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