summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2007-09-19 12:26:16 +0000
committertobias <tobias@openbsd.org>2007-09-19 12:26:16 +0000
commit1f51c0c75ef9dd99dcab0d529ed7d4d7ee43c037 (patch)
tree784b987f8f2ed1a09bff753e3456504def95794f
parentWeird, but our goal is compatibility: treat '\t' in front of keyword as '#'. (diff)
downloadwireguard-openbsd-1f51c0c75ef9dd99dcab0d529ed7d4d7ee43c037.tar.xz
wireguard-openbsd-1f51c0c75ef9dd99dcab0d529ed7d4d7ee43c037.zip
Next to ' ', '\t' is valid between command and arguments.
OK joris@
-rw-r--r--usr.bin/cvs/cvs.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c
index 0d1a2488fe9..a80ed2036bb 100644
--- a/usr.bin/cvs/cvs.c
+++ b/usr.bin/cvs/cvs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.c,v 1.134 2007/09/19 12:14:21 tobias Exp $ */
+/* $OpenBSD: cvs.c,v 1.135 2007/09/19 12:26:16 tobias Exp $ */
/*
* Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -396,7 +396,7 @@ cvs_read_rcfile(void)
{
char rcpath[MAXPATHLEN], *buf, *lbuf, *lp, *p;
int i, linenum;
- size_t len;
+ size_t len, pos;
struct cvs_cmd *cmdp;
FILE *fp;
@@ -443,10 +443,15 @@ cvs_read_rcfile(void)
if (*p == '#' || *p == '\t')
continue;
- lp = strchr(p, ' ');
- if (lp == NULL)
- continue; /* ignore lines with no arguments */
- *lp = '\0';
+ pos = strcspn(p, " \t");
+ if (pos == strlen(p)) {
+ /* ignore lines with no arguments */
+ continue;
+ } else {
+ lp = p + pos;
+ *lp = '\0';
+ }
+
if (strcmp(p, "cvs") == 0) {
/*
* Global default options. In the case of cvs only,