Ken Arnold edits for document distributed with 4.3BSD
[unix-history] / usr / src / lib / libcurses / getstr.c
CommitLineData
6e1c93d0
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8static char sccsid[] = "@(#)getstr.c 5.1 (Berkeley) %G%";
9#endif not lint
10
94aeb2d1
KA
11# include "curses.ext"
12
13/*
14 * This routine gets a string starting at (_cury,_curx)
15 *
94aeb2d1
KA
16 */
17wgetstr(win,str)
18reg WINDOW *win;
19reg char *str; {
20
57bc80fd 21 while ((*str = wgetch(win)) != ERR && *str != '\n')
94aeb2d1 22 str++;
158defd2 23 if (*str == ERR) {
158defd2 24 *str = '\0';
7527eef6 25 return ERR;
158defd2
KA
26 }
27 *str = '\0';
94aeb2d1
KA
28 return OK;
29}