8 #include <gnutls/gnutls.h>
10 const char *_gnutls_strerror (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
);
28 main (int argc
, char *argv
[])
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
));
39 for (i
= 0; i
> -400; i
--)
41 _name
= _gnutls_strerror (i
);
45 strcpy (names_to_sort
[j
].name
, _name
);
46 names_to_sort
[j
].error_index
= i
;
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
)
59 printf ("@item %s:\n%s\n\n", _name
, desc
);
62 printf ("@end table\n");