A nice patch from Larry Doolittle that adds -Wshadow and
cleans up most of the now-revealed problems.
This commit is contained in:
@@ -45,7 +45,7 @@ static const struct suffix_mult dd_suffixes[] = {
|
||||
|
||||
int dd_main(int argc, char **argv)
|
||||
{
|
||||
int i, ifd, ofd, oflag, sync = FALSE, trunc = TRUE;
|
||||
int i, ifd, ofd, oflag, sync_flag = FALSE, trunc = TRUE;
|
||||
size_t in_full = 0, in_part = 0, out_full = 0, out_part = 0;
|
||||
size_t bs = 512, count = -1;
|
||||
ssize_t n;
|
||||
@@ -73,7 +73,7 @@ int dd_main(int argc, char **argv)
|
||||
trunc = FALSE;
|
||||
buf += 7;
|
||||
} else if (strncmp("sync", buf, 4) == 0) {
|
||||
sync = TRUE;
|
||||
sync_flag = TRUE;
|
||||
buf += 4;
|
||||
} else {
|
||||
error_msg_and_die("invalid conversion `%s'", argv[i]+5);
|
||||
@@ -138,7 +138,7 @@ int dd_main(int argc, char **argv)
|
||||
in_full++;
|
||||
else
|
||||
in_part++;
|
||||
if (sync) {
|
||||
if (sync_flag) {
|
||||
memset(buf + n, '\0', bs - n);
|
||||
n = bs;
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ echo_main(int argc, char** argv)
|
||||
while (argc > 0 && *argv[0] == '-')
|
||||
{
|
||||
register char *temp;
|
||||
register int index;
|
||||
register int ix;
|
||||
|
||||
/*
|
||||
* If it appears that we are handling options, then make sure
|
||||
@@ -49,9 +49,9 @@ echo_main(int argc, char** argv)
|
||||
*/
|
||||
temp = argv[0] + 1;
|
||||
|
||||
for (index = 0; temp[index]; index++)
|
||||
for (ix = 0; temp[ix]; ix++)
|
||||
{
|
||||
if (strrchr("neE", temp[index]) == 0)
|
||||
if (strrchr("neE", temp[ix]) == 0)
|
||||
goto just_echo;
|
||||
}
|
||||
|
||||
|
@@ -123,19 +123,19 @@ static unsigned int expand(char *arg, register unsigned char *buffer)
|
||||
|
||||
static int complement(unsigned char *buffer, int buffer_len)
|
||||
{
|
||||
register short i, j, index;
|
||||
register short i, j, ix;
|
||||
char conv[ASCII + 2];
|
||||
|
||||
index = 0;
|
||||
ix = 0;
|
||||
for (i = 0; i <= ASCII; i++) {
|
||||
for (j = 0; j < buffer_len; j++)
|
||||
if (buffer[j] == i)
|
||||
break;
|
||||
if (j == buffer_len)
|
||||
conv[index++] = i & ASCII;
|
||||
conv[ix++] = i & ASCII;
|
||||
}
|
||||
memcpy(buffer, conv, index);
|
||||
return index;
|
||||
memcpy(buffer, conv, ix);
|
||||
return ix;
|
||||
}
|
||||
|
||||
extern int tr_main(int argc, char **argv)
|
||||
|
Reference in New Issue
Block a user