From owner-svn-src-all@FreeBSD.ORG Fri Jun 22 19:48:39 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55B77106567E; Fri, 22 Jun 2012 19:48:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 359F58FC0A; Fri, 22 Jun 2012 19:48:39 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5MJmdT4019092; Fri, 22 Jun 2012 19:48:39 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q5MJmcjL019090; Fri, 22 Jun 2012 19:48:38 GMT (envelope-from bapt@FreeBSD.org) X-Authentication-Warning: freefall.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f Date: Fri, 22 Jun 2012 21:48:35 +0200 From: Baptiste Daroussin To: "Pedro F. Giffuni" Message-ID: <20120622194835.GE83730@ithaqua.etoilebsd.net> References: <201206221801.q5MI1NxN092238@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G6nVm6DDWH/FONJq" Content-Disposition: inline In-Reply-To: <201206221801.q5MI1NxN092238@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237448 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 19:48:39 -0000 --G6nVm6DDWH/FONJq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 22, 2012 at 06:01:23PM +0000, Pedro F. Giffuni wrote: > Author: pfg > Date: Fri Jun 22 18:01:22 2012 > New Revision: 237448 > URL: http://svn.freebsd.org/changeset/base/237448 >=20 > Log: > Merge changes from upstream libedit. > =20 > Our libedit has been diverging from the mainstream version > maintained in NetBSD. As a consequence it has been difficult > to do an appropriate MFV and we have been bringing only > partial updates. > =20 > Here we update most of the files to at least match the > version available in NetBSD's snapshot of 20091228. This > version was chosen because it still doesn't include wide > character support (UTF-8), which involves many changes and > new files. > =20 > From NetBSD's logs: > =20 > Dec 15 22:13:33 2006 - editline.3 el.c el.h histedit.h > add EL_GETFP, and EL_SETFP. > =20 > Apr 5 15:53:28 2008 - editline.3 el.c histedit.h readline.c > add EL_REFRESH for the benefit of readline > =20 > Sep 10 15:45:37 2008 - common.c el.c read.c refresh.c sig.c term.c term= =2Eh tty.c > Allow a single process to control multiple ttys (for pthreads using _RE= ENTRANT) > using multiple EditLine objects. > =20 > Jan 18 12:17:24 2009 - el.c read.c readline.c > fix -Wsign-compare issues > =20 > Feb 6 14:40:32 2009 - history.c > Plug memory leak, from MySQL. > =20 > Feb 5 19:15:44 2009 - histedit.h read.c > match documentation in el_push > =20 > Feb 6 13:14:37 2009 - vi.c > Portability fix. > =20 > Feb 12 13:39:49 2009 - readline.c term.c > More fixes for existing portability stuff. > =20 > Feb 15 21:24:13 2009 - el.h read.c > don't restart on EINTR, instead return NULL immediately. From Anon Ymous > =20 > Feb 15 21:25:01 2009 - sig.c sig.h > in order for read() to return EINTR we need to use sigaction, not signa= l, > otherwise SA_RESTART is set. > =20 > Feb 15 21:55:23 2009 - chared.c chared.h common.c emacs.c filecomplete.c > filecomplete.h key.c key.h read.c readline.c refresh.c search.c > term.c tokenizer.c tty.c vi.c > pass lint on _LP64. > =20 > Feb 17 21:34:26 2009 - el.c histedit.h prompt.c prompt.h > allow for a prompt argument. > =20 > Feb 18 15:04:40 2009 - sig.c > SA_RESTART for all signals but SIGINT. From Anon Ymous. > =20 > Feb 19 15:20:22 2009 - read.c sig.c sig.h > reset and redraw on sigcont. From Anon Ymous. > =20 > Feb 21 23:31:56 2009 - key.c key.h readline.c vi.c > more size_t stuff. > =20 > Mar 10 20:46:15 2009 - editline.3 read.c > make el_gets set the count to -1 on error to distinguish between EOF and > error. > =20 > Mar 31 17:38:27 2009 - editline.3 el.c histedit.h prompt.c prompt.h > refresh.c term.c term.h > Implement literal prompt sequences. Now someone can implement > RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-) > =20 > Mar 31 21:33:17 2009 - term.c > cast to size_t to avoid sign / unsigned comparison warning. > =20 > Apr 23 02:03 2009 - term.c > Apply patch (requested by msaitoh in ticket #2007): > Coverity CID 1668: Plug memory leak when malloc() failed.:55 2009 > =20 > May 11 18:33:30 2009 - editline.3 el.c histedit.h > restore binary compatibility by providing new prompt functions that take > an extra literal character. > =20 > May 19 21:45:14 2009 - refresh.c > always scroll when we advance past bottom. From Caleb Welton > cwelton at greenplum dot com. > =20 > Jul 17 12:27:57 2009 - term.c > - off by one in the term.h case. > - make code more similar to tcsh (if we want to handle wide chars, this= is > needed; for now it is a no-op) > =20 > Jul 22 15:56:29 2009 - el.c > Move filename to the scope it is being used. > From Michael Cook mcook at bbn dot com > =20 > Jul 22 15:57:00 2009 - read.c > Always initialize nread since it is an out param. > From Michael Cook mcook at bbn dot com > =20 > Jul 22 18:25:26 2009 - el.c > Only need path if we have issetugid... From Anon Ymous > =20 > Jul 25 21:19:23 2009 - el.c > Ignore comment lines in .editrc from Jess Thrysoee > =20 > Sep 7 21:24:33 2009 > histedit.h history.c readline.c > apply apple patches from: > http://opensource.apple.com/source/libedit/libedit-11/patches/ > =20 > Dec 28 21:52:43 2009 - refresh.c > Fix bug where tab completion on the second or > line that caused listing > ended up corrupting the display by an extra space in the beginning. Rep= orted > by Mac Chan. > =20 > Dec 28 22:15:36 2009 - refresh.c term.c > reduce diff with tcsh > =20 > Obtained from: NetBSD > Tested by: bapt, jilles and current@ > MFC after: 1 week >=20 > Modified: > head/lib/libedit/common.c > head/lib/libedit/editline.3 > head/lib/libedit/editrc.5 > head/lib/libedit/el.c > head/lib/libedit/el.h > head/lib/libedit/histedit.h > head/lib/libedit/history.c > head/lib/libedit/key.c > head/lib/libedit/key.h > head/lib/libedit/prompt.c > head/lib/libedit/prompt.h > head/lib/libedit/read.c > head/lib/libedit/refresh.c > head/lib/libedit/search.c > head/lib/libedit/sig.c > head/lib/libedit/sig.h > head/lib/libedit/term.c > head/lib/libedit/term.h > head/lib/libedit/tty.c > head/lib/libedit/vi.c >=20 > Modified: head/lib/libedit/common.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/common.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/common.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -905,7 +905,7 @@ ed_command(EditLine *el, int c __unused) > int tmplen; > =20 > tmplen =3D c_gets(el, tmpbuf, "\n: "); > - term__putc('\n'); > + term__putc(el, '\n'); > =20 > if (tmplen < 0 || (tmpbuf[tmplen] =3D 0, parse_line(el, tmpbuf)) =3D=3D= -1) > term_beep(el); >=20 > Modified: head/lib/libedit/editline.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/editline.3 Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/editline.3 Fri Jun 22 18:01:22 2012 (r237448) > @@ -1,4 +1,4 @@ > -.\" $NetBSD: editline.3,v 1.55 2007/01/12 16:31:13 christos Exp $ > +.\" $NetBSD: editline.3,v 1.70 2009/07/05 21:55:24 perry Exp $ > .\" > .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc. > .\" All rights reserved. > @@ -28,7 +28,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 12, 2007 > +.Dd July 5, 2009 > .Dt EDITLINE 3 > .Os > .Sh NAME > @@ -162,6 +162,14 @@ is modified to contain the number of cha > Returns the line read if successful, or > .Dv NULL > if no characters were read or if an error occurred. > +If an error occurred, > +.Fa count > +is set to \-1 and > +.Dv errno > +contains the error code that caused it. > +The return value may not remain valid across calls to > +.Fn el_gets > +and must be copied if the data is to be retained. > .It Fn el_getc > Read a character from the tty. > .Fa ch > @@ -222,10 +230,30 @@ are supported, along with the required a > Define prompt printing function as > .Fa f , > which is to return a string that contains the prompt. > +.It Dv EL_PROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" > +Same as > +.Dv EL_PROMPT , > +but the > +.Fa c > +argument indicates the start/stop literal prompt character. > +.Pp > +If a start/stop literal character is found in the prompt, the > +character itself > +is not printed, but characters after it are printed directly to the > +terminal without affecting the state of the current line. > +A subsequent second start/stop literal character ends this behavior. > +This is typically used to embed literal escape sequences that change the > +color/style of the terminal in the prompt. > +.Dv 0 > +unsets it. > +.It Dv EL_REFRESH > +Re-display the current line on the next terminal line. > .It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" > Define right side prompt printing function as > .Fa f , > which is to return a string that contains the prompt. > +.It Dv EL_RPROMPT_ESC , Fa "char *(*f)(EditLine *)" , Fa "char c" > +Define the right prompt printing function but with a literal escape char= acter. > .It Dv EL_TERMINAL , Fa "const char *type" > Define terminal type of the tty to be > .Fa type , > @@ -259,66 +287,43 @@ reading command input: > and > .Dv SIGWINCH . > Otherwise, the current signal handlers will be used. > -.It Dv EL_BIND , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_BIND , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic bind > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_ECHOTC , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_ECHOTC , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic echotc > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_SETTC , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_SETTC , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic settc > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_SETTY , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_SETTY , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic setty > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_TELLTC , Xo > -.Fa "const char *" , > -.Fa "..." , > -.Dv NULL > -.Xc > +.It Dv EL_TELLTC , Fa "const char *" , Fa "..." , Dv NULL > Perform the > .Ic telltc > builtin command. > Refer to > .Xr editrc 5 > for more information. > -.It Dv EL_ADDFN , Xo > -.Fa "const char *name" , > -.Fa "const char *help" , > -.Fa "unsigned char (*func)(EditLine *e, int ch)" > -.Xc > +.It Dv EL_ADDFN , Fa "const char *name" , Fa "const char *help" , \ > +Fa "unsigned char (*func)(EditLine *e, int ch)" > Add a user defined function, > .Fn func , > referred to as > @@ -360,10 +365,8 @@ Beep, and flush tty. > .It Dv CC_FATAL > Fatal error, reset tty to known state. > .El > -.It Dv EL_HIST , Xo > -.Fa "History *(*func)(History *, int op, ...)" , > -.Fa "const char *ptr" > -.Xc > +.It Dv EL_HIST , Fa "History *(*func)(History *, int op, ...)" , \ > +Fa "const char *ptr" > Defines which history function to use, which is usually > .Fn history . > .Fa ptr > @@ -435,10 +438,22 @@ The following values for > are supported, along with actual type of > .Fa result : > .Bl -tag -width 4n > -.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" > -Return a pointer to the function that displays the prompt. > -.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" > -Return a pointer to the function that displays the rightside prompt. > +.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" > +Return a pointer to the function that displays the prompt in > +.Fa f . > +If > +.Fa c > +is not > +.Dv NULL , > +return the start/stop literal prompt character in it. > +.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c" > +Return a pointer to the function that displays the prompt in > +.Fa f . > +If > +.Fa c > +is not > +.Dv NULL , > +return the start/stop literal prompt character in it. > .It Dv EL_EDITOR , Fa "const char *" > Return the name of the editor, which will be one of > .Dq emacs > @@ -603,18 +618,11 @@ assumed to be created with > .Fn history_init . > .It Dv H_CLEAR > Clear the history. > -.It Dv H_FUNC , Xo > -.Fa "void *ptr" , > -.Fa "history_gfun_t first" , > -.Fa "history_gfun_t next" , > -.Fa "history_gfun_t last" , > -.Fa "history_gfun_t prev" , > -.Fa "history_gfun_t curr" , > -.Fa "history_sfun_t set" , > -.Fa "history_vfun_t clear" , > -.Fa "history_efun_t enter" , > -.Fa "history_efun_t add" > -.Xc > +.It Dv H_FUNC , Fa "void *ptr" , Fa "history_gfun_t first" , \ > +Fa "history_gfun_t next" , Fa "history_gfun_t last" , \ > +Fa "history_gfun_t prev" , Fa "history_gfun_t curr" , \ > +Fa "history_sfun_t set" , Fa "history_vfun_t clear" , \ > +Fa "history_efun_t enter" , Fa "history_efun_t add" > Define functions to perform various history operations. > .Fa ptr > is the argument given to a function when it is invoked. >=20 > Modified: head/lib/libedit/editrc.5 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/editrc.5 Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/editrc.5 Fri Jun 22 18:01:22 2012 (r237448) > @@ -1,4 +1,4 @@ > -.\" $NetBSD: editrc.5,v 1.20 2006/08/21 12:45:30 christos Exp $ > +.\" $NetBSD: editrc.5,v 1.24 2009/04/11 22:17:52 wiz Exp $ > .\" > .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc. > .\" All rights reserved. > @@ -89,16 +89,8 @@ shell. > .Pp > The following builtin commands are available: > .Bl -tag -width 4n > -.It Ic bind Xo > -.Op Fl a > -.Op Fl e > -.Op Fl k > -.Op Fl l > -.Op Fl r > -.Op Fl s > -.Op Fl v > -.Op Ar key Op Ar command > -.Xc > +.It Ic bind Oo Fl a Oc Oo Fl e Oc Oo Fl k Oc Oo Fl l Oc Oo Fl r Oc \ > +Oo Fl s Oc Oo Fl v Oc Oo Ar key Op Ar command Oc > Without options, list all bound keys, and the editor command to which > each is bound. > If > @@ -192,11 +184,7 @@ if it has any, notably > .Sq \e > and > .Sq ^ . > -.It Ic echotc Xo > -.Op Fl sv > -.Ar arg > -.Ar ... > -.Xc > +.It Ic echotc Oo Fl sv Oc Ar arg Ar ... > Exercise terminal capabilities given in > .Ar arg Ar ... . > If > @@ -252,16 +240,8 @@ to > as defined in > .Xr termcap 5 . > No sanity checking is done. > -.It Ic setty Xo > -.Op Fl a > -.Op Fl d > -.Op Fl q > -.Op Fl x > -.Op Ar +mode > -.Op Ar -mode > -.Op Ar mode > -.Op Ar char=3Dc > -.Xc > +.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ar +mode Oc \ > +Oo Ar -mode Oc Oo Ar mode Oc Oo Ar char=3Dc Oc > Control which tty modes that > .Nm > will not allow the user to change. >=20 > Modified: head/lib/libedit/el.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/el.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/el.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: el.c,v 1.44 2006/12/15 22:13:33 christos Exp $ > + * $NetBSD: el.c,v 1.55 2009/07/25 21:19:23 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include "el.h" > =20 > #define HAVE_ISSETUGID > @@ -156,9 +157,21 @@ el_set(EditLine *el, int op, ...) > =20 > switch (op) { > case EL_PROMPT: > - case EL_RPROMPT: > - rv =3D prompt_set(el, va_arg(ap, el_pfunc_t), op); > + case EL_RPROMPT: { > + el_pfunc_t p =3D va_arg(ap, el_pfunc_t); > + > + rv =3D prompt_set(el, p, 0, op); > break; > + } > + > + case EL_PROMPT_ESC: > + case EL_RPROMPT_ESC: { > + el_pfunc_t p =3D va_arg(ap, el_pfunc_t); > + char c =3D va_arg(ap, int); > + > + rv =3D prompt_set(el, p, c, op); > + break; > + } > =20 > case EL_TERMINAL: > rv =3D term_set(el, va_arg(ap, char *)); > @@ -309,6 +322,12 @@ el_set(EditLine *el, int op, ...) > break; > } > =20 > + case EL_REFRESH: > + re_clear_display(el); > + re_refresh(el); > + term__flush(el); > + break; > + > default: > rv =3D -1; > break; > @@ -335,9 +354,13 @@ el_get(EditLine *el, int op, ...) > =20 > switch (op) { > case EL_PROMPT: > - case EL_RPROMPT: > - rv =3D prompt_get(el, va_arg(ap, el_pfunc_t *), op); > + case EL_RPROMPT: { > + el_pfunc_t *p =3D va_arg(ap, el_pfunc_t *); > + char *c =3D va_arg(ap, char *); > + > + rv =3D prompt_get(el, p, c, op); > break; > + } > =20 > case EL_EDITOR: > rv =3D map_get_editor(el, va_arg(ap, const char **)); > @@ -364,7 +387,7 @@ el_get(EditLine *el, int op, ...) > char *argv[20]; > int i; > =20 > - for (i =3D 1; i < sizeof(argv) / sizeof(argv[0]); i++) > + for (i =3D 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++) > if ((argv[i] =3D va_arg(ap, char *)) =3D=3D NULL) > break; > =20 > @@ -495,12 +518,14 @@ el_source(EditLine *el, const char *fnam > FILE *fp; > size_t len; > char *ptr; > +#ifdef HAVE_ISSETUGID > + char path[MAXPATHLEN]; > +#endif > =20 > fp =3D NULL; > if (fname =3D=3D NULL) { > #ifdef HAVE_ISSETUGID > static const char elpath[] =3D "/.editrc"; > - char path[MAXPATHLEN]; > =20 > if (issetugid()) > return (-1); > @@ -529,6 +554,13 @@ el_source(EditLine *el, const char *fnam > if (len > 0 && ptr[len - 1] =3D=3D '\n') > --len; > ptr[len] =3D '\0'; > + > + /* loop until first non-space char or EOL */ > + while (*ptr !=3D '\0' && isspace((unsigned char)*ptr)) > + ptr++; > + if (*ptr =3D=3D '#') > + continue; /* ignore, this is a comment line */ > + > if (parse_line(el, ptr) =3D=3D -1) { > (void) fclose(fp); > return (-1); >=20 > Modified: head/lib/libedit/el.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/el.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/el.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -115,6 +115,7 @@ struct editline { > FILE *el_errfile; /* Stdio stuff */ > int el_infd; /* Input file descriptor */ > int el_flags; /* Various flags. */ > + int el_errno; /* Local copy of errno */ > coord_t el_cursor; /* Cursor location */ > char **el_display; /* Real screen image =3D what is there */ > char **el_vdisplay; /* Virtual screen image =3D what we see */ >=20 > Modified: head/lib/libedit/histedit.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/histedit.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/histedit.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -131,10 +131,10 @@ unsigned char _el_fn_sh_complete(EditLin > #define EL_GETCFN 13 /* , el_rfunc_t); */ > #define EL_CLIENTDATA 14 /* , void *); */ > #define EL_UNBUFFERED 15 /* , int); */ > -#define EL_PREP_TERM 16 /* , int); */ > +#define EL_PREP_TERM 16 /* , int); */ > #define EL_GETTC 17 /* , const char *, ..., NULL); */ > -#define EL_GETFP 18 /* , int, FILE **) */ > -#define EL_SETFP 19 /* , int, FILE *) */ > +#define EL_GETFP 18 /* , int, FILE **); */ > +#define EL_SETFP 19 /* , int, FILE *); */ > #define EL_REFRESH 20 /* , void); set */ > #define EL_PROMPT_ESC 21 /* , prompt_func, Char); set/get */ > #define EL_RPROMPT_ESC 22 /* , prompt_func, Char); set/get */ >=20 > Modified: head/lib/libedit/history.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/history.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/history.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: history.c,v 1.32 2006/09/28 13:52:51 christos Exp $ > + * $NetBSD: history.c,v 1.34 2009/09/07 21:24:33 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -116,6 +116,7 @@ private int history_prev_string(History=20 > */ > typedef struct hentry_t { > HistEvent ev; /* What we return */ > + void *data; /* data */ > struct hentry_t *next; /* Next entry */ > struct hentry_t *prev; /* Previous entry */ > } hentry_t; > @@ -145,6 +146,9 @@ private int history_def_init(ptr_t *, Hi > private int history_def_insert(history_t *, HistEvent *, const char *); > private void history_def_delete(history_t *, HistEvent *, hentry_t *); > =20 > +private int history_deldata_nth(history_t *, HistEvent *, int, void **); > +private int history_set_nth(ptr_t, HistEvent *, int); > + > #define history_def_setsize(p, num)(void) (((history_t *)p)->max =3D (nu= m)) > #define history_def_getsize(p) (((history_t *)p)->cur) > #define history_def_getunique(p) (((((history_t *)p)->flags) & H_UNIQUE)= !=3D 0) > @@ -335,6 +339,31 @@ history_def_set(ptr_t p, HistEvent *ev,=20 > } > =20 > =20 > +/* history_set_nth(): > + * Default function to set the current event in the history to the > + * n-th one. > + */ > +private int > +history_set_nth(ptr_t p, HistEvent *ev, int n) > +{ > + history_t *h =3D (history_t *) p; > + > + if (h->cur =3D=3D 0) { > + he_seterrev(ev, _HE_EMPTY_LIST); > + return (-1); > + } > + for (h->cursor =3D h->list.prev; h->cursor !=3D &h->list; > + h->cursor =3D h->cursor->prev) > + if (n-- <=3D 0) > + break; > + if (h->cursor =3D=3D &h->list) { > + he_seterrev(ev, _HE_NOT_FOUND); > + return (-1); > + } > + return (0); > +} > + > + > /* history_def_add(): > * Append string to element > */ > @@ -363,6 +392,24 @@ history_def_add(ptr_t p, HistEvent *ev,=20 > } > =20 > =20 > +private int > +history_deldata_nth(history_t *h, HistEvent *ev, > + int num, void **data) > +{ > + if (history_set_nth(h, ev, num) !=3D 0) > + return (-1); > + /* magic value to skip delete (just set to n-th history) */ > + if (data =3D=3D (void **)-1) > + return (0); > + ev->str =3D strdup(h->cursor->ev.str); > + ev->num =3D h->cursor->ev.num; > + if (data) > + *data =3D h->cursor->data; > + history_def_delete(h, ev, h->cursor); > + return (0); > +} > + > + > /* history_def_del(): > * Delete element hp of the h list > */ > @@ -392,8 +439,11 @@ history_def_delete(history_t *h,=20 > HistEventPrivate *evp =3D (void *)&hp->ev; > if (hp =3D=3D &h->list) > abort(); > - if (h->cursor =3D=3D hp) > + if (h->cursor =3D=3D hp) { > h->cursor =3D hp->prev; > + if (h->cursor =3D=3D &h->list) > + h->cursor =3D hp->next; > + } > hp->prev->next =3D hp->next; > hp->next->prev =3D hp->prev; > h_free((ptr_t) evp->str); > @@ -416,6 +466,7 @@ history_def_insert(history_t *h, HistEve > h_free((ptr_t)h->cursor); > goto oomem; > } > + h->cursor->data =3D NULL; > h->cursor->ev.num =3D ++h->eventid; > h->cursor->next =3D h->list.next; > h->cursor->prev =3D &h->list; > @@ -711,8 +762,8 @@ history_load(History *h, const char *fna > (void) strunvis(ptr, line); > line[sz] =3D c; > if (HENTER(h, &ev, ptr) =3D=3D -1) { > - h_free((ptr_t)ptr); > - return -1; > + i =3D -1; > + goto oomem; > } > } > oomem: > @@ -787,6 +838,23 @@ history_prev_event(History *h, HistEvent > } > =20 > =20 > +private int > +history_next_evdata(History *h, HistEvent *ev, int num, void **d) > +{ > + int retval; > + > + for (retval =3D HCURR(h, ev); retval !=3D -1; retval =3D HPREV(h, ev)) > + if (num-- <=3D 0) { > + if (d) > + *d =3D ((history_t *)h->h_ref)->cursor->data; > + return (0); > + } > + > + he_seterrev(ev, _HE_NOT_FOUND); > + return (-1); > +} > + > + > /* history_next_event(): > * Find the next event, with number given > */ > @@ -976,11 +1044,42 @@ history(History *h, HistEvent *ev, int f > retval =3D 0; > break; > =20 > + case H_NEXT_EVDATA: > + { > + int num =3D va_arg(va, int); > + void **d =3D va_arg(va, void **); > + retval =3D history_next_evdata(h, ev, num, d); > + break; > + } > + > + case H_DELDATA: > + { > + int num =3D va_arg(va, int); > + void **d =3D va_arg(va, void **); > + retval =3D history_deldata_nth((history_t *)h->h_ref, ev, num, d); > + break; > + } > + > + case H_REPLACE: /* only use after H_NEXT_EVDATA */ > + { > + const char *line =3D va_arg(va, const char *); > + void *d =3D va_arg(va, void *); > + const char *s; > + if(!line || !(s =3D strdup(line))) { > + retval =3D -1; > + break; > + } > + ((history_t *)h->h_ref)->cursor->ev.str =3D s; > + ((history_t *)h->h_ref)->cursor->data =3D d; > + retval =3D 0; > + break; > + } > + > default: > retval =3D -1; > he_seterrev(ev, _HE_UNKNOWN); > break; > } > va_end(va); > - return (retval); > + return retval; > } >=20 > Modified: head/lib/libedit/key.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/key.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/key.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $ > + * $NetBSD: key.c,v 1.20 2009/02/15 21:55:23 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -86,8 +86,8 @@ private void node__free(key_node_t *); > private void node__put(EditLine *, key_node_t *); > private int node__delete(EditLine *, key_node_t **, const char *); > private int node_lookup(EditLine *, const char *, key_node_t *, > - int); > -private int node_enum(EditLine *, key_node_t *, int); > + size_t); > +private int node_enum(EditLine *, key_node_t *, size_t); > =20 > #define KEY_BUFSIZ EL_BUFSIZ > =20 > @@ -478,9 +478,9 @@ node__free(key_node_t *k) > * Print if last node > */ > private int > -node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt) > +node_lookup(EditLine *el, const char *str, key_node_t *ptr, size_t cnt) > { > - int ncnt; > + size_t ncnt; > =20 > if (ptr =3D=3D NULL) > return (-1); /* cannot have null ptr */ > @@ -493,7 +493,8 @@ node_lookup(EditLine *el, const char *st > /* If match put this char into el->el_key.buf. Recurse */ > if (ptr->ch =3D=3D *str) { > /* match found */ > - ncnt =3D key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, > + ncnt =3D key__decode_char(el->el_key.buf, > + (size_t)KEY_BUFSIZ, cnt, > (unsigned char) ptr->ch); > if (ptr->next !=3D NULL) > /* not yet at leaf */ > @@ -527,9 +528,9 @@ node_lookup(EditLine *el, const char *st > * Traverse the node printing the characters it is bound in buffer > */ > private int > -node_enum(EditLine *el, key_node_t *ptr, int cnt) > +node_enum(EditLine *el, key_node_t *ptr, size_t cnt) > { > - int ncnt; > + size_t ncnt; > =20 > if (cnt >=3D KEY_BUFSIZ - 5) { /* buffer too small */ > el->el_key.buf[++cnt] =3D '"'; > @@ -547,7 +548,7 @@ node_enum(EditLine *el, key_node_t *ptr, > return (-1); > } > /* put this char at end of str */ > - ncnt =3D key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt, > + ncnt =3D key__decode_char(el->el_key.buf, (size_t)KEY_BUFSIZ, cnt, > (unsigned char)ptr->ch); > if (ptr->next =3D=3D NULL) { > /* print this key and function */ > @@ -615,8 +616,8 @@ key_kprint(EditLine *el, const char *key > /* key__decode_char(): > * Put a printable form of char in buf. > */ > -protected int > -key__decode_char(char *buf, int cnt, int off, int ch) > +protected size_t > +key__decode_char(char *buf, size_t cnt, size_t off, int ch) > { > char *sb =3D buf + off; > char *eb =3D buf + cnt; > @@ -626,7 +627,7 @@ key__decode_char(char *buf, int cnt, int > if (ch =3D=3D 0) { > ADDC('^'); > ADDC('@'); > - return b - sb; > + return (int)(b - sb); > } > if (iscntrl(ch)) { > ADDC('^'); > @@ -648,15 +649,15 @@ key__decode_char(char *buf, int cnt, int > ADDC((((unsigned int) ch >> 3) & 7) + '0'); > ADDC((ch & 7) + '0'); > } > - return b - sb; > + return (size_t)(b - sb); > } > =20 > =20 > /* key__decode_str(): > * Make a printable version of the ey > */ > -protected int > -key__decode_str(const char *str, char *buf, int len, const char *sep) > +protected size_t > +key__decode_str(const char *str, char *buf, size_t len, const char *sep) > { > char *b =3D buf, *eb =3D b + len; > const char *p; > @@ -699,7 +700,7 @@ key__decode_str(const char *str, char *b > } > done: > ADDC('\0'); > - if (b - buf >=3D len) > + if ((size_t)(b - buf) >=3D len) > buf[len - 1] =3D '\0'; > - return b - buf; > + return (size_t)(b - buf); > } >=20 > Modified: head/lib/libedit/key.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/key.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/key.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -76,8 +76,8 @@ protected int key_delete(EditLine *, c > protected void key_print(EditLine *, const char *); > protected void key_kprint(EditLine *, const char *, key_value_t= *, > int); > -protected int key__decode_str(const char *, char *, int, > +protected size_t key__decode_str(const char *, char *, size_t, > const char *); > -protected int key__decode_char(char *, int, int, int); > +protected size_t key__decode_char(char *, size_t, size_t, int); > =20 > #endif /* _h_el_key */ >=20 > Modified: head/lib/libedit/prompt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/prompt.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/prompt.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -85,14 +85,23 @@ prompt_print(EditLine *el, int op) > { > el_prompt_t *elp; > char *p; > + int ignore =3D 0; > =20 > if (op =3D=3D EL_PROMPT) > elp =3D &el->el_prompt; > else > elp =3D &el->el_rprompt; > - p =3D (elp->p_func) (el); > - while (*p) > - re_putc(el, *p++, 1); > + > + for (p =3D (*elp->p_func)(el); *p; p++) { > + if (elp->p_ignore =3D=3D *p) { > + ignore =3D !ignore; > + continue; > + } > + if (ignore) > + term__putc(el, *p); > + else > + re_putc(el, *p, 1); > + } > =20 > elp->p_pos.v =3D el->el_refresh.r_cursor.v; > elp->p_pos.h =3D el->el_refresh.r_cursor.h; > @@ -109,10 +118,12 @@ prompt_init(EditLine *el) > el->el_prompt.p_func =3D prompt_default; > el->el_prompt.p_pos.v =3D 0; > el->el_prompt.p_pos.h =3D 0; > + el->el_prompt.p_ignore =3D '\0'; > el->el_rprompt.p_func =3D prompt_default_r; > el->el_rprompt.p_pos.v =3D 0; > el->el_rprompt.p_pos.h =3D 0; > - return (0); > + el->el_rprompt.p_ignore =3D '\0'; > + return 0; > } > =20 > =20 > @@ -130,24 +141,29 @@ prompt_end(EditLine *el __unused) > * Install a prompt printing function > */ > protected int > -prompt_set(EditLine *el, el_pfunc_t prf, int op) > +prompt_set(EditLine *el, el_pfunc_t prf, char c, int op) > { > el_prompt_t *p; > =20 > - if (op =3D=3D EL_PROMPT) > + if (op =3D=3D EL_PROMPT || op =3D=3D EL_PROMPT_ESC) > p =3D &el->el_prompt; > else > p =3D &el->el_rprompt; > + > if (prf =3D=3D NULL) { > - if (op =3D=3D EL_PROMPT) > + if (op =3D=3D EL_PROMPT || op =3D=3D EL_PROMPT_ESC) > p->p_func =3D prompt_default; > else > p->p_func =3D prompt_default_r; > } else > p->p_func =3D prf; > + > + p->p_ignore =3D c; > + > p->p_pos.v =3D 0; > p->p_pos.h =3D 0; > - return (0); > + > + return 0; > } > =20 > =20 > @@ -155,14 +171,22 @@ prompt_set(EditLine *el, el_pfunc_t prf, > * Retrieve the prompt printing function > */ > protected int > -prompt_get(EditLine *el, el_pfunc_t *prf, int op) > +prompt_get(EditLine *el, el_pfunc_t *prf, char *c, int op) > { > + el_prompt_t *p; > =20 > if (prf =3D=3D NULL) > - return (-1); > + return -1; > + > if (op =3D=3D EL_PROMPT) > - *prf =3D el->el_prompt.p_func; > + p =3D &el->el_prompt; > else > - *prf =3D el->el_rprompt.p_func; > - return (0); > + p =3D &el->el_rprompt; > + > + *prf =3D el->el_rprompt.p_func; > + > + if (c) > + *c =3D p->p_ignore; > + > + return 0; > } >=20 > Modified: head/lib/libedit/prompt.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/prompt.h Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/prompt.h Fri Jun 22 18:01:22 2012 (r237448) > @@ -47,11 +47,13 @@ typedef char * (*el_pfunc_t)(EditLine*); > typedef struct el_prompt_t { > el_pfunc_t p_func; /* Function to return the prompt */ > coord_t p_pos; /* position in the line after prompt */ > + char p_ignore; /* character to start/end literal=20 > +*/ > } el_prompt_t; > =20 > protected void prompt_print(EditLine *, int); > -protected int prompt_set(EditLine *, el_pfunc_t, int); > -protected int prompt_get(EditLine *, el_pfunc_t *, int); > +protected int prompt_set(EditLine *, el_pfunc_t, char, int); > +protected int prompt_get(EditLine *, el_pfunc_t *, char *, int); > protected int prompt_init(EditLine *); > protected void prompt_end(EditLine *); > =20 >=20 > Modified: head/lib/libedit/read.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libedit/read.c Fri Jun 22 16:31:00 2012 (r237447) > +++ head/lib/libedit/read.c Fri Jun 22 18:01:22 2012 (r237448) > @@ -29,7 +29,7 @@ > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > * > - * $NetBSD: read.c,v 1.40 2007/03/01 21:41:45 christos Exp $ > + * $NetBSD: read.c,v 1.52 2009/07/22 15:57:00 christos Exp $ > */ > =20 > #if !defined(lint) && !defined(SCCSID) > @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); > #include > #include "el.h" > =20 > -#define OKCMD -1 > +#define OKCMD -1 /* must be -1! */ > =20 > private int read__fixio(int, int); > private int read_preread(EditLine *); > @@ -170,7 +170,7 @@ read__fixio(int fd __unused, int e) > return (e ? 0 : -1); > =20 > case EINTR: > - return (0); > + return (-1); > =20 > default: > return (-1); > @@ -222,7 +222,7 @@ el_push(EditLine *el, const char *str) > ma->level--; > } > term_beep(el); > - term__flush(); > + term__flush(el); > } > =20 > =20 > @@ -235,9 +235,12 @@ read_getcmd(EditLine *el, el_action_t *c > el_action_t cmd; > int num; > =20 > + el->el_errno =3D 0; > do { > - if ((num =3D el_getc(el, ch)) !=3D 1) /* if EOF or error */ > + if ((num =3D el_getc(el, ch)) !=3D 1) { /* if EOF or error */ > + el->el_errno =3D num =3D=3D 0 ? 0 : errno; > return (num); > + } > =20 > #ifdef KANJI > if ((*ch & 0200)) { > @@ -286,18 +289,25 @@ read_getcmd(EditLine *el, el_action_t *c > private int > read_char(EditLine *el, char *cp) > { > - int num_read; > + ssize_t num_read; > int tried =3D 0; > =20 > - while ((num_read =3D read(el->el_infd, cp, 1)) =3D=3D -1) > + again: > + el->el_signal->sig_no =3D 0; > + while ((num_read =3D read(el->el_infd, cp, 1)) =3D=3D -1) { > + if (el->el_signal->sig_no =3D=3D SIGCONT) { > + sig_set(el); > + el_set(el, EL_REFRESH); > + goto again; > + } > if (!tried && read__fixio(el->el_infd, errno) =3D=3D 0) > tried =3D 1; > else { > *cp =3D '\0'; > return (-1); > } > - > - return (num_read); > + } > + return (int)num_read; > } > =20 > /* read_pop(): > @@ -309,8 +319,9 @@ read_pop(c_macro_t *ma) > int i; > =20 > el_free(ma->macro[0]); > - for (i =3D ma->level--; i > 0; i--) > - ma->macro[i - 1] =3D ma->macro[i]; > + for (i =3D 0; i < ma->level; i++) > + ma->macro[i] =3D ma->macro[i + 1]; > + ma->level--; > ma->offset =3D 0; > } > =20 > @@ -323,7 +334,7 @@ el_getc(EditLine *el, char *cp) > int num_read; > c_macro_t *ma =3D &el->el_chared.c_macro; > =20 > - term__flush(); > + term__flush(el); > for (;;) { > if (ma->level < 0) { > if (!read_preread(el)) > @@ -382,7 +393,7 @@ read_prepare(EditLine *el) > re_refresh(el); /* print the prompt */ > =20 > if (el->el_flags & UNBUFFERED) > - term__flush(); > + term__flush(el); > } > =20 > protected void > @@ -402,15 +413,20 @@ el_gets(EditLine *el, int *nread) > int num; /* how many chars we have read at NL */ > char ch; > int crlf =3D 0; > + int nrb; > #ifdef FIONREAD > c_macro_t *ma =3D &el->el_chared.c_macro; > #endif /* FIONREAD */ > =20 > + if (nread =3D=3D NULL) > + nread =3D &nrb; > + *nread =3D 0; > + > if (el->el_flags & NO_TTY) { > char *cp =3D el->el_line.buffer; > size_t idx; > =20 > - while ((*el->el_read.read_char)(el, cp) =3D=3D 1) { > + while ((num =3D (*el->el_read.read_char)(el, cp)) =3D=3D 1) { > /* make sure there is space for next character */ > if (cp + 1 >=3D el->el_line.limit) { > idx =3D (cp - el->el_line.buffer); > @@ -424,12 +440,16 @@ el_gets(EditLine *el, int *nread) > if (cp[-1] =3D=3D '\r' || cp[-1] =3D=3D '\n') > break; > } > + if (num =3D=3D -1) { > + if (errno =3D=3D EINTR) > + cp =3D el->el_line.buffer; > + el->el_errno =3D errno; > + } > =20 > el->el_line.cursor =3D el->el_line.lastchar =3D cp; > *cp =3D '\0'; > - if (nread) > - *nread =3D el->el_line.cursor - el->el_line.buffer; > - return (el->el_line.buffer); > + *nread =3D (int)(el->el_line.cursor - el->el_line.buffer); > + goto done; > } > =20 > =20 > @@ -440,8 +460,8 @@ el_gets(EditLine *el, int *nread) > (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Thanks you for this work !! regards, Bapt --G6nVm6DDWH/FONJq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/kzBMACgkQ8kTtMUmk6EyyAACffsLhGWZ9evLdTHAsKhIO3gDU xUAAnRKAKSX84WuXvcMJ1V/naFEEZ36e =QL50 -----END PGP SIGNATURE----- --G6nVm6DDWH/FONJq--