summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/libiberty/strchr.c
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1998-03-01 22:58:51 +0000
committerjdp <jdp@FreeBSD.org>1998-03-01 22:58:51 +0000
commit2cbd0590cd191c81b59e94970f4c40c371f9e415 (patch)
treeb7676f996414b979dcbb7de92a3e86b97320d023 /contrib/binutils/libiberty/strchr.c
downloadFreeBSD-src-2cbd0590cd191c81b59e94970f4c40c371f9e415.zip
FreeBSD-src-2cbd0590cd191c81b59e94970f4c40c371f9e415.tar.gz
Initial import of GNU binutils version 2.8.1. Believe it or not,
this is heavily stripped down.
Diffstat (limited to 'contrib/binutils/libiberty/strchr.c')
-rw-r--r--contrib/binutils/libiberty/strchr.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/contrib/binutils/libiberty/strchr.c b/contrib/binutils/libiberty/strchr.c
new file mode 100644
index 0000000..22976ce
--- /dev/null
+++ b/contrib/binutils/libiberty/strchr.c
@@ -0,0 +1,34 @@
+/* Portable version of strchr()
+ This function is in the public domain. */
+
+/*
+NAME
+ strchr -- return pointer to first occurance of a character
+
+SYNOPSIS
+ char *strchr (const char *s, int c)
+
+DESCRIPTION
+ Returns a pointer to the first occurance of character C in
+ string S, or a NULL pointer if no occurance is found.
+
+BUGS
+ Behavior when character is the null character is implementation
+ dependent.
+*/
+
+#include <ansidecl.h>
+
+char *
+strchr (s, c)
+ register CONST char *s;
+ int c;
+{
+ do {
+ if (*s == c)
+ {
+ return (char*)s;
+ }
+ } while (*s++);
+ return (0);
+}
OpenPOWER on IntegriCloud