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$.
This commit is contained in:
Rodney W. Grimes 1994-05-14 07:00:23 +00:00
parent 075964620a
commit 9200d155f1
5 changed files with 79 additions and 9 deletions

View File

@ -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 $"

View File

@ -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');

View File

@ -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"

View File

@ -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 || RCSv<VERSION(4)
marker==Id || marker==FreeBSD || RCSv<VERSION(4)
? basename(RCSfilename)
: getfullRCSname(),
delta->num,

View File

@ -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);
}