diff --git a/libbb/getopt32.c b/libbb/getopt32.c index 428de534d..cc984e31b 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c @@ -18,6 +18,10 @@ #endif #include "libbb.h" +#ifdef __GNO__ +extern int optreset; /* exists on GNO, but isn't in the header files */ +#endif + /* Documentation uint32_t @@ -553,7 +557,9 @@ getopt32(char **argv, const char *applet_opts, ...) optind = 0; #else /* BSD style */ optind = 1; - /* optreset = 1; */ +# ifdef BSD /* includes OS X and GNO */ + optreset = 1; +# endif #endif /* optarg = NULL; opterr = 0; optopt = 0; - do we need this?? */ diff --git a/shell/hush.c b/shell/hush.c index ac3679495..97273fad3 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -8886,7 +8886,7 @@ static void helper_export_local(char **argv, int exp, int lvl) static int FAST_FUNC builtin_export(char **argv) { - unsigned opt_unexport; + uint32_t opt_unexport; #if ENABLE_HUSH_EXPORT_N /* "!": do not abort on errors */ @@ -9256,7 +9256,7 @@ static int FAST_FUNC builtin_read(char **argv) char *opt_t = NULL; char *opt_u = NULL; const char *ifs; - int read_flags; + uint32_t read_flags; /* "!": do not abort on errors. * Option string must start with "sr" to match BUILTIN_READ_xxx @@ -9484,12 +9484,12 @@ static int FAST_FUNC builtin_umask(char **argv) static int FAST_FUNC builtin_unset(char **argv) { int ret; - unsigned opts; + uint32_t opts; /* "!": do not abort on errors */ /* "+": stop at 1st non-option */ opts = getopt32(argv, "!+vf"); - if (opts == (unsigned)-1) + if (opts == (uint32_t)-1) return EXIT_FAILURE; if (opts == 3) { bb_error_msg("unset: -v and -f are exclusive");