aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-03-23 17:08:21 +0000
committerEric Andersen <andersen@codepoet.org>2001-03-23 17:08:21 +0000
commitf6aa13d403085b1645b65caae4517a338f4636e6 (patch)
treef4c9ca939b621dfd1efcd227f0fe83813fa088a9
parent82ab8da24595fced332faf947cc63497216b09db (diff)
downloadbusybox-w32-f6aa13d403085b1645b65caae4517a338f4636e6.tar.gz
busybox-w32-f6aa13d403085b1645b65caae4517a338f4636e6.tar.bz2
busybox-w32-f6aa13d403085b1645b65caae4517a338f4636e6.zip
-Wshadow tr fix from Jeff Garzik
-rw-r--r--coreutils/tr.c18
-rw-r--r--sysklogd/syslogd.c10
-rw-r--r--syslogd.c10
-rw-r--r--tr.c18
4 files changed, 28 insertions, 28 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index ddb73873d..32a4f2917 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -142,7 +142,7 @@ extern int tr_main(int argc, char **argv)
142{ 142{
143 register unsigned char *ptr; 143 register unsigned char *ptr;
144 int output_length=0, input_length; 144 int output_length=0, input_length;
145 int index = 1; 145 int idx = 1;
146 int i; 146 int i;
147 RESERVE_BB_BUFFER(output, BUFSIZ); 147 RESERVE_BB_BUFFER(output, BUFSIZ);
148 RESERVE_BB_BUFFER(input, BUFSIZ); 148 RESERVE_BB_BUFFER(input, BUFSIZ);
@@ -157,8 +157,8 @@ extern int tr_main(int argc, char **argv)
157 pinvec = invec; 157 pinvec = invec;
158 poutvec = outvec; 158 poutvec = outvec;
159 159
160 if (argc > 1 && argv[index][0] == '-') { 160 if (argc > 1 && argv[idx][0] == '-') {
161 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) { 161 for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) {
162 switch (*ptr) { 162 switch (*ptr) {
163 case 'c': 163 case 'c':
164 com_fl = TRUE; 164 com_fl = TRUE;
@@ -173,21 +173,21 @@ extern int tr_main(int argc, char **argv)
173 show_usage(); 173 show_usage();
174 } 174 }
175 } 175 }
176 index++; 176 idx++;
177 } 177 }
178 for (i = 0; i <= ASCII; i++) { 178 for (i = 0; i <= ASCII; i++) {
179 vector[i] = i; 179 vector[i] = i;
180 invec[i] = outvec[i] = FALSE; 180 invec[i] = outvec[i] = FALSE;
181 } 181 }
182 182
183 if (argv[index] != NULL) { 183 if (argv[idx] != NULL) {
184 input_length = expand(argv[index++], input); 184 input_length = expand(argv[idx++], input);
185 if (com_fl) 185 if (com_fl)
186 input_length = complement(input, input_length); 186 input_length = complement(input, input_length);
187 if (argv[index] != NULL) { 187 if (argv[idx] != NULL) {
188 if (*argv[index] == '\0') 188 if (*argv[idx] == '\0')
189 error_msg_and_die("STRING2 cannot be empty"); 189 error_msg_and_die("STRING2 cannot be empty");
190 output_length = expand(argv[index], output); 190 output_length = expand(argv[idx], output);
191 map(input, input_length, output, output_length); 191 map(input, input_length, output, output_length);
192 } 192 }
193 for (i = 0; i < input_length; i++) 193 for (i = 0; i < input_length; i++)
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 52642e302..e5ddd3b82 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -55,7 +55,7 @@
55#define __LOG_FILE "/var/log/messages" 55#define __LOG_FILE "/var/log/messages"
56 56
57/* Path to the unix socket */ 57/* Path to the unix socket */
58char lfile[BUFSIZ] = ""; 58static char lfile[BUFSIZ] = "";
59 59
60static char *logFilePath = __LOG_FILE; 60static char *logFilePath = __LOG_FILE;
61 61
@@ -390,18 +390,18 @@ static void domark(int sig)
390static const int BUFSIZE = 1023; 390static const int BUFSIZE = 1023;
391static int serveConnection (int conn) 391static int serveConnection (int conn)
392{ 392{
393 RESERVE_BB_BUFFER(buf, BUFSIZE + 1); 393 RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
394 int n_read; 394 int n_read;
395 395
396 while ((n_read = read (conn, buf, BUFSIZE )) > 0) { 396 while ((n_read = read (conn, tmpbuf, BUFSIZE )) > 0) {
397 397
398 int pri = (LOG_USER | LOG_NOTICE); 398 int pri = (LOG_USER | LOG_NOTICE);
399 char line[ BUFSIZE + 1 ]; 399 char line[ BUFSIZE + 1 ];
400 unsigned char c; 400 unsigned char c;
401 401
402 char *p = buf, *q = line; 402 char *p = tmpbuf, *q = line;
403 403
404 buf[ n_read - 1 ] = '\0'; 404 tmpbuf[ n_read - 1 ] = '\0';
405 405
406 while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) { 406 while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) {
407 if (c == '<') { 407 if (c == '<') {
diff --git a/syslogd.c b/syslogd.c
index 52642e302..e5ddd3b82 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -55,7 +55,7 @@
55#define __LOG_FILE "/var/log/messages" 55#define __LOG_FILE "/var/log/messages"
56 56
57/* Path to the unix socket */ 57/* Path to the unix socket */
58char lfile[BUFSIZ] = ""; 58static char lfile[BUFSIZ] = "";
59 59
60static char *logFilePath = __LOG_FILE; 60static char *logFilePath = __LOG_FILE;
61 61
@@ -390,18 +390,18 @@ static void domark(int sig)
390static const int BUFSIZE = 1023; 390static const int BUFSIZE = 1023;
391static int serveConnection (int conn) 391static int serveConnection (int conn)
392{ 392{
393 RESERVE_BB_BUFFER(buf, BUFSIZE + 1); 393 RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
394 int n_read; 394 int n_read;
395 395
396 while ((n_read = read (conn, buf, BUFSIZE )) > 0) { 396 while ((n_read = read (conn, tmpbuf, BUFSIZE )) > 0) {
397 397
398 int pri = (LOG_USER | LOG_NOTICE); 398 int pri = (LOG_USER | LOG_NOTICE);
399 char line[ BUFSIZE + 1 ]; 399 char line[ BUFSIZE + 1 ];
400 unsigned char c; 400 unsigned char c;
401 401
402 char *p = buf, *q = line; 402 char *p = tmpbuf, *q = line;
403 403
404 buf[ n_read - 1 ] = '\0'; 404 tmpbuf[ n_read - 1 ] = '\0';
405 405
406 while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) { 406 while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) {
407 if (c == '<') { 407 if (c == '<') {
diff --git a/tr.c b/tr.c
index ddb73873d..32a4f2917 100644
--- a/tr.c
+++ b/tr.c
@@ -142,7 +142,7 @@ extern int tr_main(int argc, char **argv)
142{ 142{
143 register unsigned char *ptr; 143 register unsigned char *ptr;
144 int output_length=0, input_length; 144 int output_length=0, input_length;
145 int index = 1; 145 int idx = 1;
146 int i; 146 int i;
147 RESERVE_BB_BUFFER(output, BUFSIZ); 147 RESERVE_BB_BUFFER(output, BUFSIZ);
148 RESERVE_BB_BUFFER(input, BUFSIZ); 148 RESERVE_BB_BUFFER(input, BUFSIZ);
@@ -157,8 +157,8 @@ extern int tr_main(int argc, char **argv)
157 pinvec = invec; 157 pinvec = invec;
158 poutvec = outvec; 158 poutvec = outvec;
159 159
160 if (argc > 1 && argv[index][0] == '-') { 160 if (argc > 1 && argv[idx][0] == '-') {
161 for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) { 161 for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) {
162 switch (*ptr) { 162 switch (*ptr) {
163 case 'c': 163 case 'c':
164 com_fl = TRUE; 164 com_fl = TRUE;
@@ -173,21 +173,21 @@ extern int tr_main(int argc, char **argv)
173 show_usage(); 173 show_usage();
174 } 174 }
175 } 175 }
176 index++; 176 idx++;
177 } 177 }
178 for (i = 0; i <= ASCII; i++) { 178 for (i = 0; i <= ASCII; i++) {
179 vector[i] = i; 179 vector[i] = i;
180 invec[i] = outvec[i] = FALSE; 180 invec[i] = outvec[i] = FALSE;
181 } 181 }
182 182
183 if (argv[index] != NULL) { 183 if (argv[idx] != NULL) {
184 input_length = expand(argv[index++], input); 184 input_length = expand(argv[idx++], input);
185 if (com_fl) 185 if (com_fl)
186 input_length = complement(input, input_length); 186 input_length = complement(input, input_length);
187 if (argv[index] != NULL) { 187 if (argv[idx] != NULL) {
188 if (*argv[index] == '\0') 188 if (*argv[idx] == '\0')
189 error_msg_and_die("STRING2 cannot be empty"); 189 error_msg_and_die("STRING2 cannot be empty");
190 output_length = expand(argv[index], output); 190 output_length = expand(argv[idx], output);
191 map(input, input_length, output, output_length); 191 map(input, input_length, output, output_length);
192 } 192 }
193 for (i = 0; i < input_length; i++) 193 for (i = 0; i < input_length; i++)