diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1997-08-22 07:01:47 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1997-08-22 07:01:47 +0000 |
| commit | d978b087d93aa94b8acc3800fba2c28ab1a04f1a (patch) | |
| tree | 4c7300d58e150e8f4adefed976376213aa1b8f02 /gnu/usr.bin | |
| parent | cd566dac7417ea05823e577de608d7530a978992 (diff) | |
Notes
Diffstat (limited to 'gnu/usr.bin')
| -rw-r--r-- | gnu/usr.bin/rcs/co/co.c | 9 | ||||
| -rw-r--r-- | gnu/usr.bin/rcs/lib/Makefile | 6 | ||||
| -rw-r--r-- | gnu/usr.bin/rcs/lib/rcsbase.h | 15 | ||||
| -rw-r--r-- | gnu/usr.bin/rcs/lib/rcsedit.c | 17 | ||||
| -rw-r--r-- | gnu/usr.bin/rcs/lib/rcsfnms.c | 4 | ||||
| -rw-r--r-- | gnu/usr.bin/rcs/lib/rcskeep.c | 3 | ||||
| -rw-r--r-- | gnu/usr.bin/rcs/lib/rcskeys.c | 69 | ||||
| -rw-r--r-- | gnu/usr.bin/rcs/lib/rcsutil.c | 9 |
8 files changed, 92 insertions, 40 deletions
diff --git a/gnu/usr.bin/rcs/co/co.c b/gnu/usr.bin/rcs/co/co.c index 91da3ef47dfa..9dbe8f360c90 100644 --- a/gnu/usr.bin/rcs/co/co.c +++ b/gnu/usr.bin/rcs/co/co.c @@ -178,7 +178,7 @@ static void cleanup P((void)); static char const quietarg[] = "-q"; -static char const *expandarg, *suffixarg, *versionarg, *zonearg, *incexcarg; +static char const *expandarg, *suffixarg, *versionarg, *zonearg; static char const **joinlist; /* revisions to be joined */ static int joinlength; static FILE *neworkptr; @@ -191,7 +191,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 1.5 1995/10/29 19:31:07 peter Exp $") +mainProg(coId, "co", "$Id: co.c,v 1.6 1995/10/29 22:06:03 peter Exp $") { static char const cmdusage[] = "\nco usage: co -{fIlMpqru}[rev] -ddate -jjoins -ksubst -sstate -T -w[who] -Vn -xsuff -zzone file ..."; @@ -314,11 +314,6 @@ mainProg(coId, "co", "$Id: co.c,v 1.5 1995/10/29 19:31:07 peter 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'); diff --git a/gnu/usr.bin/rcs/lib/Makefile b/gnu/usr.bin/rcs/lib/Makefile index 0170d4a2f712..d3792325a0fb 100644 --- a/gnu/usr.bin/rcs/lib/Makefile +++ b/gnu/usr.bin/rcs/lib/Makefile @@ -7,8 +7,8 @@ SRCS = maketime.c partime.c rcsedit.c rcsfcmp.c rcsfnms.c rcsgen.c \ rcskeep.c rcskeys.c rcslex.c rcsmap.c rcsrev.c rcssyn.c rcstime.c \ rcsutil.c merger.c version.c -NOPROFILE=noprofile - -install: +NOPROFILE= noprofile +INTERNALLIB= true +INTERNALSTATICLIB= true .include <bsd.lib.mk> diff --git a/gnu/usr.bin/rcs/lib/rcsbase.h b/gnu/usr.bin/rcs/lib/rcsbase.h index 31fb6ffd54de..6d94799456ca 100644 --- a/gnu/usr.bin/rcs/lib/rcsbase.h +++ b/gnu/usr.bin/rcs/lib/rcsbase.h @@ -1,6 +1,6 @@ /* RCS common definitions and data structures */ -#define RCSBASE "$Id: rcsbase.h,v 1.5 1995/10/29 19:31:09 peter Exp $" +#define RCSBASE "$Id: rcsbase.h,v 1.6 1995/10/29 22:06:10 peter Exp $" /* Copyright 1982, 1988, 1989 Walter Tichy Copyright 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert @@ -426,11 +426,12 @@ 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 */ +#define CVSHEADER "CVSHeader" +#define keylength 9 /* max length of any of the above keywords */ enum markers { Nomatch, Author, Date, Header, Id, - Locker, Log, Name, RCSfile, Revision, Source, State, FreeBSD }; + Locker, Log, Name, RCSfile, Revision, Source, State, CVSHeader, + LocalId }; /* This must be in the same order as rcskeys.c's Keyword[] array. */ #define DELNUMFORM "\n\n%s\n%s\n" @@ -501,6 +502,7 @@ RILE *rcsreadopen P((struct buf*,struct stat*,int)); char *bufenlarge P((struct buf*,char const**)); char const *basefilename P((char const*)); char const *getfullRCSname P((void)); +char const *getfullCVSname P((void)); char const *maketemp P((int)); char const *rcssuffix P((char const*)); int pairnames P((int,char**,RILE*(*)P((struct buf*,struct stat*,int)),int,int)); @@ -531,8 +533,11 @@ extern struct buf prevauthor, prevdate, prevname, prevrev, prevstate; int getoldkeys P((RILE*)); /* rcskeys */ -extern char const *const Keyword[]; +extern char const *Keyword[]; +extern enum markers LocalIdMode; enum markers trymatch P((char const*)); +void setRCSLocalId(char const *); +void setIncExc(char const *); /* rcslex */ extern FILE *foutptr; diff --git a/gnu/usr.bin/rcs/lib/rcsedit.c b/gnu/usr.bin/rcs/lib/rcsedit.c index 7273de50e055..be7e799c0fc4 100644 --- a/gnu/usr.bin/rcs/lib/rcsedit.c +++ b/gnu/usr.bin/rcs/lib/rcsedit.c @@ -201,7 +201,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(editId, "$Id: rcsedit.c,v 1.5 1995/10/29 19:31:10 peter Exp $") +libId(editId, "$Id: rcsedit.c,v 1.6 1995/10/29 22:06:12 peter Exp $") static void editEndsPrematurely P((void)) exiting; static void editLineNumberOverflow P((void)) exiting; @@ -1048,14 +1048,17 @@ keyreplace(marker, delta, delimstuffed, infile, out, dolog) case Date: aputs(date2str(date,datebuf), out); break; - case FreeBSD: case Id: + case LocalId: case Header: - escape_string(out, - marker==Id || marker==FreeBSD || RCSv<VERSION(4) - ? basefilename(RCSname) - : getfullRCSname() - ); + if (marker == Id || RCSv < VERSION(4) || + (marker == LocalId && LocalIdMode == Id)) + escape_string(out, basefilename(RCSname)); + else if (marker == CVSHeader || + (marker == LocalId && LocalIdMode == CVSHeader)) + escape_string(out, getfullCVSname()); + else + escape_string(out, getfullRCSname()); aprintf(out, " %s %s %s %s", delta->num, date2str(date, datebuf), diff --git a/gnu/usr.bin/rcs/lib/rcsfnms.c b/gnu/usr.bin/rcs/lib/rcsfnms.c index 5bb695d97f4e..1c0426edc8fd 100644 --- a/gnu/usr.bin/rcs/lib/rcsfnms.c +++ b/gnu/usr.bin/rcs/lib/rcsfnms.c @@ -177,7 +177,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(fnmsId, "$Id: rcsfnms.c,v 1.4 1995/10/29 22:06:18 peter Exp $") +libId(fnmsId, "$Id: rcsfnms.c,v 1.4.2.1 1997/08/19 11:24:17 peter Exp $") static char const *bindex P((char const*,int)); static int fin2open P((char const*, size_t, char const*, size_t, char const*, size_t, RILE*(*)P((struct buf*,struct stat*,int)), int)); @@ -884,7 +884,7 @@ getfullCVSname() int alen = strlen(ATTICDIR); if ((c = strrchr(namebuf, '/')) != NULL) { - if (alen >= namebuf - c) { + if (namebuf - c >= alen) { if (!strncmp(c - alen, ATTICDIR, alen)) { while(*c != '\0') { *(c - alen) = *c; diff --git a/gnu/usr.bin/rcs/lib/rcskeep.c b/gnu/usr.bin/rcs/lib/rcskeep.c index f8a0d2aad06f..e759e8dc8c99 100644 --- a/gnu/usr.bin/rcs/lib/rcskeep.c +++ b/gnu/usr.bin/rcs/lib/rcskeep.c @@ -98,7 +98,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(keepId, "$Id: rcskeep.c,v 1.3 1995/10/28 21:49:43 peter Exp $") +libId(keepId, "$Id: rcskeep.c,v 1.4 1995/10/29 22:06:23 peter Exp $") static int badly_terminated P((void)); static int checknum P((char const*)); @@ -191,6 +191,7 @@ getoldkeys(fp) break; case Header: case Id: + case LocalId: if (!( getval(fp, (struct buf*)0, false) && keeprev(fp) && diff --git a/gnu/usr.bin/rcs/lib/rcskeys.c b/gnu/usr.bin/rcs/lib/rcskeys.c index 492d8cba8d3a..8ca3b5bb2236 100644 --- a/gnu/usr.bin/rcs/lib/rcskeys.c +++ b/gnu/usr.bin/rcs/lib/rcskeys.c @@ -63,25 +63,25 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(keysId, "$Id: rcskeys.c,v 1.7 1995/10/29 19:31:11 peter Exp $") +libId(keysId, "$Id: rcskeys.c,v 1.8 1995/10/29 22:06:24 peter Exp $") -char const *const Keyword[] = { +char 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, - FREEBSD + LOCKER, LOG, NAME, RCSFILE, REVISION, SOURCE, STATE, CVSHEADER, + NULL }; /* Expand all keywords by default */ - static int ExpandKeyword[] = { false, true, true, true, true, - true, true, true, true, true, true, true, - false + true, true, true, true, true, true, true, true, + true }; +enum markers LocalIdMode = Id; enum markers trymatch(string) @@ -98,6 +98,8 @@ trymatch(string) continue; /* try next keyword */ p = Keyword[j]; + if (p == NULL) + continue; s = string; while (*p++ == *s++) { if (!*p) @@ -113,15 +115,18 @@ trymatch(string) return(Nomatch); } + void setIncExc(arg) - char *arg; + char const *arg; /* Sets up the ExpandKeyword table according to command-line flags */ { char *key; + char *copy, *next; int include = 0, j; - arg += 2; - switch (*arg++) { + copy = strdup(arg); + next = copy; + switch (*next++) { case 'e': include = false; break; @@ -129,17 +134,53 @@ setIncExc(arg) include = true; break; default: - return(false); + free(copy); + return; } if (include) for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) ExpandKeyword[j] = false; - key = strtok(arg, ","); + key = strtok(next, ","); while (key) { - for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) + for (j = sizeof(Keyword)/sizeof(*Keyword); (--j); ) { + if (Keyword[j] == NULL) + continue; if (!strcmp(key, Keyword[j])) ExpandKeyword[j] = include; + } key = strtok(NULL, ","); } - return(true); + free(copy); + return; +} + + void +setRCSLocalId(string) + char const *string; +/* function: sets local RCS id and RCSLOCALID envariable */ +{ + static char local_id[keylength+1]; + char *copy, *next, *key; + int j; + + copy = strdup(string); + next = copy; + key = strtok(next, "="); + if (strlen(key) > keylength) + error("LocalId is too long"); + VOID strcpy(local_id, key); + Keyword[LocalId] = local_id; + + /* options? */ + while (key = strtok(NULL, ",")) { + if (!strcmp(key, Keyword[Id])) + LocalIdMode=Id; + else if (!strcmp(key, Keyword[Header])) + LocalIdMode=Header; + else if (!strcmp(key, Keyword[CVSHeader])) + LocalIdMode=CVSHeader; + else + error("Unknown LocalId mode"); + } + free(copy); } diff --git a/gnu/usr.bin/rcs/lib/rcsutil.c b/gnu/usr.bin/rcs/lib/rcsutil.c index 455f054ead2c..34c61e7c7844 100644 --- a/gnu/usr.bin/rcs/lib/rcsutil.c +++ b/gnu/usr.bin/rcs/lib/rcsutil.c @@ -186,7 +186,7 @@ Report problems and direct all questions to: #include "rcsbase.h" -libId(utilId, "$Id: rcsutil.c,v 1.3 1995/10/28 21:49:57 peter Exp $") +libId(utilId, "$Id: rcsutil.c,v 1.4 1995/10/29 22:06:32 peter Exp $") #if !has_memcmp int @@ -1230,8 +1230,15 @@ getRCSINIT(argc, argv, newargv) char **argv, ***newargv; { register char *p, *q, **pp; + char const *ev; size_t n; + if ((ev = cgetenv("RCSLOCALID"))) + setRCSLocalId(ev); + + if ((ev = cgetenv("RCSINCEXC"))) + setIncExc(ev); + if (!(q = cgetenv("RCSINIT"))) *newargv = argv; else { |
