1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Make 'source' a regular built-in

The 'source' alias is now converted into a regular built-in command
so that 'unalias -a' does not remove it, and something like
	cmd=source; $cmd name args
will now work.

This is part of the project to replace default aliases that define
essential commands by proper builtins that act identically (except
you now get the actual command's name in any error/usage messages).

src/cmd/ksh93/data/aliases.c:
- Remove 'source' default alias.

src/cmd/ksh93/data/builtins.c,
src/cmd/ksh93/include/builtins.h:
- Define 'source' regular builtin with extra parser ID "SYSSOURCE".
  Same definition as '.', minus the BLT_SPC flag indicating a
  special builtin. This preserves the behaviour of 'command .'.
- Update sh_optdot[] to include info for 'source --man'.
  (Note that \f?\f expands to the current command name.
  This allows several commands to share a single --man page.)

src/cmd/ksh93/sh/parse.c:
- In the two places that SYSDOT is checked for, also check for
  SYSSOURCE, making sure the two commands are parsed identically.

src/cmd/ksh93/sh.1:
- Remove 'source' default alias.
- Document 'source' regular builtin.
This commit is contained in:
Martijn Dekker 2020-06-15 09:03:44 +02:00
parent b7f48e8a10
commit ef1621c18f
8 changed files with 38 additions and 21 deletions

7
TODO
View file

@ -32,12 +32,13 @@ Fix or remove broken or misguided default aliases:
- functions='typeset -f'
- integer='typeset -li'
- nameref='typeset -n'
- source='command .'
- stop='kill -s STOP'
- suspend='kill -s STOP $$'
Keep these default aliases for the benefit of interactive shells:
+ history='hist -l'
+ r='hist -s'
+ stop='kill -s STOP'
+ suspend='kill -s STOP $$'
To avoid interfering with shell functions by those names that POSIX
scripts may set, those should only intialise on interactive shells.
______
Fix currently known bugs affecting shell scripting. These are identified by