=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/diff.c,v retrieving revision 1.32 retrieving revision 1.33 diff -c -r1.32 -r1.33 *** src/usr.bin/cvs/diff.c 2005/04/22 03:38:56 1.32 --- src/usr.bin/cvs/diff.c 2005/04/25 19:09:15 1.33 *************** *** 1,4 **** ! /* $OpenBSD: diff.c,v 1.32 2005/04/22 03:38:56 joris Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: diff.c,v 1.33 2005/04/25 19:09:15 jfb Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. *************** *** 130,135 **** --- 130,136 ---- #include #include + #include #include #include #include *************** *** 159,164 **** --- 160,166 ---- #define D_UNIFIED 2 /* Unified context diff */ #define D_IFDEF 3 /* Diff with merged #ifdef's */ #define D_BRIEF 4 /* Say if the files differ */ + #define D_RCSDIFF 5 /* Reverse editor output: RCS format */ /* * Status values for print_status() and diffreg() return values *************** *** 392,397 **** --- 394,403 ---- strlcat(diffargs, " -N", sizeof(diffargs)); Nflag = 1; break; + case 'n': + strlcat(diffargs, " -n", sizeof(diffargs)); + format = D_RCSDIFF; + break; case 'p': strlcat(diffargs, " -p", sizeof(diffargs)); pflag = 1; *************** *** 1332,1337 **** --- 1338,1353 ---- range(c, d, ","); putchar('\n'); break; + case D_RCSDIFF: + if (a > b) + printf("a%d %d\n", b, d - c + 1); + else { + printf("d%d %d\n", a, b - a + 1); + + if (!(c > d)) /* add changed lines */ + printf("a%d %d\n", b, d - c + 1); + } + break; } if (format == D_NORMAL || format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1); *************** *** 1389,1395 **** col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { if ((c = getc(lb)) == EOF) { ! puts("\n\\ No newline at end of file"); return (0); } if (c == '\t' && tflag) { --- 1405,1414 ---- col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { if ((c = getc(lb)) == EOF) { ! if (format == D_RCSDIFF) ! warnx("No newline at end of file"); ! else ! puts("\n\\ No newline at end of file"); return (0); } if (c == '\t' && tflag) {