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

13 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
Olaf Barthel
95f0617964 - Updated the release notes file to match the contents of the changes file.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14754 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-22 15:57:38 +00:00
Olaf Barthel
4b3dbd3546 - Updated the scanf() test to check if the fixes for the scanf() family
regarding '%x' and leading zeroes in strings to be parsed are really
  working.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14753 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-22 15:55:53 +00:00
Olaf Barthel
b8663a4240 c.lib 1.179 (22.10.2004)
- The scanf() family no longer assumes that a leading '0' indicates that the
  following digits form an octal number if the conversion type has been
  specified as already '%x' already.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14752 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-10-22 10:57:53 +00:00
25 changed files with 214 additions and 191 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
#
@@ -9,7 +9,7 @@
CC = gcc
AR = ar -q
RANLIB = ranlib
COPY = copy clone
COPY = copy clone buf=0
DELETE = delete all quiet
MAKEDIR = makedir
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 \
$(LIBM_OBJS)/libm.a
LIBS_020 := $(LIBM881_OBJS)/libm881.a $(LIBS_68K)
#LIBS_020 := $(LIBS_68K)
##############################################################################
@@ -714,8 +713,8 @@ all: \
lib/mainnb.o \
lib/mainb.o \
lib/mainb32.o \
lib/libm.a \
lib/libm020/libm.a \
lib/libm.a \
lib/libb/libm.a \
lib/libb/libm020/libm.a \
lib/libb32/libm020/libm.a

View File

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

View File

@@ -1 +1 @@
178
182

View File

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

View File

@@ -1 +1 @@
178
182

View File

@@ -1,3 +1,51 @@
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)
- The scanf() family no longer assumes that a leading '0' indicates that the
following digits form an octal number if the conversion type has been
specified as already '%x' already.
c.lib 1.178 (7.10.2004)
- The OS4 version had floating point math support code enabled in all

View File

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

View File

@@ -1 +1 @@
178
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
*
@@ -38,7 +38,7 @@
/****************************************************************************/
/* 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
*
@@ -42,6 +42,12 @@
/****************************************************************************/
#ifndef _MACROS_H
#include "macros.h"
#endif /* _MACROS_H */
/****************************************************************************/
struct DirectoryHandle
{
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 REVISION 178
#define DATE "7.10.2004"
#define VERS "m.lib 1.178"
#define VSTRING "m.lib 1.178 (7.10.2004)\r\n"
#define VERSTAG "\0$VER: m.lib 1.178 (7.10.2004)"
#define REVISION 182
#define DATE "8.11.2004"
#define VERS "m.lib 1.182"
#define VSTRING "m.lib 1.182 (8.11.2004)\r\n"
#define VERSTAG "\0$VER: m.lib 1.182 (8.11.2004)"

View File

@@ -1 +1 @@
178
182

View File

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

View File

@@ -1 +1 @@
178
182

View File

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

View File

@@ -1 +1 @@
178
182

View File

@@ -1,6 +1,10 @@
c.lib 1.178 (7.10.2004)
c.lib 1.180 (23.10.2004)
- The OS4 version had floating point math support code enabled in all
libraries and not just "libm.a". Trying to link with, for example,
"libc.a" would bring up a number of unsatisfied symbol references
which could be fixed only by linking against "libm.a", too.
- 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
type '%x' (hexadecimal) and treats the number to be processed
as in octal notation if that number begins with the digit 0.

View File

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

View File

@@ -1 +1 @@
178
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
*
@@ -48,9 +48,7 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
{
ULONG file_flags;
int result = -1;
char actual_mode[8];
int open_mode;
size_t mode_len,len,i;
struct fd * fd = NULL;
STRPTR buffer = NULL;
STRPTR aligned_buffer;
@@ -86,76 +84,47 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
}
}
/* Options can follow the mode string, separated by a comma.
* We don't support any of those.
*/
len = mode_len = strlen(mode);
for(i = 0 ; i < len ; i++)
/* The first character selects the access mode: read, write or append. */
switch(mode[0])
{
if(mode[i] == ',')
{
mode_len = i;
case 'r':
SHOWMSG("read mode");
open_mode = O_RDONLY;
break;
}
case 'w':
SHOWMSG("write mode");
open_mode = O_WRONLY | O_CREAT | O_TRUNC;
break;
case 'a':
SHOWMSG("append mode");
open_mode = O_WRONLY | O_CREAT | O_APPEND;
break;
default:
D(("unsupported file open mode '%lc'",mode[0]));
errno = EINVAL;
goto out;
}
/* Keep only the first few letters of the mode string. */
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)
/* If the second or third character is a '+', switch to read/write mode. */
if((mode[1] == '+') || (mode[1] != '\0' && mode[2] == '+'))
{
SHOWMSG("read-only");
SHOWMSG("read/write access");
open_mode = O_RDONLY;
file_flags = IOBF_READ;
}
else if (strcmp(actual_mode,"w") == SAME || strcmp(actual_mode,"wb") == SAME)
{
SHOWMSG("write-only");
CLEAR_FLAG(open_mode,O_RDONLY);
CLEAR_FLAG(open_mode,O_WRONLY);
open_mode = O_WRONLY | O_CREAT | O_TRUNC;
file_flags = IOBF_WRITE;
}
else if (strcmp(actual_mode,"a") == SAME || strcmp(actual_mode,"ab") == SAME)
{
SHOWMSG("write-only; append");
open_mode = O_WRONLY | O_CREAT | O_APPEND;
file_flags = IOBF_WRITE;
}
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;
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;
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;
goto out;
SET_FLAG(open_mode,O_RDWR);
}
SHOWMSG("allocating file buffer");
@@ -193,12 +162,21 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
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,
buffer,
aligned_buffer,BUFSIZ,
file_descriptor,
slot_number,
IOBF_IN_USE | file_flags | IOBF_NO_NUL);
file_flags);
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
*
@@ -979,15 +979,8 @@ vfprintf(FILE * stream,const char * format, va_list arg)
else
(void)va_arg(arg, double);
#ifndef NDEBUG
{
output_buffer = "*FLOATING POINT NUMBER*";
output_len = strlen(output_buffer);
}
#endif /* NDEBUG */
CLEAR_FLAG(format_flags,FORMATF_ProduceSign);
CLEAR_FLAG(format_flags,FORMATF_ProduceSpace);
minimum_field_width = 0;
format_flags = 0;
}
#endif /* FLOATING_POINT_SUPPORT */
}

View File

@@ -1,5 +1,5 @@
/*
* $Id: stdio_vfscanf.c,v 1.2 2004-08-08 10:55:57 obarthel Exp $
* $Id: stdio_vfscanf.c,v 1.6 2004-11-08 17:57:52 obarthel Exp $
*
* :ts=4
*
@@ -105,24 +105,12 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
if(isspace(c))
{
BOOL finished = FALSE;
/* Skip all blank spaces in the stream. */
format++;
while(TRUE)
while((c = __getc(stream)) != EOF)
{
c = __getc(stream);
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))
if(isspace(c))
{
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;
}
/* Resume scanning. */
continue;
@@ -159,8 +156,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
{
SHOWMSG("end of file");
/* Hit the end of the stream. Due to an error? */
if(num_conversions == 0 || ferror(stream))
/* Hit the end of the stream. */
if(num_conversions == 0)
goto out;
break;
@@ -305,9 +302,11 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
break;
/* It's a floating point number. */
case 'f':
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
conversion_type = 'f';
format++;
@@ -321,6 +320,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
case 's': /* string */
case 'u': /* unsigned integer */
case 'x': /* unsigned integer in hexadecimal format */
case 'X': /* unsigned integer in hexadecimal format */
case '%': /* the % character */
case '[': /* a range of characters */
@@ -339,21 +339,9 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
conversion_type != 'n' &&
conversion_type != '[')
{
BOOL finished = FALSE;
while(TRUE)
while((c = __getc(stream)) != EOF)
{
c = __getc(stream);
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))
if(isspace(c))
{
total_num_chars_read++;
}
@@ -369,9 +357,6 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
break;
}
}
if(finished)
break;
}
num_chars_processed = 0;
@@ -428,8 +413,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
c = __getc(stream);
if(c == EOF)
{
/* Bail out if we hit the end of the stream or an error occured. */
if(num_conversions == 0 || ferror(stream))
/* Bail out if we hit the end of the stream. */
if(num_conversions == 0)
goto out;
break;
@@ -609,7 +594,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
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;
}
@@ -1016,6 +1001,10 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
}
}
/* Chose a base according to the conversion to be
expected. For the 'x' and 'i' we examine the
incoming data rather than commit ourselves to
a peculiar data format now. */
if(conversion_type == 'd' || conversion_type == 'u')
base = 10;
else if (conversion_type == 'o')
@@ -1060,7 +1049,11 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
* '0x' prefix or just a zero.
*/
c = __getc(stream);
if (c == 'x' || c == 'X')
/* This takes care of the '0x' prefix for hexadecimal
numbers ('%x') and also picks the right type of
data for the '%i' type. */
if ((c == 'x' || c == 'X') && (conversion_type == 'x' || conversion_type == 'i'))
{
/* It's the hex prefix. */
base = 16;
@@ -1075,7 +1068,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
if(maximum_field_width > 0)
maximum_field_width--;
}
else if (isdigit(c))
else if (isdigit(c) && (conversion_type == 'i')) /* This could be the octal prefix for the '%i' format. */
{
/* The preceding '0' was part of the
octal prefix. So we don't really know
@@ -1192,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;
}
@@ -1298,8 +1291,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
/* The conversion is considered to have failed if an EOF was
encountered before any non-whitespace characters could be
converted. We also bail out if we hit an error. */
if(c == EOF && (num_chars_processed == 0 || ferror(stream)))
converted. */
if(c == EOF && num_chars_processed == 0 && num_conversions == 0)
goto out;
}
@@ -1422,8 +1415,8 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
{
SHOWMSG("end of file");
/* Hit the end of the stream. Due to an error? */
if(num_conversions == 0 || ferror(stream))
/* Hit the end of the stream. */
if(num_conversions == 0)
goto out;
break;
@@ -1555,7 +1548,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
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;
}
@@ -1569,8 +1562,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
}
}
if(num_conversions > 0)
result = num_assignments;
result = num_assignments;
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
*
@@ -89,9 +89,12 @@ strtok(char *str, const char *separator_set)
goto out;
/* This is where the search can resume later. */
last = &str[size+1];
if((*last) == '\0')
last = NULL;
last = &str[size];
/* 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
it looks like a valid string. */

View File

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

View File

@@ -1 +1 @@
178
182