summaryrefslogtreecommitdiff
path: root/userland/libc/string/strrchr.c
blob: a44199ac6ef01459c4de66ea43dd8a626b6f546f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <string.h>

char *strrchr(const char *s, int c) {
  char *last = NULL;
  for (; *s; s++) {
    if (*s == (char)c)
      last = (char *)s;
  }
  if ((char)c == '\0')
    last = (char*)s;
  return last;
}