1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * ------+---------+---------+---------+---------+---------+---------+---------* 5 * Copyright (c) 2003,2013 - Garance Alistair Drosehn <gad@FreeBSD.org>. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 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. 16 * 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 27 * SUCH DAMAGE. 28 * 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. 32 * 33 * ------+---------+---------+---------+---------+---------+---------+---------* 34 * ------+---------+---------+---------+---------+---------+---------+---------* 35 */ 36 37 /* 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). 43 */ 44 45 #if !defined(_LP_CDEFS_H_) 46 #define _LP_CDEFS_H_ 47 48 /* 49 * For non-BSD platforms, you can compile lpr with -DHAVE_SYS_CDEFS_H 50 * if <sys/cdefs.h> should be included. 51 */ 52 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 53 # define HAVE_SYS_CDEFS_H 54 #endif 55 #if defined(HAVE_SYS_CDEFS_H) 56 # include <sys/cdefs.h> 57 #endif 58 59 /* 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. 63 */ 64 #ifndef USE_CLOSEFROM 65 # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 66 # define USE_CLOSEFROM 1 67 # endif 68 #endif 69 /* The macro USE_CLOSEFROM must be defined with a value of 0 or 1. */ 70 #ifndef USE_CLOSEFROM 71 # define USE_CLOSEFROM 0 72 #endif 73 74 /* 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>. 79 */ 80 #if !defined(__unused) 81 # define __unused 82 #endif 83 84 /* 85 * Some lpr include files use __BEGIN_DECLS and __END_DECLS. 86 */ 87 #if !defined(__BEGIN_DECLS) 88 # if defined(__cplusplus) 89 # define __BEGIN_DECLS extern "C" { 90 # define __END_DECLS } 91 # else 92 # define __BEGIN_DECLS 93 # define __END_DECLS 94 # endif 95 #endif 96 97 /* 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. 101 */ 102 #if !defined(__printflike) 103 # define __printflike(fmtarg, firstvararg) 104 #endif 105 #if !defined(__printf0like) 106 # define __printf0like(fmtarg, firstvararg) 107 #endif 108 109 #endif /* !_LP_CDEFS_H_ */ 110