From 5c2f250abc5951b20a8110ded86125dd86001b3d Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 30 Mar 2013 15:39:16 +0000 Subject: [PATCH] =?UTF-8?q?make=20"%#s"=20into=20print=5Fvalue=5Fquoted=20?= =?UTF-8?q?(ignoring=20field=20width=20and=20precision),=20if=20you=20can?= =?UTF-8?q?=20get=20it=20around=20gcc=E2=80=99s=20=5F=5Fprintf=5F=5F=20=5F?= =?UTF-8?q?=5Fformat=5F=5F=20attribute=20that=20is=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shf.c b/shf.c index 82db720..4cfef74 100644 --- a/shf.c +++ b/shf.c @@ -24,7 +24,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.56 2013/01/01 03:32:44 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.57 2013/03/30 15:39:16 tg Exp $"); /* flags to shf_emptybuf() */ #define EB_READSW 0x01 /* about to switch to reading */ @@ -985,6 +985,10 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args) case 's': if ((s = VA(const char *)) == NULL) s = "(null)"; + else if (flags & FL_HASH) { + print_value_quoted(shf, s); + continue; + } len = utf_mbswidth(s); break;