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

Diff for libcfg+/src/cfg+.c between version 1.20 and 1.21

version 1.20, 2002/02/13 14:55:26 version 1.21, 2002/02/17 15:18:45
Line 1 
Line 1 
   /*
    * libcfg - precise command line & config file parsing library
    *
    * cfg.c - main implementation
    * ___________________________________________________________
    *
    * Developed by Ondrej Jombik <nepto@pobox.sk>
    * Copyright (c) 2001-2002 Platon software development group
    * All rights reserved.
    *
    * See README file for more informations about this software.
    * See COPYING file for license informations.
    *
    * Download the latest version from
    * http://www.platon.sk/projects/libcfg/
    */
   
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 198  void ar_print(char *name, char *format,
Line 215  void ar_print(char *name, char *format,
         if (vals != NULL) {          if (vals != NULL) {
                 if (strcmp(format, "%s")) {                  if (strcmp(format, "%s")) {
                         register int i;                          register int i;
                         printf("%s: ", name);  
   
                         //fputs(format, stdout);  
                         //fputs(": ", stdout);  
   
                           printf("%s: ", name);
                         for (i = 0; vals[i] != NULL; i++) {                          for (i = 0; vals[i] != NULL; i++) {
   
                                 printf(format, !strcmp(format, "%d") ? *(((int **) vals)[i])  
                                                 : !strcmp(format, "%u") ? *(((unsigned int **) vals)[i])                                  if (! strcmp(format, "%e") || ! strcmp(format, "%f"))
                                                 : !strcmp(format, "%ld") ? *(((long **) vals)[i])                                          printf(format, *(((float **) vals)[i]));
                                                 : !strcmp(format, "%lu") ? *(((unsigned long**)vals)[i])                                  else
                                                 : !strcmp(format, "%f") ? *(((float **) vals)[i])                                          printf(format, *(((int **) vals)[i]));
                                                 : !strcmp(format, "%e") ? *(((double **) vals)[i])  
                                                 : 0LU);  
   
                                 printf(", ");                                  printf(", ");
                         }                          }
   
                         puts("NULL");                          puts("NULL");
                 }                  }
                 else {                  else {
Line 346  int main(int argc, char **argv)
Line 359  int main(int argc, char **argv)
                                 cfg_get_cur_idx(con),                                  cfg_get_cur_idx(con),
                                 argv[cfg_get_cur_idx(con)]);                                  argv[cfg_get_cur_idx(con)]);
   
         /* DELTHIS: cfg_free_context(con); */  
   
         if (o_cfgfile != NULL) {          if (o_cfgfile != NULL) {
                 /* DELTHIS: con = cfg_get_cfgfile_context(0, 0, o_cfgfile, options); */  
                 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, "//");
Line 382  int main(int argc, char **argv)
Line 392  int main(int argc, char **argv)
   
         puts("Multi values printing:");          puts("Multi values printing:");
   
         ar_print("o_multi_int", "%d", (void **) o_multi_int);          ar_print("o_multi_int", "%d",  (void **) o_multi_int);
         ar_print("o_multi_uint", "%u", (void **) o_multi_uint);          ar_print("o_multi_uint", "%u", (void **) o_multi_uint);
         ar_print("o_multi_long", "%ld", (void **) o_multi_long);          ar_print("o_multi_long", "%ld", (void **) o_multi_long);
         ar_print("o_multi_ulong", "%lu", (void **) o_multi_ulong);          ar_print("o_multi_ulong", "%lu", (void **) o_multi_ulong);

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

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