diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-11 14:38:01 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-10-11 14:38:01 +0000 |
commit | 064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5 (patch) | |
tree | dcf88d0a287b1f154984bfc0acb292631df2f1f3 /debianutils | |
parent | ff567f7943f50b88dea14cd27636168ba2d319b5 (diff) | |
download | busybox-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.tar.gz |
- 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.
Diffstat (limited to 'debianutils')
-rw-r--r-- | debianutils/start_stop_daemon.c | 28 |
1 files changed, 12 insertions, 16 deletions
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); |