wordsplit: minor fix in return_delims mode
* libmailutils/string/wordsplit.c (scan_word): Return only one delimiter if MU_WRDSF_RETURN_DELIMS is on * libmailutils/tests/wordsplit.at: Reflect that.
Showing
2 changed files
with
9 additions
and
12 deletions
... | @@ -1155,11 +1155,7 @@ scan_word (struct mu_wordsplit *wsp, size_t start) | ... | @@ -1155,11 +1155,7 @@ scan_word (struct mu_wordsplit *wsp, size_t start) |
1155 | } | 1155 | } |
1156 | else if (wsp->ws_flags & MU_WRDSF_RETURN_DELIMS) | 1156 | else if (wsp->ws_flags & MU_WRDSF_RETURN_DELIMS) |
1157 | { | 1157 | { |
1158 | do | 1158 | i++; |
1159 | { | ||
1160 | i++; | ||
1161 | } | ||
1162 | while (i < len && ISDELIM (wsp, command[i])); | ||
1163 | } | 1159 | } |
1164 | else if (!(wsp->ws_flags & MU_WRDSF_SQUEEZE_DELIMS)) | 1160 | else if (!(wsp->ws_flags & MU_WRDSF_SQUEEZE_DELIMS)) |
1165 | flags |= _WSNF_EMPTYOK; | 1161 | flags |= _WSNF_EMPTYOK; | ... | ... |
... | @@ -275,16 +275,17 @@ TESTWSP([custom, with returned delimiters],[],[delim : -ws trimnl return_delims] | ... | @@ -275,16 +275,17 @@ TESTWSP([custom, with returned delimiters],[],[delim : -ws trimnl return_delims] |
275 | 275 | ||
276 | TESTWSP([custom, with returned & squeezed delimiters],[],[delim : -ws trimnl return_delims -squeeze_delims], | 276 | TESTWSP([custom, with returned & squeezed delimiters],[],[delim : -ws trimnl return_delims -squeeze_delims], |
277 | [semicolon: separated::list: of :words], | 277 | [semicolon: separated::list: of :words], |
278 | [NF: 9 | 278 | [NF: 10 |
279 | 0: semicolon | 279 | 0: semicolon |
280 | 1: : | 280 | 1: : |
281 | 2: " separated" | 281 | 2: " separated" |
282 | 3: :: | 282 | 3: : |
283 | 4: list | 283 | 4: : |
284 | 5: : | 284 | 5: list |
285 | 6: " of " | 285 | 6: : |
286 | 7: : | 286 | 7: " of " |
287 | 8: words | 287 | 8: : |
288 | 9: words | ||
288 | ]) | 289 | ]) |
289 | 290 | ||
290 | TESTWSP([sed expressions],[],[sed], | 291 | TESTWSP([sed expressions],[],[sed], | ... | ... |
-
Please register or sign in to post a comment