2 * SPDX-License-Identifier: BSD-2-Clause
4 * ------+---------+---------+---------+---------+---------+---------+---------*
5 * Copyright (c) 2003,2013 - Garance Alistair Drosehn <gad@FreeBSD.org>.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * The views and conclusions contained in the software and documentation
30 * are those of the authors and should not be interpreted as representing
31 * official policies, either expressed or implied, of the FreeBSD Project.
33 * ------+---------+---------+---------+---------+---------+---------+---------*
34 * ------+---------+---------+---------+---------+---------+---------+---------*
38 * The main goal of this include file is to provide a platform-neutral way
39 * to define some macros that lpr wants from FreeBSD's <sys/cdefs.h>. This
40 * will simply use the standard <sys/cdefs.h> when compiled in FreeBSD, but
41 * other OS's may not have /usr/include/sys/cdefs.h (or even if that file
42 * exists, it may not define all the macros that lpr will use).
45 #if !defined(_LP_CDEFS_H_)
49 * For non-BSD platforms, you can compile lpr with -DHAVE_SYS_CDEFS_H
50 * if <sys/cdefs.h> should be included.
52 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
53 # define HAVE_SYS_CDEFS_H
55 #if defined(HAVE_SYS_CDEFS_H)
56 # include <sys/cdefs.h>
60 * FreeBSD added a closefrom() routine in release 8.0. When compiling
61 * `lpr' on other platforms you might want to include bsd-closefrom.c
62 * from the portable-openssh project.
65 # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
66 # define USE_CLOSEFROM 1
69 /* The macro USE_CLOSEFROM must be defined with a value of 0 or 1. */
71 # define USE_CLOSEFROM 0
75 * __unused is a compiler-specific trick which can be used to avoid
76 * warnings about a variable which is defined but never referenced.
77 * Some lpr files use this, so define a null version if it was not
78 * defined by <sys/cdefs.h>.
80 #if !defined(__unused)
85 * Some lpr include files use __BEGIN_DECLS and __END_DECLS.
87 #if !defined(__BEGIN_DECLS)
88 # if defined(__cplusplus)
89 # define __BEGIN_DECLS extern "C" {
90 # define __END_DECLS }
92 # define __BEGIN_DECLS
98 * __printflike and __printf0like are a compiler-specific tricks to
99 * tell the compiler to check the format-codes in printf-like
100 * routines wrt the args that will be formatted.
102 #if !defined(__printflike)
103 # define __printflike(fmtarg, firstvararg)
105 #if !defined(__printf0like)
106 # define __printf0like(fmtarg, firstvararg)
109 #endif /* !_LP_CDEFS_H_ */