OSSP CVS Repository

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

ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.5 -> 1.6

--- lmtp2nntp_config.c   2002/01/15 13:04:09     1.5
+++ lmtp2nntp_config.c   2002/01/16 09:46:52     1.6
@@ -98,10 +98,53 @@
 void die(char *); //FIXME
 void die(char *msg)
 {
-        printf("ERROR: %s", msg);
+        printf("ERROR: %s\n", msg);
             exit(-1);
 }
 
+static val_rc_t dumper(void *ctx, const char *name, int type, const char *desc, void *data)
+{
+    switch (type) {
+        case VAL_TYPE_VAL:
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_VAL,    desc=<%20s>, data@%.8lx INTERNAL\n",
+                    (char *)ctx,       desc, (long)data);
+            break;
+        case VAL_TYPE_PTR:
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_PTR,    desc=<%20s>, data@%.8lx=%.8lx\n",
+                    (char *)ctx,       desc, (long)data, *(long *)data);
+            break;
+        case VAL_TYPE_CHAR:                                                                              
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_CHAR,   desc=<%20s>, data@%.8lx='%c'\n",
+                    (char *)ctx,       desc, (long)data, *(char *)data);
+            break;
+        case VAL_TYPE_SHORT:                                                                             
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_SHORT,  desc=<%20s>, data@%.8lx=%8d\n",
+                    (char *)ctx,       desc, (long)data, *(short *)data);
+            break;
+        case VAL_TYPE_INT:                                                                               
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_INT,    desc=<%20s>, data@%.8lx=%8d\n",
+                    (char *)ctx,       desc, (long)data, *(int *)data);
+            break;
+        case VAL_TYPE_LONG:                                                                              
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_LONG,   desc=<%20s>, data@%.8lx=%8d\n",
+                    (char *)ctx,       desc, (long)data, *(long *)data);
+            break;
+        case VAL_TYPE_FLOAT:                                                                             
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_FLOAT,  desc=<%20s>, data@%.8lx=%8f\n",
+                    (char *)ctx,       desc, (long)data, *(float *)data);
+            break;
+        case VAL_TYPE_DOUBLE:                                                                            
+            fprintf(stderr, "DEBUG: <%10s> VAL_TYPE_DOUBLE, desc=<%20s>, data@%.8lx=%8f\n",
+                    (char *)ctx,       desc, (long)data, *(double *)data);
+            break;
+        default: 
+            fprintf(stderr, "DEBUG: <%10s> type = %.8lx,    desc=<%20s>, data@%.8lx\n",
+                    (char *)ctx, type, desc, (long)data);
+    }
+
+    return VAL_OK;
+}
+
 void dotconftest(int argc, char **argv) /*FIXME*/
 {
     popt_context poptCon;   /* context for parsing command-line options */
@@ -140,28 +183,95 @@
     {
         int testint = 10;
         int testintout = 100;
+        int testint2 = 20;
+        int testintout2 = 200;
         val_rc_t rc;
-        val_t *v;
+        val_t *v, *v2, *v3;
 
         if ((rc = val_create(&v)) != VAL_OK)
             die("val_create");
 
         printf("DEBUG: testint = %d, testintout = %d\n", testint, testintout);
 
-        if ((rc = val_reg(v, "foo.bar", VAL_TYPE_INT, (void *)&testint)) != VAL_OK)
+        if ((rc = val_reg(v, "foo", VAL_TYPE_INT, "foo variable", (void *)&testint)) != VAL_OK)
             die("val_reg");
 
         testint++;
-        if ((rc = val_get(v, "foo.bar", &testintout)) != VAL_OK)
+        if ((rc = val_get(v, "foo", &testintout)) != VAL_OK)
             die("val_get");
         printf("DEBUG: testint = %d, testintout = %d\n", testint, testintout);
 
-        if ((rc = val_set(v, "foo.bar", 2)) != VAL_OK)
+        if ((rc = val_set(v, "foo", 2)) != VAL_OK)
             die("val_set");
-        if ((rc = val_get(v, "foo.bar", &testintout)) != VAL_OK)
+        if ((rc = val_get(v, "foo", &testintout)) != VAL_OK)
             die("val_get");
         printf("DEBUG: testint = %d, testintout = %d\n", testint, testintout);
 
+        if ((rc = val_create(&v2)) != VAL_OK)
+            die("val_create 2");
+
+#if 0
+        if ((rc = val_reg(v, "bar", VAL_TYPE_VAL, "bar variable", (void *)&v2)) != VAL_OK)
+            die("val_reg 2");
+#endif
+        val_reg(v, "bar", VAL_TYPE_VAL, "bar variable", NULL);
+        val_set(v, "bar", v2);
+        if ((rc = val_get(v, "bar", &v3)) != VAL_OK)
+            die("val_get v3");
+
+        if ((rc = val_reg(v2, "quux", VAL_TYPE_INT, "quux variable", (void *)&testint2)) != VAL_OK)
+            die("val_reg 2b");
+
+        testint2++;
+        if ((rc = val_get(v2, "quux", &testintout2)) != VAL_OK)
+            die("val_get 2c");
+        printf("DEBUG: testint2 = %d, testintout2 = %d\n", testint2, testintout2);
+        if ((rc = val_get(v, "bar.quux", &testintout2)) != VAL_OK) {
+            fprintf(stderr, "rc=%d\n", rc);
+            die("val_get 2d");
+        }
+        printf("DEBUG: testint2 = %d, testintout2 = %d\n", testint2, testintout2);
+
+        printf("DEBUG: testint     at address %lx\n", (long)&testint);
+        printf("DEBUG: testintout  at address %lx\n", (long)&testintout);
+        printf("DEBUG: testint2    at address %lx\n", (long)&testint2);
+        printf("DEBUG: testint2out at address %lx\n", (long)&testintout2);
+
+        if ((rc = val_reg(v, "bar.ptr", VAL_TYPE_PTR, "bar ptr (&testint)", NULL)) != VAL_OK)
+            die("val_ret  for bar.ptr using inline data");
+        if ((rc = val_set(v, "bar.ptr", &testint)) != VAL_OK)
+            die("val_set  for bar.ptr using inline data");
+        if ((rc = val_reg(v, "bar.char", VAL_TYPE_CHAR, "bar character (!)", NULL)) != VAL_OK)
+            die("val_ret  for bar.char using inline data");
+        if ((rc = val_set(v, "bar.char", '!')) != VAL_OK)
+            die("val_set  for bar.char using inline data");
+        if ((rc = val_reg(v, "bar.short", VAL_TYPE_SHORT, "bar short (555)", NULL)) != VAL_OK)
+            die("val_ret  for bar.short using inline data");
+        if ((rc = val_set(v, "bar.short", 555)) != VAL_OK)
+            die("val_set  for bar.short using inline data");
+        if ((rc = val_reg(v, "bar.int", VAL_TYPE_INT, "bar integer (76543)", NULL)) != VAL_OK)
+            die("val_ret  for bar.int using inline data");
+        if ((rc = val_set(v, "bar.int", 76543)) != VAL_OK)
+            die("val_set  for bar.int using inline data");
+        if ((rc = val_reg(v, "bar.long", VAL_TYPE_LONG, "bar long (2097152)", NULL)) != VAL_OK)
+            die("val_ret  for bar.long using inline data");
+        if ((rc = val_set(v, "bar.long", 2097152)) != VAL_OK)
+            die("val_set  for bar.long using inline data");
+        if ((rc = val_reg(v, "bar.float", VAL_TYPE_FLOAT, "bar float (1.955830)", NULL)) != VAL_OK)
+            die("val_ret  for bar.float using inline data");
+        if ((rc = val_set(v, "bar.float", 1.95583)) != VAL_OK)
+            die("val_set  for bar.float using inline data");
+        if ((rc = val_reg(v, "bar.double", VAL_TYPE_DOUBLE, "bar double (3.1415+)", NULL)) != VAL_OK)
+            die("val_ret  for bar.double using inline data");
+        if ((rc = val_set(v, "bar.double", 3.14159265358979)) != VAL_OK)
+            die("val_set  for bar.double using inline data");
+
+        val_apply(v,  dumper, "v" );
+        val_apply(v2, dumper, "v2");
+
+        if ((rc = val_destroy(v2)) != VAL_OK)
+            die("val_destroy 2");
+
         if ((rc = val_destroy(v)) != VAL_OK)
             die("val_destroy");
 

CVSTrac 2.0.1