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-f6aa13d403085b1645b65caae4517a338f4636e6.tar.gz
-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)
{
register unsigned char *ptr;
int output_length=0, input_length;
- int index = 1;
+ int idx = 1;
int i;
RESERVE_BB_BUFFER(output, BUFSIZ);
RESERVE_BB_BUFFER(input, BUFSIZ);
@@ -157,8 +157,8 @@ extern int tr_main(int argc, char **argv)
pinvec = invec;
poutvec = outvec;
- if (argc > 1 && argv[index][0] == '-') {
- for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {
+ if (argc > 1 && argv[idx][0] == '-') {
+ for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) {
switch (*ptr) {
case 'c':
com_fl = TRUE;
@@ -173,21 +173,21 @@ extern int tr_main(int argc, char **argv)
show_usage();
}
}
- index++;
+ idx++;
}
for (i = 0; i <= ASCII; i++) {
vector[i] = i;
invec[i] = outvec[i] = FALSE;
}
- if (argv[index] != NULL) {
- input_length = expand(argv[index++], input);
+ if (argv[idx] != NULL) {
+ input_length = expand(argv[idx++], input);
if (com_fl)
input_length = complement(input, input_length);
- if (argv[index] != NULL) {
- if (*argv[index] == '\0')
+ if (argv[idx] != NULL) {
+ if (*argv[idx] == '\0')
error_msg_and_die("STRING2 cannot be empty");
- output_length = expand(argv[index], output);
+ output_length = expand(argv[idx], output);
map(input, input_length, output, output_length);
}
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 @@
#define __LOG_FILE "/var/log/messages"
/* Path to the unix socket */
-char lfile[BUFSIZ] = "";
+static char lfile[BUFSIZ] = "";
static char *logFilePath = __LOG_FILE;
@@ -390,18 +390,18 @@ static void domark(int sig)
static const int BUFSIZE = 1023;
static int serveConnection (int conn)
{
- RESERVE_BB_BUFFER(buf, BUFSIZE + 1);
+ RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
int n_read;
- while ((n_read = read (conn, buf, BUFSIZE )) > 0) {
+ while ((n_read = read (conn, tmpbuf, BUFSIZE )) > 0) {
int pri = (LOG_USER | LOG_NOTICE);
char line[ BUFSIZE + 1 ];
unsigned char c;
- char *p = buf, *q = line;
+ char *p = tmpbuf, *q = line;
- buf[ n_read - 1 ] = '\0';
+ tmpbuf[ n_read - 1 ] = '\0';
while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) {
if (c == '<') {
diff --git a/syslogd.c b/syslogd.c
index 52642e302..e5ddd3b82 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -55,7 +55,7 @@
#define __LOG_FILE "/var/log/messages"
/* Path to the unix socket */
-char lfile[BUFSIZ] = "";
+static char lfile[BUFSIZ] = "";
static char *logFilePath = __LOG_FILE;
@@ -390,18 +390,18 @@ static void domark(int sig)
static const int BUFSIZE = 1023;
static int serveConnection (int conn)
{
- RESERVE_BB_BUFFER(buf, BUFSIZE + 1);
+ RESERVE_BB_BUFFER(tmpbuf, BUFSIZE + 1);
int n_read;
- while ((n_read = read (conn, buf, BUFSIZE )) > 0) {
+ while ((n_read = read (conn, tmpbuf, BUFSIZE )) > 0) {
int pri = (LOG_USER | LOG_NOTICE);
char line[ BUFSIZE + 1 ];
unsigned char c;
- char *p = buf, *q = line;
+ char *p = tmpbuf, *q = line;
- buf[ n_read - 1 ] = '\0';
+ tmpbuf[ n_read - 1 ] = '\0';
while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) {
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)
{
register unsigned char *ptr;
int output_length=0, input_length;
- int index = 1;
+ int idx = 1;
int i;
RESERVE_BB_BUFFER(output, BUFSIZ);
RESERVE_BB_BUFFER(input, BUFSIZ);
@@ -157,8 +157,8 @@ extern int tr_main(int argc, char **argv)
pinvec = invec;
poutvec = outvec;
- if (argc > 1 && argv[index][0] == '-') {
- for (ptr = (unsigned char *) &argv[index][1]; *ptr; ptr++) {
+ if (argc > 1 && argv[idx][0] == '-') {
+ for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) {
switch (*ptr) {
case 'c':
com_fl = TRUE;
@@ -173,21 +173,21 @@ extern int tr_main(int argc, char **argv)
show_usage();
}
}
- index++;
+ idx++;
}
for (i = 0; i <= ASCII; i++) {
vector[i] = i;
invec[i] = outvec[i] = FALSE;
}
- if (argv[index] != NULL) {
- input_length = expand(argv[index++], input);
+ if (argv[idx] != NULL) {
+ input_length = expand(argv[idx++], input);
if (com_fl)
input_length = complement(input, input_length);
- if (argv[index] != NULL) {
- if (*argv[index] == '\0')
+ if (argv[idx] != NULL) {
+ if (*argv[idx] == '\0')
error_msg_and_die("STRING2 cannot be empty");
- output_length = expand(argv[index], output);
+ output_length = expand(argv[idx], output);
map(input, input_length, output, output_length);
}
for (i = 0; i < input_length; i++)