From b8ccc4af8091d513d5d2fde199bbb05470ca22e2 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Sat, 8 Oct 2005 19:20:50 +0000 Subject: support unified, context and rcsdiff output (-u -c -n flags) --- usr.bin/rcs/rcsdiff.1 | 15 +++++++++++++-- usr.bin/rcs/rcsdiff.c | 13 +++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/usr.bin/rcs/rcsdiff.1 b/usr.bin/rcs/rcsdiff.1 index 0c544d23779..17036c46b1f 100644 --- a/usr.bin/rcs/rcsdiff.1 +++ b/usr.bin/rcs/rcsdiff.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rcsdiff.1,v 1.1 2005/10/08 19:12:18 joris Exp $ +.\" $OpenBSD: rcsdiff.1,v 1.2 2005/10/08 19:20:49 joris Exp $ .\" .\" Copyright (c) 2005 Joris Vink .\" All rights reserved. @@ -23,7 +23,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl qV +.Op Fl cnquV .Ar file ... .Ek .Sh DESCRIPTION @@ -33,8 +33,19 @@ program is used to compare two revisions of each RCS file given .Pp The following options are supported: .Bl -tag -width Ds +.It Fl c +Produces a diff with three lines of context. See +.Xr diff 1 +for more information. +.It Fl n +Produces a diff in the same format as that used by +.Xr rcsdiff 1 .It Fl q Be quiet about reporting. +.It Fl u +Produces a unified diff with tree lines of context. See +.Xr diff 1 +for more information. .It Fl V Print RCS's version number. .El diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c index 4605647d75e..9c9e6d77ef5 100644 --- a/usr.bin/rcs/rcsdiff.c +++ b/usr.bin/rcs/rcsdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsdiff.c,v 1.2 2005/10/07 23:59:56 niallo Exp $ */ +/* $OpenBSD: rcsdiff.c,v 1.3 2005/10/08 19:20:49 joris Exp $ */ /* * Copyright (c) 2005 Joris Vink * All rights reserved. @@ -50,11 +50,20 @@ rcsdiff_main(int argc, char **argv) rev = RCS_HEAD_REV; - while ((ch = getopt(argc, argv, "qV")) != -1) { + while ((ch = getopt(argc, argv, "cnquV")) != -1) { switch (ch) { + case 'c': + diff_format = D_CONTEXT; + break; + case 'n': + diff_format = D_RCSDIFF; + break; case 'q': verbose = 0; break; + case 'u': + diff_format = D_UNIFIED; + break; case 'V': printf("%s\n", rcs_version); exit(0); -- cgit v1.2.3