]> pd.if.org Git - pdclib/blobdiff - functions/_PDCLIB/scan.c
PDCLIB_scan: For %p, use E_long. This is a temporary change: Long term, we will be...
[pdclib] / functions / _PDCLIB / scan.c
index 15b1d503c32a5fa9481c48f65d625a08922508bb..615d82e0f32ee659d5c9756ac90781b62f9cc660 100644 (file)
@@ -16,6 +16,8 @@
 #include <stddef.h>
 #include <limits.h>
 
+#ifndef REGTEST
+
 /* Using an integer's bits as flags for both the conversion flags and length
    modifiers.
 */
@@ -39,7 +41,7 @@
 */
 static int GET( struct _PDCLIB_status_t * status )
 {
-    int rc;
+    int rc = EOF;
     if ( status->stream != NULL )
     {
         rc = getc( status->stream );
@@ -160,7 +162,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
     status->width = (int)strtol( spec, (char**)&spec, 10 );
     if ( spec == prev_spec )
     {
-        status->width = SIZE_MAX;
+        status->width = UINT_MAX;
     }
 
     /* Optional length modifier
@@ -384,7 +386,8 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
         }
         case 'p':
             status->base = 16;
-            status->flags |= E_unsigned;
+            // TODO: Like _PDCLIB_print, E_pointer(?)
+            status->flags |= E_unsigned | E_long;
             break;
         case 'n':
         {
@@ -588,7 +591,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
     /* TODO: Floats. */
     return NULL;
 }
-
+#endif
 
 #ifdef TEST
 #define _PDCLIB_FILEID "_PDCLIB/scan.c"
@@ -596,6 +599,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
 
 #include <_PDCLIB_test.h>
 
+#ifndef REGTEST
 static int testscanf( char const * s, char const * format, ... )
 {
     struct _PDCLIB_status_t status;
@@ -612,13 +616,16 @@ static int testscanf( char const * s, char const * format, ... )
     va_end( status.arg );
     return status.n;
 }
+#endif
 
 #define TEST_CONVERSION_ONLY
 
 int main( void )
 {
+#ifndef REGTEST
     char source[100];
 #include "scanf_testcases.h"
+#endif
     return TEST_RESULTS;
 }