Add memchr()

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4989 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-07-28 20:45:29 +00:00
parent 10364c669f
commit 1b70837411
5 changed files with 110 additions and 19 deletions
+17 -8
View File
@@ -1,8 +1,8 @@
/****************************************************************************
* lib/string/lib_strchr.c
*
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -45,11 +45,21 @@
* Global Functions
****************************************************************************/
/* The strchr() function returns a pointer to the first
* occurrence of the character c in the string s.
*/
/****************************************************************************
* Name: strchr
*
* Description:
* The strchr() function locates the first occurrence of 'c' (converted to
* a char) in the string pointed to by 's'. The terminating null byte is
* considered to be part of the string.
*
* Returned Value:
* Upon completion, strchr() returns a pointer to the byte, or a null
* pointer if the byte was not found.
*
****************************************************************************/
char *strchr(const char *s, int c)
FAR char *strchr(FAR const char *s, int c)
{
if (s)
{
@@ -57,11 +67,10 @@ char *strchr(const char *s, int c)
{
if (*s == c)
{
return (char*)s;
return (FAR char *)s;
}
}
}
return NULL;
}