diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-12-19 14:11:22 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-12-19 14:11:22 +0000 |
commit | 3fbfd4061e674669c05243d47974d754b0bdfec9 (patch) | |
tree | 9a9a21376640fbecf6c701241a0addba07b823a4 | |
parent | 7f29cd36065471fc0ec53fb8bb5ccda172b2797a (diff) |
add client-side support for Set-static-directory.
-rw-r--r-- | usr.bin/cvs/client.c | 30 | ||||
-rw-r--r-- | usr.bin/cvs/remote.h | 3 | ||||
-rw-r--r-- | usr.bin/cvs/server.c | 4 |
3 files changed, 33 insertions, 4 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index 74d6cf4f3b5..ce5792617bd 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.35 2006/12/19 11:46:39 xsa Exp $ */ +/* $OpenBSD: client.c,v 1.36 2006/12/19 14:11:21 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -741,6 +741,34 @@ cvs_client_remove_entry(char *data) } void +cvs_client_set_static_directory(char *data) +{ + FILE *fp; + 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_set_static_directory: truncation"); + + if ((fp = fopen(fpath, "w+")) == NULL) { + cvs_log(LP_ERRNO, "%s", fpath); + goto out; + } + (void)fclose(fp); +out: + xfree(fpath); +} + +void cvs_client_clear_static_directory(char *data) { char *dir, *fpath; diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h index 24f14052530..d53ea308ca1 100644 --- a/usr.bin/cvs/remote.h +++ b/usr.bin/cvs/remote.h @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.h,v 1.13 2006/12/19 11:46:39 xsa Exp $ */ +/* $OpenBSD: remote.h,v 1.14 2006/12/19 14:11:21 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -53,6 +53,7 @@ void cvs_client_updated(char *); void cvs_client_merged(char *); void cvs_client_removed(char *); void cvs_client_remove_entry(char *); +void cvs_client_set_static_directory(char *); void cvs_client_clear_static_directory(char *); void cvs_client_set_sticky(char *); void cvs_client_clear_sticky(char *); diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c index 89eda3b169c..1cc91a8f058 100644 --- a/usr.bin/cvs/server.c +++ b/usr.bin/cvs/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.45 2006/12/19 11:46:39 xsa Exp $ */ +/* $OpenBSD: server.c,v 1.46 2006/12/19 14:11:21 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -34,6 +34,7 @@ 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 }, + { "Set-static-directory", 0, cvs_client_set_static_directory, 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 }, @@ -48,7 +49,6 @@ struct cvs_resp cvs_responses[] = { { "Mod-time", 0, NULL, 0 }, { "Checksum", 0, NULL, 0 }, { "Copy-file", 0, NULL, 0 }, - { "Set-static-directory", 0, NULL, 0 }, { "Template", 0, NULL, 0 }, { "Set-checkin-prog", 0, NULL, 0 }, { "Set-update-prog", 0, NULL, 0 }, |