Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Saturday, October 17, 2026

Diff for libcfg+/src/cfg+.c between version 1.12 and 1.13

version 1.12, 2001/11/30 02:10:27 version 1.13, 2001/12/01 01:27:47
Line 37  CFG_CONTEXT cfg_get_context(struct cfg_o
Line 37  CFG_CONTEXT cfg_get_context(struct cfg_o
         con->file_option_arg_separator =          con->file_option_arg_separator =
                 strdyn_create_ar(default_file_option_arg_separator);                  strdyn_create_ar(default_file_option_arg_separator);
   
         /*  
            con->line_stop_str =  
            strdyn_add_ar(con->line_stop_str, default_line_stop_str);  
            con->file_stop_str =  
            strdyn_add_ar(con->file_stop_str, default_file_stop_str);  
            con->comment_str =  
            strdyn_add_ar(con->comment_str, default_file_comment_str);  
            con->short_option_prefix =  
            strdyn_add_ar(con->short_option_prefix, default_short_option_prefix);  
            con->long_option_prefix =  
            strdyn_add_ar(con->long_option_prefix, default_long_option_prefix);  
            con->line_option_arg_separator =  
            strdyn_add_ar(con->line_option_arg_separator,  
            default_line_option_arg_separator);  
            con->file_option_arg_separator =  
            strdyn_add_ar(con->file_option_arg_separator,  
            default_file_option_arg_separator);  
          */  
   
         if (con->line_stop_str == NULL          if (con->line_stop_str == NULL
                                                         || con->file_stop_str == NULL                                                          || con->file_stop_str == NULL
                                                         || con->comment_str == NULL                                                          || con->comment_str == NULL
Line 177  int main(int argc, char **argv)
Line 158  int main(int argc, char **argv)
         int ret;          int ret;
   
         int o_nice = 20, o_verbose = 0;          int o_nice = 20, o_verbose = 0;
         char **o_name = NULL, **o_string = NULL;          char **o_name = NULL, **o_string = NULL, **o_leftover = NULL;
         int o_boolean = 0;          int o_boolean = 0;
         int o_int = -33;          int o_int = -33, **o_multi_int = NULL;
         unsigned int o_uint = 33;          unsigned int o_uint = 33, **o_multi_uint = NULL;
         long o_long = -333;          long o_long = -333, **o_multi_long = NULL;
         unsigned long o_ulong = 333;          unsigned long o_ulong = 333, **o_multi_ulong = NULL;
         float o_float = -3333.33;          float o_float = -3333.33, **o_multi_float = NULL;
         double o_double = -33333.33;          double o_double = -33333.33, **o_multi_double = NULL;
   
   
         struct cfg_option options[] = {          struct cfg_option options[] = {
Line 194  int main(int argc, char **argv)
Line 175  int main(int argc, char **argv)
   
                 { "bool", 'b', "boolean", CFG_BOOLEAN, (void *) &o_boolean, 1 },                  { "bool", 'b', "boolean", CFG_BOOLEAN, (void *) &o_boolean, 1 },
                 { "int", 'i', "int", CFG_INT, (void *) &o_int, 0 },                  { "int", 'i', "int", CFG_INT, (void *) &o_int, 0 },
                   { "multi_int", 'I', "multi int", CFG_INT + CFG_MULTI_SEPARATED, (void *) &o_multi_int,0},
                 { "uint", 'u', "unsigned int", CFG_UINT, (void *) &o_uint, 0 },                  { "uint", 'u', "unsigned int", CFG_UINT, (void *) &o_uint, 0 },
                   { "multi_uint", 'U', "multi unsigned int", CFG_UINT + CFG_MULTI,(void*)&o_multi_uint,0},
                 { "long", 'l', "long", CFG_LONG, (void *) &o_long, 0 },                  { "long", 'l', "long", CFG_LONG, (void *) &o_long, 0 },
                   { "multi_long", 'L', "multi long", CFG_LONG + CFG_MULTI_SEPARATED,(void*)&o_multi_long,0},
                 { "ulong", 'o', "unsigned long", CFG_ULONG, (void *) &o_ulong, 0 },                  { "ulong", 'o', "unsigned long", CFG_ULONG, (void *) &o_ulong, 0 },
                   { "multi_ulong",'O',"multi unsigned long",CFG_ULONG + CFG_MULTI,(void*)&o_multi_ulong,0},
                 { "float", 'f', "float", CFG_FLOAT, (void *) &o_float, 0 },                  { "float", 'f', "float", CFG_FLOAT, (void *) &o_float, 0 },
                   { "multi_float",'F',"multi float",CFG_FLOAT+CFG_MULTI_SEPARATED,(void*)&o_multi_float,0},
                 { "double", 'd', "double", CFG_DOUBLE, (void *) &o_double, 0 },                  { "double", 'd', "double", CFG_DOUBLE, (void *) &o_double, 0 },
                   { "multi_double",'D',"mdouble",CFG_DOUBLE+CFG_MULTI_SEPARATED,(void*)&o_multi_double,0},
                 { "string", 's', "string", CFG_STRING + CFG_MULTI, (void *) &o_string, 0 },                  { "string", 's', "string", CFG_STRING + CFG_MULTI, (void *) &o_string, 0 },
                   { NULL, '\0', NULL, CFG_STRING + CFG_MULTI + CFG_LEFTOVER_ARGS, (void *) &o_leftover, 0 },
                 CFG_END_OF_LIST                  CFG_END_OF_LIST
         };          };
   
Line 270  int main(int argc, char **argv)
Line 258  int main(int argc, char **argv)
   
         {          {
                 char *s;                  char *s;
                   register int i;
   
                   puts("Multi values printing:");
   
                   if (o_multi_int != NULL) {
                           printf("o_multi_int: ");
                           for (i = 0; o_multi_int[i] != NULL; i++)
                                   printf("%d, ", *(o_multi_int[i]));
                           puts("NULL");
                           strdyn_free((char**) o_multi_int);
                   }
                   else
                           puts("o_multi_int uninitialized");
   
                   if (o_multi_uint != NULL) {
                           printf("o_multi_uint: ");
                           for (i = 0; o_multi_uint[i] != NULL; i++)
                                   printf("%u, ", *(o_multi_uint[i]));
                           puts("NULL");
                           strdyn_free((char**) o_multi_uint);
                   }
                   else
                           puts("o_multi_uint uninitialized");
   
                   if (o_multi_long != NULL) {
                           printf("o_multi_long: ");
                           for (i = 0; o_multi_long[i] != NULL; i++)
                                   printf("%ld, ", *(o_multi_long[i]));
                           puts("NULL");
                           strdyn_free((char**) o_multi_long);
                   }
                   else
                           puts("o_multi_long uninitialized");
   
                   if (o_multi_ulong != NULL) {
                           printf("o_multi_ulong: ");
                           for (i = 0; o_multi_ulong[i] != NULL; i++)
                                   printf("%lu, ", *(o_multi_ulong[i]));
                           puts("NULL");
                           strdyn_free((char**) o_multi_ulong);
                   }
                   else
                           puts("o_multi_ulong uninitialized");
   
                 puts("Multi string printing:");                  if (o_multi_float != NULL) {
                           printf("o_multi_float: ");
                           for (i = 0; o_multi_float[i] != NULL; i++)
                                   printf("%f, ", *(o_multi_float[i]));
                           puts("NULL");
                           strdyn_free((char**) o_multi_float);
                   }
                   else
                           puts("o_multi_float uninitialized");
   
                   if (o_multi_double != NULL) {
                           printf("o_multi_double: ");
                           for (i = 0; o_multi_double[i] != NULL; i++)
                                   printf("%e, ", *(o_multi_double[i]));
                           puts("NULL");
                           strdyn_free((char**) o_multi_double);
                   }
                   else
                           puts("o_multi_double uninitialized");
   
                 if (o_name != NULL) {                  if (o_name != NULL) {
                         s = strdyn_implode_str(o_name, "][");                          s = strdyn_implode_str(o_name, "][");
                         printf("o_name = [%s]\n", s);                          printf("o_name = [%s]\n", s);
   
                         if (s != NULL)                          if (s != NULL)
                                 free(s);                                  free(s);
                         strdyn_free(o_name);                          strdyn_free(o_name);
Line 287  int main(int argc, char **argv)
Line 335  int main(int argc, char **argv)
                 if (o_string != NULL) {                  if (o_string != NULL) {
                         s = strdyn_implode_str(o_string, "][");                          s = strdyn_implode_str(o_string, "][");
                         printf("o_string = [%s]\n", s);                          printf("o_string = [%s]\n", s);
   
                         if (s != NULL)                          if (s != NULL)
                                 free(s);                                  free(s);
                         strdyn_free(o_string);                          strdyn_free(o_string);
                 }                  }
                 else                  else
                         puts("o_string uninitialized");                          puts("o_string uninitialized");
   
                   if (o_leftover != NULL) {
                           s = strdyn_implode_str(o_leftover, "][");
                           printf("o_leftover = [%s]\n", s);
                           if (s != NULL)
                                   free(s);
                           strdyn_free(o_leftover);
                   }
                   else
                           puts("o_leftover uninitialized");
         }          }
   
   

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top