View | Details | Raw Unified | Return to bug 1596
Collapse All | Expand All

(-)misc.c (-7 / +18 lines)
Lines 163-169 set_nodelay(int fd) Link Here
163
char *
163
char *
164
strdelim(char **s)
164
strdelim(char **s)
165
{
165
{
166
	char *old;
166
	char *old, *cp;
167
	int wspace = 0;
167
	int wspace = 0;
168
168
169
	if (*s == NULL)
169
	if (*s == NULL)
Lines 177-189 strdelim(char **s) Link Here
177
177
178
	if (*s[0] == '\"') {
178
	if (*s[0] == '\"') {
179
		memmove(*s, *s + 1, strlen(*s)); /* move nul too */
179
		memmove(*s, *s + 1, strlen(*s)); /* move nul too */
180
180
		/* Find matching quote */
181
		/* Find matching quote */
181
		if ((*s = strpbrk(*s, QUOTE)) == NULL) {
182
		for (cp = *s; ; cp++) {
182
			return (NULL);		/* no matching quote */
183
			if (*cp == '\0')
183
		} else {
184
				return NULL; /* no matching quote */
184
			*s[0] = '\0';
185
			if (*cp == '\\') {
185
			*s += strspn(*s + 1, WHITESPACE) + 1;
186
				/* Escape sequence */
186
			return (old);
187
				if (cp[1] == '\"' || cp[1] == '\'' ||
188
				    cp[1] == '\\') {
189
					memmove(cp, cp + 1, strlen(cp));
190
					continue;
191
				}
192
				return NULL; /* invalid escape */
193
			} else if (*cp == '\"') {
194
				*(cp++) = '\0';
195
				*s += strspn(cp, WHITESPACE);
196
				return old;
197
			}
187
		}
198
		}
188
	}
199
	}
189
200

Return to bug 1596