-Erik
This commit is contained in:
Erik Andersen 2000-04-18 00:00:52 +00:00
parent 91e581fa04
commit a6c752201e
19 changed files with 69 additions and 70 deletions

View File

@ -101,12 +101,12 @@ busybox: $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
$(STRIP)
docs: docs/busybox.pod
$(MAKE) -C docs clean all
busybox.links: busybox.def.h
- ./busybox.mkll | sort >$@
docs:
$(MAKE) -C docs
regexp.o nfsmount.o: %.o: %.h
$(OBJECTS): %.o: busybox.def.h internal.h %.c
@ -126,7 +126,7 @@ install: busybox busybox.links
./install.sh $(PREFIX)
dist release: distclean
$(MAKE) -C docs clean all
$(MAKE) -C docs
cd ..; \
rm -rf busybox-$(VERSION); \
cp -a busybox busybox-$(VERSION); \

View File

@ -303,7 +303,7 @@ static const struct Applet applets[] = {
{"uname", uname_main, _BB_DIR_BIN},
#endif
#ifdef BB_UNIQ
{"uniq", uniq_main, _BB_DIR_BIN},
{"uniq", uniq_main, _BB_DIR_USR_BIN},
#endif
#ifdef BB_UPDATE
{"update", update_main, _BB_DIR_SBIN},

View File

@ -303,7 +303,7 @@ static const struct Applet applets[] = {
{"uname", uname_main, _BB_DIR_BIN},
#endif
#ifdef BB_UNIQ
{"uniq", uniq_main, _BB_DIR_BIN},
{"uniq", uniq_main, _BB_DIR_USR_BIN},
#endif
#ifdef BB_UPDATE
{"update", update_main, _BB_DIR_SBIN},

View File

@ -83,6 +83,7 @@ cmdedit_setwidth(int w)
void cmdedit_reset_term(void)
{
if (reset_term)
/* sparc and other have broken termios support: use old termio handling. */
ioctl(fileno(stdin), TCSETA, (void *) &old_term);
}
@ -378,6 +379,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
memset(command, 0, sizeof(command));
if (!reset_term) {
/* sparc and other have broken termios support: use old termio handling. */
ioctl(inputFd, TCGETA, (void *) &old_term);
memcpy(&new_term, &old_term, sizeof(struct termio));
@ -589,6 +591,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
}
nr = len + 1;
/* sparc and other have broken termios support: use old termio handling. */
ioctl(inputFd, TCSETA, (void *) &old_term);
reset_term = 0;

View File

@ -30,8 +30,8 @@
#define PSF_MAXMODE 0x03
#define PSF_SEPARATOR 0xFFFF
static const char loadfont_usage[] = "loadfont\n"
"\n" "\tLoad a console font from standard input.\n" "\n";
static const char loadfont_usage[] = "loadfont\n\n"
"Loads a console font from standard input.\n";
struct psf_header {
unsigned char magic1, magic2; /* Magic number */
@ -47,6 +47,10 @@ extern int loadfont_main(int argc, char **argv)
{
int fd;
if (argc>=2 && *argv[1]=='-') {
usage(loadfont_usage);
}
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));

View File

@ -2,7 +2,7 @@
# ------------------------
# Copyright (C) 2000 Erik Andersen <andersee@debian.org> GPL
all:: clean doc
all: clean doc
doc:
@echo
@ -14,10 +14,8 @@ doc:
pod2text busybox.pod > ../BusyBox.txt
@rm -f pod2html*
clean::
clean:
@rm -f ../BusyBox.html ../BusyBox.1 ../BusyBox.txt pod2html*
distclean: clean
.PHONY: all clean distclean doc

View File

@ -68,7 +68,7 @@ Example:
-------------------------------
=item cat
=item cat
Usage: cat [file ...]
@ -807,19 +807,22 @@ Example:
=item loadacm
FIXME
FIXME -- this command does not yet have proper documentation
-------------------------------
=item loadfont
FIXME
Usage: loadfont
Loads a console font from standard input.
-------------------------------
=item loadkmap
FIXME
FIXME -- this command does not yet have proper documentation
-------------------------------
@ -1294,7 +1297,7 @@ Usage: sh
lash -- the BusyBox LAme SHell (command interpreter)
FIXME
FIXME -- this command does not yet have proper documentation
-------------------------------
@ -1778,4 +1781,4 @@ Enrique Zanardi <ezanardi@ull.es>
=cut
# $Id: busybox.pod,v 1.15 2000/04/17 17:46:46 beppu Exp $
# $Id: busybox.pod,v 1.16 2000/04/18 00:00:52 erik Exp $

2
kill.c
View File

@ -230,6 +230,8 @@ extern int kill_main(int argc, char **argv)
for(; pidList && pidList!=0; pidList++) {
if (kill(*pidList, sig) != 0)
fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
else
printf("killed %d\n", *pidList);
}
/* Note that we don't bother to free the memory
* allocated in findPidByName(). It will be freed

1
lash.c
View File

@ -120,7 +120,6 @@ static struct builtInCommand bltins[] = {
{"pwd", "Print current directory", "pwd", shell_pwd},
{"export", "Set environment variable", "export [VAR=value]", shell_export},
{"unset", "Unset environment variable", "unset VAR", shell_unset},
{".", "Source-in and run commands in a file", ". filename", shell_source},
{"help", "List shell built-in commands", "help", shell_help},
{NULL, NULL, NULL, NULL}

View File

@ -30,8 +30,8 @@
#define PSF_MAXMODE 0x03
#define PSF_SEPARATOR 0xFFFF
static const char loadfont_usage[] = "loadfont\n"
"\n" "\tLoad a console font from standard input.\n" "\n";
static const char loadfont_usage[] = "loadfont\n\n"
"Loads a console font from standard input.\n";
struct psf_header {
unsigned char magic1, magic2; /* Magic number */
@ -47,6 +47,10 @@ extern int loadfont_main(int argc, char **argv)
{
int fd;
if (argc>=2 && *argv[1]=='-') {
usage(loadfont_usage);
}
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));

22
more.c
View File

@ -33,25 +33,17 @@
static const char more_usage[] = "more [file ...]\n";
/* ED: sparc termios is broken: revert back to old termio handling. */
#ifdef BB_FEATURE_USE_TERMIOS
#if #cpu(sparc)
# define USE_OLD_TERMIO
# include <termio.h>
# define termios termio
# define stty(fd,argp) ioctl(fd,TCSETAF,argp)
#else
# include <termios.h>
# define stty(fd,argp) tcsetattr(fd,TCSANOW,argp)
#endif
#include <termio.h>
FILE *cin;
struct termios initial_settings, new_settings;
/* sparc and other have broken termios support: use old termio handling. */
struct termio initial_settings, new_settings;
void gotsig(int sig)
{
stty(fileno(cin), &initial_settings);
ioctl(fileno(cin), TCSETAF, &initial_settings);
fprintf(stdout, "\n");
exit(TRUE);
}
@ -106,15 +98,11 @@ extern int more_main(int argc, char **argv)
cin = fopen("/dev/tty", "r");
if (!cin)
cin = fopen("/dev/console", "r");
#ifdef USE_OLD_TERMIO
ioctl(fileno(cin), TCGETA, &initial_settings);
#else
tcgetattr(fileno(cin), &initial_settings);
#endif
new_settings = initial_settings;
new_settings.c_lflag &= ~ICANON;
new_settings.c_lflag &= ~ECHO;
stty(fileno(cin), &new_settings);
ioctl(fileno(cin), TCSETAF, &new_settings);
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);

View File

@ -230,6 +230,8 @@ extern int kill_main(int argc, char **argv)
for(; pidList && pidList!=0; pidList++) {
if (kill(*pidList, sig) != 0)
fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
else
printf("killed %d\n", *pidList);
}
/* Note that we don't bother to free the memory
* allocated in findPidByName(). It will be freed

1
sh.c
View File

@ -120,7 +120,6 @@ static struct builtInCommand bltins[] = {
{"pwd", "Print current directory", "pwd", shell_pwd},
{"export", "Set environment variable", "export [VAR=value]", shell_export},
{"unset", "Unset environment variable", "unset VAR", shell_unset},
{".", "Source-in and run commands in a file", ". filename", shell_source},
{"help", "List shell built-in commands", "help", shell_help},
{NULL, NULL, NULL, NULL}

View File

@ -83,6 +83,7 @@ cmdedit_setwidth(int w)
void cmdedit_reset_term(void)
{
if (reset_term)
/* sparc and other have broken termios support: use old termio handling. */
ioctl(fileno(stdin), TCSETA, (void *) &old_term);
}
@ -378,6 +379,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
memset(command, 0, sizeof(command));
if (!reset_term) {
/* sparc and other have broken termios support: use old termio handling. */
ioctl(inputFd, TCGETA, (void *) &old_term);
memcpy(&new_term, &old_term, sizeof(struct termio));
@ -589,6 +591,7 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
}
nr = len + 1;
/* sparc and other have broken termios support: use old termio handling. */
ioctl(inputFd, TCSETA, (void *) &old_term);
reset_term = 0;

View File

@ -120,7 +120,6 @@ static struct builtInCommand bltins[] = {
{"pwd", "Print current directory", "pwd", shell_pwd},
{"export", "Set environment variable", "export [VAR=value]", shell_export},
{"unset", "Unset environment variable", "unset VAR", shell_unset},
{".", "Source-in and run commands in a file", ". filename", shell_source},
{"help", "List shell built-in commands", "help", shell_help},
{NULL, NULL, NULL, NULL}

View File

@ -226,18 +226,20 @@ static void doSyslogd (void)
}
else {
#define BUFSIZE 1024 + 1
char buf[BUFSIZE];
char buf;
char *q, *p;
int n_read;
char line[BUFSIZE];
unsigned char c;
int pri;
/* Get set to read in a line */
memset (line, 0, sizeof(line));
pri = (LOG_USER | LOG_NOTICE);
/* Keep reading stuff till there is nothing else to read */
while( (n_read = read (fd, buf, BUFSIZE)) > 0 && errno != EOF) {
int pri = (LOG_USER | LOG_NOTICE);
memset (line, 0, sizeof(line));
p = buf;
while( (n_read = read (fd, &buf, 1)) > 0) {
p = &buf;
q = line;
while (p && (c = *p) && q < &line[sizeof(line) - 1]) {
if (c == '<') {
@ -262,6 +264,7 @@ static void doSyslogd (void)
/* Now log it */
logMessage(pri, line);
break;
}
close (fd);
FD_CLR (fd, &readfds);

View File

@ -226,18 +226,20 @@ static void doSyslogd (void)
}
else {
#define BUFSIZE 1024 + 1
char buf[BUFSIZE];
char buf;
char *q, *p;
int n_read;
char line[BUFSIZE];
unsigned char c;
int pri;
/* Get set to read in a line */
memset (line, 0, sizeof(line));
pri = (LOG_USER | LOG_NOTICE);
/* Keep reading stuff till there is nothing else to read */
while( (n_read = read (fd, buf, BUFSIZE)) > 0 && errno != EOF) {
int pri = (LOG_USER | LOG_NOTICE);
memset (line, 0, sizeof(line));
p = buf;
while( (n_read = read (fd, &buf, 1)) > 0) {
p = &buf;
q = line;
while (p && (c = *p) && q < &line[sizeof(line) - 1]) {
if (c == '<') {
@ -262,6 +264,7 @@ static void doSyslogd (void)
/* Now log it */
logMessage(pri, line);
break;
}
close (fd);
FD_CLR (fd, &readfds);

View File

@ -33,25 +33,17 @@
static const char more_usage[] = "more [file ...]\n";
/* ED: sparc termios is broken: revert back to old termio handling. */
#ifdef BB_FEATURE_USE_TERMIOS
#if #cpu(sparc)
# define USE_OLD_TERMIO
# include <termio.h>
# define termios termio
# define stty(fd,argp) ioctl(fd,TCSETAF,argp)
#else
# include <termios.h>
# define stty(fd,argp) tcsetattr(fd,TCSANOW,argp)
#endif
#include <termio.h>
FILE *cin;
struct termios initial_settings, new_settings;
/* sparc and other have broken termios support: use old termio handling. */
struct termio initial_settings, new_settings;
void gotsig(int sig)
{
stty(fileno(cin), &initial_settings);
ioctl(fileno(cin), TCSETAF, &initial_settings);
fprintf(stdout, "\n");
exit(TRUE);
}
@ -106,15 +98,11 @@ extern int more_main(int argc, char **argv)
cin = fopen("/dev/tty", "r");
if (!cin)
cin = fopen("/dev/console", "r");
#ifdef USE_OLD_TERMIO
ioctl(fileno(cin), TCGETA, &initial_settings);
#else
tcgetattr(fileno(cin), &initial_settings);
#endif
new_settings = initial_settings;
new_settings.c_lflag &= ~ICANON;
new_settings.c_lflag &= ~ECHO;
stty(fileno(cin), &new_settings);
ioctl(fileno(cin), TCSETAF, &new_settings);
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);

View File

@ -1364,7 +1364,8 @@ extern pid_t* findPidByName( char* pidName)
pidList[i++]=strtol(next->d_name, NULL, 0);
}
}
pidList[i]=0;
if (pidList!=NULL)
pidList[i]=0;
return pidList;
}
#endif /* BB_FEATURE_USE_DEVPS_PATCH */