From 064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5 Mon Sep 17 00:00:00 2001 From: "\"Vladimir N. Oleynik\"" Date: Tue, 11 Oct 2005 14:38:01 +0000 Subject: - use complementally '!' to '?' - 'ask' is best 'free' char for this. - more long opt compatibility, can set flag for long opt struct now - more logic: check opt-depend requires and global requires, special for 'id' and 'start-stop-daemon' applets. --- debianutils/start_stop_daemon.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'debianutils') diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index f9310af8d..b6c463556 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -204,18 +204,18 @@ do_stop(void) static const struct option ssd_long_options[] = { - { "stop", 0, NULL, 'K' }, - { "start", 0, NULL, 'S' }, + { "stop", 0, NULL, 'K' }, + { "start", 0, NULL, 'S' }, { "background", 0, NULL, 'b' }, - { "quiet", 0, NULL, 'q' }, + { "quiet", 0, NULL, 'q' }, { "make-pidfile", 0, NULL, 'm' }, { "startas", 1, NULL, 'a' }, - { "name", 1, NULL, 'n' }, - { "signal", 1, NULL, 's' }, - { "user", 1, NULL, 'u' }, - { "exec", 1, NULL, 'x' }, + { "name", 1, NULL, 'n' }, + { "signal", 1, NULL, 's' }, + { "user", 1, NULL, 'u' }, + { "exec", 1, NULL, 'x' }, { "pidfile", 1, NULL, 'p' }, - { 0, 0, 0, 0 } + { 0, 0, 0, 0 } }; #define SSD_CTX_STOP 1 @@ -233,17 +233,13 @@ start_stop_daemon_main(int argc, char **argv) bb_applet_long_options = ssd_long_options; - bb_opt_complementally = "!K~S:S~K"; + /* Check required one context option was given */ + bb_opt_complementally = "?:K?K:S?S:K~S:S~K"; opt = bb_getopt_ulflags(argc, argv, "KSbqma:n:s:u:x:p:", &startas, &cmdname, &signame, &userspec, &execname, &pidfile); - /* Check required one context option was given */ - if ((opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) { - bb_show_usage(); - } - - if (opt & SSD_OPT_QUIET) - quiet = 1; + + quiet = opt & SSD_OPT_QUIET; if (signame) { signal_nr = bb_xgetlarg(signame, 10, 0, NSIG); -- cgit v1.2.3