X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsStartup.c;h=e7da54f1539cee48a9b6baa437d5b39e912cbb29;hb=22f5f69672b91d3538366660948c9e40a9c67f02;hp=e2746e80de288c022f2fc038b202c0720dd848a2;hpb=e5af4a3e53c45884d6d26c7cbb73bc914bb37b73;p=ghc-hetmet.git diff --git a/ghc/rts/RtsStartup.c b/ghc/rts/RtsStartup.c index e2746e8..e7da54f 100644 --- a/ghc/rts/RtsStartup.c +++ b/ghc/rts/RtsStartup.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsStartup.c,v 1.76 2003/09/24 10:32:11 simonmar Exp $ + * $Id: RtsStartup.c,v 1.77 2003/09/25 15:14:41 panne Exp $ * * (c) The GHC Team, 1998-2002 * @@ -73,12 +73,25 @@ struct RTS_FLAGS RtsFlags; // Count of how many outstanding hs_init()s there have been. static int hs_init_count = 0; -#if HAVE_TERMIOS_H // Here we save the terminal settings on the standard file // descriptors, if we need to change them (eg. to support NoBuffering // input). -struct termios *saved_termios[3] = {NULL,NULL,NULL}; -#endif +static void *saved_termios[3] = {NULL,NULL,NULL}; + +void* +__hscore_get_saved_termios(int fd) +{ + return (0 <= fd && fd < sizeof(saved_termios) / sizeof(*saved_termios)) ? + saved_termios[fd] : NULL; +} + +void +__hscore_set_saved_termios(int fd, void* ts) +{ + if (0 <= fd && fd < sizeof(saved_termios) / sizeof(*saved_termios)) { + saved_termios[fd] = ts; + } +} /* ----------------------------------------------------------------------------- Starting up the RTS @@ -345,8 +358,9 @@ hs_exit(void) sigaddset(&sigset, SIGTTOU); sigprocmask(SIG_BLOCK, &sigset, &old_sigset); for (fd = 0; fd <= 2; fd++) { - if (saved_termios[fd] != NULL) { - tcsetattr(fd,TCSANOW,saved_termios[fd]); + struct termios* ts = (struct termios*)__hscore_get_saved_termios(fd); + if (ts != NULL) { + tcsetattr(fd,TCSANOW,ts); } } sigprocmask(SIG_SETMASK, &old_sigset, NULL);