Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zpty woes
- X-seq: zsh-workers 25040
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: zpty woes
- Date: Thu, 15 May 2008 16:44:46 +0100
- In-reply-to: <20080515132609.GB5190@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <34AE8142-F5DA-44FD-96BA-61BDE12BC74E@xxxxxxx> <20080515132609.GB5190@xxxxxxxxxxxxxxx>
On Thu, 15 May 2008 14:26:09 +0100
Stephane Chazelas <Stephane_Chazelas@xxxxxxxx> wrote:
> "+myscript:1> scp hello...."
>
> (by, the way, shouldn't it be something like "+(zpty):1> scp
> hello"?)
zpty currently exec's code directly, it doesn't go through eval. Borrowing
the code from eval should fix this. There may be other
parse_string()/execode() pairs that need this. This is crying out to be
object-orientated...
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.194
diff -u -r1.194 builtin.c
--- Src/builtin.c 14 May 2008 10:48:28 -0000 1.194
+++ Src/builtin.c 15 May 2008 15:42:33 -0000
@@ -4681,7 +4681,7 @@
/* eval: simple evaluation */
/**/
-int ineval;
+mod_export int ineval;
/**/
int
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.190
diff -u -r1.190 utils.c
--- Src/utils.c 14 May 2008 10:48:28 -0000 1.190
+++ Src/utils.c 15 May 2008 15:42:37 -0000
@@ -33,7 +33,7 @@
/* name of script being sourced */
/**/
-char *scriptname;
+mod_export char *scriptname;
#ifdef MULTIBYTE_SUPPORT
struct widechar_array {
Index: Src/Modules/zpty.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zpty.c,v
retrieving revision 1.37
diff -u -r1.37 zpty.c
--- Src/Modules/zpty.c 25 Jan 2008 16:48:24 -0000 1.37
+++ Src/Modules/zpty.c 15 May 2008 15:42:37 -0000
@@ -290,22 +290,34 @@
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 @@
if (nblock)
ptynonblock(master);
+ scriptname = oscriptname;
+ ineval = oineval;
return 0;
}
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author