=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/annotate.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- src/usr.bin/cvs/annotate.c 2004/12/21 18:32:09 1.3 +++ src/usr.bin/cvs/annotate.c 2005/01/13 16:32:46 1.4 @@ -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 * All rights reserved. @@ -54,19 +54,23 @@ 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 @@ 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; @@ -104,6 +115,8 @@ 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) ||