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