summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2007-09-19 13:49:55 +0000
committertobias <tobias@openbsd.org>2007-09-19 13:49:55 +0000
commitc70dac2b6dfc62579230ebb55920d33d903bf6d8 (patch)
tree282c005b4d6e3f4d4a3a9e9c85eede5af4230e0c
parentparse global arguments (cvs) and command arguments only once, i.e. first (diff)
downloadwireguard-openbsd-c70dac2b6dfc62579230ebb55920d33d903bf6d8.tar.xz
wireguard-openbsd-c70dac2b6dfc62579230ebb55920d33d903bf6d8.zip
Allow lines which do not specify any arguments for command (or cvs).
Sticks at GNU cvs behaviour. OK joris@
-rw-r--r--usr.bin/cvs/cvs.54
-rw-r--r--usr.bin/cvs/cvs.c17
2 files changed, 12 insertions, 9 deletions
diff --git a/usr.bin/cvs/cvs.5 b/usr.bin/cvs/cvs.5
index f41a2f1cabd..988edc4ce45 100644
--- a/usr.bin/cvs/cvs.5
+++ b/usr.bin/cvs/cvs.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cvs.5,v 1.3 2007/09/19 12:48:41 tobias Exp $
+.\" $OpenBSD: cvs.5,v 1.4 2007/09/19 13:49:55 tobias Exp $
.\"
.\" Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
.\" Copyright (c) 2004-2007 Xavier Santolaria <xsa@openbsd.org>
@@ -391,7 +391,7 @@ the
.Fl V
flag.
.Pp
-Empty lines and lines specifying no optional arguments are ignored.
+Empty lines are ignored.
A line beginning with a hash character
.Pq Sq #
is considered a comment and ignored.
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c
index 938221e9f39..48783d5db02 100644
--- a/usr.bin/cvs/cvs.c
+++ b/usr.bin/cvs/cvs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.c,v 1.137 2007/09/19 13:36:32 tobias Exp $ */
+/* $OpenBSD: cvs.c,v 1.138 2007/09/19 13:49:55 tobias Exp $ */
/*
* Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -450,8 +450,7 @@ cvs_read_rcfile(void)
pos = strcspn(p, " \t");
if (pos == strlen(p)) {
- /* ignore lines with no arguments */
- continue;
+ lp = NULL;
} else {
lp = p + pos;
*lp = '\0';
@@ -464,11 +463,12 @@ cvs_read_rcfile(void)
* getopt() does not like starting at index 0 for
* argument processing.
*/
- *lp = ' ';
- cvs_defargs = xstrdup(p);
+ if (lp != NULL) {
+ *lp = ' ';
+ cvs_defargs = xstrdup(p);
+ }
cvs_parsed = 1;
} else {
- lp++;
tcmdp = cvs_findcmd(p);
if (tcmdp == NULL && verbosity == 2)
cvs_log(LP_NOTICE,
@@ -478,7 +478,10 @@ cvs_read_rcfile(void)
if (tcmdp != cmdp || cmd_parsed)
continue;
- cmdp->cmd_defargs = xstrdup(lp);
+ if (lp != NULL) {
+ lp++;
+ cmdp->cmd_defargs = xstrdup(lp);
+ }
cmd_parsed = 1;
}
}