From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18614 invoked from network); 24 Aug 2004 19:34:24 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 24 Aug 2004 19:34:24 -0000 Received: (qmail 22195 invoked from network); 24 Aug 2004 19:34:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 24 Aug 2004 19:34:11 -0000 Received: (qmail 26208 invoked by alias); 24 Aug 2004 19:33:25 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7923 Received: (qmail 26198 invoked from network); 24 Aug 2004 19:33:25 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 24 Aug 2004 19:33:25 -0000 Received: (qmail 19799 invoked from network); 24 Aug 2004 19:31:46 -0000 Received: from madrid10.amenworld.com (62.193.203.32) by a.mx.sunsite.dk with SMTP; 24 Aug 2004 19:31:45 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id i7OJVf122479 for ; Tue, 24 Aug 2004 21:31:41 +0200 Received: from disposable1@telefonica.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <1Bzh1g-0007Th-00>; Tue, 24 Aug 2004 21:32:12 +0200 Date: Tue, 24 Aug 2004 21:32:12 +0200 From: DervishD To: zsh-users@sunsite.dk Subject: Re: Using zle outside zsh Message-ID: <20040824193212.GA28745@DervishD> Mail-Followup-To: zsh-users@sunsite.dk References: <20040823155951.GA24279@DervishD> <20040823194613.GA25072@DervishD> <20040824093921.GA25290@DervishD> <20040824170545.GA28326@DervishD> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.1i Organization: Pleyades X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_44 autolearn=no version=2.63 X-Spam-Hits: -0.0 Hi Bart :) * Bart Schaefer dixit: > > > So pick the last line out of $response and > > > pass that to vared as the prompt, like so: > > > pmpt=${response##$'*\n'} > > I must use "${response##*$'\n'}" or it doesn't work because the > > '*' is quoted > Oh, yes. Typo on my part. Sorry. Don't worry. My mistakes weren't typos O:) > > OTOH, I think that, for a program like 'ftp' that not only prints > > its own set of prompts but uses some server responses as prompts, it > > would be better to read line by line until no more lines are present > Unfortunately there's no way to know *when* "no more lines are present". > It's a TTY, after all; you don't get an EOF. Yes, but I can use 'zpty -rt' to test if more output must be copied. The problem with this method is that it won't read the prompt line since it doesn't have a '\n' at the end, it's not a line!. If the prompt was always the same, it wouldn't be a problem, but... It works as it is now, and the only problem is to get all the prompts. It is a work far less complex than to write a line editor for the ftp client ;) > > Seems that the only possible solutions is to know in advance all > > possible prompts and use 'zpty -r COMMAND NAME PATTERN', or using > > zselect, or even using a proxy program that translates and normalizes > > all received prompts including a '\n', or something like that... > zselect might help, because you could look for input from the keyboard > and from the pty at the same time -- but then you can't use vared. I prefer to use vared by now, although I can change all keybindings for this particular use inside the script and get rid of vared. My version of zsh doesn't even have 'zselect', so... > Or you could try something with "zle -F" but I don't know if that works > inside vared (I'd presume it does, but I've never tried). My zsh version (4.0.9) doesn't seem to have '-F' as an option to zle. I'll take a look in the 4.2.1 I haven't installed yet. Well, thanks a lot for all your help, Bart :) Now I have an alternative to zftp with full command line editing... as soon as I do a bit of work. Not much, fortunately :) Thanks Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/