mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
308b1321d5 | ||
|
|
99e6856c11 | ||
|
|
b252f90d66 | ||
|
|
1ed26d0a60 | ||
|
|
4dd74de299 | ||
|
|
3b5a4a32a4 | ||
|
|
7f7ca50d06 | ||
|
|
0ed8ef67ed | ||
|
|
267bdc4be6 | ||
|
|
a7bac89279 | ||
|
|
95f0617964 | ||
|
|
4b3dbd3546 | ||
|
|
b8663a4240 |
@@ -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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "amiga.lib 1.178"
|
#define VERS "amiga.lib 1.182"
|
||||||
#define VSTRING "amiga.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "amiga.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: amiga.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: amiga.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "c.lib 1.178"
|
#define VERS "c.lib 1.182"
|
||||||
#define VSTRING "c.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "c.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: c.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: c.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
@@ -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)
|
c.lib 1.178 (7.10.2004)
|
||||||
|
|
||||||
- The OS4 version had floating point math support code enabled in all
|
- The OS4 version had floating point math support code enabled in all
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "debug.lib 1.178"
|
#define VERS "debug.lib 1.182"
|
||||||
#define VSTRING "debug.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "debug.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: debug.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: debug.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "m.lib 1.178"
|
#define VERS "m.lib 1.182"
|
||||||
#define VSTRING "m.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "m.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: m.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: m.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "m881.lib 1.178"
|
#define VERS "m881.lib 1.182"
|
||||||
#define VSTRING "m881.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "m881.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: m881.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: m881.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "net.lib 1.178"
|
#define VERS "net.lib 1.182"
|
||||||
#define VSTRING "net.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "net.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: net.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: net.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
@@ -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
|
- The printf() family now produces no output at all for floating point
|
||||||
libraries and not just "libm.a". Trying to link with, for example,
|
numbers (%e, %f and %g) if the floating point support code is disabled.
|
||||||
"libc.a" would bring up a number of unsatisfied symbol references
|
In previous versions of the library some output (series of 0 or blank
|
||||||
which could be fixed only by linking against "libm.a", too.
|
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.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "stack.lib 1.178"
|
#define VERS "stack.lib 1.182"
|
||||||
#define VSTRING "stack.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "stack.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: stack.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: stack.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
@@ -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,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.
|
/* 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;
|
SHOWMSG("read mode");
|
||||||
|
|
||||||
|
open_mode = O_RDONLY;
|
||||||
break;
|
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 the second or third character is a '+', switch to read/write mode. */
|
||||||
if(mode_len > sizeof(actual_mode)-1)
|
if((mode[1] == '+') || (mode[1] != '\0' && mode[2] == '+'))
|
||||||
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");
|
SHOWMSG("read/write access");
|
||||||
|
|
||||||
open_mode = O_RDONLY;
|
CLEAR_FLAG(open_mode,O_RDONLY);
|
||||||
file_flags = IOBF_READ;
|
CLEAR_FLAG(open_mode,O_WRONLY);
|
||||||
}
|
|
||||||
else if (strcmp(actual_mode,"w") == SAME || strcmp(actual_mode,"wb") == SAME)
|
|
||||||
{
|
|
||||||
SHOWMSG("write-only");
|
|
||||||
|
|
||||||
open_mode = O_WRONLY | O_CREAT | O_TRUNC;
|
SET_FLAG(open_mode,O_RDWR);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SHOWMSG("allocating file buffer");
|
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);
|
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;
|
||||||
|
|
||||||
|
|||||||
@@ -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 */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* :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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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')
|
if(conversion_type == 'd' || conversion_type == 'u')
|
||||||
base = 10;
|
base = 10;
|
||||||
else if (conversion_type == 'o')
|
else if (conversion_type == 'o')
|
||||||
@@ -1060,7 +1049,11 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
* '0x' prefix or just a zero.
|
* '0x' prefix or just a zero.
|
||||||
*/
|
*/
|
||||||
c = __getc(stream);
|
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. */
|
/* It's the hex prefix. */
|
||||||
base = 16;
|
base = 16;
|
||||||
@@ -1075,7 +1068,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
if(maximum_field_width > 0)
|
if(maximum_field_width > 0)
|
||||||
maximum_field_width--;
|
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
|
/* The preceding '0' was part of the
|
||||||
octal prefix. So we don't really know
|
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;
|
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
|
/* 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1422,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;
|
||||||
@@ -1555,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1569,8 +1562,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(num_conversions > 0)
|
result = num_assignments;
|
||||||
result = num_assignments;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
||||||
|
|||||||
@@ -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. */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define VERSION 1
|
#define VERSION 1
|
||||||
#define REVISION 178
|
#define REVISION 182
|
||||||
#define DATE "7.10.2004"
|
#define DATE "8.11.2004"
|
||||||
#define VERS "unix.lib 1.178"
|
#define VERS "unix.lib 1.182"
|
||||||
#define VSTRING "unix.lib 1.178 (7.10.2004)\r\n"
|
#define VSTRING "unix.lib 1.182 (8.11.2004)\r\n"
|
||||||
#define VERSTAG "\0$VER: unix.lib 1.178 (7.10.2004)"
|
#define VERSTAG "\0$VER: unix.lib 1.182 (8.11.2004)"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
178
|
182
|
||||||
|
|||||||
Reference in New Issue
Block a user