summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/Makefile6
-rw-r--r--usr.bin/cvs/client.c3
-rw-r--r--usr.bin/cvs/cmd.c4
-rw-r--r--usr.bin/cvs/remote.h3
-rw-r--r--usr.bin/cvs/server.c10
-rw-r--r--usr.bin/cvs/version.c53
6 files changed, 71 insertions, 8 deletions
diff --git a/usr.bin/cvs/Makefile b/usr.bin/cvs/Makefile
index d8ffc3742f1..227bc5886fd 100644
--- a/usr.bin/cvs/Makefile
+++ b/usr.bin/cvs/Makefile
@@ -1,14 +1,14 @@
-# $OpenBSD: Makefile,v 1.31 2006/11/13 12:06:27 xsa Exp $
+# $OpenBSD: Makefile,v 1.32 2006/11/14 09:47:52 xsa Exp $
PROG= opencvs
MAN= cvs.1 cvsignore.5 cvsrc.5 cvswrappers.5 cvsintro.7
CPPFLAGS+=-I${.CURDIR}
-SRCS= cvs.c admin.c add.c commit.c config.c checkout.c client.c buf.c cmd.c \
+SRCS= cvs.c add.c admin.c commit.c config.c checkout.c client.c buf.c cmd.c \
date.y diff.c diff3.c diff_internals.c entries.c fatal.c file.c \
getlog.c log.c import.c init.c remove.c repository.c rcs.c rcsnum.c \
rcstime.c remote.c root.c server.c status.c tag.c worklist.c util.c \
- update.c xmalloc.c
+ update.c version.c xmalloc.c
CFLAGS+=-Wall
CFLAGS+=-Wstrict-prototypes -Wmissing-prototypes
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 9d59899eca5..b5d9f24f3e0 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.22 2006/11/13 15:55:54 xsa Exp $ */
+/* $OpenBSD: client.c,v 1.23 2006/11/14 09:47:52 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -78,6 +78,7 @@ struct cvs_req cvs_requests[] = {
{ "import", 0, NULL, 0 },
{ "add", 0, cvs_server_add, 0 },
{ "remove", 0, cvs_server_remove, 0 },
+ { "version", 0, cvs_server_version, 0 },
{ "watch-on", 0, NULL, 0 },
{ "watch-off", 0, NULL, 0 },
{ "watch-add", 0, NULL, 0 },
diff --git a/usr.bin/cvs/cmd.c b/usr.bin/cvs/cmd.c
index fbd1696b316..563f1f79e1c 100644
--- a/usr.bin/cvs/cmd.c
+++ b/usr.bin/cvs/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.53 2006/11/13 12:57:03 xsa Exp $ */
+/* $OpenBSD: cmd.c,v 1.54 2006/11/14 09:47:52 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -46,6 +46,7 @@ struct cvs_cmd *cvs_cdt[] = {
&cvs_cmd_status,
&cvs_cmd_tag,
&cvs_cmd_update,
+ &cvs_cmd_version,
#if 0
&cvs_cmd_annotate,
&cvs_cmd_checkout,
@@ -62,7 +63,6 @@ struct cvs_cmd *cvs_cdt[] = {
&cvs_cmd_rtag,
&cvs_cmd_unedit,
&cvs_cmd_update,
- &cvs_cmd_version,
&cvs_cmd_watch,
&cvs_cmd_watchers,
#endif
diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h
index e8703d1d028..1c9ed773246 100644
--- a/usr.bin/cvs/remote.h
+++ b/usr.bin/cvs/remote.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.h,v 1.5 2006/11/13 12:57:03 xsa Exp $ */
+/* $OpenBSD: remote.h,v 1.6 2006/11/14 09:47:52 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -81,6 +81,7 @@ void cvs_server_remove(char *);
void cvs_server_status(char *);
void cvs_server_tag(char *);
void cvs_server_update(char *);
+void cvs_server_version(char *);
void cvs_remote_classify_file(struct cvs_file *);
void cvs_remote_output(const char *);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index a977afd9876..c0b108a0739 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.35 2006/11/13 12:57:03 xsa Exp $ */
+/* $OpenBSD: server.c,v 1.36 2006/11/14 09:47:52 xsa Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -487,3 +487,11 @@ cvs_server_update(char *data)
cvs_update(server_argc, server_argv);
cvs_server_send_response("ok");
}
+
+void
+cvs_server_version(char *data)
+{
+ cvs_cmdop = CVS_OP_VERSION;
+ cvs_version(server_argc, server_argv);
+ cvs_server_send_response("ok");
+}
diff --git a/usr.bin/cvs/version.c b/usr.bin/cvs/version.c
new file mode 100644
index 00000000000..6f865ad3388
--- /dev/null
+++ b/usr.bin/cvs/version.c
@@ -0,0 +1,53 @@
+/* $OpenBSD: version.c,v 1.22 2006/11/14 09:47:52 xsa Exp $ */
+/*
+ * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
+ * 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"
+
+struct cvs_cmd cvs_cmd_version = {
+ CVS_OP_VERSION, 0, "version",
+ { "ve", "ver" },
+ "Show current CVS version(s)",
+ "",
+ "",
+ NULL,
+ cvs_version
+};
+
+int
+cvs_version(int argc, char **argv)
+{
+ if (current_cvsroot != NULL &&
+ current_cvsroot->cr_method != CVS_METHOD_LOCAL)
+ cvs_printf("Client: ");
+
+ cvs_printf("%s\n", CVS_VERSION);
+
+ if (current_cvsroot != NULL &&
+ current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ cvs_client_send_request("version");
+ /* XXX: better way to handle server response? */
+ cvs_printf("Server: ");
+ cvs_client_get_responses();
+ }
+
+ return (0);
+}