Recover the -K option to co, for handling selective keyword expansion.

This commit is contained in:
Peter Wemm 1995-10-29 19:31:11 +00:00
parent aac6d18515
commit 9968a350e9
4 changed files with 95 additions and 8 deletions

View File

@ -29,6 +29,16 @@ Report problems and direct all questions to:
/*
* $Log: co.c,v $
* Revision 1.4 1995/10/28 21:49:12 peter
* First part of import conflict merge from rcs-5.7 import.
*
* All those $Log$ entries, combined with the whitespace changes are a real
* pain.
*
* I'm committing this now, before it's completely finished to get it compiling
* and working again ASAP. Some of the FreeBSD specific features are not working
* in this commit yet (mainly rlog stuff and $FreeBSD$ support)
*
* Revision 5.18 1995/06/16 06:19:24 eggert
* Update FSF address.
*
@ -179,7 +189,7 @@ static void cleanup P((void));
static char const quietarg[] = "-q";
static char const *expandarg, *suffixarg, *versionarg, *zonearg;
static char const *expandarg, *suffixarg, *versionarg, *zonearg, *incexcarg;
static char const **joinlist; /* revisions to be joined */
static int joinlength;
static FILE *neworkptr;
@ -192,7 +202,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.18 1995/06/16 06:19:24 eggert Exp $")
mainProg(coId, "co", "$Id: co.c,v 1.4 1995/10/28 21:49:12 peter Exp $")
{
static char const cmdusage[] =
"\nco usage: co -{fIlMpqru}[rev] -ddate -jjoins -ksubst -sstate -T -w[who] -Vn -xsuff -zzone file ...";
@ -315,6 +325,11 @@ mainProg(coId, "co", "$Id: co.c,v 5.18 1995/06/16 06:19:24 eggert Exp $")
zone_set(a);
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

@ -1,6 +1,6 @@
/* RCS common definitions and data structures */
#define RCSBASE "$Id: rcsbase.h,v 5.20 1995/06/16 06:19:24 eggert Exp $"
#define RCSBASE "$Id: rcsbase.h,v 1.4 1995/10/28 21:49:34 peter Exp $"
/* Copyright 1982, 1988, 1989 Walter Tichy
Copyright 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert
@ -31,6 +31,16 @@ Report problems and direct all questions to:
/*
* $Log: rcsbase.h,v $
* Revision 1.4 1995/10/28 21:49:34 peter
* First part of import conflict merge from rcs-5.7 import.
*
* All those $Log$ entries, combined with the whitespace changes are a real
* pain.
*
* I'm committing this now, before it's completely finished to get it compiling
* and working again ASAP. Some of the FreeBSD specific features are not working
* in this commit yet (mainly rlog stuff and $FreeBSD$ support)
*
* Revision 5.20 1995/06/16 06:19:24 eggert
* Update FSF address.
*
@ -427,10 +437,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, Name, RCSfile, Revision, Source, State };
Locker, Log, Name, 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,16 @@ Report problems and direct all questions to:
/*
* $Log: rcsedit.c,v $
* Revision 1.4 1995/10/28 21:49:36 peter
* First part of import conflict merge from rcs-5.7 import.
*
* All those $Log$ entries, combined with the whitespace changes are a real
* pain.
*
* I'm committing this now, before it's completely finished to get it compiling
* and working again ASAP. Some of the FreeBSD specific features are not working
* in this commit yet (mainly rlog stuff and $FreeBSD$ support)
*
* Revision 5.19 1995/06/16 06:19:24 eggert
* Update FSF address.
*
@ -202,7 +212,7 @@ Report problems and direct all questions to:
#include "rcsbase.h"
libId(editId, "$Id: rcsedit.c,v 5.19 1995/06/16 06:19:24 eggert Exp $")
libId(editId, "$Id: rcsedit.c,v 1.4 1995/10/28 21:49:36 peter Exp $")
static void editEndsPrematurely P((void)) exiting;
static void editLineNumberOverflow P((void)) exiting;
@ -1049,10 +1059,11 @@ keyreplace(marker, delta, delimstuffed, infile, out, dolog)
case Date:
aputs(date2str(date,datebuf), out);
break;
case FreeBSD:
case Id:
case Header:
escape_string(out,
marker==Id || RCSv<VERSION(4)
marker==Id || marker==FreeBSD || RCSv<VERSION(4)
? basefilename(RCSname)
: getfullRCSname()
);

View File

@ -29,6 +29,16 @@ Report problems and direct all questions to:
/*
* $Log: rcskeys.c,v $
* Revision 1.6 1995/10/28 21:49:45 peter
* First part of import conflict merge from rcs-5.7 import.
*
* All those $Log$ entries, combined with the whitespace changes are a real
* pain.
*
* I'm committing this now, before it's completely finished to get it compiling
* and working again ASAP. Some of the FreeBSD specific features are not working
* in this commit yet (mainly rlog stuff and $FreeBSD$ support)
*
* Revision 5.4 1995/06/16 06:19:24 eggert
* Update FSF address.
*
@ -64,17 +74,25 @@ Report problems and direct all questions to:
#include "rcsbase.h"
libId(keysId, "$Id: rcskeys.c,v 5.4 1995/06/16 06:19:24 eggert Exp $")
libId(keysId, "$Id: rcskeys.c,v 1.6 1995/10/28 21:49:45 peter Exp $")
char const *const Keyword[] = {
/* This must be in the same order as rcsbase.h's enum markers type. */
0,
AUTHOR, DATE, HEADER, IDH,
LOCKER, LOG, NAME, RCSFILE, REVISION, SOURCE, STATE
LOCKER, LOG, NAME, RCSFILE, REVISION, SOURCE, STATE,
FREEBSD
};
/* Expand all keywords by default */
static int ExpandKeyword[] = {
false,
true, true, true, true,
true, true, true, true, true, true, true,
false
};
enum markers
trymatch(string)
@ -87,6 +105,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;
@ -104,3 +124,33 @@ 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);
}