OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/lmtp2nntp_option.c versions 1.8 and 1.9
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/lmtp2nntp/lmtp2nntp_option.c 1.8 -> 1.9

--- lmtp2nntp_option.c   2002/01/31 15:53:43     1.8
+++ lmtp2nntp_option.c   2002/02/04 13:52:15     1.9
@@ -126,7 +126,7 @@
 }
 
 
-lmtp2nntp_option_rc_t option_register(lmtp2nntp_option_t *o, char *longname, char shortname, optiontype_t type, optionloop_cb_t *cb, char *cbctx, char *descrip, char *argdescrip)
+lmtp2nntp_option_rc_t option_register(lmtp2nntp_option_t *o, char *longname, char shortname, optiontype_t type, char *def, char *descrip, char *argdescrip, optionloop_cb_t *cb, char *cbctx)
 {
     lmtp2nntp_option_rc_t rc = VAL_OK;
     optionval_t *oc;
@@ -151,10 +151,12 @@
     oc->cbctx        = cbctx;
     oc->val          = o->vo;
     oc->number       = o->pi + 1; /* 0 is a reserved val in popt, so offset 1 */
-    oc->data.f       = 0;
-    oc->data.s       = NULL; /* just in case a pointer is larger than int */
-    oc->data.m       = NULL;
-    oc->ndata        = 0;
+    switch (type) {
+        case OPT_FLAG:   oc->data.f       = 0;    break;
+        case OPT_SINGLE: oc->data.s       = def;  break;
+        case OPT_MULTI:  oc->data.m       = NULL; break;
+    }
+    oc->ndata        = (type == OPT_SINGLE && def != NULL) ? 1 : 0;
     if (   (                      oc->longname   == NULL)
         || (descrip    != NULL && oc->descrip    == NULL)
         || (argdescrip != NULL && oc->argdescrip == NULL)
@@ -601,41 +603,41 @@
     if (o == NULL)
         return OPTION_ERR_ARG;
 
-    (void)option_register(o, "childsmax",          'C', OPT_SINGLE, &stdsyntax, "m/[0-9]+/", "foo01", "childsmax" );
-    (void)option_register(o, "daemonize",          'D', OPT_FLAG,   &stdsyntax, NULL,        "foo02", NULL );
-    (void)option_register(o, "kill",               'K', OPT_FLAG,   &stdsyntax, NULL,        "foo03", NULL );
-    (void)option_register(o, "pidfile",            'P', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo04", "pidfile" );
-    (void)option_register(o, "veryverbose",        'V', OPT_FLAG,   &stdsyntax, NULL,        "foo05", NULL );
-    (void)option_register(o, "acl",                'a', OPT_MULTI,  &stdsyntax, "m/.*/",     "foo06", "addr[/mask]" );
-    (void)option_register(o, "bind",               'b', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo07", "addr[:port]|-|path[:perms]" );
-    (void)option_register(o, "client",             'c', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo08", "addr[:port]" );
-    (void)option_register(o, "destination",        'd', OPT_MULTI,  &stdsyntax, "m/.*/",     "foo09", "addr[:port]" );
-    (void)option_register(o, "groupmode",          'g', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo10", "groupmode" );
-    (void)option_register(o, "headervalue",        'h', OPT_MULTI,  &stdsyntax, "m/.*/",     "foo11", "header: value" );
-    (void)option_register(o, "include",            'i', OPT_MULTI,  &includeit, "m/.*/",     "foo12", "configfile" );
-    (void)option_register(o, "size",               's', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo13", "bytes" );
-    (void)option_register(o, "timeoutlmtp",        NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo14", "sec" );
-    (void)option_register(o, "timeoutlmtpaccept",  NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "fo14a", "sec" );
-    (void)option_register(o, "timeoutlmtpread",    NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo15", "sec" );
-    (void)option_register(o, "timeoutlmtpwrite",   NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo16", "sec" );
-    (void)option_register(o, "timeoutnntp",        NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo17", "sec" );
-    (void)option_register(o, "timeoutnntpconnect", NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "fo17a", "sec" );
-    (void)option_register(o, "timeoutnntpread",    NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo18", "sec" );
-    (void)option_register(o, "timeoutnntpwrite",   NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo19", "sec" );
-    (void)option_register(o, "mailfrom",           'm', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo20", "regex" );
-    (void)option_register(o, "nodename",           'n', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo21", "nodename" );
-    (void)option_register(o, "operationmode",      'o', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo22", "post|feed" );
-    (void)option_register(o, "l2spec",             'l', OPT_SINGLE, &stdsyntax, "m/.*/",     "L2 channel tree textual specification", "l2spec" );
-    (void)option_register(o, "user",               'u', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo24", "uid|name" );
-    (void)option_register(o, "version",            'v', OPT_FLAG,   &stdsyntax, NULL,        "fo24a", NULL );
-    (void)option_register(o, "restrictheader",     'r', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo25", "regex" );
-    (void)option_register(o, "newsgroup",          NUL, OPT_MULTI,  &stdsyntax, "m/.*/",     "foo26", "newsgroup");
+    (void)option_register(o, "childsmax",          'C', OPT_SINGLE,  "10",        "childs to spawn at max",            "childsmax",                  &stdsyntax, "m/.*/" ); //"m/[0-9]+/" );
+    (void)option_register(o, "daemonize",          'D', OPT_FLAG,    NULL,        "detach from terminal",              NULL,                         &stdsyntax, NULL );
+    (void)option_register(o, "kill",               'K', OPT_FLAG,    NULL,        "kill a previously run daemon",      NULL,                         &stdsyntax, NULL );
+    (void)option_register(o, "pidfile",            'P', OPT_SINGLE,  NULL,        "file containing pid",               "pidfile",                    &stdsyntax, "m/.*/" );
+    (void)option_register(o, "veryverbose",        'V', OPT_FLAG,    NULL,        "FIXME",                             NULL,                         &stdsyntax, NULL );
+    (void)option_register(o, "acl",                'a', OPT_MULTI,   NULL,        "LMTP server access control list",   "addr[/mask]",                &stdsyntax, "m/.*/" );
+    (void)option_register(o, "bind",               'b', OPT_SINGLE,  NULL,        "LMTP server bind",                  "addr[:port]|-|path[:perms]", &stdsyntax, "m/.*/" );
+    (void)option_register(o, "client",             'c', OPT_SINGLE,  NULL,        "NNTP client bind",                  "addr[:port]",                &stdsyntax, "m/.*/" );
+    (void)option_register(o, "destination",        'd', OPT_MULTI,   NULL,        "NNTP client destination",           "addr[:port]",                &stdsyntax, "m/.*/" );
+    (void)option_register(o, "groupmode",          'g', OPT_SINGLE,  "arg",       "arg|envelope|header",               "groupmode",                  &stdsyntax, "m/.*/" ); //"m/(arg|envelope|header)/" );
+    (void)option_register(o, "headervalue",        'h', OPT_MULTI,   NULL,        "header/ value added to message",    "header: value",              &stdsyntax, "m/.*/" );
+    (void)option_register(o, "include",            'i', OPT_MULTI,   NULL,        "configfile to include",             "configfile",                 &includeit, "m/.*/" );
+    (void)option_register(o, "size",               's', OPT_SINGLE,  "8388608",   "maximum message size",              "bytes",                      &stdsyntax, "m/.*/" ); //"m/[0-9]+/" );
+    (void)option_register(o, "timeoutlmtp",        NUL, OPT_SINGLE,  NULL,        "LMTP server default timeout",       "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "timeoutlmtpaccept",  NUL, OPT_SINGLE,  "0",         "LMTP server accept timeout",        "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "timeoutlmtpread",    NUL, OPT_SINGLE,  "10",        "LMTP server read timeout",          "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "timeoutlmtpwrite",   NUL, OPT_SINGLE,  "10",        "LMTP server write timeout",         "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "timeoutnntp",        NUL, OPT_SINGLE,  NULL,        "NNTP client default timeout",       "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "timeoutnntpconnect", NUL, OPT_SINGLE,  "360",       "NNTP client connect timeout",       "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "timeoutnntpread",    NUL, OPT_SINGLE,  "60",        "NNTP client read timeout",          "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "timeoutnntpwrite",   NUL, OPT_SINGLE,  "60",        "NNTP client write timeout",         "sec",                        &stdsyntax, "m/.*/" );
+    (void)option_register(o, "mailfrom",           'm', OPT_SINGLE,  NULL,        "mail from envelope restriction",    "regex",                      &stdsyntax, "m/.*/" );
+    (void)option_register(o, "nodename",           'n', OPT_SINGLE,  NULL,        "nodename",                          "name",                       &stdsyntax, "m/.*/" );
+    (void)option_register(o, "operationmode",      'o', OPT_SINGLE,  "553/5.7.1", "fakestatus or operationmode",       "abc/a.d.e|post|feed",        &stdsyntax, "m/.*/" ); //"m/([0-9]{3}\\/[0-9]\\.[0-9]\\.[0-9]|post|feed)/" ); /* 553 = Requested action not taken: mailbox name not allowed, 5.7.1 =  Delivery not authorized, message refused */
+    (void)option_register(o, "l2spec",             'l', OPT_SINGLE,  NULL,        "L2 channel tree specification",     "l2spec",                     &stdsyntax, "m/.*/" );
+    (void)option_register(o, "user",               'u', OPT_SINGLE,  NULL,        "user",                              "uid|name",                   &stdsyntax, "m/.*/" );
+    (void)option_register(o, "version",            'v', OPT_FLAG,    NULL,        "print version",                     NULL,                         &stdsyntax, NULL );
+    (void)option_register(o, "restrictheader",     'r', OPT_SINGLE,  NULL,        "header restriction",                "regex",                      &stdsyntax, "m/.*/" );
+    (void)option_register(o, "newsgroup",          NUL, OPT_MULTI,   NULL,        "article destination",               "newsgroup",                  &stdsyntax, "m/.*/" );
 
 #if 0
     {
         int i;
 
-        for (i=0; i<26; i++) {
+        for (i=0; i<29; i++) {
             printf("DEBUG: o->pt[%3d].longName   = %s   \n", i,       o->pt[i].longName  );
             printf("DEBUG: o->pt[%3d].shortName  = %c   \n", i,       o->pt[i].shortName );
             printf("DEBUG: o->pt[%3d].argInfo    = %d   \n", i,       o->pt[i].argInfo   );

CVSTrac 2.0.1