Subject: curses problem
To: None <current-users@NetBSD.ORG>
From: Gary D. Duzan <gary@wheel.tiac.net>
List: current-users
Date: 07/03/1995 23:04:02
   I'm having trouble running the latest version of LifeLines, a
genealogy program, and I was wondering if someone might be able to
help, since I'm not terribly familiar with curses and it looks good
to me. Apologies if this is too far off topic, but there is also a
chance this is a curses bug. Thanks.

                                      Gary D. Duzan
                         Humble Practitioner of the Computer Arts



(gdb) run
Starting program: /users/gary/lines/bin/lines302 
subwin(0x3f080, 18, 74, 13 , 3)    /* This is a fprintf I inserted */

Program received signal SIGSEGV (11), Segmentation fault
0x1004a0be in __set_subwin ()
(gdb) where
#0  0x1004a0be in __set_subwin ()
#1  0x1004a056 in subwin ()
#2  0xb02a in create_windows () at screen.c:315
#3  0x984b in init_screen () at screen.c:68
#4  0x56ee in main (argc=1, argv=0xf7bfd968) at main.c:50
(gdb) frame 2
#2  0xb02a in create_windows () at screen.c:315
315             stdout_win = SUBWIN(stdout_box_win, LINESREQ-6, COLSREQ-6);
(gdb) print stdout_box_win
$1 = (WINDOW *) 0x3f080
(gdb) print *stdout_box_win
$2 = {nextp = 0x3f0c0, orig = 0x0, begy = 12, begx = 2, cury = 0, curx = 0, 
  maxy = 20, maxx = 76, ch_off = 0, lines = 0x3c000, lspace = 0x3a400, 
  wspace = 0x47000, flags = 0}
(gdb) 

Related source code:

#define NEWWIN(r,c)   newwin(r,c,(LINES - (r))/2,(COLS - (c))/2)
#define SUBWIN(w,r,c) (fprintf(stderr, "subwin(%p, %d, %d, %d , %d)\n", \
                                        w,r,c,(LINES - (r))/2,(COLS - (c))/2), \
                       subwin(w,r,c,(LINES - (r))/2,(COLS - (c))/2))
/* qqq - #define SUBWIN(w,r,c) subwin(w,r,c,(LINES - (r))/2,(COLS - (c))/2) */

        stdout_box_win = NEWWIN(LINESREQ-4, COLSREQ-4);
        stdout_win = SUBWIN(stdout_box_win, LINESREQ-6, COLSREQ-6);