aboutsummaryrefslogtreecommitdiff
path: root/compat/strchrnul.c
diff options
context:
space:
mode:
authorAlan Brault <alan.brault@incruentatus.net>2011-05-03 09:28:09 -0400
committerAlan Brault <alan.brault@incruentatus.net>2011-05-03 09:28:09 -0400
commitb608b55786a8cecf626d7c489496ac402098b198 (patch)
treec72a75af776d41cb21ce64de6b843bae4020eab1 /compat/strchrnul.c
parent647e4ca02ad06939dea2e6b1dcf71ee510867cd4 (diff)
downloadduser-b608b55786a8cecf626d7c489496ac402098b198.tar.gz
Clean up compat, bring in strcasestr from OpenBSD and strchrnul from uclibc
and separate the headers.
Diffstat (limited to 'compat/strchrnul.c')
-rw-r--r--compat/strchrnul.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/compat/strchrnul.c b/compat/strchrnul.c
index ffc4f85..4781281 100644
--- a/compat/strchrnul.c
+++ b/compat/strchrnul.c
@@ -18,9 +18,9 @@
* along with duser. If not, see <http://www.gnu.org/licenses/>.
**/
-#include <stdio.h>
+#include <config.h>
#include <string.h>
-#include <ctype.h>
+#include "strchrnul.h"
/*
* Locate a char in a string
@@ -35,10 +35,12 @@
* if c is not found in s, then it returns a pointer to the
* null byte at the end of s, rather than NULL.
*/
-char *strchrnul(const char* s, int c)
+char *
+strchrnul (const char *s, int c_in)
{
- while(*s && *s != c)
- {
- s++;
- }
+ char c = c_in;
+ while (*s && (*s != c))
+ s++;
+
+ return (char *) s;
}