To fix dynamic linking issues with Hugs, access saved_termios via
getter/setter.
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $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
*
*
* (c) The GHC Team, 1998-2002
*
// Count of how many outstanding hs_init()s there have been.
static int hs_init_count = 0;
// Count of how many outstanding hs_init()s there have been.
static int hs_init_count = 0;
// Here we save the terminal settings on the standard file
// descriptors, if we need to change them (eg. to support NoBuffering
// input).
// 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
/* -----------------------------------------------------------------------------
Starting up the RTS
sigaddset(&sigset, SIGTTOU);
sigprocmask(SIG_BLOCK, &sigset, &old_sigset);
for (fd = 0; fd <= 2; fd++) {
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);
}
}
sigprocmask(SIG_SETMASK, &old_sigset, NULL);