diff options
author | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-23 14:52:08 +0000 |
---|---|---|
committer | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-23 14:52:08 +0000 |
commit | b340b7d47d2c9904efd7eb47df3c79bc7a4a3650 (patch) | |
tree | f74320f9994faf4d68826c95cb8d043e35d3a685 /libbb | |
parent | 7ccc7ee19df28a1c3b48f1163ff80737cdab7474 (diff) | |
download | busybox-w32-b340b7d47d2c9904efd7eb47df3c79bc7a4a3650.tar.gz busybox-w32-b340b7d47d2c9904efd7eb47df3c79bc7a4a3650.tar.bz2 busybox-w32-b340b7d47d2c9904efd7eb47df3c79bc7a4a3650.zip |
Add support for devfs device names.
git-svn-id: svn://busybox.net/trunk/busybox@3136 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/get_console.c | 8 | ||||
-rw-r--r-- | libbb/libbb.h | 28 |
2 files changed, 32 insertions, 4 deletions
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__ */ |