diff --git a/src/cmd/ksh93/edit/edit.c b/src/cmd/ksh93/edit/edit.c index 58af3577e..f198e8955 100644 --- a/src/cmd/ksh93/edit/edit.c +++ b/src/cmd/ksh93/edit/edit.c @@ -765,13 +765,17 @@ void ed_setup(register Edit_t *ep, int fd, int reedit) ep->e_eol = reedit; if(ep->e_multiline) { -#ifdef _cmd_tput +#if defined(_pth_tput) && (_tput_terminfo || _tput_termcap) char *term; if(!ep->e_term) ep->e_term = nv_search("TERM",shp->var_tree,0); if(ep->e_term && (term=nv_getval(ep->e_term)) && strlen(term)e_termname) && strcmp(term,ep->e_termname)) { - sh_trap(".sh.subscript=$(tput cuu1 2>/dev/null)",0); +#if _tput_terminfo + sh_trap(".sh.subscript=$(" _pth_tput " cuu1 2>/dev/null)",0); +#elif _tput_termcap + sh_trap(".sh.subscript=$(" _pth_tput " up 2>/dev/null)",0); +#endif if(pp=nv_getval(SH_SUBSCRNOD)) strncpy(CURSOR_UP,pp,sizeof(CURSOR_UP)-1); nv_unset(SH_SUBSCRNOD); diff --git a/src/cmd/ksh93/edit/emacs.c b/src/cmd/ksh93/edit/emacs.c index a580dd447..46c753264 100644 --- a/src/cmd/ksh93/edit/emacs.c +++ b/src/cmd/ksh93/edit/emacs.c @@ -1001,7 +1001,9 @@ static int escape(register Emacs_t* ep,register genchar *out,int count) case '*': /* filename expansion */ case '=': /* escape = - list all matching file names */ ep->mark = cur; - if(ed_expand(ep->ed,(char*)out,&cur,&eol,i,count) < 0) + if(cur<1) + beep(); + else if(ed_expand(ep->ed,(char*)out,&cur,&eol,i,count) < 0) { if(ep->ed->e_tabcount==1) { @@ -1063,10 +1065,9 @@ static int escape(register Emacs_t* ep,register genchar *out,int count) cur = i; draw(ep,UPDATE); return(-1); - -#ifdef _cmd_tput +#ifdef _pth_tput case cntl('L'): /* clear screen */ - sh_trap("tput clear", 0); + system(_pth_tput " clear"); draw(ep,REFRESH); return(-1); #endif diff --git a/src/cmd/ksh93/features/cmds b/src/cmd/ksh93/features/cmds index c7590683b..1554c68d9 100644 --- a/src/cmd/ksh93/features/cmds +++ b/src/cmd/ksh93/features/cmds @@ -1,4 +1,35 @@ -cmd newgrp,test,id,wc,cut,logname,universe,pfexec,tput +cmd universe + pth ed fail{ echo '#define _pth_ed "ed" /* ed not found on standard PATH */' }end + +pth tput + +tput_terminfo note{ does tput support terminfo codes }end run{ + case ${_pth_tput-} in + \"/*/tput\") + tput=`echo "${_pth_tput}" | sed 's/^"//; s/"$//'` + if "$tput" sgr0 >/dev/null 2>&1 && + "$tput" cuu1 >/dev/null 2>&1 + then echo '#define _tput_terminfo 1 /* tput supports terminfo codes */' + else echo '#define _tput_terminfo 0 /* tput does not support terminfo codes */' + exit 1 + fi ;; + *) exit 1 ;; + esac +}end + +tput_termcap note{ does tput support termcap codes }end run{ + case ${_pth_tput-} in + \"/*/tput\") + tput=`echo "${_pth_tput}" | sed 's/^"//; s/"$//'` + if "$tput" me >/dev/null 2>&1 && + "$tput" up >/dev/null 2>&1 + then echo '#define _tput_termcap 1 /* tput supports termcap codes */' + else echo '#define _tput_termcap 0 /* tput does not support termcap codes */' + exit 1 + fi ;; + *) exit 1 ;; + esac +}end