TOPDIR:= $(shell /bin/pwd)/
include $(TOPDIR).config
include $(TOPDIR)Rules.mak
-SUBDIRS:=applets archival archival/libunarchive console-tools \
+SUBDIRS:=applets archival archival/libunarchive console-tools debianutils \
editors fileutils findutils init miscutils modutils networking \
networking/libiproute networking/udhcp procps loginutils shell \
shellutils sysklogd textutils util-linux libbb libpwdgrp
--- /dev/null
+# Makefile for busybox
+#
+# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+TOPDIR:= ../
+DEBIANUTILS_DIR:=./
+include $(TOPDIR).config
+include $(TOPDIR)Rules.mak
+include Makefile.in
+all: $(libraries-y)
+-include $(TOPDIR).depend
+
+clean:
+ rm -f *.o *.a $(AR_TARGET)
+
--- /dev/null
+# Makefile for busybox
+#
+# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+DEBIANUTILS_AR:=debianutils.a
+ifndef $(DEBIANUTILS_DIR)
+DEBIANUTILS_DIR:=$(TOPDIR)debianutils/
+endif
+
+
+DEBIANUTILS-y:=
+DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
+DEBIANUTILS-$(CONFIG_READLINK) += readlink.o
+DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o
+DEBIANUTILS-$(CONFIG_WHICH) += which.o
+
+libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR)
+
+$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
+ $(AR) -ro $@ $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
+
--- /dev/null
+#
+# For a description of the syntax of this configuration file,
+# see scripts/kbuild/config-language.txt.
+#
+
+mainmenu_option next_comment
+comment 'Debian Utilities'
+
+bool 'mktemp' CONFIG_MKTEMP
+bool 'readlink' CONFIG_READLINK
+bool 'run-parts' CONFIG_RUN_PARTS
+bool 'which' CONFIG_WHICH
+
+endmenu
+
--- /dev/null
+/* vi: set sw=4 ts=4: */
+/*
+ * Mini mktemp implementation for busybox
+ *
+ *
+ * Copyright (C) 2000 by Daniel Jacobowitz
+ * Written by Daniel Jacobowitz <dan@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "busybox.h"
+
+extern int mktemp_main(int argc, char **argv)
+{
+ if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q")))
+ show_usage();
+ if(mkstemp(argv[argc-1]) < 0)
+ return EXIT_FAILURE;
+ (void) puts(argv[argc-1]);
+ return EXIT_SUCCESS;
+}
--- /dev/null
+/* vi: set sw=4 ts=4: */
+/*
+ * Mini readlink implementation for busybox
+ *
+ * Copyright (C) 2000,2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "busybox.h"
+
+int readlink_main(int argc, char **argv)
+{
+ char *buf = NULL;
+
+ /* no options, no getopt */
+
+ if (argc != 2)
+ show_usage();
+
+ buf = xreadlink(argv[1]);
+ if (!buf)
+ return EXIT_FAILURE;
+ puts(buf);
+#ifdef CONFIG_FEATURE_CLEAN_UP
+ free(buf);
+#endif
+
+ return EXIT_SUCCESS;
+}
--- /dev/null
+/* vi: set sw=4 ts=4: */
+/*
+ * Mini run-parts implementation for busybox
+ *
+ *
+ * Copyright (C) 2001 by Emanuele Aina <emanuele.aina@tiscali.it>
+ *
+ * Based on the Debian run-parts program, version 1.15
+ * Copyright (C) 1996 Jeff Noxon <jeff@router.patch.net>,
+ * Copyright (C) 1996-1999 Guy Maor <maor@debian.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA
+ *
+ */
+
+/* This is my first attempt to write a program in C (well, this is my first
+ * attempt to write a program! :-) . */
+
+/* This piece of code is heavily based on the original version of run-parts,
+ * taken from debian-utils. I've only removed the long options and a the
+ * report mode. As the original run-parts support only long options, I've
+ * broken compatibility because the BusyBox policy doesn't allow them.
+ * The supported options are:
+ * -t test. Print the name of the files to be executed, without
+ * execute them.
+ * -a ARG argument. Pass ARG as an argument the program executed. It can
+ * be repeated to pass multiple arguments.
+ * -u MASK umask. Set the umask of the program executed to MASK. */
+
+/* TODO
+ * done - convert calls to error in perror... and remove error()
+ * done - convert malloc/realloc to their x... counterparts
+ * done - remove catch_sigchld
+ * done - use bb's concat_path_file()
+ * done - declare run_parts_main() as extern and any other function as static?
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+/* #include <sys/types.h> */
+#include <sys/wait.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+
+#include "busybox.h"
+
+static int test_mode = 0;
+static int exitstatus = 0;
+
+static int argcount = 0, argsize = 0;
+static char **args = 0;
+
+
+/* set_umask */
+/* Check and set the umask of the program executed. As stated in the original
+ * run-parts, the octal conversion in libc is not foolproof; it will take the
+ * 8 and 9 digits under some circumstances. We'll just have to live with it.
+ */
+
+static void set_umask (void)
+{
+ int mask, result;
+
+ /*TODO
+ * We must substitute sscanf, according to bb's style guide? */
+ result = sscanf (optarg, "%o", &mask);
+ if ((result != 1) || (mask > 07777) || (mask < 0)) {
+ perror_msg_and_die ("bad umask value");
+ }
+
+ umask (mask);
+}
+
+/* add_argument */
+/* Add an argument to the commands that we will call. Called once for
+ every argument. */
+static void add_argument (char *newarg)
+{
+ if (argcount+1 >= argsize) {
+ argsize = argsize ? argsize*2 : 4;
+ /*TODO if we convert to xrealloc we lose the verbose error message */
+ args = realloc(args, argsize * (sizeof(char*)));
+ if (!args) {
+ perror_msg_and_die ("failed to reallocate memory for arguments");
+ }
+ }
+ args[argcount++] = newarg;
+ args[argcount] = 0;
+}
+
+/* valid_name */
+/* True or false? Is this a valid filename (upper/lower alpha, digits,
+ * underscores, and hyphens only?)
+ */
+
+static int valid_name (const struct dirent *d)
+{
+ char *c = d->d_name;
+ while (*c) {
+ if (!isalnum(*c) && *c!='_' && *c!='-') {
+ return 0;
+ }
+ ++c;
+ }
+ return 1;
+}
+
+
+/* run_part */
+/* Execute a file */
+
+static void run_part (char *progname)
+{
+ int result;
+ int pid;
+
+
+ if ((pid=fork()) < 0) {
+ perror_msg_and_die ("failed to fork");
+ }
+ else if (!pid) {
+ args[0] = progname;
+ execv (progname, args);
+ perror_msg_and_die ("failed to exec %s", progname);
+ }
+
+ if (0) {
+
+ } else {
+
+ waitpid(pid, &result, 0);
+ }
+
+ if (WIFEXITED (result) && WEXITSTATUS(result)) {
+ perror_msg ("%s exited with return code %d", progname, WEXITSTATUS(result));
+ exitstatus = 1;
+ }
+ else if (WIFSIGNALED (result)) {
+ perror_msg ("%s exited because of uncaught signal %d", progname,
+ WTERMSIG(result));
+ exitstatus = 1;
+ }
+}
+
+/* run_parts */
+/* Find the parts to run & call run_part() */
+
+static void run_parts (char *dir_name)
+{
+ struct dirent **namelist = 0;
+ char *filename;
+ int entries, i;
+ struct stat st;
+
+ /* -- */
+
+ /* scandir() isn't POSIX, but it makes things easy. */
+ entries = scandir (dir_name, &namelist, valid_name, alphasort);
+
+ if (entries < 0) {
+ perror_msg_and_die ("failed to open directory %s", dir_name);
+ }
+
+ for (i = 0; i < entries; i++) {
+
+ /* -- */
+
+ filename = concat_path_file (dir_name, namelist[i]->d_name);
+
+ if (stat (filename, &st) < 0) {
+ perror_msg_and_die ("failed to stat component %s", filename);
+ }
+ if (S_ISREG(st.st_mode) && !access (filename, X_OK)) {
+ if (test_mode)
+ printf ("run-parts would run %s\n", filename);
+ else {
+ run_part (filename);
+ }
+ }
+
+ else if (!S_ISDIR(st.st_mode)) {
+ error_msg ("component %s is not an executable plain file",
+ filename);
+ exitstatus = 1;
+ }
+
+ free (namelist[i]);
+ free (filename);
+ }
+ free (namelist);
+}
+
+/* run_parts_main */
+/* Process options */
+int run_parts_main (int argc, char *argv[])
+{
+ umask (022);
+ add_argument(0);
+
+ for (;;) {
+ int c;
+
+ opterr = 0;
+ c = getopt(argc, argv, "tu:a:");
+
+ if (c == EOF)
+ break;
+ switch (c) {
+ case 't': /* Enable test mode */
+ test_mode = 1;
+ break;
+ case 'u': /* Set the umask of the programs executed */
+ set_umask ();
+ break;
+ case 'a': /* Pass an argument to the programs */
+ add_argument (optarg);
+ break;
+ default:
+ show_usage();
+ }
+ }
+
+ /* We require exactly one argument: the directory name */
+ if (optind != (argc - 1)) {
+ show_usage();
+ }
+
+ run_parts (argv[optind]);
+
+ return exitstatus;
+}
--- /dev/null
+/* vi: set sw=4 ts=4: */
+/*
+ * Which implementation for busybox
+ *
+ * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
+ * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* getopt not needed */
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "busybox.h"
+
+extern int which_main(int argc, char **argv)
+{
+ char *path_list, *path_n;
+ struct stat filestat;
+ int i, count=1, found, status = EXIT_SUCCESS;
+
+ if (argc <= 1 || **(argv + 1) == '-')
+ show_usage();
+ argc--;
+
+ path_list = getenv("PATH");
+ if (path_list != NULL) {
+ for(i=strlen(path_list); i > 0; i--)
+ if (path_list[i]==':') {
+ path_list[i]=0;
+ count++;
+ }
+ } else {
+ path_list = "/bin\0/sbin\0/usr/bin\0/usr/sbin\0/usr/local/bin";
+ count = 5;
+ }
+
+ while(argc-- > 0) {
+ path_n = path_list;
+ argv++;
+ found = 0;
+ for (i = 0; i < count; i++) {
+ char *buf;
+ buf = concat_path_file(path_n, *argv);
+ if (stat (buf, &filestat) == 0
+ && filestat.st_mode & S_IXUSR)
+ {
+ puts(buf);
+ found = 1;
+ break;
+ }
+ free(buf);
+ path_n += (strlen(path_n) + 1);
+ }
+ if (!found)
+ status = EXIT_FAILURE;
+ }
+ return status;
+}
+
+/*
+Local Variables:
+c-file-style: "linux"
+c-basic-offset: 4
+tab-width: 4
+End:
+*/
FINDUTILS-y:=
FINDUTILS-$(CONFIG_FIND) += find.o
FINDUTILS-$(CONFIG_GREP) += grep.o
-FINDUTILS-$(CONFIG_WHICH) += which.o
FINDUTILS-$(CONFIG_XARGS) += xargs.o
libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR)
bool ' Support extended regular expressions (egrep & grep -E)' CONFIG_FEATURE_GREP_EGREP_ALIAS
bool ' Enable before and after context flags (-A, -B and -C)' CONFIG_FEATURE_GREP_CONTEXT
fi
-bool 'which' CONFIG_WHICH
bool 'xargs' CONFIG_XARGS
endmenu
+++ /dev/null
-/* vi: set sw=4 ts=4: */
-/*
- * Which implementation for busybox
- *
- * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-/* getopt not needed */
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "busybox.h"
-
-extern int which_main(int argc, char **argv)
-{
- char *path_list, *path_n;
- struct stat filestat;
- int i, count=1, found, status = EXIT_SUCCESS;
-
- if (argc <= 1 || **(argv + 1) == '-')
- show_usage();
- argc--;
-
- path_list = getenv("PATH");
- if (path_list != NULL) {
- for(i=strlen(path_list); i > 0; i--)
- if (path_list[i]==':') {
- path_list[i]=0;
- count++;
- }
- } else {
- path_list = "/bin\0/sbin\0/usr/bin\0/usr/sbin\0/usr/local/bin";
- count = 5;
- }
-
- while(argc-- > 0) {
- path_n = path_list;
- argv++;
- found = 0;
- for (i = 0; i < count; i++) {
- char *buf;
- buf = concat_path_file(path_n, *argv);
- if (stat (buf, &filestat) == 0
- && filestat.st_mode & S_IXUSR)
- {
- puts(buf);
- found = 1;
- break;
- }
- free(buf);
- path_n += (strlen(path_n) + 1);
- }
- if (!found)
- status = EXIT_FAILURE;
- }
- return status;
-}
-
-/*
-Local Variables:
-c-file-style: "linux"
-c-basic-offset: 4
-tab-width: 4
-End:
-*/
#define which_example_usage \
"$ which login\n" \
"/bin/login\n"
+
#define who_trivial_usage \
" "
#define who_full_usage \
INIT-$(CONFIG_POWEROFF) += poweroff.o
INIT-$(CONFIG_REBOOT) += reboot.o
INIT-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
-INIT-$(CONFIG_RUN_PARTS) += run_parts.o
libraries-y+=$(INIT_DIR)$(INIT_AR)
fi
bool 'start-stop-daemon' CONFIG_START_STOP_DAEMON
-bool 'run-parts' CONFIG_RUN_PARTS
bool 'mesg' CONFIG_MESG
endmenu
+++ /dev/null
-/* vi: set sw=4 ts=4: */
-/*
- * Mini run-parts implementation for busybox
- *
- *
- * Copyright (C) 2001 by Emanuele Aina <emanuele.aina@tiscali.it>
- *
- * Based on the Debian run-parts program, version 1.15
- * Copyright (C) 1996 Jeff Noxon <jeff@router.patch.net>,
- * Copyright (C) 1996-1999 Guy Maor <maor@debian.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA
- *
- */
-
-/* This is my first attempt to write a program in C (well, this is my first
- * attempt to write a program! :-) . */
-
-/* This piece of code is heavily based on the original version of run-parts,
- * taken from debian-utils. I've only removed the long options and a the
- * report mode. As the original run-parts support only long options, I've
- * broken compatibility because the BusyBox policy doesn't allow them.
- * The supported options are:
- * -t test. Print the name of the files to be executed, without
- * execute them.
- * -a ARG argument. Pass ARG as an argument the program executed. It can
- * be repeated to pass multiple arguments.
- * -u MASK umask. Set the umask of the program executed to MASK. */
-
-/* TODO
- * done - convert calls to error in perror... and remove error()
- * done - convert malloc/realloc to their x... counterparts
- * done - remove catch_sigchld
- * done - use bb's concat_path_file()
- * done - declare run_parts_main() as extern and any other function as static?
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-/* #include <sys/types.h> */
-#include <sys/wait.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include "busybox.h"
-
-static int test_mode = 0;
-static int exitstatus = 0;
-
-static int argcount = 0, argsize = 0;
-static char **args = 0;
-
-
-/* set_umask */
-/* Check and set the umask of the program executed. As stated in the original
- * run-parts, the octal conversion in libc is not foolproof; it will take the
- * 8 and 9 digits under some circumstances. We'll just have to live with it.
- */
-
-static void set_umask (void)
-{
- int mask, result;
-
- /*TODO
- * We must substitute sscanf, according to bb's style guide? */
- result = sscanf (optarg, "%o", &mask);
- if ((result != 1) || (mask > 07777) || (mask < 0)) {
- perror_msg_and_die ("bad umask value");
- }
-
- umask (mask);
-}
-
-/* add_argument */
-/* Add an argument to the commands that we will call. Called once for
- every argument. */
-static void add_argument (char *newarg)
-{
- if (argcount+1 >= argsize) {
- argsize = argsize ? argsize*2 : 4;
- /*TODO if we convert to xrealloc we lose the verbose error message */
- args = realloc(args, argsize * (sizeof(char*)));
- if (!args) {
- perror_msg_and_die ("failed to reallocate memory for arguments");
- }
- }
- args[argcount++] = newarg;
- args[argcount] = 0;
-}
-
-/* valid_name */
-/* True or false? Is this a valid filename (upper/lower alpha, digits,
- * underscores, and hyphens only?)
- */
-
-static int valid_name (const struct dirent *d)
-{
- char *c = d->d_name;
- while (*c) {
- if (!isalnum(*c) && *c!='_' && *c!='-') {
- return 0;
- }
- ++c;
- }
- return 1;
-}
-
-
-/* run_part */
-/* Execute a file */
-
-static void run_part (char *progname)
-{
- int result;
- int pid;
-
-
- if ((pid=fork()) < 0) {
- perror_msg_and_die ("failed to fork");
- }
- else if (!pid) {
- args[0] = progname;
- execv (progname, args);
- perror_msg_and_die ("failed to exec %s", progname);
- }
-
- if (0) {
-
- } else {
-
- waitpid(pid, &result, 0);
- }
-
- if (WIFEXITED (result) && WEXITSTATUS(result)) {
- perror_msg ("%s exited with return code %d", progname, WEXITSTATUS(result));
- exitstatus = 1;
- }
- else if (WIFSIGNALED (result)) {
- perror_msg ("%s exited because of uncaught signal %d", progname,
- WTERMSIG(result));
- exitstatus = 1;
- }
-}
-
-/* run_parts */
-/* Find the parts to run & call run_part() */
-
-static void run_parts (char *dir_name)
-{
- struct dirent **namelist = 0;
- char *filename;
- int entries, i;
- struct stat st;
-
- /* -- */
-
- /* scandir() isn't POSIX, but it makes things easy. */
- entries = scandir (dir_name, &namelist, valid_name, alphasort);
-
- if (entries < 0) {
- perror_msg_and_die ("failed to open directory %s", dir_name);
- }
-
- for (i = 0; i < entries; i++) {
-
- /* -- */
-
- filename = concat_path_file (dir_name, namelist[i]->d_name);
-
- if (stat (filename, &st) < 0) {
- perror_msg_and_die ("failed to stat component %s", filename);
- }
- if (S_ISREG(st.st_mode) && !access (filename, X_OK)) {
- if (test_mode)
- printf ("run-parts would run %s\n", filename);
- else {
- run_part (filename);
- }
- }
-
- else if (!S_ISDIR(st.st_mode)) {
- error_msg ("component %s is not an executable plain file",
- filename);
- exitstatus = 1;
- }
-
- free (namelist[i]);
- free (filename);
- }
- free (namelist);
-}
-
-/* run_parts_main */
-/* Process options */
-int run_parts_main (int argc, char *argv[])
-{
- umask (022);
- add_argument(0);
-
- for (;;) {
- int c;
-
- opterr = 0;
- c = getopt(argc, argv, "tu:a:");
-
- if (c == EOF)
- break;
- switch (c) {
- case 't': /* Enable test mode */
- test_mode = 1;
- break;
- case 'u': /* Set the umask of the programs executed */
- set_umask ();
- break;
- case 'a': /* Pass an argument to the programs */
- add_argument (optarg);
- break;
- default:
- show_usage();
- }
- }
-
- /* We require exactly one argument: the directory name */
- if (optind != (argc - 1)) {
- show_usage();
- }
-
- run_parts (argv[optind]);
-
- return exitstatus;
-}
MISCUTILS-$(CONFIG_DC) += dc.o
MISCUTILS-$(CONFIG_DUTMP) += dutmp.o
MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o
-MISCUTILS-$(CONFIG_MKTEMP) += mktemp.o
MISCUTILS-$(CONFIG_MT) += mt.o
-MISCUTILS-$(CONFIG_READLINK) += readlink.o
MISCUTILS-$(CONFIG_STRINGS) += strings.o
MISCUTILS-$(CONFIG_TIME) += time.o
MISCUTILS-$(CONFIG_UPDATE) += update.o
bool 'dc' CONFIG_DC
bool 'dutmp' CONFIG_DUTMP
bool 'makedevs' CONFIG_MAKEDEVS
-bool 'mktemp' CONFIG_MKTEMP
bool 'mt' CONFIG_MT
-bool 'readlink' CONFIG_READLINK
bool 'strings' CONFIG_STRINGS
bool 'time' CONFIG_TIME
bool 'update' CONFIG_UPDATE
+++ /dev/null
-/* vi: set sw=4 ts=4: */
-/*
- * Mini mktemp implementation for busybox
- *
- *
- * Copyright (C) 2000 by Daniel Jacobowitz
- * Written by Daniel Jacobowitz <dan@debian.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "busybox.h"
-
-extern int mktemp_main(int argc, char **argv)
-{
- if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q")))
- show_usage();
- if(mkstemp(argv[argc-1]) < 0)
- return EXIT_FAILURE;
- (void) puts(argv[argc-1]);
- return EXIT_SUCCESS;
-}
+++ /dev/null
-/* vi: set sw=4 ts=4: */
-/*
- * Mini readlink implementation for busybox
- *
- * Copyright (C) 2000,2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "busybox.h"
-
-int readlink_main(int argc, char **argv)
-{
- char *buf = NULL;
-
- /* no options, no getopt */
-
- if (argc != 2)
- show_usage();
-
- buf = xreadlink(argv[1]);
- if (!buf)
- return EXIT_FAILURE;
- puts(buf);
-#ifdef CONFIG_FEATURE_CLEAN_UP
- free(buf);
-#endif
-
- return EXIT_SUCCESS;
-}
source archival/config.in
source console-tools/config.in
+source debianutils/config.in
source editors/config.in
+source fileutils/config.in
source findutils/config.in
source init/config.in
+source loginutils/config.in
source miscutils/config.in
source modutils/config.in
source networking/config.in
-source loginutils/config.in
source procps/config.in
source shell/config.in
source shellutils/config.in
source sysklogd/config.in
source textutils/config.in
source util-linux/config.in
-source fileutils/config.in