[BusyBox] please review and apply this patch.

drwho drwho at f34r.com
Mon Dec 1 02:39:12 UTC 2003


This is for unstable start-stop-daemon to add
long param support IMHO very important unless you like
rewriting all of your init scripts.

Regards
 Sean M

-------------- next part --------------
--- beta2/busybox/debianutils/start_stop_daemon.c	Wed Jul 30 01:29:56 2003
+++ busybox/debianutils/start_stop_daemon.c	Sun Nov 30 17:20:51 2003
@@ -192,23 +192,52 @@
 	{ "signal",		1,		NULL,		's' },
 	{ "user",		1,		NULL,		'u' },
 	{ "exec",		1,		NULL,		'x' },
+	{ "quiet",		1,		NULL,		'q' },
+	{ "verbose",	1,		NULL,		'v' },
 	{ 0,			0,		0,			0 }
 };
 
 int
 start_stop_daemon_main(int argc, char **argv)
 {
-	int flags;
+	int opt;
+	int option_index;
 	char *signame = NULL;
 	bb_applet_long_options = ssd_long_options;
-
-	flags = bb_getopt_ulflags(argc, argv, "KSba:n:s:u:x:", 
-			&startas, &cmdname, &signame, &userspec, &execname);
-
-	/* Be sneaky and avoid branching */
-	stop = (flags & 1);
-	start = (flags & 2);
-	fork_before_exec = (flags & 4);
+	while ((opt = getopt_long (argc, argv, "KSba:n:s:u:x:",
+                    ssd_long_options, &option_index)) > 0)
+    {
+		switch (opt) {
+			case 'K':
+				stop = 1;
+				break;
+			case 'S':
+				start = 1;
+				break;
+			case 'b':
+				fork_before_exec = 1;
+				break;
+			case 'a':
+			    startas = optarg;
+				break;
+			case 'n':
+			    cmdname = optarg;
+			    break;
+			case 's':
+				signame = optarg;
+				break;
+			case 'u':
+				userspec = optarg;
+				break;
+			case 'x':
+				execname = optarg;
+				break;
+			case 'q': /* not implemented yet */
+			case 'v': /* not implemented yet */
+			default:
+				bb_show_usage();
+		}
+	}
 
 	if (signame) {
 		signal_nr = bb_xgetlarg(signame, 10, 0, NSIG);



More information about the busybox mailing list