Several more updates
-Erik
This commit is contained in:
parent
f93a95de69
commit
227a59b05d
3
AUTHORS
3
AUTHORS
@ -42,3 +42,6 @@ Enrique Zanardi <ezanardi@ull.es>
|
|||||||
|
|
||||||
Karl M. Hegbloom <karlheg@debian.org>
|
Karl M. Hegbloom <karlheg@debian.org>
|
||||||
cp_mv.c, the test suite, various fixes to utility.c, &c.
|
cp_mv.c, the test suite, various fixes to utility.c, &c.
|
||||||
|
|
||||||
|
Daniel Jacobowitz <dan@debian.org>
|
||||||
|
mktemp.c
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
0.44
|
0.44
|
||||||
* added the -v option (inverted search) to grep,
|
* added the -v option (inverted search) to grep,
|
||||||
updated docs/busybox.pod accordingly. -beppu
|
updated docs/busybox.pod accordingly. -beppu
|
||||||
|
* Added mktemp, contributed by Daniel Jacobowitz <dan@debian.org>
|
||||||
|
* Fix for ping warnings from Sascha Ziemann <szi@aibon.ping.de>
|
||||||
|
* More doc updates
|
||||||
|
|
||||||
|
|
||||||
0.43
|
0.43
|
||||||
* Major update to the provided documentation.
|
* Major update to the provided documentation.
|
||||||
|
@ -197,6 +197,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_MKSWAP
|
#ifdef BB_MKSWAP
|
||||||
{"mkswap", mkswap_main, _BB_DIR_SBIN},
|
{"mkswap", mkswap_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_MKTEMP
|
||||||
|
{"mktemp", mktemp_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_MNC
|
#ifdef BB_MNC
|
||||||
{"mnc", mnc_main, _BB_DIR_USR_BIN},
|
{"mnc", mnc_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
@ -197,6 +197,9 @@ static const struct Applet applets[] = {
|
|||||||
#ifdef BB_MKSWAP
|
#ifdef BB_MKSWAP
|
||||||
{"mkswap", mkswap_main, _BB_DIR_SBIN},
|
{"mkswap", mkswap_main, _BB_DIR_SBIN},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BB_MKTEMP
|
||||||
|
{"mktemp", mktemp_main, _BB_DIR_BIN},
|
||||||
|
#endif
|
||||||
#ifdef BB_MNC
|
#ifdef BB_MNC
|
||||||
{"mnc", mnc_main, _BB_DIR_USR_BIN},
|
{"mnc", mnc_main, _BB_DIR_USR_BIN},
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,12 +52,13 @@
|
|||||||
#define BB_LS
|
#define BB_LS
|
||||||
#define BB_LSMOD
|
#define BB_LSMOD
|
||||||
#define BB_MAKEDEVS
|
#define BB_MAKEDEVS
|
||||||
#define BB_MKFS_MINIX
|
|
||||||
#define BB_MATH
|
#define BB_MATH
|
||||||
#define BB_MKDIR
|
#define BB_MKDIR
|
||||||
#define BB_MKFIFO
|
#define BB_MKFIFO
|
||||||
|
#define BB_MKFS_MINIX
|
||||||
#define BB_MKNOD
|
#define BB_MKNOD
|
||||||
#define BB_MKSWAP
|
#define BB_MKSWAP
|
||||||
|
#define BB_MKTEMP
|
||||||
#define BB_MNC
|
#define BB_MNC
|
||||||
#define BB_MORE
|
#define BB_MORE
|
||||||
#define BB_MOUNT
|
#define BB_MOUNT
|
||||||
|
@ -60,10 +60,10 @@ dirname, dmesg, du, dutmp, echo, false, fbset, fdflush, find, free,
|
|||||||
freeramdisk, deallocvt, fsck.minix, grep, gunzip, gzip, halt, head, hostid,
|
freeramdisk, deallocvt, fsck.minix, grep, gunzip, gzip, halt, head, hostid,
|
||||||
hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger,
|
hostname, init, kill, killall, length, ln, loadacm, loadfont, loadkmap, logger,
|
||||||
logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap,
|
logname, ls, lsmod, makedevs, math, mkdir, mkfifo, mkfs.minix, mknod, mkswap,
|
||||||
mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd, reboot,
|
mktemp, mnc, more, mount, mt, mv, nslookup, ping, poweroff, printf, ps, pwd,
|
||||||
rm, rmdir, rmmod, sed, sh, sfdisk, sleep, sort, sync, syslogd, swapon, swapoff,
|
reboot, rm, rmdir, rmmod, sed, sh, sfdisk, sleep, sort, sync, syslogd, swapon,
|
||||||
tail, tar, test, tee, touch, tr, true, tty, umount, uname, uniq, update,
|
swapoff, tail, tar, test, tee, touch, tr, true, tty, umount, uname, uniq,
|
||||||
uptime, usleep, wc, whoami, yes, zcat, [
|
update, uptime, usleep, wc, whoami, yes, zcat, [
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
@ -1050,6 +1050,22 @@ Options:
|
|||||||
|
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
=item mktemp
|
||||||
|
|
||||||
|
Usage: mktemp [-q] TEMPLATE
|
||||||
|
|
||||||
|
Creates a temporary file with its name based on TEMPLATE.
|
||||||
|
TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
$ mktemp /tmp/temp.XXXXXX
|
||||||
|
/tmp/temp.mWiLjM
|
||||||
|
$ ls -la /tmp/temp.mWiLjM
|
||||||
|
-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM
|
||||||
|
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
=item mnc
|
=item mnc
|
||||||
|
|
||||||
Usage: mnc [IP] [port]
|
Usage: mnc [IP] [port]
|
||||||
@ -1817,4 +1833,4 @@ Enrique Zanardi <ezanardi@ull.es>
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
# $Id: busybox.pod,v 1.22 2000/04/24 18:07:30 beppu Exp $
|
# $Id: busybox.pod,v 1.23 2000/04/25 23:24:55 erik Exp $
|
||||||
|
@ -119,6 +119,7 @@ extern int mkfifo_main(int argc, char **argv);
|
|||||||
extern int mkfs_minix_main(int argc, char **argv);
|
extern int mkfs_minix_main(int argc, char **argv);
|
||||||
extern int mknod_main(int argc, char** argv);
|
extern int mknod_main(int argc, char** argv);
|
||||||
extern int mkswap_main(int argc, char** argv);
|
extern int mkswap_main(int argc, char** argv);
|
||||||
|
extern int mktemp_main(int argc, char **argv);
|
||||||
extern int mnc_main(int argc, char** argv);
|
extern int mnc_main(int argc, char** argv);
|
||||||
extern int more_main(int argc, char** argv);
|
extern int more_main(int argc, char** argv);
|
||||||
extern int mount_main(int argc, char** argv);
|
extern int mount_main(int argc, char** argv);
|
||||||
|
43
miscutils/mktemp.c
Normal file
43
miscutils/mktemp.c
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/* 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 "internal.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern int mktemp_main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q")))
|
||||||
|
usage ("mktemp [-q] TEMPLATE\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nCreates a temporary file with its name based on TEMPLATE.\n"
|
||||||
|
"TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if(mkstemp(argv[argc-1]) < 0)
|
||||||
|
exit(FALSE);
|
||||||
|
(void) puts(argv[argc-1]);
|
||||||
|
exit(TRUE);
|
||||||
|
}
|
43
mktemp.c
Normal file
43
mktemp.c
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/* 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 "internal.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern int mktemp_main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argc != 2 && (argc != 3 || strcmp(argv[1], "-q")))
|
||||||
|
usage ("mktemp [-q] TEMPLATE\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nCreates a temporary file with its name based on TEMPLATE.\n"
|
||||||
|
"TEMPLATE is any name with six `Xs' (i.e. /tmp/temp.XXXXXX).\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if(mkstemp(argv[argc-1]) < 0)
|
||||||
|
exit(FALSE);
|
||||||
|
(void) puts(argv[argc-1]);
|
||||||
|
exit(TRUE);
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* vi: set sw=4 ts=4: */
|
||||||
/*
|
/*
|
||||||
* $Id: ping.c,v 1.13 2000/04/21 01:26:49 erik Exp $
|
* $Id: ping.c,v 1.14 2000/04/25 23:24:55 erik Exp $
|
||||||
* Mini ping implementation for busybox
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -262,6 +262,26 @@ static void sendping(int ign)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *icmp_type_name (int id)
|
||||||
|
{
|
||||||
|
switch (id) {
|
||||||
|
case ICMP_ECHOREPLY: return "Echo Reply";
|
||||||
|
case ICMP_DEST_UNREACH: return "Destination Unreachable";
|
||||||
|
case ICMP_SOURCE_QUENCH: return "Source Quench";
|
||||||
|
case ICMP_REDIRECT: return "Redirect (change route)";
|
||||||
|
case ICMP_ECHO: return "Echo Request";
|
||||||
|
case ICMP_TIME_EXCEEDED: return "Time Exceeded";
|
||||||
|
case ICMP_PARAMETERPROB: return "Parameter Problem";
|
||||||
|
case ICMP_TIMESTAMP: return "Timestamp Request";
|
||||||
|
case ICMP_TIMESTAMPREPLY: return "Timestamp Reply";
|
||||||
|
case ICMP_INFO_REQUEST: return "Information Request";
|
||||||
|
case ICMP_INFO_REPLY: return "Information Reply";
|
||||||
|
case ICMP_ADDRESS: return "Address Mask Request";
|
||||||
|
case ICMP_ADDRESSREPLY: return "Address Mask Reply";
|
||||||
|
default: return "unknown ICMP type";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
||||||
{
|
{
|
||||||
struct icmp *icmppkt;
|
struct icmp *icmppkt;
|
||||||
@ -282,10 +302,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
sz -= hlen;
|
sz -= hlen;
|
||||||
icmppkt = (struct icmp *) (buf + hlen);
|
icmppkt = (struct icmp *) (buf + hlen);
|
||||||
|
|
||||||
|
if (icmppkt->icmp_id != myid)
|
||||||
|
return; /* not our ping */
|
||||||
|
|
||||||
if (icmppkt->icmp_type == ICMP_ECHOREPLY) {
|
if (icmppkt->icmp_type == ICMP_ECHOREPLY) {
|
||||||
if (icmppkt->icmp_id != myid)
|
++nreceived;
|
||||||
return; /* not our ping */
|
|
||||||
++nreceived;
|
|
||||||
tp = (struct timeval *) icmppkt->icmp_data;
|
tp = (struct timeval *) icmppkt->icmp_data;
|
||||||
|
|
||||||
if ((tv.tv_usec -= tp->tv_usec) < 0) {
|
if ((tv.tv_usec -= tp->tv_usec) < 0) {
|
||||||
@ -321,10 +342,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
if (dupflag)
|
if (dupflag)
|
||||||
printf(" (DUP!)");
|
printf(" (DUP!)");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else {
|
} else
|
||||||
fprintf(stderr,
|
if (icmppkt->icmp_type != ICMP_ECHO)
|
||||||
"Warning: unknown ICMP packet received (not echo-reply)\n");
|
fprintf(stderr,
|
||||||
}
|
"Warning: Got ICMP %d (%s)\n",
|
||||||
|
icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ping(char *host)
|
static void ping(char *host)
|
||||||
|
38
ping.c
38
ping.c
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* vi: set sw=4 ts=4: */
|
||||||
/*
|
/*
|
||||||
* $Id: ping.c,v 1.13 2000/04/21 01:26:49 erik Exp $
|
* $Id: ping.c,v 1.14 2000/04/25 23:24:55 erik Exp $
|
||||||
* Mini ping implementation for busybox
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -262,6 +262,26 @@ static void sendping(int ign)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *icmp_type_name (int id)
|
||||||
|
{
|
||||||
|
switch (id) {
|
||||||
|
case ICMP_ECHOREPLY: return "Echo Reply";
|
||||||
|
case ICMP_DEST_UNREACH: return "Destination Unreachable";
|
||||||
|
case ICMP_SOURCE_QUENCH: return "Source Quench";
|
||||||
|
case ICMP_REDIRECT: return "Redirect (change route)";
|
||||||
|
case ICMP_ECHO: return "Echo Request";
|
||||||
|
case ICMP_TIME_EXCEEDED: return "Time Exceeded";
|
||||||
|
case ICMP_PARAMETERPROB: return "Parameter Problem";
|
||||||
|
case ICMP_TIMESTAMP: return "Timestamp Request";
|
||||||
|
case ICMP_TIMESTAMPREPLY: return "Timestamp Reply";
|
||||||
|
case ICMP_INFO_REQUEST: return "Information Request";
|
||||||
|
case ICMP_INFO_REPLY: return "Information Reply";
|
||||||
|
case ICMP_ADDRESS: return "Address Mask Request";
|
||||||
|
case ICMP_ADDRESSREPLY: return "Address Mask Reply";
|
||||||
|
default: return "unknown ICMP type";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
||||||
{
|
{
|
||||||
struct icmp *icmppkt;
|
struct icmp *icmppkt;
|
||||||
@ -282,10 +302,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
sz -= hlen;
|
sz -= hlen;
|
||||||
icmppkt = (struct icmp *) (buf + hlen);
|
icmppkt = (struct icmp *) (buf + hlen);
|
||||||
|
|
||||||
|
if (icmppkt->icmp_id != myid)
|
||||||
|
return; /* not our ping */
|
||||||
|
|
||||||
if (icmppkt->icmp_type == ICMP_ECHOREPLY) {
|
if (icmppkt->icmp_type == ICMP_ECHOREPLY) {
|
||||||
if (icmppkt->icmp_id != myid)
|
++nreceived;
|
||||||
return; /* not our ping */
|
|
||||||
++nreceived;
|
|
||||||
tp = (struct timeval *) icmppkt->icmp_data;
|
tp = (struct timeval *) icmppkt->icmp_data;
|
||||||
|
|
||||||
if ((tv.tv_usec -= tp->tv_usec) < 0) {
|
if ((tv.tv_usec -= tp->tv_usec) < 0) {
|
||||||
@ -321,10 +342,11 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
if (dupflag)
|
if (dupflag)
|
||||||
printf(" (DUP!)");
|
printf(" (DUP!)");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else {
|
} else
|
||||||
fprintf(stderr,
|
if (icmppkt->icmp_type != ICMP_ECHO)
|
||||||
"Warning: unknown ICMP packet received (not echo-reply)\n");
|
fprintf(stderr,
|
||||||
}
|
"Warning: Got ICMP %d (%s)\n",
|
||||||
|
icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ping(char *host)
|
static void ping(char *host)
|
||||||
|
@ -163,13 +163,13 @@ extern int ps_main(int argc, char **argv)
|
|||||||
if (*groupName == '\0')
|
if (*groupName == '\0')
|
||||||
sprintf(groupName, "%d", p.rgid);
|
sprintf(groupName, "%d", p.rgid);
|
||||||
|
|
||||||
len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName,
|
|
||||||
p.state);
|
|
||||||
sprintf(path, "/proc/%s/cmdline", entry->d_name);
|
sprintf(path, "/proc/%s/cmdline", entry->d_name);
|
||||||
file = fopen(path, "r");
|
file = fopen(path, "r");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
fatalError("Can't open %s: %s\n", path, strerror(errno));
|
continue;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName,
|
||||||
|
p.state);
|
||||||
while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) {
|
while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) {
|
||||||
i++;
|
i++;
|
||||||
if (c == '\0')
|
if (c == '\0')
|
||||||
|
6
ps.c
6
ps.c
@ -163,13 +163,13 @@ extern int ps_main(int argc, char **argv)
|
|||||||
if (*groupName == '\0')
|
if (*groupName == '\0')
|
||||||
sprintf(groupName, "%d", p.rgid);
|
sprintf(groupName, "%d", p.rgid);
|
||||||
|
|
||||||
len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName,
|
|
||||||
p.state);
|
|
||||||
sprintf(path, "/proc/%s/cmdline", entry->d_name);
|
sprintf(path, "/proc/%s/cmdline", entry->d_name);
|
||||||
file = fopen(path, "r");
|
file = fopen(path, "r");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
fatalError("Can't open %s: %s\n", path, strerror(errno));
|
continue;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
len = fprintf(stdout, "%5d %-8s %-8s %c ", p.pid, uidName, groupName,
|
||||||
|
p.state);
|
||||||
while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) {
|
while (((c = getc(file)) != EOF) && (i < (terminal_width-len))) {
|
||||||
i++;
|
i++;
|
||||||
if (c == '\0')
|
if (c == '\0')
|
||||||
|
Loading…
Reference in New Issue
Block a user