diff options
author | Jan Klötzke <jan@kloetzke.net> | 2019-05-03 22:35:51 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-06-03 13:00:47 +0200 |
commit | 728e53d38887c268b3557afadfc38472fa4f0cd6 (patch) | |
tree | 21a4a307870c6026828aeb3f413db51f7294a75a | |
parent | d04b7261735788eea5e4d6d4c8c7159f17942581 (diff) | |
download | busybox-728e53d38887c268b3557afadfc38472fa4f0cd6.tar.gz |
mdev: use option parser helper
function old new delta
process_action - 1051 +1051
mdev_main 1324 255 -1069
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 1051/-1069) Total: -18 bytes
Signed-off-by: Jan Klötzke <jan@kloetzke.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | util-linux/mdev.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 8205a260a..e730548f7 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -249,6 +249,10 @@ #endif +enum { + MDEV_OPT_SCAN = 1 << 0, +}; + static const char keywords[] ALIGN1 = "add\0remove\0"; // "change\0" enum { OP_add, OP_remove }; @@ -1047,7 +1051,7 @@ static void signal_mdevs(unsigned my_pid) } } -static void process_action(char *temp, unsigned my_pid) +static NOINLINE void process_action(char *temp, unsigned my_pid) { char *fw; char *seq; @@ -1130,6 +1134,7 @@ static void initial_scan(char *temp) int mdev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int mdev_main(int argc UNUSED_PARAM, char **argv) { + int opt; RESERVE_CONFIG_BUFFER(temp, PATH_MAX + SCRATCH_SIZE); INIT_G(); @@ -1147,7 +1152,9 @@ int mdev_main(int argc UNUSED_PARAM, char **argv) xchdir("/dev"); - if (argv[1] && strcmp(argv[1], "-s") == 0) { + opt = getopt32(argv, "s"); + + if (opt & MDEV_OPT_SCAN) { /* * Scan: mdev -s */ |