From d4685722060c23b625164beccacab6b476fcd5cd Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 9 Oct 2007 17:41:53 +0000 Subject: [PATCH] Improve applet help a little. Also, if mountinfo as any mounts given, work explictly with --netdev/--nonetdev --- src/_usage.c | 2 +- src/_usage.h | 3 ++- src/checkown.c | 11 +++++------ src/env-update.c | 1 - src/fstabinfo.c | 1 - src/mountinfo.c | 29 +++++++++++++++-------------- src/rc-depend.c | 1 - src/rc-status.c | 3 +-- src/rc-update.c | 1 - src/rc.c | 1 - src/runscript.c | 1 - src/start-stop-daemon.c | 1 - 12 files changed, 24 insertions(+), 31 deletions(-) diff --git a/src/_usage.c b/src/_usage.c index 5d693381..6b96510d 100644 --- a/src/_usage.c +++ b/src/_usage.c @@ -20,7 +20,7 @@ static void usage (int exit_status) for (i = 0; longopts[i].name; ++i) { int len = printf (" -%c, --%s %s", longopts[i].val, longopts[i].name, has_arg[longopts[i].has_arg]); - while (++len < 30) + while (++len < 37) printf (" "); puts (longopts_help[i]); } diff --git a/src/_usage.h b/src/_usage.h index f75da52e..9d5ee69d 100644 --- a/src/_usage.h +++ b/src/_usage.h @@ -13,7 +13,8 @@ { "help", 0, NULL, 'h'}, \ { "nocolor", 0, NULL, 'C'}, \ { "verbose", 0, NULL, 'v'}, \ - { "quiet", 0, NULL, 'q'}, + { "quiet", 0, NULL, 'q'}, \ + { NULL, 0, NULL, 0 } #define longopts_help_COMMON \ "Display this help output (duh)", \ diff --git a/src/checkown.c b/src/checkown.c index c979bfbe..9fd9de1a 100644 --- a/src/checkown.c +++ b/src/checkown.c @@ -141,14 +141,13 @@ static struct option longopts[] = { { "user", 1, NULL, 'u'}, { "group", 1, NULL, 'g'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { - "", - "", - "", - "", - "", + "Check if a directory", + "Check if a file", + "Mode to check", + "User to check", + "Group to check", longopts_help_COMMON }; #include "_usage.c" diff --git a/src/env-update.c b/src/env-update.c index 3df8af73..7fcd03ad 100644 --- a/src/env-update.c +++ b/src/env-update.c @@ -80,7 +80,6 @@ static struct option longopts[] = { { "fork-ldconfig", 0, NULL, 'l'}, { "no-ldconfig", 0, NULL, 'L'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { "Fork ldconfig into the background", diff --git a/src/fstabinfo.c b/src/fstabinfo.c index 5e1781e4..23b5c42a 100644 --- a/src/fstabinfo.c +++ b/src/fstabinfo.c @@ -71,7 +71,6 @@ static struct option longopts[] = { { "passno", 1, NULL, 'p'}, { "fstype", 1, NULL, 't'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { "Extract the options field", diff --git a/src/mountinfo.c b/src/mountinfo.c index d8cbc066..061ae945 100644 --- a/src/mountinfo.c +++ b/src/mountinfo.c @@ -72,10 +72,10 @@ static int process_mount (char ***list, struct args *args, return (-1); #endif - if (args->netdev == net_yes && netdev != -1) { + if (args->netdev == net_yes && (netdev != -1 || args->mounts)) { if (netdev != 0) return (1); - } else if (args->netdev == net_no && netdev != -1) { + } else if (args->netdev == net_no && (netdev != -1 || args->mounts)) { if (netdev != 1) return (1); } else { @@ -307,20 +307,21 @@ static struct option longopts[] = { { "netdev", 0, NULL, 'e'}, { "nonetdev", 0, NULL, 'E'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + "fstype regex to find", + "fstype regex to skip", + "node regex to find", + "node regex to skip", + "options regex to find", + "options regex to skip", + "point regex to find", + "point regex to skip", + "print options", + "print fstype", + "print node", + "is it a network device", + "is it not a network device", longopts_help_COMMON }; #include "_usage.c" diff --git a/src/rc-depend.c b/src/rc-depend.c index ad95d6a4..2e0d3037 100644 --- a/src/rc-depend.c +++ b/src/rc-depend.c @@ -45,7 +45,6 @@ static struct option longopts[] = { { "strict", 0, NULL, 's'}, { "update", 0, NULL, 'u'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { "Type(s) of dependency to list", diff --git a/src/rc-status.c b/src/rc-status.c index b23c93a7..77654c25 100644 --- a/src/rc-status.c +++ b/src/rc-status.c @@ -69,13 +69,12 @@ static const struct option longopts[] = { {"servicelist", 0, NULL, 's'}, {"unused", 0, NULL, 'u'}, longopts_COMMON - {NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { "Show services from all run levels", "Show list of run levels", "Show service list", - "Show services not assigned to any run level", + "Show services not assigned to any runlevel", longopts_help_COMMON }; #include "_usage.c" diff --git a/src/rc-update.c b/src/rc-update.c index 2c0b35c8..f11952e8 100644 --- a/src/rc-update.c +++ b/src/rc-update.c @@ -116,7 +116,6 @@ static struct option longopts[] = { { "delete", 0, NULL, 'd'}, { "show", 0, NULL, 's'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { "Add the init.d to runlevels", diff --git a/src/rc.c b/src/rc.c index 9b8b1ea0..7058be15 100644 --- a/src/rc.c +++ b/src/rc.c @@ -731,7 +731,6 @@ static void run_script (const char *script) { #define getoptstring getoptstring_COMMON static struct option longopts[] = { longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { longopts_help_COMMON diff --git a/src/runscript.c b/src/runscript.c index a4eefffe..4d080594 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -983,7 +983,6 @@ static struct option longopts[] = { { "ifstarted", 0, NULL, 's'}, { "nodeps", 0, NULL, 'D'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { "", diff --git a/src/start-stop-daemon.c b/src/start-stop-daemon.c index 0b7c94fe..86eccb12 100644 --- a/src/start-stop-daemon.c +++ b/src/start-stop-daemon.c @@ -484,7 +484,6 @@ static struct option longopts[] = { { "stdout", 1, NULL, '1'}, { "stderr", 1, NULL, '2'}, longopts_COMMON - { NULL, 0, NULL, 0} }; static const char * const longopts_help[] = { "Stop daemon",