diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-02-23 08:03:20 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-02-23 08:03:20 +0000 |
commit | ef36c7fbbdba58dbbc72c8390ed82eb390e98458 (patch) | |
tree | 2b1f8e18045c46236db9bf6d2e423866e1f3c774 /usr.bin | |
parent | 01f520a35f0e3334a413c2c8341ed9dbedda5d2f (diff) |
print the header only once.
okay millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/diff/diffreg.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 35633e249a7..ec3bc79b9e3 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffreg.c,v 1.65 2007/02/22 01:44:36 millert Exp $ */ +/* $OpenBSD: diffreg.c,v 1.66 2007/02/23 08:03:19 espie Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -65,7 +65,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.65 2007/02/22 01:44:36 millert Exp $"; +static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.66 2007/02/23 08:03:19 espie Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -212,7 +212,7 @@ static void prune(void); static void equiv(struct line *, int, struct line *, int, int *); static void unravel(int); static void unsort(struct line *, int, int *); -static void change(char *, FILE *, char *, FILE *, int, int, int, int, int); +static void change(char *, FILE *, char *, FILE *, int, int, int, int, int *); static void sort(struct line *, int); static void print_header(const char *, const char *); static int ignoreline(char *); @@ -916,7 +916,7 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) i1++; j1 = J[i1 + 1] - 1; J[i1] = j1; - change(file1, f1, file2, f2, i0, i1, j0, j1, flags); + change(file1, f1, file2, f2, i0, i1, j0, j1, &flags); } } else { for (i0 = m; i0 >= 1; i0 = i1 - 1) { @@ -928,11 +928,11 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) i1--; j1 = J[i1 - 1] + 1; J[i1] = j1; - change(file1, f1, file2, f2, i1, i0, j1, j0, flags); + change(file1, f1, file2, f2, i1, i0, j1, j0, &flags); } } if (m == 0) - change(file1, f1, file2, f2, 1, 0, 1, len[1], flags); + change(file1, f1, file2, f2, 1, 0, 1, len[1], &flags); if (format == D_IFDEF) { for (;;) { #define c i0 @@ -1003,7 +1003,7 @@ ignoreline(char *line) */ static void change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d, - int flags) + int *pflags) { static size_t max_context = 64; int i; @@ -1037,8 +1037,10 @@ restart: return; } proceed: - if (flags & D_HEADER) + if (*pflags & D_HEADER) { printf("%s %s %s\n", diffargs, file1, file2); + *pflags &= ~D_HEADER; + } if (format == D_CONTEXT || format == D_UNIFIED) { /* * Allocate change records as needed. |