Module Name: othersrc Committed By: agc Date: Fri Jan 11 05:19:46 UTC 2013
Modified Files: othersrc/external/bsd/netdiff/bin/netdiff: 004.expected othersrc/external/bsd/netdiff/bin/qdiff: 004.expected othersrc/external/bsd/netdiff/dist: diff.c diff_subr.c diffdir.c diffreg.c Log Message: avoid accessing fields in the struct from main() and other callers - set defaults at the start of the 3 main functions - diff_file(), diff_dir() and difference(). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ othersrc/external/bsd/netdiff/bin/netdiff/004.expected cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/bin/qdiff/004.expected cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/netdiff/dist/diff.c \ othersrc/external/bsd/netdiff/dist/diffdir.c \ othersrc/external/bsd/netdiff/dist/diffreg.c cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/diff_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/external/bsd/netdiff/bin/netdiff/004.expected diff -u othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.2 othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.3 --- othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.2 Fri Jan 11 05:10:19 2013 +++ othersrc/external/bsd/netdiff/bin/netdiff/004.expected Fri Jan 11 05:19:46 2013 @@ -6,9 +6,9 @@ diff /usr/src/sbin/Makefile /d/thinfs-sr > SUBDIR+= mount_thinfs diff /usr/src/sbin/Makefile.inc /d/thinfs-src/sbin/Makefile.inc 1c1 -< # $NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $ +< # $NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $ --- -> # $NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $ +> # $NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $ 6c6 < WARNS?= 4 --- Index: othersrc/external/bsd/netdiff/bin/qdiff/004.expected diff -u othersrc/external/bsd/netdiff/bin/qdiff/004.expected:1.2 othersrc/external/bsd/netdiff/bin/qdiff/004.expected:1.3 --- othersrc/external/bsd/netdiff/bin/qdiff/004.expected:1.2 Fri Jan 11 05:10:19 2013 +++ othersrc/external/bsd/netdiff/bin/qdiff/004.expected Fri Jan 11 05:19:46 2013 @@ -6,9 +6,9 @@ diff /usr/src/sbin/Makefile /d/thinfs-sr > SUBDIR+= mount_thinfs diff /usr/src/sbin/Makefile.inc /d/thinfs-src/sbin/Makefile.inc 1c1 -< # $NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $ +< # $NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $ --- -> # $NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $ +> # $NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $ 6c6 < WARNS?= 4 --- Index: othersrc/external/bsd/netdiff/dist/diff.c diff -u othersrc/external/bsd/netdiff/dist/diff.c:1.1.1.1 othersrc/external/bsd/netdiff/dist/diff.c:1.2 --- othersrc/external/bsd/netdiff/dist/diff.c:1.1.1.1 Thu Jan 10 08:17:11 2013 +++ othersrc/external/bsd/netdiff/dist/diff.c Fri Jan 11 05:19:46 2013 @@ -346,9 +346,6 @@ main(int argc, char **argv) char *prog; memset(&diff, 0x0, sizeof(diff)); - diff.tabsize = 8; - diff.fp = stdout; - diff.optfile = "\0"; oargv = argv; oargc = argc; lastch = '\0'; Index: othersrc/external/bsd/netdiff/dist/diffdir.c diff -u othersrc/external/bsd/netdiff/dist/diffdir.c:1.1.1.1 othersrc/external/bsd/netdiff/dist/diffdir.c:1.2 --- othersrc/external/bsd/netdiff/dist/diffdir.c:1.1.1.1 Thu Jan 10 08:17:11 2013 +++ othersrc/external/bsd/netdiff/dist/diffdir.c Fri Jan 11 05:19:46 2013 @@ -228,6 +228,15 @@ diff_dir(diff_t *diff, char *p1, char *p if (diff == NULL || p1 == NULL || p2 == NULL) { return 0; } + if (diff->tabsize == 0) { + diff->tabsize = 8; + } + if (diff->fp == NULL) { + diff->fp = stdout; + } + if (diff->optfile == NULL) { + diff->optfile = "\0"; + } dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1)); if (dirlen1 >= sizeof(path1) - 1) { warnx("%s: %s", p1, strerror(ENAMETOOLONG)); Index: othersrc/external/bsd/netdiff/dist/diffreg.c diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.1.1.1 othersrc/external/bsd/netdiff/dist/diffreg.c:1.2 --- othersrc/external/bsd/netdiff/dist/diffreg.c:1.1.1.1 Thu Jan 10 08:17:11 2013 +++ othersrc/external/bsd/netdiff/dist/diffreg.c Fri Jan 11 05:19:46 2013 @@ -1763,6 +1763,15 @@ diff_file(diff_t *diff, const char *ofil if (diff == NULL || ofile1 == NULL || ofile2 == NULL) { return D_MISMATCH1; } + if (diff->tabsize == 0) { + diff->tabsize = 8; + } + if (diff->fp == NULL) { + diff->fp = stdout; + } + if (diff->optfile == NULL) { + diff->optfile = "\0"; + } memset(&s, 0x0, sizeof(s)); memset(&f[0], 0x0, sizeof(f[0])); memset(&f[1], 0x0, sizeof(f[1])); Index: othersrc/external/bsd/netdiff/dist/diff_subr.c diff -u othersrc/external/bsd/netdiff/dist/diff_subr.c:1.2 othersrc/external/bsd/netdiff/dist/diff_subr.c:1.3 --- othersrc/external/bsd/netdiff/dist/diff_subr.c:1.2 Fri Jan 11 05:10:19 2013 +++ othersrc/external/bsd/netdiff/dist/diff_subr.c Fri Jan 11 05:19:46 2013 @@ -384,6 +384,15 @@ difference(diff_t *diff, char *file1, ch if (diff == NULL || file1 == NULL || file2 == NULL) { return 2; } + if (diff->tabsize == 0) { + diff->tabsize = 8; + } + if (diff->fp == NULL) { + diff->fp = stdout; + } + if (diff->optfile == NULL) { + diff->optfile = "\0"; + } gotstdin = 0; /* * Do sanity checks, fill in st[0] and st[1] and call the appropriate