diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-12-19 15:13:00 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-12-19 15:13:00 +0000 |
commit | b48f7c652516d74d3c0efbb33a5a4bb55cae6bef (patch) | |
tree | d64e03d952b94fece518fe4235b5206cd143c0d1 /usr.bin/cvs/add.c | |
parent | e73a0e699c57f06d47ec44ec7eb9e9958892d616 (diff) |
- Introduce a way for the command code to recognize what the server replied.
- Modify the add command so it uses the above method to correctly enter
added files in CVS/Entries if in a remote setup.
ok xsa@
... And no a shark didnt eat me.
Diffstat (limited to 'usr.bin/cvs/add.c')
-rw-r--r-- | usr.bin/cvs/add.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c index e0930e5099e..13025a8fe41 100644 --- a/usr.bin/cvs/add.c +++ b/usr.bin/cvs/add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add.c,v 1.62 2006/12/04 09:51:21 xsa Exp $ */ +/* $OpenBSD: add.c,v 1.63 2006/12/19 15:12:59 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> @@ -26,6 +26,7 @@ extern char *__progname; void cvs_add_local(struct cvs_file *); +void cvs_add_entry(struct cvs_file *); static void add_directory(struct cvs_file *); static void add_file(struct cvs_file *); @@ -89,12 +90,36 @@ cvs_add(int argc, char **argv) cvs_client_senddir("."); cvs_client_send_request("add"); cvs_client_get_responses(); + + if (server_response == SERVER_OK) { + cr.fileproc = cvs_add_entry; + cvs_file_run(argc, argv, &cr); + } } return (0); } void +cvs_add_entry(struct cvs_file *cf) +{ + int l; + char *entry; + CVSENTRIES *entlist; + + if (cf->file_type == CVS_DIR) { + entry = xmalloc(CVS_ENT_MAXLINELEN); + l = snprintf(entry, CVS_ENT_MAXLINELEN, + "D/%s/////", cf->file_name); + entlist = cvs_ent_open(cf->file_wd); + cvs_ent_add(entlist, entry); + cvs_ent_close(entlist, ENT_SYNC); + } else { + add_entry(cf); + } +} + +void cvs_add_local(struct cvs_file *cf) { cvs_log(LP_TRACE, "cvs_add_local(%s)", cf->file_path); |