Reuse 'n' in cmp(1)

Factors out one more local variable.
This commit is contained in:
FRIGN 2015-02-07 21:13:54 +01:00
parent 79e45395e5
commit d756dca999

14
cmp.c
View File

@ -18,7 +18,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
FILE *fp[2]; FILE *fp[2];
size_t i, line = 1, n = 1; size_t line = 1, n;
int lflag = 0, sflag = 0, same = 1, b[2]; int lflag = 0, sflag = 0, same = 1, b[2];
ARGBEGIN { ARGBEGIN {
@ -38,13 +38,13 @@ main(int argc, char *argv[])
if (!strcmp(argv[0], argv[1])) if (!strcmp(argv[0], argv[1]))
return Same; return Same;
for (i = 0; i < 2; i++) { for (n = 0; n < 2; n++) {
if (argv[i][0] == '-' && !argv[i][1]) if (argv[n][0] == '-' && !argv[n][1])
argv[i] = "/dev/fd/0"; argv[n] = "/dev/fd/0";
fp[i] = fopen(argv[i], "r"); fp[n] = fopen(argv[n], "r");
if (!fp[i]) { if (!fp[n]) {
if (!sflag) if (!sflag)
weprintf("fopen %s:", argv[i]); weprintf("fopen %s:", argv[n]);
exit(Error); exit(Error);
} }
} }