xref: /openbsd-src/lib/libc/yp/ypprot_err.c (revision ba364beffe5dd70209394c4a6ab86a4314f8587d)
1*ba364befSguenther /*	$OpenBSD: ypprot_err.c,v 1.9 2015/09/13 20:57:28 guenther Exp $ */
218128546Sderaadt /*
318128546Sderaadt  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com>
418128546Sderaadt  * All rights reserved.
518128546Sderaadt  *
618128546Sderaadt  * Redistribution and use in source and binary forms, with or without
718128546Sderaadt  * modification, are permitted provided that the following conditions
818128546Sderaadt  * are met:
918128546Sderaadt  * 1. Redistributions of source code must retain the above copyright
1018128546Sderaadt  *    notice, this list of conditions and the following disclaimer.
1118128546Sderaadt  * 2. Redistributions in binary form must reproduce the above copyright
1218128546Sderaadt  *    notice, this list of conditions and the following disclaimer in the
1318128546Sderaadt  *    documentation and/or other materials provided with the distribution.
1418128546Sderaadt  *
1518128546Sderaadt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
1618128546Sderaadt  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1718128546Sderaadt  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818128546Sderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
1918128546Sderaadt  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2018128546Sderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2118128546Sderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2218128546Sderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2318128546Sderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2418128546Sderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2518128546Sderaadt  * SUCH DAMAGE.
2618128546Sderaadt  */
2718128546Sderaadt 
2818128546Sderaadt #include <sys/types.h>
2918128546Sderaadt #include <rpc/rpc.h>
3018128546Sderaadt #include <rpc/xdr.h>
3118128546Sderaadt #include <rpcsvc/yp.h>
3218128546Sderaadt #include <rpcsvc/ypclnt.h>
3318128546Sderaadt 
3418128546Sderaadt int
ypprot_err(unsigned int incode)3511e5d692Sderaadt ypprot_err(unsigned int incode)
3618128546Sderaadt {
37198c6cf5Stholo 	switch ((int)incode) {
3818128546Sderaadt 	case YP_TRUE:
3918128546Sderaadt 		return 0;
4018128546Sderaadt 	case YP_FALSE:
4118128546Sderaadt 		return YPERR_YPBIND;
4218128546Sderaadt 	case YP_NOMORE:
4318128546Sderaadt 		return YPERR_NOMORE;
4418128546Sderaadt 	case YP_NOMAP:
4518128546Sderaadt 		return YPERR_MAP;
4618128546Sderaadt 	case YP_NODOM:
4718128546Sderaadt 		return YPERR_NODOM;
4818128546Sderaadt 	case YP_NOKEY:
4918128546Sderaadt 		return YPERR_KEY;
5018128546Sderaadt 	case YP_BADOP:
5118128546Sderaadt 		return YPERR_YPERR;
5218128546Sderaadt 	case YP_BADDB:
5318128546Sderaadt 		return YPERR_BADDB;
5418128546Sderaadt 	case YP_YPERR:
5518128546Sderaadt 		return YPERR_YPERR;
5618128546Sderaadt 	case YP_BADARGS:
5718128546Sderaadt 		return YPERR_BADARGS;
5818128546Sderaadt 	case YP_VERS:
5918128546Sderaadt 		return YPERR_VERS;
6018128546Sderaadt 	}
6118128546Sderaadt 	return YPERR_YPERR;
6218128546Sderaadt }
63*ba364befSguenther DEF_WEAK(ypprot_err);
64