Index: ossp-pkg/lmtp2nntp/fixme.h RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/fixme.h,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/fixme.h,v' 2>/dev/null --- fixme.h 2002/01/31 13:54:21 1.7 +++ fixme.h 2002/01/31 15:03:23 1.8 @@ -113,4 +113,10 @@ GROUPMODE_HEADER }; +enum { + OPERATIONMODE_FAKE, + OPERATIONMODE_POST, + OPERATIONMODE_FEED +}; + #endif /* __FIXME_H__ */ Index: ossp-pkg/lmtp2nntp/lmtp2nntp_config.c RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.c,v rcsdiff -q -kk '-r1.27' '-r1.28' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.c,v' 2>/dev/null --- lmtp2nntp_config.c 2002/01/31 14:47:13 1.27 +++ lmtp2nntp_config.c 2002/01/31 15:03:23 1.28 @@ -513,6 +513,57 @@ } catch (ex) rethrow; + + /* --operationmode SINGLE */ + try { + char *cp; + + if ( (val_get(ctx->val, "option.operationmode", &ov) != VAL_OK) + || (ov->ndata != 1) + || (ov->data.s == NULL) + ) throw(0,0,0); + log1(ctx, TRACE, "--operationmode = \"%s\"", ov->data.s); + + cp = strdup(ov->data.s); + if (strcasecmp(cp, "post") == 0) + ctx->option_operationmode = OPERATIONMODE_POST; + else if (strcasecmp(cp, "feed") == 0) + ctx->option_operationmode = OPERATIONMODE_FEED; + else { + if (strlen(cp) != 9) { + log1(ctx, ERROR, "option --operationmode, invalid length (%s)", cp); + throw(0,0,0); + } + if (cp[3] != '/') { + log1(ctx, ERROR, "option --operationmode, missing slash (%s)", cp); + throw(0,0,0); + } + cp[3] = NUL; + ctx->option_operationmodefakestatus = &cp[0]; + ctx->option_operationmodefakedsn = &cp[4]; + if ( strlen(ctx->option_operationmodefakestatus) != 3 + || !isdigit((int)ctx->option_operationmodefakestatus[0]) + || !isdigit((int)ctx->option_operationmodefakestatus[1]) + || !isdigit((int)ctx->option_operationmodefakestatus[2]) + ) { + log1(ctx, ERROR, "option --operationmode, invalid status code (%s)", cp); + throw(0,0,0); + } + if ( (strlen(ctx->option_operationmodefakedsn) != 5) + || !isdigit((int)ctx->option_operationmodefakedsn[0]) + || (ctx->option_operationmodefakedsn[1] != '.') + || !isdigit((int)ctx->option_operationmodefakedsn[2]) + || (ctx->option_operationmodefakedsn[3] != '.') + || !isdigit((int)ctx->option_operationmodefakedsn[4]) + || (ctx->option_operationmodefakedsn[0] != ctx->option_operationmodefakestatus[0]) + ) { + log1(ctx, ERROR, "option --operationmode, invalid dsn code (%s)", cp); + 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.21' '-r1.22' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_main.c,v' 2>/dev/null --- lmtp2nntp_main.c 2002/01/31 14:47:13 1.21 +++ lmtp2nntp_main.c 2002/01/31 15:03:23 1.22 @@ -189,12 +189,6 @@ static void lmtp_gfs_rset(lmtp2nntp_t *); static void lmtp_gfs_quit(lmtp2nntp_t *); -enum { - OPERATIONMODE_FAKE, - OPERATIONMODE_POST, - OPERATIONMODE_FEED -}; - /* * print usage information */ @@ -456,46 +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 'o': /*POD [B<-o> I] */ - if (strcasecmp(optarg, "post") == 0) - ctx->option_operationmode = OPERATIONMODE_POST; - else if (strcasecmp(optarg, "feed") == 0) - ctx->option_operationmode = OPERATIONMODE_FEED; - else { - if (strlen(optarg) != 9) { - fprintf(stderr, "%s:Error: Invalid format or length \"%s\" to option -o\n", ctx->progname, optarg); - CU(ERR_EXECUTION); - } - - if (optarg[3] != '/') { - fprintf(stderr, "%s:Error: Invalid format or missing slash \"%s\" to option -o\n", ctx->progname, optarg); - CU(ERR_EXECUTION); - } - - optarg[3] = NUL; - ctx->option_operationmodefakestatus = &optarg[0]; - ctx->option_operationmodefakedsn = &optarg[4]; - - if ( strlen(ctx->option_operationmodefakestatus) != 3 - || !isdigit((int)ctx->option_operationmodefakestatus[0]) - || !isdigit((int)ctx->option_operationmodefakestatus[1]) - || !isdigit((int)ctx->option_operationmodefakestatus[2])) { - fprintf(stderr, "%s:Error: Invalid status in format \"%s\" to option -o\n", ctx->progname, optarg); - CU(ERR_EXECUTION); - } - - if ( (strlen(ctx->option_operationmodefakedsn) != 5) - || !isdigit((int)ctx->option_operationmodefakedsn[0]) - || (ctx->option_operationmodefakedsn[1] != '.') - || !isdigit((int)ctx->option_operationmodefakedsn[2]) - || (ctx->option_operationmodefakedsn[3] != '.') - || !isdigit((int)ctx->option_operationmodefakedsn[4]) - || (ctx->option_operationmodefakedsn[0] != ctx->option_operationmodefakestatus[0])) { - fprintf(stderr, "%s:Error: Invalid dsn in format \"%s\" to option -o\n", ctx->progname, optarg); - CU(ERR_EXECUTION); - } - } - break; case 'r': /*POD [B<-r> I] */ ctx->option_restrictheader = strdup(optarg); /* protect ourselfs from the substitution of backreferences.