diff options
Diffstat (limited to 'coreutils')
38 files changed, 114 insertions, 114 deletions
diff --git a/coreutils/Config.in b/coreutils/Config.in index 900908a9e..5c0180a5e 100644 --- a/coreutils/Config.in +++ b/coreutils/Config.in | |||
@@ -10,7 +10,7 @@ config CONFIG_BASENAME | |||
10 | default n | 10 | default n |
11 | help | 11 | help |
12 | basename is used to strip the directory and suffix from filenames, | 12 | basename is used to strip the directory and suffix from filenames, |
13 | leaving just the filename itself. Enable this option if you wish | 13 | leaving just the filename itself. Enable this option if you wish |
14 | to enable the 'basename' utility. | 14 | to enable the 'basename' utility. |
15 | 15 | ||
16 | config CONFIG_CAL | 16 | config CONFIG_CAL |
@@ -101,7 +101,7 @@ config CONFIG_DD | |||
101 | help | 101 | help |
102 | dd copies a file (from standard input to standard output, | 102 | dd copies a file (from standard input to standard output, |
103 | by default) using specific input and output blocksizes, | 103 | by default) using specific input and output blocksizes, |
104 | while optionally performing conversions on it. | 104 | while optionally performing conversions on it. |
105 | 105 | ||
106 | config CONFIG_DF | 106 | config CONFIG_DF |
107 | bool "df" | 107 | bool "df" |
@@ -154,7 +154,7 @@ config CONFIG_FEATURE_FANCY_ECHO | |||
154 | default y | 154 | default y |
155 | depends on CONFIG_ECHO | 155 | depends on CONFIG_ECHO |
156 | help | 156 | help |
157 | This adds options (-n and -e) to echo. | 157 | This adds options (-n and -e) to echo. |
158 | 158 | ||
159 | config CONFIG_ENV | 159 | config CONFIG_ENV |
160 | bool "env" | 160 | bool "env" |
diff --git a/coreutils/Makefile b/coreutils/Makefile index a5cdf6248..b42689a26 100644 --- a/coreutils/Makefile +++ b/coreutils/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # Makefile for busybox | 1 | # Makefile for busybox |
2 | # | 2 | # |
3 | # Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/Makefile.in b/coreutils/Makefile.in index 6c2547648..a5343c9c7 100644 --- a/coreutils/Makefile.in +++ b/coreutils/Makefile.in | |||
@@ -1,6 +1,6 @@ | |||
1 | # Makefile for busybox | 1 | # Makefile for busybox |
2 | # | 2 | # |
3 | # Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/basename.c b/coreutils/basename.c index 7fcdb8368..7b8b7b6f0 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini basename implementation for busybox | 3 | * Mini basename implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/cal.c b/coreutils/cal.c index 786156253..cd7be0d30 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -161,7 +161,7 @@ int cal_main(int argc, char **argv) | |||
161 | int row, len, days[MAXDAYS]; | 161 | int row, len, days[MAXDAYS]; |
162 | int *dp = days; | 162 | int *dp = days; |
163 | char lineout[30]; | 163 | char lineout[30]; |
164 | 164 | ||
165 | day_array(month, year, dp); | 165 | day_array(month, year, dp); |
166 | len = sprintf(lineout, "%s %d", month_names[month - 1], year); | 166 | len = sprintf(lineout, "%s %d", month_names[month - 1], year); |
167 | bb_printf("%*s%s\n%s\n", | 167 | bb_printf("%*s%s\n%s\n", |
@@ -176,7 +176,7 @@ int cal_main(int argc, char **argv) | |||
176 | int row, which_cal, week_len, days[12][MAXDAYS]; | 176 | int row, which_cal, week_len, days[12][MAXDAYS]; |
177 | int *dp; | 177 | int *dp; |
178 | char lineout[80]; | 178 | char lineout[80]; |
179 | 179 | ||
180 | sprintf(lineout, "%d", year); | 180 | sprintf(lineout, "%d", year); |
181 | center(lineout, | 181 | center(lineout, |
182 | (WEEK_LEN * 3 + HEAD_SEP * 2) | 182 | (WEEK_LEN * 3 + HEAD_SEP * 2) |
@@ -317,7 +317,7 @@ static void blank_string(char *buf, size_t buflen) | |||
317 | static char *build_row(char *p, int *dp) | 317 | static char *build_row(char *p, int *dp) |
318 | { | 318 | { |
319 | int col, val, day; | 319 | int col, val, day; |
320 | 320 | ||
321 | memset(p, ' ', (julian + DAY_LEN) * 7); | 321 | memset(p, ' ', (julian + DAY_LEN) * 7); |
322 | 322 | ||
323 | col = 0; | 323 | col = 0; |
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index 93e493869..8cfb54241 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini chgrp implementation for busybox | 3 | * Mini chgrp implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -63,7 +63,7 @@ int chgrp_main(int argc, char **argv) | |||
63 | 63 | ||
64 | /* Ok, ready to do the deed now */ | 64 | /* Ok, ready to do the deed now */ |
65 | do { | 65 | do { |
66 | if (! recursive_action (*argv, recursiveFlag, FALSE, FALSE, | 66 | if (! recursive_action (*argv, recursiveFlag, FALSE, FALSE, |
67 | fileAction, fileAction, &gid)) { | 67 | fileAction, fileAction, &gid)) { |
68 | retval = EXIT_FAILURE; | 68 | retval = EXIT_FAILURE; |
69 | } | 69 | } |
diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 390cc6d2c..0cb888628 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini chmod implementation for busybox | 3 | * Mini chmod implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * Reworked by (C) 2002 Vladimir Oleynik <dzo@simtreas.ru> | 7 | * Reworked by (C) 2002 Vladimir Oleynik <dzo@simtreas.ru> |
8 | * to correctly parse '-rwxgoa' | 8 | * to correctly parse '-rwxgoa' |
diff --git a/coreutils/chown.c b/coreutils/chown.c index 07d673f28..638745f17 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini chown implementation for busybox | 3 | * Mini chown implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -84,10 +84,10 @@ int chown_main(int argc, char **argv) | |||
84 | uid = get_ug_id(*argv, my_getpwnam); | 84 | uid = get_ug_id(*argv, my_getpwnam); |
85 | 85 | ||
86 | ++argv; | 86 | ++argv; |
87 | 87 | ||
88 | /* Ok, ready to do the deed now */ | 88 | /* Ok, ready to do the deed now */ |
89 | do { | 89 | do { |
90 | if (! recursive_action (*argv, (flags & FLAG_R), FALSE, FALSE, | 90 | if (! recursive_action (*argv, (flags & FLAG_R), FALSE, FALSE, |
91 | fileAction, fileAction, NULL)) { | 91 | fileAction, fileAction, NULL)) { |
92 | retval = EXIT_FAILURE; | 92 | retval = EXIT_FAILURE; |
93 | } | 93 | } |
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index eeed01302..62257021d 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini chroot implementation for busybox | 3 | * Mini chroot implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/cut.c b/coreutils/cut.c index 34ec3690c..d9f8161f3 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * cut.c - minimalist version of cut | 3 | * cut.c - minimalist version of cut |
4 | * | 4 | * |
5 | * Copyright (C) 1999,2000,2001 by Lineo, inc. | 5 | * Copyright (C) 1999,2000,2001 by Lineo, inc. |
6 | * Written by Mark Whitley <markw@lineo.com>, <markw@codepoet.org> | 6 | * Written by Mark Whitley <markw@codepoet.org> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -69,7 +69,7 @@ static int cmpfunc(const void *a, const void *b) | |||
69 | 69 | ||
70 | /* | 70 | /* |
71 | * parse_lists() - parses a list and puts values into startpos and endpos. | 71 | * parse_lists() - parses a list and puts values into startpos and endpos. |
72 | * valid list formats: N, N-, N-M, -M | 72 | * valid list formats: N, N-, N-M, -M |
73 | * more than one list can be seperated by commas | 73 | * more than one list can be seperated by commas |
74 | */ | 74 | */ |
75 | static void parse_lists(char *lists) | 75 | static void parse_lists(char *lists) |
@@ -96,7 +96,7 @@ static void parse_lists(char *lists) | |||
96 | s = strtoul(ntok, &junk, 10); | 96 | s = strtoul(ntok, &junk, 10); |
97 | if(*junk != '\0' || s < 0) | 97 | if(*junk != '\0' || s < 0) |
98 | bb_error_msg_and_die("invalid byte or field list"); | 98 | bb_error_msg_and_die("invalid byte or field list"); |
99 | 99 | ||
100 | /* account for the fact that arrays are zero based, while the user | 100 | /* account for the fact that arrays are zero based, while the user |
101 | * expects the first char on the line to be char # 1 */ | 101 | * expects the first char on the line to be char # 1 */ |
102 | if (s != 0) | 102 | if (s != 0) |
@@ -125,7 +125,7 @@ static void parse_lists(char *lists) | |||
125 | /* if there's something left to tokenize, the user past an invalid list */ | 125 | /* if there's something left to tokenize, the user past an invalid list */ |
126 | if (ltok) | 126 | if (ltok) |
127 | bb_error_msg_and_die("invalid byte or field list"); | 127 | bb_error_msg_and_die("invalid byte or field list"); |
128 | 128 | ||
129 | /* add the new list */ | 129 | /* add the new list */ |
130 | cut_lists = xrealloc(cut_lists, sizeof(struct cut_list) * (++nlists)); | 130 | cut_lists = xrealloc(cut_lists, sizeof(struct cut_list) * (++nlists)); |
131 | cut_lists[nlists-1].startpos = s; | 131 | cut_lists[nlists-1].startpos = s; |
@@ -227,7 +227,7 @@ static void cut_file_by_lines(const char *line, unsigned int linenum) | |||
227 | { | 227 | { |
228 | static int c = 0; | 228 | static int c = 0; |
229 | static int l = -1; | 229 | static int l = -1; |
230 | 230 | ||
231 | /* I can't initialize this above cuz the "initializer isn't | 231 | /* I can't initialize this above cuz the "initializer isn't |
232 | * constant" *sigh* */ | 232 | * constant" *sigh* */ |
233 | if (l == -1) | 233 | if (l == -1) |
diff --git a/coreutils/date.c b/coreutils/date.c index a6b595e57..9c763299f 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Mini date implementation for busybox | 3 | * Mini date implementation for busybox |
4 | * | 4 | * |
5 | * by Matthew Grant <grantma@anathoth.gen.nz> | 5 | * by Matthew Grant <grantma@anathoth.gen.nz> |
6 | * | 6 | * |
7 | * iso-format handling added by Robert Griebl <griebl@gmx.de> | 7 | * iso-format handling added by Robert Griebl <griebl@gmx.de> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
@@ -33,7 +33,7 @@ | |||
33 | #include "busybox.h" | 33 | #include "busybox.h" |
34 | 34 | ||
35 | 35 | ||
36 | /* This 'date' command supports only 2 time setting formats, | 36 | /* This 'date' command supports only 2 time setting formats, |
37 | all the GNU strftime stuff (its in libc, lets use it), | 37 | all the GNU strftime stuff (its in libc, lets use it), |
38 | setting time using UTC and displaying int, as well as | 38 | setting time using UTC and displaying int, as well as |
39 | an RFC 822 complient date output for shell scripting | 39 | an RFC 822 complient date output for shell scripting |
diff --git a/coreutils/df.c b/coreutils/df.c index 9c0d13f62..9d53f2bc4 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini df implementation for busybox | 3 | * Mini df implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * based on original code by (I think) Bruce Perens <bruce@pixar.com>. | 6 | * based on original code by (I think) Bruce Perens <bruce@pixar.com>. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
@@ -51,7 +51,7 @@ extern int df_main(int argc, char **argv) | |||
51 | long blocks_used; | 51 | long blocks_used; |
52 | long blocks_percent_used; | 52 | long blocks_percent_used; |
53 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 53 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
54 | unsigned long df_disp_hr = KILOBYTE; | 54 | unsigned long df_disp_hr = KILOBYTE; |
55 | #endif | 55 | #endif |
56 | int status = EXIT_SUCCESS; | 56 | int status = EXIT_SUCCESS; |
57 | unsigned long opt; | 57 | unsigned long opt; |
@@ -115,7 +115,7 @@ extern int df_main(int argc, char **argv) | |||
115 | bb_perror_msg("%s", mount_point); | 115 | bb_perror_msg("%s", mount_point); |
116 | goto SET_ERROR; | 116 | goto SET_ERROR; |
117 | } | 117 | } |
118 | 118 | ||
119 | if ((s.f_blocks > 0) || !mount_table){ | 119 | if ((s.f_blocks > 0) || !mount_table){ |
120 | blocks_used = s.f_blocks - s.f_bfree; | 120 | blocks_used = s.f_blocks - s.f_bfree; |
121 | blocks_percent_used = 0; | 121 | blocks_percent_used = 0; |
@@ -124,7 +124,7 @@ extern int df_main(int argc, char **argv) | |||
124 | + (blocks_used + s.f_bavail)/2 | 124 | + (blocks_used + s.f_bavail)/2 |
125 | ) / (blocks_used + s.f_bavail); | 125 | ) / (blocks_used + s.f_bavail); |
126 | } | 126 | } |
127 | 127 | ||
128 | if (strcmp(device, "rootfs") == 0) { | 128 | if (strcmp(device, "rootfs") == 0) { |
129 | continue; | 129 | continue; |
130 | } else if (strcmp(device, "/dev/root") == 0) { | 130 | } else if (strcmp(device, "/dev/root") == 0) { |
@@ -134,15 +134,15 @@ extern int df_main(int argc, char **argv) | |||
134 | goto SET_ERROR; | 134 | goto SET_ERROR; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 138 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
139 | bb_printf("%-21s%9s ", device, | 139 | bb_printf("%-21s%9s ", device, |
140 | make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr)); | 140 | make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr)); |
141 | 141 | ||
142 | bb_printf("%9s ", | 142 | bb_printf("%9s ", |
143 | make_human_readable_str( (s.f_blocks - s.f_bfree), | 143 | make_human_readable_str( (s.f_blocks - s.f_bfree), |
144 | s.f_bsize, df_disp_hr)); | 144 | s.f_bsize, df_disp_hr)); |
145 | 145 | ||
146 | bb_printf("%9s %3ld%% %s\n", | 146 | bb_printf("%9s %3ld%% %s\n", |
147 | make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr), | 147 | make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr), |
148 | blocks_percent_used, mount_point); | 148 | blocks_percent_used, mount_point); |
diff --git a/coreutils/dirname.c b/coreutils/dirname.c index d0c42b603..5136e4909 100644 --- a/coreutils/dirname.c +++ b/coreutils/dirname.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini dirname implementation for busybox | 3 | * Mini dirname implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index c28e6a8b9..a21ed5bc3 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c | |||
@@ -50,7 +50,7 @@ typedef unsigned long int bb_uint64_t; | |||
50 | static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | 50 | static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
51 | 51 | ||
52 | // if fn is NULL then input is stdin and output is stdout | 52 | // if fn is NULL then input is stdin and output is stdout |
53 | static int convert(char *fn, int ConvType) | 53 | static int convert(char *fn, int ConvType) |
54 | { | 54 | { |
55 | int c, fd; | 55 | int c, fd; |
56 | struct timeval tv; | 56 | struct timeval tv; |
@@ -156,12 +156,12 @@ static int convert(char *fn, int ConvType) | |||
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | int dos2unix_main(int argc, char *argv[]) | 159 | int dos2unix_main(int argc, char *argv[]) |
160 | { | 160 | { |
161 | int ConvType = CT_AUTO; | 161 | int ConvType = CT_AUTO; |
162 | int o; | 162 | int o; |
163 | 163 | ||
164 | //See if we are supposed to be doing dos2unix or unix2dos | 164 | //See if we are supposed to be doing dos2unix or unix2dos |
165 | if (argv[0][0]=='d') { | 165 | if (argv[0][0]=='d') { |
166 | ConvType = CT_DOS2UNIX; | 166 | ConvType = CT_DOS2UNIX; |
167 | } | 167 | } |
diff --git a/coreutils/du.c b/coreutils/du.c index df75a6953..bfa44034a 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -181,7 +181,7 @@ int du_main(int argc, char **argv) | |||
181 | #else | 181 | #else |
182 | disp_k = 0; | 182 | disp_k = 0; |
183 | #endif | 183 | #endif |
184 | } | 184 | } |
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | /* Note: SUSv3 specifies that -a and -s options can not be used together | 187 | /* Note: SUSv3 specifies that -a and -s options can not be used together |
diff --git a/coreutils/echo.c b/coreutils/echo.c index b600a1fbd..26a6fbf81 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c | |||
@@ -55,7 +55,7 @@ extern int echo_main(int argc, char** argv) | |||
55 | * that all of the options specified are actually valid. | 55 | * that all of the options specified are actually valid. |
56 | * Otherwise, the string should just be echoed. | 56 | * Otherwise, the string should just be echoed. |
57 | */ | 57 | */ |
58 | 58 | ||
59 | if (!*(p = *argv + 1)) { /* A single '-', so echo it. */ | 59 | if (!*(p = *argv + 1)) { /* A single '-', so echo it. */ |
60 | goto just_echo; | 60 | goto just_echo; |
61 | } | 61 | } |
@@ -87,7 +87,7 @@ just_echo: | |||
87 | while ((c = *(*argv)++)) { | 87 | while ((c = *(*argv)++)) { |
88 | if (c == eflag) { /* Check for escape seq. */ | 88 | if (c == eflag) { /* Check for escape seq. */ |
89 | if (**argv == 'c') { | 89 | if (**argv == 'c') { |
90 | /* '\c' means cancel newline and | 90 | /* '\c' means cancel newline and |
91 | * ignore all subsequent chars. */ | 91 | * ignore all subsequent chars. */ |
92 | goto DONE; | 92 | goto DONE; |
93 | } | 93 | } |
@@ -141,8 +141,8 @@ DONE: | |||
141 | * notice, this list of conditions and the following disclaimer in the | 141 | * notice, this list of conditions and the following disclaimer in the |
142 | * documentation and/or other materials provided with the distribution. | 142 | * documentation and/or other materials provided with the distribution. |
143 | * | 143 | * |
144 | * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change | 144 | * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change |
145 | * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> | 145 | * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> |
146 | * | 146 | * |
147 | * California, Berkeley and its contributors. | 147 | * California, Berkeley and its contributors. |
148 | * 4. Neither the name of the University nor the names of its contributors | 148 | * 4. Neither the name of the University nor the names of its contributors |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 77d603b88..e5816371a 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * based on GNU expr Mike Parker. | 5 | * based on GNU expr Mike Parker. |
6 | * Copyright (C) 86, 1991-1997, 1999 Free Software Foundation, Inc. | 6 | * Copyright (C) 86, 1991-1997, 1999 Free Software Foundation, Inc. |
7 | * | 7 | * |
8 | * Busybox modifications | 8 | * Busybox modifications |
9 | * Copyright (c) 2000 Edward Betts <edward@debian.org>. | 9 | * Copyright (c) 2000 Edward Betts <edward@debian.org>. |
10 | * Aug 2003 Vladimir Oleynik - reduced 464 bytes. | 10 | * Aug 2003 Vladimir Oleynik - reduced 464 bytes. |
11 | * | 11 | * |
diff --git a/coreutils/false.c b/coreutils/false.c index a07b99d95..5cf238409 100644 --- a/coreutils/false.c +++ b/coreutils/false.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini false implementation for busybox | 3 | * Mini false implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/id.c b/coreutils/id.c index 971e7cdad..602b26ec3 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -47,7 +47,7 @@ extern int id_main(int argc, char **argv) | |||
47 | #ifdef CONFIG_SELINUX | 47 | #ifdef CONFIG_SELINUX |
48 | int is_flask_enabled_flag = is_flask_enabled(); | 48 | int is_flask_enabled_flag = is_flask_enabled(); |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | flags = bb_getopt_ulflags(argc, argv, "ugrn"); | 51 | flags = bb_getopt_ulflags(argc, argv, "ugrn"); |
52 | 52 | ||
53 | if (((flags & (JUST_USER | JUST_GROUP)) == (JUST_USER | JUST_GROUP)) | 53 | if (((flags & (JUST_USER | JUST_GROUP)) == (JUST_USER | JUST_GROUP)) |
diff --git a/coreutils/install.c b/coreutils/install.c index 82773b8de..305e02b0d 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -48,7 +48,7 @@ static const struct option install_long_options[] = { | |||
48 | { "owner", 0, NULL, 'o' }, | 48 | { "owner", 0, NULL, 'o' }, |
49 | { 0, 0, 0, 0 } | 49 | { 0, 0, 0, 0 } |
50 | }; | 50 | }; |
51 | 51 | ||
52 | extern int install_main(int argc, char **argv) | 52 | extern int install_main(int argc, char **argv) |
53 | { | 53 | { |
54 | struct stat statbuf; | 54 | struct stat statbuf; |
@@ -116,7 +116,7 @@ extern int install_main(int argc, char **argv) | |||
116 | } | 116 | } |
117 | return(ret); | 117 | return(ret); |
118 | } | 118 | } |
119 | 119 | ||
120 | cp_mv_stat2(argv[argc - 1], &statbuf, lstat); | 120 | cp_mv_stat2(argv[argc - 1], &statbuf, lstat); |
121 | for (i = optind; i < argc - 1; i++) { | 121 | for (i = optind; i < argc - 1; i++) { |
122 | unsigned char *dest; | 122 | unsigned char *dest; |
@@ -137,15 +137,15 @@ extern int install_main(int argc, char **argv) | |||
137 | /* Set the user and group id */ | 137 | /* Set the user and group id */ |
138 | if (lchown(dest, uid, gid) == -1) { | 138 | if (lchown(dest, uid, gid) == -1) { |
139 | bb_perror_msg("cannot change ownership of %s", dest); | 139 | bb_perror_msg("cannot change ownership of %s", dest); |
140 | ret = EXIT_FAILURE; | 140 | ret = EXIT_FAILURE; |
141 | } | 141 | } |
142 | if (flags & INSTALL_OPT_STRIP) { | 142 | if (flags & INSTALL_OPT_STRIP) { |
143 | if (execlp("strip", "strip", dest, NULL) == -1) { | 143 | if (execlp("strip", "strip", dest, NULL) == -1) { |
144 | bb_error_msg("strip failed"); | 144 | bb_error_msg("strip failed"); |
145 | ret = EXIT_FAILURE; | 145 | ret = EXIT_FAILURE; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | return(ret); | 150 | return(ret); |
151 | } | 151 | } |
diff --git a/coreutils/libcoreutils/Makefile b/coreutils/libcoreutils/Makefile index b3a4e79b6..11867c602 100644 --- a/coreutils/libcoreutils/Makefile +++ b/coreutils/libcoreutils/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # Makefile for busybox | 1 | # Makefile for busybox |
2 | # | 2 | # |
3 | # Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/libcoreutils/Makefile.in b/coreutils/libcoreutils/Makefile.in index a7481d40a..d0e8b3a05 100644 --- a/coreutils/libcoreutils/Makefile.in +++ b/coreutils/libcoreutils/Makefile.in | |||
@@ -1,6 +1,6 @@ | |||
1 | # Makefile for busybox | 1 | # Makefile for busybox |
2 | # | 2 | # |
3 | # Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 3 | # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License as published by | 6 | # it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/ln.c b/coreutils/ln.c index 7c282b001..885ba61db 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini ln implementation for busybox | 3 | * Mini ln implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -88,14 +88,14 @@ extern int ln_main(int argc, char **argv) | |||
88 | if (flag & LN_SYMLINK) { | 88 | if (flag & LN_SYMLINK) { |
89 | link_func = symlink; | 89 | link_func = symlink; |
90 | } | 90 | } |
91 | 91 | ||
92 | if (link_func(*argv, src) != 0) { | 92 | if (link_func(*argv, src) != 0) { |
93 | bb_perror_msg(src); | 93 | bb_perror_msg(src); |
94 | status = EXIT_FAILURE; | 94 | status = EXIT_FAILURE; |
95 | } | 95 | } |
96 | 96 | ||
97 | free(src_name); | 97 | free(src_name); |
98 | 98 | ||
99 | } while ((++argv)[1]); | 99 | } while ((++argv)[1]); |
100 | 100 | ||
101 | return status; | 101 | return status; |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 2605ab12d..f7fa9a110 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -315,7 +315,7 @@ static int count_dirs(struct dnode **dn, int nfiles, int notsubdirs) | |||
315 | if (S_ISDIR(dn[i]->dstat.st_mode) | 315 | if (S_ISDIR(dn[i]->dstat.st_mode) |
316 | && (notsubdirs | 316 | && (notsubdirs |
317 | || ((dn[i]->name[0] != '.') | 317 | || ((dn[i]->name[0] != '.') |
318 | || (dn[i]->name[1] | 318 | || (dn[i]->name[1] |
319 | && ((dn[i]->name[1] != '.') | 319 | && ((dn[i]->name[1] != '.') |
320 | || dn[i]->name[2]))))) | 320 | || dn[i]->name[2]))))) |
321 | dirs++; | 321 | dirs++; |
@@ -1055,7 +1055,7 @@ extern int ls_main(int argc, char **argv) | |||
1055 | if ((all_fmt & STYLE_MASK) == STYLE_LONG && (all_fmt & LIST_ID_NUMERIC)) | 1055 | if ((all_fmt & STYLE_MASK) == STYLE_LONG && (all_fmt & LIST_ID_NUMERIC)) |
1056 | all_fmt &= ~LIST_ID_NAME; /* don't list names if numeric uid */ | 1056 | all_fmt &= ~LIST_ID_NAME; /* don't list names if numeric uid */ |
1057 | #endif | 1057 | #endif |
1058 | 1058 | ||
1059 | /* choose a display format */ | 1059 | /* choose a display format */ |
1060 | if ((all_fmt & STYLE_MASK) == STYLE_AUTO) | 1060 | if ((all_fmt & STYLE_MASK) == STYLE_AUTO) |
1061 | #if STYLE_AUTO != 0 | 1061 | #if STYLE_AUTO != 0 |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 83f6da180..64e069374 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Glenn L. McGrath | 2 | * Copyright (C) 2003 Glenn L. McGrath |
3 | * Copyright (C) 2003 Erik Andersen | 3 | * Copyright (C) 2003-2004 Erik Andersen |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
diff --git a/coreutils/mknod.c b/coreutils/mknod.c index d5e9e17fe..7b2467b8f 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c | |||
@@ -50,7 +50,7 @@ extern int mknod_main(int argc, char **argv) | |||
50 | dev = (bb_xgetularg10_bnd(argv[2], 0, 255) << 8) | 50 | dev = (bb_xgetularg10_bnd(argv[2], 0, 255) << 8) |
51 | + bb_xgetularg10_bnd(argv[3], 0, 255); | 51 | + bb_xgetularg10_bnd(argv[3], 0, 255); |
52 | } | 52 | } |
53 | 53 | ||
54 | if (argc == 2) { | 54 | if (argc == 2) { |
55 | name = *argv; | 55 | name = *argv; |
56 | if (mknod(name, mode, dev) == 0) { | 56 | if (mknod(name, mode, dev) == 0) { |
diff --git a/coreutils/mv.c b/coreutils/mv.c index c28d0500e..4f08dedc0 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -75,7 +75,7 @@ extern int mv_main(int argc, char **argv) | |||
75 | goto DO_MOVE; | 75 | goto DO_MOVE; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | do { | 79 | do { |
80 | dest = concat_path_file(last, bb_get_last_path_component(*argv)); | 80 | dest = concat_path_file(last, bb_get_last_path_component(*argv)); |
81 | 81 | ||
@@ -84,7 +84,7 @@ extern int mv_main(int argc, char **argv) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | DO_MOVE: | 86 | DO_MOVE: |
87 | 87 | ||
88 | if (dest_exists && !(flags & OPT_FILEUTILS_FORCE) && | 88 | if (dest_exists && !(flags & OPT_FILEUTILS_FORCE) && |
89 | ((access(dest, W_OK) < 0 && isatty(0)) || | 89 | ((access(dest, W_OK) < 0 && isatty(0)) || |
90 | (flags & OPT_FILEUTILS_INTERACTIVE))) { | 90 | (flags & OPT_FILEUTILS_INTERACTIVE))) { |
@@ -119,7 +119,7 @@ DO_MOVE: | |||
119 | bb_perror_msg("cannot remove `%s'", dest); | 119 | bb_perror_msg("cannot remove `%s'", dest); |
120 | goto RET_1; | 120 | goto RET_1; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | if ((copy_file(*argv, dest, | 123 | if ((copy_file(*argv, dest, |
124 | FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS) >= 0) && | 124 | FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS) >= 0) && |
125 | (remove_file(*argv, FILEUTILS_RECUR | FILEUTILS_FORCE) >= 0)) { | 125 | (remove_file(*argv, FILEUTILS_RECUR | FILEUTILS_FORCE) >= 0)) { |
@@ -132,7 +132,7 @@ RET_1: | |||
132 | RET_0: | 132 | RET_0: |
133 | if (dest != last) { | 133 | if (dest != last) { |
134 | free((void *) dest); | 134 | free((void *) dest); |
135 | } | 135 | } |
136 | } while (*++argv != last); | 136 | } while (*++argv != last); |
137 | 137 | ||
138 | return (status); | 138 | return (status); |
diff --git a/coreutils/printf.c b/coreutils/printf.c index 76f59686b..053b01ee5 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
@@ -106,7 +106,7 @@ static int print_esc __P((char *escstart)); | |||
106 | static int print_formatted __P((char *format, int argc, char **argv)); | 106 | static int print_formatted __P((char *format, int argc, char **argv)); |
107 | static long xstrtol __P((char *s)); | 107 | static long xstrtol __P((char *s)); |
108 | static unsigned long xstrtoul __P((char *s)); | 108 | static unsigned long xstrtoul __P((char *s)); |
109 | static void print_direc __P( (char *start, size_t length, | 109 | static void print_direc __P( (char *start, size_t length, |
110 | int field_width, int precision, char *argument)); | 110 | int field_width, int precision, char *argument)); |
111 | static void print_esc_char __P((int c)); | 111 | static void print_esc_char __P((int c)); |
112 | static void print_esc_string __P((char *str)); | 112 | static void print_esc_string __P((char *str)); |
@@ -214,7 +214,7 @@ static int print_formatted(char *format, int argc, char **argv) | |||
214 | ++f; | 214 | ++f; |
215 | ++direc_length; | 215 | ++direc_length; |
216 | } | 216 | } |
217 | /* | 217 | /* |
218 | if (!strchr ("diouxXfeEgGcs", *f)) | 218 | if (!strchr ("diouxXfeEgGcs", *f)) |
219 | fprintf(stderr, "%%%c: invalid directive", *f); | 219 | fprintf(stderr, "%%%c: invalid directive", *f); |
220 | */ | 220 | */ |
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 3f6037170..a10e5bb4f 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -66,7 +66,7 @@ extern int rmdir_main(int argc, char **argv) | |||
66 | } | 66 | } |
67 | break; | 67 | break; |
68 | } while (1); | 68 | } while (1); |
69 | 69 | ||
70 | } while (*++argv); | 70 | } while (*++argv); |
71 | 71 | ||
72 | return status; | 72 | return status; |
diff --git a/coreutils/tail.c b/coreutils/tail.c index d588ccdd1..b18064a38 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -118,7 +118,7 @@ int tail_main(int argc, char **argv) | |||
118 | /* Allow legacy syntax of an initial numeric option without -n. */ | 118 | /* Allow legacy syntax of an initial numeric option without -n. */ |
119 | if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-') | 119 | if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-') |
120 | /* && (isdigit)(argv[1][1]) */ | 120 | /* && (isdigit)(argv[1][1]) */ |
121 | && (((unsigned int)(argv[1][1] - '0')) <= 9)))) | 121 | && (((unsigned int)(argv[1][1] - '0')) <= 9)))) |
122 | { | 122 | { |
123 | optind = 2; | 123 | optind = 2; |
124 | optarg = argv[1]; | 124 | optarg = argv[1]; |
diff --git a/coreutils/tee.c b/coreutils/tee.c index 73c2f8e9d..bb2896663 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -97,7 +97,7 @@ int tee_main(int argc, char **argv) | |||
97 | } | 97 | } |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | /* Now we need to check for i/o errors on stdin and the various | 100 | /* Now we need to check for i/o errors on stdin and the various |
101 | * output files. Since we know that the first entry in the output | 101 | * output files. Since we know that the first entry in the output |
102 | * file table is stdout, we can save one "if ferror" test by | 102 | * file table is stdout, we can save one "if ferror" test by |
103 | * setting the first entry to stdin and checking stdout error | 103 | * setting the first entry to stdin and checking stdout error |
diff --git a/coreutils/test.c b/coreutils/test.c index 2ad326ea6..419da5101 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * test implementation for busybox | 3 | * test implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (c) by a whole pile of folks: | 5 | * Copyright (c) by a whole pile of folks: |
6 | * | 6 | * |
7 | * test(1); version 7-like -- author Erik Baalbergen | 7 | * test(1); version 7-like -- author Erik Baalbergen |
8 | * modified by Eric Gisin to be used as built-in. | 8 | * modified by Eric Gisin to be used as built-in. |
@@ -10,7 +10,7 @@ | |||
10 | * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). | 10 | * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). |
11 | * modified by J.T. Conklin for NetBSD. | 11 | * modified by J.T. Conklin for NetBSD. |
12 | * modified by Herbert Xu to be used as built-in in ash. | 12 | * modified by Herbert Xu to be used as built-in in ash. |
13 | * modified by Erik Andersen <andersen@codepoet.org> to be used | 13 | * modified by Erik Andersen <andersen@codepoet.org> to be used |
14 | * in busybox. | 14 | * in busybox. |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or modify | 16 | * This program is free software; you can redistribute it and/or modify |
diff --git a/coreutils/touch.c b/coreutils/touch.c index 3d780e167..645fb2174 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini touch implementation for busybox | 3 | * Mini touch implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/tr.c b/coreutils/tr.c index 958fc80b8..1325245b8 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) Michiel Huisjes | 5 | * Copyright (c) Michiel Huisjes |
6 | * | 6 | * |
7 | * This version of tr is adapted from Minix tr and was modified | 7 | * This version of tr is adapted from Minix tr and was modified |
8 | * by Erik Andersen <andersen@codepoet.org> to be used in busybox. | 8 | * by Erik Andersen <andersen@codepoet.org> to be used in busybox. |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
@@ -20,7 +20,7 @@ | |||
20 | * You should have received a copy of the GNU General Public License | 20 | * You should have received a copy of the GNU General Public License |
21 | * along with this program; if not, write to the Free Software | 21 | * along with this program; if not, write to the Free Software |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 | * | 23 | * |
24 | * Original copyright notice is retained at the end of this file. | 24 | * Original copyright notice is retained at the end of this file. |
25 | */ | 25 | */ |
26 | 26 | ||
@@ -213,24 +213,24 @@ extern int tr_main(int argc, char **argv) | |||
213 | /* | 213 | /* |
214 | * Copyright (c) 1987,1997, Prentice Hall | 214 | * Copyright (c) 1987,1997, Prentice Hall |
215 | * All rights reserved. | 215 | * All rights reserved. |
216 | * | 216 | * |
217 | * Redistribution and use of the MINIX operating system in source and | 217 | * Redistribution and use of the MINIX operating system in source and |
218 | * binary forms, with or without modification, are permitted provided | 218 | * binary forms, with or without modification, are permitted provided |
219 | * that the following conditions are met: | 219 | * that the following conditions are met: |
220 | * | 220 | * |
221 | * Redistributions of source code must retain the above copyright | 221 | * Redistributions of source code must retain the above copyright |
222 | * notice, this list of conditions and the following disclaimer. | 222 | * notice, this list of conditions and the following disclaimer. |
223 | * | 223 | * |
224 | * Redistributions in binary form must reproduce the above | 224 | * Redistributions in binary form must reproduce the above |
225 | * copyright notice, this list of conditions and the following | 225 | * copyright notice, this list of conditions and the following |
226 | * disclaimer in the documentation and/or other materials provided | 226 | * disclaimer in the documentation and/or other materials provided |
227 | * with the distribution. | 227 | * with the distribution. |
228 | * | 228 | * |
229 | * Neither the name of Prentice Hall nor the names of the software | 229 | * Neither the name of Prentice Hall nor the names of the software |
230 | * authors or contributors may be used to endorse or promote | 230 | * authors or contributors may be used to endorse or promote |
231 | * products derived from this software without specific prior | 231 | * products derived from this software without specific prior |
232 | * written permission. | 232 | * written permission. |
233 | * | 233 | * |
234 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND | 234 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND |
235 | * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | 235 | * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
236 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 236 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
diff --git a/coreutils/true.c b/coreutils/true.c index d19e749aa..3e7eb0111 100644 --- a/coreutils/true.c +++ b/coreutils/true.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Mini true implementation for busybox | 3 | * Mini true implementation for busybox |
4 | * | 4 | * |
5 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | 5 | * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 1734ed419..96da7caf3 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * Based on specification from | 18 | * Based on specification from |
19 | * http://www.opengroup.org/onlinepubs/007904975/utilities/uuencode.html | 19 | * http://www.opengroup.org/onlinepubs/007904975/utilities/uuencode.html |
20 | * | 20 | * |
21 | * Bugs: the spec doesnt mention anything about "`\n`\n" prior to the "end" line | 21 | * Bugs: the spec doesnt mention anything about "`\n`\n" prior to the "end" line |
22 | */ | 22 | */ |
23 | 23 | ||
24 | 24 | ||
@@ -50,7 +50,7 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream) | |||
50 | if (length > 60) { | 50 | if (length > 60) { |
51 | bb_error_msg_and_die("Line too long"); | 51 | bb_error_msg_and_die("Line too long"); |
52 | } | 52 | } |
53 | 53 | ||
54 | line_ptr++; | 54 | line_ptr++; |
55 | /* Tolerate an overly long line to acomadate a possible exta '`' */ | 55 | /* Tolerate an overly long line to acomadate a possible exta '`' */ |
56 | if (strlen(line_ptr) < length) { | 56 | if (strlen(line_ptr) < length) { |
diff --git a/coreutils/wc.c b/coreutils/wc.c index 779901524..0eb795c4b 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -26,7 +26,7 @@ | |||
26 | /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) | 26 | /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) |
27 | * | 27 | * |
28 | * Rewritten to fix a number of problems and do some size optimizations. | 28 | * Rewritten to fix a number of problems and do some size optimizations. |
29 | * Problems in the previous busybox implementation (besides bloat) included: | 29 | * Problems in the previous busybox implementation (besides bloat) included: |
30 | * 1) broken 'wc -c' optimization (read note below) | 30 | * 1) broken 'wc -c' optimization (read note below) |
31 | * 2) broken handling of '-' args | 31 | * 2) broken handling of '-' args |
32 | * 3) no checking of ferror on EOF returns | 32 | * 3) no checking of ferror on EOF returns |
@@ -110,33 +110,33 @@ int wc_main(int argc, char **argv) | |||
110 | char status = EXIT_SUCCESS; | 110 | char status = EXIT_SUCCESS; |
111 | char in_word; | 111 | char in_word; |
112 | char print_type; | 112 | char print_type; |
113 | 113 | ||
114 | print_type = bb_getopt_ulflags(argc, argv, wc_opts); | 114 | print_type = bb_getopt_ulflags(argc, argv, wc_opts); |
115 | 115 | ||
116 | if (print_type == 0) { | 116 | if (print_type == 0) { |
117 | print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); | 117 | print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); |
118 | } | 118 | } |
119 | 119 | ||
120 | argv += optind; | 120 | argv += optind; |
121 | if (!*argv) { | 121 | if (!*argv) { |
122 | *--argv = (char *) bb_msg_standard_input; | 122 | *--argv = (char *) bb_msg_standard_input; |
123 | } | 123 | } |
124 | 124 | ||
125 | memset(totals, 0, sizeof(totals)); | 125 | memset(totals, 0, sizeof(totals)); |
126 | 126 | ||
127 | pcounts = counts; | 127 | pcounts = counts; |
128 | 128 | ||
129 | do { | 129 | do { |
130 | ++num_files; | 130 | ++num_files; |
131 | if (!(fp = bb_wfopen_input(*argv))) { | 131 | if (!(fp = bb_wfopen_input(*argv))) { |
132 | status = EXIT_FAILURE; | 132 | status = EXIT_FAILURE; |
133 | continue; | 133 | continue; |
134 | } | 134 | } |
135 | 135 | ||
136 | memset(counts, 0, sizeof(counts)); | 136 | memset(counts, 0, sizeof(counts)); |
137 | linepos = 0; | 137 | linepos = 0; |
138 | in_word = 0; | 138 | in_word = 0; |
139 | 139 | ||
140 | do { | 140 | do { |
141 | ++counts[WC_CHARS]; | 141 | ++counts[WC_CHARS]; |
142 | c = getc(fp); | 142 | c = getc(fp); |
@@ -177,21 +177,21 @@ int wc_main(int argc, char **argv) | |||
177 | } else { | 177 | } else { |
178 | continue; | 178 | continue; |
179 | } | 179 | } |
180 | 180 | ||
181 | counts[WC_WORDS] += in_word; | 181 | counts[WC_WORDS] += in_word; |
182 | in_word = 0; | 182 | in_word = 0; |
183 | if (c == EOF) { | 183 | if (c == EOF) { |
184 | break; | 184 | break; |
185 | } | 185 | } |
186 | } while (1); | 186 | } while (1); |
187 | 187 | ||
188 | if (totals[WC_LENGTH] < counts[WC_LENGTH]) { | 188 | if (totals[WC_LENGTH] < counts[WC_LENGTH]) { |
189 | totals[WC_LENGTH] = counts[WC_LENGTH]; | 189 | totals[WC_LENGTH] = counts[WC_LENGTH]; |
190 | } | 190 | } |
191 | totals[WC_LENGTH] -= counts[WC_LENGTH]; | 191 | totals[WC_LENGTH] -= counts[WC_LENGTH]; |
192 | 192 | ||
193 | bb_fclose_nonstdin(fp); | 193 | bb_fclose_nonstdin(fp); |
194 | 194 | ||
195 | OUTPUT: | 195 | OUTPUT: |
196 | s = fmt_str + 1; /* Skip the leading space on 1st pass. */ | 196 | s = fmt_str + 1; /* Skip the leading space on 1st pass. */ |
197 | u = 0; | 197 | u = 0; |
@@ -202,16 +202,16 @@ int wc_main(int argc, char **argv) | |||
202 | } | 202 | } |
203 | totals[u] += pcounts[u]; | 203 | totals[u] += pcounts[u]; |
204 | } while (++u < 4); | 204 | } while (++u < 4); |
205 | 205 | ||
206 | s += 8; /* Set the format to the empty string. */ | 206 | s += 8; /* Set the format to the empty string. */ |
207 | 207 | ||
208 | if (*argv != bb_msg_standard_input) { | 208 | if (*argv != bb_msg_standard_input) { |
209 | s -= 3; /* We have a name, so do %s conversion. */ | 209 | s -= 3; /* We have a name, so do %s conversion. */ |
210 | } | 210 | } |
211 | bb_printf(s, *argv); | 211 | bb_printf(s, *argv); |
212 | 212 | ||
213 | } while (*++argv); | 213 | } while (*++argv); |
214 | 214 | ||
215 | /* If more than one file was processed, we want the totals. To save some | 215 | /* If more than one file was processed, we want the totals. To save some |
216 | * space, we set the pcounts ptr to the totals array. This has the side | 216 | * space, we set the pcounts ptr to the totals array. This has the side |
217 | * effect of trashing the totals array after outputting it, but that's | 217 | * effect of trashing the totals array after outputting it, but that's |
@@ -222,6 +222,6 @@ int wc_main(int argc, char **argv) | |||
222 | pcounts = totals; | 222 | pcounts = totals; |
223 | goto OUTPUT; | 223 | goto OUTPUT; |
224 | } | 224 | } |
225 | 225 | ||
226 | bb_fflush_stdout_and_exit(status); | 226 | bb_fflush_stdout_and_exit(status); |
227 | } | 227 | } |
diff --git a/coreutils/who.c b/coreutils/who.c index 1bf552056..9561db132 100644 --- a/coreutils/who.c +++ b/coreutils/who.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /*---------------------------------------------------------------------- | 2 | /*---------------------------------------------------------------------- |
3 | * Mini who is used to display user name, login time, | 3 | * Mini who is used to display user name, login time, |
4 | * idle time and host name. | 4 | * idle time and host name. |
5 | * | 5 | * |
6 | * Author: Da Chen <dchen@ayrnetworks.com> | 6 | * Author: Da Chen <dchen@ayrnetworks.com> |
@@ -10,7 +10,7 @@ | |||
10 | * as published by the Free Software Foundation: | 10 | * as published by the Free Software Foundation: |
11 | * http://www.gnu.org/copyleft/gpl.html | 11 | * http://www.gnu.org/copyleft/gpl.html |
12 | * | 12 | * |
13 | * Copyright (c) 2002 AYR Networks, Inc. | 13 | * Copyright (c) 2002 AYR Networks, Inc. |
14 | *---------------------------------------------------------------------- | 14 | *---------------------------------------------------------------------- |
15 | */ | 15 | */ |
16 | 16 | ||
@@ -30,21 +30,21 @@ extern int who_main(int argc, char **argv) | |||
30 | struct utmp *ut; | 30 | struct utmp *ut; |
31 | struct stat st; | 31 | struct stat st; |
32 | int devlen, len; | 32 | int devlen, len; |
33 | time_t now, idle; | 33 | time_t now, idle; |
34 | 34 | ||
35 | if (argc > 1) | 35 | if (argc > 1) |
36 | bb_show_usage(); | 36 | bb_show_usage(); |
37 | 37 | ||
38 | setutent(); | 38 | setutent(); |
39 | devlen = sizeof("/dev/") - 1; | 39 | devlen = sizeof("/dev/") - 1; |
40 | printf("USER TTY IDLE FROM HOST\n"); | 40 | printf("USER TTY IDLE FROM HOST\n"); |
41 | 41 | ||
42 | while ((ut = getutent()) != NULL) { | 42 | while ((ut = getutent()) != NULL) { |
43 | char name[40]; | 43 | char name[40]; |
44 | 44 | ||
45 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { | 45 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { |
46 | len = strlen(ut->ut_line); | 46 | len = strlen(ut->ut_line); |
47 | if (ut->ut_line[0] == '/') { | 47 | if (ut->ut_line[0] == '/') { |
48 | strncpy(name, ut->ut_line, len); | 48 | strncpy(name, ut->ut_line, len); |
49 | name[len] = '\0'; | 49 | name[len] = '\0'; |
50 | strcpy(ut->ut_line, ut->ut_line + devlen); | 50 | strcpy(ut->ut_line, ut->ut_line + devlen); |
@@ -53,27 +53,27 @@ extern int who_main(int argc, char **argv) | |||
53 | strncpy(name+devlen, ut->ut_line, len); | 53 | strncpy(name+devlen, ut->ut_line, len); |
54 | name[devlen+len] = '\0'; | 54 | name[devlen+len] = '\0'; |
55 | } | 55 | } |
56 | 56 | ||
57 | printf("%-10s %-8s ", ut->ut_user, ut->ut_line); | 57 | printf("%-10s %-8s ", ut->ut_user, ut->ut_line); |
58 | 58 | ||
59 | if (stat(name, &st) == 0) { | 59 | if (stat(name, &st) == 0) { |
60 | now = time(NULL); | 60 | now = time(NULL); |
61 | idle = now - st.st_atime; | 61 | idle = now - st.st_atime; |
62 | 62 | ||
63 | if (idle < 60) | 63 | if (idle < 60) |
64 | printf("00:00m "); | 64 | printf("00:00m "); |
65 | else if (idle < (60 * 60)) | 65 | else if (idle < (60 * 60)) |
66 | printf("00:%02dm ", (int)(idle / 60)); | 66 | printf("00:%02dm ", (int)(idle / 60)); |
67 | else if (idle < (24 * 60 * 60)) | 67 | else if (idle < (24 * 60 * 60)) |
68 | printf("%02d:%02dm ", (int)(idle / (60 * 60)), | 68 | printf("%02d:%02dm ", (int)(idle / (60 * 60)), |
69 | (int)(idle % (60 * 60)) / 60); | 69 | (int)(idle % (60 * 60)) / 60); |
70 | else if (idle < (24 * 60 * 60 * 365)) | 70 | else if (idle < (24 * 60 * 60 * 365)) |
71 | printf("%03ddays ", (int)(idle / (24 * 60 * 60))); | 71 | printf("%03ddays ", (int)(idle / (24 * 60 * 60))); |
72 | else | 72 | else |
73 | printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); | 73 | printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); |
74 | } else | 74 | } else |
75 | printf("%-8s ", "?"); | 75 | printf("%-8s ", "?"); |
76 | 76 | ||
77 | printf("%-12.12s %s\n", ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); | 77 | printf("%-12.12s %s\n", ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); |
78 | } | 78 | } |
79 | } | 79 | } |