zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: closing stdin in zle
Date: Mon, 7 Jun 1999 10:17:16 +0200 (MET DST)	[thread overview]
Message-ID: <199906070817.KAA05053@beta.informatik.hu-berlin.de> (raw)


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


             reply	other threads:[~1999-06-07  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-07  8:17 Sven Wischnowsky [this message]
1999-06-07  8:10 ` Peter Stephenson
1999-06-07  8:32 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199906070817.KAA05053@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).