xref: /netbsd/lib/libc/yp/ypprot_err.c (revision 90275da6)
1*90275da6Sabs /*	$NetBSD: ypprot_err.c,v 1.6 2012/06/25 22:32:46 abs Exp $	 */
2159bafeaSjtc 
3159bafeaSjtc /*
4159bafeaSjtc  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
5159bafeaSjtc  * All rights reserved.
6159bafeaSjtc  *
7159bafeaSjtc  * Redistribution and use in source and binary forms, with or without
8159bafeaSjtc  * modification, are permitted provided that the following conditions
9159bafeaSjtc  * are met:
10159bafeaSjtc  * 1. Redistributions of source code must retain the above copyright
11159bafeaSjtc  *    notice, this list of conditions and the following disclaimer.
12159bafeaSjtc  * 2. Redistributions in binary form must reproduce the above copyright
13159bafeaSjtc  *    notice, this list of conditions and the following disclaimer in the
14159bafeaSjtc  *    documentation and/or other materials provided with the distribution.
15159bafeaSjtc  *
16159bafeaSjtc  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
17159bafeaSjtc  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18159bafeaSjtc  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19159bafeaSjtc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20159bafeaSjtc  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21159bafeaSjtc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22159bafeaSjtc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23159bafeaSjtc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24159bafeaSjtc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25159bafeaSjtc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26159bafeaSjtc  * SUCH DAMAGE.
27159bafeaSjtc  */
28159bafeaSjtc 
29e7cc5503Schristos #include <sys/cdefs.h>
30159bafeaSjtc #if defined(LIBC_SCCS) && !defined(lint)
31*90275da6Sabs __RCSID("$NetBSD: ypprot_err.c,v 1.6 2012/06/25 22:32:46 abs Exp $");
32159bafeaSjtc #endif
33159bafeaSjtc 
3443fa6fe3Sjtc #include "namespace.h"
35159bafeaSjtc #include <rpc/rpc.h>
36159bafeaSjtc #include <rpcsvc/yp_prot.h>
37159bafeaSjtc #include <rpcsvc/ypclnt.h>
38159bafeaSjtc 
3943fa6fe3Sjtc #ifdef __weak_alias
__weak_alias(ypprot_err,_ypprot_err)4060549036Smycroft __weak_alias(ypprot_err,_ypprot_err)
4143fa6fe3Sjtc #endif
4243fa6fe3Sjtc 
43159bafeaSjtc int
44*90275da6Sabs ypprot_err(unsigned int incode)
45159bafeaSjtc {
46159bafeaSjtc 	switch (incode) {
47159bafeaSjtc 	case YP_TRUE:
48159bafeaSjtc 		return 0;
49159bafeaSjtc 	case YP_FALSE:
50159bafeaSjtc 		return YPERR_YPBIND;
51159bafeaSjtc 	case YP_NOMORE:
52159bafeaSjtc 		return YPERR_NOMORE;
53159bafeaSjtc 	case YP_NOMAP:
54159bafeaSjtc 		return YPERR_MAP;
55159bafeaSjtc 	case YP_NODOM:
56159bafeaSjtc 		return YPERR_NODOM;
57159bafeaSjtc 	case YP_NOKEY:
58159bafeaSjtc 		return YPERR_KEY;
59159bafeaSjtc 	case YP_BADOP:
60159bafeaSjtc 		return YPERR_YPERR;
61159bafeaSjtc 	case YP_BADDB:
62159bafeaSjtc 		return YPERR_BADDB;
63159bafeaSjtc 	case YP_YPERR:
64159bafeaSjtc 		return YPERR_YPERR;
65159bafeaSjtc 	case YP_BADARGS:
66159bafeaSjtc 		return YPERR_BADARGS;
67159bafeaSjtc 	case YP_VERS:
68159bafeaSjtc 		return YPERR_VERS;
69159bafeaSjtc 	}
70159bafeaSjtc 	return YPERR_YPERR;
71159bafeaSjtc }
72