1/* $NetBSD: strstr.c,v 1.1.1.1 2009/12/13 16:55:04 kardel Exp $ */ 2 3#include <config.h> 4 5#if !HAVE_STRSTR 6 7/* 8 * Amanda, The Advanced Maryland Automatic Network Disk Archiver 9 * Copyright (c) 1991-1998 University of Maryland at College Park 10 * All Rights Reserved. 11 * 12 * Permission to use, copy, modify, distribute, and sell this software and its 13 * documentation for any purpose is hereby granted without fee, provided that 14 * the above copyright notice appear in all copies and that both that 15 * copyright notice and this permission notice appear in supporting 16 * documentation, and that the name of U.M. not be used in advertising or 17 * publicity pertaining to distribution of the software without specific, 18 * written prior permission. U.M. makes no representations about the 19 * suitability of this software for any purpose. It is provided "as is" 20 * without express or implied warranty. 21 * 22 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. 24 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 25 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 26 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 27 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 28 * 29 * Author: James da Silva, Systems Design and Analysis Group 30 * Computer Science Department 31 * University of Maryland at College Park 32 */ 33/* 34 * $Id: strstr.c,v 1.1.1.1 2009/12/13 16:55:04 kardel Exp $ 35 * 36 * replacement for missing ANSI-C strstr function 37 */ 38 39char *strstr(a, b) 40char *a, *b; 41{ 42 int alen, blen, i; 43 44 alen = strlen(a); 45 blen = strlen(b); 46 47 for(i=0; i <= alen-blen; i++, a++) 48 if(strncmp(a, b, blen) == 0) return a; 49 50 return NULL; 51} 52#else 53int strstr_bs; 54#endif 55