aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-05-11 05:33:08 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-05-11 05:33:08 +0000
commite6da6cbc7d7681ff3eb2154249d0617a9e21672b (patch)
tree539a9d7ff357b456e11a9d248de999a3f79ccba1 /gnu/usr.bin
parentae02ebaab467cfa44d58c3565bb99af5d81cc978 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin')
-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 fd6ce5cb8941d..4165df2c02c00 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 0170d4a2f7124..d3792325a0fb8 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 ee2eafbfa5aed..918f1b9a470db 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 dd13f0bf6a5f3..e3f714bc840f3 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 8ca86e44b3e46..c44d114803a26 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 126e2889a12b0..ebc369e3a0432 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 4cbcda73e03f8..6d0afb3284896 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 58aef7386f29a..3b2a46fcdb394 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 {