stopped working because the third letter remained in the buffer,
incard() skipped the NUL and used the old garbage.
Fix this bug reported by pjanzen@, but in a simpler way than he
suggested, by just clearing any trailing garbage from the buffer.
ok pjanzen@
-/* $OpenBSD: io.c,v 1.15 2014/05/09 00:03:41 schwarze Exp $ */
+/* $OpenBSD: io.c,v 1.16 2014/05/09 02:47:25 schwarze Exp $ */
/* $NetBSD: io.c,v 1.9 1997/07/09 06:25:47 phil Exp $ */
/*-
Mpos++;
}
}
- linebuf[pos] = '\0';
+ while (pos < sizeof(linebuf))
+ linebuf[pos++] = '\0';
stdscr = oscr;
return (linebuf);
}