#ifndef REGTEST
-extern void (*_PDCLIB_regstack[])( void );
-extern size_t _PDCLIB_regptr;
+extern void (*_PDCLIB_exitstack[])( void );
+extern size_t _PDCLIB_exitptr;
int atexit( void (*func)( void ) )
{
- if ( _PDCLIB_regptr == 0 )
+ if ( _PDCLIB_exitptr == 0 )
{
return -1;
}
else
{
- _PDCLIB_regstack[ --_PDCLIB_regptr ] = func;
+ _PDCLIB_exitstack[ --_PDCLIB_exitptr ] = func;
return 0;
}
}
*/
#define NUMBER_OF_SLOTS 40
-void (*_PDCLIB_regstack[ NUMBER_OF_SLOTS ])( void ) = { _PDCLIB_closeall };
-size_t _PDCLIB_regptr = NUMBER_OF_SLOTS;
+void (*_PDCLIB_exitstack[ NUMBER_OF_SLOTS ])( void ) = { _PDCLIB_closeall };
+size_t _PDCLIB_exitptr = NUMBER_OF_SLOTS;
void exit( int status )
{
- while ( _PDCLIB_regptr < NUMBER_OF_SLOTS )
+ while ( _PDCLIB_exitptr < NUMBER_OF_SLOTS )
{
- _PDCLIB_regstack[ _PDCLIB_regptr++ ]();
+ _PDCLIB_exitstack[ _PDCLIB_exitptr++ ]();
}
_Exit( status );
}
strcpy( s, presort );
qsort( s, 1, 1, compare );
TESTCASE( strcmp( s, presort ) == 0 );
-#if __BSD_VISIBLE
+#if defined( REGTEST ) && ( defined( __BSD_VISIBLE ) || defined( __APPLE__ ) )
puts( "qsort.c: Skipping test #4 for BSD as it goes into endless loop here." );
#else
qsort( s, 100, 0, compare );
/* TODO: Doing this via a static array is not the way to do it. */
char * strerror( int errnum )
{
- if ( errnum == 0 || errnum >= _PDCLIB_ERRNO_MAX )
+ if ( errnum >= _PDCLIB_ERRNO_MAX )
{
return (char *)"Unknown error";
}
++s2;
--n;
}
- if ( ( n == 0 ) )
+ if ( n == 0 )
{
return 0;
}