aboutsummaryrefslogtreecommitdiff
path: root/contrib/cvs
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-08-19 11:21:34 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-08-19 11:21:34 +0000
commitf9d4cf805b9f202358a7aa16a83fefb128271490 (patch)
treedf92155e4dd8f4cd236f211c6e4714f0e6ea740e /contrib/cvs
parent441de788b11fa278901a2250f0b70da7c9f61719 (diff)
downloadsrc-f9d4cf805b9f202358a7aa16a83fefb128271490.tar.gz
src-f9d4cf805b9f202358a7aa16a83fefb128271490.zip
Redo the $CVSHeader$ support to use code similar to that from David Dawes
but adapted to run within cvs instead of rcs. The stuff I hacked together didn't strip out "/Attic/" for files on branches when the HEAD version was cvs rm'ed.
Notes
Notes: svn path=/head/; revision=28409
Diffstat (limited to 'contrib/cvs')
-rw-r--r--contrib/cvs/src/rcs.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/contrib/cvs/src/rcs.c b/contrib/cvs/src/rcs.c
index 834acd9a7883..7e80557d2b98 100644
--- a/contrib/cvs/src/rcs.c
+++ b/contrib/cvs/src/rcs.c
@@ -41,7 +41,7 @@ enum rcs_delta_op {RCS_ANNOTATE, RCS_FETCH};
static void RCS_deltas PROTO ((RCSNode *, FILE *, char *, enum rcs_delta_op,
char **, size_t *, char **, size_t *));
-static char * getfullCVSname PROTO ((char *));
+static char * getfullCVSname PROTO ((char *, char **));
/*
* We don't want to use isspace() from the C library because:
@@ -2487,7 +2487,9 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen)
char *path;
int free_path;
char *date;
+ char *old_path;
+ old_path = NULL;
if (kw == KEYWORD_HEADER ||
(kw == KEYWORD_LOCALID &&
keyword_local == KEYWORD_HEADER))
@@ -2495,9 +2497,10 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen)
else if (kw == KEYWORD_CVSHEADER ||
(kw == KEYWORD_LOCALID &&
keyword_local == KEYWORD_CVSHEADER))
- path = getfullCVSname(rcs->path);
+ path = getfullCVSname(rcs->path, &old_path);
else
path = last_component (rcs->path);
+ printf("path: `%s'\n", path);
path = escape_keyword_value (path, &free_path);
date = printable_date (ver->date);
value = xmalloc (strlen (path)
@@ -2515,6 +2518,8 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen)
locker != NULL ? locker : "");
if (free_path)
free (path);
+ if (old_path)
+ free (old_path);
free (date);
free_value = 1;
}
@@ -4373,28 +4378,35 @@ RCS_setincexc (arg)
return;
}
+#define ATTIC "/" CVSATTIC
static char *
-getfullCVSname(CVSname)
- char *CVSname;
+getfullCVSname(CVSname, pathstore)
+ char *CVSname, **pathstore;
{
- int rootlen;
-
if (CVSroot_directory) {
- rootlen = strlen(CVSroot_directory);
- /* ignore trailing '/' chars from $CVSROOT */
- while (rootlen > 0) {
- if (CVSroot_directory[rootlen - 1] == '/')
- rootlen--;
- else
- break;
- }
- if (strncmp(CVSname, CVSroot_directory, rootlen) == 0) {
- CVSname += rootlen;
- /* skip any leading '/' chars */
- while (*CVSname == '/')
- CVSname++;
- return CVSname;
+ int rootlen;
+ char *c = NULL;
+ int alen = sizeof(ATTIC) - 1;
+
+ *pathstore = xstrdup(CVSname);
+ if ((c = strrchr(*pathstore, '/')) != NULL) {
+ if (alen >= *pathstore - c) {
+ if (!strncmp(c - alen, ATTIC, alen)) {
+ while (*c != '\0') {
+ *(c - alen) = *c;
+ c++;
+ }
+ *(c - alen) = '\0';
+ }
+ }
}
+
+ rootlen = strlen(CVSroot_directory);
+ if (!strncmp(*pathstore, CVSroot_directory, rootlen) &&
+ (*pathstore)[rootlen] == '/')
+ CVSname = (*pathstore + rootlen + 1);
+ else
+ CVSname = (*pathstore);
}
return CVSname;
}