]> git.sur5r.net Git - tio/blobdiff - src/tty.c
New upstream version 2.6
[tio] / src / tty.c
index f5ffc355fd330a42b88a06d64da6ce4b05d88aa9..186fa77c9745100a6f0442bd9de5f4b612abcc23 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
 #include "timestamp.h"
 #include "misc.h"
 
-#if defined(__APPLE__)
+/* tty device listing configuration */
+
+#if defined(__linux__)
+#define PATH_SERIAL_DEVICES "/dev/serial/by-id/"
+#define PREFIX_TTY_DEVICES ""
+#elif defined(__FreeBSD__)
+#define PATH_SERIAL_DEVICES "/dev/"
+#define PREFIX_TTY_DEVICES "cua"
+#elif defined(__APPLE__)
 #define PATH_SERIAL_DEVICES "/dev/"
 #define PREFIX_TTY_DEVICES "tty."
 #elif defined(__CYGWIN__)
 #define PATH_SERIAL_DEVICES "/dev/"
 #define PREFIX_TTY_DEVICES "ttyS"
-#else
-#define PATH_SERIAL_DEVICES "/dev/serial/by-id/"
+#elif defined(__HAIKU__)
+#define PATH_SERIAL_DEVICES "/dev/ports/"
 #define PREFIX_TTY_DEVICES ""
+#else
+#define PATH_SERIAL_DEVICES "/dev/"
+#define PREFIX_TTY_DEVICES "tty"
 #endif
 
 #ifndef CMSPAR
@@ -118,6 +129,9 @@ const char random_array[] =
 };
 
 bool interactive_mode = true;
+bool map_i_nl_cr = false;
+bool map_i_cr_nl = false;
+bool map_ign_cr = false;
 
 static struct termios tio, tio_old, stdout_new, stdout_old, stdin_new, stdin_old;
 static unsigned long rx_total = 0, tx_total = 0;
@@ -976,14 +990,17 @@ void tty_configure(void)
             if (strcmp(token,"INLCR") == 0)
             {
                 tio.c_iflag |= INLCR;
+                map_i_nl_cr = true;
             }
             else if (strcmp(token,"IGNCR") == 0)
             {
                 tio.c_iflag |= IGNCR;
+                map_ign_cr = true;
             }
             else if (strcmp(token,"ICRNL") == 0)
             {
                 tio.c_iflag |= ICRNL;
+                map_i_cr_nl = true;
             }
             else if (strcmp(token,"OCRNL") == 0)
             {
@@ -1409,7 +1426,7 @@ int tty_connect(void)
 
                     if (option.response_wait)
                     {
-                        if ((input_char == '\r') || (input_char == '\n'))
+                        if (input_char == '\n')
                         {
                              tty_sync(fd);
                              exit(EXIT_SUCCESS);