summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/watch.c
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2005-05-30 08:01:20 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2005-05-30 08:01:20 +0000
commitfbb2d5f0804d3cb9bd1e1f55721106b32643ddd3 (patch)
treeaa7bee2e00dd16caeb7ca638b81f447193a03834 /usr.bin/cvs/watch.c
parent69a76e3ea973edb04e00a6b1b1c17e35492cc1be (diff)
skeleton for watch{,ers} commands, not linked yet;
"i'm cool with that" joris@
Diffstat (limited to 'usr.bin/cvs/watch.c')
-rw-r--r--usr.bin/cvs/watch.c152
1 files changed, 152 insertions, 0 deletions
diff --git a/usr.bin/cvs/watch.c b/usr.bin/cvs/watch.c
new file mode 100644
index 00000000000..55ddee31804
--- /dev/null
+++ b/usr.bin/cvs/watch.c
@@ -0,0 +1,152 @@
+/* $OpenBSD: watch.c,v 1.1 2005/05/30 08:01:19 xsa Exp $ */
+/*
+ * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "cvs.h"
+#include "log.h"
+#include "proto.h"
+
+static int cvs_watch_init (struct cvs_cmd *, int, char **, int *);
+static int cvs_watch_remote (CVSFILE *, void*);
+static int cvs_watch_local (CVSFILE *, void*);
+
+static int cvs_watchers_remote (CVSFILE *, void*);
+static int cvs_watchers_local (CVSFILE *, void*);
+
+
+struct cvs_cmd cvs_cmd_watch = {
+ CVS_OP_WATCH, CVS_REQ_NOOP, "watch",
+ {},
+ "",
+ "on | off | add | remove [-lR] [-a action] [file ...]",
+ "a:lR",
+ NULL,
+ CF_SORT | CF_RECURSE,
+ cvs_watch_init,
+ NULL,
+ cvs_watch_remote,
+ cvs_watch_local,
+ NULL,
+ NULL,
+ 0
+};
+
+struct cvs_cmd cvs_cmd_watchers = {
+ CVS_OP_WATCHERS, CVS_REQ_WATCHERS, "watchers",
+ {},
+ "",
+ "[-lR] [file ...]",
+ "lR",
+ NULL,
+ CF_SORT | CF_RECURSE,
+ cvs_watch_init,
+ NULL,
+ cvs_watchers_remote,
+ cvs_watchers_local,
+ NULL,
+ NULL,
+ 0
+};
+
+
+
+static int
+cvs_watch_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg)
+{
+ int ch;
+
+ while ((ch = getopt(argc, argv, cmd->cmd_opts)) != -1) {
+ switch (ch) {
+ case 'a':
+ if (cvs_cmdop != CVS_OP_WATCH)
+ return (CVS_EX_USAGE);
+ break;
+ case 'l':
+ cmd->file_flags &= ~CF_RECURSE;
+ break;
+ case 'R':
+ cmd->file_flags |= CF_RECURSE;
+ break;
+ default:
+ return (CVS_EX_USAGE);
+ }
+ }
+
+ *arg = optind;
+ return (CVS_EX_OK);
+}
+
+
+/*
+ * cvs_watch_remote()
+ *
+ */
+static int
+cvs_watch_remote(CVSFILE *file, void *arg)
+{
+ return (CVS_EX_OK);
+}
+
+
+/*
+ * cvs_watch_local()
+ *
+ */
+static int
+cvs_watch_local(CVSFILE *file, void *arg)
+{
+ return (CVS_EX_OK);
+}
+
+
+/*
+ * cvs_watchers_remote()
+ *
+ */
+static int
+cvs_watchers_remote(CVSFILE *file, void *arg)
+{
+ return (CVS_EX_OK);
+}
+
+
+/*
+ * cvs_watchers_local()
+ *
+ */
+static int
+cvs_watchers_local(CVSFILE *file, void *arg)
+{
+ return (CVS_EX_OK);
+}