dtksh: Turn dtksh aliases into builtins and discard BLT_SPC flag

Upstream ksh has removed it's builtin aliases, favoring instead to make them
all builtin commands, this would also allow us to skip having to manually
merge another file, it was explained best in this email:

"Default aliases are an ugly hack that you are better off without.
Disadvantages include:
- 'unalias -a' becomes basically unusable as it gets rid of commands you
probably want;
- shell functions by those names are ignored (unless you quote their
names upon invocation);
- something like 'cmdname=foo; "$cmdname" bar baz' doesn't work if
$cmdname is an alias.

I strongly recommend removing the BLT_SPC flag from all of
your extra dtksh builtins. Making builtins "special builtins" is of no
real benefit at all, while introducing a pointless restriction: shell
functions by those names cannot be defined, which causes a risk of
incompatibility with scripts written for other shells. The BLT_SPC flag
is for a very few historic builtins that must have certain weird
corner-case behaviour of "special" builtins for POSIX compliance and
Bourne shell compatibility reasons."
This commit is contained in:
Chase
2020-07-19 12:32:25 -05:00
committed by Jon Trulson
parent 15a2032626
commit 0f3bcae232
3 changed files with 140 additions and 293 deletions

View File

@@ -63,7 +63,6 @@ PROGRAMS = dtksh
SRCS = \
userinit.c \
builtins.c \
aliases.c \
widget.c \
dtkcvt.c \
dtkcmds.c \
@@ -102,14 +101,13 @@ XCOMM Must replace standard ksh tables of builtins and aliases
XCOMM with our augmented versions.
XCOMM
libshell.a: $(KSH93SLIBSHELL) userinit.o builtins.o aliases.o
libshell.a: $(KSH93SLIBSHELL) userinit.o builtins.o
$(CP) $(KSH93LIBSHELL) libshell.a; \
ar d libshell.a userinit.o builtins.o aliases.o ; \
$(AR) libshell.a userinit.o builtins.o aliases.o
ar d libshell.a userinit.o builtins.o ; \
$(AR) libshell.a userinit.o builtins.o
SpecialObjectRule(userinit.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ )
SpecialObjectRule(builtins.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ )
SpecialObjectRule(aliases.o,$(NULL),-DSHOPT_VSH -DKSHELL -D_TRACE_ )
ComplexProgramTarget($(PROGRAMS))