aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libbb.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 11d022fb5..777a4a884 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1176,19 +1176,17 @@ extern const char *applet_long_options;
1176#endif 1176#endif
1177extern uint32_t option_mask32; 1177extern uint32_t option_mask32;
1178extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC; 1178extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC;
1179
1180
1181/* BSD-derived getopt() functions require that optind be set to 1 in 1179/* BSD-derived getopt() functions require that optind be set to 1 in
1182 * order to reset getopt() state. This used to be generally accepted 1180 * order to reset getopt() state. This used to be generally accepted
1183 * way of resetting getopt(). However, glibc's getopt() 1181 * way of resetting getopt(). However, glibc's getopt()
1184 * has additional getopt() state beyond optind (specifically, glibc 1182 * has additional getopt() state beyond optind (specifically, glibc
1185 * extensions ('+' and '-' at the start of the string), and requires 1183 * extensions such as '+' and '-' at the start of the string), and requires
1186 * that optind be set to zero to reset its state. BSD-derived versions 1184 * that optind be set to zero to reset its state. BSD-derived versions
1187 * of getopt() misbehaved if optind is set to 0 in order to reset getopt(), 1185 * of getopt() misbehaved if optind is set to 0 in order to reset getopt(),
1188 * and glibc's getopt() used to coredump if optind is set 1 in order 1186 * and glibc's getopt() used to coredump if optind is set 1 in order
1189 * to reset getopt(). 1187 * to reset getopt().
1190 * Then BSD introduced additional variable "optreset" which 1188 * Then BSD introduced additional variable "optreset" which should be
1191 * be set to 1 in order to reset getopt(). Sigh. Standards, anyone? 1189 * set to 1 in order to reset getopt(). Sigh. Standards, anyone?
1192 * 1190 *
1193 * By ~2008, OpenBSD 3.4 was changed to survive glibc-like optind = 0 1191 * By ~2008, OpenBSD 3.4 was changed to survive glibc-like optind = 0
1194 * (to interpret it as if optreset was set). 1192 * (to interpret it as if optreset was set).