112db70c8Szrj /* $NetBSD: sys.h,v 1.27 2016/05/09 21:46:56 christos Exp $ */ 232fe07f8SJohn Marino 332fe07f8SJohn Marino /*- 432fe07f8SJohn Marino * Copyright (c) 1992, 1993 532fe07f8SJohn Marino * The Regents of the University of California. All rights reserved. 632fe07f8SJohn Marino * 732fe07f8SJohn Marino * This code is derived from software contributed to Berkeley by 832fe07f8SJohn Marino * Christos Zoulas of Cornell University. 932fe07f8SJohn Marino * 1032fe07f8SJohn Marino * Redistribution and use in source and binary forms, with or without 1132fe07f8SJohn Marino * modification, are permitted provided that the following conditions 1232fe07f8SJohn Marino * are met: 1332fe07f8SJohn Marino * 1. Redistributions of source code must retain the above copyright 1432fe07f8SJohn Marino * notice, this list of conditions and the following disclaimer. 1532fe07f8SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 1632fe07f8SJohn Marino * notice, this list of conditions and the following disclaimer in the 1732fe07f8SJohn Marino * documentation and/or other materials provided with the distribution. 1832fe07f8SJohn Marino * 3. Neither the name of the University nor the names of its contributors 1932fe07f8SJohn Marino * may be used to endorse or promote products derived from this software 2032fe07f8SJohn Marino * without specific prior written permission. 2132fe07f8SJohn Marino * 2232fe07f8SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2332fe07f8SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2432fe07f8SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2532fe07f8SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2632fe07f8SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2732fe07f8SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2832fe07f8SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2932fe07f8SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3032fe07f8SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3132fe07f8SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3232fe07f8SJohn Marino * SUCH DAMAGE. 3332fe07f8SJohn Marino * 3432fe07f8SJohn Marino * @(#)sys.h 8.1 (Berkeley) 6/4/93 3532fe07f8SJohn Marino */ 3632fe07f8SJohn Marino 3732fe07f8SJohn Marino /* 3832fe07f8SJohn Marino * sys.h: Put all the stupid compiler and system dependencies here... 3932fe07f8SJohn Marino */ 4032fe07f8SJohn Marino #ifndef _h_sys 4132fe07f8SJohn Marino #define _h_sys 4232fe07f8SJohn Marino 43*cdf8408cSAntonio Huete Jimenez #if defined(HAVE_SYS_TYPES_H) && defined(__sun) 44*cdf8408cSAntonio Huete Jimenez #include <sys/types.h> 4532fe07f8SJohn Marino #endif 4632fe07f8SJohn Marino 4732fe07f8SJohn Marino #if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) 4832fe07f8SJohn Marino # define __attribute__(A) 4932fe07f8SJohn Marino #endif 5032fe07f8SJohn Marino 5132fe07f8SJohn Marino #ifndef _DIAGASSERT 5232fe07f8SJohn Marino # define _DIAGASSERT(x) 5332fe07f8SJohn Marino #endif 5432fe07f8SJohn Marino 5532fe07f8SJohn Marino #ifndef __BEGIN_DECLS 5632fe07f8SJohn Marino # ifdef __cplusplus 5732fe07f8SJohn Marino # define __BEGIN_DECLS extern "C" { 5832fe07f8SJohn Marino # define __END_DECLS } 5932fe07f8SJohn Marino # else 6032fe07f8SJohn Marino # define __BEGIN_DECLS 6132fe07f8SJohn Marino # define __END_DECLS 6232fe07f8SJohn Marino # endif 6332fe07f8SJohn Marino #endif 6432fe07f8SJohn Marino 6512db70c8Szrj /* If your compiler does not support this, define it to be empty. */ 6612db70c8Szrj #define libedit_private __attribute__((__visibility__("hidden"))) 6732fe07f8SJohn Marino 6832fe07f8SJohn Marino #ifndef __arraycount 6932fe07f8SJohn Marino # define __arraycount(a) (sizeof(a) / sizeof(*(a))) 7032fe07f8SJohn Marino #endif 7132fe07f8SJohn Marino 7232fe07f8SJohn Marino #ifndef _PTR_T 7332fe07f8SJohn Marino # define _PTR_T 7432fe07f8SJohn Marino typedef void *ptr_t; 7532fe07f8SJohn Marino #endif 7632fe07f8SJohn Marino 7732fe07f8SJohn Marino #ifndef _IOCTL_T 7832fe07f8SJohn Marino # define _IOCTL_T 7932fe07f8SJohn Marino typedef void *ioctl_t; 8032fe07f8SJohn Marino #endif 8132fe07f8SJohn Marino 8232fe07f8SJohn Marino #include <stdio.h> 8332fe07f8SJohn Marino 8432fe07f8SJohn Marino #ifndef HAVE_STRLCAT 85*cdf8408cSAntonio Huete Jimenez //#define strlcat libedit_strlcat 8632fe07f8SJohn Marino size_t strlcat(char *dst, const char *src, size_t size); 8732fe07f8SJohn Marino #endif 8832fe07f8SJohn Marino 8932fe07f8SJohn Marino #ifndef HAVE_STRLCPY 90*cdf8408cSAntonio Huete Jimenez //#define strlcpy libedit_strlcpy 9132fe07f8SJohn Marino size_t strlcpy(char *dst, const char *src, size_t size); 9232fe07f8SJohn Marino #endif 9332fe07f8SJohn Marino 9412db70c8Szrj #ifndef HAVE_GETLINE 95*cdf8408cSAntonio Huete Jimenez //#define getline libedit_getline 9612db70c8Szrj ssize_t getline(char **line, size_t *len, FILE *fp); 9732fe07f8SJohn Marino #endif 9832fe07f8SJohn Marino 99*cdf8408cSAntonio Huete Jimenez #ifndef HAVE_HAVE_REALLOCARR 100*cdf8408cSAntonio Huete Jimenez int reallocarr(void *ptr, size_t number, size_t size); 101*cdf8408cSAntonio Huete Jimenez #endif 102*cdf8408cSAntonio Huete Jimenez 103*cdf8408cSAntonio Huete Jimenez #ifndef HAVE_WCSDUP 104*cdf8408cSAntonio Huete Jimenez wchar_t * wcsdup(const wchar_t *str); 105*cdf8408cSAntonio Huete Jimenez #endif 106*cdf8408cSAntonio Huete Jimenez 10732fe07f8SJohn Marino #ifndef _DIAGASSERT 10832fe07f8SJohn Marino #define _DIAGASSERT(x) 10932fe07f8SJohn Marino #endif 11032fe07f8SJohn Marino 11132fe07f8SJohn Marino #ifndef __RCSID 11232fe07f8SJohn Marino #define __RCSID(x) 11332fe07f8SJohn Marino #endif 11432fe07f8SJohn Marino 11532fe07f8SJohn Marino #ifndef HAVE_U_INT32_T 11632fe07f8SJohn Marino typedef unsigned int u_int32_t; 11732fe07f8SJohn Marino #endif 11832fe07f8SJohn Marino 11932fe07f8SJohn Marino #define REGEX /* Use POSIX.2 regular expression functions */ 12032fe07f8SJohn Marino #undef REGEXP /* Use UNIX V8 regular expression functions */ 12132fe07f8SJohn Marino 12232fe07f8SJohn Marino #if defined(__sun) 12332fe07f8SJohn Marino extern int tgetent(char *, const char *); 12432fe07f8SJohn Marino extern int tgetflag(char *); 12532fe07f8SJohn Marino extern int tgetnum(char *); 12632fe07f8SJohn Marino extern int tputs(const char *, int, int (*)(int)); 12732fe07f8SJohn Marino extern char* tgoto(const char*, int, int); 12832fe07f8SJohn Marino extern char* tgetstr(char*, char**); 12932fe07f8SJohn Marino #endif 13032fe07f8SJohn Marino 13132fe07f8SJohn Marino #endif /* _h_sys */ 132