home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / elm-2.4-pl20.tar.Z / elm-2.4-pl20.tar / lib / in_string.c < prev    next >
C/C++ Source or Header  |  1992-10-03  |  1KB  |  46 lines

  1. static char rcsid[] = "@(#)$Id: in_string.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  2.  
  3. /*******************************************************************************
  4.  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  5.  *
  6.  *            Copyright (c) 1988-1992 USENET Community Trust
  7.  *            Copyright (c) 1986,1987 Dave Taylor
  8.  *******************************************************************************
  9.  * Bug reports, patches, comments, suggestions should be sent to:
  10.  *
  11.  *    Syd Weinstein, Elm Coordinator
  12.  *    elm@DSI.COM            dsinc!elm
  13.  *
  14.  *******************************************************************************
  15.  * $Log: in_string.c,v $
  16.  * Revision 5.1  1992/10/03  22:41:36  syd
  17.  * Initial checkin as of 2.4 Release at PL0
  18.  *
  19.  *
  20.  ******************************************************************************/
  21.  
  22. /** 
  23.  
  24. **/
  25.  
  26. #include "headers.h"
  27.  
  28.  
  29. int 
  30. in_string(buffer, pattern)
  31. char *buffer, *pattern;
  32. {
  33.     /** Returns TRUE iff pattern occurs IN IT'S ENTIRETY in buffer. **/ 
  34.  
  35.     register int i = 0, j = 0;
  36.     
  37.     while (buffer[i] != '\0') {
  38.       while (buffer[i++] == pattern[j++]) 
  39.         if (pattern[j] == '\0') 
  40.           return(TRUE);
  41.       i = i - j + 1;
  42.       j = 0;
  43.     }
  44.     return(FALSE);
  45. }
  46.