home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / gawk213s.lzh / GAWK213S / STRCHR.C < prev    next >
Text File  |  1993-07-29  |  543b  |  36 lines

  1. /*
  2.  * strchr --- search a string for a character
  3.  *
  4.  * We supply this routine for those systems that aren't standard yet.
  5.  */
  6.  
  7. char *
  8. strchr (str, c)
  9. register char *str, c;
  10. {
  11.     for (; *str; str++)
  12.         if (*str == c)
  13.             return str;
  14.  
  15.     return NULL;
  16. }
  17.  
  18. /*
  19.  * strrchr --- find the last occurrence of a character in a string
  20.  *
  21.  * We supply this routine for those systems that aren't standard yet.
  22.  */
  23.  
  24. char *
  25. strrchr (str, c)
  26. register char *str, c;
  27. {
  28.     register char *save = NULL;
  29.  
  30.     for (; *str; str++)
  31.         if (*str == c)
  32.             save = str;
  33.  
  34.     return save;
  35. }
  36.