/* $Id$ */
-/* Release $Name$ */
-
/* qsort( void *, size_t, size_t, int(*)( const void *, const void * ) )
This file is part of the Public Domain C Library (PDCLib).
#include <string.h>
#include <limits.h>
-int compare( const void * left, const void * right )
+static int compare( const void * left, const void * right )
{
return *( (unsigned char *)left ) - *( (unsigned char *)right );
}
-int main()
+int main( void )
{
char presort[] = { "shreicnyjqpvozxmbt" };
char sorted1[] = { "bcehijmnopqrstvxyz" };
char sorted2[] = { "bticjqnyozpvreshxm" };
char s[19];
- BEGIN_TESTS;
strcpy( s, presort );
qsort( s, 18, 1, compare );
TESTCASE( strcmp( s, sorted1 ) == 0 );
strcpy( s, presort );
qsort( s, 1, 1, compare );
TESTCASE( strcmp( s, presort ) == 0 );
+#if __BSD_VISIBLE
+ puts( "qsort.c: Skipping test #4 for BSD as it goes into endless loop here." );
+#else
qsort( s, 100, 0, compare );
TESTCASE( strcmp( s, presort ) == 0 );
+#endif
return TEST_RESULTS;
}