xref: /csrg-svn/lib/libcurses/getstr.c (revision 57472)
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*57472Sbostic static char sccsid[] = "@(#)getstr.c	5.8 (Berkeley) 01/11/93";
1055960Sbostic #endif	/* not lint */
1122665Sdist 
1255960Sbostic #include <curses.h>
132250Sarnold 
142250Sarnold /*
1555960Sbostic  * wgetstr --
1656238Selan  *	Get a string starting at (cury, curx).
172250Sarnold  */
1855960Sbostic int
1955960Sbostic wgetstr(win, str)
2055960Sbostic 	register WINDOW *win;
2155960Sbostic 	register char *str;
2255960Sbostic {
23*57472Sbostic 	while ((*str = wgetch(win)) != ERR && *str != '\n')
242250Sarnold 		str++;
25*57472Sbostic 	if (*str == ERR) {
263639Sarnold 		*str = '\0';
27*57472Sbostic 		return (ERR);
283497Sarnold 	}
292250Sarnold 	*str = '\0';
30*57472Sbostic 	return (OK);
312250Sarnold }
32