pjc@pbhyf.UUCP (Paul Condie) (10/29/87)
/*
** Help on how to program the suns' function keys???
*/
#include <curses.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sundev/kbd.h>
#include <sundev/kbio.h>
main ()
{
char ch;
int fd;
initscr ();
cbreak ();
noecho ();
nonl ();
keypad (stdscr, TRUE);
fd = open ("/dev/kbd", 0, 0);
/* set the up arrow */
/* this works */
set_key (fd, 69, "uparrow", STRING+UPARROW);
/* set F4 */
/* this doesn't work */
/* H E L P - why doesn't this work ? */
set_key (fd, 3, "hello", STRING+TF(4));
close (fd);
while (ch != '9')
{
ch = getch ();
printf ("\n:%d: :%c:", ch, ch);
}
endwin ();
}
set_key(fd, station, value, count)
int fd, station, count ;
char value[80] ;
{
struct kiockey key ;
key.kio_tablemask = 0 ;
key.kio_entry = count ;
key.kio_station = station ;
strcpy (key.kio_string,value) ;
ioctl (fd,(int) KIOCSETKEY,(char *) &key) ;
}