err.c revision 1.8 1 1.8 christos /*
2 1.8 christos * Copyright (c) 1994 Christos Zoulas
3 1.8 christos * All rights reserved.
4 1.1 glass *
5 1.1 glass * Redistribution and use in source and binary forms, with or without
6 1.1 glass * modification, are permitted provided that the following conditions
7 1.1 glass * are met:
8 1.1 glass * 1. Redistributions of source code must retain the above copyright
9 1.1 glass * notice, this list of conditions and the following disclaimer.
10 1.1 glass * 2. Redistributions in binary form must reproduce the above copyright
11 1.1 glass * notice, this list of conditions and the following disclaimer in the
12 1.1 glass * documentation and/or other materials provided with the distribution.
13 1.1 glass * 3. All advertising materials mentioning features or use of this software
14 1.1 glass * must display the following acknowledgement:
15 1.8 christos * This product includes software developed by Christos Zoulas.
16 1.8 christos * 4. The name of the author may not be used to endorse or promote products
17 1.8 christos * derived from this software without specific prior written permission.
18 1.1 glass *
19 1.8 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20 1.8 christos * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 1.8 christos * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.8 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 1.8 christos * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 glass * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 glass * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 glass * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 glass * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 glass * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 glass * SUCH DAMAGE.
30 1.1 glass */
31 1.1 glass
32 1.8 christos #include <sys/cdefs.h>
33 1.1 glass
34 1.8 christos #ifdef __weak_reference
35 1.8 christos __weak_reference(__err, err);
36 1.8 christos __weak_reference(__verr, verr);
37 1.8 christos __weak_reference(__errx, errx);
38 1.8 christos __weak_reference(__verrx, verrx);
39 1.8 christos __weak_reference(__warn, warn);
40 1.8 christos __weak_reference(__vwarn, vwarn);
41 1.8 christos __weak_reference(__warnx, warnx);
42 1.8 christos __weak_reference(__vwarnx, vwarnx);
43 1.8 christos #else
44 1.8 christos
45 1.8 christos /*
46 1.8 christos * Without weak references, we would have to put one function per file
47 1.8 christos * in order to be able to replace only a single function without picking
48 1.8 christos * up all the others. Too bad; I am not going to create 100 little files.
49 1.8 christos * Also it is not that simple to just create dummy stubs that call __func
50 1.8 christos * because most of the functions are varyadic and we need to parse the
51 1.8 christos * argument list anyway.
52 1.8 christos */
53 1.8 christos
54 1.8 christos #define __err err
55 1.8 christos #define __verr verr
56 1.8 christos #define __errx errx
57 1.8 christos #define __verrx verrx
58 1.8 christos #define __warn warn
59 1.8 christos #define __vwarn vwarn
60 1.8 christos #define __warnx warnx
61 1.8 christos #define __vwarnx vwarnx
62 1.1 glass
63 1.8 christos #include "__err.c"
64 1.1 glass
65 1.1 glass #endif
66