diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-12-19 11:46:40 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-12-19 11:46:40 +0000 |
commit | 830b3da8bcd9664623a1ec0266ad5375f12054ee (patch) | |
tree | 1ed7840fc79add9d5af20511d842e64d40e09b45 /usr.bin | |
parent | 10f0fbacbf47f76338f2fe5572c63c96da5bb222 (diff) |
add client-side support for Clear-static-directory, Clear-sticky and
Set-sticky requests. Set-sticky needs more work though.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/client.c | 74 | ||||
-rw-r--r-- | usr.bin/cvs/remote.h | 5 | ||||
-rw-r--r-- | usr.bin/cvs/server.c | 8 |
3 files changed, 81 insertions, 6 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index bc6c6bf1e82..74d6cf4f3b5 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.34 2006/12/15 15:40:28 xsa Exp $ */ +/* $OpenBSD: client.c,v 1.35 2006/12/19 11:46:39 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -739,6 +739,78 @@ cvs_client_remove_entry(char *data) dir = cvs_remote_input(); xfree(dir); } + +void +cvs_client_clear_static_directory(char *data) +{ + char *dir, *fpath; + + if (cvs_cmdop == CVS_OP_EXPORT) + return; + + STRIP_SLASH(data); + + dir = cvs_remote_input(); + xfree(dir); + + fpath = xmalloc(MAXPATHLEN); + if (cvs_path_cat(data, CVS_PATH_STATICENTRIES, fpath, MAXPATHLEN) >= + MAXPATHLEN) + fatal("cvs_client_clear_static_directory: truncation"); + + (void)cvs_unlink(fpath); + + xfree(fpath); +} + +void +cvs_client_set_sticky(char *data) +{ + FILE *fp; + char *dir, *tag, *tagpath; + + STRIP_SLASH(data); + + dir = cvs_remote_input(); + xfree(dir); + tag = cvs_remote_input(); + + tagpath = xmalloc(MAXPATHLEN); + if (cvs_path_cat(data, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) + fatal("cvs_client_clear_sticky: truncation"); + + if ((fp = fopen(tagpath, "w+")) == NULL) { + cvs_log(LP_ERRNO, "%s", tagpath); + goto out; + } + + (void)fprintf(fp, "%s\n", tag); + (void)fclose(fp); +out: + xfree(tagpath); + xfree(tag); +} + +void +cvs_client_clear_sticky(char *data) +{ + char *dir, *tagpath; + + STRIP_SLASH(data); + + dir = cvs_remote_input(); + xfree(dir); + + tagpath = xmalloc(MAXPATHLEN); + if (cvs_path_cat(data, CVS_PATH_TAG, tagpath, MAXPATHLEN) >= MAXPATHLEN) + fatal("cvs_client_clear_sticky: truncation"); + + (void)cvs_unlink(tagpath); + + xfree(tagpath); +} + + /* * cvs_client_initlog() * diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h index d54308193ab..24f14052530 100644 --- a/usr.bin/cvs/remote.h +++ b/usr.bin/cvs/remote.h @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.h,v 1.12 2006/12/15 13:12:14 xsa Exp $ */ +/* $OpenBSD: remote.h,v 1.13 2006/12/19 11:46:39 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -53,6 +53,9 @@ void cvs_client_updated(char *); void cvs_client_merged(char *); void cvs_client_removed(char *); void cvs_client_remove_entry(char *); +void cvs_client_clear_static_directory(char *); +void cvs_client_set_sticky(char *); +void cvs_client_clear_sticky(char *); void cvs_client_senddir(const char *); void cvs_client_sendfile(struct cvs_file *); diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c index f8ffcf288e3..89eda3b169c 100644 --- a/usr.bin/cvs/server.c +++ b/usr.bin/cvs/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.44 2006/12/15 13:12:14 xsa Exp $ */ +/* $OpenBSD: server.c,v 1.45 2006/12/19 11:46:39 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -34,6 +34,9 @@ struct cvs_resp cvs_responses[] = { { "Merged", 0, cvs_client_merged, RESP_NEEDED }, { "Removed", 0, cvs_client_removed, RESP_NEEDED }, { "Remove-entry", 0, cvs_client_remove_entry, RESP_NEEDED }, + { "Clear-static-directory", 0, cvs_client_clear_static_directory, RESP_NEEDED }, + { "Set-sticky", 0, cvs_client_set_sticky, RESP_NEEDED }, + { "Clear-sticky", 0, cvs_client_clear_sticky, RESP_NEEDED }, /* unsupported responses until told otherwise */ { "New-entry", 0, NULL, 0 }, @@ -46,9 +49,6 @@ struct cvs_resp cvs_responses[] = { { "Checksum", 0, NULL, 0 }, { "Copy-file", 0, NULL, 0 }, { "Set-static-directory", 0, NULL, 0 }, - { "Clear-static-directory", 0, NULL, 0 }, - { "Set-sticky", 0, NULL, 0 }, - { "Clear-sticky", 0, NULL, 0 }, { "Template", 0, NULL, 0 }, { "Set-checkin-prog", 0, NULL, 0 }, { "Set-update-prog", 0, NULL, 0 }, |