mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 08:40:07 +00:00
c1f4108352
These tests were skipped by the use-test-skeleton conversion done in
commit 29955b5d
because they did not have an `int main (void)'
declaration. Instead their `main' functions were declared with arguments
(i.e. argc, argv) even though they didn't use them.
Remove these arguments and include the test skeleton in these tests.
49 lines
849 B
C
49 lines
849 B
C
/* Test for strverscmp() */
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#define MAX_STRINGS 256
|
|
#define MAX_LINE_SIZE 32
|
|
|
|
static int
|
|
compare (const void *p1, const void *p2)
|
|
{
|
|
return strverscmp (*((char **) p1), *((char **) p2));
|
|
}
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
char line[MAX_LINE_SIZE + 1];
|
|
char *str[MAX_STRINGS];
|
|
int count = 0;
|
|
int i, n;
|
|
|
|
while (count < MAX_STRINGS && fgets (line, MAX_LINE_SIZE, stdin) != NULL)
|
|
{
|
|
n = strlen (line) - 1;
|
|
|
|
if (line[n] == '\n')
|
|
line[n] = '\0';
|
|
|
|
str[count] = strdup (line);
|
|
|
|
if (str[count] == NULL)
|
|
exit (EXIT_FAILURE);
|
|
|
|
++count;
|
|
}
|
|
|
|
qsort (str, count, sizeof (char *), compare);
|
|
|
|
for (i = 0; i < count; ++i)
|
|
puts (str[i]);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
#define TEST_FUNCTION do_test ()
|
|
#include "../test-skeleton.c"
|