1313981Spfg/* $NetBSD: sys.h,v 1.23 2016/02/17 19:47:49 christos Exp $ */ 2276881Sbapt 31573Srgrimes/*- 41573Srgrimes * Copyright (c) 1992, 1993 51573Srgrimes * The Regents of the University of California. All rights reserved. 61573Srgrimes * 71573Srgrimes * This code is derived from software contributed to Berkeley by 81573Srgrimes * Christos Zoulas of Cornell University. 91573Srgrimes * 101573Srgrimes * Redistribution and use in source and binary forms, with or without 111573Srgrimes * modification, are permitted provided that the following conditions 121573Srgrimes * are met: 131573Srgrimes * 1. Redistributions of source code must retain the above copyright 141573Srgrimes * notice, this list of conditions and the following disclaimer. 151573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 161573Srgrimes * notice, this list of conditions and the following disclaimer in the 171573Srgrimes * documentation and/or other materials provided with the distribution. 18148834Sstefanf * 3. Neither the name of the University nor the names of its contributors 191573Srgrimes * may be used to endorse or promote products derived from this software 201573Srgrimes * without specific prior written permission. 211573Srgrimes * 221573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231573Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241573Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251573Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261573Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271573Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281573Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291573Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301573Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311573Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321573Srgrimes * SUCH DAMAGE. 331573Srgrimes * 341573Srgrimes * @(#)sys.h 8.1 (Berkeley) 6/4/93 3584260Sobrien * $FreeBSD: stable/11/lib/libedit/sys.h 313981 2017-02-20 03:33:59Z pfg $ 361573Srgrimes */ 371573Srgrimes 381573Srgrimes/* 391573Srgrimes * sys.h: Put all the stupid compiler and system dependencies here... 401573Srgrimes */ 411573Srgrimes#ifndef _h_sys 4284260Sobrien#define _h_sys 431573Srgrimes 44276881Sbapt#ifdef HAVE_SYS_CDEFS_H 45148924Sstefanf#include <sys/cdefs.h> 46276881Sbapt#endif 47148924Sstefanf 48276881Sbapt#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) 49276881Sbapt# define __attribute__(A) 50276881Sbapt#endif 51276881Sbapt 52276881Sbapt#ifndef __BEGIN_DECLS 53276881Sbapt# ifdef __cplusplus 54276881Sbapt# define __BEGIN_DECLS extern "C" { 55276881Sbapt# define __END_DECLS } 56276881Sbapt# else 57276881Sbapt# define __BEGIN_DECLS 58276881Sbapt# define __END_DECLS 59276881Sbapt# endif 60276881Sbapt#endif 61313981Spfg 621573Srgrimes#ifndef public 631573Srgrimes# define public /* Externally visible functions/variables */ 641573Srgrimes#endif 651573Srgrimes 661573Srgrimes#ifndef private 671573Srgrimes# define private static /* Always hidden internals */ 681573Srgrimes#endif 691573Srgrimes 701573Srgrimes#ifndef protected 711573Srgrimes# define protected /* Redefined from elsewhere to "static" */ 721573Srgrimes /* When we want to hide everything */ 731573Srgrimes#endif 741573Srgrimes 75276881Sbapt#ifndef __arraycount 76276881Sbapt# define __arraycount(a) (sizeof(a) / sizeof(*(a))) 771573Srgrimes#endif 781573Srgrimes 79276881Sbapt#include <stdio.h> 80276881Sbapt 81276881Sbapt#ifndef HAVE_STRLCAT 82276881Sbapt#define strlcat libedit_strlcat 83276881Sbaptsize_t strlcat(char *dst, const char *src, size_t size); 841573Srgrimes#endif 851573Srgrimes 86276881Sbapt#ifndef HAVE_STRLCPY 87276881Sbapt#define strlcpy libedit_strlcpy 88276881Sbaptsize_t strlcpy(char *dst, const char *src, size_t size); 89276881Sbapt#endif 901573Srgrimes 91313981Spfg#ifndef HAVE_GETLINE 92313981Spfg#define getline libedit_getline 93313981Spfgssize_t getline(char **line, size_t *len, FILE *fp); 94276881Sbapt#endif 95276881Sbapt 96276881Sbapt#ifndef _DIAGASSERT 97276881Sbapt#define _DIAGASSERT(x) 98276881Sbapt#endif 99276881Sbapt 100276881Sbapt#ifndef __RCSID 101276881Sbapt#define __RCSID(x) 102276881Sbapt#endif 103276881Sbapt 104276881Sbapt#ifndef HAVE_U_INT32_T 105276881Sbapttypedef unsigned int u_int32_t; 106276881Sbapt#endif 107276881Sbapt 108313981Spfg#ifndef HAVE_SIZE_MAX 109313981Spfg#define SIZE_MAX ((size_t)-1) 110276881Sbapt#endif 111276881Sbapt 11284260Sobrien#define REGEX /* Use POSIX.2 regular expression functions */ 11384260Sobrien#undef REGEXP /* Use UNIX V8 regular expression functions */ 11484260Sobrien 115313981Spfg#ifndef WIDECHAR 116313981Spfg#define setlocale(c, l) /*LINTED*/NULL 117313981Spfg#define nl_langinfo(i) "" 118313981Spfg#endif 119313981Spfg 120268502Spfg#if defined(__sun) 121268502Spfgextern int tgetent(char *, const char *); 122268502Spfgextern int tgetflag(char *); 123268502Spfgextern int tgetnum(char *); 124268502Spfgextern int tputs(const char *, int, int (*)(int)); 125268502Spfgextern char* tgoto(const char*, int, int); 126268502Spfgextern char* tgetstr(char*, char**); 127268502Spfg#endif 128268502Spfg 1291573Srgrimes#endif /* _h_sys */ 130