summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index af8d6aa04c..ac8fccfa5a 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -1111,6 +1111,26 @@ char *strrchr_m(const char *s, char c)
return (char *)(s+strlen(s2));
}
+/***********************************************************************
+ Return the equivalent of doing strrchr 'n' times - always going
+ backwards.
+***********************************************************************/
+
+char *strnrchr_m(const char *s, char c, unsigned int n)
+{
+ wpstring ws;
+ pstring s2;
+ smb_ucs2_t *p;
+
+ push_ucs2(NULL, ws, s, sizeof(ws), STR_TERMINATE);
+ p = strnrchr_w(ws, UCS2_CHAR(c), n);
+ if (!p)
+ return NULL;
+ *p = 0;
+ pull_ucs2_pstring(s2, ws);
+ return (char *)(s+strlen(s2));
+}
+
/**
Convert a string to lower case.
**/