Commit 9a51b1295743c11e72f1194d6b83c66de2f2df72

Steffen Jaeckel 2019-10-01T10:37:30

exit instead of segfault

diff --git a/etc/tune.c b/etc/tune.c
index b3019c3..409576e 100644
--- a/etc/tune.c
+++ b/etc/tune.c
@@ -212,6 +212,7 @@ static long s_strtol(const char *str, char **endptr, const char *err)
    return val;
 }
 
+static int s_exit_code = EXIT_FAILURE;
 static void s_usage(char *s)
 {
    fprintf(stderr,"Usage: %s [TvcpGbtrSLFfMmosh]\n",s);
@@ -240,6 +241,7 @@ static void s_usage(char *s)
    fprintf(stderr,"             tc3s = Toom-Cook 3-way squaring\n");
    fprintf(stderr,"             Implies '-p'\n");
    fprintf(stderr,"          -h this message\n");
+   exit(s_exit_code);
 }
 
 struct cutoffs {
@@ -398,9 +400,10 @@ int main(int argc, char **argv)
             TOOM_SQR_CUTOFF = (int)s_strtol(str, &endptr, "[4/4] No value for TOOM_SQR_CUTOFF given");
             break;
          case 'h':
+            s_exit_code = EXIT_SUCCESS;
+         /* FALLTHROUGH */
          default:
             s_usage(argv[0]);
-            exit(EXIT_FAILURE);
          }
       }
    }