diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-07-05 18:01:50 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-07-05 18:01:50 +0200 |
commit | 32f3bba54f7a33c4e486495023cc3d6584839dff (patch) | |
tree | a78699e24f33aa0996e3b4e0de676ab11d8918b8 /common/console.c | |
parent | d402b885cee55236019dc17fd533cc5380726abf (diff) | |
download | barebox-32f3bba54f7a33c4e486495023cc3d6584839dff.tar.gz barebox-32f3bba54f7a33c4e486495023cc3d6584839dff.tar.xz |
svn_rev_398
remove disable_ctrlc(), had_ctrlc() and clear_ctrlc()
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/common/console.c b/common/console.c index 3fe737be28..2a22206859 100644 --- a/common/console.c +++ b/common/console.c @@ -54,11 +54,10 @@ int console_register(struct console_device *newcdev) int getc (void) { struct console_device *cdev = NULL; - while (1) { if (!cdev) cdev = first_console; - if (cdev->flags & CONSOLE_STDIN && !cdev->tstc(cdev)) + if (cdev->flags & CONSOLE_STDIN && cdev->tstc(cdev)) return cdev->getc(cdev); cdev = cdev->next; } @@ -73,7 +72,7 @@ int fgetc(int fd) return read(fd, &c, 1); } -int tstc (void) +int tstc(void) { struct console_device *cdev = first_console; @@ -169,42 +168,10 @@ void vprintf (const char *fmt, va_list args) } /* test if ctrl-c was pressed */ -static int ctrlc_disabled = 0; /* see disable_ctrl() */ -static int ctrlc_was_pressed = 0; int ctrlc (void) { - if (!ctrlc_disabled) { - if (tstc ()) { - switch (getc ()) { - case 0x03: /* ^C - Control C */ - ctrlc_was_pressed = 1; - return 1; - default: - break; - } - } - } + if (tstc() && getc() == 3) + return 1; return 0; } -/* pass 1 to disable ctrlc() checking, 0 to enable. - * returns previous state - */ -int disable_ctrlc (int disable) -{ - int prev = ctrlc_disabled; /* save previous state */ - - ctrlc_disabled = disable; - return prev; -} - -int had_ctrlc (void) -{ - return ctrlc_was_pressed; -} - -void clear_ctrlc (void) -{ - ctrlc_was_pressed = 0; -} - |