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.9 and 1.10

version 1.9, 2001/11/27 15:15:25 version 1.10, 2001/11/27 17:11:30
Line 138  void cfg_free_context(
Line 138  void cfg_free_context(
         cfg_clear_cfgfile_option_arg_separator(con);          cfg_clear_cfgfile_option_arg_separator(con);
   
         /*          /*
          * We can't call free_currents(con); cause it is stacic method           * We can't call free_currents(con), because it is stacic method defined
          * defined in cmdline.c           * in cmdline.c; but no problem, we will do the free-job ourself.
          */           */
   
         if (con->cur_opt != NULL)          if (con->cur_opt != NULL)
Line 158  void cfg_free_context(
Line 158  void cfg_free_context(
 int main(int argc, char **argv) {  int main(int argc, char **argv) {
   
         CFG_CONTEXT con;          CFG_CONTEXT con;
         int o_nice = 20, o_verbose = 0, ret;          int ret;
   
           int o_nice = 20, o_verbose = 0;
           int o_int = -33;
           unsigned int o_uint = 33;
           long o_long = -333;
           unsigned long o_ulong = 333;
           float o_float = -3333.33;
           double o_double = -33333.33;
   
   
         struct cfg_option options[] = {          struct cfg_option options[] = {
                 { "nice", 'n', "nice", CFG_INT, (void *) &o_nice, 0 },                  { "nice", 'n', "nice", CFG_INT, (void *) &o_nice, 0 },
                 { "verbose", 'v', "verbose", CFG_BOOLEAN, (void *) &o_verbose, 0 },                  { "verbose", 'v', "verbose", CFG_BOOLEAN, (void *) &o_verbose, 0 },
   
                   { "int", 'i', "int", CFG_INT, (void *) &o_int, 0 },
                   { "uint", 'u', "unsigned int", CFG_UINT, (void *) &o_uint, 0 },
                   { "long", 'l', "long", CFG_LONG, (void *) &o_long, 0 },
                   { "ulong", 'o', "unsigned long", CFG_ULONG, (void *) &o_ulong, 0 },
                   { "float", 'f', "float", CFG_FLOAT, (void *) &o_float, 0 },
                   { "double", 'd', "double", CFG_DOUBLE, (void *) &o_double, 0 },
                 CFG_END_OF_LIST                  CFG_END_OF_LIST
         };          };
   
Line 172  int main(int argc, char **argv) {
Line 188  int main(int argc, char **argv) {
                 printf("ret = %d\n", ret);                  printf("ret = %d\n", ret);
         }          }
   
           fputs("***** ", stdout);
   
         switch (ret) {          switch (ret) {
                 case CFG_ERROR_INTERNAL:                  case CFG_ERROR_INTERNAL:
                         puts("Command line parsing internal error.");                          puts("Command line parsing internal error.");
Line 202  int main(int argc, char **argv) {
Line 220  int main(int argc, char **argv) {
                         break;                          break;
         }          }
   
           if (ret != CFG_OK)
                   printf("***** opt = '%s', arg = '%s'\n", con->cur_opt, con->cur_arg);
   
   
         cfg_free_context(con);          cfg_free_context(con);
   
         printf("o_verbose = %d, o_nice = %d\n", o_verbose, o_nice);          printf("o_verbose = %d, o_nice = %d\n", o_verbose, o_nice);
           printf("o_int = %d, o_uint = %u\n", o_int, o_uint);
           printf("o_long = %ld, o_ulong = %lu\n", o_long, o_ulong);
           printf("o_float = %f, o_double = %e\n", o_float, o_double);
   
         return 0;          return 0;
 }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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