hexedit: restore screen on exit
[oweals/busybox.git] / miscutils / rx.c
index 1dffb593afc70dfe771b9717c822d659f9a172e2..874a3f0a33a5667abbaef568212bd1161bb68d02 100644 (file)
  *
  * This was originally written for blob and then adapted for busybox.
  */
+//config:config RX
+//config:      bool "rx (2.9 kb)"
+//config:      default y
+//config:      select PLATFORM_LINUX
+//config:      help
+//config:      Receive files using the Xmodem protocol.
+
+//applet:IF_RX(APPLET(rx, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_RX) += rx.o
 
 //usage:#define rx_trivial_usage
 //usage:       "FILE"
@@ -84,7 +94,7 @@ static int receive(/*int read_fd, */int file_fd)
                int blockBegin;
                int blockNo, blockNoOnesCompl;
                int cksum_or_crc;
-               int expected;
+               unsigned expected;
                int i, j;
 
                blockBegin = read_byte(timeout);
@@ -101,7 +111,7 @@ static int receive(/*int read_fd, */int file_fd)
                         && blockBuf[blockLength - 3] == PAD
                        ) {
                                while (blockLength
-                                  && blockBuf[blockLength - 1] == PAD
+                                   && blockBuf[blockLength - 1] == PAD
                                ) {
                                        blockLength--;
                                }
@@ -253,6 +263,7 @@ int rx_main(int argc UNUSED_PARAM, char **argv)
 
        termios_err = tcgetattr(read_fd, &tty);
        if (termios_err == 0) {
+//TODO: use set_termios_to_raw()
                orig_tty = tty;
                cfmakeraw(&tty);
                tcsetattr(read_fd, TCSAFLUSH, &tty);