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/cvs/client.c | |
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/cvs/client.c')
-rw-r--r-- | usr.bin/cvs/client.c | 74 |
1 files changed, 73 insertions, 1 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() * |