summaryrefslogtreecommitdiff
path: root/userland/libc/string/strrchr.c
blob: 30b625dac8fdfb5d6769ba6baf507cad9692b4a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#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;
}