]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/strnlen.3
Automated addition of parentheses by add_parens_for_own_funcs.sh
[thirdparty/man-pages.git] / man3 / strnlen.3
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
7 .\"
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\"
11 .TH STRNLEN 3 1999-07-25 "GNU" "Linux Programmer's Manual"
12 .SH NAME
13 strnlen \- determine the length of a fixed-size string
14 .SH SYNOPSIS
15 .nf
16 .B #define _GNU_SOURCE
17 .sp
18 .B #include <string.h>
19 .sp
20 .BI "size_t strnlen(const char *" s ", size_t " maxlen );
21 .fi
22 .SH DESCRIPTION
23 The \fBstrnlen\fP() function returns the number of characters in the string
24 pointed to by \fIs\fP, not including the terminating '\\0' character, but
25 at most \fImaxlen\fP. In doing this, \fBstrnlen\fP() looks only at the first
26 \fImaxlen\fP characters at \fIs\fP and never beyond \fIs+maxlen\fP.
27 .SH "RETURN VALUE"
28 The \fBstrnlen\fP() function returns \fIstrlen(s)\fP, if that is less than
29 \fImaxlen\fP, or \fImaxlen\fP if there is no '\\0' character among the first
30 \fImaxlen\fP characters pointed to by \fIs\fP.
31 .SH "CONFORMING TO"
32 This function is a GNU extension.
33 .SH "SEE ALSO"
34 .BR strlen (3)