summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/rcs
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-05-11 05:33:08 +0000
committerpeter <peter@FreeBSD.org>1997-05-11 05:33:08 +0000
commit5998a776b157a6ed6a0cb8d21b84e9316372e8ac (patch)
tree08573ef694cb1d7b64eda5892deb7c1206aa7e4f /gnu/usr.bin/rcs
parentd6965698fb1416979654ee302b57fefd2027daf3 (diff)
downloadFreeBSD-src-5998a776b157a6ed6a0cb8d21b84e9316372e8ac.zip
FreeBSD-src-5998a776b157a6ed6a0cb8d21b84e9316372e8ac.tar.gz
After looking around at what the other *BSD's do for their $xxxBSD$ tags,
take the easy way out and implement the beginnings of something similar. Don't worry, the code here is *dormant* so far, some "help" from cvs is required. This is going in now so that jdp can see what I'm working on. This is an extension of the previous existing skeleton $FreeBSD$ code.
Diffstat (limited to 'gnu/usr.bin/rcs')
-rw-r--r--gnu/usr.bin/rcs/co/co.c9
-rw-r--r--gnu/usr.bin/rcs/lib/Makefile6
-rw-r--r--gnu/usr.bin/rcs/lib/rcsbase.h15
-rw-r--r--gnu/usr.bin/rcs/lib/rcsedit.c17
-rw-r--r--gnu/usr.bin/rcs/lib/rcsfnms.c35
-rw-r--r--gnu/usr.bin/rcs/lib/rcskeep.c3
-rw-r--r--gnu/usr.bin/rcs/lib/rcskeys.c69
-rw-r--r--gnu/usr.bin/rcs/lib/rcsutil.c9
8 files changed, 124 insertions, 39 deletions
diff --git a/gnu/usr.bin/rcs/co/co.c b/gnu/usr.bin/rcs/co/co.c
index fd6ce5c..4165df2 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$")
+mainProg(coId, "co", "$Id: co.c,v 1.8 1997/02/22 15:47:21 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$")
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 0170d4a..d379232 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 ee2eafb..918f1b9 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$"
+#define RCSBASE "$Id: rcsbase.h,v 1.8 1997/02/22 15:47:33 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 dd13f0b..e3f714b 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$")
+libId(editId, "$Id: rcsedit.c,v 1.8 1997/02/22 15:47:35 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 8ca86e4..c44d114 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$")
+libId(fnmsId, "$Id: rcsfnms.c,v 1.6 1997/02/22 15:47:36 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));
@@ -867,6 +867,39 @@ getfullRCSname()
}
}
+ char const *
+getfullCVSname()
+/*
+ * Return a pointer to the fill pathname of the RCS file, but trim $CVSROOT.
+ */
+{
+ char const *CVSname;
+ char const *cvsroot;
+ int rootlen;
+
+ CVSname = getfullRCSname();
+ cvsroot = getenv("CVSROOT");
+
+ if (cvsroot) {
+ rootlen = strlen(cvsroot);
+ /* ignore trailing '/' chars from $CVSROOT */
+ while (rootlen > 0) {
+ if (cvsroot[rootlen - 1] == '/')
+ rootlen--;
+ else
+ break;
+ }
+ if (strncmp(CVSname, cvsroot, rootlen) == 0) {
+ CVSname += rootlen;
+ /* skip any leading '/' chars */
+ while (*CVSname == '/')
+ CVSname++;
+ return CVSname;
+ }
+ }
+ return CVSname;
+}
+
static size_t
dir_useful_len(d)
char const *d;
diff --git a/gnu/usr.bin/rcs/lib/rcskeep.c b/gnu/usr.bin/rcs/lib/rcskeep.c
index 126e288..ebc369e 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$")
+libId(keepId, "$Id: rcskeep.c,v 1.6 1997/02/22 15:47:38 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 4cbcda7..6d0afb3 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$")
+libId(keysId, "$Id: rcskeys.c,v 1.10 1997/02/22 15:47:38 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 58aef73..3b2a46f 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$")
+libId(utilId, "$Id: rcsutil.c,v 1.6 1997/02/22 15:47:43 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 {
OpenPOWER on IntegriCloud