zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: closing stdin in zle
  1999-06-07  8:17 PATCH: closing stdin in zle Sven Wischnowsky
@ 1999-06-07  8:10 ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 1999-06-07  8:10 UTC (permalink / raw)
  To: zsh-workers

Sven Wischnowsky wrote:
> Peter, is movefd(), redup(), zclose() the right way to do it? (At
> least it works...)

Unless I'm missing something fundamental, redup() automatically calls
zclose() for the fd redup'd from, so the zclose's aren't necessary and I've
editted them out by hand.  Otherwise, this is certainly supposed to work.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH: closing stdin in zle
@ 1999-06-07  8:17 Sven Wischnowsky
  1999-06-07  8:10 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1999-06-07  8:17 UTC (permalink / raw)
  To: zsh-workers


Here is the patch to temporarily close stdin when doing completion.
I've put it at the very beginning, so this also effect completion
widgets and `compctl -K'.

I've also added similar code around the execution of normal zle (shell 
function-) widgets.

Peter, is movefd(), redup(), zclose() the right way to do it? (At
least it works...)

Bye
 Sven


ist das richtig so?
auch fuer zle-widgets!


diff -u os/Zle/zle_main.c Src/Zle/zle_main.c
--- os/Zle/zle_main.c	Sat Jun  5 13:31:11 1999
+++ Src/Zle/zle_main.c	Sat Jun  5 15:28:25 1999
@@ -640,7 +640,7 @@
 	    zsfree(msg);
 	    feep();
 	} else {
-	    int osc = sfcontext;
+	    int osc = sfcontext, osi = movefd(0);
 
 	    startparamscope();
 	    makezleparams(0);
@@ -650,6 +650,8 @@
 	    endparamscope();
 	    lastcmd = 0;
 	    r = 1;
+	    redup(osi, 0);
+	    zclose(osi);
 	}
     }
     if (r) {
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Sat Jun  5 13:31:12 1999
+++ Src/Zle/zle_tricky.c	Sat Jun  5 15:26:49 1999
@@ -4586,7 +4586,7 @@
     struct cmlist ms;
     Cmlist m;
     char *p, *os = s;
-    int onm = nmatches;
+    int onm = nmatches, osi = movefd(0);
 
     /* Inside $... ? */
     if (compfunc && (p = check_param(s, 0)))
@@ -4676,6 +4676,9 @@
 	    validlist = 1;
 	    amatches = pmatches;
 
+	    redup(osi, 0);
+	    zclose(osi);
+
 	    return 0;
 	}
 	PERMALLOC {
@@ -4685,6 +4688,9 @@
 	if (nmatches && !errflag) {
 	    validlist = 1;
 
+	    redup(osi, 0);
+	    zclose(osi);
+
 	    return 0;
 	}
 	if (!m || !(m = m->next))
@@ -4693,6 +4699,8 @@
 	errflag = 0;
 	compmatcher++;
     }
+    redup(osi, 0);
+    zclose(osi);
     return 1;
 }
 

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: closing stdin in zle
@ 1999-06-07  8:32 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-06-07  8:32 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> ...
> 
> ist das richtig so?
> auch fuer zle-widgets!
> 

Oh dear, Monday morning...

Sorry, these are just some comments I put into the patch I prepared at 
home...

And while I'm at it, I apologise for including a patch for a
emacs-backup file in 6486.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-06-07  8:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-07  8:17 PATCH: closing stdin in zle Sven Wischnowsky
1999-06-07  8:10 ` Peter Stephenson
1999-06-07  8:32 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).