version 1.15, 2005/02/17 16:09:03 |
version 1.16, 2005/04/16 19:05:02 |
|
|
struct cvsroot* |
struct cvsroot* |
cvsroot_get(const char *dir) |
cvsroot_get(const char *dir) |
{ |
{ |
|
int l; |
size_t len; |
size_t len; |
char rootpath[MAXPATHLEN], *rootstr, line[128]; |
char rootpath[MAXPATHLEN], *rootstr, line[128]; |
FILE *fp; |
FILE *fp; |
|
|
if (cvs_rootstr != NULL) |
if (cvs_rootstr != NULL) |
return cvsroot_parse(cvs_rootstr); |
return cvsroot_parse(cvs_rootstr); |
|
|
snprintf(rootpath, sizeof(rootpath), "%s/" CVS_PATH_ROOTSPEC, dir); |
l = snprintf(rootpath, sizeof(rootpath), "%s/" CVS_PATH_ROOTSPEC, dir); |
|
if (l == -1 || l >= (int)sizeof(rootpath)) { |
|
errno = ENAMETOOLONG; |
|
cvs_log(LP_ERRNO, "%s", rootpath); |
|
return (NULL); |
|
} |
|
|
fp = fopen(rootpath, "r"); |
fp = fopen(rootpath, "r"); |
if (fp == NULL) { |
if (fp == NULL) { |
if (errno == ENOENT) { |
if (errno == ENOENT) { |