Last change
on this file since b987a75 was
b987a75,
checked in by Jarielle Catbagan <jcatbagan93@…>, on 06/19/15 at 21:32:43
|
Removed execution mode file attribute from all ASCII text files
|
-
Property mode set to
100644
|
File size:
839 bytes
|
Line | |
---|
1 | #include "config.h" |
---|
2 | #include <ctype.h> |
---|
3 | #include "ether.h" |
---|
4 | #include "genlib.h" |
---|
5 | #include "stddefs.h" |
---|
6 | #include "timer.h" |
---|
7 | |
---|
8 | /* pollConsole(): |
---|
9 | * Common function used to query the console port with a message. |
---|
10 | * If after about a 2-second period (or the time specified by POLLTIMEOUT), |
---|
11 | * there is no response from the console, then return 0; else return |
---|
12 | * the character that was received. |
---|
13 | */ |
---|
14 | int |
---|
15 | pollConsole(char *msg) |
---|
16 | { |
---|
17 | char *env; |
---|
18 | int pollval, msec; |
---|
19 | struct elapsed_tmr tmr; |
---|
20 | |
---|
21 | env = getenv("POLLTIMEOUT"); |
---|
22 | if (env) |
---|
23 | msec = strtol(env,0,0); |
---|
24 | else |
---|
25 | msec = 2000; |
---|
26 | |
---|
27 | pollval = 0; |
---|
28 | printf("%s",msg); |
---|
29 | startElapsedTimer(&tmr,msec); |
---|
30 | while(!msecElapsed(&tmr)) { |
---|
31 | if (gotachar()) { |
---|
32 | while(gotachar()) |
---|
33 | pollval = getchar(); |
---|
34 | break; |
---|
35 | } |
---|
36 | pollethernet(); |
---|
37 | } |
---|
38 | putstr("\r\n"); |
---|
39 | |
---|
40 | if (ELAPSED_TIMEOUT(&tmr)) |
---|
41 | return(0); |
---|
42 | |
---|
43 | return(pollval); |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.