Minor fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2620 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1997-11-06 18:26:51 +00:00
parent 369c38280a
commit 55b12328d1
5 changed files with 34 additions and 23 deletions

View file

@ -1,3 +1,11 @@
Thu Nov 6 10:14:39 1997 Adam Fedor <fedor@doc.com>
* 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 <scottc@speedy.net-community.com>
* src/Invocation.m (-setArgument:atIndex:): Add OpenStep method.

View file

@ -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:

View file

@ -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)\" \

View file

@ -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;
}

View file

@ -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 <Streaming>)s->stream_obj readByte: &c];
else
r = [(id <Streaming>)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 <Streaming>)s->stream_obj readBytes: buf length: count];
return OSTREAM_EOF;
r = [(id <Streaming>)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 <Streaming>)s->stream_obj readByte: &c];
if (c == -1)
r = [(id <Streaming>)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 <Streaming>)s->stream_obj readFormat: str
{
int r = 0;
r = [(id <Streaming>)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;