1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/include
Martijn Dekker 9e2a8c6925 posix mode: disable effect of repeating whitespace char in $IFS
ksh has a little-known field splitting feature that conflicts with
POSIX: if a single-byte whitespace character (cf. isspace(3)) is
repated in $IFS, then field splitting is done as if that character
wasn't a whitespace character. An exmaple with the tab character:

  $ (IFS=$'\t'; val=$'\tone\t\ttwo\t'; set -- $val; echo $#)
  2
  $ (IFS=$'\t\t'; val=$'\tone\t\ttwo\t'; set -- $val; echo $#)
  4
The latter being the same as, for example
  $ (IFS=':'; val='1️⃣2️⃣'; set -- $val; echo $#)
  4

However, this is incompatible with the POSIX spec and with every
other shell except zsh, in which repeating a character in IFS does
not have any effect. So the POSIX mode must disable this.

src/cmd/ksh93/include/defs.h,
src/cmd/ksh93/sh/init.c:
- Add sh_invalidate_ifs() function that invalidates the IFS state
  table by setting the ifsnp discipline struct member to NULL,
  which will cause the next get_ifs() call to regenerate it.
- get_ifs(): Treat a repeated char as S_DELIM even if whitespace,
  unless --posix is on.

src/cmd/ksh93/sh/args.c:
- sh_argopts(): Call sh_invalidate_ifs() when enabling or disabling
  the POSIX option. This is needed to make the change in field
  splitting behaviour take immediate effect instead of taking
  effect at the next assignment to IFS.
2022-03-11 21:22:22 +01:00
..
argnod.h Fix the output of typeset -p for two dimensional indexed arrays (#454) 2022-02-10 21:01:40 +00:00
builtins.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
defs.h posix mode: disable effect of repeating whitespace char in $IFS 2022-03-11 21:22:22 +01:00
edit.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
fault.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
fcin.h INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
history.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
io.h Accumulated fixes for minor issues (#442) 2022-01-30 20:42:59 +00:00
jobs.h trap: fix use after free (#446) 2022-02-05 13:53:11 +00:00
lexstates.h INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
name.h Fix multiple bugs when using 'alias -p' to print aliases (#398) 2021-12-27 03:49:06 +00:00
national.h INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup 2021-12-24 07:05:22 +00:00
nval.h Yet more misc. cleanups; rm SHOPT_PFSH, SHOPT_TYPEDEF 2022-02-10 21:04:56 +00:00
path.h Yet more misc. cleanups; rm SHOPT_PFSH, SHOPT_TYPEDEF 2022-02-10 21:04:56 +00:00
regress.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
shell.h Improve and document fast filescan loops (SHOPT_FILESCAN) 2022-02-17 19:43:36 +00:00
shlex.h Fix the output of typeset -p for two dimensional indexed arrays (#454) 2022-02-10 21:01:40 +00:00
shnodes.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
shtable.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
streval.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
terminal.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
test.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
timeout.h Add ksh 93u+m contributors notice to 964 copyright headers 2021-04-26 00:19:31 +01:00
ulimit.h Accumulated fixes for minor issues (#442) 2022-01-30 20:42:59 +00:00
variables.h Update copyright years in files changed since 1st Jan 2022 2022-01-30 20:49:04 +00:00
version.h enum: remove arbitrary one-argument limitation 2022-03-11 21:21:23 +01:00