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-w32-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.tar.gz busybox-w32-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.tar.bz2 busybox-w32-064f04e7e2b1316f7c3de1ac7dd1fc4d4e108dd5.zip |
- 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) | |||
204 | 204 | ||
205 | 205 | ||
206 | static const struct option ssd_long_options[] = { | 206 | static const struct option ssd_long_options[] = { |
207 | { "stop", 0, NULL, 'K' }, | 207 | { "stop", 0, NULL, 'K' }, |
208 | { "start", 0, NULL, 'S' }, | 208 | { "start", 0, NULL, 'S' }, |
209 | { "background", 0, NULL, 'b' }, | 209 | { "background", 0, NULL, 'b' }, |
210 | { "quiet", 0, NULL, 'q' }, | 210 | { "quiet", 0, NULL, 'q' }, |
211 | { "make-pidfile", 0, NULL, 'm' }, | 211 | { "make-pidfile", 0, NULL, 'm' }, |
212 | { "startas", 1, NULL, 'a' }, | 212 | { "startas", 1, NULL, 'a' }, |
213 | { "name", 1, NULL, 'n' }, | 213 | { "name", 1, NULL, 'n' }, |
214 | { "signal", 1, NULL, 's' }, | 214 | { "signal", 1, NULL, 's' }, |
215 | { "user", 1, NULL, 'u' }, | 215 | { "user", 1, NULL, 'u' }, |
216 | { "exec", 1, NULL, 'x' }, | 216 | { "exec", 1, NULL, 'x' }, |
217 | { "pidfile", 1, NULL, 'p' }, | 217 | { "pidfile", 1, NULL, 'p' }, |
218 | { 0, 0, 0, 0 } | 218 | { 0, 0, 0, 0 } |
219 | }; | 219 | }; |
220 | 220 | ||
221 | #define SSD_CTX_STOP 1 | 221 | #define SSD_CTX_STOP 1 |
@@ -233,17 +233,13 @@ start_stop_daemon_main(int argc, char **argv) | |||
233 | 233 | ||
234 | bb_applet_long_options = ssd_long_options; | 234 | bb_applet_long_options = ssd_long_options; |
235 | 235 | ||
236 | bb_opt_complementally = "!K~S:S~K"; | 236 | /* Check required one context option was given */ |
237 | bb_opt_complementally = "?:K?K:S?S:K~S:S~K"; | ||
237 | opt = bb_getopt_ulflags(argc, argv, "KSbqma:n:s:u:x:p:", | 238 | opt = bb_getopt_ulflags(argc, argv, "KSbqma:n:s:u:x:p:", |
238 | &startas, &cmdname, &signame, &userspec, &execname, &pidfile); | 239 | &startas, &cmdname, &signame, &userspec, &execname, &pidfile); |
239 | 240 | ||
240 | /* Check required one context option was given */ | 241 | |
241 | if ((opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) { | 242 | quiet = opt & SSD_OPT_QUIET; |
242 | bb_show_usage(); | ||
243 | } | ||
244 | |||
245 | if (opt & SSD_OPT_QUIET) | ||
246 | quiet = 1; | ||
247 | 243 | ||
248 | if (signame) { | 244 | if (signame) { |
249 | signal_nr = bb_xgetlarg(signame, 10, 0, NSIG); | 245 | signal_nr = bb_xgetlarg(signame, 10, 0, NSIG); |