xref: /plan9/sys/src/libsunrpc/error.c (revision ff8c3af2f44d95267f67219afa20ba82ff6cf7e4)
1 #include <u.h>
2 #include <libc.h>
3 #include <thread.h>
4 #include <sunrpc.h>
5 
6 static struct {
7 	SunStatus status;
8 	char *msg;
9 } tab[] = {
10 	SunProgUnavail,	"program unavailable",
11 	SunProgMismatch,	"program mismatch",
12 	SunProcUnavail,	"procedure unavailable",
13 	SunGarbageArgs,	"garbage args",
14 	SunSystemErr,		"system error",
15 	SunRpcMismatch,	"rpc mismatch",
16 	SunAuthBadCred,	"bad auth cred",
17 	SunAuthRejectedCred,	"rejected auth cred",
18 	SunAuthBadVerf,	"bad auth verf",
19 	SunAuthRejectedVerf,	"rejected auth verf",
20 	SunAuthTooWeak,	"auth too weak",
21 	SunAuthInvalidResp,	"invalid auth response",
22 	SunAuthFailed,		"auth failed",
23 };
24 
25 void
26 sunErrstr(SunStatus status)
27 {
28 	int i;
29 
30 	for(i=0; i<nelem(tab); i++){
31 		if(tab[i].status == status){
32 			werrstr(tab[i].msg);
33 			return;
34 		}
35 	}
36 	werrstr("unknown sun error %d", (int)status);
37 }
38