home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gawk-2.15.6-base.tgz / gawk-2.15.6-base.tar / fsf / gawk / missing / strchr.c < prev    next >
Text File  |  1993-04-28  |  579b  |  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 const char *str, c;
  10. {
  11.     for (; *str; str++)
  12.         if (*str == c)
  13.             return (char *) 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 const char *str, c;
  27. {
  28.     register const char *save = NULL;
  29.  
  30.     for (; *str; str++)
  31.         if (*str == c)
  32.             save = str;
  33.  
  34.     return (char *) save;
  35. }
  36.