[net.unix] Talk for Sys V and curses

nwh@hrc63.UUCP (Nigel Holder Marconi) (06/10/86)

 
   For all you people out there with Uniplus type Sys V ports (at least
the old variety), here are a few run downs of curses commands specific
to Sys V and not in 4.2 -

doupdate()
wnoutrefresh(win)

   These two little beasties allow many windows to be painted to curscr
by wnoutrefresh() without actually repainting the terminal.  This is
achieved by doupdate().  Real reason for use is that all
three windows can be defined and painted in one go - letting curses
decide how best to draw them and not me by assuming that curses
wants to start at the top left hand corner, and refreshing them in that
order.


                        Replace by wrefresh(win1)
                                   wrefresh(win2)
                                   wrefresh(win3)



erasechar()

   The users erase char as defined in their tty structure.  Easiest
fix is to define it as 0x7F or better still perform an ioctl
on stdin to access the structure (see tty manual entry).



flushinp()

   As name suggest it flushes all characters waiting to be read.  Can
also be achieved by ioctl call which flushes buffer before setting
new tty parameters (which can be obtained be reading them beforehand).


beep()

   Just rings the bell on the terminal.  Usually writing 0x07 will
achieve the same thing.



cbreak()

   Try using crmode - this achieves the same thing by putting terminal
in cbreak mode (why is it not called cbreak then ?).



idlok(stdscr, TRUE/FALSE)

   Enables curses to make use of insert and delete line functions
as in terminfo (compiled termcap) entry.  This seems to also
allow curses to use scrolling regions when it likes on vt100 like
terminals to perform very quick scrolling of a window (normally full
width I suspect).  4.2 can't, so eat your heart out 4.2.


nodelay(win, TRUE/FALSE)

  When set to TRUE, it puts terminal in nodelay-mode; that is
getch will always return even if there are no characters waiting
(returns -1 in this case).  Can simulate be using :-

        /*  4.x systems and some hybrids  */

        #include <sys/ioctl.h>

        long int c;             /*  usually its a long int, see man tty  */

        ioctl(0, FIONREAD, &c)          /*  not in real Sys V  */
        if (c > 0)   {
                x = getch(win)          /*  must be in crmode (cbreak) mode  */
                ...
                ...
        }
 
        (somewhat superceeded by the select() call in 4.2 now though)



        AS OPPOSED TO   (real Sys V)

        nodelay(win, TRUE);
        x = getch(win)                  /*  must be in crmode (cbreak) mode  */
        if (x != -1)   {
                ...
                ...
        }


   Well, I think thats about it - do tell me if there are any other
curses definitions that don't work.  By the way, you may also
need to compile cc ... -ltermcap -lcurses on such systems




Nigel Holder                    UK JANET:       yf21@uk.co.gec-mrc.u
Marconi Research,               ARPA:           yf21%u.gec-mrc.co.uk@ucl-cs
Chelmsford,
Essex. CM2 8HN.