xref: /csrg-svn/lib/libcurses/getstr.c (revision 55960)
122665Sdist /*
234677Sbostic  * Copyright (c) 1981 Regents of the University of California.
334677Sbostic  * All rights reserved.
434677Sbostic  *
542653Sbostic  * %sccs.include.redist.c%
622665Sdist  */
722665Sdist 
822665Sdist #ifndef lint
9*55960Sbostic static char sccsid[] = "@(#)getstr.c	5.5 (Berkeley) 08/23/92";
10*55960Sbostic #endif	/* not lint */
1122665Sdist 
12*55960Sbostic #include <curses.h>
132250Sarnold 
142250Sarnold /*
15*55960Sbostic  * wgetstr --
16*55960Sbostic  *	Get a string starting at (_cury,_curx).
172250Sarnold  */
18*55960Sbostic int
19*55960Sbostic wgetstr(win, str)
20*55960Sbostic 	register WINDOW *win;
21*55960Sbostic 	register char *str;
22*55960Sbostic {
2313223Sarnold 	while ((*str = wgetch(win)) != ERR && *str != '\n')
242250Sarnold 		str++;
253497Sarnold 	if (*str == ERR) {
263639Sarnold 		*str = '\0';
27*55960Sbostic 		return (ERR);
283497Sarnold 	}
292250Sarnold 	*str = '\0';
30*55960Sbostic 	return (OK);
312250Sarnold }
32