sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit d756dca999e856ce1d71d3ecd5ef15bf7f32b9f5
parent 79e45395e5fc8a2933df1fd3dccb570df6890929
Author: FRIGN <dev@frign.de>
Date:   Sat,  7 Feb 2015 21:13:54 +0100

Reuse 'n' in cmp(1)

Factors out one more local variable.

Diffstat:
Mcmp.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

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