Commit graph

9 commits

Author SHA1 Message Date
Sergey Poznyakoff
8f3eb3433e Fix handling of empty words when WRDSF_RETURN_DELIMS or WRDSO_MAXWORDS are in effect
* README: Update.
* wordsplit.3: Document changes.
* wordsplit.at: Test backward compatibility quirk.
* wordsplit.c: Make sure NULL and DELIM nodes are protected from
expansions.
(wordsplit_finish): Ensure the output array produced
with WRDSF_RETURN_DELIMS is consistent with that produced without this
flag.  Provide new option, WRDSO_RETDELNOTEMPTY, to request old buggy
behavior.
* wordsplit.h (WRDSO_RETDELNOTEMPTY): New option.
* wsp.c: New tests.
2025-03-15 23:05:25 +02:00
Sergey Poznyakoff
e2f0c64db9 Fix default escape settings.
* wordsplit.c (wordsplit_escape): New global.
(wordsplit_init): Backslash interpretation is disabled if
not expliticitly configured.
(wsnode_quoteremoval): Unquote unless _WSNF_NOEXPAND is set.
(scan_word): Fix backslash handling if WRDSF_QUOTE flags are set.
* wsp.c: Fix option handling.
* wordsplit.at: Test handling of C-style escapes.

* README: Document changes.
* wordsplit.3: Likewise.
2023-06-22 17:12:46 +03:00
Sergey Poznyakoff
ed0e91f0bd Update copyright years 2021-01-06 18:44:50 +02:00
Sergey Poznyakoff
66e5c11285 Minor change 2019-07-24 14:55:38 +03:00
Sergey Poznyakoff
7eaa3c45be Allow the caller to modify variable name constituents.
This new feature makes it possible to expand variables with
dots or other unusual characters in their names.

* README: Update.
* wordsplit.3: Document the use of the ws_namechar member.
* wordsplit.c (is_name_char): New static function.
(ISVARCHR): Removed. Use is_name_char instead.
(_wsplt_seterr): Set errno to EINVAL if WRDSE_USAGE is returned.
(_wsplt_subsplit): Clear the WRDSO_MAXWORDS option in the subsplit.
Pass ws_namechar.
(wordsplit_init): Check for valid ws_namechar content.
(expvar): Take into account ws_namechar when scanning variable name.
Fix name length passed to the _wsplt_setctxerr call.
* wordsplit.h (ws_namechar): New member.
(WRDSO_NAMECHAR): New option bit.
* wsp.c: New options: -D to define an "extra" environment entry
(possibly containing characters not allowed by the shell), and
-namechar to define additional variable name constituents.
* wordsplit.at: Test namechar modifications.
2019-07-24 13:36:25 +03:00
Sergey Poznyakoff
d36275fe9a Improve docs 2019-07-10 09:54:32 +03:00
Sergey Poznyakoff
4cd8bec42c Improve the docs 2019-07-09 12:21:26 +03:00
Sergey Poznyakoff
813e12d6e6 Update manpage 2019-07-07 16:32:19 +03:00
Sergey Poznyakoff
e2f87cfb91 Flatten the source tree 2019-06-25 14:31:09 +03:00
Renamed from doc/wordsplit.3 (Browse further)