Annotation of src/usr.bin/cvs/watch.c, Revision 1.2
1.2 ! xsa 1: /* $OpenBSD: watch.c,v 1.1 2005/05/30 08:01:19 xsa Exp $ */
1.1 xsa 2: /*
3: * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: *
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. The name of the author may not be used to endorse or promote products
13: * derived from this software without specific prior written permission.
14: *
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17: * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18: * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23: * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25: */
26:
27: #include <sys/types.h>
28:
29: #include <errno.h>
30: #include <fcntl.h>
31: #include <stdio.h>
32: #include <stdlib.h>
33: #include <string.h>
34: #include <unistd.h>
35:
36: #include "cvs.h"
37: #include "log.h"
38: #include "proto.h"
39:
40: static int cvs_watch_init (struct cvs_cmd *, int, char **, int *);
41: static int cvs_watch_remote (CVSFILE *, void*);
42: static int cvs_watch_local (CVSFILE *, void*);
43:
44: static int cvs_watchers_remote (CVSFILE *, void*);
45: static int cvs_watchers_local (CVSFILE *, void*);
46:
47:
48: struct cvs_cmd cvs_cmd_watch = {
49: CVS_OP_WATCH, CVS_REQ_NOOP, "watch",
50: {},
51: "",
52: "on | off | add | remove [-lR] [-a action] [file ...]",
53: "a:lR",
54: NULL,
55: CF_SORT | CF_RECURSE,
56: cvs_watch_init,
57: NULL,
58: cvs_watch_remote,
59: cvs_watch_local,
60: NULL,
61: NULL,
62: 0
63: };
64:
65: struct cvs_cmd cvs_cmd_watchers = {
66: CVS_OP_WATCHERS, CVS_REQ_WATCHERS, "watchers",
67: {},
68: "",
69: "[-lR] [file ...]",
70: "lR",
71: NULL,
72: CF_SORT | CF_RECURSE,
73: cvs_watch_init,
74: NULL,
75: cvs_watchers_remote,
76: cvs_watchers_local,
77: NULL,
78: NULL,
79: 0
80: };
81:
82:
83:
84: static int
85: cvs_watch_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg)
86: {
87: int ch;
88:
89: while ((ch = getopt(argc, argv, cmd->cmd_opts)) != -1) {
90: switch (ch) {
91: case 'a':
1.2 ! xsa 92: /*
! 93: * The `watchers' command does not have the
! 94: * -a option. Check which command has been issued.
! 95: */
1.1 xsa 96: if (cvs_cmdop != CVS_OP_WATCH)
97: return (CVS_EX_USAGE);
98: break;
99: case 'l':
100: cmd->file_flags &= ~CF_RECURSE;
101: break;
102: case 'R':
103: cmd->file_flags |= CF_RECURSE;
104: break;
105: default:
106: return (CVS_EX_USAGE);
107: }
108: }
109:
110: *arg = optind;
111: return (CVS_EX_OK);
112: }
113:
114:
115: /*
116: * cvs_watch_remote()
117: *
118: */
119: static int
120: cvs_watch_remote(CVSFILE *file, void *arg)
121: {
122: return (CVS_EX_OK);
123: }
124:
125:
126: /*
127: * cvs_watch_local()
128: *
129: */
130: static int
131: cvs_watch_local(CVSFILE *file, void *arg)
132: {
133: return (CVS_EX_OK);
134: }
135:
136:
137: /*
138: * cvs_watchers_remote()
139: *
140: */
141: static int
142: cvs_watchers_remote(CVSFILE *file, void *arg)
143: {
144: return (CVS_EX_OK);
145: }
146:
147:
148: /*
149: * cvs_watchers_local()
150: *
151: */
152: static int
153: cvs_watchers_local(CVSFILE *file, void *arg)
154: {
155: return (CVS_EX_OK);
156: }