diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-25 14:40:25 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-25 14:40:25 +0200 |
commit | 918f444f9012ca22d696020dff116844400d37d2 (patch) | |
tree | 5267ba1793eb1f6cd72de4217c614640aee96db8 /miscutils/conspy.c | |
parent | 8d444494ef82809f83f75b142c66e0aff0aa9668 (diff) | |
download | busybox-w32-918f444f9012ca22d696020dff116844400d37d2.tar.gz busybox-w32-918f444f9012ca22d696020dff116844400d37d2.tar.bz2 busybox-w32-918f444f9012ca22d696020dff116844400d37d2.zip |
conspy: make "conspy 0" use vcsa0 but "conspy" (no param) use vcsa
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r-- | miscutils/conspy.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/miscutils/conspy.c b/miscutils/conspy.c index b5adce930..11758c603 100644 --- a/miscutils/conspy.c +++ b/miscutils/conspy.c | |||
@@ -222,7 +222,6 @@ static void cleanup(int code) | |||
222 | fflush_all(); | 222 | fflush_all(); |
223 | tcsetattr(G.kbd_fd, TCSANOW, &G.term_orig); | 223 | tcsetattr(G.kbd_fd, TCSANOW, &G.term_orig); |
224 | if (ENABLE_FEATURE_CLEAN_UP) { | 224 | if (ENABLE_FEATURE_CLEAN_UP) { |
225 | free(ptr_to_globals); | ||
226 | close(G.kbd_fd); | 225 | close(G.kbd_fd); |
227 | } | 226 | } |
228 | // Reset attributes | 227 | // Reset attributes |
@@ -309,6 +308,7 @@ int conspy_main(int argc UNUSED_PARAM, char **argv) | |||
309 | applet_long_options = getopt_longopts; | 308 | applet_long_options = getopt_longopts; |
310 | #endif | 309 | #endif |
311 | INIT_G(); | 310 | INIT_G(); |
311 | strcpy(vcsa_name, "/dev/vcsa"); | ||
312 | 312 | ||
313 | opt_complementary = "x+:y+"; // numeric params | 313 | opt_complementary = "x+:y+"; // numeric params |
314 | opts = getopt32(argv, "vcsndfx:y:", &G.x, &G.y); | 314 | opts = getopt32(argv, "vcsndfx:y:", &G.x, &G.y); |
@@ -316,8 +316,8 @@ int conspy_main(int argc UNUSED_PARAM, char **argv) | |||
316 | ttynum = 0; | 316 | ttynum = 0; |
317 | if (argv[0]) { | 317 | if (argv[0]) { |
318 | ttynum = xatou_range(argv[0], 0, 63); | 318 | ttynum = xatou_range(argv[0], 0, 63); |
319 | sprintf(vcsa_name + sizeof("/dev/vcsa")-1, "%u", ttynum); | ||
319 | } | 320 | } |
320 | sprintf(vcsa_name, "/dev/vcsa%u", ttynum); | ||
321 | sprintf(tty_name, "%s%u", "/dev/tty", ttynum); | 321 | sprintf(tty_name, "%s%u", "/dev/tty", ttynum); |
322 | if (opts & FLAG(c)) { | 322 | if (opts & FLAG(c)) { |
323 | if ((opts & (FLAG(s)|FLAG(v))) != FLAG(v)) | 323 | if ((opts & (FLAG(s)|FLAG(v))) != FLAG(v)) |
@@ -329,19 +329,16 @@ int conspy_main(int argc UNUSED_PARAM, char **argv) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | get_initial_data(vcsa_name); | 331 | get_initial_data(vcsa_name); |
332 | G.kbd_fd = xopen(CURRENT_TTY, O_RDONLY); | ||
333 | if (opts & FLAG(d)) { | 332 | if (opts & FLAG(d)) { |
334 | screen_dump(); | 333 | screen_dump(); |
335 | bb_putchar('\n'); | 334 | bb_putchar('\n'); |
336 | if (ENABLE_FEATURE_CLEAN_UP) { | ||
337 | free(ptr_to_globals); | ||
338 | close(G.kbd_fd); | ||
339 | } | ||
340 | return 0; | 335 | return 0; |
341 | } | 336 | } |
342 | 337 | ||
343 | bb_signals(BB_FATAL_SIGS, cleanup); | 338 | bb_signals(BB_FATAL_SIGS, cleanup); |
339 | |||
344 | // All characters must be passed through to us unaltered | 340 | // All characters must be passed through to us unaltered |
341 | G.kbd_fd = xopen(CURRENT_TTY, O_RDONLY); | ||
345 | tcgetattr(G.kbd_fd, &G.term_orig); | 342 | tcgetattr(G.kbd_fd, &G.term_orig); |
346 | termbuf = G.term_orig; | 343 | termbuf = G.term_orig; |
347 | termbuf.c_iflag &= ~(BRKINT|INLCR|ICRNL|IXON|IXOFF|IUCLC|IXANY|IMAXBEL); | 344 | termbuf.c_iflag &= ~(BRKINT|INLCR|ICRNL|IXON|IXOFF|IUCLC|IXANY|IMAXBEL); |