diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-12 20:21:34 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-12 20:21:34 +0200 |
| commit | 352ddd3d216131757ac278e97a09ce2f4d7f53f0 (patch) | |
| tree | 6ed924aee0419bc872809811dd7462941ca21c50 /include | |
| parent | 835ad3a984c5590ae4f6c94f2f0781ea049d1ae8 (diff) | |
| download | busybox-w32-352ddd3d216131757ac278e97a09ce2f4d7f53f0.tar.gz busybox-w32-352ddd3d216131757ac278e97a09ce2f4d7f53f0.tar.bz2 busybox-w32-352ddd3d216131757ac278e97a09ce2f4d7f53f0.zip | |
Tweak GETOPT_RESET comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/libbb.h | 8 |
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 |
| 1177 | extern uint32_t option_mask32; | 1177 | extern uint32_t option_mask32; |
| 1178 | extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC; | 1178 | extern 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). |
