index.c revision 16175
116175Snate/*- 216175Snate * Copyright (c) 1990, 1993 316175Snate * The Regents of the University of California. All rights reserved. 416175Snate * 516175Snate * Redistribution and use in source and binary forms, with or without 616175Snate * modification, are permitted provided that the following conditions 716175Snate * are met: 816175Snate * 1. Redistributions of source code must retain the above copyright 916175Snate * notice, this list of conditions and the following disclaimer. 1016175Snate * 2. Redistributions in binary form must reproduce the above copyright 1116175Snate * notice, this list of conditions and the following disclaimer in the 1216175Snate * documentation and/or other materials provided with the distribution. 1316175Snate * 3. All advertising materials mentioning features or use of this software 1416175Snate * must display the following acknowledgement: 1516175Snate * This product includes software developed by the University of 1616175Snate * California, Berkeley and its contributors. 1716175Snate * 4. Neither the name of the University nor the names of its contributors 1816175Snate * may be used to endorse or promote products derived from this software 1916175Snate * without specific prior written permission. 2016175Snate * 2116175Snate * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2216175Snate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2316175Snate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2416175Snate * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2516175Snate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2616175Snate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2716175Snate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2816175Snate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2916175Snate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3016175Snate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3116175Snate * SUCH DAMAGE. 3216175Snate * 3316175Snate * $Id$ 3416175Snate */ 3516175Snate 3616175Snate#include <string.h> 3716175Snate 3816175Snatechar * 3916175Snate#ifdef STRCHR 4016175Snatestrchr(p, ch) 4116175Snate#else 4216175Snateindex(p, ch) 4316175Snate#endif 4416175Snate register const char *p, ch; 4516175Snate{ 4616175Snate for (;; ++p) { 4716175Snate if (*p == ch) 4816175Snate return((char *)p); 4916175Snate if (!*p) 5016175Snate return((char *)NULL); 5116175Snate } 5216175Snate /* NOTREACHED */ 5316175Snate} 54