mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 00:31:08 +00:00
cf3141a59d
2000-12-05 Andreas Jaeger <aj@suse.de> * nss/test-netdb.c: Mark local functions as static to avoid warnings. (main): Use return to silence warning. * stdlib/test-canon.c (check_path): Mark as static to avoid warning. * stdio-common/test-popen.c: Mark local functions as static to avoid warnings. (main): Use return to silence warning. * stdlib/testsort.c (compare): Mark as static to avoid warning. * assert/test-assert.c: Mark local functions as static to avoid warnings. * assert/test-assert-perr.c: Likewise. * math/libm-test.inc (main): Use return to silence warnings.
37 lines
602 B
C
37 lines
602 B
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
static int
|
|
compare (const void *a, const void *b)
|
|
{
|
|
return strcmp (*(char **) a, *(char **) b);
|
|
}
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
char bufs[500][20];
|
|
char *lines[500];
|
|
size_t lens[500];
|
|
size_t i, j;
|
|
|
|
srandom (1);
|
|
|
|
for (i = 0; i < 500; ++i)
|
|
{
|
|
lens[i] = random() % 19;
|
|
lines[i] = bufs[i];
|
|
for (j = 0; j < lens[i]; ++j)
|
|
lines[i][j] = random() % 26 + 'a';
|
|
lines[i][j] = '\0';
|
|
}
|
|
|
|
qsort (lines, 500, sizeof (char *), compare);
|
|
|
|
for (i = 0; i < 500 && lines[i] != NULL; ++i)
|
|
puts (lines[i]);
|
|
|
|
return 0;
|
|
}
|