diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild | 1 | ||||
-rw-r--r-- | libbb/strrstr.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild index 0c7e25497..201d795ad 100644 --- a/libbb/Kbuild +++ b/libbb/Kbuild | |||
@@ -87,6 +87,7 @@ lib-y += simplify_path.o | |||
87 | lib-y += skip_whitespace.o | 87 | lib-y += skip_whitespace.o |
88 | lib-y += speed_table.o | 88 | lib-y += speed_table.o |
89 | lib-y += str_tolower.o | 89 | lib-y += str_tolower.o |
90 | lib-y += strrstr.o | ||
90 | lib-y += time.o | 91 | lib-y += time.o |
91 | lib-y += trim.o | 92 | lib-y += trim.o |
92 | lib-y += u_signal_names.o | 93 | lib-y += u_signal_names.o |
diff --git a/libbb/strrstr.c b/libbb/strrstr.c new file mode 100644 index 000000000..b314264f5 --- /dev/null +++ b/libbb/strrstr.c | |||
@@ -0,0 +1,20 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Utility routines. | ||
4 | * | ||
5 | * Copyright (C) 2008 Bernhard Fischer | ||
6 | * | ||
7 | * Licensed under GPLv2 or later, see file License in this tarball for details. | ||
8 | */ | ||
9 | |||
10 | #include "libbb.h" | ||
11 | |||
12 | /* reverse strstr() */ | ||
13 | char* strrstr(const char *haystack, const char *needle) | ||
14 | { | ||
15 | char *tmp = strrchr(haystack, *needle); | ||
16 | if (tmp == NULL || strcmp(tmp, needle) != 0) | ||
17 | return NULL; | ||
18 | return tmp; | ||
19 | } | ||
20 | |||