revert between 56095 -> 55830 in arch
[AROS.git] / workbench / network / stacks / AROSTCP / bsdsocket / net / sana2perror.c
blob21b057559b1d75c6e10f104c3826d6943f6e2eef
1 /*
2 * Copyright (C) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
3 * Helsinki University of Technology, Finland.
4 * All rights reserved.
5 * Copyright (C) 2005 - 2007 The AROS Dev Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19 * MA 02111-1307, USA.
23 #include <conf.h>
24 #if !defined(__AROS__)
25 #include <proto/sysdebug.h>
26 #endif
27 #include <sys/param.h>
28 #include <sys/systm.h>
29 #include <sys/syslog.h>
31 #include <devices/sana2.h>
32 #include <net/sana2errno.h>
34 extern const char * const io_errlist[];
35 extern const short io_nerr;
36 extern const char * const sana2io_errlist[];
37 extern const short sana2io_nerr;
38 extern const char * const sana2wire_errlist[];
39 extern const short sana2wire_nerr;
41 void
42 sana2perror(const char *banner, struct IOSana2Req *ios2)
44 register WORD err = ios2->ios2_Req.io_Error;
45 register ULONG werr = ios2->ios2_WireError;
46 const char *errstr;
48 if (err >= sana2io_nerr || -err > io_nerr) {
49 errstr = io_errlist[0];
50 } else {
51 if (err < 0)
52 /* Negative error codes are common with all IO devices */
53 errstr = io_errlist[-err];
54 else
55 /* Positive error codes are SANA-II specific */
56 errstr = sana2io_errlist[err];
59 if (werr == 0 || werr >= sana2wire_nerr) {
60 __log(LOG_ERR, "%s: %s\n", banner, errstr);
61 } else {
62 __log(LOG_ERR, "%s: %s (%s)\n", banner, errstr, sana2wire_errlist[werr]);