1 /* 2 * Copyright (C) 1991, 1992 Linus Torvalds 3 */ 4 5 #include <xen/string.h> 6 7 /** 8 * strrchr - Find the last occurrence of a character in a string 9 * @s: The string to be searched 10 * @c: The character to search for 11 */ 12 char *(strrchr)(const char *s, int c) 13 { 14 const char *p = s + strlen(s); 15 16 for (; *p != (char)c; --p) 17 if (p == s) 18 return NULL; 19 20 return (char *)p; 21 } 22 23 /* 24 * Local variables: 25 * mode: C 26 * c-file-style: "BSD" 27 * c-basic-offset: 8 28 * tab-width: 8 29 * indent-tabs-mode: t 30 * End: 31 */ 32