--- lmtp2nntp_config.c 2002/01/23 14:12:52 1.12
+++ lmtp2nntp_config.c 2002/01/23 15:55:21 1.13
@@ -342,8 +342,36 @@
}
//printf("DEBUG: current popt error is \"%s\"(%d)\n", popt_strerror(i), i);
//printf("DEBUG: ----\n");
- while ((cp = (char *)popt_getarg(poptCon)) != NULL) {
- printf("DEBUG: popt_getarg returned \"%s\"\n", cp);
+
+ {
+ int largc;
+ char **largv;
+ char *cpNew;
+
+ if ((largv = (char **)malloc((1 + 1) * sizeof(char **))) == NULL)
+ return OPTION_ERR_MEM;
+ largc = 0;
+ largv[largc++] = "leftover";
+ largv[largc] = NULL;
+ while ((cp = (char *)popt_getarg(poptCon)) != NULL) {
+ //printf("DEBUG: popt_getarg returned \"%s\"\n", cp);
+ if ((largv = (char **)realloc(largv, (largc + 2) * sizeof(char **))) == NULL)
+ return OPTION_ERR_MEM;
+ largv[largc++] = "--newsgroup";
+ largv[largc] = NULL;
+ if ((cpNew = strdup(cp)) == NULL)
+ return OPTION_ERR_MEM;
+ //printf("DEBUG: cpNew = \"%s\"\n", cpNew);
+ largv[largc++] = cpNew;
+ largv[largc] = NULL;
+ //printf("DEBUG: largc = \"%d\"\n", largc);
+#if 0
+ for (i=0; i<largc; i++)
+ printf("DEBUG: largv[%d] = \"%s\"\n", i, largv[i]);
+#endif
+ }
+ if (largc > 1)
+ option_parse_internal(o, largc, largv);
}
//printf("DEBUG: current popt error is \"%s\"(%d)\n", popt_strerror(i), i);
popt_freecontext(poptCon);
@@ -373,12 +401,14 @@
* if (oc->ndata >= 1 || oc->data.s != NULL)
* return OPTION_ERR_USE;
*/
+#if 0
if (cbctx != NULL)
if (str_parse(arg, cbctx) <= 0) {
//printf("DEBUG: \"%s\" does NOT match \"%s\"\n", arg, cbctx);
return OPTION_ERR_USE;
}
//printf("DEBUG: \"%s\" does match \"%s\"\n", arg, cbctx);
+#endif
if ((oc->data.s = strdup(arg)) == NULL)
return OPTION_ERR_MEM;
oc->ndata = 1;
@@ -389,12 +419,14 @@
return OPTION_ERR_ARG;
if (oc->ndata >= 1 && oc->data.m == NULL)
return OPTION_ERR_USE;
+#if 0
if (cbctx != NULL)
if (str_parse(arg, cbctx) <= 0) {
//printf("DEBUG: \"%s\" does NOT match \"%s\"\n", arg, cbctx);
return OPTION_ERR_USE;
}
//printf("DEBUG: \"%s\" does match \"%s\"\n", arg, cbctx);
+#endif
if (oc->data.m == NULL) {
if ((oc->data.m = (char **)malloc( ( 1 + 1) * sizeof(char **))) == NULL)
return OPTION_ERR_MEM;
@@ -407,6 +439,14 @@
return OPTION_ERR_MEM;
oc->ndata++;
oc->data.m[oc->ndata] = NULL;
+#if 1
+ {
+ int i;
+ printf("DEBUG: oc->ndata=%d\n", oc->ndata);
+ for (i=0; i<oc->ndata; i++)
+ printf("DEBUG: oc->data[%3d] = %s\n", i, oc->data.m[i]);
+ }
+#endif
break;
default:
return OPTION_ERR_ARG;
@@ -499,30 +539,29 @@
;/* don't care about comments */
else {
//printf("DEBUG: option = ***%s***\n", option);
+ if (argv == NULL) {
+ if ((argv = (char **)malloc( ( 1 + 1) * sizeof(char **))) == NULL)
+ return OPTION_ERR_MEM;
+ argc = 0;
+ argv[argc++] = "include";
+ argv[argc] = NULL;
+ }
+
+ if ((cpNew = (char *)malloc(2 + strlen(option) + 1)) == NULL)
+ return OPTION_ERR_MEM;
+ cpNew[0]=NUL;
+ strcat(cpNew, "--");
+ strcat(cpNew, option);
+ if ((argv = (char **)realloc(argv, (argc + 1) * sizeof(char **))) == NULL)
+ return OPTION_ERR_MEM;
+ argv[argc++] = cpNew;
+ argv[argc] = NULL;
+
if ((value = str_token(&cp, " \t", "\"'", "#", STR_STRIPQUOTES|STR_BACKSLASHESC)) == NULL)
;//printf("DEBUG: no value - section\n");
else {
while(isspace((int)*value)) value++;
//printf("DEBUG: value = ***%s***\n", value);
-
- if (argv == NULL) {
- if ((argv = (char **)malloc( ( 1 + 1) * sizeof(char **))) == NULL)
- return OPTION_ERR_MEM;
- argc = 0;
- argv[argc++] = "include";
- argv[argc] = NULL;
- }
-
- if ((cpNew = (char *)malloc(2 + strlen(option) + 1)) == NULL)
- return OPTION_ERR_MEM;
- cpNew[0]=NUL;
- strcat(cpNew, "--");
- strcat(cpNew, option);
- if ((argv = (char **)realloc(argv, (argc + 1) * sizeof(char **))) == NULL)
- return OPTION_ERR_MEM;
- argv[argc++] = cpNew;
- argv[argc] = NULL;
-
if ((cpNew = strdup(value)) == NULL)
return OPTION_ERR_MEM;
if ((argv = (char **)realloc(argv, (argc + 1) * sizeof(char **))) == NULL)
@@ -541,7 +580,6 @@
p = c;
}
}
-
return option_parse_internal(o, argc, argv);
}
|