1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-04 14:31:24 +02:00
Commit graph

239 commits

Author SHA1 Message Date
Bart Schaefer
4fb96cc639 52612: %l replacment of zwarning() does literal string output 2024-03-02 09:22:43 -08:00
Bart Schaefer
b3e763cc22 52482: strip trailing newlines in emulation modes of ${ command; } 2024-01-24 17:56:21 -08:00
Bart Schaefer
fbec213cc5 52325: Clarify doc for edge cases of named references and nofork substitution
Unposted whitespace change avoids a parse error in ${ ... } with comments.
2023-11-23 13:23:55 -08:00
Bart Schaefer
e6ad117ccb 52202: improve handling of quoting in ${var/pattern/replacement} 2023-11-15 20:16:04 -08:00
Oliver Kiddle
83f8a71a7c 52214: allow extra byte for nul terminator in allocation 2023-10-11 00:43:05 +02:00
Jun-ichi Takimoto
02e33c54d8 52169: a few more improvements of (#) flag
fix (#X) in C locale in FreeBSD, DragonFly, NetBSD.
Negative values such as ${(#X):--1} are now error.
UCS4 is limited to < 0x8000_0000 (in OSes without __STDC_ISO_10646__).
2023-09-27 01:56:47 +09:00
Bart Schaefer
b357992697 52176: metafy return from ${ ... } substitution 2023-09-22 20:29:40 -05:00
Bart Schaefer
1becbba0b6 users/29160, workers/52156: Fix repetition of substitution modifier. 2023-09-16 20:51:27 -07:00
Bart Schaefer
3aaef16569 52154, 52155: Implement, document, and test non-forking command substitution.
Comprises workers/51957, 51985, 51987, 51988, 51993, 52131, 52139, plus
fixes for return values, parse errors, and trailing newlines (which were
incorrectly removed) in ${ ... }
2023-09-16 17:34:39 -07:00
Jun-ichi Takimoto
0eab788437 52122 + 52129: fix (#) parameter expansion flag
Without the X flag, null string "" is substituted for bad math expression.
2023-09-13 09:59:42 +09:00
Peter Stephenson
78102120b9 51816: add :S history modifier with pattern match 2023-06-06 09:16:46 +01:00
Bart Schaefer
0562be0af8 51509 (+ fix typo): Add ${(!)name} for the referred-to name of a named reference
Extend ${!name} in ksh emulation for same
2023-03-06 19:54:48 -08:00
Bart Schaefer
a9ba166216 51483: Enable assignment and expansion of parameters with ksh-like namespace prefixes. 2023-03-05 14:03:42 -08:00
Bart Schaefer
511e020c68 51360: Initial implementation of named references. 2023-02-12 11:21:23 -08:00
Peter Stephenson
d6b027c3c1 51350: ${(S)...//#%...} didn't match the whole string 2023-02-06 14:16:17 +00:00
Peter Stephenson
76d095df9d 51306: error message in ${unset?error} should be expanded 2023-02-02 10:12:17 +00:00
Oliver Kiddle
667ead3a64 51258, 51272: refactor handling of terminal attributes, removing OFF flags in zattr 2023-01-10 20:53:17 +01:00
Oliver Kiddle
a73c705b0c 51212: remove STOUC() macro
This served as a workaround for ancient compilers where casts to
unsigned char were broken.
2022-12-16 23:28:10 +01:00
Jun-ichi Takimoto
8154ddc62d 49853 + 49882/49883: make "${arr[*]:off}" compatible with ksh/bash 2022-03-29 11:09:36 +09:00
Jun-ichi Takimoto
9b3a292410 49166: fix coredump in ${name:offset:length} with ill-formatted length 2021-07-19 09:13:03 +09:00
Peter Stephenson
d293c12de6 49102: Ignore dynamic directory name failure if NO_EXEC 2021-06-28 15:42:01 +01:00
Bart Schaefer
82ff9f24f1 48560: add TYPESET_TO_UNSET option to remove initialization of parameters
Changes typeset such that ${newparam-notset} yields "notset" and
"typeset -p newparam" does not show an assignment to the parameter.  This
is similar to the default behavior of bash and ksh, with minor differences
in typeset output.

Also add tests for some POSIX incompatibilities plus minor changes for test
harness robustness.
2021-04-18 13:58:09 -07:00
Daniel Shahaf
4ba9008ec7 48379: Make the parameter expansion subscript flags parse error message, "error in flags", identify the location of the parse error. 2021-04-08 02:19:39 +00:00
Bart Schaefer
04bd9a44a7 Unposted - fix comment 2020-09-13 17:13:51 -07:00
Bart Schaefer
63b6398b70 47364: Enable extendedglob in pattern with ${(*)name/pattern/replacement}
Mikael Magnusson: 47382: Completion for 47364
2020-09-13 16:19:52 -07:00
Peter Stephenson
4e0058afc5 users/24971: ${(-)var} sorts on signed integers 2020-07-03 21:05:46 +01:00
Peter Stephenson
7865486994 46100: Fix =subst before =(subst)
This occurs with SH file expansion ordering.

Add test.
2020-06-26 17:32:02 +01:00
Mikael Magnusson
817d461932 Support ${name:offset:length} with an empty offset 2020-05-12 10:13:02 +02:00
Daniel Shahaf
12414d8052 45583/0003: chrealpath: Let caller decide how the return value should be allocated. 2020-03-25 23:49:01 +00:00
Daniel Shahaf
38b0e1ff7e 45583/0002: chrealpath: Make symlink resolution optional. 2020-03-25 23:49:01 +00:00
Daniel Shahaf
8bc4400762 45058: internal: Add symbolic names to possible values of zexit()'s "from_where" parameter. No functional change. 2019-12-17 05:12:36 +00:00
Martijn Dekker
c578f0a08b 45004: Fix typos in comments 2019-12-11 02:37:39 +00:00
Peter Stephenson
b8dc5a7f6d 44435: Handling digita arguments for :h and :t.
Pick number of leading or trailing path components to substitute.
Active in history, brace parameters, glob qualifiers.

Add tests for all three environments.
2019-06-20 11:13:05 +01:00
Bart Schaefer
c19a0927e1 43921: ${\var} should be an error 2018-12-21 11:41:07 -08:00
Peter Stephenson
50f8fa972c 43837 plus test from Daniel: Empty string in nested subst.
Skip Nularg or there is a bogus character at the start.
2018-11-21 10:10:03 +00:00
Peter Stephenson
f99f7dca75 43616: Various parameter setting and display fixes.
Mostly to do with typeset -p and tied variables and their interaction.

Some general tied variable fixes.
2018-10-08 10:10:42 +01:00
Jun-ichi Takimoto
baedd62f0d 43219 (except term{cap,info}.c): fix several memory leaks 2018-07-31 22:15:58 +09:00
Joey Pabalinas
110b13e109 42313: avoid null-pointer deref when using ${(PA)...} on an empty array result 2018-01-23 22:28:08 -08:00
Peter Stephenson
b3fa5c528c 41877: Separate out SH_FILE_EXPANSION loop from parameter substitution.
Parameter substitution can add nodes that need to be rescanned by
it, but not by file expansion, so the two don't play well together.
2017-10-13 18:17:09 +01:00
Barton E. Schaefer
b84d69cf52 41828, 41830: skip SHFILEEXPANSION for new nodes added by stringsubst() in prefork() 2017-10-08 18:08:09 -07:00
Peter Stephenson
728f2adfc8 Add typeset -p1, like typeset -p with newlines 2017-10-01 17:53:56 +01:00
Peter Stephenson
6230e82d44 41764 (test tweaked): allow [key]+=value when modifying arrays 2017-09-27 09:41:50 +01:00
Peter Stephenson
7d4b41b52a 41747: Don't create hash entry if just checking existence.
Pass a flag in indicating this case.
2017-09-25 20:03:05 +01:00
Peter Stephenson
85b0dd7133 Updates for ksh array element syntax.
Move detection of key/value pairs down into prefork().

Detect normal array assignment and [key]=val array assignemnt
separately.  Mark key / value pairs with Marker and pass up flag.  Deal
with marked triads specially later on.
2017-09-24 17:33:07 +01:00
Peter Stephenson
e44600d9aa 41661: Need to remove tokens before using bufferwords() for (z) 2017-09-10 18:01:39 +01:00
Barton E. Schaefer
207263a61e 40929 (replaces 40598): paramsubst() should always return scalar when PREFORK_SINGLE was passed in from prefork()
Previous commit (74fe4d09) consumed too much of the input linked list,
leading to later expansions being skipped.  This commit converts from
array to string sooner, but may thereby alter rc_expand_param and array
element uniqueness behavior.
2017-04-02 14:43:27 -07:00
Barton E. Schaefer
420fc41b7c 40832: fix $x:P when PWD=/ 2017-03-11 14:40:12 -08:00
Peter Stephenson
f3f8537cfa 40760: Always tokenize unquoted - to Dash.
This fixes use of pattern match character ranges in unusual contexts.

Attempt to detect a tokenized - in cases where we don't care.
2017-03-07 10:43:58 +00:00
Barton E. Schaefer
4b8db48c6b 40640: the (A) parameter flag forces array result even if assignment syntax is not used 2017-02-25 15:56:50 -08:00
Barton E. Schaefer
74fe4d0950 40598: paramsubst() should always return scalar when PREFORK_SINGLE was passed 2017-02-20 13:26:49 -08:00