aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/rcs/lib/rcskeys.c
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/rcs/lib/rcskeys.c
parentae02ebaab467cfa44d58c3565bb99af5d81cc978 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin/rcs/lib/rcskeys.c')
-rw-r--r--gnu/usr.bin/rcs/lib/rcskeys.c69
1 files changed, 55 insertions, 14 deletions
diff --git a/gnu/usr.bin/rcs/lib/rcskeys.c b/gnu/usr.bin/rcs/lib/rcskeys.c
index 4cbcda73e03f..6d0afb328489 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);
}