OSSP CVS Repository

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

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.13 -> 1.14

--- lmtp2nntp_config.c   2002/01/23 15:55:21     1.13
+++ lmtp2nntp_config.c   2002/01/24 08:54:25     1.14
@@ -92,9 +92,11 @@
     val_t              *val;            /* val we are registered under */
                     /**/
     int                 number;         /* number of this option for popt */
-    union {                             /* option data as read from configuration */
+    struct {                             /* option data as read from configuration */
         int f;                          /* OPT_FLAG */
+        void *foo1, *foo2, *foo3, *foo4, *foo5, *foo6, *foo7, *foo8, *foo9; 
         char *s;                        /* OPT_SINGLE */
+        void *bar1, *bar2, *bar3, *bar4, *bar5, *bar6, *bar7, *bar8, *bar9; 
         char **m;                       /* OPT_MULTI */
     } data;
     int ndata;
@@ -112,15 +114,24 @@
 
     switch (oc->type) {
         case OPT_FLAG:
-            printf("DEBUG: <%5s>, name=<%20s>, OPT_FLAG,   desc=<%20s>, data@%.8lx->[%d]%d\n",     (char *)ctx, name, desc, (long)oc, oc->ndata, oc->data.f);
-            break;
+            printf("DEBUG: <%5s>, name=<%20s>, OPT_FLAG,   desc=<%20s>, data@%.8lx->[%d]%d\n",     (char *)ctx, name, desc, (long)oc, oc->ndata, oc->data.f); break;
         case OPT_SINGLE:
             printf("DEBUG: <%5s>, name=<%20s>, OPT_SINGLE, desc=<%20s>, data@%.8lx->[%d]\"%s\"\n", (char *)ctx, name, desc, (long)oc, oc->ndata, oc->data.s == NULL ? "NULL" : oc->data.s);
             break;
         case OPT_MULTI:
             printf("DEBUG: <%5s>, name=<%20s>, OPT_MULTI,  desc=<%20s>, data@%.8lx->[%d]%.8lx\n",  (char *)ctx, name, desc, (long)oc, oc->ndata, (long)oc->data.m);
             for (i = 0; i < oc->ndata; i++) {
-                printf("DEBUG:        [%3d] \"%s\"\n", i, oc->data.m[i]);
+#if 0
+                {
+                    int j;
+                    printf("DEBUG: ");
+                    for (j=0; j<8; j++) printf("%.2x ", (unsigned char)oc->data.m[i][j]);
+                    printf(" ");
+                    for (j=0; j<8; j++) printf("%c", isprint(oc->data.m[i][j]) ? oc->data.m[i][j] : '.');
+                    printf(" ");
+                }
+#endif
+                printf("DEBUG: [%3d] %.8lx \"%s\"\n", i, (long)oc->data.m[i], oc->data.m[i]);
             }
             break;
         default:
@@ -385,7 +396,7 @@
     //printf("DEBUG: oc->type=%d\n", oc->type);
     switch (oc->type) {
         case OPT_FLAG:
-            printf("DEBUG: flag   %20s = %s should match %s\n", oc->longname, arg, cbctx);
+            //printf("DEBUG: flag   %20s = %s should match %s\n", oc->longname, arg, cbctx);
             if (arg != NULL || cbctx != NULL)
                 return OPTION_ERR_ARG;
             if (oc->ndata >= 1)
@@ -394,57 +405,60 @@
             oc->ndata = 1;
             break;
         case OPT_SINGLE:
-            printf("DEBUG: single %20s = %s should match %s\n", oc->longname, arg, cbctx);
+            //printf("DEBUG: single %20s = %s should match %s\n", oc->longname, arg, cbctx);
             if (arg == NULL)
                 return OPTION_ERR_ARG;
             /* use this if repeated overwriting definitions are not allowed
              *  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;
             break;
         case OPT_MULTI:
-            printf("DEBUG: multi  %20s = %s should match %s\n", oc->longname, arg, cbctx);
+            //printf("DEBUG: multi  %20s = %s should match %s\n", oc->longname, arg, cbctx);
             if (arg == NULL)
                 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
+            /* malloc/realloc                                 existing + this new + terminating NULL */
             if (oc->data.m == NULL) {
-                if ((oc->data.m = (char **)malloc(             (        1 + 1) * sizeof(char **))) == NULL)
+                //printf("DEBUG: before  malloc, oc->data.m = %.8lx - ", (long)oc->data.m);
+                //printf("DEBUG: requesting %d bytes\n",         (        0 + 1 + 1) * sizeof(char **));
+                if ((oc->data.m = (char **)malloc(             (        0 + 1 + 1) * sizeof(char **))) == NULL)
                     return OPTION_ERR_MEM;
+                //printf("DEBUG: after   malloc, oc->data.m = %.8lx\n", (long)oc->data.m);
             }
             else {
-                if ((oc->data.m = (char **)realloc(oc->data.m, (oc->ndata + 1) * sizeof(char **))) == NULL)
+                //printf("DEBUG: before realloc, oc->data.m = %.8lx\n", (long)oc->data.m);
+                //printf("DEBUG: requesting %d bytes\n",         (oc->ndata + 1 + 1) * sizeof(char **));
+                if ((oc->data.m = (char **)realloc(oc->data.m, (oc->ndata + 1 + 1) * sizeof(char **))) == NULL)
                     return OPTION_ERR_MEM;
+                //printf("DEBUG: after  realloc, oc->data.m = %.8lx\n", (long)oc->data.m);
             }
             if ((oc->data.m[oc->ndata] = strdup(arg)) == NULL)
                     return OPTION_ERR_MEM;
             oc->ndata++;
             oc->data.m[oc->ndata] = NULL;
-#if 1
+#if 0
             {
                 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]);
+                for (i=0; i<=oc->ndata; i++)
+                    printf("DEBUG: oc->data[%3d] at %.8lx points to  %.8lx = %s\n", i, (long)&oc->data.m[i], (long)oc->data.m[i], oc->data.m[i]);
             }
 #endif
             break;
@@ -645,6 +659,8 @@
     optionconfig_t *oc;
     int i;
 
+    //printf("DEBUG: option_destroy %.8lx\n", (long)o);
+
     if (o == NULL)
         return OPTION_ERR_ARG;
 

CVSTrac 2.0.1