diff options
| author | David S. Miller <davem@kernel.bkbits.net> | 2004-02-06 00:57:55 -0800 |
|---|---|---|
| committer | David S. Miller <davem@kernel.bkbits.net> | 2004-02-06 00:57:55 -0800 |
| commit | 39c09b95dabcbdbb7c2e35ad5a9fbf6aaac202a9 (patch) | |
| tree | 128ce6c648fbd3269d0889a7f532c5526f34b646 /lib/string.c | |
| parent | d925eab60387b18a46b036d8812c0b2166a70332 (diff) | |
| parent | 7a98480512254fa9e9f029aaeca21be1aeb5fc28 (diff) | |
Merge davem@nuts.davemloft.net:/disk1/BK/net-2.6
into kernel.bkbits.net:/home/davem/net-2.6
Diffstat (limited to 'lib/string.c')
| -rw-r--r-- | lib/string.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c index e660de079a57..d2f23f2c1e69 100644 --- a/lib/string.c +++ b/lib/string.c @@ -273,6 +273,22 @@ char * strrchr(const char * s, int c) } #endif +#ifndef __HAVE_ARCH_STRNCHR +/** + * strnchr - Find a character in a length limited string + * @s: The string to be searched + * @count: The number of characters to be searched + * @c: The character to search for + */ +char *strnchr(const char *s, size_t count, int c) +{ + for (; count-- && *s != '\0'; ++s) + if (*s == (char) c) + return (char *) s; + return NULL; +} +#endif + #ifndef __HAVE_ARCH_STRLEN /** * strlen - Find the length of a string |
