xref: /netbsd-src/external/gpl2/xcvs/dist/lib/strnlen1.h (revision a7c918477dd5f12c1da816ba05caf44eab2d06d6)
1*a7c91847Schristos /* Find the length of STRING + 1, but scan at most MAXLEN bytes.
2*a7c91847Schristos    Copyright (C) 2005 Free Software Foundation, Inc.
3*a7c91847Schristos 
4*a7c91847Schristos    This program is free software; you can redistribute it and/or modify it
5*a7c91847Schristos    under the terms of the GNU Library General Public License as published
6*a7c91847Schristos    by the Free Software Foundation; either version 2, or (at your option)
7*a7c91847Schristos    any later version.
8*a7c91847Schristos 
9*a7c91847Schristos    This program is distributed in the hope that it will be useful,
10*a7c91847Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*a7c91847Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*a7c91847Schristos    Library General Public License for more details.
13*a7c91847Schristos 
14*a7c91847Schristos    You should have received a copy of the GNU Library General Public
15*a7c91847Schristos    License along with this program; if not, write to the Free Software
16*a7c91847Schristos    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17*a7c91847Schristos    USA.  */
18*a7c91847Schristos 
19*a7c91847Schristos #ifndef _STRNLEN1_H
20*a7c91847Schristos #define _STRNLEN1_H
21*a7c91847Schristos 
22*a7c91847Schristos #include <stddef.h>
23*a7c91847Schristos 
24*a7c91847Schristos 
25*a7c91847Schristos #ifdef __cplusplus
26*a7c91847Schristos extern "C" {
27*a7c91847Schristos #endif
28*a7c91847Schristos 
29*a7c91847Schristos 
30*a7c91847Schristos /* Find the length of STRING + 1, but scan at most MAXLEN bytes.
31*a7c91847Schristos    If no '\0' terminator is found in that many characters, return MAXLEN.  */
32*a7c91847Schristos /* This is the same as strnlen (string, maxlen - 1) + 1.  */
33*a7c91847Schristos extern size_t strnlen1 (const char *string, size_t maxlen);
34*a7c91847Schristos 
35*a7c91847Schristos 
36*a7c91847Schristos #ifdef __cplusplus
37*a7c91847Schristos }
38*a7c91847Schristos #endif
39*a7c91847Schristos 
40*a7c91847Schristos 
41*a7c91847Schristos #endif /* _STRNLEN1_H */
42