=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/diff/diffreg.c,v retrieving revision 1.32 retrieving revision 1.33 diff -c -r1.32 -r1.33 *** src/usr.bin/diff/diffreg.c 2003/07/09 00:39:26 1.32 --- src/usr.bin/diff/diffreg.c 2003/07/15 23:17:56 1.33 *************** *** 1,4 **** ! /* $OpenBSD: diffreg.c,v 1.32 2003/07/09 00:39:26 millert Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. --- 1,4 ---- ! /* $OpenBSD: diffreg.c,v 1.33 2003/07/15 23:17:56 millert Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. *************** *** 65,71 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.32 2003/07/09 00:39:26 millert Exp $"; #endif /* not lint */ #include --- 65,71 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.33 2003/07/15 23:17:56 millert Exp $"; #endif /* not lint */ #include *************** *** 184,189 **** --- 184,190 ---- static void output(char *, FILE *, char *, FILE *); static void check(char *, FILE *, char *, FILE *); static void range(int, int, char *); + static void uni_range(int, int); static void dump_context_vec(FILE *, FILE *); static void dump_unified_vec(FILE *, FILE *); static void prepare(int, FILE *); *************** *** 880,885 **** --- 881,905 ---- } } + static __inline void + range(int a, int b, char *separator) + { + printf("%d", a > b ? b : a); + if (a < b) + printf("%s%d", separator, b); + } + + static __inline void + uni_range(int a, int b) + { + if (a < b) + printf("%d,%d", a, b - a + 1); + else if (a == b) + printf("%d", b); + else + printf("%d,0", b); + } + /* * The following struct is used to record change information when * doing a "context" or "unified" diff. (see routine "change" to *************** *** 987,1000 **** } static void - range(int a, int b, char *separator) - { - printf("%d", a > b ? b : a); - if (a < b) - printf("%s%d", separator, b); - } - - static void fetch(long *f, int a, int b, FILE *lb, char *s, int oldfile) { int i, j, c, col, nc; --- 1007,1012 ---- *************** *** 1261,1268 **** lowc = max(1, cvp->c - context); upd = min(len[1], context_vec_ptr->d + context); ! printf("@@ -%d,%d +%d,%d @@\n", lowa, upb - lowa + 1, ! lowc, upd - lowc + 1); /* * Output changes in "unified" diff format--the old and new lines --- 1273,1283 ---- lowc = max(1, cvp->c - context); upd = min(len[1], context_vec_ptr->d + context); ! fputs("@@ -", stdout); ! uni_range(lowa, upb); ! fputs(" +", stdout); ! uni_range(lowc, upd); ! fputs(" @@\n", stdout); /* * Output changes in "unified" diff format--the old and new lines