summaryrefslogtreecommitdiff
path: root/src/libstddjb/byte_rchr.c
blob: 66fbf276d35b549bd04705fb80f779a5d2d45568 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* ISC license. */

#include <sys/types.h>
#include <skalibs/bytestr.h>

size_t byte_rchr (char const *s, size_t n, int c)
{
  size_t i = n ;
  char ch = c ;
  s += n ;
  while (i--) if (*--s == ch) return i ;
  return n ;
}