From 2157400e3de983c358b580bb8cd22b337cd87eae Mon Sep 17 00:00:00 2001
From: izabera <izaberina@gmail.com>
Date: Tue, 17 Mar 2015 20:30:11 +0100
Subject: [PATCH] time-fmt-escapes

---
 builtins/printf.def | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/builtins/printf.def b/builtins/printf.def
index 9b9d390..cc87aae 100644
--- a/builtins/printf.def
+++ b/builtins/printf.def
@@ -450,7 +450,22 @@ printf_builtin (list)
 		fmt++;	/* skip over left paren */
 		for (t = timefmt, n = 1; *fmt; )
 		  {
-		    if (*fmt == '(')
+		    /* Allow backslash escapes in time formats */
+		    if (*fmt == '\\')
+		      {
+			fmt++;
+#if defined (HANDLE_MULTIBYTE)
+			memset (mbch, '\0', sizeof (mbch));
+			fmt += tescape (fmt, mbch, &mblen, (int *)NULL);
+			for (mbind = 0; mbind < mblen; mbind++)
+			  *t++ = mbch[mbind];
+#else
+			fmt += tescape (fmt, &nextch, (int *)NULL, (int *)NULL);
+			*t++ = nextch;
+#endif
+			continue;
+		      }
+		    else if (*fmt == '(')
 		      n++;
 		    else if (*fmt == ')')
 		      n--;
-- 
2.3.3

