diff options
Diffstat (limited to 'util-linux/getopt.c')
-rw-r--r-- | util-linux/getopt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 2da348176..31790d2a7 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -147,7 +147,7 @@ static const char *normalize(const char *arg) | |||
147 | static int generate_output(char **argv, int argc, const char *optstr, const struct option *longopts) | 147 | static int generate_output(char **argv, int argc, const char *optstr, const struct option *longopts) |
148 | { | 148 | { |
149 | int exit_code = 0; /* We assume everything will be OK */ | 149 | int exit_code = 0; /* We assume everything will be OK */ |
150 | unsigned opt; | 150 | int opt; |
151 | #if ENABLE_GETOPT_LONG | 151 | #if ENABLE_GETOPT_LONG |
152 | int longindex; | 152 | int longindex; |
153 | #endif | 153 | #endif |
@@ -173,7 +173,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru | |||
173 | #else | 173 | #else |
174 | getopt(argc, argv, optstr); | 174 | getopt(argc, argv, optstr); |
175 | #endif | 175 | #endif |
176 | if (opt == EOF) | 176 | if (opt == -1) |
177 | break; | 177 | break; |
178 | if (opt == '?' || opt == ':' ) | 178 | if (opt == '?' || opt == ':' ) |
179 | exit_code = 1; | 179 | exit_code = 1; |
@@ -190,7 +190,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru | |||
190 | printf(" %s", normalize(optarg)); | 190 | printf(" %s", normalize(optarg)); |
191 | else { | 191 | else { |
192 | printf(" -%c", opt); | 192 | printf(" -%c", opt); |
193 | charptr = strchr(optstr,opt); | 193 | charptr = strchr(optstr, opt); |
194 | if (charptr != NULL && *++charptr == ':') | 194 | if (charptr != NULL && *++charptr == ':') |
195 | printf(" %s", | 195 | printf(" %s", |
196 | normalize(optarg ? optarg : "")); | 196 | normalize(optarg ? optarg : "")); |