about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-05-15 15:50:57 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-05-15 15:50:57 +0000
commit02e0a4755f47f1eb720d5b81b37cc8e3d3a453ac (patch)
treed64ad703ab3c1ed514b2a177ed608a637a39e8c0
parent5e373b83a53c739fc6f53a632a1280179723b820 (diff)
downloadzsh-02e0a4755f47f1eb720d5b81b37cc8e3d3a453ac.tar.gz
zsh-02e0a4755f47f1eb720d5b81b37cc8e3d3a453ac.tar.xz
zsh-02e0a4755f47f1eb720d5b81b37cc8e3d3a453ac.zip
25040: zpty should display context information more like eval
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/zpty.c16
-rw-r--r--Src/builtin.c2
-rw-r--r--Src/utils.c2
4 files changed, 22 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 43f47e45d..54b6520d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-15  Peter Stephenson  <pws@csr.com>
+
+	* 25040: Src/builtin.c, Src/utils.c, Src/Modules/zpty.c:
+	zpty should display context information more like eval.
+
 2008-05-14  Peter Stephenson  <pws@csr.com>
 
 	* unposted: Completion/Unix/Command/_perforce: also p4 sizes,
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 {