and eventual platform specific includes in early.
* Licensed under GPLv2 or later, see file License in this tarball for details.
*/
+#include "busybox.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
-#include "busybox.h"
#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
static const char usage_messages[] =
/* vi: set sw=4 ts=4: */
/*
+ * BusyBox' main applet dispatcher.
+ *
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
+#include "busybox.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
-#include "busybox.h"
#if ENABLE_LOCALE_SUPPORT
#include <locale.h>
#else
+/* vi: set sw=4 ts=4: */
+/*
+ * Version stuff.
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
#include "busybox.h"
#ifndef BB_EXTRA_VERSION
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
+#include "busybox.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include "busybox.h"
int mktemp_main(int argc, char **argv)
{
+/* vi: set sw=4 ts=4: */
/*
* 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
- *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
+#include "busybox.h"
#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
+/* Read a block of data from stdin, write it to stdout.
+ * Activity is indicated by a '.' to stderr
*/
int pipe_progress_main(int argc, char **argv)
{
fputc('\n', stderr);
-#ifdef CONFIG_FEATURE_CLEAN_UP
- RELEASE_CONFIG_BUFFER(buf);
-#endif
+ if (ENABLE_FEATURE_CLEAN_UP)
+ RELEASE_CONFIG_BUFFER(buf);
+
return 0;
}
* Licensed under GPL v2, see file LICENSE in this tarball for details.
*/
+#include "busybox.h"
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
-#include "busybox.h"
#define READLINK_FLAG_f (1 << 0)
return EXIT_FAILURE;
puts(buf);
- if (ENABLE_FEATURE_CLEAN_UP && buf != bb_common_bufsiz1) free(buf);
+ if (ENABLE_FEATURE_CLEAN_UP && buf != bb_common_bufsiz1)
+ free(buf);
return EXIT_SUCCESS;
}
* 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
- *
+ * Licensed under GPL v2, see file LICENSE in this tarball for details.
*/
/* This is my first attempt to write a program in C (well, this is my first
* done - declare run_parts_main() as extern and any other function as static?
*/
+#include "busybox.h"
#include <getopt.h>
#include <stdlib.h>
-#include "busybox.h"
static const struct option runparts_long_options[] = {
{ "test", 0, NULL, 't' },
* Adapted for busybox David Kimdon <dwhedon@gordian.com>
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <getopt.h> /* struct option */
-
-#include "busybox.h"
#include "pwd_.h"
static int signal_nr = 15;
* Based on which from debianutils
*/
+#include "busybox.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
-#include "busybox.h"
int which_main(int argc, char **argv)
{
boilerplate. Be sure to name the main function <applet>_main instead of main.
And be sure to put it in <applet>.c. Usage does not have to be taken care of by
your applet.
+Make sure to #include "busybox.h" as the first include file in your applet so
+the bb_config.h and appropriate platform specific files are included properly.
For a new applet mu, here is the code that would go in mu.c:
/*
* Mini mu implementation for busybox
*
- *
* Copyright (C) [YEAR] by [YOUR NAME] <YOUR EMAIL>
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "busybox.h"
+#include <other.h>
int mu_main(int argc, char **argv)
{
* Reworked by David Douthitt <n9ubh@callsign.net> and
* 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
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
+#include "busybox.h"
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <fnmatch.h>
#include <time.h>
#include <ctype.h>
-#include "busybox.h"
//XXX just found out about libbb/messages.c . maybe move stuff there ? - ghoz
static const char msg_req_arg[] = "option `%s' requires an argument";
* precompiled regex
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include <errno.h>
-#include "busybox.h"
#include "xregex.h"
+/* vi: set sw=4 ts=4: */
/*
* Mini xargs implementation for busybox
* Options are supported: "-prtx -n max_arg -s max_chars -e[ouf_str]"
* - Mike Rendell <michael@cs.mun.ca>
* and David MacKenzie <djm@gnu.ai.mit.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
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*
* xargs is described in the Single Unix Specification v3 at
* http://www.opengroup.org/onlinepubs/007904975/utilities/xargs.html
*
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include "busybox.h"
/* COMPAT: SYSV version defaults size (and has a max value of) to 470.
We try to make it as large as possible. */
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
+#include "busybox.h"
#include <signal.h>
#include <sys/reboot.h>
-#include "busybox.h"
-
#include <unistd.h>
int halt_main(int argc, char *argv[])
flags = bb_getopt_ulflags(argc, argv, "d:nf", &delay);
if (flags&1) sleep(atoi(delay));
if (!(flags&2)) sync();
-
+
/* Perform action. */
if (ENABLE_INIT && !(flags & 4)) {
if (ENABLE_FEATURE_INITRD) {
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
+#include "busybox.h"
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <getopt.h>
#include <sys/reboot.h>
#include <sys/syslog.h>
-#include "busybox.h"
#include "init_shared.h"
const char * const init_sending_format = "Sending SIG%s to all processes.";
+/* vi: set sw=4 ts=4: */
+/*
+ * Helper functions shared by init et al.
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
extern int kill_init(int sig);
extern int bb_shutdown_system(unsigned long magic);
extern const char * const init_sending_format;
+/* vi: set sw=4 ts=4: */
/*
- * mesg implementation for busybox
+ * mesg implementation for busybox
*
- * Copyright (c) 2002 Manuel Novoa III <mjn3@codepoet.org>
+ * Copyright (c) 2002 Manuel Novoa III <mjn3@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.
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
+#include "busybox.h"
#include <unistd.h>
#include <stdlib.h>
-#include "busybox.h"
#ifdef USE_TTY_GROUP
#define S_IWGRP_OR_S_IWOTH S_IWGRP
*
* 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
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* getopt not needed */
+#include "busybox.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
-#include "busybox.h"
int free_main(int argc, char **argv)
{
+/* vi: set sw=4 ts=4: */
/*
* tiny fuser implementation
*
* GNU Library General Public License
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/sysmacros.h>
-#include "busybox.h"
#define FUSER_PROC_DIR "/proc"
#define FUSER_MAX_LINE 255
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
* 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
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
-
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
#include <unistd.h>
-#include "busybox.h"
#define KILL 0
#define KILLALL 1
* Licensed under the GPL v2, see the file LICENSE in this tarball.
*/
-
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
-#include "busybox.h"
#if ENABLE_FEATURE_PIDOF_SINGLE
#define _SINGLE_COMPL(a) a
* Licensed under the GPL v2, see the file LICENSE in this tarball.
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <termios.h>
#include <sys/ioctl.h>
-#include "busybox.h"
#if ENABLE_SELINUX
#include <selinux/selinux.h> /* for is_selinux_enabled() */
#endif
*
* Copyright (C) 2005 Manuel Novoa III <mjn3@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
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* Notes:
* following IDs (if any). Multiple switches are allowed.
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/resource.h>
-#include "busybox.h"
#if (PRIO_PROCESS < CHAR_MIN) || (PRIO_PROCESS > CHAR_MAX)
#error Assumption violated : PRIO_PROCESS value
-
+/* vi: set sw=4 ts=4: */
/*
* Sysctl 1.01 - A utility to read and manipulate the sysctl parameters
*
*
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
-#include "busybox.h"
/*
* Function Prototypes
* GNU Library General Public License
*/
+#include "busybox.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
-#include "busybox.h"
//#define CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE /* + 2k */
*
* 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
- *
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* This version of uptime doesn't display the number of users on the system,
/* getopt not needed */
-
+#include "busybox.h"
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include <stdlib.h>
-#include "busybox.h"
#ifndef FSHIFT
# define FSHIFT 16 /* nr of bits of precision */
*/
-
#define IFS_BROKEN
#define PROFILE 0
+#include "busybox.h"
+
#ifdef DEBUG
#define _GNU_SOURCE
#endif
#include <paths.h>
#include <setjmp.h>
#include <signal.h>
-#include <stdint.h>
+/*#include <stdint.h>*/
#include <time.h>
#include <fnmatch.h>
-
-#include "busybox.h"
#include "pwd_.h"
#ifdef CONFIG_ASH_JOB_CONTROL
*/
+#include "busybox.h"
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <limits.h>
-#include "busybox.h"
-
#include "../shell/cmdedit.h"
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
+
+#include "busybox.h"
#include <ctype.h> /* isalpha, isdigit */
#include <unistd.h> /* getpid */
#include <stdlib.h> /* getenv, atoi */
/* #define DEBUG_SHELL */
#if 1
-#include "busybox.h"
#include "cmdedit.h"
#else
#define bb_applet_name "hush"
//#define DEBUG_SHELL
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <getopt.h>
#include <termios.h>
-#include "busybox.h"
#include "cmdedit.h"
#ifdef CONFIG_LOCALE_SUPPORT
* Original copyright notice is retained at the end of this file.
*/
+#include "busybox.h"
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <sys/wait.h>
#include "cmdedit.h"
-#include "busybox.h"
/* Conditional use of "register" keyword */
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h> /* for our signal() handlers */
#include <sys/syslog.h>
#include <sys/klog.h>
-#include "busybox.h"
-
static void klogd_signal(int sig ATTRIBUTE_UNUSED)
{
klogctl(7, NULL, 0);
*
* 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
- *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
+#include "busybox.h"
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
-#include "busybox.h"
#if !defined CONFIG_SYSLOGD
#define SYSLOG_NAMES
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/un.h>
#include <sys/param.h>
-#include "busybox.h"
-
/* SYSLOG_NAMES defined to pull some extra junk from syslog.h */
#define SYSLOG_NAMES
#include <sys/syslog.h>