diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-04-14 23:29:02 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-04-14 23:29:02 +0000 |
commit | 8af96e7c660d4c7fe0a43c8a7b9cfbdd5eeb1517 (patch) | |
tree | fd957d074a13b5cb04fa41b240ed6468393f3349 /usr.bin/rcs/rcsprog.c | |
parent | 2ef14b987111198bdbff225245defe33b8d0b5d9 (diff) |
- don't append the extension if it's already there (PR 5076).
- show magic branches in rlog (thanks for that nicer hack niall).
- correct output in rcsdiff, so we perfectly match gnu's
all these bugs were found by sturm@ while he was using cvsweb
(which uses the RCS tools).
"it is in my view that you should put it in" niallo@
Diffstat (limited to 'usr.bin/rcs/rcsprog.c')
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index f4bf4a40a75..5cc47489d97 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.102 2006/04/14 01:11:07 deraadt Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.103 2006/04/14 23:29:01 joris Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -232,7 +232,7 @@ char * rcs_choosefile(const char *filename) { struct stat sb; - char *ext, name[MAXPATHLEN], *next, *ptr, rcsdir[MAXPATHLEN], + char *p, *ext, name[MAXPATHLEN], *next, *ptr, rcsdir[MAXPATHLEN], *ret, *suffixes, rcspath[MAXPATHLEN]; /* If -x flag was not given, use default. */ @@ -294,6 +294,17 @@ rcs_choosefile(const char *filename) for (ret = NULL, next = suffixes; (ext = strsep(&next, "/")) != NULL;) { char fpath[MAXPATHLEN]; + if ((p = strrchr(rcspath, ',')) != NULL) { + if (!strcmp(p, ext)) { + if (stat(rcspath, &sb) == 0) { + ret = xstrdup(rcspath); + goto out; + } + } + + continue; + } + /* Construct RCS file path. */ if (strlcpy(fpath, rcspath, sizeof(fpath)) >= sizeof(fpath) || strlcat(fpath, ext, sizeof(fpath)) >= sizeof(fpath)) @@ -338,7 +349,6 @@ rcs_statfile(char *fname, char *out, size_t len) struct stat st; char *rcspath; - /* XXX - do this in rcs_choosefile? */ if ((rcspath = rcs_choosefile(fname)) == NULL) fatal("rcs_statfile: path truncation"); |