File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / libntp / strstr.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 1 month ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>