commit 8f666e6727a955b77826be69882851792a8a1bac from: Omar Polo via: Thomas Adam date: Sat Feb 12 17:22:05 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 - 9c8bf18964a7751ad34d51de04bf84f96956cc9e commit + 8f666e6727a955b77826be69882851792a8a1bac blob - f8f3434892efa89ff78a8b2a7af18e27afa3e24e blob + 1cdbbce8bd9b2dfdca4bdf6df73b4f3cdf7c6979 --- 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 - 63aab9307dfe089eb2cccf7079df0413fbef4f80 blob + bad14df5f39d108c10d4a12d2dfaaf2795ae8c32 --- tog/tog.c +++ tog/tog.c @@ -3894,7 +3894,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);