summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/zpty.c16
-rw-r--r--Src/builtin.c2
-rw-r--r--Src/utils.c2
3 files changed, 17 insertions, 3 deletions
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 9bd14985e..4076a5b7e 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -290,22 +290,34 @@ static int
 newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 {
     Ptycmd p;
-    int master, slave, pid;
+    int master, slave, pid, oineval = ineval;
+    char *oscriptname = scriptname;
     Eprog prog;
 
+    /* code borrowed from bin_eval() */
+    ineval = !isset(EVALLINENO);
+    if (!ineval)
+	scriptname = "(zpty)";
+
     prog = parse_string(zjoin(args, ' ', 1));
     if (!prog) {
 	errflag = 0;
+	scriptname = oscriptname;
+	ineval = oineval;
 	return 1;
     }
 
     if (get_pty(1, &master)) {
 	zwarnnam(nam, "can't open pseudo terminal: %e", errno);
+	scriptname = oscriptname;
+	ineval = oineval;
 	return 1;
     }
     if ((pid = fork()) == -1) {
 	zwarnnam(nam, "can't create pty command %s: %e", pname, errno);
 	close(master);
+	scriptname = oscriptname;
+	ineval = oineval;
 	return 1;
     } else if (!pid) {
 	/* This code copied from the clone module, except for getting *
@@ -406,6 +418,8 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
     if (nblock)
 	ptynonblock(master);
 
+    scriptname = oscriptname;
+    ineval = oineval;
     return 0;
 }
 
diff --git a/Src/builtin.c b/Src/builtin.c
index 99eef93aa..42eca3e21 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4681,7 +4681,7 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
 /* eval: simple evaluation */
 
 /**/
-int ineval;
+mod_export int ineval;
 
 /**/
 int
diff --git a/Src/utils.c b/Src/utils.c
index 4992680fe..a1a97d182 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -33,7 +33,7 @@
 /* name of script being sourced */
 
 /**/
-char *scriptname;
+mod_export char *scriptname;
 
 #ifdef MULTIBYTE_SUPPORT
 struct widechar_array {