diff options
Diffstat (limited to 'usr.bin/cvs/add.c')
-rw-r--r-- | usr.bin/cvs/add.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c index 8508d064d0a..bcf73266f72 100644 --- a/usr.bin/cvs/add.c +++ b/usr.bin/cvs/add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add.c,v 1.93 2008/02/06 18:12:28 tobias Exp $ */ +/* $OpenBSD: add.c,v 1.94 2008/02/09 20:04:00 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> @@ -122,16 +122,19 @@ cvs_add(int argc, char **argv) void cvs_add_entry(struct cvs_file *cf) { - char entry[CVS_ENT_MAXLINELEN]; + char *entry; CVSENTRIES *entlist; if (cf->file_type == CVS_DIR) { - (void)xsnprintf(entry, CVS_ENT_MAXLINELEN, - "D/%s////", cf->file_name); + entry = xmalloc(CVS_ENT_MAXLINELEN); + cvs_ent_line_str(cf->file_name, NULL, NULL, NULL, NULL, 1, 0, + entry, CVS_ENT_MAXLINELEN); entlist = cvs_ent_open(cf->file_wd); cvs_ent_add(entlist, entry); cvs_ent_close(entlist, ENT_SYNC); + + xfree(entry); } else { add_entry(cf); } @@ -241,8 +244,9 @@ add_directory(struct cvs_file *cf) entry, tag, date); p = xmalloc(CVS_ENT_MAXLINELEN); - (void)xsnprintf(p, CVS_ENT_MAXLINELEN, - "D/%s////", cf->file_name); + cvs_ent_line_str(cf->file_name, NULL, NULL, NULL, + NULL, 1, 0, p, CVS_ENT_MAXLINELEN); + entlist = cvs_ent_open(cf->file_wd); cvs_ent_add(entlist, p); cvs_ent_close(entlist, ENT_SYNC); @@ -376,7 +380,7 @@ static void add_entry(struct cvs_file *cf) { FILE *fp; - char entry[CVS_ENT_MAXLINELEN], path[MAXPATHLEN]; + char *entry, path[MAXPATHLEN]; char revbuf[CVS_REV_BUFSZ], tbuf[CVS_TIME_BUFSZ]; char sticky[CVS_ENT_MAXLINELEN]; CVSENTRIES *entlist; @@ -385,6 +389,7 @@ add_entry(struct cvs_file *cf) return; sticky[0] = '\0'; + entry = xmalloc(CVS_ENT_MAXLINELEN); if (cf->file_status == FILE_REMOVED) { rcsnum_tostr(cf->file_ent->ce_rev, revbuf, sizeof(revbuf)); @@ -397,9 +402,9 @@ add_entry(struct cvs_file *cf) cf->file_ent->ce_tag); /* Remove the '-' prefixing the version number. */ - (void)xsnprintf(entry, CVS_ENT_MAXLINELEN, - "/%s/%s/%s/%s/%s", cf->file_name, revbuf, tbuf, - cf->file_ent->ce_opts ? cf->file_ent->ce_opts : "", sticky); + cvs_ent_line_str(cf->file_name, revbuf, tbuf, + cf->file_ent->ce_opts ? cf->file_ent->ce_opts : "", sticky, + 0, 0, entry, CVS_ENT_MAXLINELEN); } else { if (logmsg != NULL) { (void)xsnprintf(path, MAXPATHLEN, "%s/%s%s", @@ -426,9 +431,9 @@ add_entry(struct cvs_file *cf) (void)xsnprintf(tbuf, sizeof(tbuf), "Initial %s", cf->file_name); - (void)xsnprintf(entry, CVS_ENT_MAXLINELEN, - "/%s/0/%s/%s/%s", cf->file_name, tbuf, kflag ? kbuf : "", - sticky); + + cvs_ent_line_str(cf->file_name, "0", tbuf, kflag ? kbuf : "", + sticky, 0, 0, entry, CVS_ENT_MAXLINELEN); } if (cvs_server_active) { @@ -440,4 +445,5 @@ add_entry(struct cvs_file *cf) cvs_ent_add(entlist, entry); cvs_ent_close(entlist, ENT_SYNC); } + xfree(entry); } |