2006-07-02 19:47:05 +00:00
|
|
|
/* vi: set sw=4 ts=4: */
|
2001-04-26 15:56:47 +00:00
|
|
|
/*
|
|
|
|
* busybox library eXtended function
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Larry Doolittle, <ldoolitt@recycle.lbl.gov>
|
|
|
|
*
|
2010-08-16 20:14:46 +02:00
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
2001-04-26 15:56:47 +00:00
|
|
|
*/
|
|
|
|
#include "libbb.h"
|
|
|
|
|
2020-06-30 08:33:02 +02:00
|
|
|
/* Find out if the last character of a string matches the one given */
|
2008-06-27 02:52:20 +00:00
|
|
|
char* FAST_FUNC last_char_is(const char *s, int c)
|
2001-04-26 15:56:47 +00:00
|
|
|
{
|
2020-07-19 20:49:22 +02:00
|
|
|
if (!s[0])
|
|
|
|
return NULL;
|
|
|
|
while (s[1])
|
|
|
|
s++;
|
|
|
|
return (*s == (char)c) ? (char *) s : NULL;
|
2001-04-26 15:56:47 +00:00
|
|
|
}
|