disable debug.
[AROS.git] / compiler / stdc / strnlen.c
blob2eadccbec4a3756e6972b98ce1d201ecd8e8f56c
1 /*
2 Copyright © 2015, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function strnlen().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 size_t strnlen (
15 /* SYNOPSIS */
16 const char * ptr, size_t n)
18 /* FUNCTION
19 Calculate the length of a string (without the terminating 0 byte).
21 INPUTS
22 ptr - The string to get its length for
23 n - The max length
25 RESULT
26 The length of the string.
28 NOTES
30 EXAMPLE
32 BUGS
34 SEE ALSO
36 INTERNALS
38 ******************************************************************************/
40 const char * start = ptr;
42 while (*ptr && n)
44 ptr ++;
45 n--;
48 return (((long)ptr) - ((long)start));
49 } /* strnlen */