Commit | Line | Data |
---|---|---|
550654be KB |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
ca063491 KB |
3 | * All rights reserved. |
4 | * | |
550654be | 5 | * %sccs.include.redist.c% |
080609df BJ |
6 | */ |
7 | ||
ca063491 | 8 | #if defined(LIBC_SCCS) && !defined(lint) |
46b5f26a | 9 | static char sccsid[] = "@(#)index.c 5.7 (Berkeley) %G%"; |
ca063491 KB |
10 | #endif /* LIBC_SCCS and not lint */ |
11 | ||
46b5f26a | 12 | #include <sys/cdefs.h> |
550654be KB |
13 | #include <string.h> |
14 | #include <stddef.h> | |
080609df BJ |
15 | |
16 | char * | |
f61c2fd8 KB |
17 | #ifdef STRCHR |
18 | strchr(p, ch) | |
19 | #else | |
ca063491 | 20 | index(p, ch) |
f61c2fd8 | 21 | #endif |
46b5f26a | 22 | register const char *p, ch; |
080609df | 23 | { |
ca063491 KB |
24 | for (;; ++p) { |
25 | if (*p == ch) | |
46b5f26a | 26 | return((char *)p); |
ca063491 KB |
27 | if (!*p) |
28 | return((char *)NULL); | |
29 | } | |
30 | /* NOTREACHED */ | |
080609df | 31 | } |