version 1.68, 2007/01/24 13:55:11 |
version 1.69, 2007/01/25 18:56:33 |
|
|
FILE *fp; |
FILE *fp; |
int linenum; |
int linenum; |
size_t len; |
size_t len; |
char linebuf[128], *tagpath; |
char linebuf[128], tagpath[MAXPATHLEN]; |
|
|
if (tagp != NULL) |
if (tagp != NULL) |
*tagp = NULL; |
*tagp = NULL; |
|
|
if (nbp != NULL) |
if (nbp != NULL) |
*nbp = 0; |
*nbp = 0; |
|
|
tagpath = xmalloc(MAXPATHLEN); |
|
|
|
if (cvs_path_cat(dir, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) |
if (cvs_path_cat(dir, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) |
goto out; |
return; |
|
|
if ((fp = fopen(tagpath, "r")) == NULL) { |
if ((fp = fopen(tagpath, "r")) == NULL) { |
if (errno != ENOENT) |
if (errno != ENOENT) |
cvs_log(LP_NOTICE, "failed to open `%s' : %s", tagpath, |
cvs_log(LP_NOTICE, "failed to open `%s' : %s", tagpath, |
strerror(errno)); |
strerror(errno)); |
goto out; |
return; |
} |
} |
|
|
linenum = 0; |
linenum = 0; |
|
|
cvs_log(LP_NOTICE, "failed to read line from `%s'", tagpath); |
cvs_log(LP_NOTICE, "failed to read line from `%s'", tagpath); |
|
|
(void)fclose(fp); |
(void)fclose(fp); |
out: |
|
xfree(tagpath); |
|
} |
} |
|
|
void |
void |
cvs_write_tagfile(char *dir, char *tag, char *date, int nb) |
cvs_write_tagfile(char *dir, char *tag, char *date, int nb) |
{ |
{ |
FILE *fp; |
FILE *fp; |
char *tagpath; |
char tagpath[MAXPATHLEN]; |
|
|
if (cvs_noexec == 1) |
if (cvs_noexec == 1) |
return; |
return; |
|
|
tagpath = xmalloc(MAXPATHLEN); |
|
|
|
if (cvs_path_cat(dir, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) |
if (cvs_path_cat(dir, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) |
goto out; |
return; |
|
|
if ((tag != NULL) || (date != NULL)) { |
if ((tag != NULL) || (date != NULL)) { |
if ((fp = fopen(tagpath, "w+")) == NULL) { |
if ((fp = fopen(tagpath, "w+")) == NULL) { |
|
|
cvs_log(LP_NOTICE, "failed to open `%s' : %s", |
cvs_log(LP_NOTICE, "failed to open `%s' : %s", |
tagpath, strerror(errno)); |
tagpath, strerror(errno)); |
} |
} |
goto out; |
return; |
} |
} |
if (tag != NULL) { |
if (tag != NULL) { |
if (nb != 0) |
if (nb != 0) |
|
|
(void)fclose(fp); |
(void)fclose(fp); |
} else { |
} else { |
(void)cvs_unlink(tagpath); |
(void)cvs_unlink(tagpath); |
goto out; |
|
} |
} |
out: |
|
xfree(tagpath); |
|
} |
} |