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);
--- /dev/null
+/* 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;
+}
+