diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-28 14:19:27 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-28 14:19:27 +0000 |
commit | 17282292c2259b130ef7833bdac97c8ce8bf5515 (patch) | |
tree | 2740c55326f87a057cb7652d03582d5a9bfb0f48 /libbb/strrstr.c | |
parent | 5de8a13b0888e6eb490e13cba2cca293ee8bc4ad (diff) | |
download | busybox-w32-17282292c2259b130ef7833bdac97c8ce8bf5515.tar.gz busybox-w32-17282292c2259b130ef7833bdac97c8ce8bf5515.tar.bz2 busybox-w32-17282292c2259b130ef7833bdac97c8ce8bf5515.zip |
- add strrchr
Diffstat (limited to 'libbb/strrstr.c')
-rw-r--r-- | libbb/strrstr.c | 20 |
1 files changed, 20 insertions, 0 deletions
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 | |||