|
Packit |
992a25 |
/***********************************************************************
|
|
Packit |
992a25 |
* *
|
|
Packit |
992a25 |
* This software is part of the ast package *
|
|
Packit |
992a25 |
* Copyright (c) 1992-2012 AT&T Intellectual Property *
|
|
Packit |
992a25 |
* and is licensed under the *
|
|
Packit |
992a25 |
* Eclipse Public License, Version 1.0 *
|
|
Packit |
992a25 |
* by AT&T Intellectual Property *
|
|
Packit |
992a25 |
* *
|
|
Packit |
992a25 |
* A copy of the License is available at *
|
|
Packit |
992a25 |
* http://www.eclipse.org/org/documents/epl-v10.html *
|
|
Packit |
992a25 |
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
|
|
Packit |
992a25 |
* *
|
|
Packit |
992a25 |
* Information and Software Systems Research *
|
|
Packit |
992a25 |
* AT&T Research *
|
|
Packit |
992a25 |
* Florham Park NJ *
|
|
Packit |
992a25 |
* *
|
|
Packit |
992a25 |
* Glenn Fowler <gsf@research.att.com> *
|
|
Packit |
992a25 |
* David Korn <dgk@research.att.com> *
|
|
Packit |
992a25 |
* *
|
|
Packit |
992a25 |
***********************************************************************/
|
|
Packit |
992a25 |
#pragma prototyped
|
|
Packit |
992a25 |
/*
|
|
Packit |
992a25 |
* David Korn
|
|
Packit |
992a25 |
* Glenn Fowler
|
|
Packit |
992a25 |
* AT&T Bell Laboratories
|
|
Packit |
992a25 |
*
|
|
Packit |
992a25 |
* cmp
|
|
Packit |
992a25 |
*/
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
static const char usage[] =
|
|
Packit |
992a25 |
"[-?\n@(#)$Id: cmp (AT&T Research) 2010-04-11 $\n]"
|
|
Packit |
992a25 |
USAGE_LICENSE
|
|
Packit |
992a25 |
"[+NAME?cmp - compare two files]"
|
|
Packit |
992a25 |
"[+DESCRIPTION?\bcmp\b compares two files \afile1\a and \afile2\a. "
|
|
Packit |
992a25 |
"\bcmp\b writes no output if the files are the same. By default, if the "
|
|
Packit |
992a25 |
"files differ, the byte and line number at which the first difference "
|
|
Packit |
992a25 |
"occurred are written to standard output. Bytes and lines are numbered "
|
|
Packit |
992a25 |
"beginning with 1.]"
|
|
Packit |
992a25 |
"[+?If \askip1\a or \askip2\a are specified, or the \b-i\b option is "
|
|
Packit |
992a25 |
"specified, initial bytes of the corresponding file are skipped before "
|
|
Packit |
992a25 |
"beginning the compare. The skip values are in bytes or can have a "
|
|
Packit |
992a25 |
"suffix of \bk\b for kilobytes or \bm\b for megabytes.]"
|
|
Packit |
992a25 |
"[+?If either \afile1\a or \afiles2\a is \b-\b, \bcmp\b uses standard "
|
|
Packit |
992a25 |
"input starting at the current location.]"
|
|
Packit |
992a25 |
"[b:print-bytes?Print differing bytes as 3 digit octal values.]"
|
|
Packit |
992a25 |
"[c:print-chars?Print differing bytes as follows: non-space printable "
|
|
Packit |
992a25 |
"characters as themselves; space and control characters as \b^\b "
|
|
Packit |
992a25 |
"followed by a letter of the alphabet; and characters with the high bit "
|
|
Packit |
992a25 |
"set as the lower 7 bit character prefixed by \bM^\b for 7 bit space and "
|
|
Packit |
992a25 |
"non-printable characters and \bM-\b for all other characters. If the 7 "
|
|
Packit |
992a25 |
"bit character encoding is not ASCII then the characters are converted "
|
|
Packit |
992a25 |
"to ASCII to determine \ahigh bit set\a, and if set it is cleared and "
|
|
Packit |
992a25 |
"converted back to the native encoding. Multibyte characters in the "
|
|
Packit |
992a25 |
"current locale are treated as printable characters.]"
|
|
Packit |
992a25 |
"[d:differences?Print at most \adifferences\a differences using "
|
|
Packit |
992a25 |
"\b--verbose\b output format. \b--differences=0\b is equivalent to "
|
|
Packit |
992a25 |
"\b--silent\b.]#[differences]"
|
|
Packit |
992a25 |
"[i:ignore-initial|skip?Skip the the first \askip1\a bytes in \afile1\a "
|
|
Packit |
992a25 |
"and the first \askip2\a bytes in \afile2\a. If \askip2\a is omitted "
|
|
Packit |
992a25 |
"then \askip1\a is used.]:[skip1[::skip2]]:=0::0]"
|
|
Packit |
992a25 |
"[l:verbose?Write the decimal byte number and the differing bytes (in "
|
|
Packit |
992a25 |
"octal) for each difference.]"
|
|
Packit |
992a25 |
"[n:count|bytes?Compare at most \acount\a bytes.]#[count]"
|
|
Packit |
992a25 |
"[s:quiet|silent?Write nothing for differing files; return non-zero exit "
|
|
Packit |
992a25 |
"status only.]"
|
|
Packit |
992a25 |
"\n"
|
|
Packit |
992a25 |
"\nfile1 file2 [skip1 [skip2]]\n"
|
|
Packit |
992a25 |
"\n"
|
|
Packit |
992a25 |
"[+EXIT STATUS?]"
|
|
Packit |
992a25 |
"{"
|
|
Packit |
992a25 |
"[+0?The files or portions compared are identical.]"
|
|
Packit |
992a25 |
"[+1?The files are different.]"
|
|
Packit |
992a25 |
"[+>1?An error occurred.]"
|
|
Packit |
992a25 |
"}"
|
|
Packit |
992a25 |
"[+SEE ALSO?\bcomm\b(1), \bdiff\b(1), \bcat\b(1)]"
|
|
Packit |
992a25 |
;
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
#include <cmd.h>
|
|
Packit |
992a25 |
#include <ls.h>
|
|
Packit |
992a25 |
#include <ctype.h>
|
|
Packit |
992a25 |
#include <ccode.h>
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
#define CMP_VERBOSE 0x01
|
|
Packit |
992a25 |
#define CMP_SILENT 0x02
|
|
Packit |
992a25 |
#define CMP_CHARS 0x04
|
|
Packit |
992a25 |
#define CMP_BYTES 0x08
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
static void
|
|
Packit |
992a25 |
pretty(Sfio_t *out, int o, int delim, int flags)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
int c;
|
|
Packit |
992a25 |
int m;
|
|
Packit |
992a25 |
char* s;
|
|
Packit |
992a25 |
char buf[10];
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
s = buf;
|
|
Packit |
992a25 |
if ((flags & CMP_BYTES) || !(flags & CMP_CHARS))
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
*s++ = ' ';
|
|
Packit |
992a25 |
if ((flags & CMP_CHARS) && delim != -1)
|
|
Packit |
992a25 |
*s++ = ' ';
|
|
Packit |
992a25 |
*s++ = '0' + ((o >> 6) & 07);
|
|
Packit |
992a25 |
*s++ = '0' + ((o >> 3) & 07);
|
|
Packit |
992a25 |
*s++ = '0' + (o & 07);
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (flags & CMP_CHARS)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
*s++ = ' ';
|
|
Packit |
992a25 |
c = ccmapc(o, CC_NATIVE, CC_ASCII);
|
|
Packit |
992a25 |
if (c & 0x80)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
m = 1;
|
|
Packit |
992a25 |
*s++ = 'M';
|
|
Packit |
992a25 |
c &= 0x7f;
|
|
Packit |
992a25 |
o = ccmapc(c, CC_ASCII, CC_NATIVE);
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
m = 0;
|
|
Packit |
992a25 |
if (isspace(o) || !isprint(o))
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!m)
|
|
Packit |
992a25 |
*s++ = ' ';
|
|
Packit |
992a25 |
*s++ = '^';
|
|
Packit |
992a25 |
c ^= 0x40;
|
|
Packit |
992a25 |
o = ccmapc(c, CC_ASCII, CC_NATIVE);
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
else if (m)
|
|
Packit |
992a25 |
*s++ = '-';
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
*s++ = ' ';
|
|
Packit |
992a25 |
*s++ = ' ';
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
*s++ = o;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
*s = 0;
|
|
Packit |
992a25 |
sfputr(out, buf, delim);
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
/*
|
|
Packit |
992a25 |
* compare two files
|
|
Packit |
992a25 |
*/
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
static int
|
|
Packit |
992a25 |
cmp(const char* file1, Sfio_t* f1, const char* file2, Sfio_t* f2, int flags, Sfoff_t count, Sfoff_t differences)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
register int c1;
|
|
Packit |
992a25 |
register int c2;
|
|
Packit |
992a25 |
register unsigned char* p1 = 0;
|
|
Packit |
992a25 |
register unsigned char* p2 = 0;
|
|
Packit |
992a25 |
register Sfoff_t lines = 1;
|
|
Packit |
992a25 |
register unsigned char* e1 = 0;
|
|
Packit |
992a25 |
register unsigned char* e2 = 0;
|
|
Packit |
992a25 |
Sfoff_t pos = 0;
|
|
Packit |
992a25 |
int n1 = 0;
|
|
Packit |
992a25 |
int ret = 0;
|
|
Packit |
992a25 |
unsigned char* last;
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
for (;;)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if ((c1 = e1 - p1) <= 0)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (count > 0 && !(count -= n1))
|
|
Packit |
992a25 |
return ret;
|
|
Packit |
992a25 |
if (!(p1 = (unsigned char*)sfreserve(f1, SF_UNBOUND, 0)) || (c1 = sfvalue(f1)) <= 0)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if ((e2 - p2) > 0 || sfreserve(f2, SF_UNBOUND, 0) && sfvalue(f2) > 0)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
ret = 1;
|
|
Packit |
992a25 |
if (!(flags & CMP_SILENT))
|
|
Packit |
992a25 |
error(ERROR_exit(1), "EOF on %s", file1);
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
return ret;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (count > 0 && c1 > count)
|
|
Packit |
992a25 |
c1 = (int)count;
|
|
Packit |
992a25 |
e1 = p1 + c1;
|
|
Packit |
992a25 |
n1 = c1;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if ((c2 = e2 - p2) <= 0)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!(p2 = (unsigned char*)sfreserve(f2, SF_UNBOUND, 0)) || (c2 = sfvalue(f2)) <= 0)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!(flags & CMP_SILENT))
|
|
Packit |
992a25 |
error(ERROR_exit(1), "EOF on %s", file2);
|
|
Packit |
992a25 |
return 1;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
e2 = p2 + c2;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (c1 > c2)
|
|
Packit |
992a25 |
c1 = c2;
|
|
Packit |
992a25 |
pos += c1;
|
|
Packit |
992a25 |
if (flags & CMP_SILENT)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (memcmp(p1, p2, c1))
|
|
Packit |
992a25 |
return 1;
|
|
Packit |
992a25 |
p1 += c1;
|
|
Packit |
992a25 |
p2 += c1;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
last = p1 + c1;
|
|
Packit |
992a25 |
while (p1 < last)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if ((c1 = *p1++) != *p2++)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (differences >= 0)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!differences)
|
|
Packit |
992a25 |
return 1;
|
|
Packit |
992a25 |
differences--;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
#if 0
|
|
Packit |
992a25 |
if (!flags)
|
|
Packit |
992a25 |
sfprintf(sfstdout, "%s %s differ: char %I*d, line %I*u\n", file1, file2, sizeof(pos), pos - (last - p1), sizeof(lines), lines);
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
sfprintf(sfstdout, "%6I*d", sizeof(pos), pos - (last - p1));
|
|
Packit |
992a25 |
pretty(sfstdout, c1, -1, flags);
|
|
Packit |
992a25 |
pretty(sfstdout, *(p2-1), '\n', flags);
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
#else
|
|
Packit |
992a25 |
if (flags & CMP_VERBOSE)
|
|
Packit |
992a25 |
sfprintf(sfstdout, "%6I*d", sizeof(pos), pos - (last - p1));
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
sfprintf(sfstdout, "%s %s differ: char %I*d, line %I*u", file1, file2, sizeof(pos), pos - (last - p1), sizeof(lines), lines);
|
|
Packit |
992a25 |
if (flags & (CMP_BYTES|CMP_CHARS|CMP_VERBOSE))
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
sfputc(sfstdout, (flags & CMP_VERBOSE) ? ' ' : ',');
|
|
Packit |
992a25 |
pretty(sfstdout, c1, -1, flags);
|
|
Packit |
992a25 |
pretty(sfstdout, *(p2-1), '\n', flags);
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
sfputc(sfstdout, '\n');
|
|
Packit |
992a25 |
#endif
|
|
Packit |
992a25 |
if (!differences || differences < 0 && !(flags & CMP_VERBOSE))
|
|
Packit |
992a25 |
return 1;
|
|
Packit |
992a25 |
ret = 1;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (c1 == '\n')
|
|
Packit |
992a25 |
lines++;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
int
|
|
Packit |
992a25 |
b_cmp(int argc, register char** argv, Shbltin_t* context)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
char* s;
|
|
Packit |
992a25 |
char* e;
|
|
Packit |
992a25 |
char* file1;
|
|
Packit |
992a25 |
char* file2;
|
|
Packit |
992a25 |
int n;
|
|
Packit |
992a25 |
struct stat s1;
|
|
Packit |
992a25 |
struct stat s2;
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
Sfio_t* f1 = 0;
|
|
Packit |
992a25 |
Sfio_t* f2 = 0;
|
|
Packit |
992a25 |
Sfoff_t o1 = 0;
|
|
Packit |
992a25 |
Sfoff_t o2 = 0;
|
|
Packit |
992a25 |
Sfoff_t count = -1;
|
|
Packit |
992a25 |
Sfoff_t differences = -1;
|
|
Packit |
992a25 |
int flags = 0;
|
|
Packit |
992a25 |
|
|
Packit |
992a25 |
NoP(argc);
|
|
Packit |
992a25 |
cmdinit(argc, argv, context, ERROR_CATALOG, 0);
|
|
Packit |
992a25 |
for (;;)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
switch (optget(argv, usage))
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
case 'b':
|
|
Packit |
992a25 |
flags |= CMP_BYTES;
|
|
Packit |
992a25 |
continue;
|
|
Packit |
992a25 |
case 'c':
|
|
Packit |
992a25 |
flags |= CMP_CHARS;
|
|
Packit |
992a25 |
continue;
|
|
Packit |
992a25 |
case 'd':
|
|
Packit |
992a25 |
flags |= CMP_VERBOSE;
|
|
Packit |
992a25 |
differences = opt_info.number;
|
|
Packit |
992a25 |
continue;
|
|
Packit |
992a25 |
case 'i':
|
|
Packit |
992a25 |
o1 = strtoll(opt_info.arg, &e, 0);
|
|
Packit |
992a25 |
if (*e == ':')
|
|
Packit |
992a25 |
o2 = strtoll(e + 1, &e, 0);
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
o2 = o1;
|
|
Packit |
992a25 |
if (*e)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
error(2, "%s: skip1:skip2 expected", opt_info.arg);
|
|
Packit |
992a25 |
break;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
continue;
|
|
Packit |
992a25 |
case 'l':
|
|
Packit |
992a25 |
flags |= CMP_VERBOSE;
|
|
Packit |
992a25 |
continue;
|
|
Packit |
992a25 |
case 'n':
|
|
Packit |
992a25 |
count = opt_info.number;
|
|
Packit |
992a25 |
continue;
|
|
Packit |
992a25 |
case 's':
|
|
Packit |
992a25 |
flags |= CMP_SILENT;
|
|
Packit |
992a25 |
continue;
|
|
Packit |
992a25 |
case ':':
|
|
Packit |
992a25 |
error(2, "%s", opt_info.arg);
|
|
Packit |
992a25 |
break;
|
|
Packit |
992a25 |
case '?':
|
|
Packit |
992a25 |
error(ERROR_usage(2), "%s", opt_info.arg);
|
|
Packit |
992a25 |
break;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
break;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
argv += opt_info.index;
|
|
Packit |
992a25 |
if (error_info.errors || !(file1 = *argv++) || !(file2 = *argv++))
|
|
Packit |
992a25 |
error(ERROR_usage(2), "%s", optusage(NiL));
|
|
Packit |
992a25 |
n = 2;
|
|
Packit |
992a25 |
if (streq(file1, "-"))
|
|
Packit |
992a25 |
f1 = sfstdin;
|
|
Packit |
992a25 |
else if (!(f1 = sfopen(NiL, file1, "r")))
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!(flags & CMP_SILENT))
|
|
Packit |
992a25 |
error(ERROR_system(0), "%s: cannot open", file1);
|
|
Packit |
992a25 |
goto done;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (streq(file2, "-"))
|
|
Packit |
992a25 |
f2 = sfstdin;
|
|
Packit |
992a25 |
else if (!(f2 = sfopen(NiL, file2, "r")))
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!(flags & CMP_SILENT))
|
|
Packit |
992a25 |
error(ERROR_system(0), "%s: cannot open", file2);
|
|
Packit |
992a25 |
goto done;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (s = *argv++)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
o1 = strtoll(s, &e, 0);
|
|
Packit |
992a25 |
if (*e)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
error(ERROR_exit(0), "%s: %s: invalid skip", file1, s);
|
|
Packit |
992a25 |
goto done;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (s = *argv++)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
o2 = strtoll(s, &e, 0);
|
|
Packit |
992a25 |
if (*e)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
error(ERROR_exit(0), "%s: %s: invalid skip", file2, s);
|
|
Packit |
992a25 |
goto done;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (*argv)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
error(ERROR_usage(0), "%s", optusage(NiL));
|
|
Packit |
992a25 |
goto done;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (o1 && sfseek(f1, o1, SEEK_SET) != o1)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!(flags & CMP_SILENT))
|
|
Packit |
992a25 |
error(ERROR_exit(0), "EOF on %s", file1);
|
|
Packit |
992a25 |
n = 1;
|
|
Packit |
992a25 |
goto done;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (o2 && sfseek(f2, o2, SEEK_SET) != o2)
|
|
Packit |
992a25 |
{
|
|
Packit |
992a25 |
if (!(flags & CMP_SILENT))
|
|
Packit |
992a25 |
error(ERROR_exit(0), "EOF on %s", file2);
|
|
Packit |
992a25 |
n = 1;
|
|
Packit |
992a25 |
goto done;
|
|
Packit |
992a25 |
}
|
|
Packit |
992a25 |
if (fstat(sffileno(f1), &s1))
|
|
Packit |
992a25 |
error(ERROR_system(0), "%s: cannot stat", file1);
|
|
Packit |
992a25 |
else if (fstat(sffileno(f2), &s2))
|
|
Packit |
992a25 |
error(ERROR_system(0), "%s: cannot stat", file1);
|
|
Packit |
992a25 |
else if (s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev && o1 == o2)
|
|
Packit |
992a25 |
n = 0;
|
|
Packit |
992a25 |
else
|
|
Packit |
992a25 |
n = ((flags & CMP_SILENT) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode) && (s1.st_size - o1) != (s2.st_size - o2)) ? 1 : cmp(file1, f1, file2, f2, flags, count, differences);
|
|
Packit |
992a25 |
done:
|
|
Packit |
992a25 |
if (f1 && f1 != sfstdin)
|
|
Packit |
992a25 |
sfclose(f1);
|
|
Packit |
992a25 |
if (f2 && f2 != sfstdin)
|
|
Packit |
992a25 |
sfclose(f2);
|
|
Packit |
992a25 |
return n;
|
|
Packit |
992a25 |
}
|