[BACK]Return to errstr.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / openssl

Diff for /src/usr.bin/openssl/errstr.c between version 1.1 and 1.2

version 1.1, 2014/08/26 17:47:24 version 1.2, 2015/04/13 15:02:23
Line 67 
Line 67 
 #include <openssl/lhash.h>  #include <openssl/lhash.h>
 #include <openssl/ssl.h>  #include <openssl/ssl.h>
   
   struct {
           int stats;
   } errstr_config;
   
   struct option errstr_options[] = {
           {
                   .name = "stats",
                   .desc = "Print debugging statistics for the hash table",
                   .type = OPTION_FLAG,
                   .opt.flag = &errstr_config.stats,
           },
           { NULL },
   };
   
   static void
   errstr_usage()
   {
           fprintf(stderr, "usage: errstr [-stats] errno ...\n");
           options_usage(errstr_options);
   }
   
 int errstr_main(int, char **);  int errstr_main(int, char **);
   
 int  int
Line 75 
Line 96 
         int i, ret = 0;          int i, ret = 0;
         char buf[256];          char buf[256];
         unsigned long l;          unsigned long l;
           int argsused;
   
         if ((argc > 1) && (strcmp(argv[1], "-stats") == 0)) {          memset(&errstr_config, 0, sizeof(errstr_config));
   
           if (options_parse(argc, argv, errstr_options, NULL, &argsused) != 0) {
                   errstr_usage();
                   return (1);
           }
   
           if (errstr_config.stats) {
                 BIO *out = NULL;                  BIO *out = NULL;
   
                 out = BIO_new(BIO_s_file());                  out = BIO_new(BIO_s_file());
Line 90 
Line 119 
                 }                  }
                 if (out != NULL)                  if (out != NULL)
                         BIO_free_all(out);                          BIO_free_all(out);
                 argc--;  
                 argv++;  
         }          }
         for (i = 1; i < argc; i++) {  
           for (i = argsused; i < argc; i++) {
                 if (sscanf(argv[i], "%lx", &l)) {                  if (sscanf(argv[i], "%lx", &l)) {
                         ERR_error_string_n(l, buf, sizeof buf);                          ERR_error_string_n(l, buf, sizeof buf);
                         printf("%s\n", buf);                          printf("%s\n", buf);
                 } else {                  } else {
                         printf("%s: bad error code\n", argv[i]);                          printf("%s: bad error code\n", argv[i]);
                         printf("usage: errstr [-stats] <errno> ...\n");                          errstr_usage();
                         ret++;                          ret++;
                 }                  }
         }          }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2