commit 5a20d08d6546fa260cd5ce2ed01e438f5ec35f41 from: Omar Polo date: Wed Feb 09 14:59:46 2022 UTC tweak error reporting due to invalid numbers Use the same idiom as in the strtonum(3) manpage which produces a more readable error message. OK kn, stsp commit - d75b4088b08f12aea8079aad55996a65b7b312c8 commit + 5a20d08d6546fa260cd5ce2ed01e438f5ec35f41 blob - 03281c064021bf591b75ae61f102c19de7a4658f blob + 23e3b35d2df3662ccdf58a8fd4544ed6490c1a3c --- got/got.c +++ got/got.c @@ -4110,12 +4110,14 @@ cmd_log(int argc, char *argv[]) diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT, &errstr); if (errstr != NULL) - err(1, "-C option %s", errstr); + errx(1, "number of context lines is %s: %s", + errstr, optarg); break; case 'l': limit = strtonum(optarg, 0, INT_MAX, &errstr); if (errstr != NULL) - err(1, "-l option %s", errstr); + errx(1, "number of commits is %s: %s", + errstr, optarg); break; case 'b': log_branches = 1; @@ -4530,7 +4532,8 @@ cmd_diff(int argc, char *argv[]) diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT, &errstr); if (errstr != NULL) - err(1, "-C option %s", errstr); + errx(1, "number of context lines is %s: %s", + errstr, optarg); break; case 'r': repo_path = realpath(optarg, NULL); blob - 982154f8af09a3beb7bda5bd21732225bfbeeade blob + 280413b8f66e5256382c5cabb2bf2dc5dbb4bfc5 --- tog/tog.c +++ tog/tog.c @@ -3884,7 +3884,8 @@ cmd_diff(int argc, char *argv[]) diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT, &errstr); if (errstr != NULL) - err(1, "-C option %s", errstr); + errx(1, "number of context lines is %s: %s", + errstr, errstr); break; case 'r': repo_path = realpath(optarg, NULL);