From f4ca4c5e6b671f3cde8d8970ecbf0b3745ad431f Mon Sep 17 00:00:00 2001 From: rgrimes Date: Sat, 14 May 1994 07:00:23 +0000 Subject: Add new option -K from David Dawes that allows you to turn on and off specific keyword substitution during a rcs co command. Add the new keyword FreeBSD that is IDENTICAL in operation to $Id$. --- gnu/usr.bin/rcs/co/co.1 | 10 ++++++++- gnu/usr.bin/rcs/co/co.c | 11 ++++++++-- gnu/usr.bin/rcs/lib/rcsbase.h | 8 ++++++-- gnu/usr.bin/rcs/lib/rcsedit.c | 11 ++++++++-- gnu/usr.bin/rcs/lib/rcskeys.c | 48 +++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 79 insertions(+), 9 deletions(-) (limited to 'gnu/usr.bin/rcs') diff --git a/gnu/usr.bin/rcs/co/co.1 b/gnu/usr.bin/rcs/co/co.1 index d9ce65e..1fce152 100644 --- a/gnu/usr.bin/rcs/co/co.1 +++ b/gnu/usr.bin/rcs/co/co.1 @@ -2,7 +2,7 @@ .ds Rv \\$3 .ds Dt \\$4 .. -.Id $Id: co.1,v 5.7 1991/08/19 03:13:55 eggert Exp $ +.Id $Id: co.1,v 1.1.1.1 1993/06/18 04:22:11 jkh Exp $ .ds g \&\s-1UTC\s0 .ds r \&\s-1RCS\s0 .if n .ds - \%-- @@ -141,6 +141,14 @@ See also .SM "FILE MODES" below. .TP +.B \-K\f2keywordlist\fP +Exclude or include keyword expansion when checking out a file. +By default all keywords are expanded, you can turn individual +keywords off with +.BR \-K\f2eKeyword\fP +or on with +.BR \-K\f2iKeyword\fP . +.TP .B \-kkv Generate keyword strings using the default form, e.g.\& .B "$\&Revision: \*(Rv $" diff --git a/gnu/usr.bin/rcs/co/co.c b/gnu/usr.bin/rcs/co/co.c index 9435574..82f7cc8 100644 --- a/gnu/usr.bin/rcs/co/co.c +++ b/gnu/usr.bin/rcs/co/co.c @@ -34,6 +34,9 @@ Report problems and direct all questions to: /* $Log: co.c,v $ + * Revision 1.1.1.1 1993/06/18 04:22:11 jkh + * Updated GNU utilities + * * Revision 5.9 1991/10/07 17:32:46 eggert * ci -u src/RCS/co.c,v src/co.c <<\. * -k affects just working file, not RCS file. @@ -152,7 +155,7 @@ static void cleanup P((void)); static char const quietarg[] = "-q"; -static char const *expandarg, *join, *suffixarg, *versionarg; +static char const *expandarg, *join, *suffixarg, *versionarg, *incexcarg; static char const *joinlist[joinlength]; /* revisions to be joined */ static FILE *neworkptr; static int exitstatus; @@ -164,7 +167,7 @@ static struct hshentries *gendeltas; /* deltas to be generated */ static struct hshentry *targetdelta; /* final delta to be generated */ static struct stat workstat; -mainProg(coId, "co", "$Id: co.c,v 5.9 1991/10/07 17:32:46 eggert Exp $") +mainProg(coId, "co", "$Id: co.c,v 1.1.1.1 1993/06/18 04:22:11 jkh Exp $") { static char const cmdusage[] = "\nco usage: co -{flpqru}[rev] -ddate -jjoinlist -sstate -w[login] -Vn file ..."; @@ -270,6 +273,10 @@ mainProg(coId, "co", "$Id: co.c,v 5.9 1991/10/07 17:32:46 eggert Exp $") setRCSversion(versionarg); break; + case 'K': /* set keyword inclusions/exclusions */ + incexcarg = *argv; + setIncExc(incexcarg); + break; case 'k': /* set keyword expand mode */ expandarg = *argv; if (0 <= expmode) redefined('k'); diff --git a/gnu/usr.bin/rcs/lib/rcsbase.h b/gnu/usr.bin/rcs/lib/rcsbase.h index c0904bb..17a123d 100644 --- a/gnu/usr.bin/rcs/lib/rcsbase.h +++ b/gnu/usr.bin/rcs/lib/rcsbase.h @@ -2,7 +2,7 @@ /* * RCS common definitions and data structures */ -#define RCSBASE "$Id: rcsbase.h,v 5.11 1991/10/07 17:32:46 eggert Exp $" +#define RCSBASE "$Id: rcsbase.h,v 1.1.1.1 1993/06/18 04:22:13 jkh Exp $" /* Copyright (C) 1982, 1988, 1989 Walter Tichy Copyright 1990, 1991 by Paul Eggert @@ -43,6 +43,9 @@ Report problems and direct all questions to: /* $Log: rcsbase.h,v $ + * Revision 1.1.1.1 1993/06/18 04:22:13 jkh + * Updated GNU utilities + * * Revision 5.11 1991/10/07 17:32:46 eggert * Support piece tables even if !has_mmap. * @@ -380,10 +383,11 @@ struct assoc { #define REVISION "Revision" #define SOURCE "Source" #define STATE "State" +#define FREEBSD "FreeBSD" #define keylength 8 /* max length of any of the above keywords */ enum markers { Nomatch, Author, Date, Header, Id, - Locker, Log, RCSfile, Revision, Source, State }; + Locker, Log, RCSfile, Revision, Source, State, FreeBSD }; /* This must be in the same order as rcskeys.c's Keyword[] array. */ #define DELNUMFORM "\n\n%s\n%s\n" diff --git a/gnu/usr.bin/rcs/lib/rcsedit.c b/gnu/usr.bin/rcs/lib/rcsedit.c index fab4f62..98e4c4b 100644 --- a/gnu/usr.bin/rcs/lib/rcsedit.c +++ b/gnu/usr.bin/rcs/lib/rcsedit.c @@ -36,6 +36,9 @@ Report problems and direct all questions to: /* $Log: rcsedit.c,v $ + * Revision 1.1.1.1 1993/06/18 04:22:12 jkh + * Updated GNU utilities + * * Revision 5.11 1991/11/03 01:11:44 eggert * Move the warning about link breaking to where they're actually being broken. * @@ -154,7 +157,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(editId, "$Id: rcsedit.c,v 5.11 1991/11/03 01:11:44 eggert Exp $") +libId(editId, "$Id: rcsedit.c,v 1.1.1.1 1993/06/18 04:22:12 jkh Exp $") static void keyreplace P((enum markers,struct hshentry const*,FILE*)); @@ -959,10 +962,14 @@ keyreplace(marker,delta,out) case Date: aputs(date2str(date,datebuf), out); break; + /* + * The FreeBSD keyword is identical to Id. + */ + case FreeBSD: case Id: case Header: aprintf(out, "%s %s %s %s %s", - marker==Id || RCSvnum, diff --git a/gnu/usr.bin/rcs/lib/rcskeys.c b/gnu/usr.bin/rcs/lib/rcskeys.c index 82850a7..e41363b 100644 --- a/gnu/usr.bin/rcs/lib/rcskeys.c +++ b/gnu/usr.bin/rcs/lib/rcskeys.c @@ -31,6 +31,9 @@ Report problems and direct all questions to: /* $Log: rcskeys.c,v $ + * Revision 1.1.1.1 1993/06/18 04:22:12 jkh + * Updated GNU utilities + * * Revision 5.2 1991/08/19 03:13:55 eggert * Say `T const' instead of `const T'; it's less confusing for pointer types. * (This change was made in other source files too.) @@ -60,17 +63,24 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(keysId, "$Id: rcskeys.c,v 5.2 1991/08/19 03:13:55 eggert Exp $") +libId(keysId, "$Id: rcskeys.c,v 1.1.1.1 1993/06/18 04:22:12 jkh Exp $") char const *const Keyword[] = { /* This must be in the same order as rcsbase.h's enum markers type. */ nil, AUTHOR, DATE, HEADER, IDH, - LOCKER, LOG, RCSFILE, REVISION, SOURCE, STATE + LOCKER, LOG, RCSFILE, REVISION, SOURCE, STATE, FREEBSD }; +/* Expand all keywords by default */ + +static int ExpandKeyword[] = { + nil, + true, true, true, true, + true, true, true, true, true, true, true, true +}; enum markers trymatch(string) @@ -83,6 +93,8 @@ trymatch(string) register int j; register char const *p, *s; for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) { + if (!ExpandKeyword[j]) + continue; /* try next keyword */ p = Keyword[j]; s = string; @@ -100,3 +112,35 @@ trymatch(string) return(Nomatch); } + +setIncExc(arg) + char *arg; +/* Sets up the ExpandKeyword table according to command-line flags */ +{ + char *key; + int include = 0, j; + + arg += 2; + switch (*arg++) { + case 'e': + include = false; + break; + case 'i': + include = true; + break; + default: + return(false); + } + if (include) + for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) + ExpandKeyword[j] = false; + key = strtok(arg, ","); + while (key) { + for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) + if (!strcmp(key, Keyword[j])) + ExpandKeyword[j] = include; + key = strtok(NULL, ","); + } + return(true); +} + -- cgit v1.1