Subject: Re: CVS commit: basesrc/bin/ksh
To: Joerg Klemenz <joerg@gmx.net>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 09/28/2002 14:39:20
[ On Saturday, September 28, 2002 at 00:59:17 (+0000), Joerg Klemenz wrote: ]
> Subject: Re: CVS commit: basesrc/bin/ksh
>
> > Since <HOME> is in ANSI x3.64 by default <ESC>[H, and <END> is by
> > default <ESC>[F, extending the above suggests:
> > 
> > 	bind '^XH'=beginning-of-line
> > 	bind '^XF'=end-of-line
> > 
> > And, indeed those to commands alone work just fine (since if I'm not
> > mistaken '^[['=prefix-2 is already a default binding).
> 
> It is not. I don't know what version of pdksh or NetBSD you are using,
> but it certainly doesn't work for me.

I'm using an xterm, but my example should work for all ANSI x3.64
compatible terminals.

> The NetBSD console gives ^[[8~
> for <END> not ^[[F

A, well then I guess on some versions of NetBSD, including what you're
using, the console is not ANSI x3.64 compatible.

> I did not say it was errornous. It just sucks.
> Cursor-addressable terminals have been available for some time now.

I'm not sure what you're complaining about then.  No matter how you
manipulate the characters on the screen, the behaviour of a horizonally
scrolling line editor is going to be essentially exactly the same.  The
way pdksh manipulates the terminal happens to be quite portable across
terminals and hosts.

> > fragment from ~/.profile that I've used for the past ten years:
> > 
> > 	if [ ${RANDOM:-0} -ne ${RANDOM:-0} -a -z "${BASH}" ] ; then
> > 		# we're running ksh
> > 		if [ -r $HOME/.kshlogin ] ; then
> > 			. $HOME/.kshlogin
> > 		fi
> > 	fi
> 
> I can see from looking at it for 10 seconds that this code fails w/ zsh

I've never encountered a system where zsh might be the only POSIX-like
shell available to me, so I've never bothered to test it.  However that
fragment above will not "fail" with zsh -- it just might not do
everything you want, which is why I suggested that you look at the
complete implemenation in my archive.

> it's late...

You should look again when you've had more sleep!  :-)

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>