config: more tweaking of help texts
[oweals/busybox.git] / miscutils / conspy.c
index f6468c116b7b682fe4cf27c98f8668864e83bacc..47b9e72079554bb38c62ff0a3ccb05b27e502b5c 100644 (file)
@@ -9,20 +9,19 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
-//applet:IF_CONSPY(APPLET(conspy, BB_DIR_BIN, BB_SUID_DROP))
-
-//kbuild:lib-$(CONFIG_CONSPY) += conspy.o
-
 //config:config CONSPY
-//config:      bool "conspy"
+//config:      bool "conspy (10 kb)"
 //config:      default y
 //config:      select PLATFORM_LINUX
 //config:      help
-//config:        A text-mode VNC like program for Linux virtual terminals.
-//config:        example:  conspy NUM      shared access to console num
-//config:        or        conspy -nd NUM  screenshot of console num
-//config:        or        conspy -cs NUM  poor man's GNU screen like
+//config:      A text-mode VNC like program for Linux virtual terminals.
+//config:      example:  conspy NUM      shared access to console num
+//config:      or        conspy -nd NUM  screenshot of console num
+//config:      or        conspy -cs NUM  poor man's GNU screen like
+
+//applet:IF_CONSPY(APPLET(conspy, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_CONSPY) += conspy.o
 
 //usage:#define conspy_trivial_usage
 //usage:       "[-vcsndfFQ] [-x COL] [-y LINE] [CONSOLE_NO]"
@@ -364,7 +363,6 @@ int conspy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int conspy_main(int argc UNUSED_PARAM, char **argv)
 {
        char tty_name[sizeof(DEV_TTY "NN")];
-       struct termios termbuf;
        unsigned opts;
        unsigned ttynum;
        int poll_timeout_ms;
@@ -388,8 +386,8 @@ int conspy_main(int argc UNUSED_PARAM, char **argv)
        INIT_G();
        strcpy(G.vcsa_name, DEV_VCSA);
 
-       opt_complementary = "x+:y+"; // numeric params
-       opts = getopt32(argv, "vcQsndfFx:y:", &G.x, &G.y);
+       // numeric params
+       opts = getopt32(argv, "vcQsndfFx:+y:+", &G.x, &G.y);
        argv += optind;
        ttynum = 0;
        if (argv[0]) {
@@ -415,16 +413,14 @@ int conspy_main(int argc UNUSED_PARAM, char **argv)
 
        bb_signals(BB_FATAL_SIGS, cleanup);
 
-       // All characters must be passed through to us unaltered
        G.kbd_fd = xopen(CURRENT_TTY, O_RDONLY);
-       tcgetattr(G.kbd_fd, &G.term_orig);
-       termbuf = G.term_orig;
-       termbuf.c_iflag &= ~(BRKINT|INLCR|ICRNL|IXON|IXOFF|IUCLC|IXANY|IMAXBEL);
-       //termbuf.c_oflag &= ~(OPOST); - no, we still want \n -> \r\n
-       termbuf.c_lflag &= ~(ISIG|ICANON|ECHO);
-       termbuf.c_cc[VMIN] = 1;
-       termbuf.c_cc[VTIME] = 0;
-       tcsetattr(G.kbd_fd, TCSANOW, &termbuf);
+
+       // All characters must be passed through to us unaltered
+       set_termios_to_raw(G.kbd_fd, &G.term_orig, 0
+               | TERMIOS_CLEAR_ISIG // no signals on ^C ^Z etc
+               | TERMIOS_RAW_INPUT  // turn off all input conversions
+       );
+       //Note: termios.c_oflag &= ~(OPOST); - no, we still want \n -> \r\n
 
        poll_timeout_ms = 250;
        while (1) {