Operating System - HP-UX
1833758 Members
2945 Online
110063 Solutions
New Discussion

up arrow and character mapping

 
SOLVED
Go to solution
Josh_13
Super Advisor

up arrow and character mapping

i can'tfind the command to do character mapping anywhere. i have been asked to map the up arrow so that it will go through the history, but cannot even find what the keyboard interpretation that hpux looks for is. can anyone help? what's the cmmand for character mapping? some variant of stty not mentioned in the man? and what is the character for the up arrow?

thanx.

-Josh
17 REPLIES 17
A. Clay Stephenson
Acclaimed Contributor

Re: up arrow and character mapping

Hi Josh:

In one sense your question has no meaning in that UNIX depends upon the particular setting of TERM to make this determination. The easy way to find out what your current setting is to do an 'infocmp' and look for the kcuu1 entry. This is the terminfo key_up value butr it is typically a sequence of characters rather than a single character. infocmp is used to get a text version, tic (terminfo compiler) is used to convert a specification into a terminfo database entry. Man infocmp, terminfo, and tic for details.
If it ain't broke, I can fix that.
Josh_13
Super Advisor

Re: up arrow and character mapping

i'd like to thank you for the help. there's so much information in those manual entries it'll take a day or two to go through everything. i'll be assinging points afterwords, but it looks like you both deserve a ten.

-Josh
Josh_13
Super Advisor

Re: up arrow and character mapping

after having done most of the reading, i'm not sure there is anything wrong with the mappeing per se. i think the problem is the shell. netscape, xemacs, sam, etc all use it correctly, but in the shell it displays [A instead of going up through the history and [B instead of scrolling down through the history.
John Waller
Esteemed Contributor

Re: up arrow and character mapping

Try typing smkx, I've just found that that seems to correct using up and down arrows for history information
Josh_13
Super Advisor

Re: up arrow and character mapping

hal.net.brandeis.edu 21: smkx
smkx: Command not found.
hal.net.brandeis.edu 22:
S.K. Chan
Honored Contributor

Re: up arrow and character mapping

# tput smkx
Josh_13
Super Advisor

Re: up arrow and character mapping

slightly different, but still not scrolling through history. i think all the answers so far deserve a 9 since the frist two highlighted the fact the problem is only in the shell and are very infomrative, and the second two are commands that could (possibly should) work, but for some reason aren't working. in either case here's what's happening after hte last one:

hal.net.brandeis.edu 33: tput smkx
hal.net.brandeis.edu 34: OAOB
Josh_13
Super Advisor

Re: up arrow and character mapping

i have a dilemma here.
Sanjay and A. Clay Stephenson both deserve ten points for pointing out that it's not actually a character maping issue and that i was thinking of this in a very wrong context, however, that's not a magic answer, so i cna't give them their points until it's fixed.

now there's the next two responses...

John Waller and S.K. Chan both deserve 9 points becuase the real answer should probably be a variant of what they said. however, the man pages are giving no clues as to what variants are possible. it doesn't even give the smkx add on. changing it to "tput -smkx" from "tput smkx" merelygives this error:
hal.net.brandeis.edu 31: tput -smkx
tput: usage: "tput [-STterm] capname [parms ...]"
hal.net.brandeis.edu 32:

now i just need the variant that fixes it on the hpux box i'm using. anyone willing to tell me the codes i can use and what they do so i can try figureing it out, or giving me the one that will work? either way it will *hopefully* solve the problem, and then i'll give out points to everyone who responded here

-J
Rodney Hills
Honored Contributor
Solution

Re: up arrow and character mapping

If you are trying to do what VMS/VAX does for command line editting, I don't think you can map the up arrow key in ksh, csh, or posix.

However, if you run "keysh" as your shell, the up, down, left, right arrow keys work there.

keysh is kind of a strange critter and has features that most sys admins probabily don't care for. But if arrow processing is important, then this could do it for you...

-- Rod Hills
There be dragons...
Marc Dijkstra
Trusted Contributor

Re: up arrow and character mapping

Hey Josh...

I put the bash shell on my HP for the very reason. Download from http://hpux.connect.org.uk/ ,it is a swinstall depot.

MND
"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila"
John Waller
Esteemed Contributor

Re: up arrow and character mapping

Just smkx worked for me as me predisesor has put it in /.kshrc file. I'm wondering if he put anything else in there which mad it work so here it is for you to compare

machine:/ # cat .kshrc
:
# .kshrc

smkx() {
echo $(tput smkx)
}

set -o emacs
set -o noclobber

MAILCHECK=0
TMOUT=1200

export KEYKSH=y
export KEYPS1=y

alias hist='fc -lr -100 | more -10;'

#alias mt='mt -t ${TAPE:-/dev/rmt/0hnb}'

# define terminal-specific aliases for cursor keys

case $TERM in
ftp2*|vt1*|vt2*|tn*|ansi|xansi|xterm)
alias __A=''
alias __B=''
alias __C=''
alias __D=''
;;
hp*|700*)
alias _A=''
alias _B=''
alias _C=''
alias _D=''
alias _S=''
alias _T=''
alias _U=''
alias _V=''
alias _P=''
smkx
;;
*)
;;
esac

It may help, but then again....
John Waller
Esteemed Contributor

Re: up arrow and character mapping

Forgot to add root uses /sbin/sh as its shell, normal users /usr/bin/ksh. We use this file as a comman for both .
Rodney Hills
Honored Contributor

Re: up arrow and character mapping

Question to John Waller,

I notice you have
export KEYKSH=y
Are you sure you are not running "keysh"? With this option set, "keysh" will try to look like "ksh".

I don't see how echoing the smkx changes your shell to accept the up arrow key for command history. Your script is only echoing for hp terminals, does that mean vt100/vt200 terminals would not have up arrow processing of the command history?

Josh- Your original question implied you were looking for a way to scan and edit the command history by using the up arrow key. Is that what you are looking for?

-- Rod Hills
There be dragons...
Josh_13
Super Advisor

Re: up arrow and character mapping

Marc-

is there an 11i version?
Marc Dijkstra
Trusted Contributor

Re: up arrow and character mapping

Hi Josh

I am running it happily on my C100 running 11i on my desk. Just installed the binaries too;)

There is source code for the shell on the site, so if you have trouble, you could always compile it.

MND
"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila"
Marc Dijkstra
Trusted Contributor

Re: up arrow and character mapping

Josh,

A gotcha here that I should mention. Do not under any circumstances set this as root's primary shell in the /etc/passwd file! I think you will find a thread on this forum as to why;)

MND
"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila"