- if (tcgetattr(devfd,&restios))
- error(_("^Unable to get termios settings"));
- else {
- restios.c_cflag=(restios.c_cflag&~(CBAUD|CBAUDEX))|B0|HUPCL;
- restios_yes=1;
- }
- tios.c_iflag=IGNBRK|IGNPAR|(handshake_rtscts ? 0 : IXON|IXOFF);
- tios.c_oflag=0;
- tios.c_cflag=CS8|CREAD|CLOCAL|HUPCL|portbaud|(handshake_rtscts ? CRTSCTS : 0);
- tios.c_lflag=IEXTEN|NOFLSH;
- memset(tios.c_cc,_POSIX_VDISABLE,sizeof(tios.c_cc));
- tios.c_cc[VTIME]=0;
- tios.c_cc[VMIN ]=1;
- cfsetispeed(&tios,portbaud);
- if (cfsetospeed(&tios,portbaud)|cfsetispeed(&tios,portbaud))
- error(_("^Error setting termios baudrate on device"));
- if (tcflush(devfd,TCIOFLUSH))
- error(_("^Error flushing termios (TCIOFLUSH) on device"));
- if (tcsetattr(devfd,TCSANOW,&tios))
- error(_("^!Unable to set initial termios device settings"));