2 * Copyright (C) 1984-2012 Mark Nudelman
3 * Modified for use with illumos by Garrett D'Amore.
4 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Less License, as specified in the README file.
9 * For more information, see the README file.
13 * Routines dealing with getting input from the keyboard (i.e. from the user).
19 extern volatile sig_atomic_t sigs
;
23 * Open keyboard for input.
30 * If that doesn't work, use file descriptor 2,
31 * which in Unix is usually attached to the screen,
32 * but also usually lets you read from the keyboard.
34 tty
= open("/dev/tty", O_RDONLY
);
40 * Get a character from the keyboard.
49 result
= iread(tty
, &c
, sizeof (char));
50 if (result
== READ_INTR
)
54 * Don't call error() here,
55 * because error calls getchr!
60 * Various parts of the program cannot handle
61 * an input character of '\0'.
62 * If a '\0' was actually typed, convert it to '\340' here.
66 } while (result
!= 1);