COHERENT manpages
This page displays the COHERENT manpage for stty() [Set terminal modes].
List of available manpages
Index
stty() -- System Call (libc) Set terminal modes #include <sgtty.h> int stty(fd, sgp) int fd; struct sgttyb *sgp; The COHERENT system call stty() sets a terminal's attributes. See the Lexicon article for stty for information on terminal attributes and their legal values. Example This example demonstrates both stty() and gtty(). It sets terminal input to read one character at a time (that is, it reads the terminal in ``raw'' form). When you type `q', it restores the terminal to its previous settings, and exits. For an additional example, see the pipe Lexicon article. #include <sgtty.h> main() { struct sgttyb os, ns; char buff; printf("Waiting for q\n"); gtty(1, &os); /* save old state */ ns = os; /* get base of new state */ ns.sg_flags |= RAW;/* prevent <ctl-c> from working */ ns.sg_flags &= ~(ECHO|CRMOD);/* no echo for now... */ stty(1, &ns); /* set mode */ do { buff = getchar();/* wait for the keyboard */ } while(buff != 'q'); stty(1, &os); /* reset mode */ } Files <sgtty.h> -- Header file See Also exec, gtty(), ioctl(), libc, open(), read(), sgtty.h, stty, write() Notes Please note that if you use stty() to change the baud rate on a port, you must first invoke sleep(). If you do not, the port reverts back to its default settings.