Changeset 182 for trunk/src


Ignore:
Timestamp:
03/17/10 02:41:17 (15 years ago)
Author:
tim
Message:

redesigned regfi logging API to utilize thread-local storage

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/common.c

    r178 r182  
    2929const char* common_special_chars = ",\"\\";
    3030
    31 #define REGLOOKUP_VERSION "0.12.0"
     31#define REGLOOKUP_VERSION "0.1?.0"
    3232
    3333#define REGLOOKUP_EXIT_OK       0
     
    4949{
    5050  fprintf(stderr, message);
     51  regfi_log_stop();
    5152  exit(code);
    5253}
    5354
    54 void printMsgs(REGFI_FILE* f)
    55 {
    56   char* msgs = regfi_get_messages(f);
     55void printMsgs()
     56{
     57  char* msgs = regfi_log_get_str();
    5758  if(msgs != NULL)
    5859  {
     
    6263}
    6364
    64 void clearMsgs(REGFI_FILE* f)
    65 {
    66   char* msgs = regfi_get_messages(f);
     65void clearMsgs()
     66{
     67  char* msgs = regfi_log_get_str();
    6768  if(msgs != NULL)
    6869    free(msgs);
  • trunk/src/reglookup-recover.c

    r181 r182  
    827827  }
    828828
     829  if(print_verbose)
     830    regfi_log_start(REGFI_LOG_ERROR|REGFI_LOG_WARN|REGFI_LOG_INFO);
     831  else
     832    regfi_log_start(REGFI_LOG_ERROR);
     833
    829834  f = regfi_alloc(fd);
    830835  if(f == NULL)
     
    833838    bailOut(REGLOOKUP_EXIT_NOINPUT, "ERROR: Failed to create REGFI_FILE structure.\n");
    834839  }
    835 
    836   if(print_verbose)
    837     regfi_set_message_mask(f, REGFI_MSG_ERROR|REGFI_MSG_WARN|REGFI_MSG_INFO);
    838   else
    839     regfi_set_message_mask(f, REGFI_MSG_ERROR);
    840840
    841841  if(print_header)
     
    994994
    995995  regfi_free(f);
     996  regfi_log_stop();
    996997  close(fd);
    997998
  • trunk/src/reglookup.c

    r181 r182  
    619619  registry_file = argv[argi];
    620620
     621  if(print_verbose)
     622    regfi_log_start(REGFI_LOG_INFO|REGFI_LOG_WARN|REGFI_LOG_ERROR);
     623  else
     624    regfi_log_start(REGFI_LOG_ERROR|REGFI_LOG_WARN);
     625
    621626  fd = openHive(registry_file);
    622627  if(fd < 0)
     
    625630    bailOut(REGLOOKUP_EXIT_NOINPUT, "");
    626631  }
    627 
     632   
    628633  f = regfi_alloc(fd);
    629634  if(f == NULL)
     
    633638  }
    634639
    635   if(print_verbose)
    636     regfi_set_message_mask(f, REGFI_MSG_INFO|REGFI_MSG_WARN|REGFI_MSG_ERROR);
    637640
    638641  /* XXX: add command line option to choose output encoding */
     
    678681  regfi_iterator_free(iter);
    679682  regfi_free(f);
     683  regfi_log_stop();
    680684  close(fd);
    681685
Note: See TracChangeset for help on using the changeset viewer.