2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
4 * Author: Nikos Mavrogiannopoulos, Simon Josefsson
6 * This file is part of GnuTLS.
8 * GnuTLS is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * GnuTLS is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 #include <gnutls/gnutls.h>
39 compar (const void *_n1
, const void *_n2
)
41 const error_name
*n1
= (const error_name
*) _n1
,
42 *n2
= (const error_name
*) _n2
;
43 return strcmp (n1
->name
, n2
->name
);
47 main (int argc
, char *argv
[])
52 error_name names_to_sort
[400]; /* up to 400 names */
54 printf ("@table @code\n");
56 memset (names_to_sort
, 0, sizeof (names_to_sort
));
58 for (i
= 0; i
> -400; i
--)
60 _name
= gnutls_strerror_name (i
);
64 strcpy (names_to_sort
[j
].name
, _name
);
65 names_to_sort
[j
].error_index
= i
;
69 qsort (names_to_sort
, j
, sizeof (error_name
), compar
);
71 for (i
= 0; i
< j
; i
++)
73 _name
= names_to_sort
[i
].name
;
74 desc
= gnutls_strerror (names_to_sort
[i
].error_index
);
75 if (desc
== NULL
|| _name
== NULL
)
78 printf ("@item %s:\n%s\n\n", _name
, desc
);
81 printf ("@end table\n");