dcuddeback / termios-rs

Safe bindings for the termios library.
http://dcuddeback.github.io/termios-rs/termios/
MIT License
75 stars 25 forks source link

Add FreeBSD support #3

Closed valpackett closed 8 years ago

valpackett commented 8 years ago

Should also add OpenBSD and NetBSD, but I don't have them running on anything right now…

dcuddeback commented 8 years ago

Nice! Thanks for doing this.

valpackett commented 8 years ago

Makes sense!

Here's man termios from different operating systems:

FreeBSD:

           OPOST   /* enable following output processing */
           ONLCR   /* map NL to CR-NL (ala CRMOD) */
           OCRNL   /* map CR to NL */
           TABDLY  /* tab delay mask */
           TAB0    /* no tab delay and expansion */
           TAB3    /* expand tabs to spaces */
           ONOEOT  /* discard EOT's ‘^D’ on output) */
           ONOCR   /* do not transmit CRs on column 0 */
           ONLRET  /* on the terminal NL performs the CR function */

OpenBSD:

           OPOST    /* enable following output processing */
           ONLCR    /* map NL to CR-NL (ala CRMOD) */
           OXTABS   /* expand tabs to spaces */
           ONOEOT   /* discard EOT's (^D) on output */
           OCRNL    /* map CR to NL */
           OLCUC    /* translate lower case to upper case */
           ONOCR    /* No CR output at column 0 */
           ONLRET   /* NL performs the CR function */ 

NetBSD:

          OPOST      /* enable following output processing */
          ONLCR      /* map NL to CR-NL (ala CRMOD) */
          OCRNL      /* map CR to NL */
          OXTABS     /* expand tabs to spaces */
          ONOEOT     /* discard EOT's (^D) on output */
          ONOCR      /* do not transmit CRs on column 0 */
          ONLRET     /* on the terminal NL performs the CR function */ 

OS X:

           OPOST     /* enable following output processing */
           ONLCR     /* map NL to CR-NL (ala CRMOD) */
           OXTABS    /* expand tabs to spaces */
           ONOEOT    /* discard EOT's `^D' on output) */
           OCRNL     /* map CR to NL */
           OLCUC     /* translate lower case to upper case */
           ONOCR     /* No CR output at column 0 */
           ONLRET    /* NL performs CR function */

The least common subset seems to be OPOST, ONLCR, OCRNL, ONOEOT, ONOCR, ONLRET.

And OXTABS which is named TAB3 on FreeBSD for some reason :D

dcuddeback commented 8 years ago

Looks great. Thanks!