1// Copyright 2016 The Fuchsia Authors 2// Copyright 2001, Manuel J. Petit 3// Copyright (c) 2008 Travis Geiselbrecht 4// 5// Use of this source code is governed by a MIT-style 6// license that can be found in the LICENSE file or at 7// https://opensource.org/licenses/MIT 8 9#include <string.h> 10#include <sys/types.h> 11 12char * 13strrchr(char const *s, int c) 14{ 15 char const *last= c?0:s; 16 17 18 while (*s) { 19 if (*s== c) { 20 last= s; 21 } 22 23 s+= 1; 24 } 25 26 return (char *)last; 27} 28