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

Diff for libcfg+/src/cfg+.c between version 1.10 and 1.11

version 1.10, 2001/11/27 17:11:30 version 1.11, 2001/11/28 20:46:51
Line 6 
Line 6 
 #include "str/strplus.h"  #include "str/strplus.h"
 #include "cfg.h"  #include "cfg.h"
   
 /* #include "parse.c" */  
   
 static char *default_cmdline_stop_str[2] = { "--", NULL };  static char *default_cmdline_stop_str[2] = { "--", NULL };
 static char *default_cfgfile_stop_str[2] = { "[", NULL };  static char *default_cfgfile_stop_str[2] = { "[", NULL };
 static char *default_cfgfile_comment_str[3] = { "#", ";", NULL };  static char *default_cfgfile_comment_str[3] = { "#", ";", NULL };
Line 107  void cfg_set_cmdline_context(
Line 105  void cfg_set_cmdline_context(
         con->argc = argc;          con->argc = argc;
         con->argv = argv;          con->argv = argv;
   
         con->cur_idx = con->flags & CFG_PROCESS_FIRST ? 0 : 1;          con->cur_idx_tmp = con->flags & CFG_PROCESS_FIRST ? 0 : 1;
           con->cur_idx = 0;
 }  }
   
 void cfg_set_cfgfile_context(  void cfg_set_cfgfile_context(
Line 161  int main(int argc, char **argv) {
Line 160  int main(int argc, char **argv) {
         int ret;          int ret;
   
         int o_nice = 20, o_verbose = 0;          int o_nice = 20, o_verbose = 0;
           int o_boolean = 0;
         int o_int = -33;          int o_int = -33;
         unsigned int o_uint = 33;          unsigned int o_uint = 33;
         long o_long = -333;          long o_long = -333;
Line 173  int main(int argc, char **argv) {
Line 173  int main(int argc, char **argv) {
                 { "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 },
   
                   { "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 },
                 { "uint", 'u', "unsigned int", CFG_UINT, (void *) &o_uint, 0 },                  { "uint", 'u', "unsigned int", CFG_UINT, (void *) &o_uint, 0 },
                 { "long", 'l', "long", CFG_LONG, (void *) &o_long, 0 },                  { "long", 'l', "long", CFG_LONG, (void *) &o_long, 0 },
Line 185  int main(int argc, char **argv) {
Line 186  int main(int argc, char **argv) {
         con = cfg_get_cmdline_context(argc, argv, options);          con = cfg_get_cmdline_context(argc, argv, options);
   
         while ((ret = cfg_get_next_opt(con)) > 0) {          while ((ret = cfg_get_next_opt(con)) > 0) {
                 printf("ret = %d\n", ret);                  printf("ret = %d, opt = '%s', arg = '%s', idx = %d, argv[idx] = '%s'\n",
                                                                   ret,
                                                                   cfg_get_cur_opt(con),
                                                                   cfg_get_cur_arg(con),
                                                                   cfg_get_cur_idx(con),
                                                                   argv[cfg_get_cur_idx(con)]);
         }          }
   
         fputs("***** ", stdout);          fputs("***** ", stdout);
Line 221  int main(int argc, char **argv) {
Line 227  int main(int argc, char **argv) {
         }          }
   
         if (ret != CFG_OK)          if (ret != CFG_OK)
                 printf("***** opt = '%s', arg = '%s'\n", con->cur_opt, con->cur_arg);                  printf("***** opt = '%s', arg = '%s', idx = %d, argv[idx] = '%s'\n",
                                                                   cfg_get_cur_opt(con),
                                                                   cfg_get_cur_arg(con),
                                                                   cfg_get_cur_idx(con),
                                                                   argv[cfg_get_cur_idx(con)]);
   
   
         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_boolean = %d\n", o_boolean);
         printf("o_int = %d, o_uint = %u\n", o_int, o_uint);          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_long = %ld, o_ulong = %lu\n", o_long, o_ulong);
         printf("o_float = %f, o_double = %e\n", o_float, o_double);          printf("o_float = %f, o_double = %e\n", o_float, o_double);

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

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