ado@elsie.UUCP (Arthur David Olson) (04/29/86)
Index: bin/stty.c Fix Description: The stty command gives wild output for speed values outside the range it knows about. Repeat-By: Compile this source into a.out: # #include "sgtty.h" main(argc, argv) int argc; char * argv[]; { struct sgttyb old, new; gtty(0, &old); new = old; new.sg_ispeed = new.sg_ospeed = atoi(argv[1]); stty(0, &new); (void) system("stty 2>&1 1>&0"); stty(0, &old); return 0; } then type in the command a.out 20 > results ; cat results and note the "speed" portion of the output: . . .speed 1701707883 baud; . . . Fix: The fix is to stty.c, in particular to the function prspeed. The changes are shown below, conditioned on OLDVERSION. As usual, the trade secret status of the code involved precludes a clearer posting. prspeed(c, s) char *c; { #ifdef OLDVERSION fprintf(stderr,"%s%d baud", c, speed[s]); #else if (s < 0 || s >= sizeof speed / sizeof speed[0]) (void) fprintf(stderr, "%scode %d", c, s); else (void) fprintf(stderr, "%s%d baud", c, speed[s]); #endif OLDVERSION } -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX, Elsie & Ado are Digital, Borden & Shakespeare trademarks.