summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-05-29 04:24:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-05-29 04:24:52 +0200
commit488dd7086925b83bb36568965558221e04d2cc91 (patch)
tree2c4ee47019880b24cb308eef3eb6f9fd211fbafb /docs
parent217a7f4bf95339a93a217c5806c5b9a48c0027d5 (diff)
fix !ENABLE_FEATURE_GETOPT_LONG build. Closes 3775
When compiling with !ENABLE_FEATURE_GETOPT_LONG, busybox still tries to include getopt.h which is not available; for example with uClibc when !UCLIBC_HAS_GETOPT_LONG. getopt.h is only required for the _long set of functions. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/style-guide.txt11
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/style-guide.txt b/docs/style-guide.txt
index fdf6cfe4d..10ed893dc 100644
--- a/docs/style-guide.txt
+++ b/docs/style-guide.txt
@@ -679,11 +679,10 @@ line in the midst of your #includes, if you need to parse long options:
Then have long options defined:
- static const struct option <applet>_long_options[] = {
- { "list", 0, NULL, 't' },
- { "extract", 0, NULL, 'x' },
- { NULL, 0, NULL, 0 }
- };
+ static const char <applet>_longopts[] ALIGN1 =
+ "list\0" No_argument "t"
+ "extract\0" No_argument "x"
+ ;
And a code block similar to the following near the top of your applet_main()
routine:
@@ -691,7 +690,7 @@ routine:
char *str_b;
opt_complementary = "cryptic_string";
- applet_long_options = <applet>_long_options; /* if you have them */
+ applet_long_options = <applet>_longopts; /* if you have them */
opt = getopt32(argc, argv, "ab:c", &str_b);
if (opt & 1) {
handle_option_a();