X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_scan.c;h=aa7be84e75c768e186e6beccfb12c19689506bff;hp=615d82e0f32ee659d5c9756ac90781b62f9cc660;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=3082b97d8f2de1584430ad42671a0e056ed33be4 diff --git a/functions/stdio/_PDCLIB_scan.c b/functions/stdio/_PDCLIB_scan.c index 615d82e..aa7be84 100644 --- a/functions/stdio/_PDCLIB_scan.c +++ b/functions/stdio/_PDCLIB_scan.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* _PDCLIB_scan( const char *, struct _PDCLIB_status_t * ) This file is part of the Public Domain C Library (PDCLib). @@ -18,6 +16,8 @@ #ifndef REGTEST +#include "_PDCLIB_io.h" + /* Using an integer's bits as flags for both the conversion flags and length modifiers. */ @@ -118,7 +118,7 @@ static bool IN_SCANSET( const char * scanlist, const char * end_scanlist, int rc const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) { /* generic input character */ - int rc; + int rc = EOF; const char * orig_spec = spec; if ( *(++spec) == '%' ) { @@ -257,7 +257,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) { char * c = va_arg( status->arg, char * ); /* for %c, default width is one */ - if ( status->width == SIZE_MAX ) + if ( status->width == UINT_MAX ) { status->width = 1; } @@ -287,7 +287,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) case 's': { char * c = va_arg( status->arg, char * ); - while ( ( status->current < status->width ) && + while ( ( status->current < status->width ) && ( ( rc = GET( status ) ) != EOF ) ) { if ( isspace( rc ) ) @@ -347,7 +347,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) } while ( *endspec != ']' ); // read according to scanlist, equiv. to %s above char * c = va_arg( status->arg, char * ); - while ( ( status->current < status->width ) && + while ( ( status->current < status->width ) && ( ( rc = GET( status ) ) != EOF ) ) { if ( negative_scanlist ) @@ -597,7 +597,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) #define _PDCLIB_FILEID "_PDCLIB/scan.c" #define _PDCLIB_STRINGIO -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" #ifndef REGTEST static int testscanf( char const * s, char const * format, ... )