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.33 and 1.34

version 1.33, 2002/04/21 10:08:40 version 1.34, 2002/04/24 22:03:54
Line 87  cfg_get_context(options)
Line 87  cfg_get_context(options)
         con->quote_prefix = strdyn_create_ar(default_quote_prefix);          con->quote_prefix = strdyn_create_ar(default_quote_prefix);
         con->quote_postfix = strdyn_create_ar(default_quote_postfix);          con->quote_postfix = strdyn_create_ar(default_quote_postfix);
   
           /* If any memory allocation failure. */
         if (con->line_stop_str == NULL          if (con->line_stop_str == NULL
                         || con->file_stop_prefix == NULL                          || con->file_stop_prefix == NULL
                         || con->comment_prefix == NULL                          || con->comment_prefix == NULL
Line 228  cfg_free_context(con)
Line 229  cfg_free_context(con)
         con->argc = 0;          con->argc = 0;
         con->argv = NULL;          con->argv = NULL;
   
         con->filename = NULL;          con->filename  = NULL;
         con->begin_pos = 0;          con->begin_pos = 0;
         con->end_pos = 0;          con->end_pos   = 0;
   
         con->type = CFG_NO_CONTEXT;          con->type = CFG_NO_CONTEXT;
   
Line 238  cfg_free_context(con)
Line 239  cfg_free_context(con)
 }  }
   
         void          void
 cfg_print_error(con, errorcode, fh)  cfg_print_error(con)
           const CFG_CONTEXT con;
   {
           cfg_fprint_error(con, stderr);
   }
   
           void
   cfg_fprint_error(con, fh)
         const CFG_CONTEXT con;          const CFG_CONTEXT con;
         const int errorcode;  
         FILE *fh;          FILE *fh;
 {  {
         char *s;          char *s;
   
         s = cfg_get_error_str(con, errorcode);          s = cfg_get_error_str(con);
   
         if (s == NULL)          if (s == NULL) {
                 fputs("not enough memory for error printing", fh);                  fputs("not enough memory for error printing\n", fh);
           }
         fputs(s, fh);          else {
         free(s);                  fputs(s, fh);
                   free(s);
           }
 }  }
   
         char *          char *
 cfg_get_error_str(con, errorcode)  cfg_get_error_str(con)
         const CFG_CONTEXT con;          const CFG_CONTEXT con;
         const int errorcode;  
 {  {
         char *s;          char *s;
         char *str_type  = con->type == CFG_LINE ? "on command line" : "in config file";          char *str_type  = con->type == CFG_LINE ? "on command line" : "in config file";
Line 297  cfg_get_error_str(con, errorcode)
Line 305  cfg_get_error_str(con, errorcode)
         if ((s = (char *) malloc(sizeof(char) * size)) == NULL)          if ((s = (char *) malloc(sizeof(char) * size)) == NULL)
                 return NULL;                  return NULL;
   
         switch (errorcode) {          switch (con->error_code) {
   
                 /* case CFG_ERR_OK: */                  /* case CFG_ERR_OK: */
                 /* case CFG_ERROR_OK: */                  /* case CFG_ERROR_OK: */
Line 389  cfg_get_error_str(con, errorcode)
Line 397  cfg_get_error_str(con, errorcode)
                 case CFG_ERROR_INTERNAL:                  case CFG_ERROR_INTERNAL:
                         sprintf(s, "libcfg internal error");                          sprintf(s, "libcfg internal error");
                 default:                  default:
                         sprintf(s, "unknown error (%d)", errorcode);                          sprintf(s, "unknown error (%d)", con->error_code);
                         break;                          break;
         }          }
   
Line 600  main(argc, argv)
Line 608  main(argc, argv)
                                         "+------------------+");                                          "+------------------+");
   
                         printf("***** ");                          printf("***** ");
                         cfg_print_error(con, ret, stdout);                          cfg_fprint_error(con, stdout);
                         putchar('\n');                          putchar('\n');
   
                         printf("***** %s error %d at %d: %s\n",                          printf("***** %s error %d at %d: %s\n",

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

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