Problem with curses ``getstr()''.

Mike Laman laman at ncr-sd.UUCP
Wed Oct 23 10:49:10 AEST 1985


In article <137 at oberon.UUCP> mcooper at oberon.UUCP (Michael Cooper) writes:
>Ahh, yes.  Another curses problem.  Or at least it is a problem 
>that curses is having with me!  I am trying to get a string from a window
>with wgetstr(win, buf).  Now I checked both in the documentation and
>getstr.c and both say that getstr reads up to a newline ('\n') or EOF.
>When I put this into practice, though, it just plain doesn't work.  It
>keeps reading everything in.  This includes newlines, SIGINTR, SIGKILL,
>SIGSUSP.  The only way to get out of it is to use another terminal and kill
>the program's process.
>
>Would somebody care to point out something that I missed?  Or is it 
>just another bug from the braindamaged Berzerkeley?  If so, anybody want to
>volunteer a fix?
>

    Sure, I'll volunteer a fix.  This is an amazingly simple one.  Don't
ask me how it got through, but one would suspect the wgetstr (or getstr)
aren't used much :-).

    In wgetstr() you will see the loop:

							Opps
							   |
							   |
							   V
	while ((*str = wgetch(win)) != ERR && *str != '\n');
		str++;
	if (*str == ERR) {
		:
		:

    Yep.  Remove the semicolon and have fun.  Maybe I should post
my list of bug fixes for the 4.2 BSD curses library again
(to net.bugs.4bsd)? If anyone thinks so, then let me know by mail.  If I
get a few requests, I'll post my file of bug fixes again.  It has
been a while.

		Mike Laman, NCR @ Rancho Bernardo
		UUCP: {ucbvax,philabs,sdcsla}!sdcsvax!ncr-sd!laman



More information about the Comp.unix.wizards mailing list