version 1.102, 2006/04/14 01:11:07 |
version 1.103, 2006/04/14 23:29:01 |
|
|
rcs_choosefile(const char *filename) |
rcs_choosefile(const char *filename) |
{ |
{ |
struct stat sb; |
struct stat sb; |
char *ext, name[MAXPATHLEN], *next, *ptr, rcsdir[MAXPATHLEN], |
char *p, *ext, name[MAXPATHLEN], *next, *ptr, rcsdir[MAXPATHLEN], |
*ret, *suffixes, rcspath[MAXPATHLEN]; |
*ret, *suffixes, rcspath[MAXPATHLEN]; |
|
|
/* If -x flag was not given, use default. */ |
/* If -x flag was not given, use default. */ |
|
|
for (ret = NULL, next = suffixes; (ext = strsep(&next, "/")) != NULL;) { |
for (ret = NULL, next = suffixes; (ext = strsep(&next, "/")) != NULL;) { |
char fpath[MAXPATHLEN]; |
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. */ |
/* Construct RCS file path. */ |
if (strlcpy(fpath, rcspath, sizeof(fpath)) >= sizeof(fpath) || |
if (strlcpy(fpath, rcspath, sizeof(fpath)) >= sizeof(fpath) || |
strlcat(fpath, ext, sizeof(fpath)) >= sizeof(fpath)) |
strlcat(fpath, ext, sizeof(fpath)) >= sizeof(fpath)) |
|
|
struct stat st; |
struct stat st; |
char *rcspath; |
char *rcspath; |
|
|
/* XXX - do this in rcs_choosefile? */ |
|
if ((rcspath = rcs_choosefile(fname)) == NULL) |
if ((rcspath = rcs_choosefile(fname)) == NULL) |
fatal("rcs_statfile: path truncation"); |
fatal("rcs_statfile: path truncation"); |
|
|