home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / STRCFIND.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-30  |  698 b   |  42 lines

  1. /*
  2.  * strcfind.c
  3.  * contains: strcfind()
  4.  *
  5.  */
  6.  
  7. #include <stdio.h>
  8. #include "gfuncts.h"
  9.  
  10. /*
  11.  *  int
  12.  * strcfind(str,c)
  13.  *
  14.  * ARGUMENT
  15.  *  (char *)    str    -    pointer to string to examine
  16.  *  (char)    c    -    character to locate in string
  17.  *
  18.  * DESCRIPTION
  19.  *  The indicated string is searched left to right for the first occurrence
  20.  *  of the character indicated by c.
  21.  *
  22.  * RETURNS
  23.  *  Position of character if found, -1 if not found in string.
  24.  *
  25.  * AUTHOR
  26.  *   Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  27.  */
  28. int GF_CONV strcfind(p,c)
  29. char c,*p;
  30. {
  31.     int i=0;
  32.  
  33.     while(*p)
  34.         if(*p==c)
  35.             return i;
  36.         else {
  37.             ++i;
  38.             ++p;
  39.         }
  40.     return (-1);
  41. }
  42.