xref: /original-bsd/lib/libcurses/getstr.c (revision 02e832b2)
1 /*
2  * Copyright (c) 1981 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)getstr.c	5.7 (Berkeley) 12/30/92";
10 #endif	/* not lint */
11 
12 #include <curses.h>
13 
14 /*
15  * wgetstr --
16  *	Get a string starting at (cury, curx).
17  */
18 int
19 wgetstr(win, str)
20 	register WINDOW *win;
21 	register char *str;
22 {
23 	while ((*str = wgetch(win)) != CURSES_ERR && *str != '\n')
24 		str++;
25 	if (*str == CURSES_ERR) {
26 		*str = '\0';
27 		return (CURSES_ERR);
28 	}
29 	*str = '\0';
30 	return (CURSES_OK);
31 }
32