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