diff options
Diffstat (limited to 'busybox/debianutils')
-rw-r--r-- | busybox/debianutils/Config.in | 58 | ||||
-rw-r--r-- | busybox/debianutils/Makefile | 32 | ||||
-rw-r--r-- | busybox/debianutils/Makefile.in | 41 | ||||
-rw-r--r-- | busybox/debianutils/mktemp.c | 63 | ||||
-rw-r--r-- | busybox/debianutils/pipe_progress.c | 55 | ||||
-rw-r--r-- | busybox/debianutils/readlink.c | 46 | ||||
-rw-r--r-- | busybox/debianutils/run_parts.c | 114 | ||||
-rw-r--r-- | busybox/debianutils/start_stop_daemon.c | 296 | ||||
-rw-r--r-- | busybox/debianutils/which.c | 96 |
9 files changed, 801 insertions, 0 deletions
diff --git a/busybox/debianutils/Config.in b/busybox/debianutils/Config.in new file mode 100644 index 0000000..7cf7cad --- /dev/null +++ b/busybox/debianutils/Config.in @@ -0,0 +1,58 @@ +# +# For a description of the syntax of this configuration file, +# see scripts/kbuild/config-language.txt. +# + +menu "Debian Utilities" + +config CONFIG_MKTEMP + bool "mktemp" + default n + help + mktemp is used to create unique temporary files + +config CONFIG_PIPE_PROGRESS + bool "pipe_progress" + default n + help + Display a dot to indicate pipe activity. + +config CONFIG_READLINK + bool "readlink" + default n + help + This program reads a symbolic link and returns the name + of the file it points to + +config CONFIG_RUN_PARTS + bool "run-parts" + default n + help + run-parts is a utility designed to run all the scripts in a directory. + + It is useful to set up a directory like cron.daily, where you need to + execute all the scripts in that directory. + + In this implementation of run-parts some features (such as report mode) + are not implemented. + + Unless you know that run-parts is used in some of your scripts + you can safely say N here. + +config CONFIG_START_STOP_DAEMON + bool "start-stop-daemon" + default y + help + start-stop-daemon is used to control the creation and + termination of system-level processes, usually the ones + started during the startup of the system. + +config CONFIG_WHICH + bool "which" + default n + help + which is used to find programs in your PATH and + print out their pathnames. + +endmenu + diff --git a/busybox/debianutils/Makefile b/busybox/debianutils/Makefile new file mode 100644 index 0000000..10ec1cc --- /dev/null +++ b/busybox/debianutils/Makefile @@ -0,0 +1,32 @@ +# Makefile for busybox +# +# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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 +# + +top_srcdir=.. +top_builddir=.. +srcdir=$(top_srcdir)/debianutils +DEBIANUTILS_DIR:=./ +include $(top_builddir)/Rules.mak +include $(top_builddir)/.config +include $(srcdir)/Makefile.in +all: $(libraries-y) +-include $(top_builddir)/.depend + +clean: + rm -f *.o *.a $(AR_TARGET) + diff --git a/busybox/debianutils/Makefile.in b/busybox/debianutils/Makefile.in new file mode 100644 index 0000000..3a20403 --- /dev/null +++ b/busybox/debianutils/Makefile.in @@ -0,0 +1,41 @@ +# Makefile for busybox +# +# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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:=$(top_builddir)/debianutils/ +endif +srcdir=$(top_srcdir)/debianutils + +DEBIANUTILS-y:= +DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o +DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o +DEBIANUTILS-$(CONFIG_READLINK) += readlink.o +DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o +DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.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)) + +$(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< + diff --git a/busybox/debianutils/mktemp.c b/busybox/debianutils/mktemp.c new file mode 100644 index 0000000..9fdf79b --- /dev/null +++ b/busybox/debianutils/mktemp.c @@ -0,0 +1,63 @@ +/* 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) +{ + unsigned char dir_flag = 0; + int opt; + + while ((opt = getopt(argc, argv, "qd")) != -1) { + if (opt == 'd') { + dir_flag = 1; + } + else if (opt != 'q') { + bb_show_usage(); + } + } + + if (optind + 1 != argc) { + bb_show_usage(); + } + + if (dir_flag) { + if (mkdtemp(argv[argc-1]) == NULL) { + return EXIT_FAILURE; + } + } else { + if (mkstemp(argv[argc-1]) < 0) { + return EXIT_FAILURE; + } + } + + (void) puts(argv[argc-1]); + + return EXIT_SUCCESS; +} diff --git a/busybox/debianutils/pipe_progress.c b/busybox/debianutils/pipe_progress.c new file mode 100644 index 0000000..ab05202 --- /dev/null +++ b/busybox/debianutils/pipe_progress.c @@ -0,0 +1,55 @@ +/* + * Monitor a pipe with a simple progress display. + * + * Copyright (C) 2003 by Rob Landley <rob@landley.net>, Joey Hess + * + * 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 <stdlib.h> +#include <unistd.h> +#include <time.h> + +#include "busybox.h" + +#define PIPE_PROGRESS_SIZE 4096 + +/* Read a block of data from stdin, write it to stdout. + * Activity is indicated by a '.' to stderr + */ +extern int pipe_progress_main(int argc, char **argv) +{ + RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE); + time_t t = time(NULL); + size_t len; + + while ((len = fread(buf, 1, PIPE_PROGRESS_SIZE, stdin)) > 0) { + time_t new_time = time(NULL); + if (new_time != t) { + t = new_time; + fputc('.', stderr); + } + fwrite(buf, len, 1, stdout); + } + + fputc('\n', stderr); + +#ifdef CONFIG_FEATURE_CLEAN_UP + RELEASE_CONFIG_BUFFER(buf); +#endif + return 0; +} diff --git a/busybox/debianutils/readlink.c b/busybox/debianutils/readlink.c new file mode 100644 index 0000000..d8d7e8c --- /dev/null +++ b/busybox/debianutils/readlink.c @@ -0,0 +1,46 @@ +/* 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) + bb_show_usage(); + + buf = xreadlink(argv[1]); + if (!buf) + return EXIT_FAILURE; + puts(buf); +#ifdef CONFIG_FEATURE_CLEAN_UP + free(buf); +#endif + + return EXIT_SUCCESS; +} diff --git a/busybox/debianutils/run_parts.c b/busybox/debianutils/run_parts.c new file mode 100644 index 0000000..6205595 --- /dev/null +++ b/busybox/debianutils/run_parts.c @@ -0,0 +1,114 @@ +/* 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 <getopt.h> +#include <stdlib.h> + +#include "libbb.h" + +static const struct option runparts_long_options[] = { + { "test", 0, NULL, 't' }, + { "umask", 1, NULL, 'u' }, + { "arg", 1, NULL, 'a' }, + { 0, 0, 0, 0 } +}; + +extern char **environ; + +/* run_parts_main */ +/* Process options */ +int run_parts_main(int argc, char **argv) +{ + char **args = xmalloc(2 * sizeof(char *)); + unsigned char test_mode = 0; + unsigned short argcount = 1; + int opt; + + umask(022); + + while ((opt = getopt_long (argc, argv, "tu:a:", + runparts_long_options, NULL)) > 0) + { + switch (opt) { + /* Enable test mode */ + case 't': + test_mode++; + break; + /* Set the umask of the programs executed */ + case 'u': + /* 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. + */ + umask(bb_xgetlarg(optarg, 8, 0, 07777)); + break; + /* Pass an argument to the programs */ + case 'a': + /* Add an argument to the commands that we will call. + * Called once for every argument. */ + args = xrealloc(args, (argcount + 2) * (sizeof(char *))); + args[argcount++] = optarg; + break; + default: + bb_show_usage(); + } + } + + /* We require exactly one argument: the directory name */ + if (optind != (argc - 1)) { + bb_show_usage(); + } + + args[0] = argv[optind]; + args[argcount] = 0; + + return(run_parts(args, test_mode, environ)); +} diff --git a/busybox/debianutils/start_stop_daemon.c b/busybox/debianutils/start_stop_daemon.c new file mode 100644 index 0000000..e15944c --- /dev/null +++ b/busybox/debianutils/start_stop_daemon.c @@ -0,0 +1,296 @@ +/* vi: set sw=4 ts=4: */ +/* + * Mini start-stop-daemon implementation(s) for busybox + * + * Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, + * public domain. + * Adapted for busybox David Kimdon <dwhedon@gordian.com> + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <signal.h> +#include <errno.h> +#include <sys/stat.h> +#include <dirent.h> +#include <unistd.h> +#include <getopt.h> + +#include "busybox.h" +#include "pwd_.h" + +static int signal_nr = 15; +static int user_id = -1; +static int quiet = 0; +static char *userspec = NULL; +static char *cmdname = NULL; +static char *execname = NULL; +static char *pidfile = NULL; + +struct pid_list { + struct pid_list *next; + pid_t pid; +}; + +static struct pid_list *found = NULL; + +static inline void +push(pid_t pid) +{ + struct pid_list *p; + + p = xmalloc(sizeof(*p)); + p->next = found; + p->pid = pid; + found = p; +} + +static int +pid_is_exec(pid_t pid, const char *name) +{ + char buf[32]; + struct stat sb, exec_stat; + + if (name && stat(name, &exec_stat)) + bb_perror_msg_and_die("stat %s", name); + + sprintf(buf, "/proc/%d/exe", pid); + if (stat(buf, &sb) != 0) + return 0; + return (sb.st_dev == exec_stat.st_dev && sb.st_ino == exec_stat.st_ino); +} + +static int +pid_is_user(int pid, int uid) +{ + struct stat sb; + char buf[32]; + + sprintf(buf, "/proc/%d", pid); + if (stat(buf, &sb) != 0) + return 0; + return (sb.st_uid == uid); +} + +static int +pid_is_cmd(pid_t pid, const char *name) +{ + char buf[32]; + FILE *f; + int c; + + sprintf(buf, "/proc/%d/stat", pid); + f = fopen(buf, "r"); + if (!f) + return 0; + while ((c = getc(f)) != EOF && c != '(') + ; + if (c != '(') { + fclose(f); + return 0; + } + /* this hopefully handles command names containing ')' */ + while ((c = getc(f)) != EOF && c == *name) + name++; + fclose(f); + return (c == ')' && *name == '\0'); +} + + +static void +check(int pid) +{ + if (execname && !pid_is_exec(pid, execname)) { + return; + } + if (userspec && !pid_is_user(pid, user_id)) { + return; + } + if (cmdname && !pid_is_cmd(pid, cmdname)) { + return; + } + push(pid); +} + + +static void +do_pidfile(void) +{ + FILE *f; + pid_t pid; + + f = fopen(pidfile, "r"); + if (f) { + if (fscanf(f, "%d", &pid) == 1) + check(pid); + fclose(f); + } else if (errno != ENOENT) + bb_perror_msg_and_die("open pidfile %s", pidfile); + +} + +static void +do_procinit(void) +{ + DIR *procdir; + struct dirent *entry; + int foundany, pid; + + if (pidfile) { + do_pidfile(); + return; + } + + procdir = opendir("/proc"); + if (!procdir) + bb_perror_msg_and_die ("opendir /proc"); + + foundany = 0; + while ((entry = readdir(procdir)) != NULL) { + if (sscanf(entry->d_name, "%d", &pid) != 1) + continue; + foundany++; + check(pid); + } + closedir(procdir); + if (!foundany) + bb_error_msg_and_die ("nothing in /proc - not mounted?"); +} + + +static void +do_stop(void) +{ + char what[1024]; + struct pid_list *p; + int killed = 0; + + do_procinit(); + + if (cmdname) + strcpy(what, cmdname); + else if (execname) + strcpy(what, execname); + else if (pidfile) + sprintf(what, "process in pidfile `%.200s'", pidfile); + else if (userspec) + sprintf(what, "process(es) owned by `%s'", userspec); + else + bb_error_msg_and_die ("internal error, please report"); + + if (!found) { + if (!quiet) + printf("no %s found; none killed.\n", what); + return; + } + for (p = found; p; p = p->next) { + if (kill(p->pid, signal_nr) == 0) { + p->pid = -p->pid; + killed++; + } else { + bb_perror_msg("warning: failed to kill %d", p->pid); + } + } + if (!quiet && killed) { + printf("stopped %s (pid", what); + for (p = found; p; p = p->next) + if(p->pid < 0) + printf(" %d", -p->pid); + printf(").\n"); + } +} + + +static const struct option ssd_long_options[] = { + { "stop", 0, NULL, 'K' }, + { "start", 0, NULL, 'S' }, + { "background", 0, NULL, 'b' }, + { "quiet", 0, NULL, 'q' }, + { "make-pidfile", 0, NULL, 'm' }, + { "startas", 1, NULL, 'a' }, + { "name", 1, NULL, 'n' }, + { "signal", 1, NULL, 's' }, + { "user", 1, NULL, 'u' }, + { "exec", 1, NULL, 'x' }, + { "pidfile", 1, NULL, 'p' }, + { 0, 0, 0, 0 } +}; + +#define SSD_CTX_STOP 1 +#define SSD_CTX_START 2 +#define SSD_OPT_BACKGROUND 4 +#define SSD_OPT_QUIET 8 +#define SSD_OPT_MAKEPID 16 + +int +start_stop_daemon_main(int argc, char **argv) +{ + unsigned long opt; + char *signame = NULL; + char *startas = NULL; + + bb_applet_long_options = ssd_long_options; + + bb_opt_complementaly = "K~S:S~K"; + opt = bb_getopt_ulflags(argc, argv, "KSbqma:n:s:u:x:p:", + &startas, &cmdname, &signame, &userspec, &execname, &pidfile); + + /* Check one and only one context option was given */ + if ((opt & 0x80000000UL) || (opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) { + bb_show_usage(); + } + + if (signame) { + signal_nr = bb_xgetlarg(signame, 10, 0, NSIG); + } + + if (!execname && !pidfile && !userspec && !cmdname) + bb_error_msg_and_die ("need at least one of -x, -p, -u, or -n"); + + if (!startas) + startas = execname; + + if ((opt & SSD_CTX_START) && !startas) + bb_error_msg_and_die ("-S needs -x or -a"); + + if ((opt & SSD_OPT_MAKEPID) && pidfile == NULL) + bb_error_msg_and_die ("-m needs -p"); + + argc -= optind; + argv += optind; + + if (userspec && sscanf(userspec, "%d", &user_id) != 1) + user_id = my_getpwnam(userspec); + + if (opt & SSD_CTX_STOP) { + do_stop(); + return EXIT_SUCCESS; + } + + do_procinit(); + + if (found) { + if (!quiet) + printf("%s already running.\n%d\n", execname ,found->pid); + return EXIT_SUCCESS; + } + *--argv = startas; + if (opt & SSD_OPT_BACKGROUND) { + if (daemon(0, 0) == -1) + bb_perror_msg_and_die ("unable to fork"); + setsid(); + } + if (opt & SSD_OPT_MAKEPID) { + /* user wants _us_ to make the pidfile */ + FILE *pidf = fopen(pidfile, "w"); + pid_t pidt = getpid(); + if (pidf == NULL) + bb_perror_msg_and_die("Unable to write pidfile '%s'", pidfile); + fprintf(pidf, "%d\n", pidt); + fclose(pidf); + } + execv(startas, argv); + bb_perror_msg_and_die ("unable to start %s", startas); +} diff --git a/busybox/debianutils/which.c b/busybox/debianutils/which.c new file mode 100644 index 0000000..999dded --- /dev/null +++ b/busybox/debianutils/which.c @@ -0,0 +1,96 @@ +/* vi: set sw=4 ts=4: */ +/* + * Which implementation for busybox + * + * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.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 + * + * Based on which from debianutils + */ + + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "busybox.h" + + +extern int which_main(int argc, char **argv) +{ + char *path_list; + int i, count=1, status = EXIT_SUCCESS; + + if (argc <= 1 || **(argv + 1) == '-') { + bb_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) { + char *buf; + char *path_n; + char found = 0; + argv++; + + /* + * Check if we were given the full path, first. + * Otherwise see if the file exists in our $PATH. + */ + path_n = path_list; + buf = *argv; + if (access(buf, X_OK) == 0) { + found = 1; + } else { + for (i = 0; i < count; i++) { + buf = concat_path_file(path_n, *argv); + if (access(buf, X_OK) == 0) { + found = 1; + break; + } + free(buf); + path_n += (strlen(path_n) + 1); + } + } + if (found) { + puts(buf); + } else { + status = EXIT_FAILURE; + } + } + return status; +} + +/* +Local Variables: +c-file-style: "linux" +c-basic-offset: 4 +tab-width: 4 +End: +*/ |