[rtems commit] hexdump-conv.c: Use proper printf() formatting for wchar_t

Joel Sherril joel at rtems.org
Tue Nov 25 20:40:34 UTC 2014


Module:    rtems
Branch:    master
Commit:    ebb39a216d8c26929e1228181f0a4a02088c2b8a
Changeset: http://git.rtems.org/rtems/commit/?id=ebb39a216d8c26929e1228181f0a4a02088c2b8a

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Mon Nov 24 13:54:37 2014 -0600

hexdump-conv.c: Use proper printf() formatting for wchar_t

---

 cpukit/libmisc/shell/hexdump-conv.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/shell/hexdump-conv.c b/cpukit/libmisc/shell/hexdump-conv.c
index 44390ba..95d8a87 100644
--- a/cpukit/libmisc/shell/hexdump-conv.c
+++ b/cpukit/libmisc/shell/hexdump-conv.c
@@ -142,7 +142,15 @@ retry:
 			pad = 3 - width;
 			if (pad < 0)
 				pad = 0;
-			(void)printf("%*s%lc", pad, "", wc);
+			#if defined(__rtems__)
+			{
+			  wchar_t wc_tmp[2] = {0,0};
+			  wc_tmp[0] = wc;
+			  (void)printf("%*s%lc", pad, "", wc_tmp);
+			}
+			#else
+			  (void)printf("%*s%lc", pad, "", wc);
+			#endif
 			pr->mbleft = clen - 1;
 		}
 	} else {



More information about the vc mailing list