summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2005-10-19 11:37:12 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2005-10-19 11:37:12 +0000
commit0ca429e0b70fa7f675e1e0182c5354c98d8a4107 (patch)
tree41b977662c11dbe6d58f051161694e4f8f11b2c1
parentda37bf5d2ed2f7b9359bd37281a6f8034032f008 (diff)
- make a bunch of changes to how we handle verbose output. this brings us
much closer in line with GNU RCS and cleans things up in general. ok joris@, "looks fine to me" xsa@
-rw-r--r--usr.bin/rcs/ci.c8
-rw-r--r--usr.bin/rcs/co.c22
-rw-r--r--usr.bin/rcs/rcsprog.c20
3 files changed, 22 insertions, 28 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index 455de8d5fad..2e6c767a693 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.46 2005/10/18 01:39:47 joris Exp $ */
+/* $OpenBSD: ci.c,v 1.47 2005/10/19 11:37:11 niallo Exp $ */
/*
* Copyright (c) 2005 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -87,7 +87,7 @@ checkin_main(int argc, char **argv)
file = NULL;
rcs_msg = username = NULL;
newrev = NULL;
- fmode = force = lkmode = verbose = rflag = status = symforce = 0;
+ fmode = force = lkmode = rflag = status = symforce = 0;
interactive = 1;
@@ -460,7 +460,9 @@ checkin_getlogmsg(RCSNUM *rev, RCSNUM *rev2)
return (NULL);
}
- printf("new revision: %s; previous revision: %s\n", nrev, prev);
+ if (verbose == 1)
+ printf("new revision: %s; previous revision: %s\n", nrev,
+ prev);
printf("enter log message, terminated with single "
"'.' or end of file:\n");
printf(">> ");
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index 23b4f62f801..09d2fd423cb 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.20 2005/10/19 00:30:22 joris Exp $ */
+/* $OpenBSD: co.c,v 1.21 2005/10/19 11:37:11 niallo Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -104,6 +104,9 @@ checkout_main(int argc, char **argv)
if (rcs_statfile(argv[i], fpath, sizeof(fpath)) < 0)
continue;
+ if (verbose == 1)
+ printf("%s <-- %s\n", fpath, argv[i]);
+
if ((file = rcs_open(fpath, RCS_RDWR)) == NULL)
continue;
@@ -173,10 +176,8 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int lkmode,
if (lkmode == LOCK_LOCK) {
if ((username != NULL)
&& (rcs_lock_add(file, username, frev) < 0)) {
- if (rcs_errno != RCS_ERR_DUPENT)
+ if ((rcs_errno != RCS_ERR_DUPENT) && (verbose == 1))
cvs_log(LP_ERR, "failed to lock '%s'", buf);
- else
- cvs_log(LP_WARN, "you already have a lock");
}
mode = 0644;
@@ -200,16 +201,21 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int lkmode,
if ((stat(dst, &st) != -1) && force == 0) {
if (st.st_mode & S_IWUSR) {
yn = 0;
+ if (verbose == 0) {
+ cvs_log(LP_ERR,
+ "writeable %s exists; checkout aborted",
+ dst);
+ return (-1);
+ }
while (yn != 'y' && yn != 'n') {
- printf("writeable '%s' exists; ", dst);
- printf("remove it? [ny] (n):");
+ printf("writeable %s exists; ", dst);
+ printf("remove it? [ny](n): ");
fflush(stdout);
yn = getchar();
}
if (yn == 'n') {
- if (verbose == 1)
- cvs_log(LP_ERR, "checkout aborted");
+ cvs_log(LP_ERR, "checkout aborted");
return (-1);
}
}
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index 50821390348..8bd2ba5e67d 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.34 2005/10/19 00:30:22 joris Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.35 2005/10/19 11:37:11 niallo Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -183,7 +183,6 @@ int
rcs_statfile(char *fname, char *out, size_t len)
{
int l;
- char *s;
char filev[MAXPATHLEN], fpath[MAXPATHLEN];
struct stat st;
@@ -206,21 +205,6 @@ rcs_statfile(char *fname, char *out, size_t len)
}
strlcpy(out, fpath, len);
- if ((verbose == 1) && (strcmp(__progname, "rcsclean"))) {
- if (!strcmp(__progname, "co")) {
- printf("%s --> ", fpath);
- if (pipeout == 1) {
- printf("standard output\n");
- } else {
- if ((s = strrchr(filev, ',')) != NULL) {
- *s = '\0';
- printf("%s\n", fname);
- }
- }
- } else {
- printf("RCS file: %s\n", fpath);
- }
- }
return (0);
}
@@ -369,6 +353,8 @@ rcs_main(int argc, char **argv)
if (rcs_statfile(argv[i], fpath, sizeof(fpath)) < 0)
continue;
+ if (verbose == 1)
+ printf("RCS file: %s\n", fpath);
file = rcs_open(fpath, flags, fmode);
if (file == NULL)
continue;