udhcp: IF_UDHCP_VERBOSE() macro - improve code readability
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
cd06e06eee
commit
6c9c0a1dc9
@ -248,6 +248,7 @@ struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code)
|
|||||||
/*** Logging ***/
|
/*** Logging ***/
|
||||||
|
|
||||||
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
|
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
|
||||||
|
# define IF_UDHCP_VERBOSE(...) __VA_ARGS__
|
||||||
extern unsigned dhcp_verbose;
|
extern unsigned dhcp_verbose;
|
||||||
# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0)
|
# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0)
|
||||||
# if CONFIG_UDHCP_DEBUG >= 2
|
# if CONFIG_UDHCP_DEBUG >= 2
|
||||||
@ -263,6 +264,7 @@ void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC;
|
|||||||
# define log3(...) ((void)0)
|
# define log3(...) ((void)0)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
|
# define IF_UDHCP_VERBOSE(...)
|
||||||
# define udhcp_dump_packet(...) ((void)0)
|
# define udhcp_dump_packet(...) ((void)0)
|
||||||
# define log1(...) ((void)0)
|
# define log1(...) ((void)0)
|
||||||
# define log2(...) ((void)0)
|
# define log2(...) ((void)0)
|
||||||
|
@ -1077,11 +1077,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
|
|
||||||
/* Parse command line */
|
/* Parse command line */
|
||||||
/* O,x: list; -T,-t,-A take numeric param */
|
/* O,x: list; -T,-t,-A take numeric param */
|
||||||
opt_complementary = "O::x::T+:t+:A+"
|
opt_complementary = "O::x::T+:t+:A+" IF_UDHCP_VERBOSE(":vv") ;
|
||||||
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
|
|
||||||
":vv"
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
IF_LONG_OPTS(applet_long_options = udhcpc_longopts;)
|
IF_LONG_OPTS(applet_long_options = udhcpc_longopts;)
|
||||||
opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB"
|
opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB"
|
||||||
USE_FOR_MMU("b")
|
USE_FOR_MMU("b")
|
||||||
@ -1095,9 +1091,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
, &list_O
|
, &list_O
|
||||||
, &list_x
|
, &list_x
|
||||||
IF_FEATURE_UDHCP_PORT(, &str_P)
|
IF_FEATURE_UDHCP_PORT(, &str_P)
|
||||||
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
|
IF_UDHCP_VERBOSE(, &dhcp_verbose)
|
||||||
, &dhcp_verbose
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
if (opt & (OPT_h|OPT_H))
|
if (opt & (OPT_h|OPT_H))
|
||||||
client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
|
client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
|
||||||
|
@ -314,9 +314,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
opt = getopt32(argv, "fSv"
|
opt = getopt32(argv, "fSv"
|
||||||
IF_FEATURE_UDHCP_PORT("P:", &str_P)
|
IF_FEATURE_UDHCP_PORT("P:", &str_P)
|
||||||
#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
|
IF_UDHCP_VERBOSE(, &dhcp_verbose)
|
||||||
, &dhcp_verbose
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
if (!(opt & 1)) { /* no -f */
|
if (!(opt & 1)) { /* no -f */
|
||||||
bb_daemonize_or_rexec(0, argv);
|
bb_daemonize_or_rexec(0, argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user