]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - unix/uxser.c
Rationalise access to, and content of, backends[] array.
[PuTTY.git] / unix / uxser.c
index 463f4c43f7952d25a1bf29da5d7ab5f09fa1fc6a..a12fdec76add7098a3e8b622a3845e1bc9200d9a 100644 (file)
@@ -205,7 +205,25 @@ static const char *serial_configure(Serial serial, Config *cfg)
 
     options.c_cflag |= CLOCAL | CREAD;
     options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
-    options.c_oflag &= ~OPOST;
+    options.c_iflag &= ~(ISTRIP | IGNCR | INLCR | ICRNL
+#ifdef IUCLC
+                        | IUCLC
+#endif
+                        );
+    options.c_oflag &= ~(OPOST
+#ifdef ONLCR
+                        | ONLCR
+#endif
+#ifdef OCRNL
+                        | OCRNL
+#endif
+#ifdef ONOCR
+                        | ONOCR
+#endif
+#ifdef ONLRET
+                        | ONLRET
+#endif
+                        );
     options.c_cc[VMIN] = 1;
     options.c_cc[VTIME] = 0;
 
@@ -248,6 +266,8 @@ static const char *serial_init(void *frontend_handle, void **backend_handle,
     if (serial->fd < 0)
        return "Unable to open serial port";
 
+    cloexec(serial->fd);
+
     err = serial_configure(serial, cfg);
     if (err)
        return err;
@@ -516,5 +536,7 @@ Backend serial_backend = {
     serial_provide_logctx,
     serial_unthrottle,
     serial_cfg_info,
+    "serial",
+    PROT_SERIAL,
     1
 };