/************************************************************* * File: mon/stty.c * Purpose: Part of core Monitor * This module contains the stty command. * Author: Phil Bunce (pjb@carmel.com) * Revision History: * 970304 Start of revision history * 970707 Fixed prob with not being able to set the baud rate * 970805 Fixed prob of incorrect con baud after boot w nvram overide * 980618 Changed baud list to use info from driver. */ #include #include #include #include struct brate { char *str; int value; }; struct brate btable[] = { {"0",B0}, {"50",B50}, {"75",B75}, {"110",B110}, {"134",B134}, {"200",B200}, {"150",B150}, {"300",B300}, {"600",B600}, {"1200",B1200}, {"1800",B1800}, {"2400",B2400}, {"4800",B4800}, {"9600",B9600}, {"19200",B19200}, {"38400",B38400}, {"57600",B57600}, {"76800",B76800}, {"115200",B115200}, {"153600",B153600}, {"230400",B230400}, {"307200",B307200}, {"460800",B460800}, {"921600",B921600}, {0}}; Optdesc stty_opts[] = { {"[opt][][]","Set/display terminal options"}, {"-v","list possible baud rates and terminal types"}, {"-a","list all settings"}, {"","set baud rate"}, {"","set terminal type"}, {"sane","set sane settings"}, {"ixany","allow any char to restart output"}, {"-ixany","allow only to restart output"}, {"ixoff","enable tandem mode"}, {"-ixoff","disable tandem mode"}, {"echo","enable echo"}, {"-echo","disable echo"}, {0}}; /************************************************************* * stty(ac,av) * the 'stty' command */ stty(ac,av) int ac; char *av[]; { int fd,i,flag,aflag,vflag,j; struct termio tbuf; char buf[16]; Ulong bauds; fd = STDIN; ioctl_getsaved(fd,&tbuf); flag = aflag = vflag = 0; if (ioctl(fd,BAUDRATES,&bauds) == -1) { printf("warning: unable to get valid baudrates.\n"); bauds = 0;; } for (i=1;i