fix support for globally disabling --long-options.
(disabling them saves ~4K on fully configured bbox)
This commit is contained in:
@@ -264,15 +264,13 @@ int ftp_send(ftp_host_info_t *server, FILE *control_stream,
|
||||
|
||||
#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)
|
||||
@@ -307,9 +305,9 @@ 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 */
|
||||
|
@@ -64,19 +64,18 @@ int get_prefix(unsigned long netmask);
|
||||
|
||||
#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;
|
||||
@@ -85,9 +84,9 @@ int ipcalc_main(int argc, char **argv)
|
||||
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;
|
||||
|
@@ -160,6 +160,7 @@ int udhcpc_main(int argc, char *argv[])
|
||||
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' },
|
||||
@@ -181,7 +182,7 @@ int udhcpc_main(int argc, char *argv[])
|
||||
{ "retries", required_argument, 0, 't' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
#endif
|
||||
/* Default options. */
|
||||
client_config.interface = "eth0";
|
||||
client_config.script = DEFAULT_SCRIPT;
|
||||
@@ -191,7 +192,9 @@ int udhcpc_main(int argc, char *argv[])
|
||||
/* 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,
|
||||
|
Reference in New Issue
Block a user