diff options
| author | Ron Yorston <rmy@pobox.com> | 2012-03-22 14:11:12 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 14:11:12 +0000 |
| commit | 67758035a4fe040c6ac69b39d61bcd6bddd7b827 (patch) | |
| tree | a4a1db7f54c16d12fabe2626b8f1e235cd694e9e /debianutils | |
| parent | 811c449748d5bd0505f8510e5582892f94ac0cda (diff) | |
| parent | b83c9704128dd106071184e4b00335a3b8486857 (diff) | |
| download | busybox-w32-67758035a4fe040c6ac69b39d61bcd6bddd7b827.tar.gz busybox-w32-67758035a4fe040c6ac69b39d61bcd6bddd7b827.tar.bz2 busybox-w32-67758035a4fe040c6ac69b39d61bcd6bddd7b827.zip | |
Merge commit 'b83c9704128dd106071184e4b00335a3b8486857' into merge
Diffstat (limited to 'debianutils')
| -rw-r--r-- | debianutils/pipe_progress.c | 4 | ||||
| -rw-r--r-- | debianutils/run_parts.c | 26 | ||||
| -rw-r--r-- | debianutils/start_stop_daemon.c | 73 | ||||
| -rw-r--r-- | debianutils/which.c | 9 |
4 files changed, 110 insertions, 2 deletions
diff --git a/debianutils/pipe_progress.c b/debianutils/pipe_progress.c index 1e57dc241..2c7444f31 100644 --- a/debianutils/pipe_progress.c +++ b/debianutils/pipe_progress.c | |||
| @@ -6,6 +6,10 @@ | |||
| 6 | * | 6 | * |
| 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 8 | */ | 8 | */ |
| 9 | |||
| 10 | //usage:#define pipe_progress_trivial_usage NOUSAGE_STR | ||
| 11 | //usage:#define pipe_progress_full_usage "" | ||
| 12 | |||
| 9 | #include "libbb.h" | 13 | #include "libbb.h" |
| 10 | 14 | ||
| 11 | #define PIPE_PROGRESS_SIZE 4096 | 15 | #define PIPE_PROGRESS_SIZE 4096 |
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index b93a5a917..0c2302696 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c | |||
| @@ -30,6 +30,32 @@ | |||
| 30 | * -u MASK umask. Set the umask of the program executed to MASK. | 30 | * -u MASK umask. Set the umask of the program executed to MASK. |
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | //usage:#define run_parts_trivial_usage | ||
| 34 | //usage: "[-t] "IF_FEATURE_RUN_PARTS_FANCY("[-l] ")"[-a ARG] [-u MASK] DIRECTORY" | ||
| 35 | //usage:#define run_parts_full_usage "\n\n" | ||
| 36 | //usage: "Run a bunch of scripts in DIRECTORY\n" | ||
| 37 | //usage: "\nOptions:" | ||
| 38 | //usage: "\n -t Print what would be run, but don't actually run anything" | ||
| 39 | //usage: "\n -a ARG Pass ARG as argument for every program" | ||
| 40 | //usage: "\n -u MASK Set the umask to MASK before running every program" | ||
| 41 | //usage: IF_FEATURE_RUN_PARTS_FANCY( | ||
| 42 | //usage: "\n -l Print names of all matching files even if they are not executable" | ||
| 43 | //usage: ) | ||
| 44 | //usage: | ||
| 45 | //usage:#define run_parts_example_usage | ||
| 46 | //usage: "$ run-parts -a start /etc/init.d\n" | ||
| 47 | //usage: "$ run-parts -a stop=now /etc/init.d\n\n" | ||
| 48 | //usage: "Let's assume you have a script foo/dosomething:\n" | ||
| 49 | //usage: "#!/bin/sh\n" | ||
| 50 | //usage: "for i in $*; do eval $i; done; unset i\n" | ||
| 51 | //usage: "case \"$1\" in\n" | ||
| 52 | //usage: "start*) echo starting something;;\n" | ||
| 53 | //usage: "stop*) set -x; shutdown -h $stop;;\n" | ||
| 54 | //usage: "esac\n\n" | ||
| 55 | //usage: "Running this yields:\n" | ||
| 56 | //usage: "$run-parts -a stop=+4m foo/\n" | ||
| 57 | //usage: "+ shutdown -h +4m" | ||
| 58 | |||
| 33 | #include "libbb.h" | 59 | #include "libbb.h" |
| 34 | 60 | ||
| 35 | struct globals { | 61 | struct globals { |
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index d2ee95068..bc61959d2 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
| @@ -56,6 +56,69 @@ Misc options: | |||
| 56 | -v,--verbose Verbose | 56 | -v,--verbose Verbose |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | //usage:#define start_stop_daemon_trivial_usage | ||
| 60 | //usage: "[OPTIONS] [-S|-K] ... [-- ARGS...]" | ||
| 61 | //usage:#define start_stop_daemon_full_usage "\n\n" | ||
| 62 | //usage: "Search for matching processes, and then\n" | ||
| 63 | //usage: "-K: stop all matching processes.\n" | ||
| 64 | //usage: "-S: start a process unless a matching process is found.\n" | ||
| 65 | //usage: IF_FEATURE_START_STOP_DAEMON_LONG_OPTIONS( | ||
| 66 | //usage: "\nProcess matching:" | ||
| 67 | //usage: "\n -u,--user USERNAME|UID Match only this user's processes" | ||
| 68 | //usage: "\n -n,--name NAME Match processes with NAME" | ||
| 69 | //usage: "\n in comm field in /proc/PID/stat" | ||
| 70 | //usage: "\n -x,--exec EXECUTABLE Match processes with this command" | ||
| 71 | //usage: "\n in /proc/PID/cmdline" | ||
| 72 | //usage: "\n -p,--pidfile FILE Match a process with PID from the file" | ||
| 73 | //usage: "\n All specified conditions must match" | ||
| 74 | //usage: "\n-S only:" | ||
| 75 | //usage: "\n -x,--exec EXECUTABLE Program to run" | ||
| 76 | //usage: "\n -a,--startas NAME Zeroth argument" | ||
| 77 | //usage: "\n -b,--background Background" | ||
| 78 | //usage: IF_FEATURE_START_STOP_DAEMON_FANCY( | ||
| 79 | //usage: "\n -N,--nicelevel N Change nice level" | ||
| 80 | //usage: ) | ||
| 81 | //usage: "\n -c,--chuid USER[:[GRP]] Change to user/group" | ||
| 82 | //usage: "\n -m,--make-pidfile Write PID to the pidfile specified by -p" | ||
| 83 | //usage: "\n-K only:" | ||
| 84 | //usage: "\n -s,--signal SIG Signal to send" | ||
| 85 | //usage: "\n -t,--test Match only, exit with 0 if a process is found" | ||
| 86 | //usage: "\nOther:" | ||
| 87 | //usage: IF_FEATURE_START_STOP_DAEMON_FANCY( | ||
| 88 | //usage: "\n -o,--oknodo Exit with status 0 if nothing is done" | ||
| 89 | //usage: "\n -v,--verbose Verbose" | ||
| 90 | //usage: ) | ||
| 91 | //usage: "\n -q,--quiet Quiet" | ||
| 92 | //usage: ) | ||
| 93 | //usage: IF_NOT_FEATURE_START_STOP_DAEMON_LONG_OPTIONS( | ||
| 94 | //usage: "\nProcess matching:" | ||
| 95 | //usage: "\n -u USERNAME|UID Match only this user's processes" | ||
| 96 | //usage: "\n -n NAME Match processes with NAME" | ||
| 97 | //usage: "\n in comm field in /proc/PID/stat" | ||
| 98 | //usage: "\n -x EXECUTABLE Match processes with this command" | ||
| 99 | //usage: "\n command in /proc/PID/cmdline" | ||
| 100 | //usage: "\n -p FILE Match a process with PID from the file" | ||
| 101 | //usage: "\n All specified conditions must match" | ||
| 102 | //usage: "\n-S only:" | ||
| 103 | //usage: "\n -x EXECUTABLE Program to run" | ||
| 104 | //usage: "\n -a NAME Zeroth argument" | ||
| 105 | //usage: "\n -b Background" | ||
| 106 | //usage: IF_FEATURE_START_STOP_DAEMON_FANCY( | ||
| 107 | //usage: "\n -N N Change nice level" | ||
| 108 | //usage: ) | ||
| 109 | //usage: "\n -c USER[:[GRP]] Change to user/group" | ||
| 110 | //usage: "\n -m Write PID to the pidfile specified by -p" | ||
| 111 | //usage: "\n-K only:" | ||
| 112 | //usage: "\n -s SIG Signal to send" | ||
| 113 | //usage: "\n -t Match only, exit with 0 if a process is found" | ||
| 114 | //usage: "\nOther:" | ||
| 115 | //usage: IF_FEATURE_START_STOP_DAEMON_FANCY( | ||
| 116 | //usage: "\n -o Exit with status 0 if nothing is done" | ||
| 117 | //usage: "\n -v Verbose" | ||
| 118 | //usage: ) | ||
| 119 | //usage: "\n -q Quiet" | ||
| 120 | //usage: ) | ||
| 121 | |||
| 59 | #include <sys/resource.h> | 122 | #include <sys/resource.h> |
| 60 | 123 | ||
| 61 | /* Override ENABLE_FEATURE_PIDFILE */ | 124 | /* Override ENABLE_FEATURE_PIDFILE */ |
| @@ -274,11 +337,17 @@ static int do_stop(void) | |||
| 274 | goto ret; | 337 | goto ret; |
| 275 | } | 338 | } |
| 276 | for (p = G.found_procs; p; p = p->next) { | 339 | for (p = G.found_procs; p; p = p->next) { |
| 277 | if (TEST || kill(p->pid, signal_nr) == 0) { | 340 | if (kill(p->pid, TEST ? 0 : signal_nr) == 0) { |
| 278 | killed++; | 341 | killed++; |
| 279 | } else { | 342 | } else { |
| 280 | p->pid = 0; | ||
| 281 | bb_perror_msg("warning: killing process %u", (unsigned)p->pid); | 343 | bb_perror_msg("warning: killing process %u", (unsigned)p->pid); |
| 344 | p->pid = 0; | ||
| 345 | if (TEST) { | ||
| 346 | /* Example: -K --test --pidfile PIDFILE detected | ||
| 347 | * that PIDFILE's pid doesn't exist */ | ||
| 348 | killed = -1; | ||
| 349 | goto ret; | ||
| 350 | } | ||
| 282 | } | 351 | } |
| 283 | } | 352 | } |
| 284 | if (!QUIET && killed) { | 353 | if (!QUIET && killed) { |
diff --git a/debianutils/which.c b/debianutils/which.c index 0cf786803..6e92901bc 100644 --- a/debianutils/which.c +++ b/debianutils/which.c | |||
| @@ -10,6 +10,15 @@ | |||
| 10 | * Based on which from debianutils | 10 | * Based on which from debianutils |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | //usage:#define which_trivial_usage | ||
| 14 | //usage: "[COMMAND]..." | ||
| 15 | //usage:#define which_full_usage "\n\n" | ||
| 16 | //usage: "Locate a COMMAND" | ||
| 17 | //usage: | ||
| 18 | //usage:#define which_example_usage | ||
| 19 | //usage: "$ which login\n" | ||
| 20 | //usage: "/bin/login\n" | ||
| 21 | |||
| 13 | #include "libbb.h" | 22 | #include "libbb.h" |
| 14 | 23 | ||
| 15 | int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 24 | int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
