OSSP CVS Repository

ossp - Check-in [1750]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1750
Date: 2002-Jan-31 16:09:25 (local)
2002-Jan-31 15:09:25 (UTC)
User:thl
Branch:
Comment: moved --restrictheader option
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_config.c      1.29 -> 1.30     28 inserted, 0 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_main.c      1.22 -> 1.23     0 inserted, 16 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_option.c      1.4 -> 1.5     1 inserted, 1 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.29 -> 1.30

--- lmtp2nntp_config.c   2002/01/31 15:03:51     1.29
+++ lmtp2nntp_config.c   2002/01/31 15:09:25     1.30
@@ -564,6 +564,34 @@
     }
     catch (ex)
         rethrow;
+
+    /* --restrictheader SINGLE */
+    try {
+        char *cp;
+
+        if (   (val_get(ctx->val, "option.restrictheader", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--restrictheader = \"%s\"", ov->data.s);
+
+        ctx->option_restrictheader = strdup(ov->data.s);
+        /* protect ourselfs from the substitution of backreferences.
+         * Missing varargs would cause segfaults.  Rewrite capturing
+         * brackets to clustering syntax. Use poor man's s///g
+         * simulator as current str library doesn't support global
+         * substitution */
+        while (str_parse(ctx->option_restrictheader, "s/(.*?)\\((?!\\?:)(.*)/$1(?:$2/", &cp) > 0) {
+            free(ctx->option_restrictheader);
+            ctx->option_restrictheader = cp;
+        }
+        if (str_parse("<>", ctx->option_restrictheader) == -1) {
+            log1(ctx, ERROR, "option --restrictheader, illegal regex (%s)", ctx->option_restrictheader);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
 CUS:
     return;
 }


ossp-pkg/lmtp2nntp/lmtp2nntp_main.c 1.22 -> 1.23

--- lmtp2nntp_main.c     2002/01/31 15:03:23     1.22
+++ lmtp2nntp_main.c     2002/01/31 15:09:25     1.23
@@ -450,22 +450,6 @@
     /* read in the arguments */
     while ((i = getopt(argc, argv, "C:DKP:Va:b:c:d:g:h:l:m:n:o:r:s:t:u:v")) != -1) {
         switch (i) {
-            case 'r': /*POD [B<-r> I<restrictheader>] */
-                ctx->option_restrictheader = strdup(optarg);
-                /* protect ourselfs from the substitution of backreferences.
-                 * Missing varargs would cause segfaults.  Rewrite capturing
-                 * brackets to clustering syntax. Use poor man's s///g
-                 * simulator as current str library doesn't support global
-                 * substitution */
-                while (str_parse(ctx->option_restrictheader, "s/(.*?)\\((?!\\?:)(.*)/$1(?:$2/", &cp) > 0) {
-                    free(ctx->option_restrictheader);
-                    ctx->option_restrictheader = cp;
-                }
-                if (str_parse("<>", ctx->option_restrictheader) == -1) {
-                    fprintf(stderr, "%s:Error: illegal regex \"%s\" to option -r.\n", ctx->progname, ctx->option_restrictheader);
-                    CU(ERR_EXECUTION);
-                }
-                break;
             case 's': /*POD [B<-s> I<size>] */
                 ctx->option_maxmessagesize = atoi(optarg);
                 if(ctx->option_maxmessagesize < 64) {


ossp-pkg/lmtp2nntp/lmtp2nntp_option.c 1.4 -> 1.5

--- lmtp2nntp_option.c   2002/01/30 16:41:02     1.4
+++ lmtp2nntp_option.c   2002/01/31 15:09:25     1.5
@@ -625,7 +625,7 @@
     (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, "uid",                'u', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo24", "number|name" );
-    (void)option_register(o, "restrictheader",     'r', OPT_MULTI,  &stdsyntax, "m/.*/",     "foo25", "regex" );
+    (void)option_register(o, "restrictheader",     'r', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo25", "regex" );
     (void)option_register(o, "newsgroup",          NUL, OPT_MULTI,  &stdsyntax, "m/.*/",     "foo26", "newsgroup");
 
 #if 0

CVSTrac 2.0.1