version 1.73, 2007/01/27 21:18:17 |
version 1.74, 2007/01/31 21:07:35 |
|
|
"invalid RCS keyword expension mode"); |
"invalid RCS keyword expension mode"); |
fatal("%s", cvs_cmd_add.cmd_synopsis); |
fatal("%s", cvs_cmd_add.cmd_synopsis); |
} |
} |
snprintf(kbuf, sizeof(kbuf), "-k%s", koptstr); |
(void)xsnprintf(kbuf, sizeof(kbuf), "-k%s", koptstr); |
break; |
break; |
case 'm': |
case 'm': |
logmsg = xstrdup(optarg); |
logmsg = xstrdup(optarg); |
|
|
void |
void |
cvs_add_entry(struct cvs_file *cf) |
cvs_add_entry(struct cvs_file *cf) |
{ |
{ |
int l; |
|
char entry[CVS_ENT_MAXLINELEN]; |
char entry[CVS_ENT_MAXLINELEN]; |
CVSENTRIES *entlist; |
CVSENTRIES *entlist; |
|
|
if (cf->file_type == CVS_DIR) { |
if (cf->file_type == CVS_DIR) { |
l = snprintf(entry, CVS_ENT_MAXLINELEN, |
(void)xsnprintf(entry, CVS_ENT_MAXLINELEN, |
"D/%s/////", cf->file_name); |
"D/%s/////", cf->file_name); |
if (l == -1 || l >= CVS_ENT_MAXLINELEN) |
|
fatal("cvs_add_entry: overflow"); |
|
|
|
entlist = cvs_ent_open(cf->file_wd); |
entlist = cvs_ent_open(cf->file_wd); |
cvs_ent_add(entlist, entry); |
cvs_ent_add(entlist, entry); |
|
|
static void |
static void |
add_directory(struct cvs_file *cf) |
add_directory(struct cvs_file *cf) |
{ |
{ |
int l, added, nb; |
int added, nb; |
struct stat st; |
struct stat st; |
CVSENTRIES *entlist; |
CVSENTRIES *entlist; |
char *date, entry[MAXPATHLEN], msg[1024], repo[MAXPATHLEN], *tag, *p; |
char *date, entry[MAXPATHLEN], msg[1024], repo[MAXPATHLEN], *tag, *p; |
|
|
cvs_log(LP_TRACE, "add_directory(%s)", cf->file_path); |
cvs_log(LP_TRACE, "add_directory(%s)", cf->file_path); |
|
|
l = snprintf(entry, MAXPATHLEN, "%s%s", cf->file_rpath, RCS_FILE_EXT); |
(void)xsnprintf(entry, MAXPATHLEN, "%s%s", |
if (l == -1 || l >= MAXPATHLEN) |
cf->file_rpath, RCS_FILE_EXT); |
fatal("cvs_add_local: overflow"); |
|
|
|
added = 1; |
added = 1; |
if (stat(entry, &st) != -1) { |
if (stat(entry, &st) != -1) { |
|
|
entry, tag, date, nb); |
entry, tag, date, nb); |
|
|
p = xmalloc(CVS_ENT_MAXLINELEN); |
p = xmalloc(CVS_ENT_MAXLINELEN); |
l = snprintf(p, CVS_ENT_MAXLINELEN, |
(void)xsnprintf(p, CVS_ENT_MAXLINELEN, |
"D/%s/////", cf->file_name); |
"D/%s/////", cf->file_name); |
entlist = cvs_ent_open(cf->file_wd); |
entlist = cvs_ent_open(cf->file_wd); |
cvs_ent_add(entlist, p); |
cvs_ent_add(entlist, p); |
|
|
} |
} |
|
|
if (added == 1) { |
if (added == 1) { |
snprintf(msg, sizeof(msg), |
(void)xsnprintf(msg, sizeof(msg), |
"Directory %s added to the repository", cf->file_rpath); |
"Directory %s added to the repository", cf->file_rpath); |
|
|
if (tag != NULL) { |
if (tag != NULL) { |
|
|
add_entry(struct cvs_file *cf) |
add_entry(struct cvs_file *cf) |
{ |
{ |
FILE *fp; |
FILE *fp; |
int l; |
|
char entry[CVS_ENT_MAXLINELEN], path[MAXPATHLEN], revbuf[16], tbuf[32]; |
char entry[CVS_ENT_MAXLINELEN], path[MAXPATHLEN], revbuf[16], tbuf[32]; |
CVSENTRIES *entlist; |
CVSENTRIES *entlist; |
|
|
|
|
tbuf[strlen(tbuf) - 1] = '\0'; |
tbuf[strlen(tbuf) - 1] = '\0'; |
|
|
/* Remove the '-' prefixing the version number. */ |
/* Remove the '-' prefixing the version number. */ |
l = snprintf(entry, CVS_ENT_MAXLINELEN, |
(void)xsnprintf(entry, CVS_ENT_MAXLINELEN, |
"/%s/%s/%s/%s/", cf->file_name, revbuf, tbuf, |
"/%s/%s/%s/%s/", cf->file_name, revbuf, tbuf, |
cf->file_ent->ce_opts ? cf->file_ent->ce_opts : ""); |
cf->file_ent->ce_opts ? cf->file_ent->ce_opts : ""); |
if (l == -1 || l >= CVS_ENT_MAXLINELEN) |
|
fatal("add_entry: truncation"); |
|
} else { |
} else { |
if (logmsg != NULL) { |
if (logmsg != NULL) { |
l = snprintf(path, MAXPATHLEN, "%s/%s%s", |
(void)xsnprintf(path, MAXPATHLEN, "%s/%s%s", |
CVS_PATH_CVSDIR, cf->file_name, CVS_DESCR_FILE_EXT); |
CVS_PATH_CVSDIR, cf->file_name, CVS_DESCR_FILE_EXT); |
if (l == -1 || l >= MAXPATHLEN) |
|
fatal("add_entry: truncation"); |
|
|
|
if ((fp = fopen(path, "w+")) == NULL) |
if ((fp = fopen(path, "w+")) == NULL) |
fatal("add_entry: fopen `%s': %s", |
fatal("add_entry: fopen `%s': %s", |
|
|
(void)fclose(fp); |
(void)fclose(fp); |
} |
} |
|
|
l = snprintf(entry, CVS_ENT_MAXLINELEN, |
(void)xsnprintf(entry, CVS_ENT_MAXLINELEN, |
"/%s/0/Initial %s/%s/", cf->file_name, cf->file_name, |
"/%s/0/Initial %s/%s/", cf->file_name, cf->file_name, |
(kflag != RCS_KWEXP_DEFAULT) ? kbuf : ""); |
(kflag != RCS_KWEXP_DEFAULT) ? kbuf : ""); |
if (l == -1 || l >= CVS_ENT_MAXLINELEN) |
|
fatal("add_entry: truncation"); |
|
} |
} |
|
|
entlist = cvs_ent_open(cf->file_wd); |
entlist = cvs_ent_open(cf->file_wd); |