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:
parent
b7f48e8a10
commit
ef1621c18f
8 changed files with 38 additions and 21 deletions
|
@ -1023,7 +1023,11 @@ static struct argnod *assign(Lex_t *lexp, register struct argnod *ap, int type)
|
|||
}
|
||||
else if(n && n!=FUNCTSYM)
|
||||
sh_syntax(lexp);
|
||||
else if(type!=NV_ARRAY && n!=FUNCTSYM && !(lexp->arg->argflag&ARG_ASSIGN) && !((np=nv_search(lexp->arg->argval,lexp->sh->fun_tree,0)) && (nv_isattr(np,BLT_DCL)|| np==SYSDOT)))
|
||||
else if(type!=NV_ARRAY &&
|
||||
n!=FUNCTSYM &&
|
||||
!(lexp->arg->argflag&ARG_ASSIGN) &&
|
||||
!((np=nv_search(lexp->arg->argval,lexp->sh->fun_tree,0)) &&
|
||||
(nv_isattr(np,BLT_DCL) || np==SYSDOT || np==SYSSOURCE)))
|
||||
{
|
||||
array=SH_ARRAY;
|
||||
if(fcgetc(n)==LPAREN)
|
||||
|
@ -1078,7 +1082,10 @@ static struct argnod *assign(Lex_t *lexp, register struct argnod *ap, int type)
|
|||
if(array || n!=FUNCTSYM)
|
||||
sh_syntax(lexp);
|
||||
}
|
||||
if((n!=FUNCTSYM) && !(lexp->arg->argflag&ARG_ASSIGN) && !((np=nv_search(lexp->arg->argval,lexp->sh->fun_tree,0)) && (nv_isattr(np,BLT_DCL)||np==SYSDOT)))
|
||||
if((n!=FUNCTSYM) &&
|
||||
!(lexp->arg->argflag&ARG_ASSIGN) &&
|
||||
!((np=nv_search(lexp->arg->argval,lexp->sh->fun_tree,0)) &&
|
||||
(nv_isattr(np,BLT_DCL) || np==SYSDOT || np==SYSSOURCE)))
|
||||
{
|
||||
struct argnod *arg = lexp->arg;
|
||||
if(n!=0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue