[comp.bugs.4bsd] curses bug: mvwprintw

bart@videovax.tv.Tek.com (Bart Massey) (02/22/89)

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 <curses.h>

	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);