aboutsummaryrefslogtreecommitdiff
path: root/sys/libc/index.c
blob: fa7a4917c6f2214b3921667e9afd908a3abaf2ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}