summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-04 01:29:22 +0200
committerGünther Deschner <gd@samba.org>2008-06-04 01:35:43 +0200
commitd4c5a1d504a522c0ade2bb91557e50f6252a0b1c (patch)
treeca60a578205a750d385766353d32d7eb6625f2c7
parent12281d02ae0f6b5abf17edcaa973ec27a0340320 (diff)
downloadsamba-d4c5a1d504a522c0ade2bb91557e50f6252a0b1c.tar.gz
samba-d4c5a1d504a522c0ade2bb91557e50f6252a0b1c.tar.bz2
samba-d4c5a1d504a522c0ade2bb91557e50f6252a0b1c.zip
util_str: add talloc_asprintf_strlower_m().
Guenther (This used to be commit 7f8b0b4d151fa4d07758b6fd7b47b0b7c07dda17)
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/lib/util_str.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e8a2b697d7..582300b2a6 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1730,6 +1730,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
size_t *bufsize, const char *fmt, ...);
int asprintf_strupper_m(char **strp, const char *fmt, ...);
char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
+char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
char *sstring_sub(const char *src, char front, char back);
bool validate_net_name( const char *name,
const char *invalid_chars,
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 5a08f7bc2c..1e1108132c 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -2615,6 +2615,23 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...)
return ret;
}
+char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...)
+{
+ va_list ap;
+ char *ret;
+
+ va_start(ap, fmt);
+ ret = talloc_vasprintf(t, fmt, ap);
+ va_end(ap);
+
+ if (ret == NULL) {
+ return NULL;
+ }
+ strlower_m(ret);
+ return ret;
+}
+
+
/*
Returns the substring from src between the first occurrence of
the char "front" and the first occurence of the char "back".