summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/annotate.c
diff options
context:
space:
mode:
authorjfb <jfb@openbsd.org>2005-01-13 16:32:46 +0000
committerjfb <jfb@openbsd.org>2005-01-13 16:32:46 +0000
commit0b8aa4ccd8871f60c41ad8871b7ecc6f789dc4ea (patch)
tree2b0eff10d19d379d69f15e83bf046762ffcc7c52 /usr.bin/cvs/annotate.c
parentunneeded, bye. (diff)
downloadwireguard-openbsd-0b8aa4ccd8871f60c41ad8871b7ecc6f789dc4ea.tar.xz
wireguard-openbsd-0b8aa4ccd8871f60c41ad8871b7ecc6f789dc4ea.zip
fix the annotate usage (there is no -F flag) and add the missing bits
so the -r and -f arguments are supported, and complain if both -D and -r are given. GNU CVS silently accepts to have both specified, but does not produce output as a result.
Diffstat (limited to 'usr.bin/cvs/annotate.c')
-rw-r--r--usr.bin/cvs/annotate.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index 755b4b0f3fd..fc7d545afa7 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.3 2004/12/21 18:32:09 jfb Exp $ */
+/* $OpenBSD: annotate.c,v 1.4 2005/01/13 16:32:46 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -54,19 +54,23 @@ int cvs_annotate_prune (CVSFILE *, void *);
int
cvs_annotate(int argc, char **argv)
{
- int i, ch, flags;
+ int i, ch, flags, usehead;
char *date, *rev;
struct cvsroot *root;
+ usehead = 0;
date = NULL;
rev = NULL;
flags = CF_SORT|CF_RECURSE|CF_IGNORE|CF_NOSYMS;
- while ((ch = getopt(argc, argv, "D:FflRr:")) != -1) {
+ while ((ch = getopt(argc, argv, "D:flRr:")) != -1) {
switch (ch) {
case 'D':
date = optarg;
break;
+ case 'f':
+ usehead = 1;
+ break;
case 'l':
flags &= ~CF_RECURSE;
break;
@@ -74,12 +78,19 @@ cvs_annotate(int argc, char **argv)
flags |= CF_RECURSE;
break;
case 'r':
+ rev = optarg;
break;
default:
return (EX_USAGE);
}
}
+ if ((date != NULL) && (rev != NULL)) {
+ cvs_log(LP_ERR,
+ "the -D and -d arguments are mutually exclusive");
+ return (EX_USAGE);
+ }
+
argc -= optind;
argv += optind;
@@ -105,6 +116,8 @@ cvs_annotate(int argc, char **argv)
if (root->cr_method != CVS_METHOD_LOCAL) {
if (cvs_connect(root) < 0)
return (EX_PROTOCOL);
+ if (usehead && (cvs_sendarg(root, "-f", 0) < 0))
+ return (EX_PROTOCOL);
if (rev != NULL) {
if ((cvs_sendarg(root, "-r", 0) < 0) ||
(cvs_sendarg(root, rev, 0) < 0))