diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-02-17 15:52:02 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-02-17 15:52:02 +0000 |
commit | d01c2739ee04c79a8da5fb68ef889d862e747921 (patch) | |
tree | 3c6f8dd683c840fd4855f86e6956db38ad9320bb /libbb | |
parent | de436fdcedf26d45531d2c147c9b03c778514600 (diff) | |
download | busybox-w32-d01c2739ee04c79a8da5fb68ef889d862e747921.tar.gz busybox-w32-d01c2739ee04c79a8da5fb68ef889d862e747921.tar.bz2 busybox-w32-d01c2739ee04c79a8da5fb68ef889d862e747921.zip |
init: code readability enhancements; very small code changes
git-svn-id: svn://busybox.net/trunk/busybox@17917 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 | ||