aboutsummaryrefslogtreecommitdiff
path: root/debianutils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-07-26 09:16:00 +0000
committerEric Andersen <andersen@codepoet.org>2003-07-26 09:16:00 +0000
commita1ed06b04739d85389fe23e78e97556864b77c64 (patch)
tree80ceac0ee76ad0bee1838252ced4f0cfd097659c /debianutils
parentaa820dbc00860a2ddcb7a0205345ffe39c7d18d7 (diff)
downloadbusybox-w32-a1ed06b04739d85389fe23e78e97556864b77c64.tar.gz
busybox-w32-a1ed06b04739d85389fe23e78e97556864b77c64.tar.bz2
busybox-w32-a1ed06b04739d85389fe23e78e97556864b77c64.zip
Move start_stop_daemon to debianutils.
Cleanup run_parts a bit and add long opts
Diffstat (limited to 'debianutils')
-rw-r--r--debianutils/Config.in8
-rw-r--r--debianutils/Makefile.in1
-rw-r--r--debianutils/run_parts.c56
3 files changed, 40 insertions, 25 deletions
diff --git a/debianutils/Config.in b/debianutils/Config.in
index 108cc5388..8bdb91f26 100644
--- a/debianutils/Config.in
+++ b/debianutils/Config.in
@@ -33,6 +33,14 @@ config CONFIG_RUN_PARTS
33 Unless you know that run-parts is used in some of your scripts 33 Unless you know that run-parts is used in some of your scripts
34 you can safely say N here. 34 you can safely say N here.
35 35
36config CONFIG_START_STOP_DAEMON
37 bool "start-stop-daemon"
38 default y
39 help
40 start-stop-daemon is used to control the creation and
41 termination of system-level processes, usually the ones
42 started during the startup of the system.
43
36config CONFIG_WHICH 44config CONFIG_WHICH
37 bool "which" 45 bool "which"
38 default n 46 default n
diff --git a/debianutils/Makefile.in b/debianutils/Makefile.in
index 313faa0de..8ca05c738 100644
--- a/debianutils/Makefile.in
+++ b/debianutils/Makefile.in
@@ -27,6 +27,7 @@ DEBIANUTILS-y:=
27DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o 27DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
28DEBIANUTILS-$(CONFIG_READLINK) += readlink.o 28DEBIANUTILS-$(CONFIG_READLINK) += readlink.o
29DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o 29DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o
30DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
30DEBIANUTILS-$(CONFIG_WHICH) += which.o 31DEBIANUTILS-$(CONFIG_WHICH) += which.o
31 32
32libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR) 33libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR)
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index a941e1fc8..98fd58887 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -54,6 +54,13 @@
54 54
55#include "libbb.h" 55#include "libbb.h"
56 56
57static const struct option runparts_long_options[] = {
58 { "test", 0, NULL, 't' },
59 { "umask", 1, NULL, 'u' },
60 { "arg", 1, NULL, 'a' },
61 { 0, 0, 0, 0 }
62};
63
57/* run_parts_main */ 64/* run_parts_main */
58/* Process options */ 65/* Process options */
59int run_parts_main(int argc, char **argv) 66int run_parts_main(int argc, char **argv)
@@ -65,32 +72,31 @@ int run_parts_main(int argc, char **argv)
65 72
66 umask(022); 73 umask(022);
67 74
68 while ((opt = getopt(argc, argv, "tu:a:")) != -1) { 75 while ((opt = getopt_long (argc, argv, "tu:a:",
76 runparts_long_options, NULL)) > 0)
77 {
69 switch (opt) { 78 switch (opt) {
70 case 't': /* Enable test mode */ 79 /* Enable test mode */
71 test_mode = 1; 80 case 't':
72 break; 81 test_mode++;
73 case 'u': /* Set the umask of the programs executed */ 82 break;
74 /* Check and set the umask of the program executed. As stated in the original 83 /* Set the umask of the programs executed */
75 * run-parts, the octal conversion in libc is not foolproof; it will take the 84 case 'u':
76 * 8 and 9 digits under some circumstances. We'll just have to live with it. 85 /* Check and set the umask of the program executed. As stated in the original
77 */ 86 * run-parts, the octal conversion in libc is not foolproof; it will take the
78 { 87 * 8 and 9 digits under some circumstances. We'll just have to live with it.
79 const unsigned int mask = (unsigned int) strtol(optarg, NULL, 8); 88 */
80 if (mask > 07777) { 89 umask(bb_xgetlarg(optarg, 8, 0, 07777));
81 bb_perror_msg_and_die("bad umask value"); 90 break;
82 } 91 /* Pass an argument to the programs */
83 umask(mask); 92 case 'a':
84 } 93 /* Add an argument to the commands that we will call.
85 break; 94 * Called once for every argument. */
86 case 'a': /* Pass an argument to the programs */ 95 args = xrealloc(args, (argcount + 2) * (sizeof(char *)));
87 /* Add an argument to the commands that we will call. 96 args[argcount++] = optarg;
88 * Called once for every argument. */ 97 break;
89 args = xrealloc(args, (argcount + 2) * (sizeof(char *))); 98 default:
90 args[argcount++] = optarg; 99 bb_show_usage();
91 break;
92 default:
93 bb_show_usage();
94 } 100 }
95 } 101 }
96 102