-#include "busybox.h"
-#include <getopt.h>
-
-static const struct option runparts_long_options[] = {
- { "test", 0, NULL, 't' },
- { "umask", 1, NULL, 'u' },
- { "arg", 1, NULL, 'a' },
- { 0, 0, 0, 0 }
+//usage:#define run_parts_trivial_usage
+//usage: "[-t] "IF_FEATURE_RUN_PARTS_FANCY("[-l] ")"[-a ARG] [-u MASK] DIRECTORY"
+//usage:#define run_parts_full_usage "\n\n"
+//usage: "Run a bunch of scripts in DIRECTORY\n"
+//usage: "\nOptions:"
+//usage: "\n -t Print what would be run, but don't actually run anything"
+//usage: "\n -a ARG Pass ARG as argument for every program"
+//usage: "\n -u MASK Set the umask to MASK before running every program"
+//usage: IF_FEATURE_RUN_PARTS_FANCY(
+//usage: "\n -l Print names of all matching files even if they are not executable"
+//usage: )
+//usage:
+//usage:#define run_parts_example_usage
+//usage: "$ run-parts -a start /etc/init.d\n"
+//usage: "$ run-parts -a stop=now /etc/init.d\n\n"
+//usage: "Let's assume you have a script foo/dosomething:\n"
+//usage: "#!/bin/sh\n"
+//usage: "for i in $*; do eval $i; done; unset i\n"
+//usage: "case \"$1\" in\n"
+//usage: "start*) echo starting something;;\n"
+//usage: "stop*) set -x; shutdown -h $stop;;\n"
+//usage: "esac\n\n"
+//usage: "Running this yields:\n"
+//usage: "$run-parts -a stop=+4m foo/\n"
+//usage: "+ shutdown -h +4m"
+
+#include "libbb.h"
+
+struct globals {
+ char **names;
+ int cur;
+ char *cmd[1];
+} FIX_ALIASING;
+#define G (*(struct globals*)&bb_common_bufsiz1)
+#define names (G.names)
+#define cur (G.cur )
+#define cmd (G.cmd )
+
+enum { NUM_CMD = (COMMON_BUFSIZE - sizeof(G)) / sizeof(cmd[0]) - 1 };
+
+enum {
+ OPT_r = (1 << 0),
+ OPT_a = (1 << 1),
+ OPT_u = (1 << 2),
+ OPT_t = (1 << 3),
+ OPT_l = (1 << 4) * ENABLE_FEATURE_RUN_PARTS_FANCY,