cmp: ifdefectomy

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Rob Landley 2010-04-26 14:01:14 +02:00 committed by Denys Vlasenko
parent 4640ccc399
commit 0c1ba443c8

View File

@ -37,8 +37,7 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
{ {
FILE *fp1, *fp2, *outfile = stdout; FILE *fp1, *fp2, *outfile = stdout;
const char *filename1, *filename2 = "-"; const char *filename1, *filename2 = "-";
IF_DESKTOP(off_t skip1 = 0, skip2 = 0;) off_t skip1 = 0, skip2 = 0, char_pos = 0;
off_t char_pos = 0;
int line_pos = 1; /* Hopefully won't overflow... */ int line_pos = 1; /* Hopefully won't overflow... */
const char *fmt; const char *fmt;
int c1, c2; int c1, c2;
@ -59,14 +58,12 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
if (*++argv) { if (*++argv) {
filename2 = *argv; filename2 = *argv;
#if ENABLE_DESKTOP if (ENABLE_DESKTOP && *++argv) {
if (*++argv) {
skip1 = XATOOFF(*argv); skip1 = XATOOFF(*argv);
if (*++argv) { if (*++argv) {
skip2 = XATOOFF(*argv); skip2 = XATOOFF(*argv);
} }
} }
#endif
} }
fp2 = xfopen_stdin(filename2); fp2 = xfopen_stdin(filename2);
@ -83,10 +80,10 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
else else
fmt = fmt_differ; fmt = fmt_differ;
#if ENABLE_DESKTOP if (ENABLE_DESKTOP) {
while (skip1) { getc(fp1); skip1--; } while (skip1) { getc(fp1); skip1--; }
while (skip2) { getc(fp2); skip2--; } while (skip2) { getc(fp2); skip2--; }
#endif }
do { do {
c1 = getc(fp1); c1 = getc(fp1);
c2 = getc(fp2); c2 = getc(fp2);