1 /*
2  *	aprsc
3  *
4  *	(c) Matti Aarnio, OH2MQK, <oh2mqk@sral.fi>
5  *
6  *	This program is licensed under the BSD license, which can be found
7  *	in the file LICENSE.
8  *
9  */
10 /*
11 	Libc fill-in for ZMailer using IPv6 API
12 	by Matti Aarnio <mea@nic.funet.fi> 1997, 2001
13 
14 	The original Craig Metz code is deeply Linux specific,
15 	this adaptation tries to be way more generic..
16 */
17 
18 #include "../config.h"
19 #include <stdio.h>
20 #include <sys/types.h>
21 #include <netdb.h>
22 #ifndef EAI_BADFLAGS
23 # include "netdb6.h"
24 #endif
25 
26 #ifndef __STDC__
27 # define const
28 #endif
29 
30 #ifndef HAVE_GAI_STRERROR
31 
32 /*
33 %%% copyright-cmetz-97
34 This software is Copyright 1997 by Craig Metz, All Rights Reserved.
35 The Inner Net License Version 2 applies to this software.
36 You should have received a copy of the license with this software. If
37 you didn't get a copy, you may request one from <license@inner.net>.
38 
39 */
40 
gai_strerror(errnum)41 const char *gai_strerror(errnum)
42 int errnum;
43 {
44   static char buffer[24];
45   switch(errnum) {
46     case 0:
47       return "no error";
48     case EAI_BADFLAGS:
49       return "invalid value for ai_flags";
50     case EAI_NONAME:
51       return "name or service is not known";
52     case EAI_AGAIN:
53       return "temporary failure in name resolution";
54     case EAI_FAIL:
55       return "non-recoverable failure in name resolution";
56     case EAI_NODATA:
57       return "no address associated with name";
58     case EAI_FAMILY:
59       return "ai_family not supported";
60     case EAI_SOCKTYPE:
61       return "ai_socktype not supported";
62     case EAI_SERVICE:
63       return "service not supported for ai_socktype";
64     case EAI_ADDRFAMILY:
65       return "address family for name not supported";
66     case EAI_MEMORY:
67       return "memory allocation failure";
68     case EAI_SYSTEM:
69       return "system error";
70     default:
71       sprintf(buffer,"gai_error_%02x", errnum);
72       return buffer;
73   }
74 }
75 
76 #endif
77