X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;ds=sidebyside;f=unix%2Fuxser.c;h=a12fdec76add7098a3e8b622a3845e1bc9200d9a;hb=46c00b0f381f48a9992e43e014e104015952e9da;hp=db98dd87c64a12c840d849e13b5ba739e7cd8850;hpb=088bc613ed171d70c4829605dc0dbdf8e3ef17cb;p=PuTTY.git diff --git a/unix/uxser.c b/unix/uxser.c index db98dd87..a12fdec7 100644 --- a/unix/uxser.c +++ b/unix/uxser.c @@ -162,9 +162,15 @@ static const char *serial_configure(Serial serial, Config *cfg) logevent(serial->frontend, msg); sfree(msg); - options.c_cflag &= ~(IXON|IXOFF); + options.c_iflag &= ~(IXON|IXOFF); +#ifdef CRTSCTS + options.c_cflag &= ~CRTSCTS; +#endif +#ifdef CNEW_RTSCTS + options.c_cflag &= ~CNEW_RTSCTS; +#endif if (cfg->serflow == SER_FLOW_XONXOFF) { - options.c_cflag |= IXON | IXOFF; + options.c_iflag |= IXON | IXOFF; str = "XON/XOFF"; } else if (cfg->serflow == SER_FLOW_RTSCTS) { #ifdef CRTSCTS @@ -199,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; @@ -242,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; @@ -510,5 +536,7 @@ Backend serial_backend = { serial_provide_logctx, serial_unthrottle, serial_cfg_info, + "serial", + PROT_SERIAL, 1 };