From 514b1ee8381ffc1c0c69d17d2db4af3864c8d770 Mon Sep 17 00:00:00 2001 From: fedor Date: Thu, 6 Nov 1997 18:26:51 +0000 Subject: [PATCH] Minor fixes. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2620 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Documentation/gnustep-howto.texi | 2 +- Source/GNUmakefile | 1 - Source/NSBundle.m | 18 ++++++------------ Source/ostream.m | 28 +++++++++++++++++++--------- 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3951a2937..6a82078fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Nov 6 10:14:39 1997 Adam Fedor + + * src/GNUmakefile (DEFS): Remove PLATFORM_OS. + * src/NSBundle.m: Change platform to gnustep_target_os. + + * src/ostream.m (ostream_getc, ostream_read, ostream_vscanf): + Return EOF if stream_obj returned 0. + Wed Nov 5 16:10:32 1997 Scott Christley * src/Invocation.m (-setArgument:atIndex:): Add OpenStep method. diff --git a/Documentation/gnustep-howto.texi b/Documentation/gnustep-howto.texi index e6835397c..185ce0f3c 100644 --- a/Documentation/gnustep-howto.texi +++ b/Documentation/gnustep-howto.texi @@ -182,7 +182,7 @@ running configure: @example LIBS=-lthread; ./configure --prefix=/usr/local/GNUstep -@end +@end example After this you should add the shell script @file{GNUstep.sh} in the makefile package to you initialization file (such as @file{.profile}). For instance: diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 8beb6b71b..a58853e16 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -40,7 +40,6 @@ LIBRARY_NAME=libgnustep-base # GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because # the installing person may set it on the `make' command line. DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT) \ - -DPLATFORM_OS=\"$(GNUSTEP_TARGET_OS)\" \ -DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \ -DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \ -DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \ diff --git a/Source/NSBundle.m b/Source/NSBundle.m index d780e101f..13ce21918 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -105,12 +105,6 @@ static NSBundle* _loadingBundle = nil; static NSLock* load_lock = nil; static BOOL _strip_after_loading = NO; -static NSString* platform = -#ifdef PLATFORM_OS - @PLATFORM_OS; -#else - nil; -#endif static NSString* gnustep_target_dir = #ifdef GNUSTEP_TARGET_DIR @GNUSTEP_TARGET_DIR; @@ -582,12 +576,12 @@ _bundle_load_callback(Class theClass, Category *theCategory) [NSString stringWithFormat: @"%@.%@", name, ext]]; if ( stat([fullpath cString], &statbuf) == 0) { - if (platform) + if (gnustep_target_os) { NSString* platpath; platpath = [path stringByAppendingPathComponent: [NSString stringWithFormat: @"%@-%@.%@", - name, platform, ext]]; + name, gnustep_target_os, ext]]; if ( stat([platpath cString], &statbuf) == 0) fullpath = platpath; } @@ -602,12 +596,12 @@ _bundle_load_callback(Class theClass, Category *theCategory) [NSString stringWithFormat: @"%@", name]]; if ( stat([fullpath cString], &statbuf) == 0) { - if (platform) + if (gnustep_target_os) { NSString* platpath; platpath = [path stringByAppendingPathComponent: [NSString stringWithFormat: @"%@-%@", - name, platform]]; + name, gnustep_target_os]]; if ( stat([platpath cString], &statbuf) == 0) fullpath = platpath; } @@ -615,12 +609,12 @@ _bundle_load_callback(Class theClass, Category *theCategory) else { fullpath = _bundle_path_for_name(path, name); - if (fullpath && platform) + if (fullpath && gnustep_target_os) { NSString* platpath; platpath = _bundle_path_for_name(path, [NSString stringWithFormat: @"%@-%@", - name, platform]); + name, gnustep_target_os]); if (platpath) fullpath = platpath; } diff --git a/Source/ostream.m b/Source/ostream.m index 8d42f0675..04a7b3096 100644 --- a/Source/ostream.m +++ b/Source/ostream.m @@ -41,10 +41,11 @@ _ostream_error (const char* message) int ostream_getc (ostream* s) { - char c = 0; + char r, c; + r = c = 0; if (s->flags & OSTREAM_READFLAG) - [(id )s->stream_obj readByte: &c]; - else + r = [(id )s->stream_obj readByte: &c]; + if (r == 0) c = OSTREAM_EOF; return c; } @@ -105,23 +106,26 @@ ostream_tell (ostream *s) int ostream_read (ostream* s, void* buf, int count) { + int r = 0; assert(buf); /* xxxFIXME: should be an exception ? */ if (s->flags & OSTREAM_READFLAG) - return [(id )s->stream_obj readBytes: buf length: count]; - return OSTREAM_EOF; + r = [(id )s->stream_obj readBytes: buf length: count]; + if (r == 0) + r = OSTREAM_EOF; + return r; } char* ostream_gets (ostream* s, char* buf, int count) { - char c; + char r, c; int i = 0; assert(buf); /* xxxFIXME: should be an exception ? */ if (!(s->flags & OSTREAM_READFLAG)) return NULL; while (i < count-1) { - [(id )s->stream_obj readByte: &c]; - if (c == -1) + r = [(id )s->stream_obj readByte: &c]; + if (r <= 0) break; buf[i++] = c; if (c == '\n') @@ -177,8 +181,14 @@ ostream_vscanf (ostream *s, const char *format, va_list argList) { id str = [[NSString alloc] stringWithCString: format]; if (s->flags & OSTREAM_READFLAG) - return [(id )s->stream_obj readFormat: str + { + int r = 0; + r = [(id )s->stream_obj readFormat: str arguments: argList]; + if (r == 0) + r = OSTREAM_EOF; + return r; + } _ostream_error("Tried to read from non-readable stream"); [str release]; return OSTREAM_EOF;