1/*-
2 * ------+---------+---------+---------+---------+---------+---------+---------*
3 * Copyright (c) 2003  - Garance Alistair Drosehn <gad@FreeBSD.org>.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *   1. Redistributions of source code must retain the above copyright
10 *      notice, this list of conditions and the following disclaimer.
11 *   2. Redistributions in binary form must reproduce the above copyright
12 *      notice, this list of conditions and the following disclaimer in the
13 *      documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * The views and conclusions contained in the software and documentation
28 * are those of the authors and should not be interpreted as representing
29 * official policies, either expressed or implied, of the FreeBSD Project.
30 *
31 * ------+---------+---------+---------+---------+---------+---------+---------*
32 * $FreeBSD$
33 * ------+---------+---------+---------+---------+---------+---------+---------*
34 */
35
36/*
37 * The main goal of this include file is to provide a platform-neutral way
38 * to define some macros that lpr wants from FreeBSD's <sys/cdefs.h>.  This
39 * will simply use the standard <sys/cdefs.h> when compiled in FreeBSD, but
40 * other OS's may not have /usr/include/sys/cdefs.h (or even if that file
41 * exists, it may not define all the macros that lpr will use).
42 */
43
44#if !defined(_LP_CDEFS_H_)
45#define	_LP_CDEFS_H_
46
47/*
48 * For non-BSD platforms, you can compile lpr with -DHAVE_SYS_CDEFS_H
49 * if <sys/cdefs.h> should be included.
50 */
51#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
52#  define HAVE_SYS_CDEFS_H
53#endif
54#if defined(HAVE_SYS_CDEFS_H)
55#  include <sys/cdefs.h>
56#endif
57
58/*
59 * __unused is a compiler-specific trick which can be used to avoid
60 * warnings about a variable which is defined but never referenced.
61 * Some lpr files use this, so define a null version if it was not
62 * defined by <sys/cdefs.h>.
63 */
64#if !defined(__unused)
65#  define	__unused
66#endif
67
68/*
69 * All the lpr source files will want to reference __FBSDID() to
70 * handle rcs id's.
71 */
72#if !defined(__FBSDID)
73#  if defined(lint) || defined(STRIP_FBSDID)
74#    define	__FBSDID(s)	struct skip_rcsid_struct
75#  elif defined(__IDSTRING)			/* NetBSD */
76#    define	__FBSDID(s)	__IDSTRING(rcsid,s)
77#  else
78#    define	__FBSDID(s)	static const char rcsid[] __unused = s
79#  endif
80#endif /* __FBSDID */
81
82/*
83 * Some lpr include files use __BEGIN_DECLS and __END_DECLS.
84 */
85#if !defined(__BEGIN_DECLS)
86#  if defined(__cplusplus)
87#    define	__BEGIN_DECLS	extern "C" {
88#    define	__END_DECLS	}
89#  else
90#    define	__BEGIN_DECLS
91#    define	__END_DECLS
92#  endif
93#endif
94
95/*
96 * __printflike and __printf0like are a compiler-specific tricks to
97 * tell the compiler to check the format-codes in printf-like
98 * routines wrt the args that will be formatted.
99 */
100#if !defined(__printflike)
101#  define	__printflike(fmtarg, firstvararg)
102#endif
103#if !defined(__printf0like)
104#  define	__printf0like(fmtarg, firstvararg)
105#endif
106
107#endif /* !_LP_CDEFS_H_ */
108