Commit graph

8 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
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
6a7581f2e6 Change the testsuite files to be easily incorporated into an existing testsuite
* README: Rewrite the testuite section.
* wordsplit.at: Remove AT_INIT
* wsp.c: Include wordsplit-version.h before wordsplit.h
2019-07-11 11:14:52 +03:00
Sergey Poznyakoff
d5a0b05f52 Add the bootstrap script
* .gitignore: New file.
* bootstrap: New file.
* wordsplit.at: Convert to stand-alone script.
* wsp.c: Support the --version option.
2019-07-07 16:15:32 +03:00
Sergey Poznyakoff
42acf86a10 Get rid of the grecs dependencies 2019-06-25 17:28:26 +03:00
Sergey Poznyakoff
e2f87cfb91 Flatten the source tree 2019-06-25 14:31:09 +03:00
Renamed from tests/wordsplit.at (Browse further)