home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / programm / 5789 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  1.1 KB

  1. Path: sparky!uunet!opl.com!hri.com!noc.near.net!meiko.com!mike
  2. From: mike@meiko.com (Mike Stok)
  3. Newsgroups: comp.unix.programmer
  4. Subject: termios vs. ioctl (SunOS 4.1.1)
  5. Message-ID: <1992Dec29.151426.26933@meiko.com>
  6. Date: 29 Dec 92 15:14:26 GMT
  7. Sender: news@meiko.com
  8. Organization: Meiko Scientific Corp.
  9. Lines: 27
  10.  
  11. I would like to know what the equivalent code using struct termios
  12. would be for:
  13.  
  14.   struct sgttyb sg;
  15.   ioctl(fd, TIOCGETP, &sg);
  16.   sg.sg_flags = O_RAW;
  17.   ioctl(fd, TIOCSETP, &sg);
  18.  
  19. The following fragment comes pretty close, but isn't exactly the same
  20.  
  21.   tcgetattr (fd, &termios);
  22.   termios.c_iflag &= ~(BRKINT | ISTRIP | IMAXBEL);
  23.   termios.c_oflag &= ~(PARENB | CSIZE);
  24.   termios.c_oflag |= CS8;
  25.   termios.c_iflag &= ~(ICRNL | IXON);
  26.   termios.c_lflag &= ~(ISIG | ICANON | ECHO);
  27.   tcsetattr (fd, TCSANOW, &termios);
  28.  
  29. Any suggestions would be most welcome (having zipped through various
  30. bits of TFM several times...)
  31.  
  32. Mike
  33. --
  34. The "usual disclaimers" apply.    |
  35. Mike Stok                         |
  36. mike@meiko.com                    |
  37. Meiko tel: (617) 890 7676         |
  38.