[comp.lang.c] Curses! Fix Those Bugs!

nardacph@Hawaii-EMH.arpa (10/15/87)

In article <932@trotter.usma.edu>, Bill Gunshannon requested that
I post the fixes I made to Allen Holub's version of Curses, which
he published in the July issue of Dr. Dobb's Journal of Software
Tools.  Because I followed the usual procedure of making changes
until it worked, I do not guarantee that every one of these changes
is absolutely essential.  Line numbers refer to the published listings.
 
    List-   Line    function    Change
    ing #   #       name
 
    4       186     newwin()    reverse lines 186, 187
    4       299     waddch()    "default:" case should read:
                                if(++(win->col) < win->x_size) {
                                    putchar(c);
                                    break;
                                } else
                                    replace(c);
                                /* fall through to newline */
    4       333     waddstr()   Change:  waddch( win, *str );
                                To:      waddch( win, *str++ );
    4       340     wputc()     Change:  static wputc(c,win) WINDOW *win;
                                To:      static wputc(c, win)
                                         int    c;
                                         WINDOW *win;
    4       366     box()       Add between lines 366 and 367:
                                    int vert, horiz;
    4       445     werase()    Change final parameter of werase()
                                From:  win->y_size
                                To:    0
    4       560     clear()     Change final argument of doscroll()
                                From:  25
                                To:    0
    4       585     wclrtoeol() Change:  replace(' ');
                                To:      if (win->col < win->x_size)
                                            replace(' ');
    4       659     main()      Change:  win2 = boxwin(10, 20, 21, 11);
                                To:      win2 = boxwin(10, 20, 11, 21);
    1       54      vb_scroll() Declare function parameters
    1       117     vb_cursize()   "  "
    1       198     vb_ctoyx()     "  "
    1       215     vb_replace()   "  "
    1       232     vb_putchar()   "  "
    1       249     vb_puts()   Declare move_cur
 
To make the package work with color, I #define'd  ATTRIBUTE to be
0x17 (white on blue), then replaced 0x07 with ATTRIBUTE in vb_scroll(),
vb_replace(), and vb_putchar() (all in Listing 1, VBIOS.C).  To change
colors, redefine ATTRIBUTE and recompile.
 
I had to make some additional changes to make the package work with
a pre-ANSI version of Computer Innovations C86 (V. 2.30a).  If anyone
is interested in those changes, please let me know.
 
For those who tuned in late, the source code for this package is
available in DDJFORUM on Compuserve, or by mail from Dr. Dobb's Journal.
 
_____________________________________ ___________________________________
Charles Taylor                       |
Navy Regional Data Automation Center |  "The symbol is not the thing
Box 140                              |   symbolized.  The map is not
Pearl Harbor, HI 96860               |   the territory."
                                     |         S. I. Hayakawa
MILNET:  NARDACPH @ HAWAII-EMH.ARPA  |
_____________________________________|___________________________________