summaryrefslogtreecommitdiffstats
path: root/aux.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-07-15 14:14:16 +1000
committerDamien Miller <djm@mindrot.org>2000-07-15 14:14:16 +1000
commitbe484b5d9889ca636fecdf1f6b73ddfbe4cce3c9 (patch)
tree8b1023f666bebd274c08fe579a61c70a8a66f283 /aux.c
parent055dc369837e1bde0f84a7ecfe669e4e44f10db9 (diff)
- (djm) OpenBSD CVS updates
- provos@cvs.openbsd.org 2000/07/13 16:53:22 [aux.c readconf.c servconf.c ssh.h] allow multiple whitespace but only one '=' between tokens, bug report from Ralf S. Engelschall <rse@engelschall.com> but different fix. okay deraadt@ - provos@cvs.openbsd.org 2000/07/13 17:14:09 [clientloop.c] typo; todd@fries.net - provos@cvs.openbsd.org 2000/07/13 17:19:31 [scp.c] close can fail on AFS, report error; from Greg Hudson <ghudson@mit.edu> - markus@cvs.openbsd.org 2000/07/14 16:59:46 [readconf.c servconf.c] allow leading whitespace. ok niels - djm@cvs.openbsd.org 2000/07/14 22:01:38 [ssh-keygen.c ssh.c] Always create ~/.ssh with mode 700; ok Markus
Diffstat (limited to 'aux.c')
-rw-r--r--aux.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/aux.c b/aux.c
index 63f7dd41..709e2451 100644
--- a/aux.c
+++ b/aux.c
@@ -1,5 +1,5 @@
#include "includes.h"
-RCSID("$OpenBSD: aux.c,v 1.3 2000/06/18 17:13:41 markus Exp $");
+RCSID("$OpenBSD: aux.c,v 1.4 2000/07/13 22:53:21 provos Exp $");
#include "ssh.h"
@@ -39,3 +39,33 @@ set_nonblock(int fd)
if (fcntl(fd, F_SETFL, val) == -1)
error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
}
+
+/* Characters considered whitespace in strsep calls. */
+#define WHITESPACE " \t\r\n"
+
+char *
+strdelim(char **s)
+{
+ char *old;
+ int wspace = 0;
+
+ if (*s == NULL)
+ return NULL;
+
+ old = *s;
+
+ *s = strpbrk(*s, WHITESPACE "=");
+ if (*s == NULL)
+ return (old);
+
+ /* Allow only one '=' to be skipped */
+ if (*s[0] == '=')
+ wspace = 1;
+ *s[0] = '\0';
+
+ *s += strspn(*s + 1, WHITESPACE) + 1;
+ if (*s[0] == '=' && !wspace)
+ *s += strspn(*s + 1, WHITESPACE) + 1;
+
+ return (old);
+}