Fix most “set -x” problems (LP#1179287)

• “set -x” manually (cmdline too) snapshots fd#2 now
• “set -o inherit-xtrace” introduced; default still enabled
• reverted iodup printing to pre-R45 behaviour
• made Flag(FXTRACE) a proper state machine
This commit is contained in:
tg
2013-07-21 18:47:24 +00:00
parent dd7b17e704
commit ead77623d3
9 changed files with 108 additions and 40 deletions

9
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.267 2013/07/21 18:36:01 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.268 2013/07/21 18:47:19 tg Exp $");
extern char **environ;
@ -343,6 +343,11 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
*/
Flag(FBRACEEXPAND) = 1;
/*
* Turn on "set -x" inheritance by default.
*/
Flag(FXTRACEREC) = 1;
#ifndef MKSH_NO_CMDLINE_EDITING
/*
* Set edit mode to emacs by default, may be overridden
@ -1388,7 +1393,7 @@ initio(void)
/* force buffer allocation */
shf_fdopen(1, SHF_WR, shl_stdout);
shf_fdopen(2, SHF_WR, shl_out);
shf_fdopen(2, SHF_WR, shl_spare);
shf_fdopen(2, SHF_WR, shl_xtrace);
#ifdef DF
if ((lfp = getenv("SDMKSH_PATH")) == NULL) {
if ((lfp = getenv("HOME")) == NULL || *lfp != '/')