// Nothing beyond this point should ever be touched by
// mere mortals so leave this stuff alone.
//
+#include <features.h>
+#if defined __UCLIBC__ && ! defined __UCLIBC_HAS_MMU__
+ #undef BB_RPM2CPIO /* Uses gz_open(), which uses fork() */
+ #undef BB_DPKG_DEB /* Uses gz_open(), which uses fork() */
+ #undef BB_FEATURE_ASH /* Uses fork() */
+ #undef BB_FEATURE_HUSH /* Uses fork() */
+ #undef BB_FEATURE_LASH /* Uses fork() */
+ #undef BB_INIT /* Uses fork() */
+ #undef BB_FEATURE_TAR_GZIP /* Uses fork() */
+ #undef BB_SYSLOGD /* Uses daemon() */
+ #undef BB_KLOGD /* Uses daemon() */
+ #undef BB_UPDATE /* Uses daemon() */
+#endif
#if defined BB_SH
#if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT
docs/busybox.lineo.com/BusyBox.html
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
- - rm -f multibuild.log Config.h.orig
+ - rm -f multibuild.log Config.h.orig *.gdb *.elf
- rm -rf docs/busybox _install libpwd.a libbb.a pod2htm*
- rm -f busybox.links libbb/loop.h *~ slist.mk core applet_source_list
- find -name \*.o -exec rm -f {} \;
return(p);
}
+#ifdef BB_FEATURE_LS_RECURSIVE
static void dfree(struct dnode **dnp)
{
struct dnode *cur, *next;
}
free(dnp); /* free the array holding the dnode pointers */
}
+#endif
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
{
char buf[2 * BUFSIZ];
char *outname;
int do_base64 = 0;
+ int res;
+ int dofre;
/* Search for header line. */
}
/* If the output file name is given on the command line this rules. */
+ dofre = FALSE;
if (forced_outname != NULL)
outname = (char *) forced_outname;
else {
}
n = strlen (pw->pw_dir);
n1 = strlen (p);
- outname = (char *) alloca ((size_t) (n + n1 + 2));
+ outname = (char *) xmalloc ((size_t) (n + n1 + 2));
memcpy (outname + n + 1, p, (size_t) (n1 + 1));
memcpy (outname, pw->pw_dir, (size_t) n);
outname[n] = '/';
+ dofre = TRUE;
}
}
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
perror_msg("%s", outname); /* */
+ if (dofre)
+ free(outname);
return FALSE;
}
/* For each input line: */
if (do_base64)
- return read_base64 (inname);
+ res = read_base64 (inname);
else
- return read_stduu (inname);
+ res = read_stduu (inname);
+ if (dofre)
+ free(outname);
+ return res;
}
int uudecode_main (int argc,
*/
static const char vi_Version[] =
- "$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
+ "$Id: vi.c,v 1.13 2001/07/19 22:28:01 andersen Exp $";
/*
* To compile for standalone use:
}
charcnt = 0;
// FIXIT- use the correct umask()
- fd = open((char *) fn, (O_RDWR | O_CREAT | O_TRUNC), 0664);
+ fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664);
if (fd < 0)
return (-1);
cnt = last - first + 1;
const struct signal_name *s = signames;
while (s->name != 0) {
- col +=
- fprintf(stderr, "%2d) %-8s", s->number,
- (s++)->name);
+ col += fprintf(stderr, "%2d) %-8s", s->number, s->name);
+ s++;
if (col > 60) {
fprintf(stderr, "\n");
col = 0;
return(NULL);
}
if ((*pid = fork()) == -1) {
- error_msg("fork failured");
+ error_msg("fork failed");
return(NULL);
}
if (*pid==0) {
}
close(unzip_pipe[1]);
if (unzip_pipe[0] == -1) {
- error_msg("Couldnt initialise gzip stream");
+ error_msg("gzip stream init failed");
}
return(fdopen(unzip_pipe[0], "r"));
}
* that either displays or sets the characteristics of
* one or more of the system's networking interfaces.
*
- * Version: $Id: interface.c,v 1.3 2001/06/01 21:47:15 andersen Exp $
+ * Version: $Id: interface.c,v 1.4 2001/07/19 22:28:02 andersen Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#if 0
#include <arpa/nameser.h>
+#endif
#include "libbb.h"
#define _(x) x
#ifdef DEBUG
fprintf (stderr, "getnetbyaddr (%08lx)\n", host_ad);
#endif
+#if 0
np = getnetbyaddr(host_ad, AF_INET);
if (np != NULL)
safe_strncpy(name, np->n_name, len);
+#endif
}
if ((ent == NULL) && (np == NULL))
safe_strncpy(name, inet_ntoa(s_in->sin_addr), len);
struct ifconf ifc;
struct ifreq *ifr;
int n, err = -1;
- /* XXX Should this re-use the global skfd? */
int skfd2;
/* SIOCGIFCONF currently seems to only work properly on AF_INET sockets
}
}
+ openlog(name, option, (pri | LOG_FACMASK));
if (optind == argc) {
- /* read from stdin */
- i = 0;
- while ((c = getc(stdin)) != EOF && i < sizeof(buf)) {
- buf[i++] = c;
- }
- buf[i++] = '\0';
- message = buf;
+ do {
+ /* read from stdin */
+ i = 0;
+ while ((c = getc(stdin)) != EOF && c != '\n' &&
+ i < (sizeof(buf)-1)) {
+ buf[i++] = c;
+ }
+ if (i > 0) {
+ buf[i++] = '\0';
+ syslog(pri, "%s", buf);
+ }
+ } while (c != EOF);
} else {
len = 1; /* for the '\0' */
message=xcalloc(1, 1);
strcat(message, " ");
}
message[strlen(message)-1] = '\0';
+ syslog(pri, "%s", message);
}
- /*openlog(name, option, (pri | LOG_FACMASK));
- syslog(pri, "%s", message);
- closelog();*/
- syslog_msg_with_name(name,(pri | LOG_FACMASK),pri,message);
+ closelog();
return EXIT_SUCCESS;
}
return(p);
}
+#ifdef BB_FEATURE_LS_RECURSIVE
static void dfree(struct dnode **dnp)
{
struct dnode *cur, *next;
}
free(dnp); /* free the array holding the dnode pointers */
}
+#endif
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
{
show_usage();
}
}
+
+ if (daemon(0, 1) < 0)
+ perror_msg_and_die("daemon");
- pid = fork();
- if (pid < 0)
- return EXIT_FAILURE;
- else if (pid == 0) {
- /* Become a proper daemon */
- setsid();
- chdir("/");
+ /* Become a proper daemon */
+ setsid();
+ chdir("/");
#ifdef OPEN_MAX
- for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
+ for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
#else
- /* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
- for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
+ /* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
+ for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
#endif
- /*
- * This is no longer necessary since 1.3.5x, but it will harmlessly
- * exit if that is the case.
- */
+ /* This is no longer necessary since 1.3.5x, but it will harmlessly
+ * exit if that is the case.
+ */
- /* set the program name that will show up in a 'ps' listing */
- argv[0] = "bdflush (update)";
- argv[1] = NULL;
- argv[2] = NULL;
- for (;;) {
- if (use_sync) {
- sleep(sync_duration);
- sync();
- } else {
- sleep(flush_duration);
- if (bdflush(1, 0) < 0) {
- openlog("update", LOG_CONS, LOG_DAEMON);
- syslog(LOG_INFO,
- "This kernel does not need update(8). Exiting.");
- closelog();
- return EXIT_SUCCESS;
- }
+ /* set the program name that will show up in a 'ps' listing */
+ argv[0] = "bdflush (update)";
+ argv[1] = NULL;
+ argv[2] = NULL;
+ for (;;) {
+ if (use_sync) {
+ sleep(sync_duration);
+ sync();
+ } else {
+ sleep(flush_duration);
+ if (bdflush(1, 0) < 0) {
+ openlog("update", LOG_CONS, LOG_DAEMON);
+ syslog(LOG_INFO,
+ "This kernel does not need update(8). Exiting.");
+ closelog();
+ return EXIT_SUCCESS;
}
}
}
+
return EXIT_SUCCESS;
}
static FILE *open_socket(char *host, int port);
static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
-static void progressmeter(int flag);
/* Globals (can be accessed from signal handlers */
static off_t filesize = 0; /* content-length of the file */
static int chunked = 0; /* chunked transfer encoding */
#ifdef BB_FEATURE_WGET_STATUSBAR
+static void progressmeter(int flag);
static char *curfile; /* Name of current file being transferred. */
static struct timeval start; /* Time a transfer started. */
static volatile unsigned long statbytes = 0; /* Number of bytes transferred so far. */
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.44 2001/07/19 19:13:55 kraai Exp $
+ * $Id: wget.c,v 1.45 2001/07/19 22:28:01 andersen Exp $
*/
const struct signal_name *s = signames;
while (s->name != 0) {
- col +=
- fprintf(stderr, "%2d) %-8s", s->number,
- (s++)->name);
+ col += fprintf(stderr, "%2d) %-8s", s->number, s->name);
+ s++;
if (col > 60) {
fprintf(stderr, "\n");
col = 0;
}
}
+ openlog(name, option, (pri | LOG_FACMASK));
if (optind == argc) {
- /* read from stdin */
- i = 0;
- while ((c = getc(stdin)) != EOF && i < sizeof(buf)) {
- buf[i++] = c;
- }
- buf[i++] = '\0';
- message = buf;
+ do {
+ /* read from stdin */
+ i = 0;
+ while ((c = getc(stdin)) != EOF && c != '\n' &&
+ i < (sizeof(buf)-1)) {
+ buf[i++] = c;
+ }
+ if (i > 0) {
+ buf[i++] = '\0';
+ syslog(pri, "%s", buf);
+ }
+ } while (c != EOF);
} else {
len = 1; /* for the '\0' */
message=xcalloc(1, 1);
strcat(message, " ");
}
message[strlen(message)-1] = '\0';
+ syslog(pri, "%s", message);
}
- /*openlog(name, option, (pri | LOG_FACMASK));
- syslog(pri, "%s", message);
- closelog();*/
- syslog_msg_with_name(name,(pri | LOG_FACMASK),pri,message);
+ closelog();
return EXIT_SUCCESS;
}
show_usage();
}
}
+
+ if (daemon(0, 1) < 0)
+ perror_msg_and_die("daemon");
- pid = fork();
- if (pid < 0)
- return EXIT_FAILURE;
- else if (pid == 0) {
- /* Become a proper daemon */
- setsid();
- chdir("/");
+ /* Become a proper daemon */
+ setsid();
+ chdir("/");
#ifdef OPEN_MAX
- for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
+ for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
#else
- /* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
- for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
+ /* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
+ for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
#endif
- /*
- * This is no longer necessary since 1.3.5x, but it will harmlessly
- * exit if that is the case.
- */
+ /* This is no longer necessary since 1.3.5x, but it will harmlessly
+ * exit if that is the case.
+ */
- /* set the program name that will show up in a 'ps' listing */
- argv[0] = "bdflush (update)";
- argv[1] = NULL;
- argv[2] = NULL;
- for (;;) {
- if (use_sync) {
- sleep(sync_duration);
- sync();
- } else {
- sleep(flush_duration);
- if (bdflush(1, 0) < 0) {
- openlog("update", LOG_CONS, LOG_DAEMON);
- syslog(LOG_INFO,
- "This kernel does not need update(8). Exiting.");
- closelog();
- return EXIT_SUCCESS;
- }
+ /* set the program name that will show up in a 'ps' listing */
+ argv[0] = "bdflush (update)";
+ argv[1] = NULL;
+ argv[2] = NULL;
+ for (;;) {
+ if (use_sync) {
+ sleep(sync_duration);
+ sync();
+ } else {
+ sleep(flush_duration);
+ if (bdflush(1, 0) < 0) {
+ openlog("update", LOG_CONS, LOG_DAEMON);
+ syslog(LOG_INFO,
+ "This kernel does not need update(8). Exiting.");
+ closelog();
+ return EXIT_SUCCESS;
}
}
}
+
return EXIT_SUCCESS;
}
char buf[2 * BUFSIZ];
char *outname;
int do_base64 = 0;
+ int res;
+ int dofre;
/* Search for header line. */
}
/* If the output file name is given on the command line this rules. */
+ dofre = FALSE;
if (forced_outname != NULL)
outname = (char *) forced_outname;
else {
}
n = strlen (pw->pw_dir);
n1 = strlen (p);
- outname = (char *) alloca ((size_t) (n + n1 + 2));
+ outname = (char *) xmalloc ((size_t) (n + n1 + 2));
memcpy (outname + n + 1, p, (size_t) (n1 + 1));
memcpy (outname, pw->pw_dir, (size_t) n);
outname[n] = '/';
+ dofre = TRUE;
}
}
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
perror_msg("%s", outname); /* */
+ if (dofre)
+ free(outname);
return FALSE;
}
/* For each input line: */
if (do_base64)
- return read_base64 (inname);
+ res = read_base64 (inname);
else
- return read_stduu (inname);
+ res = read_stduu (inname);
+ if (dofre)
+ free(outname);
+ return res;
}
int uudecode_main (int argc,
*/
static const char vi_Version[] =
- "$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
+ "$Id: vi.c,v 1.13 2001/07/19 22:28:01 andersen Exp $";
/*
* To compile for standalone use:
}
charcnt = 0;
// FIXIT- use the correct umask()
- fd = open((char *) fn, (O_RDWR | O_CREAT | O_TRUNC), 0664);
+ fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664);
if (fd < 0)
return (-1);
cnt = last - first + 1;
static FILE *open_socket(char *host, int port);
static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
-static void progressmeter(int flag);
/* Globals (can be accessed from signal handlers */
static off_t filesize = 0; /* content-length of the file */
static int chunked = 0; /* chunked transfer encoding */
#ifdef BB_FEATURE_WGET_STATUSBAR
+static void progressmeter(int flag);
static char *curfile; /* Name of current file being transferred. */
static struct timeval start; /* Time a transfer started. */
static volatile unsigned long statbytes = 0; /* Number of bytes transferred so far. */
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.44 2001/07/19 19:13:55 kraai Exp $
+ * $Id: wget.c,v 1.45 2001/07/19 22:28:01 andersen Exp $
*/