diff options
author | Matt Kraai <kraai@debian.org> | 2001-07-23 14:52:08 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-07-23 14:52:08 +0000 |
commit | 439e3df65300100e4b63580141eaa238c30431d5 (patch) | |
tree | f74320f9994faf4d68826c95cb8d043e35d3a685 | |
parent | 0139ca92ff4b960e904d18bc0254499e163e2545 (diff) | |
download | busybox-w32-439e3df65300100e4b63580141eaa238c30431d5.tar.gz busybox-w32-439e3df65300100e4b63580141eaa238c30431d5.tar.bz2 busybox-w32-439e3df65300100e4b63580141eaa238c30431d5.zip |
Add support for devfs device names.
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | Config.h | 3 | ||||
-rw-r--r-- | console-tools/dumpkmap.c | 4 | ||||
-rw-r--r-- | console-tools/loadacm.c | 4 | ||||
-rw-r--r-- | console-tools/loadfont.c | 4 | ||||
-rw-r--r-- | console-tools/loadkmap.c | 4 | ||||
-rw-r--r-- | dumpkmap.c | 4 | ||||
-rw-r--r-- | include/libbb.h | 28 | ||||
-rw-r--r-- | init.c | 26 | ||||
-rw-r--r-- | init/init.c | 26 | ||||
-rw-r--r-- | libbb/get_console.c | 8 | ||||
-rw-r--r-- | libbb/libbb.h | 28 | ||||
-rw-r--r-- | loadacm.c | 4 | ||||
-rw-r--r-- | loadfont.c | 4 | ||||
-rw-r--r-- | loadkmap.c | 4 | ||||
-rw-r--r-- | more.c | 4 | ||||
-rw-r--r-- | util-linux/more.c | 4 |
17 files changed, 102 insertions, 58 deletions
@@ -9,6 +9,7 @@ | |||
9 | Other Changes: | 9 | Other Changes: |
10 | * Vladimir Oleynik -- Fixed tr to support 'tr a-z A-Z' syntax, | 10 | * Vladimir Oleynik -- Fixed tr to support 'tr a-z A-Z' syntax, |
11 | many ash corrections, and others optimizations, and cleanups. | 11 | many ash corrections, and others optimizations, and cleanups. |
12 | * Matt Kraai -- Added BB_FEATURE_DEVFS to enable devfs device names. | ||
12 | 13 | ||
13 | 14 | ||
14 | -Not Yet Released | 15 | -Not Yet Released |
@@ -407,6 +407,9 @@ | |||
407 | // Support for TELNET to pass TERM type to remote host. Adds 384 bytes. | 407 | // Support for TELNET to pass TERM type to remote host. Adds 384 bytes. |
408 | #define BB_FEATURE_TELNET_TTYPE | 408 | #define BB_FEATURE_TELNET_TTYPE |
409 | // | 409 | // |
410 | // Support for devfs. | ||
411 | //#define BB_FEATURE_DEVFS | ||
412 | // | ||
410 | // End of Features List | 413 | // End of Features List |
411 | // | 414 | // |
412 | // | 415 | // |
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index 0da01868b..22652a5e2 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c | |||
@@ -51,9 +51,9 @@ int dumpkmap_main(int argc, char **argv) | |||
51 | show_usage(); | 51 | show_usage(); |
52 | } | 52 | } |
53 | 53 | ||
54 | fd = open("/dev/tty0", O_RDWR); | 54 | fd = open(CURRENT_VC, O_RDWR); |
55 | if (fd < 0) { | 55 | if (fd < 0) { |
56 | perror_msg("Error opening /dev/tty0"); | 56 | perror_msg("Error opening " CURRENT_VC); |
57 | return EXIT_FAILURE; | 57 | return EXIT_FAILURE; |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index 5dbf03e36..3fb4e7665 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c | |||
@@ -37,9 +37,9 @@ int loadacm_main(int argc, char **argv) | |||
37 | show_usage(); | 37 | show_usage(); |
38 | } | 38 | } |
39 | 39 | ||
40 | fd = open("/dev/tty", O_RDWR); | 40 | fd = open(CURRENT_VC, O_RDWR); |
41 | if (fd < 0) { | 41 | if (fd < 0) { |
42 | perror_msg_and_die("Error opening /dev/tty1"); | 42 | perror_msg_and_die("Error opening " CURRENT_VC); |
43 | } | 43 | } |
44 | 44 | ||
45 | if (screen_map_load(fd, stdin)) { | 45 | if (screen_map_load(fd, stdin)) { |
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 1a724ca85..d66500195 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c | |||
@@ -46,9 +46,9 @@ extern int loadfont_main(int argc, char **argv) | |||
46 | if (argc != 1) | 46 | if (argc != 1) |
47 | show_usage(); | 47 | show_usage(); |
48 | 48 | ||
49 | fd = open("/dev/tty0", O_RDWR); | 49 | fd = open(CURRENT_VC, O_RDWR); |
50 | if (fd < 0) | 50 | if (fd < 0) |
51 | perror_msg_and_die("Error opening /dev/tty0"); | 51 | perror_msg_and_die("Error opening " CURRENT_VC); |
52 | loadnewfont(fd); | 52 | loadnewfont(fd); |
53 | 53 | ||
54 | return EXIT_SUCCESS; | 54 | return EXIT_SUCCESS; |
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index dcb5c1caa..4f217d630 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c | |||
@@ -53,9 +53,9 @@ int loadkmap_main(int argc, char **argv) | |||
53 | if (argc != 1) | 53 | if (argc != 1) |
54 | show_usage(); | 54 | show_usage(); |
55 | 55 | ||
56 | fd = open("/dev/tty0", O_RDWR); | 56 | fd = open(CURRENT_VC, O_RDWR); |
57 | if (fd < 0) | 57 | if (fd < 0) |
58 | perror_msg_and_die("Error opening /dev/tty0"); | 58 | perror_msg_and_die("Error opening " CURRENT_VC); |
59 | 59 | ||
60 | read(0, buff, 7); | 60 | read(0, buff, 7); |
61 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) | 61 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) |
diff --git a/dumpkmap.c b/dumpkmap.c index 0da01868b..22652a5e2 100644 --- a/dumpkmap.c +++ b/dumpkmap.c | |||
@@ -51,9 +51,9 @@ int dumpkmap_main(int argc, char **argv) | |||
51 | show_usage(); | 51 | show_usage(); |
52 | } | 52 | } |
53 | 53 | ||
54 | fd = open("/dev/tty0", O_RDWR); | 54 | fd = open(CURRENT_VC, O_RDWR); |
55 | if (fd < 0) { | 55 | if (fd < 0) { |
56 | perror_msg("Error opening /dev/tty0"); | 56 | perror_msg("Error opening " CURRENT_VC); |
57 | return EXIT_FAILURE; | 57 | return EXIT_FAILURE; |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/include/libbb.h b/include/libbb.h index c167e10bc..3cf932dc4 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -288,4 +288,32 @@ extern const char * const name_longer_than_foo; | |||
288 | extern const char * const unknown; | 288 | extern const char * const unknown; |
289 | extern const char * const can_not_create_raw_socket; | 289 | extern const char * const can_not_create_raw_socket; |
290 | 290 | ||
291 | #ifdef BB_FEATURE_DEVFS | ||
292 | # define CURRENT_VC "/dev/vc/0" | ||
293 | # define VC_1 "/dev/vc/1" | ||
294 | # define VC_2 "/dev/vc/2" | ||
295 | # define VC_3 "/dev/vc/3" | ||
296 | # define VC_4 "/dev/vc/4" | ||
297 | # define VC_5 "/dev/vc/5" | ||
298 | # define SC_0 "/dev/tts/0" | ||
299 | # define SC_1 "/dev/tts/1" | ||
300 | # define VC_FORMAT "/dev/vc/%d" | ||
301 | # define SC_FORMAT "/dev/tts/%d" | ||
302 | #else | ||
303 | # define CURRENT_VC "/dev/tty0" | ||
304 | # define VC_1 "/dev/tty1" | ||
305 | # define VC_2 "/dev/tty2" | ||
306 | # define VC_3 "/dev/tty3" | ||
307 | # define VC_4 "/dev/tty4" | ||
308 | # define VC_5 "/dev/tty5" | ||
309 | # define SC_0 "/dev/ttyS0" | ||
310 | # define SC_1 "/dev/ttyS1" | ||
311 | # define VC_FORMAT "/dev/tty%d" | ||
312 | # define SC_FORMAT "/dev/ttyS%d" | ||
313 | #endif | ||
314 | |||
315 | /* The following devices are the same on devfs and non-devfs systems. */ | ||
316 | #define CURRENT_TTY "/dev/tty" | ||
317 | #define CONSOLE_DEV "/dev/console" | ||
318 | |||
291 | #endif /* __LIBBB_H__ */ | 319 | #endif /* __LIBBB_H__ */ |
@@ -117,13 +117,6 @@ static const int RB_AUTOBOOT = 0x01234567; | |||
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | 119 | ||
120 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ | ||
121 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ | ||
122 | #define VT_THIRD "/dev/tty3" /* Virtual console */ | ||
123 | #define VT_FOURTH "/dev/tty4" /* Virtual console */ | ||
124 | #define VT_LOG "/dev/tty5" /* Virtual console */ | ||
125 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ | ||
126 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ | ||
127 | #define SHELL "/bin/sh" /* Default shell */ | 120 | #define SHELL "/bin/sh" /* Default shell */ |
128 | #define LOGIN_SHELL "-" SHELL /* Default login shell */ | 121 | #define LOGIN_SHELL "-" SHELL /* Default login shell */ |
129 | #define INITTAB "/etc/inittab" /* inittab file location */ | 122 | #define INITTAB "/etc/inittab" /* inittab file location */ |
@@ -176,10 +169,10 @@ struct initActionTag { | |||
176 | static initAction *initActionList = NULL; | 169 | static initAction *initActionList = NULL; |
177 | 170 | ||
178 | 171 | ||
179 | static char *secondConsole = VT_SECONDARY; | 172 | static char *secondConsole = VC_2; |
180 | static char *thirdConsole = VT_THIRD; | 173 | static char *thirdConsole = VC_3; |
181 | static char *fourthConsole = VT_FOURTH; | 174 | static char *fourthConsole = VC_4; |
182 | static char *log = VT_LOG; | 175 | static char *log = VC_5; |
183 | static int kernelVersion = 0; | 176 | static int kernelVersion = 0; |
184 | static char termType[32] = "TERM=linux"; | 177 | static char termType[32] = "TERM=linux"; |
185 | static char console[32] = _PATH_CONSOLE; | 178 | static char console[32] = _PATH_CONSOLE; |
@@ -341,20 +334,19 @@ static void console_init() | |||
341 | else if ((s = getenv("console")) != NULL) { | 334 | else if ((s = getenv("console")) != NULL) { |
342 | /* remap tty[ab] to /dev/ttyS[01] */ | 335 | /* remap tty[ab] to /dev/ttyS[01] */ |
343 | if (strcmp(s, "ttya") == 0) | 336 | if (strcmp(s, "ttya") == 0) |
344 | safe_strncpy(console, SERIAL_CON0, sizeof(console)); | 337 | safe_strncpy(console, SC_0, sizeof(console)); |
345 | else if (strcmp(s, "ttyb") == 0) | 338 | else if (strcmp(s, "ttyb") == 0) |
346 | safe_strncpy(console, SERIAL_CON1, sizeof(console)); | 339 | safe_strncpy(console, SC_1, sizeof(console)); |
347 | } | 340 | } |
348 | #endif | 341 | #endif |
349 | else { | 342 | else { |
350 | /* 2.2 kernels: identify the real console backend and try to use it */ | 343 | /* 2.2 kernels: identify the real console backend and try to use it */ |
351 | if (ioctl(0, TIOCGSERIAL, &sr) == 0) { | 344 | if (ioctl(0, TIOCGSERIAL, &sr) == 0) { |
352 | /* this is a serial console */ | 345 | /* this is a serial console */ |
353 | snprintf(console, sizeof(console) - 1, "/dev/ttyS%d", sr.line); | 346 | snprintf(console, sizeof(console) - 1, SC_FORMAT, sr.line); |
354 | } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { | 347 | } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { |
355 | /* this is linux virtual tty */ | 348 | /* this is linux virtual tty */ |
356 | snprintf(console, sizeof(console) - 1, "/dev/tty%d", | 349 | snprintf(console, sizeof(console) - 1, VC_FORMAT, vt.v_active); |
357 | vt.v_active); | ||
358 | } else { | 350 | } else { |
359 | safe_strncpy(console, _PATH_CONSOLE, sizeof(console)); | 351 | safe_strncpy(console, _PATH_CONSOLE, sizeof(console)); |
360 | tried_devcons++; | 352 | tried_devcons++; |
@@ -371,7 +363,7 @@ static void console_init() | |||
371 | /* Can't open selected console -- try vt1 */ | 363 | /* Can't open selected console -- try vt1 */ |
372 | if (!tried_vtprimary) { | 364 | if (!tried_vtprimary) { |
373 | tried_vtprimary++; | 365 | tried_vtprimary++; |
374 | safe_strncpy(console, VT_PRIMARY, sizeof(console)); | 366 | safe_strncpy(console, VC_1, sizeof(console)); |
375 | continue; | 367 | continue; |
376 | } | 368 | } |
377 | break; | 369 | break; |
diff --git a/init/init.c b/init/init.c index ec144ea85..f397b7e0a 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -117,13 +117,6 @@ static const int RB_AUTOBOOT = 0x01234567; | |||
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | 119 | ||
120 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ | ||
121 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ | ||
122 | #define VT_THIRD "/dev/tty3" /* Virtual console */ | ||
123 | #define VT_FOURTH "/dev/tty4" /* Virtual console */ | ||
124 | #define VT_LOG "/dev/tty5" /* Virtual console */ | ||
125 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ | ||
126 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ | ||
127 | #define SHELL "/bin/sh" /* Default shell */ | 120 | #define SHELL "/bin/sh" /* Default shell */ |
128 | #define LOGIN_SHELL "-" SHELL /* Default login shell */ | 121 | #define LOGIN_SHELL "-" SHELL /* Default login shell */ |
129 | #define INITTAB "/etc/inittab" /* inittab file location */ | 122 | #define INITTAB "/etc/inittab" /* inittab file location */ |
@@ -176,10 +169,10 @@ struct initActionTag { | |||
176 | static initAction *initActionList = NULL; | 169 | static initAction *initActionList = NULL; |
177 | 170 | ||
178 | 171 | ||
179 | static char *secondConsole = VT_SECONDARY; | 172 | static char *secondConsole = VC_2; |
180 | static char *thirdConsole = VT_THIRD; | 173 | static char *thirdConsole = VC_3; |
181 | static char *fourthConsole = VT_FOURTH; | 174 | static char *fourthConsole = VC_4; |
182 | static char *log = VT_LOG; | 175 | static char *log = VC_5; |
183 | static int kernelVersion = 0; | 176 | static int kernelVersion = 0; |
184 | static char termType[32] = "TERM=linux"; | 177 | static char termType[32] = "TERM=linux"; |
185 | static char console[32] = _PATH_CONSOLE; | 178 | static char console[32] = _PATH_CONSOLE; |
@@ -341,20 +334,19 @@ static void console_init() | |||
341 | else if ((s = getenv("console")) != NULL) { | 334 | else if ((s = getenv("console")) != NULL) { |
342 | /* remap tty[ab] to /dev/ttyS[01] */ | 335 | /* remap tty[ab] to /dev/ttyS[01] */ |
343 | if (strcmp(s, "ttya") == 0) | 336 | if (strcmp(s, "ttya") == 0) |
344 | safe_strncpy(console, SERIAL_CON0, sizeof(console)); | 337 | safe_strncpy(console, SC_0, sizeof(console)); |
345 | else if (strcmp(s, "ttyb") == 0) | 338 | else if (strcmp(s, "ttyb") == 0) |
346 | safe_strncpy(console, SERIAL_CON1, sizeof(console)); | 339 | safe_strncpy(console, SC_1, sizeof(console)); |
347 | } | 340 | } |
348 | #endif | 341 | #endif |
349 | else { | 342 | else { |
350 | /* 2.2 kernels: identify the real console backend and try to use it */ | 343 | /* 2.2 kernels: identify the real console backend and try to use it */ |
351 | if (ioctl(0, TIOCGSERIAL, &sr) == 0) { | 344 | if (ioctl(0, TIOCGSERIAL, &sr) == 0) { |
352 | /* this is a serial console */ | 345 | /* this is a serial console */ |
353 | snprintf(console, sizeof(console) - 1, "/dev/ttyS%d", sr.line); | 346 | snprintf(console, sizeof(console) - 1, SC_FORMAT, sr.line); |
354 | } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { | 347 | } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { |
355 | /* this is linux virtual tty */ | 348 | /* this is linux virtual tty */ |
356 | snprintf(console, sizeof(console) - 1, "/dev/tty%d", | 349 | snprintf(console, sizeof(console) - 1, VC_FORMAT, vt.v_active); |
357 | vt.v_active); | ||
358 | } else { | 350 | } else { |
359 | safe_strncpy(console, _PATH_CONSOLE, sizeof(console)); | 351 | safe_strncpy(console, _PATH_CONSOLE, sizeof(console)); |
360 | tried_devcons++; | 352 | tried_devcons++; |
@@ -371,7 +363,7 @@ static void console_init() | |||
371 | /* Can't open selected console -- try vt1 */ | 363 | /* Can't open selected console -- try vt1 */ |
372 | if (!tried_vtprimary) { | 364 | if (!tried_vtprimary) { |
373 | tried_vtprimary++; | 365 | tried_vtprimary++; |
374 | safe_strncpy(console, VT_PRIMARY, sizeof(console)); | 366 | safe_strncpy(console, VC_1, sizeof(console)); |
375 | continue; | 367 | continue; |
376 | } | 368 | } |
377 | break; | 369 | break; |
diff --git a/libbb/get_console.c b/libbb/get_console.c index 4be9adc84..3b36a59e7 100644 --- a/libbb/get_console.c +++ b/libbb/get_console.c | |||
@@ -98,15 +98,15 @@ int get_console_fd(char *tty_name) | |||
98 | return fd; | 98 | return fd; |
99 | } | 99 | } |
100 | 100 | ||
101 | fd = open_a_console("/dev/tty"); | 101 | fd = open_a_console(CURRENT_TTY); |
102 | if (fd >= 0) | 102 | if (fd >= 0) |
103 | return fd; | 103 | return fd; |
104 | 104 | ||
105 | fd = open_a_console("/dev/tty0"); | 105 | fd = open_a_console(CURRENT_VC); |
106 | if (fd >= 0) | 106 | if (fd >= 0) |
107 | return fd; | 107 | return fd; |
108 | 108 | ||
109 | fd = open_a_console("/dev/console"); | 109 | fd = open_a_console(CONSOLE_DEV); |
110 | if (fd >= 0) | 110 | if (fd >= 0) |
111 | return fd; | 111 | return fd; |
112 | 112 | ||
@@ -114,7 +114,7 @@ int get_console_fd(char *tty_name) | |||
114 | if (is_a_console(fd)) | 114 | if (is_a_console(fd)) |
115 | return fd; | 115 | return fd; |
116 | 116 | ||
117 | error_msg("Couldnt get a file descriptor referring to the console"); | 117 | error_msg("Couldn't get a file descriptor referring to the console"); |
118 | return -1; /* total failure */ | 118 | return -1; /* total failure */ |
119 | } | 119 | } |
120 | 120 | ||
diff --git a/libbb/libbb.h b/libbb/libbb.h index c167e10bc..3cf932dc4 100644 --- a/libbb/libbb.h +++ b/libbb/libbb.h | |||
@@ -288,4 +288,32 @@ extern const char * const name_longer_than_foo; | |||
288 | extern const char * const unknown; | 288 | extern const char * const unknown; |
289 | extern const char * const can_not_create_raw_socket; | 289 | extern const char * const can_not_create_raw_socket; |
290 | 290 | ||
291 | #ifdef BB_FEATURE_DEVFS | ||
292 | # define CURRENT_VC "/dev/vc/0" | ||
293 | # define VC_1 "/dev/vc/1" | ||
294 | # define VC_2 "/dev/vc/2" | ||
295 | # define VC_3 "/dev/vc/3" | ||
296 | # define VC_4 "/dev/vc/4" | ||
297 | # define VC_5 "/dev/vc/5" | ||
298 | # define SC_0 "/dev/tts/0" | ||
299 | # define SC_1 "/dev/tts/1" | ||
300 | # define VC_FORMAT "/dev/vc/%d" | ||
301 | # define SC_FORMAT "/dev/tts/%d" | ||
302 | #else | ||
303 | # define CURRENT_VC "/dev/tty0" | ||
304 | # define VC_1 "/dev/tty1" | ||
305 | # define VC_2 "/dev/tty2" | ||
306 | # define VC_3 "/dev/tty3" | ||
307 | # define VC_4 "/dev/tty4" | ||
308 | # define VC_5 "/dev/tty5" | ||
309 | # define SC_0 "/dev/ttyS0" | ||
310 | # define SC_1 "/dev/ttyS1" | ||
311 | # define VC_FORMAT "/dev/tty%d" | ||
312 | # define SC_FORMAT "/dev/ttyS%d" | ||
313 | #endif | ||
314 | |||
315 | /* The following devices are the same on devfs and non-devfs systems. */ | ||
316 | #define CURRENT_TTY "/dev/tty" | ||
317 | #define CONSOLE_DEV "/dev/console" | ||
318 | |||
291 | #endif /* __LIBBB_H__ */ | 319 | #endif /* __LIBBB_H__ */ |
@@ -37,9 +37,9 @@ int loadacm_main(int argc, char **argv) | |||
37 | show_usage(); | 37 | show_usage(); |
38 | } | 38 | } |
39 | 39 | ||
40 | fd = open("/dev/tty", O_RDWR); | 40 | fd = open(CURRENT_VC, O_RDWR); |
41 | if (fd < 0) { | 41 | if (fd < 0) { |
42 | perror_msg_and_die("Error opening /dev/tty1"); | 42 | perror_msg_and_die("Error opening " CURRENT_VC); |
43 | } | 43 | } |
44 | 44 | ||
45 | if (screen_map_load(fd, stdin)) { | 45 | if (screen_map_load(fd, stdin)) { |
diff --git a/loadfont.c b/loadfont.c index 1a724ca85..d66500195 100644 --- a/loadfont.c +++ b/loadfont.c | |||
@@ -46,9 +46,9 @@ extern int loadfont_main(int argc, char **argv) | |||
46 | if (argc != 1) | 46 | if (argc != 1) |
47 | show_usage(); | 47 | show_usage(); |
48 | 48 | ||
49 | fd = open("/dev/tty0", O_RDWR); | 49 | fd = open(CURRENT_VC, O_RDWR); |
50 | if (fd < 0) | 50 | if (fd < 0) |
51 | perror_msg_and_die("Error opening /dev/tty0"); | 51 | perror_msg_and_die("Error opening " CURRENT_VC); |
52 | loadnewfont(fd); | 52 | loadnewfont(fd); |
53 | 53 | ||
54 | return EXIT_SUCCESS; | 54 | return EXIT_SUCCESS; |
diff --git a/loadkmap.c b/loadkmap.c index dcb5c1caa..4f217d630 100644 --- a/loadkmap.c +++ b/loadkmap.c | |||
@@ -53,9 +53,9 @@ int loadkmap_main(int argc, char **argv) | |||
53 | if (argc != 1) | 53 | if (argc != 1) |
54 | show_usage(); | 54 | show_usage(); |
55 | 55 | ||
56 | fd = open("/dev/tty0", O_RDWR); | 56 | fd = open(CURRENT_VC, O_RDWR); |
57 | if (fd < 0) | 57 | if (fd < 0) |
58 | perror_msg_and_die("Error opening /dev/tty0"); | 58 | perror_msg_and_die("Error opening " CURRENT_VC); |
59 | 59 | ||
60 | read(0, buff, 7); | 60 | read(0, buff, 7); |
61 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) | 61 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) |
@@ -79,9 +79,9 @@ extern int more_main(int argc, char **argv) | |||
79 | 79 | ||
80 | /* not use inputing from terminal if usage: more > outfile */ | 80 | /* not use inputing from terminal if usage: more > outfile */ |
81 | if(isatty(fileno(stdout))) { | 81 | if(isatty(fileno(stdout))) { |
82 | cin = fopen("/dev/tty", "r"); | 82 | cin = fopen(CURRENT_TTY, "r"); |
83 | if (!cin) | 83 | if (!cin) |
84 | cin = xfopen("/dev/console", "r"); | 84 | cin = xfopen(CONSOLE_DEV, "r"); |
85 | please_display_more_prompt = 0; | 85 | please_display_more_prompt = 0; |
86 | #ifdef BB_FEATURE_USE_TERMIOS | 86 | #ifdef BB_FEATURE_USE_TERMIOS |
87 | getTermSettings(fileno(cin), &initial_settings); | 87 | getTermSettings(fileno(cin), &initial_settings); |
diff --git a/util-linux/more.c b/util-linux/more.c index 6cdec729b..780cddf66 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
@@ -79,9 +79,9 @@ extern int more_main(int argc, char **argv) | |||
79 | 79 | ||
80 | /* not use inputing from terminal if usage: more > outfile */ | 80 | /* not use inputing from terminal if usage: more > outfile */ |
81 | if(isatty(fileno(stdout))) { | 81 | if(isatty(fileno(stdout))) { |
82 | cin = fopen("/dev/tty", "r"); | 82 | cin = fopen(CURRENT_TTY, "r"); |
83 | if (!cin) | 83 | if (!cin) |
84 | cin = xfopen("/dev/console", "r"); | 84 | cin = xfopen(CONSOLE_DEV, "r"); |
85 | please_display_more_prompt = 0; | 85 | please_display_more_prompt = 0; |
86 | #ifdef BB_FEATURE_USE_TERMIOS | 86 | #ifdef BB_FEATURE_USE_TERMIOS |
87 | getTermSettings(fileno(cin), &initial_settings); | 87 | getTermSettings(fileno(cin), &initial_settings); |