Просмотр исходного кода

* Port [3141] to 1.2.13
* Make ./binary -E default to displaying every error. (fixes #322)


svn: 3142

Bryan Drewery 19 лет назад
Родитель
Сommit
366cea0c83
2 измененных файлов с 9 добавлено и 12 удалено
  1. 1 0
      doc/UPDATES
  2. 8 12
      src/main.c

+ 1 - 0
doc/UPDATES

@@ -9,6 +9,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * For ./binary -C prefer environment variable EDITOR over VISUAL.
 * Fix ./binary -C not signalling the correct process under some situations. (fixes #315)
 * Fix security hole in all shell cmds. (fixes #321)
+* Make ./binary -E default to displaying every error. (fixes #322)
 
 1.2.12 - http://wraith.shatow.net/milestone/1.2.12
 * Clearing a variable via 'set var -' now resets that variable to default settings. (implements #111)

+ 8 - 12
src/main.c

@@ -263,7 +263,7 @@ static void show_help()
   printf(format, STR("-e <infile> <outfile>"), STR("Encrypt infile to outfile"));
   printf(format, STR("-d <infile> <outfile>"), STR("Decrypt infile to outfile"));
   printf(format, STR("-D"), STR("Enables debug mode (see -n)"));
-  printf(format, STR("-E [#/all]"), STR("Display Error codes english translation (use 'all' to display all)"));
+  printf(format, STR("-E [error code]"), STR("Display Error codes english translation"));
 /*  printf(format, STR("-g <file>"), STR("Generates a template config file"));
   printf(format, STR("-G <file>"), STR("Generates a custom config for the box"));
 */
@@ -346,19 +346,15 @@ static void dtx_arg(int argc, char *argv[])
         break;
       case 'E':
         p = argv[optind];
-        if (p && p[0]) {
-          if (!strcmp(p, "all")) {
-            int n;
-            putlog(LOG_MISC, "*", "Listing all errors");
-            for (n = 1; n < ERR_MAX; n++)
-            putlog(LOG_MISC, "*", "Error #%d: %s", n, werr_tostr(n));
-          } else if (egg_isdigit(p[0])) {
-            putlog(LOG_MISC, "*", "Error #%d: %s", atoi(p), werr_tostr(atoi(p)));
-          }
-          exit(0);
+        if (p && p[0] && egg_isdigit(p[0])) {
+          putlog(LOG_MISC, "*", "Error #%d: %s", atoi(p), werr_tostr(atoi(p)));
         } else {
-          fatal(STR("You must specify error number after -E (or 'all')"), 0);
+          int n;
+          putlog(LOG_MISC, "*", "Listing all errors");
+          for (n = 1; n < ERR_MAX; n++)
+          putlog(LOG_MISC, "*", "Error #%d: %s", n, werr_tostr(n));
         }
+        exit(0);
         break;
       case 'e':
         if (argv[optind])