mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Revert "[1.0 release prep] Remove tilde expansion discipline"
This revertsc0334e32
, thereby restoring936a1939
. After the fixes in0a343244
anda2bc49be
, the tilde expansion disciplines work nicely, so they can come back to the 1.0 branch.
This commit is contained in:
parent
a2bc49bed1
commit
350e52877b
9 changed files with 134 additions and 1 deletions
|
@ -2631,7 +2631,23 @@ static void tilde_expand2(Shell_t *shp, register int offset)
|
|||
char *cp = NIL(char*); /* character pointer for tilde expansion result */
|
||||
char *stakp = stakptr(0); /* current stack object (&stakp[offset] is tilde string) */
|
||||
int curoff = staktell(); /* current offset of current stack object */
|
||||
static char block; /* for disallowing tilde expansion in .get/.set to change ${.sh.tilde} */
|
||||
/*
|
||||
* Allow overriding tilde expansion with a .sh.tilde.set or .get discipline function.
|
||||
*/
|
||||
if(!block && SH_TILDENOD->nvfun && SH_TILDENOD->nvfun->disc)
|
||||
{
|
||||
stakfreeze(1); /* terminate current stack object to avoid data corruption */
|
||||
block++;
|
||||
nv_putval(SH_TILDENOD, &stakp[offset], 0);
|
||||
cp = nv_getval(SH_TILDENOD);
|
||||
block--;
|
||||
if(cp[0]=='\0' || cp[0]=='~')
|
||||
cp = NIL(char*); /* do not use empty or unexpanded result */
|
||||
stakset(stakp,curoff); /* restore stack to state on function entry */
|
||||
}
|
||||
/*
|
||||
* Perform default tilde expansion unless overridden.
|
||||
* Write the result to the stack, if any.
|
||||
*/
|
||||
stakputc(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue