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.25 and 1.26

version 1.25, 2002/03/21 14:11:53 version 1.26, 2002/03/25 14:18:11
Line 339  main(argc, argv)
Line 339  main(argc, argv)
 {  {
   
         CFG_CONTEXT con;          CFG_CONTEXT con;
         int ret;          int ret, i;
   
         int o_nice = 20, o_verbose = 0;          int o_nice = 20, o_verbose = 0;
         char *o_cfgfile = NULL, *o_string = NULL;          char *o_cfgfile = NULL, *o_string = NULL;
Line 377  main(argc, argv)
Line 377  main(argc, argv)
                 CFG_END_OF_LIST                  CFG_END_OF_LIST
         };          };
   
         con = cfg_get_cmdline_context(argc, argv, options);          con = cfg_get_context(options);
         cfg_set_context_flag(con, CFG_ADVANCED_LEFTOVERS);  
           for (i = 0; ; i++) {
   
         do {  
                 /* This is powerful testing stuff :)                  /* This is powerful testing stuff :)
   
                    printf("advanced leftovers: %d\n", cfg_get_context_flag(con, CFG_ADVANCED_LEFTOVERS));                     printf("advanced leftovers: %d\n", cfg_get_context_flag(con, CFG_ADVANCED_LEFTOVERS));
Line 393  main(argc, argv)
Line 393  main(argc, argv)
                    printf("advanced leftovers: %d\n", cfg_get_context_flag(con, CFG_ADVANCED_LEFTOVERS));                     printf("advanced leftovers: %d\n", cfg_get_context_flag(con, CFG_ADVANCED_LEFTOVERS));
                    */                     */
   
                 if (o_cfgfile != NULL) {                  if (i == 0) {
                           cfg_set_cmdline_context(con, argc, argv);
                           cfg_set_context_flag(con, CFG_ADVANCED_LEFTOVERS);
                   }
                   else {
                         cfg_set_cfgfile_context(con, 0, 0, o_cfgfile);                          cfg_set_cfgfile_context(con, 0, 0, o_cfgfile);
                         cfg_remove_cfgfile_comment_prefix(con, "//");                          cfg_remove_cfgfile_comment_prefix(con, "//");
                         cfg_add_cfgfile_comment_prefix(con, "//");                          cfg_add_cfgfile_comment_prefix(con, "//");
   
                         o_cfgfile = NULL;  
                 }                  }
   
                 while ((ret = cfg_get_next_opt(con)) > 0) {                  while ((ret = cfg_get_next_opt(con)) > 0) {
                         printf("ret = %d, opt = '%s', arg = '%s', idx = %d, argv[idx] = '%s'\n",                          printf("ret = %d, opt = '%s', arg = '%s'", ret,
                                         ret,                                          cfg_get_cur_opt(con), cfg_get_cur_arg(con));
                                         cfg_get_cur_opt(con),  
                                         cfg_get_cur_arg(con),                          if (i == 0)
                                         cfg_get_cur_idx(con),                                  printf(", idx = %d, argv[idx] = '%s'",
                                         argv[cfg_get_cur_idx(con)]);                                                  cfg_get_cur_idx(con),
                                                   argv[cfg_get_cur_idx(con)]);
   
                           putchar('\n');
                 }                  }
   
                 if (ret != CFG_OK) {                  if (ret != CFG_OK) {
                           puts(
                                           "+------------------+\n"
                                           "|  Error printing  |\n"
                                           "+------------------+");
   
                         printf("***** %s error %d: %s\n",                          printf("***** %s error %d: %s\n",
                                         o_cfgfile == NULL ? "cmdline" : "cfgfile",                                          i == 0 ? "cmdline" : "cfgfile",
                                         ret, cfg_get_error_str(ret));                                          ret, cfg_get_error_str(ret));
   
                         printf("***** opt = '%s', arg = '%s', idx = %d, argv[idx] = '%s'\n",                          printf("***** opt = '%s', arg = '%s'",
                                         cfg_get_cur_opt(con),                                          cfg_get_cur_opt(con), cfg_get_cur_arg(con));
                                         cfg_get_cur_arg(con),  
                                         cfg_get_cur_idx(con),                          if (i == 0)
                                         argv[cfg_get_cur_idx(con)]);\                                  printf(", idx = %d, argv[idx] = '%s'",
                                                   cfg_get_cur_idx(con), argv[cfg_get_cur_idx(con)]);
   
                           putchar('\n');
                 }                  }
         } while (o_cfgfile != NULL);  
                   if (i == 0 && o_cfgfile == NULL)
                           break;
   
                   if (i > 0)
                           break;
           }
   
         cfg_free_context(con);          cfg_free_context(con);
   

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

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