Commit | Line | Data |
---|---|---|
97e3edfb 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 | |
8 | static char sccsid[] = "@(#)rawchar.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
10 | ||
2f01710c RC |
11 | /* |
12 | * get a character from the terminal, with no line buffering. | |
13 | */ | |
14 | ||
15 | #include "2648.h" | |
16 | ||
17 | rawchar() | |
18 | { | |
19 | char c; | |
20 | ||
21 | sync(); | |
22 | escseq(NONE); | |
23 | fflush(stdout); | |
24 | if (_pb_front && _on2648) { | |
25 | c = *_pb_front++; | |
26 | #ifdef TRACE | |
27 | if (trace) | |
28 | fprintf(trace, "%s from queue, front=%d, back=%d\n", rdchar(c), _pb_front-_pushback, _pb_back-_pushback); | |
29 | #endif | |
30 | if (_pb_front > _pb_back) { | |
31 | _pb_front = _pb_back = NULL; | |
32 | #ifdef TRACE | |
33 | if (trace) | |
34 | fprintf(trace, "reset pushback to null\n"); | |
35 | #endif | |
36 | } | |
37 | return (c); | |
38 | } | |
39 | _outcount = 0; | |
40 | c = getchar(); | |
41 | #ifdef TRACE | |
42 | if (trace) | |
43 | fprintf(trace, "rawchar '%s'\n", rdchar(c)); | |
44 | #endif | |
45 | return (c); | |
46 | } |