Windows: Use secure ctime and strncpy in afs_ctime
[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
16 #include <sys/types.h>
17 #include <stdarg.h>
18 #include <ctype.h>
19
20
21 size_t
22 afs_strnlen(char * buf, size_t len)
23 {
24     size_t i;
25
26     for (i = 0; i < len; i++) {
27         if (buf[i] == '\0')
28             break;
29     }
30
31     return i;
32 }
33