|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T o
Length: 1453 (0x5ad) Types: TextFile Names: »okgalaxy.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Galaxy/src1/okgalaxy.c«
/* * %W% (mrdch&amnnon) %E% */ # include <stdio.h> # include <signal.h> # include <sys/types.h> # include <sys/stat.h> struct stat stbuf ; char *tty ; /* * The reason for this file is that usually there is no READ * permission on someone else terminal. Giving this command * enables the main game to read whatever is typed by the * second player, and interpret his commands. */ main() { char *ttyname() ; int doexit() ; tty = ttyname(0) ; if(tty == 0) { fprintf(stderr, "Don't know you.\n") ; exit(1) ; } /* * collect terminal situation in a temporary buf. */ stat(tty, &stbuf) ; /* * prepare for leaving the game when it's all over. */ signal(SIGINT, doexit) ; signal(SIGQUIT, doexit) ; signal(SIGTSTP, doexit) ; /* * try to make the terminal readable to all. */ if(chmod(tty, 0666) == -1) { fprintf(stderr, "Your tty ain't yours.\n") ; exit(1) ; } /* * all went fine, relax and let the originator to catch up. */ printf("Please wait.....") ; fflush(stdout) ; /* * Suspend all activity. To exit this mode after the game * has finished, one needs to interrupt it with a keybourd * signal. */ pause() ; } /* restore terminal mode to original state. */ doexit() { chmod(tty, stbuf.st_mode) ; exit(0) ; }