summaryrefslogtreecommitdiffstats
path: root/main/glib/pollconsole.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/glib/pollconsole.c')
-rw-r--r--main/glib/pollconsole.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/main/glib/pollconsole.c b/main/glib/pollconsole.c
index 62d05b2..927999d 100644
--- a/main/glib/pollconsole.c
+++ b/main/glib/pollconsole.c
@@ -14,31 +14,34 @@
int
pollConsole(char *msg)
{
- char *env;
- int pollval, msec;
- struct elapsed_tmr tmr;
+ char *env;
+ int pollval, msec;
+ struct elapsed_tmr tmr;
- env = getenv("POLLTIMEOUT");
- if (env)
- msec = strtol(env,0,0);
- else
- msec = 2000;
+ env = getenv("POLLTIMEOUT");
+ if(env) {
+ msec = strtol(env,0,0);
+ } else {
+ msec = 2000;
+ }
- pollval = 0;
- printf("%s",msg);
- startElapsedTimer(&tmr,msec);
- while(!msecElapsed(&tmr)) {
- if (gotachar()) {
- while(gotachar())
- pollval = getchar();
- break;
- }
- pollethernet();
- }
- putstr("\r\n");
-
- if (ELAPSED_TIMEOUT(&tmr))
- return(0);
+ pollval = 0;
+ printf("%s",msg);
+ startElapsedTimer(&tmr,msec);
+ while(!msecElapsed(&tmr)) {
+ if(gotachar()) {
+ while(gotachar()) {
+ pollval = getchar();
+ }
+ break;
+ }
+ pollethernet();
+ }
+ putstr("\r\n");
- return(pollval);
+ if(ELAPSED_TIMEOUT(&tmr)) {
+ return(0);
+ }
+
+ return(pollval);
}