1*e19355d0Sriastradh /* $NetBSD: strings.h,v 1.21 2024/11/01 18:52:29 riastradh Exp $ */ 24d2cbfceScgd 361f28255Scgd /*- 47d9fe293Skleink * Copyright (c) 1998 The NetBSD Foundation, Inc. 561f28255Scgd * All rights reserved. 661f28255Scgd * 77d9fe293Skleink * This code is derived from software contributed to The NetBSD Foundation 87d9fe293Skleink * by Klaus Klein. 97d9fe293Skleink * 1061f28255Scgd * Redistribution and use in source and binary forms, with or without 1161f28255Scgd * modification, are permitted provided that the following conditions 1261f28255Scgd * are met: 1361f28255Scgd * 1. Redistributions of source code must retain the above copyright 1461f28255Scgd * notice, this list of conditions and the following disclaimer. 1561f28255Scgd * 2. Redistributions in binary form must reproduce the above copyright 1661f28255Scgd * notice, this list of conditions and the following disclaimer in the 1761f28255Scgd * documentation and/or other materials provided with the distribution. 1861f28255Scgd * 197d9fe293Skleink * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 207d9fe293Skleink * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 217d9fe293Skleink * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 227d9fe293Skleink * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 237d9fe293Skleink * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 247d9fe293Skleink * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 257d9fe293Skleink * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 267d9fe293Skleink * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 277d9fe293Skleink * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 287d9fe293Skleink * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 297d9fe293Skleink * POSSIBILITY OF SUCH DAMAGE. 3061f28255Scgd */ 3161f28255Scgd 327d9fe293Skleink #ifndef _STRINGS_H_ 337d9fe293Skleink #define _STRINGS_H_ 347d9fe293Skleink 357d9fe293Skleink #include <machine/ansi.h> 36f991579dSkleink #include <sys/featuretest.h> 377d9fe293Skleink 387d9fe293Skleink #ifdef _BSD_SIZE_T_ 397d9fe293Skleink typedef _BSD_SIZE_T_ size_t; 407d9fe293Skleink #undef _BSD_SIZE_T_ 417d9fe293Skleink #endif 427d9fe293Skleink 434be7a2dcSbjh21 #if defined(_NETBSD_SOURCE) 441bba558eSkleink #include <sys/null.h> 45f991579dSkleink #endif 467d9fe293Skleink 477d9fe293Skleink #include <sys/cdefs.h> 487d9fe293Skleink 49112cae6fSdholland #include <machine/int_types.h> 500578c2adSjoerg 517d9fe293Skleink __BEGIN_DECLS 52235f3e57Sriastradh #if defined(_NETBSD_SOURCE) || \ 53*e19355d0Sriastradh (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE - 0 < 700) 5419b7469aSperry int bcmp(const void *, const void *, size_t); 5519b7469aSperry void bcopy(const void *, void *, size_t); 5619b7469aSperry void bzero(void *, size_t); 57235f3e57Sriastradh #endif 58ae7ade48Sriastradh #if defined(_NETBSD_SOURCE) || _XOPEN_SOURCE - 0 >= 600 59235f3e57Sriastradh int ffs(int) __constfunc; 60235f3e57Sriastradh #endif 61235f3e57Sriastradh #if defined(_NETBSD_SOURCE) || _XOPEN_SOURCE - 0 >= 800 62235f3e57Sriastradh int ffsl(long) __constfunc; 63235f3e57Sriastradh int ffsll(long long) __constfunc; 64235f3e57Sriastradh #endif 65235f3e57Sriastradh #ifdef _NETBSD_SOURCE 66974b291aSjoerg unsigned int popcount(unsigned int) __constfunc; 67974b291aSjoerg unsigned int popcountl(unsigned long) __constfunc; 68974b291aSjoerg unsigned int popcountll(unsigned long long) __constfunc; 69112cae6fSdholland unsigned int popcount32(__uint32_t) __constfunc; 70112cae6fSdholland unsigned int popcount64(__uint64_t) __constfunc; 71235f3e57Sriastradh #endif 72235f3e57Sriastradh #if defined(_NETBSD_SOURCE) || \ 73*e19355d0Sriastradh (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE - 0 < 700) 74235f3e57Sriastradh char *index(const char *, int); 7519b7469aSperry char *rindex(const char *, int); 76235f3e57Sriastradh #endif 7719b7469aSperry int strcasecmp(const char *, const char *); 7819b7469aSperry int strncasecmp(const char *, const char *, size_t); 797d9fe293Skleink __END_DECLS 807d9fe293Skleink 814be7a2dcSbjh21 #if defined(_NETBSD_SOURCE) 82af3e9a71Skleink #include <string.h> 83af3e9a71Skleink #endif 84af3e9a71Skleink 851ef79ebcSkristerw #if _FORTIFY_SOURCE > 0 86dc99372bStls #include <ssp/strings.h> 871ef79ebcSkristerw #endif 887d9fe293Skleink #endif /* !defined(_STRINGS_H_) */ 89