1*3e1db26aSLionel Sambuc /* $NetBSD: sys.h,v 1.17 2011/09/28 14:08:04 christos Exp $ */ 2*3e1db26aSLionel Sambuc 3*3e1db26aSLionel Sambuc /*- 4*3e1db26aSLionel Sambuc * Copyright (c) 1992, 1993 5*3e1db26aSLionel Sambuc * The Regents of the University of California. All rights reserved. 6*3e1db26aSLionel Sambuc * 7*3e1db26aSLionel Sambuc * This code is derived from software contributed to Berkeley by 8*3e1db26aSLionel Sambuc * Christos Zoulas of Cornell University. 9*3e1db26aSLionel Sambuc * 10*3e1db26aSLionel Sambuc * Redistribution and use in source and binary forms, with or without 11*3e1db26aSLionel Sambuc * modification, are permitted provided that the following conditions 12*3e1db26aSLionel Sambuc * are met: 13*3e1db26aSLionel Sambuc * 1. Redistributions of source code must retain the above copyright 14*3e1db26aSLionel Sambuc * notice, this list of conditions and the following disclaimer. 15*3e1db26aSLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 16*3e1db26aSLionel Sambuc * notice, this list of conditions and the following disclaimer in the 17*3e1db26aSLionel Sambuc * documentation and/or other materials provided with the distribution. 18*3e1db26aSLionel Sambuc * 3. Neither the name of the University nor the names of its contributors 19*3e1db26aSLionel Sambuc * may be used to endorse or promote products derived from this software 20*3e1db26aSLionel Sambuc * without specific prior written permission. 21*3e1db26aSLionel Sambuc * 22*3e1db26aSLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23*3e1db26aSLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24*3e1db26aSLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25*3e1db26aSLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26*3e1db26aSLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27*3e1db26aSLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28*3e1db26aSLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29*3e1db26aSLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30*3e1db26aSLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31*3e1db26aSLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32*3e1db26aSLionel Sambuc * SUCH DAMAGE. 33*3e1db26aSLionel Sambuc * 34*3e1db26aSLionel Sambuc * @(#)sys.h 8.1 (Berkeley) 6/4/93 35*3e1db26aSLionel Sambuc */ 36*3e1db26aSLionel Sambuc 37*3e1db26aSLionel Sambuc /* 38*3e1db26aSLionel Sambuc * sys.h: Put all the stupid compiler and system dependencies here... 39*3e1db26aSLionel Sambuc */ 40*3e1db26aSLionel Sambuc #ifndef _h_sys 41*3e1db26aSLionel Sambuc #define _h_sys 42*3e1db26aSLionel Sambuc 43*3e1db26aSLionel Sambuc #ifdef HAVE_SYS_CDEFS_H 44*3e1db26aSLionel Sambuc #include <sys/cdefs.h> 45*3e1db26aSLionel Sambuc #endif 46*3e1db26aSLionel Sambuc 47*3e1db26aSLionel Sambuc #if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) 48*3e1db26aSLionel Sambuc # define __attribute__(A) 49*3e1db26aSLionel Sambuc #endif 50*3e1db26aSLionel Sambuc 51*3e1db26aSLionel Sambuc #ifndef __BEGIN_DECLS 52*3e1db26aSLionel Sambuc # ifdef __cplusplus 53*3e1db26aSLionel Sambuc # define __BEGIN_DECLS extern "C" { 54*3e1db26aSLionel Sambuc # define __END_DECLS } 55*3e1db26aSLionel Sambuc # else 56*3e1db26aSLionel Sambuc # define __BEGIN_DECLS 57*3e1db26aSLionel Sambuc # define __END_DECLS 58*3e1db26aSLionel Sambuc # endif 59*3e1db26aSLionel Sambuc #endif 60*3e1db26aSLionel Sambuc 61*3e1db26aSLionel Sambuc #ifndef public 62*3e1db26aSLionel Sambuc # define public /* Externally visible functions/variables */ 63*3e1db26aSLionel Sambuc #endif 64*3e1db26aSLionel Sambuc 65*3e1db26aSLionel Sambuc #ifndef private 66*3e1db26aSLionel Sambuc # define private static /* Always hidden internals */ 67*3e1db26aSLionel Sambuc #endif 68*3e1db26aSLionel Sambuc 69*3e1db26aSLionel Sambuc #ifndef protected 70*3e1db26aSLionel Sambuc # define protected /* Redefined from elsewhere to "static" */ 71*3e1db26aSLionel Sambuc /* When we want to hide everything */ 72*3e1db26aSLionel Sambuc #endif 73*3e1db26aSLionel Sambuc 74*3e1db26aSLionel Sambuc #ifndef __arraycount 75*3e1db26aSLionel Sambuc # define __arraycount(a) (sizeof(a) / sizeof(*(a))) 76*3e1db26aSLionel Sambuc #endif 77*3e1db26aSLionel Sambuc 78*3e1db26aSLionel Sambuc #include <stdio.h> 79*3e1db26aSLionel Sambuc 80*3e1db26aSLionel Sambuc #ifndef HAVE_STRLCAT 81*3e1db26aSLionel Sambuc #define strlcat libedit_strlcat 82*3e1db26aSLionel Sambuc size_t strlcat(char *dst, const char *src, size_t size); 83*3e1db26aSLionel Sambuc #endif 84*3e1db26aSLionel Sambuc 85*3e1db26aSLionel Sambuc #ifndef HAVE_STRLCPY 86*3e1db26aSLionel Sambuc #define strlcpy libedit_strlcpy 87*3e1db26aSLionel Sambuc size_t strlcpy(char *dst, const char *src, size_t size); 88*3e1db26aSLionel Sambuc #endif 89*3e1db26aSLionel Sambuc 90*3e1db26aSLionel Sambuc #ifndef HAVE_FGETLN 91*3e1db26aSLionel Sambuc #define fgetln libedit_fgetln 92*3e1db26aSLionel Sambuc char *fgetln(FILE *fp, size_t *len); 93*3e1db26aSLionel Sambuc #endif 94*3e1db26aSLionel Sambuc 95*3e1db26aSLionel Sambuc #ifndef HAVE_WCSDUP 96*3e1db26aSLionel Sambuc #include <wchar.h> 97*3e1db26aSLionel Sambuc wchar_t *wcsdup(const wchar_t *); 98*3e1db26aSLionel Sambuc #endif 99*3e1db26aSLionel Sambuc 100*3e1db26aSLionel Sambuc #ifndef _DIAGASSERT 101*3e1db26aSLionel Sambuc #define _DIAGASSERT(x) 102*3e1db26aSLionel Sambuc #endif 103*3e1db26aSLionel Sambuc 104*3e1db26aSLionel Sambuc #ifndef __RCSID 105*3e1db26aSLionel Sambuc #define __RCSID(x) 106*3e1db26aSLionel Sambuc #endif 107*3e1db26aSLionel Sambuc 108*3e1db26aSLionel Sambuc #ifndef HAVE_U_INT32_T 109*3e1db26aSLionel Sambuc typedef unsigned int u_int32_t; 110*3e1db26aSLionel Sambuc #endif 111*3e1db26aSLionel Sambuc 112*3e1db26aSLionel Sambuc #ifndef SIZE_T_MAX 113*3e1db26aSLionel Sambuc #define SIZE_T_MAX ((size_t)-1) 114*3e1db26aSLionel Sambuc #endif 115*3e1db26aSLionel Sambuc 116*3e1db26aSLionel Sambuc #define REGEX /* Use POSIX.2 regular expression functions */ 117*3e1db26aSLionel Sambuc #undef REGEXP /* Use UNIX V8 regular expression functions */ 118*3e1db26aSLionel Sambuc 119*3e1db26aSLionel Sambuc #if defined(__sun) 120*3e1db26aSLionel Sambuc extern int tgetent(char *, const char *); 121*3e1db26aSLionel Sambuc extern int tgetflag(char *); 122*3e1db26aSLionel Sambuc extern int tgetnum(char *); 123*3e1db26aSLionel Sambuc extern int tputs(const char *, int, int (*)(int)); 124*3e1db26aSLionel Sambuc extern char* tgoto(const char*, int, int); 125*3e1db26aSLionel Sambuc extern char* tgetstr(char*, char**); 126*3e1db26aSLionel Sambuc #endif 127*3e1db26aSLionel Sambuc 128*3e1db26aSLionel Sambuc #endif /* _h_sys */ 129