summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/checkout.c18
-rw-r--r--usr.bin/cvs/rcs.c13
-rw-r--r--usr.bin/cvs/update.c10
3 files changed, 27 insertions, 14 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 2b20fb351c0..9a4be099be2 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.100 2007/09/07 19:36:05 tobias Exp $ */
+/* $OpenBSD: checkout.c,v 1.101 2007/09/07 23:05:04 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -32,6 +32,7 @@
static void checkout_check_repository(int, char **);
static void checkout_repository(const char *, const char *);
+extern int print_stdout;
extern int prune_dirs;
extern int build_dirs;
@@ -74,6 +75,10 @@ cvs_checkout(int argc, char **argv)
case 'P':
prune_dirs = 1;
break;
+ case 'p':
+ print_stdout = 1;
+ cvs_noexec = 1;
+ break;
case 'R':
break;
case 'r':
@@ -151,6 +156,9 @@ checkout_check_repository(int argc, char **argv)
if (cvs_cmdop == CVS_OP_CHECKOUT && prune_dirs == 1)
cvs_client_send_request("Argument -P");
+ if (print_stdout == 1)
+ cvs_client_send_request("Argument -p");
+
cr.enterdir = NULL;
cr.leavedir = NULL;
cr.fileproc = cvs_client_sendfile;
@@ -248,13 +256,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags)
(cvs_server_active) ? "to client" : "to disk");
if (co_flags & CO_DUMP) {
- if (cvs_server_active) {
- cvs_printf("dump file %s to client\n", cf->file_path);
- } else {
- rcs_rev_write_fd(cf->file_rcs, rnum,
- STDOUT_FILENO, 1);
- }
-
+ rcs_rev_write_fd(cf->file_rcs, rnum, STDOUT_FILENO, 1);
return;
}
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 3e4ac6c9ee1..37a3bd1e6ce 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.216 2007/08/27 19:18:05 xsa Exp $ */
+/* $OpenBSD: rcs.c,v 1.217 2007/09/07 23:05:04 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -2782,6 +2782,7 @@ rcs_rev_write_fd(RCSFILE *rfp, RCSNUM *rev, int fd, int mode)
struct rcs_delta *rdp;
struct cvs_lines *lines;
struct cvs_line *lp;
+ extern int print_stdout;
expand = 0;
lines = rcs_rev_getlines(rfp, rev);
@@ -2806,6 +2807,16 @@ rcs_rev_write_fd(RCSFILE *rfp, RCSNUM *rev, int fd, int mode)
if (expand)
rcs_kwexp_line(rfp->rf_path, rdp, lp, expmode);
+ /*
+ * Solely for the checkout and update -p options.
+ */
+ if (cvs_server_active == 1 &&
+ (cvs_cmdop == CVS_OP_CHECKOUT ||
+ cvs_cmdop == CVS_OP_UPDATE) && print_stdout == 1) {
+ if (write(fd, "M ", 2) == -1)
+ fatal("rcs_rev_write_fd: %s", strerror(errno));
+ }
+
if (write(fd, lp->l_line, lp->l_len) == -1)
fatal("rcs_rev_write_fd: %s", strerror(errno));
}
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index f23539b1559..0897f6f78ce 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.107 2007/09/04 17:57:41 tobias Exp $ */
+/* $OpenBSD: update.c,v 1.108 2007/09/07 23:05:04 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -27,7 +27,7 @@
#include "remote.h"
int prune_dirs = 0;
-int print = 0;
+int print_stdout = 0;
int build_dirs = 0;
int reset_stickies = 0;
char *cvs_specified_tag = NULL;
@@ -82,7 +82,7 @@ cvs_update(int argc, char **argv)
prune_dirs = 1;
break;
case 'p':
- print = 1;
+ print_stdout = 1;
cvs_noexec = 1;
break;
case 'Q':
@@ -118,7 +118,7 @@ cvs_update(int argc, char **argv)
cvs_client_send_request("Argument -l");
if (prune_dirs)
cvs_client_send_request("Argument -P");
- if (print)
+ if (print_stdout)
cvs_client_send_request("Argument -p");
cr.enterdir = NULL;
@@ -319,7 +319,7 @@ cvs_update_local(struct cvs_file *cf)
cvs_server_clear_sticky(cf->file_wd);
}
- if (print && cf->file_status != FILE_UNKNOWN) {
+ if (print_stdout && cf->file_status != FILE_UNKNOWN) {
rcsnum_tostr(cf->file_rcsrev, rbuf, sizeof(rbuf));
if (verbosity > 1)
cvs_printf("%s\nChecking out %s\n"