Home | History | Annotate | Download | only in in.ftpd
      1 #pragma ident	"%Z%%M%	%I%	%E% SMI"
      2 
      3 /****************************************************************************
      4 
      5   Copyright (c) 1999,2000 WU-FTPD Development Group.
      6   All rights reserved.
      7 
      8   Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994
      9     The Regents of the University of California.
     10   Portions Copyright (c) 1993, 1994 Washington University in Saint Louis.
     11   Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc.
     12   Portions Copyright (c) 1989 Massachusetts Institute of Technology.
     13   Portions Copyright (c) 1998 Sendmail, Inc.
     14   Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P.  Allman.
     15   Portions Copyright (c) 1997 by Stan Barber.
     16   Portions Copyright (c) 1997 by Kent Landfield.
     17   Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
     18     Free Software Foundation, Inc.
     19 
     20   Use and distribution of this software and its source code are governed
     21   by the terms and conditions of the WU-FTPD Software License ("LICENSE").
     22 
     23   If you did not receive a copy of the license, it may be obtained online
     24   at http://www.wu-ftpd.org/license.html.
     25 
     26   $Id: strcasestr.c,v 1.5 2000/07/01 18:36:29 wuftpd Exp $
     27 
     28 ****************************************************************************/
     29 #include <string.h>
     30 /*
     31  * Find the first occurrence of find in s.
     32  */
     33 char *strcasestr(register char *s, register char *find)
     34 {
     35     register char c, sc;
     36     register size_t len;
     37 
     38     if ((c = *find++) != 0) {
     39 	len = strlen(find);
     40 	do {
     41 	    do {
     42 		if ((sc = *s++) == 0)
     43 		    return (NULL);
     44 	    } while (sc != c);
     45 	} while (strncasecmp(s, find, len) != 0);
     46 	s--;
     47     }
     48     return ((char *) s);
     49 }
     50