diff options
author | emaste <emaste@FreeBSD.org> | 2016-02-10 19:39:36 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-02-10 19:39:36 +0000 |
commit | 85217dee0e24c5f3ac285420e843063b4b52c1a0 (patch) | |
tree | 3de9500b684e6cb0b1066dfbf0133793e385df71 /strings/strings.c | |
parent | 08c7091d4a30fde09fdda23d2016d8d11624cb15 (diff) | |
download | FreeBSD-src-85217dee0e24c5f3ac285420e843063b4b52c1a0.zip FreeBSD-src-85217dee0e24c5f3ac285420e843063b4b52c1a0.tar.gz |
Import ELF Tool Chain snapshot revision 3395
This is close to the upcoming 0.7.1 release.
From http://svn.code.sf.net/p/elftoolchain/code
Diffstat (limited to 'strings/strings.c')
-rw-r--r-- | strings/strings.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/strings/strings.c b/strings/strings.c index 6eab165..f122eba 100644 --- a/strings/strings.c +++ b/strings/strings.c @@ -37,6 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sysexits.h> #include <unistd.h> #include <libelf.h> @@ -45,7 +46,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: strings.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: strings.c 3360 2016-01-24 18:34:06Z jkoshy $"); enum return_code { RETURN_OK, @@ -73,10 +74,10 @@ enum encoding_style { ((c) == '\t' || isprint((c)) || \ (encoding == ENCODING_8BIT && (c) > 127))) - -static int encoding_size, entire_file, min_len, show_filename, show_loc; +static int encoding_size, entire_file, show_filename, show_loc; static enum encoding_style encoding; static enum radix_style radix; +static intmax_t min_len; static struct option strings_longopts[] = { { "all", no_argument, NULL, 'a'}, @@ -144,7 +145,10 @@ main(int argc, char **argv) show_filename = 1; break; case 'n': - min_len = (int)strtoimax(optarg, (char**)NULL, 10); + min_len = strtoimax(optarg, (char**)NULL, 10); + if (min_len <= 0) + errx(EX_USAGE, "option -n should specify a " + "positive decimal integer."); break; case 'o': show_loc = 1; |