sys.h revision 12e21689bc88a77c7b5b9b220fec31e049e5ec0f
1e3365aa452673f7ea3244bb6638551f13ab7570dNick Lewycky/* $NetBSD: sys.h,v 1.17 2011/09/28 14:08:04 christos Exp $ */ 23ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 33ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar/*- 43ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar * Copyright (c) 1992, 1993 53ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar * The Regents of the University of California. All rights reserved. 63ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar * 73ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar * This code is derived from software contributed to Berkeley by 83ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar * Christos Zoulas of Cornell University. 93ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar * 103ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar * Redistribution and use in source and binary forms, with or without 1155fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth * modification, are permitted provided that the following conditions 1255fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth * are met: 1355fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth * 1. Redistributions of source code must retain the above copyright 1453ec55215075c8f4ddd47ca6ed7d382f16beb670Daniel Dunbar * notice, this list of conditions and the following disclaimer. 151b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar * 2. Redistributions in binary form must reproduce the above copyright 161b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar * notice, this list of conditions and the following disclaimer in the 171b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar * documentation and/or other materials provided with the distribution. 184ad4b3ebbe5769143389dccfcfadb666a4ba5940Daniel Dunbar * 3. Neither the name of the University nor the names of its contributors 19f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar * may be used to endorse or promote products derived from this software 2027e738d0d3f781672a5999d2a9e2827b00a97d0cDaniel Dunbar * without specific prior written permission. 210648262df75d97b464c2be0ed867da3615659785Daniel Dunbar * 221b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24f353c8cc2ee1cc16ff194b399a8d951f707fb129Daniel Dunbar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 257f9fc3f7ce076645cb6aefc99c64d9446caf13d6Chris Lattner * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 264d7b14734f2285695dcec347f8718b512093390aTed Kremenek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2755fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28548f6c8e8010b181cb151df92f0a989363cb993eDavid Blaikie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29256053b31e697fdf0cc48f17d621c82fc3b8dff0Michael J. Spencer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3003013fa9a0bf1ef4b907f5fec006c8f4000fdd21Michael J. Spencer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3155fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3203013fa9a0bf1ef4b907f5fec006c8f4000fdd21Michael J. Spencer * SUCH DAMAGE. 3355fc873017f10f6f566b182b70f6fc22aefa3464Chandler Carruth * 34f2462be34a49e2108c9b4151f8e6d3fe1b916179Dylan Noblesmith * @(#)sys.h 8.1 (Berkeley) 6/4/93 3569d3b4f7c9fa818d2536b4f1b220b942ae392128Dylan Noblesmith */ 3688a8fa366e1a76507ae2212f9c3f110df865c3a5NAKAMURA Takumi 3788a8fa366e1a76507ae2212f9c3f110df865c3a5NAKAMURA Takumi/* 3888a8fa366e1a76507ae2212f9c3f110df865c3a5NAKAMURA Takumi * sys.h: Put all the stupid compiler and system dependencies here... 3988a8fa366e1a76507ae2212f9c3f110df865c3a5NAKAMURA Takumi */ 401b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar#ifndef _h_sys 4192b369928b8e9ad156fb6eec2bf9f21d657bd69bChris Lattner#define _h_sys 421b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar 435f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner#ifdef HAVE_SYS_CDEFS_H 449606a57b6f2c43bf438a958fdffea1de60f6b2b7Sebastian Pop#include <sys/cdefs.h> 455f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner#endif 46d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie 477e46d0b8436d844d77f3ff580b6e1204e0407044Nick Lewycky#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) 484762a2da74875d2ae94e0d77d38ed964816cce36Sebastian Pop# define __attribute__(A) 494762a2da74875d2ae94e0d77d38ed964816cce36Sebastian Pop#endif 50abac441b7d114d5980864093ee0643bf68f1a8f2Chad Rosier 516f85b1e7906f7a03cbede1f730ba19b28a5f85e8Bob Wilson#ifndef _DIAGASSERT 52c8a22b091677c02003880166e5d5767ca8d74b70Daniel Dunbar# define _DIAGASSERT(x) 53c8a22b091677c02003880166e5d5767ca8d74b70Daniel Dunbar#endif 54951c5705771a57eca0bca07aae5d4738619dd6c6Joerg Sonnenberger 55c8a22b091677c02003880166e5d5767ca8d74b70Daniel Dunbar#ifndef __BEGIN_DECLS 562b81910618f63e4ce2373c926a26e76b4b91373fChad Rosier# ifdef __cplusplus 5764c4f29ff3b98d412e0235504364096e997b04bbBob Wilson# define __BEGIN_DECLS extern "C" { 58225c41706dc0f3682236e351820d339e14390e00Daniel Dunbar# define __END_DECLS } 59d5b08bee799d4f77f1a25fa5977ca77b983ab031Michael J. Spencer# else 60d5b08bee799d4f77f1a25fa5977ca77b983ab031Michael J. Spencer# define __BEGIN_DECLS 610bbad519aa068206f1e158d5073f72a39fbe83c5Daniel Dunbar# define __END_DECLS 62225c41706dc0f3682236e351820d339e14390e00Daniel Dunbar# endif 635f9e272e632e951b1efe824cd16acb4d96077930Chris Lattner#endif 64f7ccbad5d9949e7ddd1cbef43d482553b811e026Dylan Noblesmith 65d5b08bee799d4f77f1a25fa5977ca77b983ab031Michael J. Spencer#ifndef public 66d5b08bee799d4f77f1a25fa5977ca77b983ab031Michael J. Spencer# define public /* Externally visible functions/variables */ 67d5b08bee799d4f77f1a25fa5977ca77b983ab031Michael J. Spencer#endif 68d5b08bee799d4f77f1a25fa5977ca77b983ab031Michael J. Spencer 69225c41706dc0f3682236e351820d339e14390e00Daniel Dunbar#ifndef private 703ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar# define private static /* Always hidden internals */ 713ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar#endif 723ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar 731b3bb6efc59a21f794b534078f9ae7e95393f510Daniel Dunbar#ifndef protected 7418d7f3af752c41a197552a1ff25ddd639224b4bbChandler Carruth# define protected /* Redefined from elsewhere to "static" */ 7518d7f3af752c41a197552a1ff25ddd639224b4bbChandler Carruth /* When we want to hide everything */ 7618d7f3af752c41a197552a1ff25ddd639224b4bbChandler Carruth#endif 7718d7f3af752c41a197552a1ff25ddd639224b4bbChandler Carruth 7818d7f3af752c41a197552a1ff25ddd639224b4bbChandler Carruth#ifndef __arraycount 793ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar# define __arraycount(a) (sizeof(a) / sizeof(*(a))) 803ede8d0a7d1813f678ccc6011a99a0834b1b6116Daniel Dunbar#endif 812d3ba4f5a923a90c3fc290ddfba5e36c2d0a9b46Chris Lattner 828f25c79e59d88df41c5a3cabba1c58035d384a6eDaniel Dunbar#ifndef _PTR_T 83847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar# define _PTR_T 847f9fc3f7ce076645cb6aefc99c64d9446caf13d6Chris Lattnertypedef void *ptr_t; 85847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar#endif 86847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar 87847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar#ifndef _IOCTL_T 88847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar# define _IOCTL_T 89847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbartypedef void *ioctl_t; 90847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar#endif 91847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar 92847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar#include <stdio.h> 93847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar 94847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar#ifndef HAVE_STRLCAT 95847abaa62883b6c20005bdd3346ebbd44e46dbacDaniel Dunbar#define strlcat libedit_strlcat 9691e06dab9335ed6b4474a74353549c708cf3d936Michael J. Spencersize_t strlcat(char *dst, const char *src, size_t size); 97b0c4df5c4df69a003f26b378eb95961bc7c486e5Daniel Dunbar#endif 98b0c4df5c4df69a003f26b378eb95961bc7c486e5Daniel Dunbar 99b0c4df5c4df69a003f26b378eb95961bc7c486e5Daniel Dunbar#ifndef HAVE_STRLCPY 1002dd17a15ddc0184790d790b6128d79ffddae4964Chad Rosier#define strlcpy libedit_strlcpy 1012dd17a15ddc0184790d790b6128d79ffddae4964Chad Rosiersize_t strlcpy(char *dst, const char *src, size_t size); 1026467c9bf4f07f54789d3ed902f04048f4d80ad47Chad Rosier#endif 1032dd17a15ddc0184790d790b6128d79ffddae4964Chad Rosier 1046467c9bf4f07f54789d3ed902f04048f4d80ad47Chad Rosier#ifndef HAVE_FGETLN 1056467c9bf4f07f54789d3ed902f04048f4d80ad47Chad Rosier#define fgetln libedit_fgetln 1062dd17a15ddc0184790d790b6128d79ffddae4964Chad Rosierchar *fgetln(FILE *fp, size_t *len); 1070648262df75d97b464c2be0ed867da3615659785Daniel Dunbar#endif 1080648262df75d97b464c2be0ed867da3615659785Daniel Dunbar 1090648262df75d97b464c2be0ed867da3615659785Daniel Dunbar#ifndef HAVE_WCSDUP 1100648262df75d97b464c2be0ed867da3615659785Daniel Dunbar#include <wchar.h> 1110648262df75d97b464c2be0ed867da3615659785Daniel Dunbarwchar_t *wcsdup(const wchar_t *); 1121fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#endif 1131fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier 1141fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#ifndef _DIAGASSERT 1151fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#define _DIAGASSERT(x) 1161fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#endif 1171fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier 1181fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#ifndef __RCSID 11959f9b26bcb59bfb4d66c6ea129172795dcd1cb6bEric Christopher#define __RCSID(x) 1201fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#endif 1211fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier 1221fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#ifndef HAVE_U_INT32_T 1231fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosiertypedef unsigned int u_int32_t; 1241fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#endif 12559f9b26bcb59bfb4d66c6ea129172795dcd1cb6bEric Christopher 1261fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#ifndef SIZE_T_MAX 1271fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#define SIZE_T_MAX ((size_t)-1) 1281fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#endif 129582b395ea4d5dfe353e2132a470d39efe2f84a54Fariborz Jahanian 13030660a898545416f0fea2d717f16f75640001e38Ted Kremenek#define REGEX /* Use POSIX.2 regular expression functions */ 1311fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#undef REGEXP /* Use UNIX V8 regular expression functions */ 13253cb2b47596b0ca893a449fa81e0912ded658759Chad Rosier 1331fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#if defined(__sun) 1341fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosierextern int tgetent(char *, const char *); 1351fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosierextern int tgetflag(char *); 1361fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosierextern int tgetnum(char *); 1371fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosierextern int tputs(const char *, int, int (*)(int)); 1381fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosierextern char* tgoto(const char*, int, int); 1391fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosierextern char* tgetstr(char*, char**); 1401fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#endif 1411fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier 1421fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier#endif /* _h_sys */ 1431fc1de48cdf9a2f241e0f2c7b9e9db2322f1b794Chad Rosier