Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekcrl!tekfdi!videovax!bart From: bart@videovax.tv.Tek.com (Bart Massey) Newsgroups: comp.bugs.4bsd Subject: curses bug: mvwprintw() works only on stdscr Keywords: curses Message-ID: <5381@videovax.tv.Tek.com> Date: 22 Feb 89 01:26:37 GMT Organization: Tektronix TV Measurement Systems, Beaverton OR Lines: 59 From: Bart Massey (bart@videovax.tv.tek.com) Versions: 4.3BSD "tahoe" on a VAX 11/750 @(#)curses.h 5.4 (Berkeley) 6/30/88 Description: mvwprintw() can't be a macro because of varargs. Unfortunately, the C code calls move() instead of wmove() to do the move part. Thus, mvwprintw() works correctly only on stdscr. Repeat-by: Compile and execute the following: ------------------------------------------------------------ #include main() { WINDOW *w; initscr(); crmode(); noecho(); w = subwin(stdscr, LINES-10, COLS-10, 5, 5); mvwprintw(w, 6, 6, "%s", "hello"); mvwprintw(w, 6, 20, "%s", "gbye"); wrefresh( w ); getchar(); endwin(); } ------------------------------------------------------------ Note that there is no space left between the two output strings, and that the cursor ends up in a funny spot. Fix: *** /tmp/,RCSt1017541 Tue Feb 21 17:18:37 1989 --- mvprintw.c Tue Feb 21 14:49:23 1989 *************** *** 48,54 **** char buf[512]; ! if (move(y, x) != OK) return ERR; (void) vsprintf(buf, fmt, &args); return waddstr(win, buf); --- 48,54 ---- char buf[512]; ! if (wmove(win, y, x) != OK) return ERR; (void) vsprintf(buf, fmt, &args); return waddstr(win, buf);