diff options
-rw-r--r-- | usr.bin/cvs/edit.c | 92 | ||||
-rw-r--r-- | usr.bin/cvs/watch.c | 92 |
2 files changed, 184 insertions, 0 deletions
diff --git a/usr.bin/cvs/edit.c b/usr.bin/cvs/edit.c new file mode 100644 index 00000000000..0a753edf1cd --- /dev/null +++ b/usr.bin/cvs/edit.c @@ -0,0 +1,92 @@ +/* $OpenBSD: edit.c,v 1.14 2007/01/02 13:51:13 xsa Exp $ */ +/* + * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "includes.h" + +#include "cvs.h" +#include "log.h" +#include "remote.h" + +static void cvs_editors_local(struct cvs_file *); + +struct cvs_cmd cvs_cmd_editors = { + CVS_OP_EDITORS, 0, "editors", + { }, + "See who is editing a watched file", + "[-lR] [file ...]", + "lR", + NULL, + cvs_editors +}; + +int +cvs_editors(int argc, char **argv) +{ + int ch; + int flags; + struct cvs_recursion cr; + + flags = CR_RECURSE_DIRS; + + while ((ch = getopt(argc, argv, cvs_cmd_editors.cmd_opts)) != -1) { + switch (ch) { + case 'l': + flags &= ~CR_RECURSE_DIRS; + break; + case 'R': + break; + default: + fatal("%s", cvs_cmd_editors.cmd_synopsis); + } + } + + argc -= optind; + argv += optind; + + if (argc == 0) + fatal("%s", cvs_cmd_editors.cmd_synopsis); + + cr.enterdir = NULL; + cr.leavedir = NULL; + + if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cr.fileproc = cvs_client_sendfile; + + if (!(flags & CR_RECURSE_DIRS)) + cvs_client_send_request("Argument -l"); + } else { + cr.fileproc = cvs_editors_local; + } + + cr.flags = flags; + + cvs_file_run(argc, argv, &cr); + + if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_send_files(argv, argc); + cvs_client_senddir("."); + cvs_client_send_request("editors"); + cvs_client_get_responses(); + } + + return (0); +} + +static void +cvs_editors_local(struct cvs_file *cf) +{ +} diff --git a/usr.bin/cvs/watch.c b/usr.bin/cvs/watch.c new file mode 100644 index 00000000000..acc5ca9e255 --- /dev/null +++ b/usr.bin/cvs/watch.c @@ -0,0 +1,92 @@ +/* $OpenBSD: watch.c,v 1.14 2007/01/02 13:51:13 xsa Exp $ */ +/* + * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "includes.h" + +#include "cvs.h" +#include "log.h" +#include "remote.h" + +static void cvs_watchers_local(struct cvs_file *); + +struct cvs_cmd cvs_cmd_watchers = { + CVS_OP_WATCHERS, 0, "watchers", + { }, + "See who is watching a file", + "[-lR] [file ...]", + "lR", + NULL, + cvs_watchers +}; + +int +cvs_watchers(int argc, char **argv) +{ + int ch; + int flags; + struct cvs_recursion cr; + + flags = CR_RECURSE_DIRS; + + while ((ch = getopt(argc, argv, cvs_cmd_watchers.cmd_opts)) != -1) { + switch (ch) { + case 'l': + flags &= ~CR_RECURSE_DIRS; + break; + case 'R': + break; + default: + fatal("%s", cvs_cmd_watchers.cmd_synopsis); + } + } + + argc -= optind; + argv += optind; + + if (argc == 0) + fatal("%s", cvs_cmd_watchers.cmd_synopsis); + + cr.enterdir = NULL; + cr.leavedir = NULL; + + if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cr.fileproc = cvs_client_sendfile; + + if (!(flags & CR_RECURSE_DIRS)) + cvs_client_send_request("Argument -l"); + } else { + cr.fileproc = cvs_watchers_local; + } + + cr.flags = flags; + + cvs_file_run(argc, argv, &cr); + + if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_send_files(argv, argc); + cvs_client_senddir("."); + cvs_client_send_request("watchers"); + cvs_client_get_responses(); + } + + return (0); +} + +static void +cvs_watchers_local(struct cvs_file *cf) +{ +} |