summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strnlen.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2012-07-13 17:49:56 +0000
committercvs2svn <admin@example.com>2012-07-13 17:49:56 +0000
commit6f82d0e8f9756938f04071892206a5af85e676f0 (patch)
tree821921a1dd0a5a3cece91121e121cc63c4b68128 /src/lib/libc/string/strnlen.c
parent9204e59073bcf27e1487ec4ac46e981902ddd904 (diff)
downloadopenbsd-eric_g2k12.tar.gz
openbsd-eric_g2k12.tar.bz2
openbsd-eric_g2k12.zip
This commit was manufactured by cvs2git to create tag 'eric_g2k12'.eric_g2k12
Diffstat (limited to 'src/lib/libc/string/strnlen.c')
-rw-r--r--src/lib/libc/string/strnlen.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/lib/libc/string/strnlen.c b/src/lib/libc/string/strnlen.c
deleted file mode 100644
index a5e13ae04e..0000000000
--- a/src/lib/libc/string/strnlen.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/* $OpenBSD: strnlen.c,v 1.4 2012/04/26 01:22:31 matthew Exp $ */
2
3/*
4 * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <sys/types.h>
20
21#if !defined(_KERNEL) && !defined(_STANDALONE)
22#include <string.h>
23#else
24#include <lib/libkern/libkern.h>
25#endif
26
27size_t
28strnlen(const char *str, size_t maxlen)
29{
30 const char *cp;
31
32 for (cp = str; maxlen != 0 && *cp != '\0'; cp++, maxlen--)
33 ;
34
35 return (size_t)(cp - str);
36}