svn commit: trunk/busybox: include libbb
aldot at busybox.net
aldot at busybox.net
Wed May 28 14:19:28 UTC 2008
Author: aldot
Date: 2008-05-28 07:19:27 -0700 (Wed, 28 May 2008)
New Revision: 22106
Log:
- add strrchr
Added:
trunk/busybox/libbb/strrstr.c
Modified:
trunk/busybox/include/libbb.h
trunk/busybox/libbb/Kbuild
Changeset:
Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h 2008-05-28 12:44:22 UTC (rev 22105)
+++ trunk/busybox/include/libbb.h 2008-05-28 14:19:27 UTC (rev 22106)
@@ -244,6 +244,7 @@
extern void trim(char *s);
extern char *skip_whitespace(const char *);
extern char *skip_non_whitespace(const char *);
+extern char *strrstr(const char *haystack, const char *needle);
//TODO: supply a pointer to char[11] buffer (avoid statics)?
extern const char *bb_mode_string(mode_t mode);
Modified: trunk/busybox/libbb/Kbuild
===================================================================
--- trunk/busybox/libbb/Kbuild 2008-05-28 12:44:22 UTC (rev 22105)
+++ trunk/busybox/libbb/Kbuild 2008-05-28 14:19:27 UTC (rev 22106)
@@ -87,6 +87,7 @@
lib-y += skip_whitespace.o
lib-y += speed_table.o
lib-y += str_tolower.o
+lib-y += strrstr.o
lib-y += time.o
lib-y += trim.o
lib-y += u_signal_names.o
Added: trunk/busybox/libbb/strrstr.c
===================================================================
--- trunk/busybox/libbb/strrstr.c (rev 0)
+++ trunk/busybox/libbb/strrstr.c 2008-05-28 14:19:27 UTC (rev 22106)
@@ -0,0 +1,20 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) 2008 Bernhard Fischer
+ *
+ * Licensed under GPLv2 or later, see file License in this tarball for details.
+ */
+
+#include "libbb.h"
+
+/* reverse strstr() */
+char* strrstr(const char *haystack, const char *needle)
+{
+ char *tmp = strrchr(haystack, *needle);
+ if (tmp == NULL || strcmp(tmp, needle) != 0)
+ return NULL;
+ return tmp;
+}
+
More information about the busybox-cvs
mailing list