cks@hawkwind.utcs.toronto.edu (Chris Siebenmann) (02/26/91)
/* * A program that illustrates a problem with Ultrix POSIXification * incant: cc -YPOSIX tty-bug.c; stty new; stty; ./a.out /dev/tty; stty * to see the bug. * incant: cc tty-bug.c; stty new; stty; ./a.out /dev/tty; stty * to see the bug go away. * (Note: the bug also occurs if you compile for System V or if you * use ./a.out `tty`.) * * The bug is that whenever a tty is opened by a program is POSIX * or SysV mode, the line discipline on that tty is instantly changed * to termios. This is braindamaged. It also seems to be deliberate; * see tty_def_open() in sys/sys/tty.c. * * Workaround: Never compile a program for POSIX or System V environments, * learn to love termios line discipline, start saying 'stty new' or * 'stty old' after all dubious commands, or never ever point a POSIX * or System V program near a terminal. In particular, don't compile * the 4.3BSD syslogging patches from jtkohl@MIT.EDU (John T Kohl) * with -YPOSIX, or your console line discipline will randomly change * to termios. */ #include <stdio.h> #include <fcntl.h> main(argc, argv) int argc; char **argv; { int fd, i; for (i = 1; i < argc; i++) { fd = open(argv[i], O_WRONLY, 0); if (fd < 0) perror(argv[i]); (void) close(fd); } return 0; } -- "You don't *run* programs on Ultrix." - Mark Moraes "Right, you chase them." - Rayan Zachariassen cks@hawkwind.utcs.toronto.edu ...!{utgpu,utzoo,watmath}!utgpu!cks