dafs-20060317
[openafs.git] / src / util / strnlen.c
1 /*
2  * Copyright 2006, Sine Nomine Associates and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* strnlen.c - fixed length string length */
11
12 #include <afsconfig.h>
13 #include <afs/param.h>
14
15 RCSID
16     ("$Header$");
17
18 #include <sys/types.h>
19 #include <stdarg.h>
20 #include <ctype.h>
21
22
23 size_t
24 afs_strnlen(char * buf, size_t len)
25 {
26     size_t i;
27
28     for (i = 0; i < len; i++) {
29         if (buf[i] == '\0')
30             break;
31     }
32
33     return i;
34 }
35