xref: /original-bsd/lib/libcurses/getstr.c (revision c3e32dec)
1 /*
2  * Copyright (c) 1981, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)getstr.c	8.1 (Berkeley) 06/04/93";
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)) != ERR && *str != '\n')
24 		str++;
25 	if (*str == ERR) {
26 		*str = '\0';
27 		return (ERR);
28 	}
29 	*str = '\0';
30 	return (OK);
31 }
32