From f52a9fb11e61a5b62fa77d43fb635556de3fb648 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Tue, 4 May 1999 21:27:55 +0000 Subject: zsh-workers:6205 --- Src/Zle/zle_main.c | 22 +++++++++++++++++----- acconfig.h | 3 --- configure.in | 19 ------------------- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 46721b641..be82672f8 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -119,12 +119,16 @@ zsetterm(void) { struct ttyinfo ti; -#if defined(CLOBBERS_TYPEAHEAD) && defined(FIONREAD) +#if defined(FIONREAD) int val; ioctl(SHTTY, FIONREAD, (char *)&val); - if (val) - return; + if (val) { + char *tmpline = (char *)zalloc(val); + read(SHTTY, tmpline, val); + ungetkeys(tmpline, val); + zfree(tmpline, val); + } #endif /* sanitize the tty */ @@ -656,14 +660,18 @@ handleprefixes(void) initmodifier(&zmod); } +/* this exports the argument we are currently vared'iting if != NULL */ + +/**/ +char *varedarg; + /* vared: edit (literally) a parameter value */ /**/ static int bin_vared(char *name, char **args, char *ops, int func) { - char *s; - char *t; + char *s, *t, *ova = varedarg; Value v; Param pm = 0; int create = 0; @@ -753,7 +761,9 @@ bin_vared(char *name, char **args, char *ops, int func) PERMALLOC { pushnode(bufstack, ztrdup(s)); } LASTALLOC; + varedarg = *args; t = (char *) zleread(p1, p2, ops['h'] ? ZLRF_HISTORY : 0); + varedarg = ova; if (!t || errflag) { /* error in editing */ errflag = 0; @@ -927,6 +937,8 @@ setup_zle(Module m) /* initialise the keymap system */ init_keymaps(); + varedarg = NULL; + return 0; } diff --git a/acconfig.h b/acconfig.h index 1e0473557..58ad6aa2b 100644 --- a/acconfig.h +++ b/acconfig.h @@ -189,9 +189,6 @@ /* Define to 1 if struct timezone is defined by a system header */ #undef HAVE_STRUCT_TIMEZONE -/* Define if your system's typeahead disappears from the shell editor. */ -#undef CLOBBERS_TYPEAHEAD - /* Define to 1 if there is a prototype defined for brk() on your system */ #undef HAVE_BRK_PROTO diff --git a/configure.in b/configure.in index f022744f4..d275d6fb0 100644 --- a/configure.in +++ b/configure.in @@ -883,25 +883,6 @@ zsh_PATH_UTMP(wtmp) zsh_PATH_UTMP(utmpx) zsh_PATH_UTMP(wtmpx) -dnl ---------------- -dnl TYPEAHEAD KLUDGE -dnl ---------------- -dnl Some systems clobber typeahead when you go from canonical input -dnl processing to non-canonical, so we need a FIONREAD ioctl. -dnl I don't know how to check this with configure, so I am using the -dnl system names directly. -dnl The doubled square brackets are necessary because autoconf uses m4. -AC_CACHE_CHECK(if typeahead needs FIONREAD, zsh_cv_sys_clobbers_typeahead, -[case x-$host_vendor-$host_os in - x-*-ultrix* | x-*-dgux* | x-sni-sysv4* | x-*-irix*) - zsh_cv_sys_clobbers_typeahead=yes;; - *) - zsh_cv_sys_clobbers_typeahead=no;; -esac]) -if test $zsh_cv_sys_clobbers_typeahead = yes; then - AC_DEFINE(CLOBBERS_TYPEAHEAD) -fi - dnl ------------------- dnl brk/sbrk PROTOTYPES dnl ------------------- -- cgit 1.4.1