busybox to support locale settings.
config GETOPT_LONG
- bool
+ bool "Enable support for --long-options"
default y
-# bool "Enable support for --long-options"
-# default n
-# help
-# Enable this if you want busybox applets to use the gnu --long-option
-# style, in addition to single character -a -b -c style options.
+ help
+ Enable this if you want busybox applets to use the gnu --long-option
+ style, in addition to single character -a -b -c style options.
config FEATURE_DEVPTS
bool "Use the devpts filesystem for Unix98 PTYs"
# endif
{ 0, 0, 0, 0 }
};
-#else
-#define tar_long_options 0
#endif
int tar_main(int argc, char **argv)
USE_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
USE_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
SKIP_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive
- if (ENABLE_FEATURE_TAR_LONG_OPTIONS)
- applet_long_options = tar_long_options;
+#if ENABLE_FEATURE_TAR_LONG_OPTIONS
+ applet_long_options = tar_long_options;
+#endif
opt = getopt32(argc, argv,
"txC:f:Opvk"
USE_FEATURE_TAR_CREATE( "ch" )
#endif
case LIST_FILENAME:
errno = 0;
+#if ENABLE_FEATURE_LS_COLOR
if (show_color && !lstat(dn->fullname, &info)) {
printf("\033[%d;%dm", bgcolor(info.st_mode),
fgcolor(info.st_mode));
}
+#endif
column += printf("%s", dn->name);
if (show_color) {
printf("\033[0m");
append = append_char(info.st_mode);
}
#endif
+#if ENABLE_FEATURE_LS_COLOR
if (show_color) {
errno = 0;
printf("\033[%d;%dm", bgcolor(info.st_mode),
fgcolor(info.st_mode));
}
+#endif
column += printf("%s", lpath) + 4;
if (show_color) {
printf("\033[0m");
printf(address_fmt, address_pad_len, address);
}
+#if ENABLE_GETOPT_LONG
+/* only used with --traditional */
static void
format_address_paren(off_t address, char c)
{
format_address_std(address, ' ');
format_address_paren(address + pseudo_offset, c);
}
-
+#endif
static void
dump_hexl_mode_trailer(size_t n_bytes, const char *block)
return l_c_m;
}
+#if ENABLE_GETOPT_LONG
/* If S is a valid traditional offset specification with an optional
leading '+' return nonzero and set *OFFSET to the offset it denotes. */
return (*offset >= 0);
}
+#endif
/* Read a chunk of size BYTES_PER_BLOCK from the input files, write the
formatted block to standard output, and repeat until the specified
OPT_s = 1 << 15,
OPT_S = 1 << 16,
OPT_w = 1 << 17,
- OPT_traditional = 1 << 18,
+ OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG,
};
+#if ENABLE_GETOPT_LONG
static const struct option long_options[] = {
{ "skip-bytes", required_argument, NULL, 'j' },
{ "address-radix", required_argument, NULL, 'A' },
{ "traditional", no_argument, NULL, 0xff },
{ NULL, 0, NULL, 0 }
};
+#endif
char *str_A, *str_N, *str_j, *str_S;
char *str_w = NULL;
llist_t *lst_t = NULL;
/* Parse command line */
opt_complementary = "t::"; // list
+#if ENABLE_GETOPT_LONG
applet_long_options = long_options;
+#endif
opt = getopt32(argc, argv, "A:N:abcdfhij:lot:vxsS:"
"w::", // -w with optional param
// -S was -s and also had optional parameter
* FIXME: POSIX 1003.1-2001 with XSI requires support for the
* traditional syntax even if --traditional is not given. */
+#if ENABLE_GETOPT_LONG
if (opt & OPT_traditional) {
off_t o1, o2;
}
}
}
+#endif
if (limit_bytes_to_format) {
end_offset = n_bytes_to_skip + max_bytes_to_format;
enum { BB_GETOPT_ERROR = 0x80000000 };
extern const char *opt_complementary;
+#if ENABLE_GETOPT_LONG
extern const struct option *applet_long_options;
+#endif
extern uint32_t option_mask32;
extern uint32_t getopt32(int argc, char **argv, const char *applet_opts, ...);
extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
extern void bb_perror_nomsg(void);
extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
-/* These two are used internally -- you shouldn't need to use them */
+/* These are used internally -- you shouldn't need to use them */
extern void bb_verror_msg(const char *s, va_list p, const char *strerr);
extern void bb_vperror_msg(const char *s, va_list p);
extern void bb_vinfo_msg(const char *s, va_list p);
#if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
static const struct option ftpgetput_long_options[] = {
- {"continue", 1, NULL, 'c'},
- {"verbose", 0, NULL, 'v'},
- {"username", 1, NULL, 'u'},
- {"password", 1, NULL, 'p'},
- {"port", 1, NULL, 'P'},
- {0, 0, 0, 0}
+ { "continue", 1, NULL, 'c' },
+ { "verbose", 0, NULL, 'v' },
+ { "username", 1, NULL, 'u' },
+ { "password", 1, NULL, 'p' },
+ { "port", 1, NULL, 'P' },
+ { 0, 0, 0, 0 }
};
-#else
-#define ftpgetput_long_options 0
#endif
int ftpgetput_main(int argc, char **argv)
/*
* Decipher the command line
*/
- if (ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS)
- applet_long_options = ftpgetput_long_options;
-
+#if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
+ applet_long_options = ftpgetput_long_options;
+#endif
opt = getopt32(argc, argv, "cvu:p:P:", &server->user, &server->password, &port);
/* Process the non-option command line arguments */
#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
static const struct option long_options[] = {
- {"netmask", no_argument, NULL, 'm'},
- {"broadcast", no_argument, NULL, 'b'},
- {"network", no_argument, NULL, 'n'},
-#ifdef CONFIG_FEATURE_IPCALC_FANCY
- {"prefix", no_argument, NULL, 'p'},
- {"hostname", no_argument, NULL, 'h'},
- {"silent", no_argument, NULL, 's'},
-#endif
- {NULL, 0, NULL, 0}
+ { "netmask", no_argument, NULL, 'm' },
+ { "broadcast", no_argument, NULL, 'b' },
+ { "network", no_argument, NULL, 'n' },
+# if ENABLE_FEATURE_IPCALC_FANCY
+ { "prefix", no_argument, NULL, 'p' },
+ { "hostname", no_argument, NULL, 'h' },
+ { "silent", no_argument, NULL, 's' },
+# endif
+ { NULL, 0, NULL, 0 }
};
-#else
-#define long_options 0
#endif
+
int ipcalc_main(int argc, char **argv)
{
unsigned opt;
struct in_addr a;
char *ipstr;
- if (ENABLE_FEATURE_IPCALC_LONG_OPTIONS)
- applet_long_options = long_options;
-
+#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
+ applet_long_options = long_options;
+#endif
opt = getopt32(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs"));
argc -= optind;
argv += optind;
OPT_t = 1 << 16,
OPT_v = 1 << 17,
};
+#if ENABLE_GETOPT_LONG
static const struct option arg_options[] = {
{ "clientid", required_argument, 0, 'c' },
{ "clientid-none", no_argument, 0, 'C' },
{ "retries", required_argument, 0, 't' },
{ 0, 0, 0, 0 }
};
-
+#endif
/* Default options. */
client_config.interface = "eth0";
client_config.script = DEFAULT_SCRIPT;
/* Parse command line */
opt_complementary = "?:c--C:C--c" // mutually exclusive
":hH:Hh"; // -h and -H are the same
+#if ENABLE_GETOPT_LONG
applet_long_options = arg_options;
+#endif
opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v",
&str_c, &str_V, &str_h, &str_h, &str_F,
&client_config.interface, &client_config.pidfile, &str_r,
sym_init();
menu_init();
modules_sym = sym_lookup("MODULES", 0);
- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
+ rootmenu.prompt = menu_add_prompt(P_MENU, "Busybox Configuration", NULL);
#if YYDEBUG
if (getenv("ZCONF_DEBUG"))
sym_init();
menu_init();
modules_sym = sym_lookup("MODULES", 0);
- rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
+ rootmenu.prompt = menu_add_prompt(P_MENU, "Busybox Configuration", NULL);
#if YYDEBUG
if (getenv("ZCONF_DEBUG"))