diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-17 15:52:02 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-17 15:52:02 +0000 |
| commit | ec27feb04589d46233802f686559fb5f532fb2df (patch) | |
| tree | 3c6f8dd683c840fd4855f86e6956db38ad9320bb /libbb | |
| parent | c84520d73dbe100449d84241ec0df9d02ee0fc4d (diff) | |
| download | busybox-w32-ec27feb04589d46233802f686559fb5f532fb2df.tar.gz busybox-w32-ec27feb04589d46233802f686559fb5f532fb2df.tar.bz2 busybox-w32-ec27feb04589d46233802f686559fb5f532fb2df.zip | |
init: code readability enhancements; very small code changes
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/get_console.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libbb/get_console.c b/libbb/get_console.c index 62a17399d..42ee137b9 100644 --- a/libbb/get_console.c +++ b/libbb/get_console.c | |||
| @@ -8,15 +8,10 @@ | |||
| 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <stdio.h> | ||
| 12 | #include <errno.h> | ||
| 13 | #include <fcntl.h> | ||
| 14 | #include <unistd.h> | ||
| 15 | #include <sys/ioctl.h> | 11 | #include <sys/ioctl.h> |
| 16 | #include "libbb.h" | 12 | #include "libbb.h" |
| 17 | 13 | ||
| 18 | 14 | ||
| 19 | |||
| 20 | /* From <linux/kd.h> */ | 15 | /* From <linux/kd.h> */ |
| 21 | enum { KDGKBTYPE = 0x4B33 }; /* get keyboard type */ | 16 | enum { KDGKBTYPE = 0x4B33 }; /* get keyboard type */ |
| 22 | 17 | ||
| @@ -47,18 +42,18 @@ static int open_a_console(const char *fnam) | |||
| 47 | 42 | ||
| 48 | int get_console_fd(void) | 43 | int get_console_fd(void) |
| 49 | { | 44 | { |
| 50 | int fd; | 45 | static const char *const console_names[] = { |
| 51 | 46 | DEV_CONSOLE, CURRENT_VC, CURRENT_TTY | |
| 52 | static const char * const choise_console_names[] = { | ||
| 53 | CONSOLE_DEV, CURRENT_VC, CURRENT_TTY | ||
| 54 | }; | 47 | }; |
| 55 | 48 | ||
| 49 | int fd; | ||
| 50 | |||
| 56 | for (fd = 2; fd >= 0; fd--) { | 51 | for (fd = 2; fd >= 0; fd--) { |
| 57 | int fd4name; | 52 | int fd4name; |
| 58 | int choise_fd; | 53 | int choise_fd; |
| 59 | char arg; | 54 | char arg; |
| 60 | 55 | ||
| 61 | fd4name = open_a_console(choise_console_names[fd]); | 56 | fd4name = open_a_console(console_names[fd]); |
| 62 | chk_std: | 57 | chk_std: |
| 63 | choise_fd = (fd4name >= 0 ? fd4name : fd); | 58 | choise_fd = (fd4name >= 0 ? fd4name : fd); |
| 64 | 59 | ||
