The test now works.
[gnutls.git] / src / errcodes.c
blobe6e04da3fa8bde868c4b3818c7533a524cfdcfb9
1 #if HAVE_CONFIG_H
2 #include "config.h"
3 #endif
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <gnutls/gnutls.h>
10 const char *_gnutls_strerror (int);
12 typedef struct
14 char name[128];
15 int error_index;
16 } error_name;
19 static int
20 compar (const void *_n1, const void *_n2)
22 const error_name *n1 = (const error_name *) _n1,
23 *n2 = (const error_name *) _n2;
24 return strcmp (n1->name, n2->name);
27 int
28 main (int argc, char *argv[])
30 int i, j;
31 const char *desc;
32 const char *_name;
33 error_name names_to_sort[400]; /* up to 400 names */
35 printf ("@table @code\n");
37 memset (names_to_sort, 0, sizeof (names_to_sort));
38 j = 0;
39 for (i = 0; i > -400; i--)
41 _name = _gnutls_strerror (i);
42 if (_name == NULL)
43 continue;
45 strcpy (names_to_sort[j].name, _name);
46 names_to_sort[j].error_index = i;
47 j++;
50 qsort (names_to_sort, j, sizeof (error_name), compar);
52 for (i = 0; i < j; i++)
54 _name = names_to_sort[i].name;
55 desc = gnutls_strerror (names_to_sort[i].error_index);
56 if (desc == NULL || _name == NULL)
57 continue;
59 printf ("@item %s:\n%s\n\n", _name, desc);
62 printf ("@end table\n");
64 return 0;