From d108f4123cdac62bb3b43f70be70efae74ea0283 Mon Sep 17 00:00:00 2001 From: vsc Date: Wed, 23 Jan 2002 02:28:31 +0000 Subject: [PATCH] fix IO for simplesim git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@320 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/iopreds.c | 9 +++++++++ C/sysbits.c | 17 +++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/C/iopreds.c b/C/iopreds.c index 55271320a..2c41aa1d3 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -373,6 +373,14 @@ unix_upd_stream_info (StreamDesc * s) } #else #if HAVE_ISATTY +#if __simplescalar__ + /* isatty does not seem to work with simplescar. I'll assume the first + three streams will probably be ttys (pipes are not thatg different) */ + if (s-Stream < 3) { + s->u.file.name = LookupAtom("tty"); + s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f; + } +#else { int filedes; /* visualc */ filedes = YP_fileno (s->u.file.file); @@ -386,6 +394,7 @@ unix_upd_stream_info (StreamDesc * s) return; } } +#endif #endif /* HAVE_ISATTY */ #endif /* _MSC_VER */ s->status |= Seekable_Stream_f; diff --git a/C/sysbits.c b/C/sysbits.c index 049c99f6d..d6768fecf 100644 --- a/C/sysbits.c +++ b/C/sysbits.c @@ -107,6 +107,10 @@ STATIC_PROTO (int chdir, (char *)); /* #define signal skel_signal */ #endif /* MACYAP */ +#if __simplescalar__ +char yap_pwd[YAP_FILENAME_MAX]; +#endif + STD_PROTO (void exit, (int)); #ifdef _WIN32 @@ -1505,7 +1509,6 @@ int TrueFileName (char *source, char *result, int in_lib) #if __simplescalar__ /* does not implement getcwd */ - char *yap_pwd = getenv("PWD"); strncpy(ares1,yap_pwd,YAP_FILENAME_MAX); #elif HAVE_GETCWD if (getcwd (ares1, YAP_FILENAME_MAX) == NULL) @@ -1595,7 +1598,6 @@ p_getcwd(void) #if __simplescalar__ /* does not implement getcwd */ - char *yap_pwd = getenv("PWD"); strncpy(FileNameBuf,yap_pwd,YAP_FILENAME_MAX); #elif HAVE_GETCWD if (getcwd (FileNameBuf, YAP_FILENAME_MAX) == NULL) @@ -1787,10 +1789,7 @@ p_cd (void) } TrueFileName (FileNameBuf, FileNameBuf2, FALSE); #if __simplescalar__ - strncpy(FileNameBuf,"PWD=",YAP_FILENAME_MAX); - strncat(FileNameBuf,FileNameBuf2,YAP_FILENAME_MAX); - fprintf(stderr,"adding %s\n", FileNameBuf); - putenv(FileNameBuf); + strncpy(yap_pwd,FileNameBuf2,YAP_FILENAME_MAX); #endif return (!chdir (FileNameBuf2)); #else @@ -2057,6 +2056,12 @@ set_fpu_exceptions(int flag) void InitSysbits (void) { +#if __simplescalar__ + { + char *pwd = getenv("PWD"); + strncpy(yap_pwd,pwd,YAP_FILENAME_MAX); + } +#endif InitPageSize(); InitTime (); InitWTime ();