[dovecot-cvs] dovecot/src/lib var-expand.c,1.7,1.8
cras at dovecot.org
cras at dovecot.org
Sun Sep 11 23:22:37 EEST 2005
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv27358/lib
Modified Files:
var-expand.c
Log Message:
Added 'R' reverse modifier.
Index: var-expand.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/var-expand.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- var-expand.c 11 Sep 2005 19:56:03 -0000 1.7
+++ var-expand.c 11 Sep 2005 20:22:35 -0000 1.8
@@ -44,6 +44,20 @@
return t_strdup_printf("%llx", l);
}
+static const char *
+m_str_reverse(const char *str, struct var_expand_context *ctx __attr_unused__)
+{
+ size_t len = strlen(str);
+ char *p, *rev;
+
+ rev = t_malloc(len + 1);
+ rev[len] = '\0';
+
+ for (p = rev + len - 1; *str != '\0'; str++)
+ *p-- = *str;
+ return rev;
+}
+
static const char *m_str_hash(const char *str, struct var_expand_context *ctx)
{
unsigned int value = str_hash(str);
@@ -68,6 +82,7 @@
{ 'U', m_str_ucase },
{ 'E', m_str_escape },
{ 'X', m_str_hex },
+ { 'R', m_str_reverse },
{ 'H', m_str_hash },
{ '\0', NULL }
};
More information about the dovecot-cvs
mailing list