summaryrefslogtreecommitdiff
path: root/binutils/strings.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2009-06-04 08:27:54 +0000
committerAlan Modra <amodra@bigpond.net.au>2009-06-04 08:27:54 +0000
commit5837fc46dbc41aa1fb685a292b26f713f2ea95ed (patch)
tree9979d626df5de498c07a91eeefe6b21fa937c2e5 /binutils/strings.c
parent02e1a129e216391b77fbf1c7e85b923da87cce20 (diff)
downloadbinutils-redhat-5837fc46dbc41aa1fb685a292b26f713f2ea95ed.tar.gz
* strings.c (main): Delay parsing of decimal digits.
Diffstat (limited to 'binutils/strings.c')
-rw-r--r--binutils/strings.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/binutils/strings.c b/binutils/strings.c
index dc582f56d0..06fd8e995b 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -158,6 +158,7 @@ main (int argc, char **argv)
int exit_status = 0;
bfd_boolean files_given = FALSE;
char *s;
+ int numeric_opt = 0;
#if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, "");
@@ -247,13 +248,17 @@ main (int argc, char **argv)
usage (stderr, 1);
default:
- string_min = (int) strtoul (argv[optind - 1] + 1, &s, 0);
- if (s != NULL && *s != 0)
- fatal (_("invalid integer argument %s"), argv[optind - 1] + 1);
+ numeric_opt = optind;
break;
}
}
+ if (numeric_opt != 0)
+ {
+ string_min = (int) strtoul (argv[numeric_opt - 1] + 1, &s, 0);
+ if (s != NULL && *s != 0)
+ fatal (_("invalid integer argument %s"), argv[numeric_opt - 1] + 1);
+ }
if (string_min < 1)
fatal (_("invalid minimum string length %d"), string_min);