xref: /csrg-svn/lib/libcurses/getstr.c (revision 61270)
122665Sdist /*
2*61270Sbostic  * Copyright (c) 1981, 1993
3*61270Sbostic  *	The Regents of the University of California.  All rights reserved.
434677Sbostic  *
542653Sbostic  * %sccs.include.redist.c%
622665Sdist  */
722665Sdist 
822665Sdist #ifndef lint
9*61270Sbostic static char sccsid[] = "@(#)getstr.c	8.1 (Berkeley) 06/04/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 {
2357472Sbostic 	while ((*str = wgetch(win)) != ERR && *str != '\n')
242250Sarnold 		str++;
2557472Sbostic 	if (*str == ERR) {
263639Sarnold 		*str = '\0';
2757472Sbostic 		return (ERR);
283497Sarnold 	}
292250Sarnold 	*str = '\0';
3057472Sbostic 	return (OK);
312250Sarnold }
32