X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2F_PDCLIB%2Fscan.c;h=b6012611b707b290158d4c3585de5a271149790b;hb=0b5f84a52cf54e88b99a44efc6f5f2c46e9b294d;hp=2f59fa59cc405d49979da8123b7196caaf4de38f;hpb=a59e44598f84721180a53dcfb6a35caa190cfe79;p=pdclib diff --git a/functions/_PDCLIB/scan.c b/functions/_PDCLIB/scan.c index 2f59fa5..b601261 100644 --- a/functions/_PDCLIB/scan.c +++ b/functions/_PDCLIB/scan.c @@ -209,7 +209,15 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) *(c++) = rc; value_parsed = true; } - return value_parsed ? spec : NULL; + if ( value_parsed ) + { + ++status->n; + return ++spec; + } + else + { + return NULL; + } } case 's': { @@ -239,7 +247,8 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) if ( value_parsed ) { *c = '\0'; - return spec; + ++status->n; + return ++spec; } else { @@ -370,7 +379,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) puts( "UNSUPPORTED SCANF FLAG COMBINATION" ); return NULL; } - return spec; + return ++spec; } /* TODO: Floats. */ return NULL; @@ -379,10 +388,13 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status ) #ifdef TEST #include <_PDCLIB_test.h> +#include + + int main( void ) { - TESTCASE( NO_TESTDRIVER ); + /* Testing covered by fscanf.c */ return TEST_RESULTS; }