summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rcs/ci.c24
-rw-r--r--usr.bin/rcs/co.c22
-rw-r--r--usr.bin/rcs/ident.c7
-rw-r--r--usr.bin/rcs/rcsclean.c8
-rw-r--r--usr.bin/rcs/rcsdiff.c15
-rw-r--r--usr.bin/rcs/rcsmerge.c16
-rw-r--r--usr.bin/rcs/rcsprog.c13
-rw-r--r--usr.bin/rcs/rcsprog.h4
-rw-r--r--usr.bin/rcs/rlog.c6
9 files changed, 60 insertions, 55 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index b47abd81a88..e579bc103d7 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.153 2006/04/18 03:35:57 ray Exp $ */
+/* $OpenBSD: ci.c,v 1.154 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -69,7 +69,7 @@ static int checkin_attach_symbol(struct checkin_params *);
static int checkin_checklock(struct checkin_params *);
static char *checkin_diff_file(struct checkin_params *);
static char *checkin_getdesc(void);
-static char *checkin_getlogmsg(RCSNUM *, RCSNUM *);
+static char *checkin_getlogmsg(RCSNUM *, RCSNUM *, int);
static int checkin_init(struct checkin_params *);
static int checkin_keywordscan(char *, RCSNUM **, time_t *, char **,
char **);
@@ -169,7 +169,7 @@ checkin_main(int argc, char **argv)
fatal("invalid symbol `%s'", pb.symbol);
break;
case 'q':
- verbose = 0;
+ pb.flags |= QUIET;
break;
case 'r':
rcs_setrevstr(&rev_str, rcs_optarg);
@@ -269,7 +269,7 @@ checkin_main(int argc, char **argv)
if (pb.file == NULL)
fatal("failed to open rcsfile '%s'", pb.fpath);
- if (verbose == 1)
+ if (!(pb.flags & QUIET))
printf("%s <-- %s\n", pb.fpath, pb.filename);
/* XXX - Should we rcsnum_free(pb.newrev)? */
@@ -300,7 +300,7 @@ checkin_main(int argc, char **argv)
rcs_close(pb.file);
}
- if (verbose == 1 && status == 0)
+ if (!(pb.flags & QUIET) && status == 0)
printf("done\n");
return (status);
@@ -377,7 +377,7 @@ out:
* Returns pointer to a char array on success, NULL on failure.
*/
static char *
-checkin_getlogmsg(RCSNUM *rev, RCSNUM *rev2)
+checkin_getlogmsg(RCSNUM *rev, RCSNUM *rev2, int flags)
{
char *rcs_msg, nrev[16], prev[16];
const char *prompt =
@@ -394,7 +394,7 @@ checkin_getlogmsg(RCSNUM *rev, RCSNUM *rev2)
rcsnum_tostr(rev2, nrev, sizeof(nrev));
rcsnum_free(tmprev);
- if (verbose == 1)
+ if (!(flags & QUIET))
printf("new revision: %s; previous revision: %s\n", nrev,
prev);
@@ -519,7 +519,8 @@ checkin_update(struct checkin_params *pb)
/* If no log message specified, get it interactively. */
if (pb->flags & INTERACTIVE)
- pb->rcs_msg = checkin_getlogmsg(pb->frev, pb->newrev);
+ pb->rcs_msg = checkin_getlogmsg(pb->frev, pb->newrev,
+ pb->flags);
if (rcs_lock_remove(pb->file, pb->username, pb->frev) < 0) {
if (rcs_errno != RCS_ERR_NOENT)
@@ -667,7 +668,8 @@ skipdesc:
* emulate odd GNU behaviour and fetch log message.
*/
if (fetchlog == 1) {
- pb->rcs_msg = checkin_getlogmsg(pb->frev, pb->newrev);
+ pb->rcs_msg = checkin_getlogmsg(pb->frev, pb->newrev,
+ pb->flags);
rcsnum_free(pb->frev);
}
@@ -734,7 +736,7 @@ skipdesc:
}
- if (verbose == 1) {
+ if (!(pb->flags & QUIET)) {
fprintf(stderr, "initial revision: %s\n",
rcsnum_tostr(pb->newrev, numb, sizeof(numb)));
}
@@ -757,7 +759,7 @@ checkin_attach_symbol(struct checkin_params *pb)
{
char rbuf[16];
int ret;
- if (verbose == 1)
+ if (!(pb->flags & QUIET))
printf("symbol: %s\n", pb->symbol);
if (pb->flags & CI_SYMFORCE) {
if (rcs_sym_remove(pb->file, pb->symbol) < 0) {
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index 2cb5a2bc594..b722d1bc994 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.78 2006/04/15 16:28:07 pat Exp $ */
+/* $OpenBSD: co.c,v 1.79 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -92,7 +92,7 @@ checkout_main(int argc, char **argv)
break;
case 'q':
rcs_setrevstr(&rev_str, rcs_optarg);
- verbose = 0;
+ flags |= QUIET;
break;
case 'r':
rcs_setrevstr(&rev_str, rcs_optarg);
@@ -158,7 +158,7 @@ checkout_main(int argc, char **argv)
if (rcs_statfile(argv[i], fpath, sizeof(fpath)) < 0)
continue;
- if (verbose == 1)
+ if (!(flags & QUIET))
printf("%s --> %s\n", fpath,
(pipeout == 1) ? "standard output" : argv[i]);
@@ -197,7 +197,7 @@ checkout_main(int argc, char **argv)
continue;
}
- if (verbose == 1)
+ if (!(flags & QUIET))
printf("done\n");
rcs_close(file);
@@ -343,11 +343,11 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
}
}
- if (verbose == 1 && !(flags & NEWFILE) &&
+ if (!(flags & QUIET) && !(flags & NEWFILE) &&
!(flags & CO_REVERT) && file->rf_ndelta != 0)
printf("revision %s", buf);
- if (verbose == 1 && (flags & CO_REVERT))
+ if (!(flags & QUIET) && (flags & CO_REVERT))
printf("done");
if (file->rf_ndelta != 0) {
@@ -388,7 +388,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
mode |= S_IWUSR;
if (file->rf_ndelta != 0) {
- if (verbose == 1 && !(flags & NEWFILE) &&
+ if (!(flags & QUIET) && !(flags & NEWFILE) &&
!(flags & CO_REVERT))
printf(" (locked)");
}
@@ -405,7 +405,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
(S_IXUSR|S_IXGRP|S_IXOTH|S_IRUSR|S_IRGRP|S_IROTH);
if (file->rf_ndelta != 0) {
- if (verbose == 1 && !(flags & NEWFILE) &&
+ if (!(flags & QUIET) && !(flags & NEWFILE) &&
!(flags & CO_REVERT))
printf(" (unlocked)");
}
@@ -416,14 +416,14 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
cvs_log(LP_WARN, "no revisions, so nothing can be %s",
(flags & CO_LOCK) ? "locked" : "unlocked");
} else if (file->rf_ndelta != 0) {
- if (verbose == 1 && !(flags & NEWFILE))
+ if (!(flags & QUIET) && !(flags & NEWFILE))
printf("\n");
}
if (flags & CO_LOCK) {
if (rcs_errno != RCS_ERR_DUPENT)
lcount++;
- if (verbose == 1 && lcount > 1 && !(flags & CO_REVERT))
+ if (!(flags & QUIET) && lcount > 1 && !(flags & CO_REVERT))
cvs_log(LP_WARN, "%s: warning: You now have %d locks.",
file->rf_path, lcount);
}
@@ -449,7 +449,7 @@ checkout_rev(RCSFILE *file, RCSNUM *frev, const char *dst, int flags,
printf("remove it? [ny](n): ");
/* default is n */
if (cvs_yesno() == -1) {
- if (verbose == 1 && isatty(STDIN_FILENO))
+ if (!(flags & QUIET) && isatty(STDIN_FILENO))
cvs_log(LP_ERR,
"writable %s exists; checkout aborted",
dst);
diff --git a/usr.bin/rcs/ident.c b/usr.bin/rcs/ident.c
index cc66501ca38..9c9953d6693 100644
--- a/usr.bin/rcs/ident.c
+++ b/usr.bin/rcs/ident.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ident.c,v 1.15 2006/04/14 01:11:07 deraadt Exp $ */
+/* $OpenBSD: ident.c,v 1.16 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -32,6 +32,7 @@
#define VALDELIM ':' /* values delimiter */
static int found = 0;
+static int flags = 0;
static void ident_file(const char *, FILE *);
static void ident_line(FILE *);
@@ -45,7 +46,7 @@ ident_main(int argc, char **argv)
while ((ch = rcs_getopt(argc, argv, "qV")) != -1) {
switch(ch) {
case 'q':
- verbose = 0;
+ flags |= QUIET;
break;
case 'V':
printf("%s\n", rcs_version);
@@ -95,7 +96,7 @@ ident_file(const char *filename, FILE *fp)
ident_line(fp);
}
- if (found == 0 && verbose == 1)
+ if (found == 0 && !(flags & QUIET))
fprintf(stderr, "ident warning: no id keywords in %s\n",
filename);
diff --git a/usr.bin/rcs/rcsclean.c b/usr.bin/rcs/rcsclean.c
index b29407a9865..ef0acdc7882 100644
--- a/usr.bin/rcs/rcsclean.c
+++ b/usr.bin/rcs/rcsclean.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsclean.c,v 1.36 2006/04/17 04:50:08 ray Exp $ */
+/* $OpenBSD: rcsclean.c,v 1.37 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -64,7 +64,7 @@ rcsclean_main(int argc, char **argv)
break;
case 'q':
rcs_setrevstr(&rev_str, rcs_optarg);
- verbose = 0;
+ flags |= QUIET;
break;
case 'r':
rcs_setrevstr(&rev_str, rcs_optarg);
@@ -185,7 +185,7 @@ rcsclean_file(char *fname, const char *rev_str)
if (match == 1) {
if (uflag == 1 && !TAILQ_EMPTY(&(file->rf_locks))) {
- if (verbose == 1 && nflag == 0) {
+ if (!(flags & QUIET) && nflag == 0) {
printf("rcs -u%s %s\n",
rcsnum_tostr(rev, numb, sizeof(numb)),
fpath);
@@ -194,7 +194,7 @@ rcsclean_file(char *fname, const char *rev_str)
}
if (TAILQ_EMPTY(&(file->rf_locks))) {
- if (verbose == 1)
+ if (!(flags & QUIET))
printf("rm -f %s\n", fname);
if (nflag == 0)
diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c
index 38f2db7cbc8..05b7bf6e6ea 100644
--- a/usr.bin/rcs/rcsdiff.c
+++ b/usr.bin/rcs/rcsdiff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsdiff.c,v 1.50 2006/04/14 23:32:01 deraadt Exp $ */
+/* $OpenBSD: rcsdiff.c,v 1.51 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -32,6 +32,7 @@
static int rcsdiff_file(RCSFILE *, RCSNUM *, const char *);
static int rcsdiff_rev(RCSFILE *, RCSNUM *, RCSNUM *);
+static int flags = 0;
static int kflag = RCS_KWEXP_ERR;
int
@@ -68,7 +69,7 @@ rcsdiff_main(int argc, char **argv)
diff_format = D_RCSDIFF;
break;
case 'q':
- verbose = 0;
+ flags |= QUIET;
break;
case 'u':
strlcat(diffargs, " -u", sizeof(diffargs));
@@ -126,7 +127,7 @@ rcsdiff_main(int argc, char **argv)
fatal("bad revision number");
}
- if (verbose == 1) {
+ if (!(flags & QUIET)) {
fprintf(stderr, "%s\n", RCS_DIFF_DIV);
fprintf(stderr, "RCS file: %s\n", fpath);
}
@@ -197,7 +198,7 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename)
}
rcsnum_tostr(rev, rbuf, sizeof(rbuf));
- if (verbose == 1) {
+ if (!(flags & QUIET)) {
fprintf(stderr, "retrieving revision %s\n", rbuf);
fprintf(stderr, "%s -r%s %s\n", diffargs, rbuf, filename);
}
@@ -273,7 +274,7 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2)
diff_rev2 = rev2;
rcsnum_tostr(rev1, rbuf1, sizeof(rbuf1));
- if (verbose == 1)
+ if (!(flags & QUIET))
fprintf(stderr, "retrieving revision %s\n", rbuf1);
if ((b1 = rcs_getrev(file, rev1)) == NULL) {
@@ -286,7 +287,7 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2)
tv[1].tv_sec = tv[0].tv_sec;
rcsnum_tostr(rev2, rbuf2, sizeof(rbuf2));
- if (verbose == 1)
+ if (!(flags & QUIET))
fprintf(stderr, "retrieving revision %s\n", rbuf2);
if ((b2 = rcs_getrev(file, rev2)) == NULL) {
@@ -298,7 +299,7 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2)
tv2[0].tv_sec = (long)rcs_rev_getdate(file, rev2);
tv2[1].tv_sec = tv2[0].tv_sec;
- if (verbose == 1)
+ if (!(flags & QUIET))
fprintf(stderr, "%s -r%s -r%s\n", diffargs, rbuf1, rbuf2);
strlcpy(path1, rcs_tmpdir, sizeof(path1));
diff --git a/usr.bin/rcs/rcsmerge.c b/usr.bin/rcs/rcsmerge.c
index 3456d4592ca..121ef6c36fc 100644
--- a/usr.bin/rcs/rcsmerge.c
+++ b/usr.bin/rcs/rcsmerge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsmerge.c,v 1.26 2006/04/14 16:28:24 ray Exp $ */
+/* $OpenBSD: rcsmerge.c,v 1.27 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -29,17 +29,17 @@
#include "rcsprog.h"
#include "diff.h"
-static int kflag = RCS_KWEXP_ERR;
-
int
rcsmerge_main(int argc, char **argv)
{
- int i, ch;
+ int i, ch, flags, kflag;
char *fcont, fpath[MAXPATHLEN], r1[16], r2[16], *rev_str1, *rev_str2;
RCSFILE *file;
RCSNUM *rev1, *rev2;
BUF *bp;
+ flags = 0;
+ kflag = RCS_KWEXP_ERR;
rev1 = rev2 = NULL;
rev_str1 = rev_str2 = NULL;
@@ -62,7 +62,7 @@ rcsmerge_main(int argc, char **argv)
break;
case 'q':
rcs_setrevstr2(&rev_str1, &rev_str2, rcs_optarg);
- verbose = 0;
+ flags |= QUIET;
break;
case 'r':
rcs_setrevstr2(&rev_str1, &rev_str2, rcs_optarg);
@@ -111,7 +111,7 @@ rcsmerge_main(int argc, char **argv)
if ((file = rcs_open(fpath, RCS_READ)) == NULL)
continue;
- if (verbose == 1)
+ if (!(flags & QUIET))
fprintf(stderr, "RCS file: %s\n", fpath);
if (rev1 != NULL) {
@@ -138,7 +138,7 @@ rcsmerge_main(int argc, char **argv)
continue;
}
- if (verbose == 1) {
+ if (!(flags & QUIET)) {
(void)rcsnum_tostr(rev1, r1, sizeof(r1));
(void)rcsnum_tostr(rev2, r2, sizeof(r2));
@@ -148,7 +148,7 @@ rcsmerge_main(int argc, char **argv)
}
if ((bp = cvs_diff3(file, argv[i], rev1, rev2,
- verbose)) == NULL) {
+ !(flags & QUIET))) == NULL) {
cvs_log(LP_ERR, "failed to merge");
rcs_close(file);
continue;
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index c7c9ebda9dd..5c4dc13433c 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.107 2006/04/18 03:35:57 ray Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.108 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -35,7 +35,6 @@
"or end of file:\nNOTE: This is NOT the log message!\n"
const char rcs_version[] = "OpenCVS RCS version 3.6";
-int verbose = 1;
int pipeout = 0;
int flags;
@@ -561,7 +560,7 @@ rcs_main(int argc, char **argv)
orange = xstrdup(rcs_optarg);
break;
case 'q':
- verbose = 0;
+ rcsflags |= QUIET;
break;
case 't':
descfile = rcs_optarg;
@@ -612,7 +611,7 @@ rcs_main(int argc, char **argv)
if (rcs_statfile(argv[i], fpath, sizeof(fpath)) < 0)
continue;
- if (verbose == 1)
+ if (!(rcsflags & QUIET))
printf("RCS file: %s\n", fpath);
if ((file = rcs_open(fpath, flags, fmode)) == NULL)
@@ -730,7 +729,7 @@ rcs_main(int argc, char **argv)
fatal("%s: can't lock nonexisting revision %s",
fpath, rev_str);
if (rcs_lock_add(file, username, rev) != -1 &&
- verbose == 1)
+ !(rcsflags & QUIET))
printf("%s locked\n", rev_str);
rcsnum_free(rev);
}
@@ -756,7 +755,7 @@ rcs_main(int argc, char **argv)
fatal("%s: can't unlock nonexisting revision %s",
fpath, rev_str);
if (rcs_lock_remove(file, username, rev) == -1 &&
- verbose == 1)
+ !(rcsflags & QUIET))
cvs_log(LP_ERR,
"%s: warning: No locks are set.", fpath);
rcsnum_free(rev);
@@ -784,7 +783,7 @@ rcs_main(int argc, char **argv)
if (rcsflags & PRESERVETIME)
rcs_set_mtime(fpath, rcs_mtime);
- if (verbose == 1)
+ if (!(rcsflags & QUIET))
printf("done\n");
}
diff --git a/usr.bin/rcs/rcsprog.h b/usr.bin/rcs/rcsprog.h
index 1faa42f41e1..e9c471a0bed 100644
--- a/usr.bin/rcs/rcsprog.h
+++ b/usr.bin/rcs/rcsprog.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.h,v 1.49 2006/04/18 03:35:57 ray Exp $ */
+/* $OpenBSD: rcsprog.h,v 1.50 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -64,10 +64,10 @@
#define INTERACTIVE (1<<18)
#define NEWFILE (1<<19)
#define PRESERVETIME (1<<20)
+#define QUIET (1<<21)
extern char *__progname;
extern const char rcs_version[];
-extern int verbose;
extern int pipeout;
extern int rcs_optind;
diff --git a/usr.bin/rcs/rlog.c b/usr.bin/rcs/rlog.c
index 8d4f8a50f33..6283884a17b 100644
--- a/usr.bin/rcs/rlog.c
+++ b/usr.bin/rcs/rlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rlog.c,v 1.46 2006/04/15 19:35:19 xsa Exp $ */
+/* $OpenBSD: rlog.c,v 1.47 2006/04/19 06:53:41 xsa Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -79,7 +79,9 @@ rlog_main(int argc, char **argv)
Nflag = 1;
break;
case 'q':
- verbose = 0;
+ /*
+ * kept for compatibility
+ */
break;
case 'R':
Rflag = 1;