More cleanups.
-Erik
This commit is contained in:
parent
b870af09ae
commit
fad04fdd12
@ -104,7 +104,7 @@ static void write_header(const char *filename)
|
||||
Return 0 if successful, 1 if an error occurred. */
|
||||
|
||||
static int
|
||||
file_lines(const char *filename, int fd, long int n_lines, off_t pos)
|
||||
file_lines(int fd, long int n_lines, off_t pos)
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
int bytes_read;
|
||||
@ -164,7 +164,7 @@ file_lines(const char *filename, int fd, long int n_lines, off_t pos)
|
||||
Buffer the text as a linked list of LBUFFERs, adding them as needed.
|
||||
Return 0 if successful, 1 if an error occured. */
|
||||
|
||||
static int pipe_lines(const char *filename, int fd, long int n_lines)
|
||||
static int pipe_lines(int fd, long int n_lines)
|
||||
{
|
||||
struct linebuffer {
|
||||
int nbytes, nlines;
|
||||
@ -266,7 +266,7 @@ static int pipe_lines(const char *filename, int fd, long int n_lines)
|
||||
If `forever' is nonzero, keep reading from the end of the file
|
||||
until killed. Return the number of bytes read from the file. */
|
||||
|
||||
static long dump_remainder(const char *filename, int fd)
|
||||
static long dump_remainder(int fd)
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
int bytes_read;
|
||||
@ -312,11 +312,11 @@ static int tail_lines(const char *filename, int fd, long int n_lines)
|
||||
if (S_ISREG(stats.st_mode)
|
||||
&& lseek(fd, (off_t) 0, SEEK_CUR) == (off_t) 0) {
|
||||
length = lseek(fd, (off_t) 0, SEEK_END);
|
||||
if (length != 0 && file_lines(filename, fd, n_lines, length))
|
||||
if (length != 0 && file_lines(fd, n_lines, length))
|
||||
return 1;
|
||||
dump_remainder(filename, fd);
|
||||
dump_remainder(fd);
|
||||
} else
|
||||
return pipe_lines(filename, fd, n_lines);
|
||||
return pipe_lines(fd, n_lines);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -616,7 +616,7 @@ file_lines(const char *filename, int fd, long int n_lines, off_t pos)
|
||||
Buffer the text as a linked list of LBUFFERs, adding them as needed.
|
||||
Return 0 if successful, 1 if an error occured. */
|
||||
|
||||
static int pipe_lines(const char *filename, int fd, long int n_lines)
|
||||
static int pipe_lines(int fd, long int n_lines)
|
||||
{
|
||||
struct linebuffer {
|
||||
int nbytes, nlines;
|
||||
@ -850,7 +850,7 @@ static int start_lines(const char *filename, int fd, long int n_lines)
|
||||
If `forever' is nonzero, keep reading from the end of the file
|
||||
until killed. Return the number of bytes read from the file. */
|
||||
|
||||
static long dump_remainder(const char *filename, int fd)
|
||||
static long dump_remainder(int fd)
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
int bytes_read;
|
||||
@ -925,7 +925,7 @@ static void tail_forever(char **names, int nfiles)
|
||||
write_header(names[i], NULL);
|
||||
last = i;
|
||||
}
|
||||
file_sizes[i] += dump_remainder(names[i], file_descs[i]);
|
||||
file_sizes[i] += dump_remainder(file_descs[i]);
|
||||
}
|
||||
|
||||
/* If none of the files changed size, sleep. */
|
||||
@ -955,7 +955,7 @@ static int tail_bytes(const char *filename, int fd, off_t n_bytes)
|
||||
lseek(fd, n_bytes, SEEK_CUR);
|
||||
else if (start_bytes(filename, fd, n_bytes))
|
||||
return 1;
|
||||
dump_remainder(filename, fd);
|
||||
dump_remainder(fd);
|
||||
} else {
|
||||
if (S_ISREG(stats.st_mode)) {
|
||||
off_t current_pos, end_pos;
|
||||
@ -1021,9 +1021,9 @@ static int tail_lines(const char *filename, int fd, long int n_lines)
|
||||
length = lseek(fd, (off_t) 0, SEEK_END);
|
||||
if (length != 0 && file_lines(filename, fd, n_lines, length))
|
||||
return 1;
|
||||
dump_remainder(filename, fd);
|
||||
dump_remainder(fd);
|
||||
} else
|
||||
return pipe_lines(filename, fd, n_lines);
|
||||
return pipe_lines(fd, n_lines);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ filstat(nm, mode)
|
||||
enum token mode;
|
||||
{
|
||||
struct stat s;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (mode == FILSYM) {
|
||||
#ifdef S_IFLNK
|
||||
@ -535,7 +535,7 @@ char *path;
|
||||
int mode;
|
||||
{
|
||||
struct stat st;
|
||||
int euid = geteuid();
|
||||
unsigned int euid = geteuid();
|
||||
|
||||
if (stat (path, &st) < 0)
|
||||
return (-1);
|
||||
|
@ -140,10 +140,10 @@ static unsigned int expand(char *arg, register unsigned char *buffer)
|
||||
return (buffer - buffer_start);
|
||||
}
|
||||
|
||||
static int complement(unsigned char *buffer, unsigned int buffer_len)
|
||||
static int complement(unsigned char *buffer, int buffer_len)
|
||||
{
|
||||
register short i, j, index;
|
||||
unsigned char conv[ASCII + 2];
|
||||
char conv[ASCII + 2];
|
||||
|
||||
index = 0;
|
||||
for (i = 0; i <= ASCII; i++) {
|
||||
@ -160,9 +160,9 @@ static int complement(unsigned char *buffer, unsigned int buffer_len)
|
||||
extern int tr_main(int argc, char **argv)
|
||||
{
|
||||
register unsigned char *ptr;
|
||||
unsigned int output_length=0, input_length;
|
||||
int output_length=0, input_length;
|
||||
int index = 1;
|
||||
short i;
|
||||
int i;
|
||||
|
||||
if (argc > 1 && argv[index][0] == '-') {
|
||||
for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {
|
||||
|
10
internal.h
10
internal.h
@ -275,11 +275,11 @@ extern char *xstrndup (const char *s, int n);
|
||||
/* These parse entries in /etc/passwd and /etc/group. This is desirable
|
||||
* for BusyBox since we want to avoid using the glibc NSS stuff, which
|
||||
* increases target size and is often not needed embedded systems. */
|
||||
extern unsigned long my_getpwnam(char *name);
|
||||
extern unsigned long my_getgrnam(char *name);
|
||||
extern void my_getpwuid(char *name, unsigned long uid);
|
||||
extern void my_getgrgid(char *group, unsigned long gid);
|
||||
extern unsigned long my_getpwnamegid(char *name);
|
||||
extern long my_getpwnam(char *name);
|
||||
extern long my_getgrnam(char *name);
|
||||
extern void my_getpwuid(char *name, long uid);
|
||||
extern void my_getgrgid(char *group, long gid);
|
||||
extern long my_getpwnamegid(char *name);
|
||||
|
||||
|
||||
#if defined BB_INIT || defined BB_SYSLOGD
|
||||
|
6
lash.c
6
lash.c
@ -150,9 +150,9 @@ static char *cwd = NULL;
|
||||
static char *local_pending_command = NULL;
|
||||
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
void win_changed(int sig)
|
||||
void win_changed(int junk)
|
||||
{
|
||||
struct winsize win = { 0, 0 };
|
||||
struct winsize win = { 0, 0, 0, 0 };
|
||||
ioctl(0, TIOCGWINSZ, &win);
|
||||
if (win.ws_col > 0) {
|
||||
cmdedit_setwidth( win.ws_col - 1);
|
||||
@ -251,7 +251,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
|
||||
}
|
||||
|
||||
/* built-in 'help' handler */
|
||||
static int builtin_help(struct job *cmd, struct jobSet *junk)
|
||||
static int builtin_help(struct job *dummy, struct jobSet *junk)
|
||||
{
|
||||
struct builtInCommand *x;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* $Id: ping.c,v 1.21 2000/07/14 01:51:25 kraai Exp $
|
||||
* $Id: ping.c,v 1.22 2000/07/14 06:49:52 andersen Exp $
|
||||
* Mini ping implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||
@ -294,7 +294,7 @@ static void unpack(char *, int, struct sockaddr_in *);
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
static void pingstats(int ign)
|
||||
static void pingstats(int junk)
|
||||
{
|
||||
signal(SIGINT, SIG_IGN);
|
||||
|
||||
@ -314,7 +314,7 @@ static void pingstats(int ign)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void sendping(int ign)
|
||||
static void sendping(int junk)
|
||||
{
|
||||
struct icmp *pkt;
|
||||
int i;
|
||||
@ -337,7 +337,7 @@ static void sendping(int ign)
|
||||
|
||||
if (i < 0)
|
||||
fatalError("sendto: %s\n", strerror(errno));
|
||||
else if (i != sizeof(packet))
|
||||
else if ((size_t)i != sizeof(packet))
|
||||
fatalError("ping wrote %d chars; %d expected\n", i,
|
||||
(int)sizeof(packet));
|
||||
|
||||
|
8
ping.c
8
ping.c
@ -1,6 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* $Id: ping.c,v 1.21 2000/07/14 01:51:25 kraai Exp $
|
||||
* $Id: ping.c,v 1.22 2000/07/14 06:49:52 andersen Exp $
|
||||
* Mini ping implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||
@ -294,7 +294,7 @@ static void unpack(char *, int, struct sockaddr_in *);
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
static void pingstats(int ign)
|
||||
static void pingstats(int junk)
|
||||
{
|
||||
signal(SIGINT, SIG_IGN);
|
||||
|
||||
@ -314,7 +314,7 @@ static void pingstats(int ign)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void sendping(int ign)
|
||||
static void sendping(int junk)
|
||||
{
|
||||
struct icmp *pkt;
|
||||
int i;
|
||||
@ -337,7 +337,7 @@ static void sendping(int ign)
|
||||
|
||||
if (i < 0)
|
||||
fatalError("sendto: %s\n", strerror(errno));
|
||||
else if (i != sizeof(packet))
|
||||
else if ((size_t)i != sizeof(packet))
|
||||
fatalError("ping wrote %d chars; %d expected\n", i,
|
||||
(int)sizeof(packet));
|
||||
|
||||
|
@ -126,7 +126,7 @@ extern int ps_main(int argc, char **argv)
|
||||
char groupName[10] = "";
|
||||
int len, i, c;
|
||||
#ifdef BB_FEATURE_AUTOWIDTH
|
||||
struct winsize win = { 0, 0 };
|
||||
struct winsize win = { 0, 0, 0, 0 };
|
||||
int terminal_width = TERMINAL_WIDTH;
|
||||
#else
|
||||
#define terminal_width TERMINAL_WIDTH
|
||||
|
2
ps.c
2
ps.c
@ -126,7 +126,7 @@ extern int ps_main(int argc, char **argv)
|
||||
char groupName[10] = "";
|
||||
int len, i, c;
|
||||
#ifdef BB_FEATURE_AUTOWIDTH
|
||||
struct winsize win = { 0, 0 };
|
||||
struct winsize win = { 0, 0, 0, 0 };
|
||||
int terminal_width = TERMINAL_WIDTH;
|
||||
#else
|
||||
#define terminal_width TERMINAL_WIDTH
|
||||
|
6
sh.c
6
sh.c
@ -150,9 +150,9 @@ static char *cwd = NULL;
|
||||
static char *local_pending_command = NULL;
|
||||
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
void win_changed(int sig)
|
||||
void win_changed(int junk)
|
||||
{
|
||||
struct winsize win = { 0, 0 };
|
||||
struct winsize win = { 0, 0, 0, 0 };
|
||||
ioctl(0, TIOCGWINSZ, &win);
|
||||
if (win.ws_col > 0) {
|
||||
cmdedit_setwidth( win.ws_col - 1);
|
||||
@ -251,7 +251,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
|
||||
}
|
||||
|
||||
/* built-in 'help' handler */
|
||||
static int builtin_help(struct job *cmd, struct jobSet *junk)
|
||||
static int builtin_help(struct job *dummy, struct jobSet *junk)
|
||||
{
|
||||
struct builtInCommand *x;
|
||||
|
||||
|
@ -150,9 +150,9 @@ static char *cwd = NULL;
|
||||
static char *local_pending_command = NULL;
|
||||
|
||||
#ifdef BB_FEATURE_SH_COMMAND_EDITING
|
||||
void win_changed(int sig)
|
||||
void win_changed(int junk)
|
||||
{
|
||||
struct winsize win = { 0, 0 };
|
||||
struct winsize win = { 0, 0, 0, 0 };
|
||||
ioctl(0, TIOCGWINSZ, &win);
|
||||
if (win.ws_col > 0) {
|
||||
cmdedit_setwidth( win.ws_col - 1);
|
||||
@ -251,7 +251,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
|
||||
}
|
||||
|
||||
/* built-in 'help' handler */
|
||||
static int builtin_help(struct job *cmd, struct jobSet *junk)
|
||||
static int builtin_help(struct job *dummy, struct jobSet *junk)
|
||||
{
|
||||
struct builtInCommand *x;
|
||||
|
||||
|
24
tail.c
24
tail.c
@ -104,7 +104,7 @@ static void write_header(const char *filename)
|
||||
Return 0 if successful, 1 if an error occurred. */
|
||||
|
||||
static int
|
||||
file_lines(const char *filename, int fd, long int n_lines, off_t pos)
|
||||
file_lines(int fd, long int n_lines, off_t pos)
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
int bytes_read;
|
||||
@ -164,7 +164,7 @@ file_lines(const char *filename, int fd, long int n_lines, off_t pos)
|
||||
Buffer the text as a linked list of LBUFFERs, adding them as needed.
|
||||
Return 0 if successful, 1 if an error occured. */
|
||||
|
||||
static int pipe_lines(const char *filename, int fd, long int n_lines)
|
||||
static int pipe_lines(int fd, long int n_lines)
|
||||
{
|
||||
struct linebuffer {
|
||||
int nbytes, nlines;
|
||||
@ -266,7 +266,7 @@ static int pipe_lines(const char *filename, int fd, long int n_lines)
|
||||
If `forever' is nonzero, keep reading from the end of the file
|
||||
until killed. Return the number of bytes read from the file. */
|
||||
|
||||
static long dump_remainder(const char *filename, int fd)
|
||||
static long dump_remainder(int fd)
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
int bytes_read;
|
||||
@ -312,11 +312,11 @@ static int tail_lines(const char *filename, int fd, long int n_lines)
|
||||
if (S_ISREG(stats.st_mode)
|
||||
&& lseek(fd, (off_t) 0, SEEK_CUR) == (off_t) 0) {
|
||||
length = lseek(fd, (off_t) 0, SEEK_END);
|
||||
if (length != 0 && file_lines(filename, fd, n_lines, length))
|
||||
if (length != 0 && file_lines(fd, n_lines, length))
|
||||
return 1;
|
||||
dump_remainder(filename, fd);
|
||||
dump_remainder(fd);
|
||||
} else
|
||||
return pipe_lines(filename, fd, n_lines);
|
||||
return pipe_lines(fd, n_lines);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -616,7 +616,7 @@ file_lines(const char *filename, int fd, long int n_lines, off_t pos)
|
||||
Buffer the text as a linked list of LBUFFERs, adding them as needed.
|
||||
Return 0 if successful, 1 if an error occured. */
|
||||
|
||||
static int pipe_lines(const char *filename, int fd, long int n_lines)
|
||||
static int pipe_lines(int fd, long int n_lines)
|
||||
{
|
||||
struct linebuffer {
|
||||
int nbytes, nlines;
|
||||
@ -850,7 +850,7 @@ static int start_lines(const char *filename, int fd, long int n_lines)
|
||||
If `forever' is nonzero, keep reading from the end of the file
|
||||
until killed. Return the number of bytes read from the file. */
|
||||
|
||||
static long dump_remainder(const char *filename, int fd)
|
||||
static long dump_remainder(int fd)
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
int bytes_read;
|
||||
@ -925,7 +925,7 @@ static void tail_forever(char **names, int nfiles)
|
||||
write_header(names[i], NULL);
|
||||
last = i;
|
||||
}
|
||||
file_sizes[i] += dump_remainder(names[i], file_descs[i]);
|
||||
file_sizes[i] += dump_remainder(file_descs[i]);
|
||||
}
|
||||
|
||||
/* If none of the files changed size, sleep. */
|
||||
@ -955,7 +955,7 @@ static int tail_bytes(const char *filename, int fd, off_t n_bytes)
|
||||
lseek(fd, n_bytes, SEEK_CUR);
|
||||
else if (start_bytes(filename, fd, n_bytes))
|
||||
return 1;
|
||||
dump_remainder(filename, fd);
|
||||
dump_remainder(fd);
|
||||
} else {
|
||||
if (S_ISREG(stats.st_mode)) {
|
||||
off_t current_pos, end_pos;
|
||||
@ -1021,9 +1021,9 @@ static int tail_lines(const char *filename, int fd, long int n_lines)
|
||||
length = lseek(fd, (off_t) 0, SEEK_END);
|
||||
if (length != 0 && file_lines(filename, fd, n_lines, length))
|
||||
return 1;
|
||||
dump_remainder(filename, fd);
|
||||
dump_remainder(fd);
|
||||
} else
|
||||
return pipe_lines(filename, fd, n_lines);
|
||||
return pipe_lines(fd, n_lines);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
4
test.c
4
test.c
@ -372,7 +372,7 @@ filstat(nm, mode)
|
||||
enum token mode;
|
||||
{
|
||||
struct stat s;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (mode == FILSYM) {
|
||||
#ifdef S_IFLNK
|
||||
@ -535,7 +535,7 @@ char *path;
|
||||
int mode;
|
||||
{
|
||||
struct stat st;
|
||||
int euid = geteuid();
|
||||
unsigned int euid = geteuid();
|
||||
|
||||
if (stat (path, &st) < 0)
|
||||
return (-1);
|
||||
|
8
tr.c
8
tr.c
@ -140,10 +140,10 @@ static unsigned int expand(char *arg, register unsigned char *buffer)
|
||||
return (buffer - buffer_start);
|
||||
}
|
||||
|
||||
static int complement(unsigned char *buffer, unsigned int buffer_len)
|
||||
static int complement(unsigned char *buffer, int buffer_len)
|
||||
{
|
||||
register short i, j, index;
|
||||
unsigned char conv[ASCII + 2];
|
||||
char conv[ASCII + 2];
|
||||
|
||||
index = 0;
|
||||
for (i = 0; i <= ASCII; i++) {
|
||||
@ -160,9 +160,9 @@ static int complement(unsigned char *buffer, unsigned int buffer_len)
|
||||
extern int tr_main(int argc, char **argv)
|
||||
{
|
||||
register unsigned char *ptr;
|
||||
unsigned int output_length=0, input_length;
|
||||
int output_length=0, input_length;
|
||||
int index = 1;
|
||||
short i;
|
||||
int i;
|
||||
|
||||
if (argc > 1 && argv[index][0] == '-') {
|
||||
for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {
|
||||
|
18
utility.c
18
utility.c
@ -820,12 +820,12 @@ extern int parse_mode(const char *s, mode_t * theMode)
|
||||
* This uses buf as storage to hold things.
|
||||
*
|
||||
*/
|
||||
unsigned long my_getid(const char *filename, char *name, unsigned long id, unsigned long *gid)
|
||||
unsigned long my_getid(const char *filename, char *name, long id, long *gid)
|
||||
{
|
||||
FILE *file;
|
||||
char *rname, *start, *end, buf[128];
|
||||
unsigned long rid;
|
||||
unsigned long rgid = 0;
|
||||
long rid;
|
||||
long rgid = 0;
|
||||
|
||||
file = fopen(filename, "r");
|
||||
if (file == NULL) {
|
||||
@ -881,33 +881,33 @@ unsigned long my_getid(const char *filename, char *name, unsigned long id, unsig
|
||||
}
|
||||
|
||||
/* returns a uid given a username */
|
||||
unsigned long my_getpwnam(char *name)
|
||||
long my_getpwnam(char *name)
|
||||
{
|
||||
return my_getid("/etc/passwd", name, -1, NULL);
|
||||
}
|
||||
|
||||
/* returns a gid given a group name */
|
||||
unsigned long my_getgrnam(char *name)
|
||||
long my_getgrnam(char *name)
|
||||
{
|
||||
return my_getid("/etc/group", name, -1, NULL);
|
||||
}
|
||||
|
||||
/* gets a username given a uid */
|
||||
void my_getpwuid(char *name, unsigned long uid)
|
||||
void my_getpwuid(char *name, long uid)
|
||||
{
|
||||
my_getid("/etc/passwd", name, uid, NULL);
|
||||
}
|
||||
|
||||
/* gets a groupname given a gid */
|
||||
void my_getgrgid(char *group, unsigned long gid)
|
||||
void my_getgrgid(char *group, long gid)
|
||||
{
|
||||
my_getid("/etc/group", group, gid, NULL);
|
||||
}
|
||||
|
||||
/* gets a gid given a user name */
|
||||
unsigned long my_getpwnamegid(char *name)
|
||||
long my_getpwnamegid(char *name)
|
||||
{
|
||||
unsigned long gid;
|
||||
long gid;
|
||||
my_getid("/etc/passwd", name, -1, &gid);
|
||||
return gid;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user