From: tholo Date: Sat, 26 Apr 1997 08:33:28 +0000 (+0000) Subject: Allow a private tag when we expand RCS identifiers ourselves as well. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9db208e9116b6e610049f518624078b6c638fc3f;p=openbsd Allow a private tag when we expand RCS identifiers ourselves as well. --- diff --git a/gnu/usr.bin/cvs/src/cvs.h b/gnu/usr.bin/cvs/src/cvs.h index 60a8e8aefa9..d8a3ca3f9cb 100644 --- a/gnu/usr.bin/cvs/src/cvs.h +++ b/gnu/usr.bin/cvs/src/cvs.h @@ -363,6 +363,7 @@ extern int really_quiet, quiet; extern int use_editor; extern int cvswrite; extern mode_t cvsumask; +extern char *RCS_citag; /* Access method specified in CVSroot. */ typedef enum { diff --git a/gnu/usr.bin/cvs/src/main.c b/gnu/usr.bin/cvs/src/main.c index be606cefda2..8b5a7bb81b7 100644 --- a/gnu/usr.bin/cvs/src/main.c +++ b/gnu/usr.bin/cvs/src/main.c @@ -43,6 +43,7 @@ int noexec = FALSE; int readonlyfs = FALSE; int logoff = FALSE; mode_t cvsumask = UMASK_DFLT; +char *RCS_citag = NULL; char *CurDir; @@ -956,9 +957,18 @@ parseopts(root) *q = '\0'; if (!strncmp(buf, "tag=", 4)) { - char *RCS_citag = strdup(buf+4); - char *what = malloc(sizeof("RCSLOCALID")+1+strlen(RCS_citag)+1); - + char *what; + + RCS_citag = strdup(buf+4); + if (RCS_citag == NULL) { + printf("no memory for local tag\n"); + return; + } + what = malloc(sizeof("RCSLOCALID")+1+strlen(RCS_citag)+1); + if (what == NULL) { + printf("no memory for local tag\n"); + return; + } sprintf(what, "RCSLOCALID=%s", RCS_citag); putenv(what); } else if (!strncmp(buf, "umask=", 6)) { diff --git a/gnu/usr.bin/cvs/src/rcs.c b/gnu/usr.bin/cvs/src/rcs.c index 1d0d38a4b89..a56f312c498 100644 --- a/gnu/usr.bin/cvs/src/rcs.c +++ b/gnu/usr.bin/cvs/src/rcs.c @@ -2162,7 +2162,7 @@ struct rcs_keyword size_t len; }; #define KEYWORD_INIT(s) (s), sizeof (s) - 1 -static const struct rcs_keyword keywords[] = +static struct rcs_keyword keywords[] = { { KEYWORD_INIT ("Author") }, { KEYWORD_INIT ("Date") }, @@ -2175,6 +2175,7 @@ static const struct rcs_keyword keywords[] = { KEYWORD_INIT ("Revision") }, { KEYWORD_INIT ("Source") }, { KEYWORD_INIT ("State") }, + { NULL, 0 }, { NULL, 0 } }; enum keyword @@ -2189,7 +2190,8 @@ enum keyword KEYWORD_RCSFILE, KEYWORD_REVISION, KEYWORD_SOURCE, - KEYWORD_STATE + KEYWORD_STATE, + KEYWORD_LOCALID }; /* Convert an RCS date string into a readable string. This is like @@ -2326,6 +2328,11 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen) return; } + if (RCS_citag != NULL && keywords[KEYWORD_LOCALID].string == NULL) { + keywords[KEYWORD_LOCALID].string = RCS_citag; + keywords[KEYWORD_LOCALID].len = strlen(RCS_citag); + } + /* If we are using -kkvl, dig out the locker information if any. */ locker = NULL; if (expand == KFLAG_KVL && rcs->other != NULL) @@ -2450,6 +2457,7 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen) case KEYWORD_HEADER: case KEYWORD_ID: + case KEYWORD_LOCALID: { char *path; int free_path;