20 |
|
*/ |
21 |
|
|
22 |
|
struct sgttyb ttymode; /* original tty modes */ |
23 |
– |
|
23 |
|
int ttyfd; /* tty file descriptor */ |
25 |
– |
|
24 |
|
struct driver *ttydev; /* tty device */ |
25 |
|
|
26 |
+ |
static dr_cominf_t ttyin; |
27 |
+ |
static dr_getchf_t; |
28 |
+ |
static void ttydone(void); |
29 |
+ |
static void newinp(void); |
30 |
|
|
31 |
< |
ttyset(dev, fd) /* set up raw tty device */ |
32 |
< |
struct driver *dev; |
33 |
< |
int fd; |
31 |
> |
|
32 |
> |
extern void /* XXX declare */ |
33 |
> |
ttyset( /* set up raw tty device */ |
34 |
> |
struct driver *dev, |
35 |
> |
int fd |
36 |
> |
) |
37 |
|
{ |
33 |
– |
int ttyin(), newinp(); |
38 |
|
struct sgttyb flags; |
39 |
|
|
40 |
|
if (!isatty(fd)) |
56 |
|
} |
57 |
|
|
58 |
|
|
59 |
< |
ttydone() /* restore tty modes */ |
59 |
> |
static void |
60 |
> |
ttydone(void) /* restore tty modes */ |
61 |
|
{ |
62 |
|
fcntl(ttyfd, F_SETFL, 0); |
63 |
|
signal(SIGIO, SIG_DFL); |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
< |
int |
72 |
< |
getch() /* get a character in raw mode */ |
71 |
> |
static int |
72 |
> |
getch(void) /* get a character in raw mode */ |
73 |
|
{ |
74 |
|
register int c; |
75 |
|
|
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
< |
static |
86 |
< |
ttyin(buf, prompt) /* read a line in raw mode */ |
87 |
< |
char *buf, *prompt; |
85 |
> |
static void |
86 |
> |
ttyin( /* read a line in raw mode */ |
87 |
> |
char *buf, |
88 |
> |
char *prompt |
89 |
> |
) |
90 |
|
{ |
84 |
– |
int getch(); |
91 |
|
|
92 |
|
if (prompt != NULL) |
93 |
|
(*ttydev->comout)(prompt); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
< |
static |
99 |
< |
newinp() /* new input */ |
98 |
> |
static void |
99 |
> |
newinp(void) /* new input */ |
100 |
|
{ |
101 |
|
ttydev->inpready++; |
102 |
|
} |