]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
clients: Add -O option
authorAidan Van Dyk <aidan@ifax.com>
Fri, 12 Jun 2009 15:31:53 +0000 (11:31 -0400)
committerAidan Van Dyk <aidan@ifax.com>
Fri, 21 Aug 2009 20:26:59 +0000 (16:26 -0400)
This adds a -O <option> syntax to the HylaFAX clients.  This is
similar to the -c <option> on the server counterparts.  Unfortunately
 -c is already used by many clients (and -O is used for other things on
the server parts).

This gives you the ability to set any config option on a per-invocation
basis, like:
faxstat -O 'JobFmt: %j,%s' -O 'RecvFmt: %m' -r -d -s

16 files changed:
faxalter/faxalter.c++
faxmail/faxmail.c++
faxrm/faxrm.c++
faxstat/faxstat.c++
man/faxalter.1
man/faxmail.1
man/faxrm.1
man/faxstat.1
man/sendfax.1
man/sendpage.1
man/textfmt.1
sendfax/sendfax.c++
sendpage/sendpage.c++
util/faxfetch.c++
util/faxwatch.c++
util/textfmt.c++

index db04a699859f73ab8f6c10b600b58c32bcfab70d..4d0f6ff29d6523fe66b913ef6b84959d23fbf13d 100644 (file)
@@ -100,7 +100,7 @@ faxAlterApp::run(int argc, char** argv)
     int rc;
 
     int c;
-    while ((c = Sys::getopt(argc, argv, "Ca:d:h:k:m:n:P:t:ADQRgprv")) != -1)
+    while ((c = Sys::getopt(argc, argv, "Ca:d:h:k:m:n:O:P:t:ADQRgprv")) != -1)
        switch (c) {
        case 'C':
            errorexit = false;
@@ -200,6 +200,9 @@ faxAlterApp::run(int argc, char** argv)
                script.append("\n");
            }
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
        case 'p':                       // send now (push)
            script.append(groups ? "JGPARM " : "JPARM ");
            script.append("SENDTIME NOW\n");
index 8cb702a4e9ec6a0d6411f8e41883af283ac11c62..8a7ced42569120460aac1294d693b52b21a9662c 100644 (file)
@@ -158,7 +158,7 @@ faxMailApp::run(int argc, char** argv)
     readConfig(FAX_LIBDATA "/faxmail.conf");
     readConfig(FAX_USERCONF);
 
-    while ((c = Sys::getopt(argc, argv, "12b:cC:df:H:i:M:nNp:rRs:t:Tu:vW:")) != -1)
+    while ((c = Sys::getopt(argc, argv, "12b:cC:df:H:i:M:nNO:p:rRs:t:Tu:vW:")) != -1)
        switch (c) {
        case '1': case '2':             // format in 1 or 2 columns
            setNumberOfColumns(c - '0');
@@ -193,6 +193,9 @@ faxMailApp::run(int argc, char** argv)
        case 'N':
            formatEnvHeaders = false;
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
        case 'p':                       // point size
            setTextPointSize(TextFormat::inch(optarg));
            break;
index c5f57df734dfee34e8a357705454343d7390ad15..f9f4af2b4973898799477c19ae9e45477bc81f87 100644 (file)
@@ -59,7 +59,7 @@ faxRmApp::run(int argc, char** argv)
     bool docs = false;
     bool useadmin = false;
 
-    while ((c = Sys::getopt(argc, argv, "ah:dv")) != -1)
+    while ((c = Sys::getopt(argc, argv, "ah:dO:v")) != -1)
        switch (c) {
        case 'a':
            useadmin = true;
@@ -71,6 +71,9 @@ faxRmApp::run(int argc, char** argv)
        case 'h':                       // server's host
            setHost(optarg);
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
        case 'v':
            setVerbose(true);
            break;
index cf6c9e442584e82dc3a6f54ea73cacbed992c4a0..2fd878bb8988cf82201e8dbd7570e6ea304b5166 100644 (file)
@@ -63,7 +63,7 @@ faxStatApp::run(int argc, char** argv)
     dirs.append(FAX_STATUSDIR);                // server status
     bool checkInfo = false;
     int c;
-    while ((c = Sys::getopt(argc, argv, "h:adgfilrsv")) != -1)
+    while ((c = Sys::getopt(argc, argv, "h:adgfilO:rsv")) != -1)
        switch (c) {
        case 'a':                       // display archived jobs
            dirs.append(FAX_ARCHDIR);
@@ -86,6 +86,9 @@ faxStatApp::run(int argc, char** argv)
        case 'l':                       // use local timezone for dates & times
            setTimeZone(TZ_LOCAL);
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
        case 'r':                       // display receive queue
            dirs.append(FAX_RECVDIR);
            break;
index 1fc4cd08b1b360a84f24fbccc02ea8ddb6654e60..43ecea2c42dc8dfd99eeb29dc4670919daae3c40 100644 (file)
@@ -33,6 +33,9 @@ faxalter \- alter parameters of a \*(Fx job queued for transmission
 .SH SYNOPSIS
 .B faxalter
 [
+.B \-O
+.I config
+] [
 .I options
 ]
 .IR id ...
@@ -116,6 +119,16 @@ Specifying ``any'' for
 .I modem
 causes the jobs to be scheduled for any available modem.
 .TP 10
+.BI \-O " config"
+Treat
+.I config
+as a configuration parameter specification that is interpreted
+after reading the configuration file.
+For example, ``\-O Host:fax.example.com'' would set the
+.B Host
+configuration parameter to ``fax.example.com'', overriding any setting in
+the configuration file.
+.TP 10
 .B \-p
 The jobs should be
 .IR pushed ;
index 88bf5c92757e5ec93097754c4dd30f1cb12a116c..765a13e70688414e875b94e59f377e18f7242db2 100644 (file)
@@ -34,6 +34,9 @@ faxmail \- \*(Fx mail-to-fax gateway application
 .SH SYNOPSIS
 .B faxmail
 [
+.B \-O
+.I config
+] [
 .I options
 ] [
 .I destination
@@ -313,6 +316,16 @@ Suppress auto cover page generation.
 .B \-N
 Suppress formatting of mail envelope headers.
 .TP 10
+.BI \-O " config"
+Treat
+.I config
+as a configuration parameter specification that is interpreted
+after reading the configuration file.
+For example, ``\-O Host:fax.example.com'' would set the
+.B Host
+configuration parameter to ``fax.example.com'', overriding any setting in
+the configuration file.
+.TP 10
 .BI \-p " size"
 Set all text using
 .I size
index 7b24b9a87a725e8619dd9fad01377aa9cf0f4e9c..85fbcaa8a1d23474c3f3b6fbf9e71b9e8506f381 100644 (file)
@@ -37,6 +37,9 @@ faxrm \- remove a \*(Fx job or document from a server
 ] [
 .B \-d
 ] [
+.B \-O
+.I config
+] [
 .B \-v
 ] [
 .B \-h
@@ -113,6 +116,16 @@ per-user file and then in the system-wide file).
 If all of the above fails, then
 .I faxrm
 attempts to contact a server on the machine where it is run.
+.TP 10
+.BI \-O " config"
+Treat
+.I config
+as a configuration parameter specification that is interpreted
+after reading the configuration file.
+For example, ``\-O Host:fax.example.com'' would set the
+.B Host
+configuration parameter to ``fax.example.com'', overriding any setting in
+the configuration file.
 .TP
 .B \-v
 Trace the protocol messages to and from the server.
index facbd44de73161a554ae9f6dec2ca930b9076b63..ffc81a5687e323b14bf6e38f57e68507cd9f5598 100644 (file)
@@ -33,6 +33,9 @@ faxstat \- display \*(Fx status
 .SH SYNOPSIS
 .B faxstat
 [
+.B \-O
+.I config
+] [
 .I options
 ]
 .SH DESCRIPTION
@@ -158,6 +161,16 @@ The
 string defines the content and format of information reported with
 this option (see below).
 .TP 10
+.BI \-O " config"
+Treat
+.I config
+as a configuration parameter specification that is interpreted
+after reading the configuration file.
+For example, ``\-O Host:fax.example.com'' would set the
+.B Host
+configuration parameter to ``fax.example.com'', overriding any setting in
+the configuration file.
+.TP 10
 .B \-s
 Display the status of jobs in the send queue on the server machine.
 The
index b9090d705f06327d9ff5ea0c6a078cf36df79217..2d2b417a005f1a13aeefec7ae613becec84370fc 100644 (file)
@@ -34,6 +34,9 @@ sendfax \- submit a facsimile job for transmission
 .SH SYNOPSIS
 .B sendfax
 [
+.B \-O
+.I config
+] [
 .I options
 ] [
 .IR files ...
@@ -464,6 +467,16 @@ environment variable that may be set for the same purpose.
 If neither is specified, the user's 
 current login name is used.
 .TP 12
+.BI \-O " config"
+Treat
+.I config
+as a configuration parameter specification that is interpreted
+after reading the configuration file.
+For example, ``\-O Host:fax.example.com'' would set the
+.B Host
+configuration parameter to ``fax.example.com'', overriding any setting in
+the configuration file.
+.TP 12
 .B \-p
 Poll each destination for any available documents.
 If a poll request is made together with document transmission, the
index 4c381169d28f5e17f7096ee3bdcadfdf1e5baf08..5576c4f51e95b811d88c5543de6698a7776ebe2f 100644 (file)
@@ -35,6 +35,9 @@ sendpage \- submit a pager job for transmission
 .SH SYNOPSIS
 .B sendpage
 [
+.B \-O
+.I config
+] [
 .I options
 ] [
 .IR message ...
@@ -225,6 +228,16 @@ page has been delivered to the service provider (default).
 This option is meaningful only when communicating with a
 \*(Fx server.
 .TP 12
+.BI \-O " config"
+Treat
+.I config
+as a configuration parameter specification that is interpreted
+after reading the configuration file.
+For example, ``\-O Host:fax.example.com'' would set the
+.B Host
+configuration parameter to ``fax.example.com'', overriding any setting in
+the configuration file.
+.TP 12
 .BI \-p " PIN"
 The Pager Identification Number (\s-1PIN\s+1) for a terminal 
 that is to receive the message.
index 0f1422aa2154ded9579ffa7d61f43751baafc3dd..079e63da027cf65acef96dd9216da47a6839beae 100644 (file)
@@ -34,6 +34,9 @@ textfmt \- convert text to \*(Ps\(rg for facsimile transmission
 .SH SYNOPSIS
 .B ${LIBEXEC}/textfmt
 [
+.B \-O
+.I config
+] [
 .I options
 ] [
 .IR files ...
@@ -112,6 +115,16 @@ left and right .25 inch, top .85 inch, bottom .5 inch.
 Draw an outline around each column of text; the specified number 
 defines the width of the line that is drawn.
 .TP
+.BI \-O " config"
+Treat
+.I config
+as a configuration parameter specification that is interpreted
+after reading the configuration file.
+For example, ``\-O Host:fax.example.com'' would set the
+.B Host
+configuration parameter to ``fax.example.com'', overriding any setting in
+the configuration file.
+.TP
 .BI \-p " pts"
 Set text using fonts with
 .I pts
index 3dd1acc1bf899b4731d3a41adc2f032c48a5583a..dc4fcba58d43b454309688926e2d298bf8e9a85c 100644 (file)
@@ -93,7 +93,7 @@ sendFaxApp::run(int argc, char** argv)
     int verbose = 0;
     SendFaxJob& proto = getProtoJob();
     db = new FaxDB(tildeExpand(dbName));
-    while ((c = Sys::getopt(argc, argv, "a:b:B:c:C:d:f:F:h:i:I:k:M:o:P:r:s:S:t:T:U:V:W:x:X:y:Y:z:Z:123lmnpvwADEGNR")) != -1) {
+    while ((c = Sys::getopt(argc, argv, "a:b:B:c:C:d:f:F:h:i:I:k:M:o:O:P:r:s:S:t:T:U:V:W:x:X:y:Y:z:Z:123lmnpvwADEGNR")) != -1) {
         if (c != 'h')
             optionsUsed = false;
         switch (c) {
@@ -173,6 +173,9 @@ sendFaxApp::run(int argc, char** argv)
        case 'o':                       // specify owner
            owner = optarg;
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
         case 'p':                      // submit polling request
             addPollRequest();
             break;
index 11dbdec5a517fa47c0ed2529e557ec4986e99574..b0425b1398ab8de89325c09a52df8a86e5a5fbda 100644 (file)
@@ -83,7 +83,7 @@ sendPageApp::run(int argc, char** argv)
     fxStr emsg;
     bool noText = false;               // default is to assume message text
     SNPPJob& proto = getProtoJob();
-    while ((c = Sys::getopt(argc, argv, "a:De:f:h:i:I:l:nNp:qRs:t:T:v")) != -1)
+    while ((c = Sys::getopt(argc, argv, "a:De:f:h:i:I:l:nNO:p:qRs:t:T:v")) != -1)
        switch (c) {
        case 'a':                       // time at which to transmit page
            if (!proto.setHoldTime(optarg, emsg)) {
@@ -116,6 +116,9 @@ sendPageApp::run(int argc, char** argv)
        case 'N':                       // no notification
            proto.setNotification("none");
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
        case 'p':                       // PIN
            addJob().setPIN(optarg);
            break;
index fdddfd4fc4151a61940a8280558874678e463ae8..1f5398df88db044385e71849162f0dcab6a0a164 100644 (file)
@@ -64,11 +64,14 @@ faxFetchApp::run(int argc, char** argv)
     fxStr op = "RETR ";
     u_int mode = MODE_S;
     u_long page = 0;
-    while ((c = Sys::getopt(argc, argv, "h:o:p:svz")) != -1)
+    while ((c = Sys::getopt(argc, argv, "h:o:O:p:svz")) != -1)
        switch (c) {
        case 'h':                       // server's host
            setHost(optarg);
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
        case 'p':                       // retrieve page
            op = "RETP ";
            page = atol(optarg);
index d309a153f99c0c1591e77a11223fe73d9ea52eac..d22a31628652f00b1a0ae1ec4c6e83a0565726de 100644 (file)
@@ -73,7 +73,7 @@ watchApp::run(int argc, char** argv)
     readConfig(FAX_SYSCONF);
     readConfig(FAX_USERCONF);
 
-    while ((c = Sys::getopt(argc, argv, "gh:lv")) != -1)
+    while ((c = Sys::getopt(argc, argv, "gh:lO:v")) != -1)
        switch (c) {
        case 'g':
            setTimeZone(TZ_GMT);
@@ -84,6 +84,9 @@ watchApp::run(int argc, char** argv)
        case 'l':
            setTimeZone(TZ_LOCAL);
            break;
+       case 'O':
+           readConfigItem(optarg);
+           break;
        case 'v':                       // verbose mode
            setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
            FaxClient::setVerbose(true);// protocol tracing
index 35a16097283f1dddd0b5a85d6d3e9eadf0cae2aa..6f22ff8362092028524fbc7b3eb0cd8fe04f6026 100644 (file)
@@ -88,7 +88,7 @@ main(int argc, char* argv[])
     fmt.readConfig(FAX_USERCONF);
 
     prog = argv[0];
-    while ((c = Sys::getopt(argc, argv, "f:F:m:M:o:p:s:V:12BcDGrRU")) != -1)
+    while ((c = Sys::getopt(argc, argv, "f:F:m:M:o:O:p:s:V:12BcDGrRU")) != -1)
        switch(c) {
        case '1':               // 1-column output
        case '2':               // 2-column output
@@ -129,6 +129,9 @@ main(int argc, char* argv[])
        case 'o':               // outline columns
            fmt.setOutlineMargin(TextFormat::inch(optarg));
            break;
+       case 'O':
+           fmt.readConfigItem(optarg);
+           break;
        case 'p':               // text point size
            fmt.setTextPointSize(TextFormat::inch(optarg));
            break;