aboutsummaryrefslogtreecommitdiff
path: root/sys/libc/index.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/libc/index.c')
-rw-r--r--sys/libc/index.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/libc/index.c b/sys/libc/index.c
new file mode 100644
index 00000000..fa7a4917
--- /dev/null
+++ b/sys/libc/index.c
@@ -0,0 +1,26 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+*/
+
+#define import_libc
+#define import_spp
+#include <iraf.h>
+
+
+/* INDEX -- Search string STR for char CH, returning a pointer to the first
+** occurrence of CH in STR or NULL.
+*/
+char *
+index (
+ char *str, /* string to be searched */
+ int ch /* character we are searching for */
+)
+{
+ register char *ip = str;
+
+ do {
+ if (*ip == ch)
+ return (ip);
+ } while (*ip++);
+
+ return ((char *) NULL);
+}