• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

missing/strchr.c

Go to the documentation of this file.
00001 /* public domain rewrite of strchr(3) and strrchr(3) */
00002 
00003 char *
00004 strchr(const char *s, int c)
00005 {
00006     if (c == 0) return (char *)s + strlen(s);
00007     while (*s) {
00008         if (*s == c)
00009             return (char *)s;
00010         s++;
00011     }
00012     return 0;
00013 }
00014 
00015 char *
00016 strrchr(const char *s, int c)
00017 {
00018     const char *save;
00019 
00020     if (c == 0) return (char *)s + strlen(s);
00021     save = 0;
00022     while (*s) {
00023         if (*s == c)
00024             save = s;
00025         s++;
00026     }
00027     return (char *)save;
00028 }
00029 

Generated on Wed Sep 8 2010 21:55:01 for Ruby by  doxygen 1.7.1