mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
Some more accumulated minor tweaks and cleanups
Notable changes:
src/cmd/ksh93/include/fault.h:
- Get rid of the superflous sh pointer argument in the
sh_pushcontext() and sh_popcontext() macros. (re: 2d3ec8b6
)
src/cmd/ksh93/tests/io.sh:
- Tweak a process substitution test to allow up to a second for
unused process substitution processes to disappear. On the Alpine
Linux console (at least the musl libc version), this is needed to
avoid a test failure as long as no GUI is active. As soon as you
start X11, this phenomenon disappears, even on the console. Very
strange, but also very probably not ksh's fault.
src/cmd/ksh93/tests/shtests:
- Instead of just SIGCONT and SIGPIPE, set all signals to default,
just to be sure to avoid spurious test failures due to signals
that were ignored on entry. (It made no difference to the
aforementioned Alpine Linux test failure, so ignored signals had
nothing to do with that -- but still a good idea.)
.github/workflows/ci.yml:
- On the GitHub CI runs, when testing with SHOPTs disabled, disable
SHOPT_SPAWN as well, which tests that everything still works
correctly with the regular fork(2) method.
COPYRIGHT:
- Remove duplicate of BSD license.
This commit is contained in:
parent
41ee12a527
commit
172becffea
34 changed files with 84 additions and 118 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
||||||
LANG=ja_JP.SJIS script -q -e -c "bin/shtests --locale --nocompile" &&
|
LANG=ja_JP.SJIS script -q -e -c "bin/shtests --locale --nocompile" &&
|
||||||
: disable most SHOPTs, rebuild ksh &&
|
: disable most SHOPTs, rebuild ksh &&
|
||||||
sed --regexp-extended --in-place=.orig \
|
sed --regexp-extended --in-place=.orig \
|
||||||
'/^SHOPT (2DMATCH|AUDIT|BGX|BRACEPAT|DEVFD|DYNAMIC|EDPREDICT|ESH|FIXEDARRAY|HISTEXPAND|MULTIBYTE|NAMESPACE|OPTIMIZE|STATS|SUID_EXEC|VSH)=/ s/=1?/=0/' \
|
'/^SHOPT (2DMATCH|AUDIT|BGX|BRACEPAT|DEVFD|DYNAMIC|EDPREDICT|ESH|FIXEDARRAY|HISTEXPAND|MULTIBYTE|NAMESPACE|OPTIMIZE|SPAWN|STATS|SUID_EXEC|VSH)=/ s/=1?/=0/' \
|
||||||
src/cmd/ksh93/SHOPT.sh &&
|
src/cmd/ksh93/SHOPT.sh &&
|
||||||
bin/package make &&
|
bin/package make &&
|
||||||
: default regression tests with SHOPTs disabled &&
|
: default regression tests with SHOPTs disabled &&
|
||||||
|
|
32
COPYRIGHT
32
COPYRIGHT
|
@ -82,38 +82,6 @@ bsd package general copyright notice
|
||||||
# This software is part of the BSD package #
|
# This software is part of the BSD package #
|
||||||
# Copyright (c) 1979-2012 The Regents of the University of California #
|
# Copyright (c) 1979-2012 The Regents of the University of California #
|
||||||
# #
|
# #
|
||||||
# Redistribution and use in source and binary forms, with or #
|
|
||||||
# without modification, are permitted provided that the following #
|
|
||||||
# conditions are met: #
|
|
||||||
# #
|
|
||||||
# 1. Redistributions of source code must retain the above #
|
|
||||||
# copyright notice, this list of conditions and the #
|
|
||||||
# following disclaimer. #
|
|
||||||
# #
|
|
||||||
# 2. Redistributions in binary form must reproduce the above #
|
|
||||||
# copyright notice, this list of conditions and the #
|
|
||||||
# following disclaimer in the documentation and/or other #
|
|
||||||
# materials provided with the distribution. #
|
|
||||||
# #
|
|
||||||
# 3. Neither the name of The Regents of the University of California#
|
|
||||||
# names of its contributors may be used to endorse or #
|
|
||||||
# promote products derived from this software without #
|
|
||||||
# specific prior written permission. #
|
|
||||||
# #
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND #
|
|
||||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, #
|
|
||||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
|
||||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #
|
|
||||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS #
|
|
||||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
|
||||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED #
|
|
||||||
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #
|
|
||||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON #
|
|
||||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, #
|
|
||||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY #
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE. #
|
|
||||||
# #
|
|
||||||
# Redistribution and use in source and binary forms, with or without #
|
# Redistribution and use in source and binary forms, with or without #
|
||||||
# modification, are permitted provided that the following conditions #
|
# modification, are permitted provided that the following conditions #
|
||||||
# are met: #
|
# are met: #
|
||||||
|
|
|
@ -659,7 +659,7 @@ make install
|
||||||
meta main.o %.c>%.o sh/main.c main
|
meta main.o %.c>%.o sh/main.c main
|
||||||
prev sh/main.c
|
prev sh/main.c
|
||||||
prev SHOPT.sh
|
prev SHOPT.sh
|
||||||
exec - ${CC} ${mam_cc_FLAGS} ${SHOPT_TIMEOUT+-DSHOPT_TIMEOUT=${SHOPT_TIMEOUT}} ${SHOPT_ACCT+-DSHOPT_ACCT=${SHOPT_ACCT}} ${SHOPT_SYSRC+-DSHOPT_SYSRC=${SHOPT_SYSRC}} ${SHOPT_REMOTE+-DSHOPT_REMOTE=${SHOPT_REMOTE}} ${SHOPT_OLDTERMIO+-DSHOPT_OLDTERMIO=${SHOPT_OLDTERMIO}} ${SHOPT_SPAWN+-DSHOPT_SPAWN=${SHOPT_SPAWN}} ${SHOPT_P_SUID+-DSHOPT_P_SUID=${SHOPT_P_SUID}} ${SHOPT_REGRESS+-DSHOPT_REGRESS=${SHOPT_REGRESS}} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${CCFLAGS.FORCE}?} ${DEBUG+-DDEBUG=${DEBUG}} -DSH_DICT=${SH_DICT} ${SH_CMDLIB_DIR+-DSH_CMDLIB_DIR=${SH_CMDLIB_DIR}} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -DERROR_CONTEXT_T=Error_context_t -c sh/main.c
|
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${CCFLAGS.FORCE}?} ${DEBUG+-DDEBUG=${DEBUG}} -DSH_DICT=${SH_DICT} ${SH_CMDLIB_DIR+-DSH_CMDLIB_DIR=${SH_CMDLIB_DIR}} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -DERROR_CONTEXT_T=Error_context_t -c sh/main.c
|
||||||
done main.o generated
|
done main.o generated
|
||||||
make nvdisc.o
|
make nvdisc.o
|
||||||
make sh/nvdisc.c
|
make sh/nvdisc.c
|
||||||
|
@ -1147,7 +1147,7 @@ make install
|
||||||
meta trestore.o %.c>%.o sh/trestore.c trestore
|
meta trestore.o %.c>%.o sh/trestore.c trestore
|
||||||
prev sh/trestore.c
|
prev sh/trestore.c
|
||||||
prev SHOPT.sh
|
prev SHOPT.sh
|
||||||
exec - ${CC} ${mam_cc_FLAGS} ${SHOPT_SYSRC+-DSHOPT_SYSRC=${SHOPT_SYSRC}} ${SHOPT_ACCT+-DSHOPT_ACCT=${SHOPT_ACCT}} ${SHOPT_SPAWN+-DSHOPT_SPAWN=${SHOPT_SPAWN}} ${SHOPT_P_SUID+-DSHOPT_P_SUID=${SHOPT_P_SUID}} ${SHOPT_REGRESS+-DSHOPT_REGRESS=${SHOPT_REGRESS}} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${CCFLAGS.FORCE}?} ${SH_CMDLIB_DIR+-DSH_CMDLIB_DIR=${SH_CMDLIB_DIR}} -DSH_DICT=${SH_DICT} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -DERROR_CONTEXT_T=Error_context_t -c sh/trestore.c
|
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${CCFLAGS.FORCE}?} ${SH_CMDLIB_DIR+-DSH_CMDLIB_DIR=${SH_CMDLIB_DIR}} -DSH_DICT=${SH_DICT} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -DERROR_CONTEXT_T=Error_context_t -c sh/trestore.c
|
||||||
done trestore.o generated
|
done trestore.o generated
|
||||||
make waitevent.o
|
make waitevent.o
|
||||||
make sh/waitevent.c
|
make sh/waitevent.c
|
||||||
|
@ -1235,7 +1235,7 @@ make install
|
||||||
meta strdata.o %.c>%.o data/strdata.c strdata
|
meta strdata.o %.c>%.o data/strdata.c strdata
|
||||||
prev data/strdata.c
|
prev data/strdata.c
|
||||||
prev SHOPT.sh
|
prev SHOPT.sh
|
||||||
exec - ${CC} ${mam_cc_FLAGS} ${SHOPT_P_SUID+-DSHOPT_P_SUID=${SHOPT_P_SUID}} ${SHOPT_REGRESS+-DSHOPT_REGRESS=${SHOPT_REGRESS}} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${CCFLAGS.FORCE}?} ${SH_CMDLIB_DIR+-DSH_CMDLIB_DIR=${SH_CMDLIB_DIR}} -DSH_DICT=${SH_DICT} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -DERROR_CONTEXT_T=Error_context_t -c data/strdata.c
|
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${CCFLAGS.FORCE}?} ${SH_CMDLIB_DIR+-DSH_CMDLIB_DIR=${SH_CMDLIB_DIR}} -DSH_DICT=${SH_DICT} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -DERROR_CONTEXT_T=Error_context_t -c data/strdata.c
|
||||||
done strdata.o generated
|
done strdata.o generated
|
||||||
make testops.o
|
make testops.o
|
||||||
make data/testops.c
|
make data/testops.c
|
||||||
|
|
|
@ -143,7 +143,7 @@ The options have the following defaults and meanings:
|
||||||
SPAWN on Use posix_spawn(3) as combined fork/exec if job control
|
SPAWN on Use posix_spawn(3) as combined fork/exec if job control
|
||||||
is not active. Improves speed.
|
is not active. Improves speed.
|
||||||
|
|
||||||
STATS on Add .sh.stats compound variable.
|
STATS on Add .sh.stats compound variable.
|
||||||
|
|
||||||
SUID_EXEC on Execute /etc/suid_exec for setuid, setgid script.
|
SUID_EXEC on Execute /etc/suid_exec for setuid, setgid script.
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ The options have the following defaults and meanings:
|
||||||
exiting the shell when you don't enter a command. If
|
exiting the shell when you don't enter a command. If
|
||||||
non-zero, TMOUT can not be set larger than this value.
|
non-zero, TMOUT can not be set larger than this value.
|
||||||
|
|
||||||
TYPEDEF on Enable typeset type definitions.
|
TYPEDEF on Enable typeset type definitions.
|
||||||
|
|
||||||
VSH on Compile with vi command line editing. The original vi
|
VSH on Compile with vi command line editing. The original vi
|
||||||
line editor code was provided by Pat Sullivan at CB.
|
line editor code was provided by Pat Sullivan at CB.
|
||||||
|
|
|
@ -2573,7 +2573,7 @@ ____
|
||||||
directory of the script has been fixed.
|
directory of the script has been fixed.
|
||||||
01-02-19 A shell script did not always pick up tty mode changes
|
01-02-19 A shell script did not always pick up tty mode changes
|
||||||
made by external commands such as stty which could
|
made by external commands such as stty which could
|
||||||
effect the behavior of read.
|
affect the behavior of read.
|
||||||
01-02-19 The -u, -g, and -k unary tests did not give the correct
|
01-02-19 The -u, -g, and -k unary tests did not give the correct
|
||||||
results when used with negation and this has been fixed.
|
results when used with negation and this has been fixed.
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ of ksh.
|
||||||
the variable it references was the subject of a compound
|
the variable it references was the subject of a compound
|
||||||
assignment has been fixed.
|
assignment has been fixed.
|
||||||
e. A bug which in which assignment to array variables in
|
e. A bug which in which assignment to array variables in
|
||||||
a subshell could effect the parent shell has been
|
a subshell could affect the parent shell has been
|
||||||
fixed.
|
fixed.
|
||||||
f. read name?prompt was putting a 0 byte at the end of the
|
f. read name?prompt was putting a 0 byte at the end of the
|
||||||
prompt on standard error.
|
prompt on standard error.
|
||||||
|
|
|
@ -106,11 +106,11 @@ int b_getopts(int argc,char *argv[],Shbltin_t *context)
|
||||||
if(mode= (*options==':'))
|
if(mode= (*options==':'))
|
||||||
options++;
|
options++;
|
||||||
extended = *options=='\n' && *(options+1)=='[' || *options=='[' && *(options+1)=='-';
|
extended = *options=='\n' && *(options+1)=='[' || *options=='[' && *(options+1)=='-';
|
||||||
sh_pushcontext(&sh,&buff,1);
|
sh_pushcontext(&buff,1);
|
||||||
jmpval = sigsetjmp(buff.buff,0);
|
jmpval = sigsetjmp(buff.buff,0);
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
{
|
{
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
sh.st.opterror = 1;
|
sh.st.opterror = 1;
|
||||||
if(r==0)
|
if(r==0)
|
||||||
return(2);
|
return(2);
|
||||||
|
@ -199,7 +199,7 @@ int b_getopts(int argc,char *argv[],Shbltin_t *context)
|
||||||
else
|
else
|
||||||
nv_putval(np, opt_info.arg, NV_RDONLY);
|
nv_putval(np, opt_info.arg, NV_RDONLY);
|
||||||
nv_close(np);
|
nv_close(np);
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
opt_info.disc = 0;
|
opt_info.disc = 0;
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ int b_dot_cmd(register int n,char *argv[],Shbltin_t *context)
|
||||||
sh.posix_fun = 0;
|
sh.posix_fun = 0;
|
||||||
if(np || argv[1])
|
if(np || argv[1])
|
||||||
argsave = sh_argnew(argv,&saveargfor);
|
argsave = sh_argnew(argv,&saveargfor);
|
||||||
sh_pushcontext(&sh,&buff,SH_JMPDOT);
|
sh_pushcontext(&buff,SH_JMPDOT);
|
||||||
jmpval = sigsetjmp(buff.buff,0);
|
jmpval = sigsetjmp(buff.buff,0);
|
||||||
if(jmpval == 0)
|
if(jmpval == 0)
|
||||||
{
|
{
|
||||||
|
@ -324,7 +324,7 @@ int b_dot_cmd(register int n,char *argv[],Shbltin_t *context)
|
||||||
sh_eval(iop,sh_isstate(SH_PROFILE)?SH_FUNEVAL:0);
|
sh_eval(iop,sh_isstate(SH_PROFILE)?SH_FUNEVAL:0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
if(buffer)
|
if(buffer)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if(!np)
|
if(!np)
|
||||||
|
|
|
@ -347,7 +347,7 @@ int sh_readline(char **names, volatile int fd, int flags, ssize_t size, long tim
|
||||||
was_share = (sfset(iop,SF_SHARE,sh.redir0!=2)&SF_SHARE)!=0;
|
was_share = (sfset(iop,SF_SHARE,sh.redir0!=2)&SF_SHARE)!=0;
|
||||||
if(timeout || (sh.fdstatus[fd]&(IOTTY|IONOSEEK)))
|
if(timeout || (sh.fdstatus[fd]&(IOTTY|IONOSEEK)))
|
||||||
{
|
{
|
||||||
sh_pushcontext(&sh,&buff,1);
|
sh_pushcontext(&buff,1);
|
||||||
jmpval = sigsetjmp(buff.buff,0);
|
jmpval = sigsetjmp(buff.buff,0);
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -829,7 +829,7 @@ int sh_readline(char **names, volatile int fd, int flags, ssize_t size, long tim
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if(timeout || (sh.fdstatus[fd]&(IOTTY|IONOSEEK)))
|
if(timeout || (sh.fdstatus[fd]&(IOTTY|IONOSEEK)))
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
if(was_write)
|
if(was_write)
|
||||||
sfset(iop,SF_WRITE,1);
|
sfset(iop,SF_WRITE,1);
|
||||||
if(!was_share)
|
if(!was_share)
|
||||||
|
|
|
@ -1324,7 +1324,7 @@ static int unall(int argc, char **argv, register Dt_t *troot)
|
||||||
}
|
}
|
||||||
while(name = *argv++)
|
while(name = *argv++)
|
||||||
{
|
{
|
||||||
sh_pushcontext(&sh,&buff,1);
|
sh_pushcontext(&buff,1);
|
||||||
jmpval = sigsetjmp(buff.buff,0);
|
jmpval = sigsetjmp(buff.buff,0);
|
||||||
np = 0;
|
np = 0;
|
||||||
if(jmpval==0)
|
if(jmpval==0)
|
||||||
|
@ -1336,7 +1336,7 @@ static int unall(int argc, char **argv, register Dt_t *troot)
|
||||||
#endif /* SHOPT_NAMESPACE */
|
#endif /* SHOPT_NAMESPACE */
|
||||||
np=nv_open(name,troot,NV_NOADD|nflag);
|
np=nv_open(name,troot,NV_NOADD|nflag);
|
||||||
}
|
}
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
{
|
{
|
||||||
r = 1;
|
r = 1;
|
||||||
|
|
|
@ -372,7 +372,7 @@ const char sh_optalias[] =
|
||||||
"field splitting and pathname expansion are not performed on "
|
"field splitting and pathname expansion are not performed on "
|
||||||
"the arguments. Tilde expansion occurs on \avalue\a. An alias "
|
"the arguments. Tilde expansion occurs on \avalue\a. An alias "
|
||||||
"definition only affects scripts read by the current shell "
|
"definition only affects scripts read by the current shell "
|
||||||
"environment. It does not effect scripts run by this shell.]"
|
"environment. It does not affect scripts run by this shell.]"
|
||||||
"[p?Causes the output to be in the form of alias commands that can be used "
|
"[p?Causes the output to be in the form of alias commands that can be used "
|
||||||
"as input to the shell to recreate the current aliases.]"
|
"as input to the shell to recreate the current aliases.]"
|
||||||
"[t?Each \aname\a is looked up as a command in \b$PATH\b and its path is "
|
"[t?Each \aname\a is looked up as a command in \b$PATH\b and its path is "
|
||||||
|
|
|
@ -1716,7 +1716,6 @@ static int ed_histlencopy(const char *cp, char *dp)
|
||||||
*dp++ = *oldcp++;
|
*dp++ = *oldcp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -714,7 +714,6 @@ update:
|
||||||
draw(ep,UPDATE);
|
draw(ep,UPDATE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process:
|
process:
|
||||||
|
@ -880,7 +879,6 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 'b': /* M-b == go backward one word */
|
case 'b': /* M-b == go backward one word */
|
||||||
case DELETE :
|
case DELETE :
|
||||||
case '\b':
|
case '\b':
|
||||||
|
@ -1429,9 +1427,7 @@ static void draw(register Emacs_t *ep,Draw_t option)
|
||||||
|
|
||||||
if ((lookahead)&&(option != FINAL))
|
if ((lookahead)&&(option != FINAL))
|
||||||
{
|
{
|
||||||
|
|
||||||
ep->scvalid = 0; /* Screen is out of date, APPEND will not work */
|
ep->scvalid = 0; /* Screen is out of date, APPEND will not work */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1441,7 +1437,6 @@ static void draw(register Emacs_t *ep,Draw_t option)
|
||||||
and the window has room for another character,
|
and the window has room for another character,
|
||||||
then output the character and adjust the screen only.
|
then output the character and adjust the screen only.
|
||||||
*****************************************/
|
*****************************************/
|
||||||
|
|
||||||
|
|
||||||
if(logcursor > drawbuff)
|
if(logcursor > drawbuff)
|
||||||
i = *(logcursor-1); /* last character inserted */
|
i = *(logcursor-1); /* last character inserted */
|
||||||
|
|
|
@ -301,7 +301,6 @@ getline:
|
||||||
flag |= HIST_EVENT;
|
flag |= HIST_EVENT;
|
||||||
if(str) /* !string or !?string? event designator */
|
if(str) /* !string or !?string? event designator */
|
||||||
{
|
{
|
||||||
|
|
||||||
/* search history for string */
|
/* search history for string */
|
||||||
hl = hist_find(sh.hist_ptr, str,
|
hl = hist_find(sh.hist_ptr, str,
|
||||||
sh.hist_ptr->histind,
|
sh.hist_ptr->histind,
|
||||||
|
|
|
@ -101,12 +101,20 @@ struct checkpt
|
||||||
Error_context_t err;
|
Error_context_t err;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define sh_pushcontext(shp,bp,n)( (bp)->mode=(n) , (bp)->olist=0, \
|
#define sh_pushcontext(bp,n) \
|
||||||
(bp)->topfd=(shp)->topfd, (bp)->prev=(shp)->jmplist, \
|
( \
|
||||||
(bp)->err = *ERROR_CONTEXT_BASE, \
|
(bp)->mode = (n), \
|
||||||
(shp)->jmplist = (sigjmp_buf*)(&(bp)->buff) \
|
(bp)->olist = 0, \
|
||||||
)
|
(bp)->topfd = sh.topfd, \
|
||||||
#define sh_popcontext(shp,bp) ((shp)->jmplist=(bp)->prev, errorpop(&((bp)->err)))
|
(bp)->prev = sh.jmplist, \
|
||||||
|
(bp)->err = *ERROR_CONTEXT_BASE, \
|
||||||
|
sh.jmplist = (sigjmp_buf*)(&(bp)->buff) \
|
||||||
|
)
|
||||||
|
#define sh_popcontext(bp) \
|
||||||
|
( \
|
||||||
|
sh.jmplist = (bp)->prev, \
|
||||||
|
errorpop(&((bp)->err)) \
|
||||||
|
)
|
||||||
|
|
||||||
extern noreturn void sh_done(int);
|
extern noreturn void sh_done(int);
|
||||||
extern void sh_fault(int);
|
extern void sh_fault(int);
|
||||||
|
|
|
@ -153,7 +153,7 @@ struct Namval
|
||||||
#define NV_RAW NV_LJUST /* used only with NV_BINARY */
|
#define NV_RAW NV_LJUST /* used only with NV_BINARY */
|
||||||
#define NV_HOST (NV_RJUST|NV_LJUST) /* map to host filename */
|
#define NV_HOST (NV_RJUST|NV_LJUST) /* map to host filename */
|
||||||
|
|
||||||
/* The following attributes do not effect the value */
|
/* The following attributes do not affect the value */
|
||||||
#define NV_RDONLY 0x1 /* readonly bit */
|
#define NV_RDONLY 0x1 /* readonly bit */
|
||||||
#define NV_EXPORT 0x2000 /* export bit */
|
#define NV_EXPORT 0x2000 /* export bit */
|
||||||
#define NV_TAGGED 0x8000 /* user define tag bit */
|
#define NV_TAGGED 0x8000 /* user define tag bit */
|
||||||
|
|
|
@ -389,7 +389,7 @@ procedure (the shell equivalent of an include file)
|
||||||
is read all at once (unlike
|
is read all at once (unlike
|
||||||
start up files
|
start up files
|
||||||
which are read a command at
|
which are read a command at
|
||||||
a time) so that any aliases defined there will not effect any commands
|
a time) so that any aliases defined there will not affect any commands
|
||||||
within this script.
|
within this script.
|
||||||
Predefined aliases do not have this problem.
|
Predefined aliases do not have this problem.
|
||||||
.H 2 "Command Re-entry"
|
.H 2 "Command Re-entry"
|
||||||
|
@ -2680,7 +2680,7 @@ part of the language rather than user definable commands.
|
||||||
The best examples of commands that fit this description
|
The best examples of commands that fit this description
|
||||||
are \f5break\fP and \f5continue\fP.
|
are \f5break\fP and \f5continue\fP.
|
||||||
Because they are not reserved words, they can be the
|
Because they are not reserved words, they can be the
|
||||||
result of shell expansions and are not effected by quoting.
|
result of shell expansions and are not affected by quoting.
|
||||||
These commands have the following special properties:
|
These commands have the following special properties:
|
||||||
.BL
|
.BL
|
||||||
.LI
|
.LI
|
||||||
|
|
|
@ -464,7 +464,7 @@ int sh_trap(const char *trap, int mode)
|
||||||
sh_offstate(SH_HISTORY);
|
sh_offstate(SH_HISTORY);
|
||||||
sh_offstate(SH_VERBOSE);
|
sh_offstate(SH_VERBOSE);
|
||||||
sh.intrap++;
|
sh.intrap++;
|
||||||
sh_pushcontext(&sh,&buff,SH_JMPTRAP);
|
sh_pushcontext(&buff,SH_JMPTRAP);
|
||||||
jmpval = sigsetjmp(buff.buff,0);
|
jmpval = sigsetjmp(buff.buff,0);
|
||||||
if(jmpval == 0)
|
if(jmpval == 0)
|
||||||
{
|
{
|
||||||
|
@ -491,7 +491,7 @@ int sh_trap(const char *trap, int mode)
|
||||||
jmpval=SH_JMPTRAP;
|
jmpval=SH_JMPTRAP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
sh.intrap--;
|
sh.intrap--;
|
||||||
sfsync(sh.outpool);
|
sfsync(sh.outpool);
|
||||||
savxit_return = sh.exitval;
|
savxit_return = sh.exitval;
|
||||||
|
|
|
@ -1449,7 +1449,7 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
||||||
*/
|
*/
|
||||||
error_info.id = sh_strdup(sh.st.dolv[0]); /* error_info.id is $0 */
|
error_info.id = sh_strdup(sh.st.dolv[0]); /* error_info.id is $0 */
|
||||||
sh.jmpbuffer = (void*)&sh.checkbase;
|
sh.jmpbuffer = (void*)&sh.checkbase;
|
||||||
sh_pushcontext(&sh,&sh.checkbase,SH_JMPSCRIPT);
|
sh_pushcontext(&sh.checkbase,SH_JMPSCRIPT);
|
||||||
sh.st.self = &sh.global;
|
sh.st.self = &sh.global;
|
||||||
sh.topscope = (Shscope_t*)sh.st.self;
|
sh.topscope = (Shscope_t*)sh.st.self;
|
||||||
sh_offstate(SH_INIT);
|
sh_offstate(SH_INIT);
|
||||||
|
|
|
@ -1536,7 +1536,6 @@ static int comsub(register Lex_t *lp, int endtok)
|
||||||
{
|
{
|
||||||
if(endtok==LPAREN && lp->lexd.paren)
|
if(endtok==LPAREN && lp->lexd.paren)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(first==lp->lexd.first)
|
if(first==lp->lexd.first)
|
||||||
{
|
{
|
||||||
n = cp+1-(char*)fcseek(0);
|
n = cp+1-(char*)fcseek(0);
|
||||||
|
|
|
@ -130,11 +130,11 @@ char *sh_mactry(register char *string)
|
||||||
int savexit = sh.savexit;
|
int savexit = sh.savexit;
|
||||||
struct checkpt buff;
|
struct checkpt buff;
|
||||||
Lex_t *lexp = (Lex_t*)sh.lex_context, savelex = *lexp;
|
Lex_t *lexp = (Lex_t*)sh.lex_context, savelex = *lexp;
|
||||||
sh_pushcontext(&sh,&buff,SH_JMPSUB);
|
sh_pushcontext(&buff,SH_JMPSUB);
|
||||||
jmp_val = sigsetjmp(buff.buff,0);
|
jmp_val = sigsetjmp(buff.buff,0);
|
||||||
if(jmp_val == 0)
|
if(jmp_val == 0)
|
||||||
string = sh_mactrim(string,0);
|
string = sh_mactrim(string,0);
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
*lexp = savelex;
|
*lexp = savelex;
|
||||||
sh.savexit = savexit;
|
sh.savexit = savexit;
|
||||||
return(string);
|
return(string);
|
||||||
|
@ -2156,14 +2156,14 @@ static void comsubst(Mac_t *mp,register Shnode_t* t, int type)
|
||||||
int r=0;
|
int r=0;
|
||||||
struct checkpt buff;
|
struct checkpt buff;
|
||||||
struct ionod *ip=0;
|
struct ionod *ip=0;
|
||||||
sh_pushcontext(&sh,&buff,SH_JMPIO);
|
sh_pushcontext(&buff,SH_JMPIO);
|
||||||
if((ip=t->tre.treio) &&
|
if((ip=t->tre.treio) &&
|
||||||
((ip->iofile&IOLSEEK) || !(ip->iofile&IOUFD)) &&
|
((ip->iofile&IOLSEEK) || !(ip->iofile&IOUFD)) &&
|
||||||
(r=sigsetjmp(buff.buff,0))==0)
|
(r=sigsetjmp(buff.buff,0))==0)
|
||||||
fd = sh_redirect(ip,3);
|
fd = sh_redirect(ip,3);
|
||||||
else
|
else
|
||||||
fd = sh_chkopen(e_devnull);
|
fd = sh_chkopen(e_devnull);
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
if(r==0 && ip && (ip->iofile&IOLSEEK))
|
if(r==0 && ip && (ip->iofile&IOLSEEK))
|
||||||
{
|
{
|
||||||
if(sp=sh.sftable[fd])
|
if(sp=sh.sftable[fd])
|
||||||
|
|
|
@ -365,7 +365,7 @@ static void exfile(register Sfio_t *iop,register int fno)
|
||||||
int maxtry=IOMAXTRY, tdone=0, execflags;
|
int maxtry=IOMAXTRY, tdone=0, execflags;
|
||||||
int states,jmpval;
|
int states,jmpval;
|
||||||
struct checkpt buff;
|
struct checkpt buff;
|
||||||
sh_pushcontext(&sh,&buff,SH_JMPERREXIT);
|
sh_pushcontext(&buff,SH_JMPERREXIT);
|
||||||
/* open input stream */
|
/* open input stream */
|
||||||
nv_putval(SH_PATHNAMENOD, sh.st.filename, NV_NOFREE);
|
nv_putval(SH_PATHNAMENOD, sh.st.filename, NV_NOFREE);
|
||||||
if(!iop)
|
if(!iop)
|
||||||
|
@ -600,7 +600,7 @@ static void exfile(register Sfio_t *iop,register int fno)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
if(sh_isstate(SH_INTERACTIVE))
|
if(sh_isstate(SH_INTERACTIVE))
|
||||||
{
|
{
|
||||||
if(isatty(0) && !sh_isoption(SH_CFLAG))
|
if(isatty(0) && !sh_isoption(SH_CFLAG))
|
||||||
|
|
|
@ -2565,7 +2565,6 @@ void _nv_unset(register Namval_t *np,int flags)
|
||||||
up = np->nvalue.up;
|
up = np->nvalue.up;
|
||||||
else if(nv_isref(np) && !nv_isattr(np,NV_EXPORT|NV_MINIMAL) && np->nvalue.nrp)
|
else if(nv_isref(np) && !nv_isattr(np,NV_EXPORT|NV_MINIMAL) && np->nvalue.nrp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(np->nvalue.nrp->root && Refdict)
|
if(np->nvalue.nrp->root && Refdict)
|
||||||
dtdelete(Refdict,(void*)np->nvalue.nrp);
|
dtdelete(Refdict,(void*)np->nvalue.nrp);
|
||||||
if(np->nvalue.nrp->sub)
|
if(np->nvalue.nrp->sub)
|
||||||
|
|
|
@ -294,11 +294,11 @@ static void assign(Namval_t *np,const char* val,int flags,Namfun_t *handle)
|
||||||
block(bp,type);
|
block(bp,type);
|
||||||
if(bflag = (type==APPEND && !isblocked(bp,LOOKUPS)))
|
if(bflag = (type==APPEND && !isblocked(bp,LOOKUPS)))
|
||||||
block(bp,LOOKUPS);
|
block(bp,LOOKUPS);
|
||||||
sh_pushcontext(&sh, &checkpoint, 1);
|
sh_pushcontext(&checkpoint, 1);
|
||||||
jmpval = sigsetjmp(checkpoint.buff, 0);
|
jmpval = sigsetjmp(checkpoint.buff, 0);
|
||||||
if(!jmpval)
|
if(!jmpval)
|
||||||
sh_fun(nq,np,(char**)0);
|
sh_fun(nq,np,(char**)0);
|
||||||
sh_popcontext(&sh, &checkpoint);
|
sh_popcontext(&checkpoint);
|
||||||
if(sh.topfd != checkpoint.topfd)
|
if(sh.topfd != checkpoint.topfd)
|
||||||
sh_iorestore(checkpoint.topfd, jmpval);
|
sh_iorestore(checkpoint.topfd, jmpval);
|
||||||
unblock(bp,type);
|
unblock(bp,type);
|
||||||
|
@ -410,11 +410,11 @@ static char* lookup(Namval_t *np, int type, Sfdouble_t *dp,Namfun_t *handle)
|
||||||
}
|
}
|
||||||
block(bp,type);
|
block(bp,type);
|
||||||
block(bp, UNASSIGN); /* make sure nv_setdisc doesn't invalidate 'vp' by freeing it */
|
block(bp, UNASSIGN); /* make sure nv_setdisc doesn't invalidate 'vp' by freeing it */
|
||||||
sh_pushcontext(&sh, &checkpoint, 1);
|
sh_pushcontext(&checkpoint, 1);
|
||||||
jmpval = sigsetjmp(checkpoint.buff, 0);
|
jmpval = sigsetjmp(checkpoint.buff, 0);
|
||||||
if(!jmpval)
|
if(!jmpval)
|
||||||
sh_fun(nq,np,(char**)0);
|
sh_fun(nq,np,(char**)0);
|
||||||
sh_popcontext(&sh, &checkpoint);
|
sh_popcontext(&checkpoint);
|
||||||
if(sh.topfd != checkpoint.topfd)
|
if(sh.topfd != checkpoint.topfd)
|
||||||
sh_iorestore(checkpoint.topfd, jmpval);
|
sh_iorestore(checkpoint.topfd, jmpval);
|
||||||
unblock(bp,UNASSIGN);
|
unblock(bp,UNASSIGN);
|
||||||
|
|
|
@ -396,7 +396,6 @@ void nv_attribute(register Namval_t *np,Sfio_t *out,char *prefix,int noname)
|
||||||
}
|
}
|
||||||
if(np==typep)
|
if(np==typep)
|
||||||
{
|
{
|
||||||
|
|
||||||
fp = 0;
|
fp = 0;
|
||||||
typep = 0;
|
typep = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -771,7 +771,6 @@ static Shnode_t *arithfor(Lex_t *lexp,register Shnode_t *tf)
|
||||||
tw->wh.dotre = sh_cmd(lexp,n==DOSYM?DONESYM:RBRACE,SH_NL|SH_SEMI);
|
tw->wh.dotre = sh_cmd(lexp,n==DOSYM?DONESYM:RBRACE,SH_NL|SH_SEMI);
|
||||||
tw->wh.whtyp = TWH;
|
tw->wh.whtyp = TWH;
|
||||||
return(tf);
|
return(tf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Shnode_t *funct(Lex_t *lexp)
|
static Shnode_t *funct(Lex_t *lexp)
|
||||||
|
@ -875,7 +874,7 @@ static Shnode_t *funct(Lex_t *lexp)
|
||||||
}
|
}
|
||||||
if((flag && lexp->token!=LBRACE) || lexp->token==EOFSYM)
|
if((flag && lexp->token!=LBRACE) || lexp->token==EOFSYM)
|
||||||
sh_syntax(lexp);
|
sh_syntax(lexp);
|
||||||
sh_pushcontext(&sh,&buff,1);
|
sh_pushcontext(&buff,1);
|
||||||
jmpval = sigsetjmp(buff.buff,0);
|
jmpval = sigsetjmp(buff.buff,0);
|
||||||
if(jmpval == 0)
|
if(jmpval == 0)
|
||||||
{
|
{
|
||||||
|
@ -927,7 +926,7 @@ static Shnode_t *funct(Lex_t *lexp)
|
||||||
}
|
}
|
||||||
else if(sh.shcomp)
|
else if(sh.shcomp)
|
||||||
exit(1);
|
exit(1);
|
||||||
sh_popcontext(&sh,&buff);
|
sh_popcontext(&buff);
|
||||||
loop_level = saveloop;
|
loop_level = saveloop;
|
||||||
label_last = savelabel;
|
label_last = savelabel;
|
||||||
/* restore the old stack */
|
/* restore the old stack */
|
||||||
|
|
|
@ -502,7 +502,7 @@ Sfio_t *sh_subshell(Shnode_t *t, volatile int flags, int comsub)
|
||||||
}
|
}
|
||||||
sh.curenv = ++subenv;
|
sh.curenv = ++subenv;
|
||||||
savst = sh.st;
|
savst = sh.st;
|
||||||
sh_pushcontext(&sh,&checkpoint,SH_JMPSUB);
|
sh_pushcontext(&checkpoint,SH_JMPSUB);
|
||||||
sh.subshell++; /* increase level of virtual subshells */
|
sh.subshell++; /* increase level of virtual subshells */
|
||||||
sh.realsubshell++; /* increase ${.sh.subshell} */
|
sh.realsubshell++; /* increase ${.sh.subshell} */
|
||||||
sp->prev = subshell_data;
|
sp->prev = subshell_data;
|
||||||
|
@ -676,7 +676,7 @@ Sfio_t *sh_subshell(Shnode_t *t, volatile int flags, int comsub)
|
||||||
if(sh.subshell==0) /* we must have forked with sh_subfork(); this is the child process */
|
if(sh.subshell==0) /* we must have forked with sh_subfork(); this is the child process */
|
||||||
{
|
{
|
||||||
subshell_data = sp->prev;
|
subshell_data = sp->prev;
|
||||||
sh_popcontext(&sh,&checkpoint);
|
sh_popcontext(&checkpoint);
|
||||||
if(jmpval==SH_JMPSCRIPT)
|
if(jmpval==SH_JMPSCRIPT)
|
||||||
siglongjmp(*sh.jmplist,jmpval);
|
siglongjmp(*sh.jmplist,jmpval);
|
||||||
sh.exitval &= SH_EXITMASK;
|
sh.exitval &= SH_EXITMASK;
|
||||||
|
@ -881,7 +881,7 @@ Sfio_t *sh_subshell(Shnode_t *t, volatile int flags, int comsub)
|
||||||
sh.subshell--; /* decrease level of virtual subshells */
|
sh.subshell--; /* decrease level of virtual subshells */
|
||||||
sh.realsubshell--; /* decrease ${.sh.subshell} */
|
sh.realsubshell--; /* decrease ${.sh.subshell} */
|
||||||
subshell_data = sp->prev;
|
subshell_data = sp->prev;
|
||||||
sh_popcontext(&sh,&checkpoint);
|
sh_popcontext(&checkpoint);
|
||||||
if(!argsav || argsav->dolrefcnt==argcnt)
|
if(!argsav || argsav->dolrefcnt==argcnt)
|
||||||
sh_argfree(argsav,0);
|
sh_argfree(argsav,0);
|
||||||
if(sh.topfd != checkpoint.topfd)
|
if(sh.topfd != checkpoint.topfd)
|
||||||
|
|
|
@ -687,7 +687,7 @@ int sh_eval(register Sfio_t *iop, int mode)
|
||||||
mode ^= SH_TOPFUN;
|
mode ^= SH_TOPFUN;
|
||||||
sh.fn_reset = 1;
|
sh.fn_reset = 1;
|
||||||
}
|
}
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPEVAL);
|
sh_pushcontext(buffp,SH_JMPEVAL);
|
||||||
buffp->olist = pp->olist;
|
buffp->olist = pp->olist;
|
||||||
jmpval = sigsetjmp(buffp->buff,0);
|
jmpval = sigsetjmp(buffp->buff,0);
|
||||||
while(jmpval==0)
|
while(jmpval==0)
|
||||||
|
@ -718,7 +718,7 @@ int sh_eval(register Sfio_t *iop, int mode)
|
||||||
if(!(mode&SH_FUNEVAL))
|
if(!(mode&SH_FUNEVAL))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
sh.binscript = binscript;
|
sh.binscript = binscript;
|
||||||
sh.comsub = comsub;
|
sh.comsub = comsub;
|
||||||
if(traceon)
|
if(traceon)
|
||||||
|
@ -1120,11 +1120,11 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
{
|
{
|
||||||
/* avoid exit on error from nv_setlist, e.g. read-only variable */
|
/* avoid exit on error from nv_setlist, e.g. read-only variable */
|
||||||
struct checkpt *chkp = (struct checkpt*)stakalloc(sizeof(struct checkpt));
|
struct checkpt *chkp = (struct checkpt*)stakalloc(sizeof(struct checkpt));
|
||||||
sh_pushcontext(&sh,chkp,SH_JMPCMD);
|
sh_pushcontext(chkp,SH_JMPCMD);
|
||||||
jmpval = sigsetjmp(chkp->buff,1);
|
jmpval = sigsetjmp(chkp->buff,1);
|
||||||
if(!jmpval)
|
if(!jmpval)
|
||||||
nv_setlist(argp,flgs,tp);
|
nv_setlist(argp,flgs,tp);
|
||||||
sh_popcontext(&sh,chkp);
|
sh_popcontext(chkp);
|
||||||
if(jmpval) /* error occurred */
|
if(jmpval) /* error occurred */
|
||||||
goto setexit;
|
goto setexit;
|
||||||
}
|
}
|
||||||
|
@ -1272,7 +1272,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
}
|
}
|
||||||
if(execflg)
|
if(execflg)
|
||||||
sh_onstate(SH_NOFORK);
|
sh_onstate(SH_NOFORK);
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPCMD);
|
sh_pushcontext(buffp,SH_JMPCMD);
|
||||||
jmpval = sigsetjmp(buffp->buff,1);
|
jmpval = sigsetjmp(buffp->buff,1);
|
||||||
if(jmpval == 0)
|
if(jmpval == 0)
|
||||||
{
|
{
|
||||||
|
@ -1422,7 +1422,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
sfpool(sfstdin,NIL(Sfio_t*),SF_WRITE);
|
sfpool(sfstdin,NIL(Sfio_t*),SF_WRITE);
|
||||||
sh.nextprompt = save_prompt;
|
sh.nextprompt = save_prompt;
|
||||||
}
|
}
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
errorpop(&buffp->err);
|
errorpop(&buffp->err);
|
||||||
error_info.flags &= ~(ERROR_SILENT|ERROR_NOTIFY);
|
error_info.flags &= ~(ERROR_SILENT|ERROR_NOTIFY);
|
||||||
sh.bltinfun = 0;
|
sh.bltinfun = 0;
|
||||||
|
@ -1507,7 +1507,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
if(io)
|
if(io)
|
||||||
{
|
{
|
||||||
indx = sh.topfd;
|
indx = sh.topfd;
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPIO);
|
sh_pushcontext(buffp,SH_JMPIO);
|
||||||
jmpval = sigsetjmp(buffp->buff,0);
|
jmpval = sigsetjmp(buffp->buff,0);
|
||||||
}
|
}
|
||||||
if(jmpval == 0)
|
if(jmpval == 0)
|
||||||
|
@ -1537,7 +1537,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
{
|
{
|
||||||
if(buffp->olist)
|
if(buffp->olist)
|
||||||
free_list(buffp->olist);
|
free_list(buffp->olist);
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
sh_iorestore(indx,jmpval);
|
sh_iorestore(indx,jmpval);
|
||||||
}
|
}
|
||||||
if(nq)
|
if(nq)
|
||||||
|
@ -1715,7 +1715,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
#endif
|
#endif
|
||||||
if(no_fork)
|
if(no_fork)
|
||||||
sh_sigreset(2);
|
sh_sigreset(2);
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPEXIT);
|
sh_pushcontext(buffp,SH_JMPEXIT);
|
||||||
jmpval = sigsetjmp(buffp->buff,0);
|
jmpval = sigsetjmp(buffp->buff,0);
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1826,7 +1826,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
free(save_sh_fifo);
|
free(save_sh_fifo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
if(jmpval>SH_JMPEXIT)
|
if(jmpval>SH_JMPEXIT)
|
||||||
siglongjmp(*sh.jmplist,jmpval);
|
siglongjmp(*sh.jmplist,jmpval);
|
||||||
sh_done(0);
|
sh_done(0);
|
||||||
|
@ -1843,7 +1843,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
int jmpval, waitall = 0;
|
int jmpval, waitall = 0;
|
||||||
int simple = (t->fork.forktre->tre.tretyp&COMMSK)==TCOM;
|
int simple = (t->fork.forktre->tre.tretyp&COMMSK)==TCOM;
|
||||||
struct checkpt *buffp = (struct checkpt*)stkalloc(sh.stk,sizeof(struct checkpt));
|
struct checkpt *buffp = (struct checkpt*)stkalloc(sh.stk,sizeof(struct checkpt));
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPIO);
|
sh_pushcontext(buffp,SH_JMPIO);
|
||||||
if(type&FPIN)
|
if(type&FPIN)
|
||||||
{
|
{
|
||||||
was_interactive = sh_isstate(SH_INTERACTIVE);
|
was_interactive = sh_isstate(SH_INTERACTIVE);
|
||||||
|
@ -1877,7 +1877,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sfsync(sh.outpool);
|
sfsync(sh.outpool);
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
sh_iorestore(buffp->topfd,jmpval);
|
sh_iorestore(buffp->topfd,jmpval);
|
||||||
if(buffp->olist)
|
if(buffp->olist)
|
||||||
free_list(buffp->olist);
|
free_list(buffp->olist);
|
||||||
|
@ -1927,11 +1927,11 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
sh_reseed_rand((struct rand*)RANDNOD->nvfun);
|
sh_reseed_rand((struct rand*)RANDNOD->nvfun);
|
||||||
sh.realsubshell++;
|
sh.realsubshell++;
|
||||||
sh_sigreset(0);
|
sh_sigreset(0);
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPEXIT);
|
sh_pushcontext(buffp,SH_JMPEXIT);
|
||||||
jmpval = sigsetjmp(buffp->buff,0);
|
jmpval = sigsetjmp(buffp->buff,0);
|
||||||
if(jmpval==0)
|
if(jmpval==0)
|
||||||
sh_exec(t->par.partre,flags);
|
sh_exec(t->par.partre,flags);
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
if(jmpval > SH_JMPEXIT)
|
if(jmpval > SH_JMPEXIT)
|
||||||
siglongjmp(*sh.jmplist,jmpval);
|
siglongjmp(*sh.jmplist,jmpval);
|
||||||
if(sh.exitval > 256)
|
if(sh.exitval > 256)
|
||||||
|
@ -2115,7 +2115,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
void *optlist = sh.optlist;
|
void *optlist = sh.optlist;
|
||||||
sh.optlist = 0;
|
sh.optlist = 0;
|
||||||
sh_tclear(t->for_.fortre);
|
sh_tclear(t->for_.fortre);
|
||||||
sh_pushcontext(&sh,buffp,jmpval);
|
sh_pushcontext(buffp,jmpval);
|
||||||
jmpval = sigsetjmp(buffp->buff,0);
|
jmpval = sigsetjmp(buffp->buff,0);
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
goto endfor;
|
goto endfor;
|
||||||
|
@ -2211,7 +2211,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
}
|
}
|
||||||
#if SHOPT_OPTIMIZE
|
#if SHOPT_OPTIMIZE
|
||||||
endfor:
|
endfor:
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
sh_tclear(t->for_.fortre);
|
sh_tclear(t->for_.fortre);
|
||||||
sh_optclear(optlist);
|
sh_optclear(optlist);
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
|
@ -2243,7 +2243,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
sh.optlist = 0;
|
sh.optlist = 0;
|
||||||
sh_tclear(t->wh.whtre);
|
sh_tclear(t->wh.whtre);
|
||||||
sh_tclear(t->wh.dotre);
|
sh_tclear(t->wh.dotre);
|
||||||
sh_pushcontext(&sh,buffp,jmpval);
|
sh_pushcontext(buffp,jmpval);
|
||||||
jmpval = sigsetjmp(buffp->buff,0);
|
jmpval = sigsetjmp(buffp->buff,0);
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
goto endwhile;
|
goto endwhile;
|
||||||
|
@ -2284,7 +2284,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
}
|
}
|
||||||
#if SHOPT_OPTIMIZE
|
#if SHOPT_OPTIMIZE
|
||||||
endwhile:
|
endwhile:
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
sh_tclear(t->wh.whtre);
|
sh_tclear(t->wh.whtre);
|
||||||
sh_tclear(t->wh.dotre);
|
sh_tclear(t->wh.dotre);
|
||||||
sh_optclear(optlist);
|
sh_optclear(optlist);
|
||||||
|
@ -3178,7 +3178,7 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg)
|
||||||
}
|
}
|
||||||
sh_sigreset(0);
|
sh_sigreset(0);
|
||||||
argsav = sh_argnew(argv,&saveargfor);
|
argsav = sh_argnew(argv,&saveargfor);
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPFUN);
|
sh_pushcontext(buffp,SH_JMPFUN);
|
||||||
errorpush(&buffp->err,0);
|
errorpush(&buffp->err,0);
|
||||||
error_info.id = argv[0];
|
error_info.id = argv[0];
|
||||||
sh.st.var_local = sh.var_tree;
|
sh.st.var_local = sh.var_tree;
|
||||||
|
@ -3232,7 +3232,7 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg)
|
||||||
errormsg(SH_DICT,ERROR_exit(1),e_toodeep,argv[0]);
|
errormsg(SH_DICT,ERROR_exit(1),e_toodeep,argv[0]);
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
sh_unscope();
|
sh_unscope();
|
||||||
sh.namespace = nspace;
|
sh.namespace = nspace;
|
||||||
sh.var_tree = (Dt_t*)prevscope->save_tree;
|
sh.var_tree = (Dt_t*)prevscope->save_tree;
|
||||||
|
@ -3379,7 +3379,7 @@ int sh_fun(Namval_t *np, Namval_t *nq, char *argv[])
|
||||||
int jmpval;
|
int jmpval;
|
||||||
struct checkpt *buffp = (struct checkpt*)stkalloc(sh.stk,sizeof(struct checkpt));
|
struct checkpt *buffp = (struct checkpt*)stkalloc(sh.stk,sizeof(struct checkpt));
|
||||||
Shbltin_t *bp = &sh.bltindata;
|
Shbltin_t *bp = &sh.bltindata;
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPCMD);
|
sh_pushcontext(buffp,SH_JMPCMD);
|
||||||
jmpval = sigsetjmp(buffp->buff,1);
|
jmpval = sigsetjmp(buffp->buff,1);
|
||||||
if(jmpval == 0)
|
if(jmpval == 0)
|
||||||
{
|
{
|
||||||
|
@ -3392,7 +3392,7 @@ int sh_fun(Namval_t *np, Namval_t *nq, char *argv[])
|
||||||
sh.exitval = 0;
|
sh.exitval = 0;
|
||||||
sh.exitval = ((Shbltin_f)funptr(np))(n,argv,bp);
|
sh.exitval = ((Shbltin_f)funptr(np))(n,argv,bp);
|
||||||
}
|
}
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
if(jmpval>SH_JMPCMD)
|
if(jmpval>SH_JMPCMD)
|
||||||
siglongjmp(*sh.jmplist,jmpval);
|
siglongjmp(*sh.jmplist,jmpval);
|
||||||
}
|
}
|
||||||
|
@ -3484,7 +3484,7 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int flag)
|
||||||
otype = savetype;
|
otype = savetype;
|
||||||
savetype=0;
|
savetype=0;
|
||||||
}
|
}
|
||||||
sh_pushcontext(&sh,buffp,SH_JMPCMD);
|
sh_pushcontext(buffp,SH_JMPCMD);
|
||||||
errorpush(&buffp->err,ERROR_SILENT);
|
errorpush(&buffp->err,ERROR_SILENT);
|
||||||
job_lock(); /* errormsg will unlock */
|
job_lock(); /* errormsg will unlock */
|
||||||
jmpval = sigsetjmp(buffp->buff,0);
|
jmpval = sigsetjmp(buffp->buff,0);
|
||||||
|
@ -3602,7 +3602,7 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int flag)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
exitset();
|
exitset();
|
||||||
sh_popcontext(&sh,buffp);
|
sh_popcontext(buffp);
|
||||||
if(buffp->olist)
|
if(buffp->olist)
|
||||||
free_list(buffp->olist);
|
free_list(buffp->olist);
|
||||||
if(sigwasset)
|
if(sigwasset)
|
||||||
|
|
|
@ -976,7 +976,6 @@ function _Dbg_print_frame
|
||||||
|
|
||||||
function _Dbg_debug_trap_handler
|
function _Dbg_debug_trap_handler
|
||||||
{
|
{
|
||||||
|
|
||||||
integer .level=.sh.level .max=.sh.level-1
|
integer .level=.sh.level .max=.sh.level-1
|
||||||
while((--.level>=0))
|
while((--.level>=0))
|
||||||
do
|
do
|
||||||
|
|
|
@ -800,7 +800,12 @@ procsub_pid=$(
|
||||||
true >(true) <(true) >(true) <(true)
|
true >(true) <(true) >(true) <(true)
|
||||||
echo "$!"
|
echo "$!"
|
||||||
)
|
)
|
||||||
sleep .1
|
integer -s i=0
|
||||||
|
while kill -0 "$procsub_pid" # on the Alpine Linux console (no GUI), these take about a second to disappear
|
||||||
|
do sleep .1
|
||||||
|
((++i > 10)) && break
|
||||||
|
done 2>/dev/null
|
||||||
|
unset i
|
||||||
if kill -0 "$procsub_pid" 2>/dev/null; then
|
if kill -0 "$procsub_pid" 2>/dev/null; then
|
||||||
kill -TERM "$procsub_pid" # don't leave around what is effectively a zombie process
|
kill -TERM "$procsub_pid" # don't leave around what is effectively a zombie process
|
||||||
err_exit "process substitutions loop or linger after parent shell finishes"
|
err_exit "process substitutions loop or linger after parent shell finishes"
|
||||||
|
|
|
@ -172,7 +172,7 @@ function valxml
|
||||||
command set +o posix 2>/dev/null
|
command set +o posix 2>/dev/null
|
||||||
unset DISPLAY FIGNORE HISTFILE POSIXLY_CORRECT _AST_FEATURES
|
unset DISPLAY FIGNORE HISTFILE POSIXLY_CORRECT _AST_FEATURES
|
||||||
export ENV=/./dev/null SHTESTS_COMMON=$PWD/_common
|
export ENV=/./dev/null SHTESTS_COMMON=$PWD/_common
|
||||||
trap + CONT PIPE # unadvertised -- set SIGCONT and SIGPIPE to SIG_DFL
|
trap + $(kill -l) # unadvertised -- set all signals to SIG_DFL
|
||||||
|
|
||||||
integer compile=-1 posix=-1 utf8=-1
|
integer compile=-1 posix=-1 utf8=-1
|
||||||
integer debug=0 keep=0 locale=0 time=1
|
integer debug=0 keep=0 locale=0 time=1
|
||||||
|
|
|
@ -202,7 +202,6 @@ function myexport
|
||||||
typeset val
|
typeset val
|
||||||
val=$(export | grep "^$1=")
|
val=$(export | grep "^$1=")
|
||||||
print ${val#"$1="}
|
print ${val#"$1="}
|
||||||
|
|
||||||
}
|
}
|
||||||
export dgk=base
|
export dgk=base
|
||||||
if [[ $(myexport dgk fun) != fun ]]
|
if [[ $(myexport dgk fun) != fun ]]
|
||||||
|
|
|
@ -77,7 +77,6 @@ static ssize_t pfxwrite(Sfio_t* f, const void* buf, register size_t n, Sfdisc_t*
|
||||||
} while ((s = t + 1) < e);
|
} while ((s = t + 1) < e);
|
||||||
pfx->skip = skip;
|
pfx->skip = skip;
|
||||||
return w;
|
return w;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -597,7 +597,6 @@ static const Tty_t *lookup(const char *name)
|
||||||
return(&Ttable[i]);
|
return(&Ttable[i]);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Tty_t *getspeed(unsigned long val)
|
static const Tty_t *getspeed(unsigned long val)
|
||||||
|
|
Loading…
Reference in a new issue