aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-07-14 06:49:52 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-07-14 06:49:52 +0000
commit3fdc0f38fbfbf12310ed50f573e8da9481ed6214 (patch)
tree7b840eb074878c454141ce76ba7328f4a8621f1b /coreutils
parent16119c7c8b5bcc30f0642e8c2b8458db4f0e94ff (diff)
downloadbusybox-w32-3fdc0f38fbfbf12310ed50f573e8da9481ed6214.tar.gz
busybox-w32-3fdc0f38fbfbf12310ed50f573e8da9481ed6214.tar.bz2
busybox-w32-3fdc0f38fbfbf12310ed50f573e8da9481ed6214.zip
More cleanups.
-Erik git-svn-id: svn://busybox.net/trunk/busybox@853 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/tail.c24
-rw-r--r--coreutils/test.c4
-rw-r--r--coreutils/tr.c8
3 files changed, 18 insertions, 18 deletions
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 601f0873d..9232356eb 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -104,7 +104,7 @@ static void write_header(const char *filename)
104 Return 0 if successful, 1 if an error occurred. */ 104 Return 0 if successful, 1 if an error occurred. */
105 105
106static int 106static int
107file_lines(const char *filename, int fd, long int n_lines, off_t pos) 107file_lines(int fd, long int n_lines, off_t pos)
108{ 108{
109 char buffer[BUFSIZ]; 109 char buffer[BUFSIZ];
110 int bytes_read; 110 int bytes_read;
@@ -164,7 +164,7 @@ file_lines(const char *filename, int fd, long int n_lines, off_t pos)
164 Buffer the text as a linked list of LBUFFERs, adding them as needed. 164 Buffer the text as a linked list of LBUFFERs, adding them as needed.
165 Return 0 if successful, 1 if an error occured. */ 165 Return 0 if successful, 1 if an error occured. */
166 166
167static int pipe_lines(const char *filename, int fd, long int n_lines) 167static int pipe_lines(int fd, long int n_lines)
168{ 168{
169 struct linebuffer { 169 struct linebuffer {
170 int nbytes, nlines; 170 int nbytes, nlines;
@@ -266,7 +266,7 @@ static int pipe_lines(const char *filename, int fd, long int n_lines)
266 If `forever' is nonzero, keep reading from the end of the file 266 If `forever' is nonzero, keep reading from the end of the file
267 until killed. Return the number of bytes read from the file. */ 267 until killed. Return the number of bytes read from the file. */
268 268
269static long dump_remainder(const char *filename, int fd) 269static long dump_remainder(int fd)
270{ 270{
271 char buffer[BUFSIZ]; 271 char buffer[BUFSIZ];
272 int bytes_read; 272 int bytes_read;
@@ -312,11 +312,11 @@ static int tail_lines(const char *filename, int fd, long int n_lines)
312 if (S_ISREG(stats.st_mode) 312 if (S_ISREG(stats.st_mode)
313 && lseek(fd, (off_t) 0, SEEK_CUR) == (off_t) 0) { 313 && lseek(fd, (off_t) 0, SEEK_CUR) == (off_t) 0) {
314 length = lseek(fd, (off_t) 0, SEEK_END); 314 length = lseek(fd, (off_t) 0, SEEK_END);
315 if (length != 0 && file_lines(filename, fd, n_lines, length)) 315 if (length != 0 && file_lines(fd, n_lines, length))
316 return 1; 316 return 1;
317 dump_remainder(filename, fd); 317 dump_remainder(fd);
318 } else 318 } else
319 return pipe_lines(filename, fd, n_lines); 319 return pipe_lines(fd, n_lines);
320 320
321 return 0; 321 return 0;
322} 322}
@@ -616,7 +616,7 @@ file_lines(const char *filename, int fd, long int n_lines, off_t pos)
616 Buffer the text as a linked list of LBUFFERs, adding them as needed. 616 Buffer the text as a linked list of LBUFFERs, adding them as needed.
617 Return 0 if successful, 1 if an error occured. */ 617 Return 0 if successful, 1 if an error occured. */
618 618
619static int pipe_lines(const char *filename, int fd, long int n_lines) 619static int pipe_lines(int fd, long int n_lines)
620{ 620{
621 struct linebuffer { 621 struct linebuffer {
622 int nbytes, nlines; 622 int nbytes, nlines;
@@ -850,7 +850,7 @@ static int start_lines(const char *filename, int fd, long int n_lines)
850 If `forever' is nonzero, keep reading from the end of the file 850 If `forever' is nonzero, keep reading from the end of the file
851 until killed. Return the number of bytes read from the file. */ 851 until killed. Return the number of bytes read from the file. */
852 852
853static long dump_remainder(const char *filename, int fd) 853static long dump_remainder(int fd)
854{ 854{
855 char buffer[BUFSIZ]; 855 char buffer[BUFSIZ];
856 int bytes_read; 856 int bytes_read;
@@ -925,7 +925,7 @@ static void tail_forever(char **names, int nfiles)
925 write_header(names[i], NULL); 925 write_header(names[i], NULL);
926 last = i; 926 last = i;
927 } 927 }
928 file_sizes[i] += dump_remainder(names[i], file_descs[i]); 928 file_sizes[i] += dump_remainder(file_descs[i]);
929 } 929 }
930 930
931 /* If none of the files changed size, sleep. */ 931 /* 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)
955 lseek(fd, n_bytes, SEEK_CUR); 955 lseek(fd, n_bytes, SEEK_CUR);
956 else if (start_bytes(filename, fd, n_bytes)) 956 else if (start_bytes(filename, fd, n_bytes))
957 return 1; 957 return 1;
958 dump_remainder(filename, fd); 958 dump_remainder(fd);
959 } else { 959 } else {
960 if (S_ISREG(stats.st_mode)) { 960 if (S_ISREG(stats.st_mode)) {
961 off_t current_pos, end_pos; 961 off_t current_pos, end_pos;
@@ -1021,9 +1021,9 @@ static int tail_lines(const char *filename, int fd, long int n_lines)
1021 length = lseek(fd, (off_t) 0, SEEK_END); 1021 length = lseek(fd, (off_t) 0, SEEK_END);
1022 if (length != 0 && file_lines(filename, fd, n_lines, length)) 1022 if (length != 0 && file_lines(filename, fd, n_lines, length))
1023 return 1; 1023 return 1;
1024 dump_remainder(filename, fd); 1024 dump_remainder(fd);
1025 } else 1025 } else
1026 return pipe_lines(filename, fd, n_lines); 1026 return pipe_lines(fd, n_lines);
1027 } 1027 }
1028 return 0; 1028 return 0;
1029} 1029}
diff --git a/coreutils/test.c b/coreutils/test.c
index d7b34a6a4..175cb5d05 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -372,7 +372,7 @@ filstat(nm, mode)
372 enum token mode; 372 enum token mode;
373{ 373{
374 struct stat s; 374 struct stat s;
375 int i; 375 unsigned int i;
376 376
377 if (mode == FILSYM) { 377 if (mode == FILSYM) {
378#ifdef S_IFLNK 378#ifdef S_IFLNK
@@ -535,7 +535,7 @@ char *path;
535int mode; 535int mode;
536{ 536{
537 struct stat st; 537 struct stat st;
538 int euid = geteuid(); 538 unsigned int euid = geteuid();
539 539
540 if (stat (path, &st) < 0) 540 if (stat (path, &st) < 0)
541 return (-1); 541 return (-1);
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 89fe3f5b0..2971ef68e 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -140,10 +140,10 @@ static unsigned int expand(char *arg, register unsigned char *buffer)
140 return (buffer - buffer_start); 140 return (buffer - buffer_start);
141} 141}
142 142
143static int complement(unsigned char *buffer, unsigned int buffer_len) 143static int complement(unsigned char *buffer, int buffer_len)
144{ 144{
145 register short i, j, index; 145 register short i, j, index;
146 unsigned char conv[ASCII + 2]; 146 char conv[ASCII + 2];
147 147
148 index = 0; 148 index = 0;
149 for (i = 0; i <= ASCII; i++) { 149 for (i = 0; i <= ASCII; i++) {
@@ -160,9 +160,9 @@ static int complement(unsigned char *buffer, unsigned int buffer_len)
160extern int tr_main(int argc, char **argv) 160extern int tr_main(int argc, char **argv)
161{ 161{
162 register unsigned char *ptr; 162 register unsigned char *ptr;
163 unsigned int output_length=0, input_length; 163 int output_length=0, input_length;
164 int index = 1; 164 int index = 1;
165 short i; 165 int i;
166 166
167 if (argc > 1 && argv[index][0] == '-') { 167 if (argc > 1 && argv[index][0] == '-') {
168 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) { 168 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {