]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.sbin/lpr/common_source/lp.cdefs.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.sbin / lpr / common_source / lp.cdefs.h
1 /*-
2  * ------+---------+---------+---------+---------+---------+---------+---------*
3  * Copyright (c) 2003,2013  - 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  * FreeBSD added a closefrom() routine in release 8.0.  When compiling
60  * `lpr' on other platforms you might want to include bsd-closefrom.c
61  * from the portable-openssh project.
62  */
63 #ifndef USE_CLOSEFROM
64 #  if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
65 #    define     USE_CLOSEFROM   1
66 #  endif
67 #endif
68 /* The macro USE_CLOSEFROM must be defined with a value of 0 or 1. */
69 #ifndef USE_CLOSEFROM
70 #  define       USE_CLOSEFROM   0
71 #endif
72
73 /*
74  * __unused is a compiler-specific trick which can be used to avoid
75  * warnings about a variable which is defined but never referenced.
76  * Some lpr files use this, so define a null version if it was not
77  * defined by <sys/cdefs.h>.
78  */
79 #if !defined(__unused)
80 #  define       __unused
81 #endif
82
83 /*
84  * All the lpr source files will want to reference __FBSDID() to
85  * handle rcs id's.
86  */
87 #if !defined(__FBSDID)
88 #  if defined(lint) || defined(STRIP_FBSDID)
89 #    define     __FBSDID(s)     struct skip_rcsid_struct
90 #  elif defined(__IDSTRING)                     /* NetBSD */
91 #    define     __FBSDID(s)     __IDSTRING(rcsid,s)
92 #  else
93 #    define     __FBSDID(s)     static const char rcsid[] __unused = s
94 #  endif
95 #endif /* __FBSDID */
96
97 /*
98  * Some lpr include files use __BEGIN_DECLS and __END_DECLS.
99  */
100 #if !defined(__BEGIN_DECLS)
101 #  if defined(__cplusplus)
102 #    define     __BEGIN_DECLS   extern "C" {
103 #    define     __END_DECLS     }
104 #  else
105 #    define     __BEGIN_DECLS
106 #    define     __END_DECLS
107 #  endif
108 #endif
109
110 /*
111  * __printflike and __printf0like are a compiler-specific tricks to
112  * tell the compiler to check the format-codes in printf-like
113  * routines wrt the args that will be formatted.
114  */
115 #if !defined(__printflike)
116 #  define       __printflike(fmtarg, firstvararg)
117 #endif
118 #if !defined(__printf0like)
119 #  define       __printf0like(fmtarg, firstvararg)
120 #endif
121
122 #endif /* !_LP_CDEFS_H_ */