zsh-users
 help / color / mirror / code / Atom feed
* Re: coproc tutorial (Re: questions)
@ 1999-10-11 10:45 Sven Wischnowsky
  1999-10-11 12:55 ` Thomas Köhler
  1999-10-11 17:58 ` Functions/Misc/nslookup (Re: coproc tutorial (Re: questions)) Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Sven Wischnowsky @ 1999-10-11 10:45 UTC (permalink / raw)
  To: zsh-users


Chris Hansen wrote:

> #!/bin/zsh -i
> 
> coproc /usr/bin/nslookup
> 
> while true; do
> 	TEST=">"
> 	NSLOUT=" "
> 	while [[ $TEST != $NSLOUT ]] ; do
> 		print -n $NSLOUT
> 		read -pk NSLOUT
> 	done
> 	read 'QUERY?>'
> 	print -p $QUERY
> done

3.1.6-pws-something (at least the latest pws-6) has Functions/Misc/nslookup
which uses `vared' to read the user input, thus allowing command line
editing. Together with the new completion system this function will
also give you completion *inside* nslookup (and not only nslookup's
arguments).

To workers: seems like noone found this interesting enough to improve
the code I hacked up. Maybe sometime we could write a generic function 
for this task...

Bye
 Sven


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


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

* Re: coproc tutorial (Re: questions)
  1999-10-11 10:45 coproc tutorial (Re: questions) Sven Wischnowsky
@ 1999-10-11 12:55 ` Thomas Köhler
  1999-10-11 17:58 ` Functions/Misc/nslookup (Re: coproc tutorial (Re: questions)) Bart Schaefer
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Köhler @ 1999-10-11 12:55 UTC (permalink / raw)
  To: zsh-users

On Mon, Oct 11, 1999 at 12:45:16PM +0200,
Sven Wischnowsky <wischnow@informatik.hu-berlin.de> wrote:
> 
> Chris Hansen wrote:
> 
> > #!/bin/zsh -i
> > 
> > coproc /usr/bin/nslookup
> > 
> > while true; do
> > 	TEST=">"
> > 	NSLOUT=" "
> > 	while [[ $TEST != $NSLOUT ]] ; do
> > 		print -n $NSLOUT
> > 		read -pk NSLOUT
> > 	done
> > 	read 'QUERY?>'
> > 	print -p $QUERY
> > done
> 
> 3.1.6-pws-something (at least the latest pws-6) has Functions/Misc/nslookup
> which uses `vared' to read the user input, thus allowing command line
> editing. Together with the new completion system this function will
> also give you completion *inside* nslookup (and not only nslookup's
> arguments).

Now this is really cool... how do I enable this? :-)

> To workers: seems like noone found this interesting enough to improve
> the code I hacked up. Maybe sometime we could write a generic function 
> for this task...

Allowing completion from within all stdin/stdout-bound programs?
ncftp -L is a candidate here, amongst others...

> Bye
>  Sven

CU,

Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de   | LCARS - Linux for
     <><        WWW:  http://home.pages.de/~jeanluc/ | Computers on All
                IRC:             jeanluc             | Real Starships
   PGP public key: http://www.mayn.de/users/jean-luc/PGP-Public.asc


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

* Functions/Misc/nslookup (Re: coproc tutorial (Re: questions))
  1999-10-11 10:45 coproc tutorial (Re: questions) Sven Wischnowsky
  1999-10-11 12:55 ` Thomas Köhler
@ 1999-10-11 17:58 ` Bart Schaefer
  1999-10-12  8:54   ` Oliver Kiddle
  1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 1999-10-11 17:58 UTC (permalink / raw)
  To: zsh-users

On Oct 11, 12:45pm, Sven Wischnowsky wrote:
} Subject: Re: coproc tutorial (Re: questions)
}
} 3.1.6-pws-something (at least the latest pws-6) has Functions/Misc/nslookup

This doesn't work for me because the real nslookup begins block-buffering
its output when stdout is not a tty.  Furthermore, if I type ^C while the
nslookup function is running, the entire shell exits.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: Functions/Misc/nslookup (Re: coproc tutorial (Re: questions))
  1999-10-11 17:58 ` Functions/Misc/nslookup (Re: coproc tutorial (Re: questions)) Bart Schaefer
@ 1999-10-12  8:54   ` Oliver Kiddle
  1999-10-12  9:04     ` Thomas Koehler
  0 siblings, 1 reply; 6+ messages in thread
From: Oliver Kiddle @ 1999-10-12  8:54 UTC (permalink / raw)
  To: zsh-users

Bart Schaefer wrote:

> This doesn't work for me because the real nslookup begins block-buffering
> its output when stdout is not a tty.  Furthermore, if I type ^C while the
> nslookup function is running, the entire shell exits.

I've had trouble getting it to work as well which I assumed was to do
with it not having a tty. I tried the same trick with timedc and mailx
aswell with varying problems. Are there any tricks we can do so that the
programs think they have a terminal because it is potentially a very
useful idea? If we can get it to work reliably a generic function for
the purpose as Sven suggested would be a good idea. Can anyone think of
any other programs which it might be useful for?

Oliver Kiddle


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

* Re: Functions/Misc/nslookup (Re: coproc tutorial (Re: questions))
  1999-10-12  8:54   ` Oliver Kiddle
@ 1999-10-12  9:04     ` Thomas Koehler
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Koehler @ 1999-10-12  9:04 UTC (permalink / raw)
  To: zsh-users

On Tue, Oct 12, 1999 at 09:54:11AM +0100, Oliver Kiddle wrote:
> 
> Bart Schaefer wrote:
> 
> > This doesn't work for me because the real nslookup begins block-buffering
> > its output when stdout is not a tty.  Furthermore, if I type ^C while the
> > nslookup function is running, the entire shell exits.
> 
> I've had trouble getting it to work as well which I assumed was to do
> with it not having a tty. I tried the same trick with timedc and mailx
> aswell with varying problems. Are there any tricks we can do so that the
> programs think they have a terminal because it is potentially a very
> useful idea? If we can get it to work reliably a generic function for
> the purpose as Sven suggested would be a good idea. Can anyone think of
> any other programs which it might be useful for?

ncftp -L (or other FTP clients)

Anyways, letting zsh control the input for curses-based programs would
be *really* cool - you run an editor in zsh and get inline completion as
a bonus :-) (Well, only an example, vim already has completion). But I
think that may be too much to code :-}

> Oliver Kiddle

CU,
Thomas

-- 
    Thomas Köhler    Email:     jean-luc@picard.franken.de
        <><           WWW:    http://home.pages.de/~jeanluc/
                      IRC:               jeanluc
      LCARS --- Linux for Computers on All Real Starships


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

* Re: Functions/Misc/nslookup (Re: coproc tutorial (Re: questions))
@ 1999-10-12  9:32 Sven Wischnowsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Wischnowsky @ 1999-10-12  9:32 UTC (permalink / raw)
  To: zsh-users


Oliver Kiddle wrote:

> Bart Schaefer wrote:
> 
> > This doesn't work for me because the real nslookup begins block-buffering
> > its output when stdout is not a tty.  Furthermore, if I type ^C while the
> > nslookup function is running, the entire shell exits.
> 
> I've had trouble getting it to work as well which I assumed was to do
> with it not having a tty. I tried the same trick with timedc and mailx
> aswell with varying problems. Are there any tricks we can do so that the
> programs think they have a terminal because it is potentially a very
> useful idea? If we can get it to work reliably a generic function for
> the purpose as Sven suggested would be a good idea. Can anyone think of
> any other programs which it might be useful for?

How about adding a module that offers a builtin that behaves like
a mixture of `coproc' and `eval' (i.e. arguments used as by `eval',
otherwise like `coproc') but executes the stuff in a pty?

This could also support options for simplifying parsing the output (so 
that we don't have to read one character after another but instead can 
read them in blocks, making things faster).

Any portable-pty-code experts around here?

Bye
 Sven


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


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

end of thread, other threads:[~1999-10-12  9:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-11 10:45 coproc tutorial (Re: questions) Sven Wischnowsky
1999-10-11 12:55 ` Thomas Köhler
1999-10-11 17:58 ` Functions/Misc/nslookup (Re: coproc tutorial (Re: questions)) Bart Schaefer
1999-10-12  8:54   ` Oliver Kiddle
1999-10-12  9:04     ` Thomas Koehler
1999-10-12  9: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).