1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

10 Commits

Author SHA1 Message Date
Olaf Barthel
308b1321d5 This commit was manufactured by cvs2svn to create tag 'V1_182'.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/tags/V1_182@14766 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-11-08 17:57:53 +00:00
Olaf Barthel
99e6856c11 c.lib 1.182 (8.11.2004)
- Changed the error abort condition for the %s conversion of the
  scanf() family. It now matches the abort conditions for all other
  conversions and no longer ignores whether any other parameters were
  converted before. This was a quirk in the older implementation.

- The scanf() family now accepts %E and %G in place of %f and %X in
  place of %x.

- Simplified the common code that fopen(), freopen() and fdopen()
  share and which has to figure out by looking at a file access
  mode specification which parameters should be used.

- Dropped error detection in the scanf() family. The EOF has to be
  good enough. Also, ungetc() failure still leads to error handling.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14765 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-11-08 17:57:52 +00:00
Olaf Barthel
b252f90d66 - Added a few more scanf() tests.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14764 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-11-08 17:56:32 +00:00
Olaf Barthel
1ed26d0a60 - The __open_iob() function can be made simpler still.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14763 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-11-03 15:39:04 +00:00
Olaf Barthel
4dd74de299 - Changed the error abort condition for the %s conversion of the
scanf() family. It now matches the abort conditions for all other
  conversions and no longer ignores whether any other parameters were
  converted before. This was a quirk in the older implementation.

- The scanf() family now accepts %E and %G in place of %f and %X in
  place of %x.

- Simplified the common code that fopen(), freopen() and fdopen()
  share and which has to figure out by looking at a file access
  mode specification which parameters should be used.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14762 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-11-03 15:35:56 +00:00
Olaf Barthel
3b5a4a32a4 c.lib 1.181 (26.10.2004)
- The scanf() family now always returns the number of assignments made
  unless an error occured or an EOF was hit during conversion before the
  first assignment could be made.

- strtok() did not terminate properly if the last token in the string
  did not end with a separator character but with a '\0' byte. Fixed.

- The directory scanning functions opendir/closedir did not get the global
  directory data tracking data structure initialized which later led to
  Enforcer hits and maybe trashed memory. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14761 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-26 16:25:04 +00:00
Olaf Barthel
7f7ca50d06 - strtok() did not terminate properly if the last token in the string
did not end with a separator character but with a '\0' byte. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14760 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-25 19:53:15 +00:00
Olaf Barthel
0ed8ef67ed - Added the strtok_test program.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14759 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-25 19:50:33 +00:00
Olaf Barthel
267bdc4be6 - The directory scanning functions opendir/closedir did not get the global
directory data tracking data structure initialized which later led to
  Enforcer hits and maybe trashed memory. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14758 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-24 20:03:42 +00:00
Olaf Barthel
a7bac89279 c.lib 1.180 (23.10.2004)
- The printf() family now produces no output at all for %e, %f and %g if the
  floating point support code is disabled. Previously, a minimum field width
  specification could take effect, printing a series of 0 or blank space
  characters where no output should have been produced.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14756 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-23 16:38:18 +00:00
25 changed files with 194 additions and 185 deletions

View File

@@ -1,5 +1,5 @@
# #
# $Id: GNUmakefile.68k,v 1.11 2004-10-07 09:20:44 obarthel Exp $ # $Id: GNUmakefile.68k,v 1.13 2004-10-26 16:25:03 obarthel Exp $
# #
# :ts=8 # :ts=8
# #
@@ -9,7 +9,7 @@
CC = gcc CC = gcc
AR = ar -q AR = ar -q
RANLIB = ranlib RANLIB = ranlib
COPY = copy clone COPY = copy clone buf=0
DELETE = delete all quiet DELETE = delete all quiet
MAKEDIR = makedir MAKEDIR = makedir
MAKE = make -f GNUmakefile.68k MAKE = make -f GNUmakefile.68k
@@ -688,7 +688,6 @@ LIBS_68K := $(LIBC_OBJS)/libc.a $(LIBSTACK_OBJS)/libstack.a $(LIBUNIX_OBJS)/libu
$(LIBNET_OBJS)/libnet.a $(LIBDEBUG_OBJS)/libdebug.a $(LIBAMIGA_OBJS)/libamiga.a \ $(LIBNET_OBJS)/libnet.a $(LIBDEBUG_OBJS)/libdebug.a $(LIBAMIGA_OBJS)/libamiga.a \
$(LIBM_OBJS)/libm.a $(LIBM_OBJS)/libm.a
LIBS_020 := $(LIBM881_OBJS)/libm881.a $(LIBS_68K) LIBS_020 := $(LIBM881_OBJS)/libm881.a $(LIBS_68K)
#LIBS_020 := $(LIBS_68K)
############################################################################## ##############################################################################
@@ -714,8 +713,8 @@ all: \
lib/mainnb.o \ lib/mainnb.o \
lib/mainb.o \ lib/mainb.o \
lib/mainb32.o \ lib/mainb32.o \
lib/libm.a \
lib/libm020/libm.a \ lib/libm020/libm.a \
lib/libm.a \
lib/libb/libm.a \ lib/libb/libm.a \
lib/libb/libm020/libm.a \ lib/libb/libm020/libm.a \
lib/libb32/libm020/libm.a lib/libb32/libm020/libm.a

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "amiga.lib 1.179" #define VERS "amiga.lib 1.182"
#define VSTRING "amiga.lib 1.179 (22.10.2004)\r\n" #define VSTRING "amiga.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: amiga.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: amiga.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "c.lib 1.179" #define VERS "c.lib 1.182"
#define VSTRING "c.lib 1.179 (22.10.2004)\r\n" #define VSTRING "c.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: c.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: c.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182

View File

@@ -1,3 +1,44 @@
c.lib 1.182 (8.11.2004)
- Changed the error abort condition for the %s conversion of the
scanf() family. It now matches the abort conditions for all other
conversions and no longer ignores whether any other parameters were
converted before. This was a quirk in the older implementation.
- The scanf() family now accepts %E and %G in place of %f and %X in
place of %x.
- Simplified the common code that fopen(), freopen() and fdopen()
share and which has to figure out by looking at a file access
mode specification which parameters should be used.
- Dropped error detection in the scanf() family. The EOF has to be
good enough. Also, ungetc() failure still leads to error handling.
c.lib 1.181 (26.10.2004)
- The scanf() family now always returns the number of assignments made
unless an error occured or an EOF was hit during conversion before the
first assignment could be made.
- strtok() did not terminate properly if the last token in the string
did not end with a separator character but with a '\0' byte. Fixed.
- The directory scanning functions opendir/closedir did not get the global
directory data tracking data structure initialized which later led to
Enforcer hits and maybe trashed memory. Fixed.
c.lib 1.180 (23.10.2004)
- The printf() family now produces no output at all for %e, %f and %g if the
floating point support code is disabled. Previously, a minimum field width
specification could take effect, printing a series of 0 or blank space
characters where no output should have been produced.
c.lib 1.179 (22.10.2004) c.lib 1.179 (22.10.2004)
- The scanf() family no longer assumes that a leading '0' indicates that the - The scanf() family no longer assumes that a leading '0' indicates that the

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "debug.lib 1.179" #define VERS "debug.lib 1.182"
#define VSTRING "debug.lib 1.179 (22.10.2004)\r\n" #define VSTRING "debug.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: debug.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: debug.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: dirent_data.c,v 1.3 2004-08-07 10:24:04 obarthel Exp $ * $Id: dirent_data.c,v 1.4 2004-10-24 20:03:42 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -38,7 +38,7 @@
/****************************************************************************/ /****************************************************************************/
/* Directories being scanned whose locks need to be freed when shutting down. */ /* Directories being scanned whose locks need to be freed when shutting down. */
struct MinList __directory_list; struct MinList NOCOMMON __directory_list;
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: dirent_headers.h,v 1.1.1.1 2004-07-26 16:30:30 obarthel Exp $ * $Id: dirent_headers.h,v 1.2 2004-10-24 20:03:42 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -42,6 +42,12 @@
/****************************************************************************/ /****************************************************************************/
#ifndef _MACROS_H
#include "macros.h"
#endif /* _MACROS_H */
/****************************************************************************/
struct DirectoryHandle struct DirectoryHandle
{ {
struct MinNode dh_MinNode; struct MinNode dh_MinNode;
@@ -56,7 +62,7 @@ struct DirectoryHandle
/****************************************************************************/ /****************************************************************************/
extern struct MinList __directory_list; extern struct MinList NOCOMMON __directory_list;
/****************************************************************************/ /****************************************************************************/

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "m.lib 1.179" #define VERS "m.lib 1.182"
#define VSTRING "m.lib 1.179 (22.10.2004)\r\n" #define VSTRING "m.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: m.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: m.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "m881.lib 1.179" #define VERS "m881.lib 1.182"
#define VSTRING "m881.lib 1.179 (22.10.2004)\r\n" #define VSTRING "m881.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: m881.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: m881.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "net.lib 1.179" #define VERS "net.lib 1.182"
#define VSTRING "net.lib 1.179 (22.10.2004)\r\n" #define VSTRING "net.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: net.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: net.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182

View File

@@ -1,4 +1,9 @@
c.lib 1.179 (22.10.2004) c.lib 1.180 (23.10.2004)
- The printf() family now produces no output at all for floating point
numbers (%e, %f and %g) if the floating point support code is disabled.
In previous versions of the library some output (series of 0 or blank
space characters) could still be produced.
- The scanf() family no longer ignores a conversion request of - The scanf() family no longer ignores a conversion request of
type '%x' (hexadecimal) and treats the number to be processed type '%x' (hexadecimal) and treats the number to be processed

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "stack.lib 1.179" #define VERS "stack.lib 1.182"
#define VSTRING "stack.lib 1.179 (22.10.2004)\r\n" #define VSTRING "stack.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: stack.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: stack.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: stdio_openiob.c,v 1.1.1.1 2004-07-26 16:31:37 obarthel Exp $ * $Id: stdio_openiob.c,v 1.3 2004-11-03 15:39:04 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -48,9 +48,7 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
{ {
ULONG file_flags; ULONG file_flags;
int result = -1; int result = -1;
char actual_mode[8];
int open_mode; int open_mode;
size_t mode_len,len,i;
struct fd * fd = NULL; struct fd * fd = NULL;
STRPTR buffer = NULL; STRPTR buffer = NULL;
STRPTR aligned_buffer; STRPTR aligned_buffer;
@@ -86,78 +84,49 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
} }
} }
/* Options can follow the mode string, separated by a comma. /* The first character selects the access mode: read, write or append. */
* We don't support any of those. switch(mode[0])
*/
len = mode_len = strlen(mode);
for(i = 0 ; i < len ; i++)
{ {
if(mode[i] == ',') case 'r':
{
mode_len = i;
break;
}
}
/* Keep only the first few letters of the mode string. */ SHOWMSG("read mode");
if(mode_len > sizeof(actual_mode)-1)
mode_len = sizeof(actual_mode)-1;
memmove(actual_mode,mode,mode_len);
actual_mode[mode_len] = '\0';
SHOWSTRING(actual_mode);
if(strcmp(actual_mode,"r") == SAME || strcmp(actual_mode,"rb") == SAME)
{
SHOWMSG("read-only");
open_mode = O_RDONLY; open_mode = O_RDONLY;
file_flags = IOBF_READ; break;
}
else if (strcmp(actual_mode,"w") == SAME || strcmp(actual_mode,"wb") == SAME) case 'w':
{
SHOWMSG("write-only"); SHOWMSG("write mode");
open_mode = O_WRONLY | O_CREAT | O_TRUNC; open_mode = O_WRONLY | O_CREAT | O_TRUNC;
file_flags = IOBF_WRITE; break;
}
else if (strcmp(actual_mode,"a") == SAME || strcmp(actual_mode,"ab") == SAME) case 'a':
{
SHOWMSG("write-only; append"); SHOWMSG("append mode");
open_mode = O_WRONLY | O_CREAT | O_APPEND; open_mode = O_WRONLY | O_CREAT | O_APPEND;
file_flags = IOBF_WRITE; break;
}
else if (strcmp(actual_mode,"r+") == SAME || strcmp(actual_mode,"rb+") == SAME || strcmp(actual_mode,"r+b") == SAME)
{
SHOWMSG("read/write; don't overwrite");
open_mode = O_RDWR; default:
file_flags = IOBF_READ | IOBF_WRITE;
}
else if (strcmp(actual_mode,"w+") == SAME || strcmp(actual_mode,"wb+") == SAME || strcmp(actual_mode,"w+b") == SAME)
{
SHOWMSG("read/write; overwrite");
open_mode = O_RDWR | O_CREAT | O_TRUNC; D(("unsupported file open mode '%lc'",mode[0]));
file_flags = IOBF_READ | IOBF_WRITE;
}
else if (strcmp(actual_mode,"a+") == SAME || strcmp(actual_mode,"ab+") == SAME || strcmp(actual_mode,"a+b") == SAME)
{
SHOWMSG("read/write; append; don't overwrite");
open_mode = O_RDWR | O_CREAT | O_APPEND;
file_flags = IOBF_READ | IOBF_WRITE;
}
else
{
SHOWMSG("unsupported file open mode");
errno = EINVAL; errno = EINVAL;
goto out; goto out;
} }
/* If the second or third character is a '+', switch to read/write mode. */
if((mode[1] == '+') || (mode[1] != '\0' && mode[2] == '+'))
{
SHOWMSG("read/write access");
CLEAR_FLAG(open_mode,O_RDONLY);
CLEAR_FLAG(open_mode,O_WRONLY);
SET_FLAG(open_mode,O_RDWR);
}
SHOWMSG("allocating file buffer"); SHOWMSG("allocating file buffer");
/* Allocate a little more memory than necessary. */ /* Allocate a little more memory than necessary. */
@@ -193,12 +162,21 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
CLEAR_FLAG(fd->fd_Flags,FDF_APPEND); CLEAR_FLAG(fd->fd_Flags,FDF_APPEND);
} }
/* Figure out the buffered file access mode by looking at the open mode. */
file_flags = IOBF_IN_USE | IOBF_NO_NUL;
if(FLAG_IS_SET(open_mode,O_RDONLY) || FLAG_IS_SET(open_mode,O_RDWR))
SET_FLAG(file_flags,IOBF_READ);
if(FLAG_IS_SET(open_mode,O_WRONLY) || FLAG_IS_SET(open_mode,O_RDWR))
SET_FLAG(file_flags,IOBF_WRITE);
__initialize_iob(file,(HOOKFUNC)__iob_hook_entry, __initialize_iob(file,(HOOKFUNC)__iob_hook_entry,
buffer, buffer,
aligned_buffer,BUFSIZ, aligned_buffer,BUFSIZ,
file_descriptor, file_descriptor,
slot_number, slot_number,
IOBF_IN_USE | file_flags | IOBF_NO_NUL); file_flags);
buffer = NULL; buffer = NULL;

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: stdio_vfprintf.c,v 1.5 2004-09-10 07:39:19 obarthel Exp $ * $Id: stdio_vfprintf.c,v 1.6 2004-10-23 16:38:18 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -979,15 +979,8 @@ vfprintf(FILE * stream,const char * format, va_list arg)
else else
(void)va_arg(arg, double); (void)va_arg(arg, double);
#ifndef NDEBUG minimum_field_width = 0;
{ format_flags = 0;
output_buffer = "*FLOATING POINT NUMBER*";
output_len = strlen(output_buffer);
}
#endif /* NDEBUG */
CLEAR_FLAG(format_flags,FORMATF_ProduceSign);
CLEAR_FLAG(format_flags,FORMATF_ProduceSpace);
} }
#endif /* FLOATING_POINT_SUPPORT */ #endif /* FLOATING_POINT_SUPPORT */
} }

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: stdio_vfscanf.c,v 1.3 2004-10-22 10:57:53 obarthel Exp $ * $Id: stdio_vfscanf.c,v 1.6 2004-11-08 17:57:52 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -105,24 +105,12 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
if(isspace(c)) if(isspace(c))
{ {
BOOL finished = FALSE;
/* Skip all blank spaces in the stream. */ /* Skip all blank spaces in the stream. */
format++; format++;
while(TRUE) while((c = __getc(stream)) != EOF)
{ {
c = __getc(stream); if(isspace(c))
if(c == EOF)
{
/* Hit the end of the stream. Due to an error? */
if(num_conversions == 0 || ferror(stream))
goto out;
finished = TRUE;
break;
}
else if (isspace(c))
{ {
total_num_chars_read++; total_num_chars_read++;
} }
@@ -139,8 +127,17 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
} }
} }
if(finished) if(c == EOF)
{
SHOWMSG("end of file");
/* Hit the end of the stream? */
if(num_conversions == 0)
goto out;
/* Finished... */
break; break;
}
/* Resume scanning. */ /* Resume scanning. */
continue; continue;
@@ -159,8 +156,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
{ {
SHOWMSG("end of file"); SHOWMSG("end of file");
/* Hit the end of the stream. Due to an error? */ /* Hit the end of the stream. */
if(num_conversions == 0 || ferror(stream)) if(num_conversions == 0)
goto out; goto out;
break; break;
@@ -305,9 +302,11 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
break; break;
/* It's a floating point number. */ /* It's a floating point number. */
case 'f':
case 'e': case 'e':
case 'E':
case 'f':
case 'g': case 'g':
case 'G':
conversion_type = 'f'; conversion_type = 'f';
format++; format++;
@@ -321,6 +320,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
case 's': /* string */ case 's': /* string */
case 'u': /* unsigned integer */ case 'u': /* unsigned integer */
case 'x': /* unsigned integer in hexadecimal format */ case 'x': /* unsigned integer in hexadecimal format */
case 'X': /* unsigned integer in hexadecimal format */
case '%': /* the % character */ case '%': /* the % character */
case '[': /* a range of characters */ case '[': /* a range of characters */
@@ -339,21 +339,9 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
conversion_type != 'n' && conversion_type != 'n' &&
conversion_type != '[') conversion_type != '[')
{ {
BOOL finished = FALSE; while((c = __getc(stream)) != EOF)
while(TRUE)
{ {
c = __getc(stream); if(isspace(c))
if(c == EOF)
{
/* Hit the end of the stream. Due to an error? */
if(num_conversions == 0 || ferror(stream))
goto out;
finished = TRUE;
break;
}
else if (isspace(c))
{ {
total_num_chars_read++; total_num_chars_read++;
} }
@@ -369,9 +357,6 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
break; break;
} }
} }
if(finished)
break;
} }
num_chars_processed = 0; num_chars_processed = 0;
@@ -428,8 +413,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
c = __getc(stream); c = __getc(stream);
if(c == EOF) if(c == EOF)
{ {
/* Bail out if we hit the end of the stream or an error occured. */ /* Bail out if we hit the end of the stream. */
if(num_conversions == 0 || ferror(stream)) if(num_conversions == 0)
goto out; goto out;
break; break;
@@ -609,7 +594,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
maximum_field_width--; maximum_field_width--;
} }
if(c == EOF && ((num_chars_processed == 0 && num_conversions == 0) || ferror(stream))) if(c == EOF && num_chars_processed == 0 && num_conversions == 0)
goto out; goto out;
} }
@@ -1200,7 +1185,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
} }
} }
if(c == EOF && ((num_chars_processed == 0 && num_conversions == 0) || ferror(stream))) if(c == EOF && num_chars_processed == 0 && num_conversions == 0)
goto out; goto out;
} }
@@ -1306,8 +1291,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
/* The conversion is considered to have failed if an EOF was /* The conversion is considered to have failed if an EOF was
encountered before any non-whitespace characters could be encountered before any non-whitespace characters could be
converted. We also bail out if we hit an error. */ converted. */
if(c == EOF && (num_chars_processed == 0 || ferror(stream))) if(c == EOF && num_chars_processed == 0 && num_conversions == 0)
goto out; goto out;
} }
@@ -1430,8 +1415,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
{ {
SHOWMSG("end of file"); SHOWMSG("end of file");
/* Hit the end of the stream. Due to an error? */ /* Hit the end of the stream. */
if(num_conversions == 0 || ferror(stream)) if(num_conversions == 0)
goto out; goto out;
break; break;
@@ -1563,7 +1548,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
maximum_field_width--; maximum_field_width--;
} }
if(c == EOF && ((num_chars_processed == 0 && num_conversions == 0) || ferror(stream))) if(c == EOF && num_chars_processed == 0 && num_conversions == 0)
goto out; goto out;
} }
@@ -1577,7 +1562,6 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
} }
} }
if(num_conversions > 0)
result = num_assignments; result = num_assignments;
out: out:

View File

@@ -1,5 +1,5 @@
/* /*
* $Id: string_strtok.c,v 1.1.1.1 2004-07-26 16:32:20 obarthel Exp $ * $Id: string_strtok.c,v 1.2 2004-10-25 19:53:15 obarthel Exp $
* *
* :ts=4 * :ts=4
* *
@@ -89,9 +89,12 @@ strtok(char *str, const char *separator_set)
goto out; goto out;
/* This is where the search can resume later. */ /* This is where the search can resume later. */
last = &str[size+1]; last = &str[size];
if((*last) == '\0')
last = NULL; /* If we didn't hit the end of the string already,
skip the separator. */
if((*last) != '\0')
last++;
/* This is the token we found; make sure that /* This is the token we found; make sure that
it looks like a valid string. */ it looks like a valid string. */

View File

@@ -1,6 +1,6 @@
#define VERSION 1 #define VERSION 1
#define REVISION 179 #define REVISION 182
#define DATE "22.10.2004" #define DATE "8.11.2004"
#define VERS "unix.lib 1.179" #define VERS "unix.lib 1.182"
#define VSTRING "unix.lib 1.179 (22.10.2004)\r\n" #define VSTRING "unix.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: unix.lib 1.179 (22.10.2004)" #define VERSTAG "\0$VER: unix.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
179 182