Index: ossp-pkg/lmtp2nntp/lmtp2nntp_config.c RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.c,v rcsdiff -q -kk '-r1.29' '-r1.30' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.c,v' 2>/dev/null --- 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; } Index: ossp-pkg/lmtp2nntp/lmtp2nntp_main.c RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_main.c,v rcsdiff -q -kk '-r1.22' '-r1.23' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_main.c,v' 2>/dev/null --- 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] */ - 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] */ ctx->option_maxmessagesize = atoi(optarg); if(ctx->option_maxmessagesize < 64) { Index: ossp-pkg/lmtp2nntp/lmtp2nntp_option.c RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_option.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_option.c,v' 2>/dev/null --- 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