]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdlib/testsort.c
Revert "Use Linux 5.1 in build-many-glibcs.py."
[thirdparty/glibc.git] / stdlib / testsort.c
CommitLineData
28f540f4
RM
1#include <stdlib.h>
2#include <string.h>
3#include <stdio.h>
4
cf3141a5 5static int
714a562f 6compare (const void *a, const void *b)
28f540f4
RM
7{
8 return strcmp (*(char **) a, *(char **) b);
9}
10
28f540f4 11int
ebbad4cc 12main (void)
28f540f4
RM
13{
14 char bufs[500][20];
15 char *lines[500];
16 size_t lens[500];
17 size_t i, j;
18
19 srandom (1);
20
21 for (i = 0; i < 500; ++i)
22 {
23 lens[i] = random() % 19;
24 lines[i] = bufs[i];
25 for (j = 0; j < lens[i]; ++j)
26 lines[i][j] = random() % 26 + 'a';
27 lines[i][j] = '\0';
28 }
29
30 qsort (lines, 500, sizeof (char *), compare);
31
32 for (i = 0; i < 500 && lines[i] != NULL; ++i)
33 puts (lines[i]);
34
35 return 0;
36}