|
Lines 125-146
char *
Link Here
|
| 125 |
strdelim(char **s) |
125 |
strdelim(char **s) |
| 126 |
{ |
126 |
{ |
| 127 |
char *old; |
127 |
char *old; |
| 128 |
int wspace = 0; |
128 |
int cont, wspace = 0; |
| 129 |
|
129 |
|
| 130 |
if (*s == NULL) |
130 |
if (*s == NULL) |
| 131 |
return NULL; |
131 |
return NULL; |
| 132 |
|
132 |
|
| 133 |
old = *s; |
133 |
old = *s; |
| 134 |
|
134 |
|
| 135 |
*s = strpbrk(*s, WHITESPACE "="); |
135 |
do { |
| 136 |
if (*s == NULL) |
136 |
cont = 0; |
| 137 |
return (old); |
137 |
*s = strpbrk(*s, WHITESPACE "=\\"); |
|
|
138 |
if (*s == NULL) |
| 139 |
return (old); |
| 140 |
/* If we found a backslash, remove it and skip next char */ |
| 141 |
if (*s[0] == '\\' && *s[1] != '\0') { |
| 142 |
cont = 1; |
| 143 |
memmove(*s, *s + 1, strlen(*s) - 1); |
| 144 |
s++; |
| 145 |
} |
| 146 |
} while (cont); |
| 138 |
|
147 |
|
| 139 |
/* Allow only one '=' to be skipped */ |
148 |
/* Allow only one '=' to be skipped */ |
| 140 |
if (*s[0] == '=') |
149 |
if (*s[0] == '=') |
| 141 |
wspace = 1; |
150 |
wspace = 1; |
| 142 |
*s[0] = '\0'; |
151 |
*s[0] = '\0'; |
| 143 |
|
152 |
|
|
|
153 |
/* Skip any extra whitespace after first token */ |
| 144 |
*s += strspn(*s + 1, WHITESPACE) + 1; |
154 |
*s += strspn(*s + 1, WHITESPACE) + 1; |
| 145 |
if (*s[0] == '=' && !wspace) |
155 |
if (*s[0] == '=' && !wspace) |
| 146 |
*s += strspn(*s + 1, WHITESPACE) + 1; |
156 |
*s += strspn(*s + 1, WHITESPACE) + 1; |