Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa for LIBSA_PRINTF_WIDTH_SUPPORT,
details: https://anonhg.NetBSD.org/src/rev/cfc2d4b59258
branches: trunk
changeset: 327946:cfc2d4b59258
user: hkenken <hkenken%NetBSD.org@localhost>
date: Sat Mar 22 02:51:44 2014 +0000
description:
for LIBSA_PRINTF_WIDTH_SUPPORT,
Fix right and left-adjusting padding.
diffstat:
sys/lib/libsa/subr_prf.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diffs (72 lines):
diff -r a3d2a774d889 -r cfc2d4b59258 sys/lib/libsa/subr_prf.c
--- a/sys/lib/libsa/subr_prf.c Sat Mar 22 01:52:44 2014 +0000
+++ b/sys/lib/libsa/subr_prf.c Sat Mar 22 02:51:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_prf.c,v 1.23 2013/12/24 22:26:21 jakllsch Exp $ */
+/* $NetBSD: subr_prf.c,v 1.24 2014/03/22 02:51:44 hkenken Exp $ */
/*-
* Copyright (c) 1993
@@ -79,7 +79,7 @@
#define ZEROPAD 0x40
#define NEGATIVE 0x80
#define KPRINTN(base) kprintn(put, ul, base, lflag, width)
-#define RZERO() \
+#define LZERO() \
do { \
if ((lflag & (ZEROPAD|LADJUST)) == ZEROPAD) { \
while (width-- > 0) \
@@ -102,7 +102,7 @@
} while (/*CONSTCOND*/0)
#else /* LIBSA_PRINTF_WIDTH_SUPPORT */
#define KPRINTN(base) kprintn(put, ul, base)
-#define RZERO() /**/
+#define LZERO() /**/
#define RPAD() /**/
#define LPAD() /**/
#endif /* LIBSA_PRINTF_WIDTH_SUPPORT */
@@ -235,9 +235,9 @@
#ifdef LIBSA_PRINTF_WIDTH_SUPPORT
--width;
#endif
- RPAD();
+ LPAD();
put(ch & 0xFF);
- LPAD();
+ RPAD();
break;
case 's':
p = va_arg(ap, char *);
@@ -246,10 +246,10 @@
continue;
width -= q - p;
#endif
- RPAD();
+ LPAD();
while ((ch = (unsigned char)*p++))
put(ch);
- LPAD();
+ RPAD();
break;
case 'd':
ul =
@@ -327,15 +327,15 @@
else if (lflag & SPACE)
*p++ = ' ';
width -= p - buf;
- if ((lflag & LADJUST) == 0) {
+ if (lflag & ZEROPAD) {
while (p > q)
put(*--p);
}
#endif
- RPAD();
- RZERO();
+ LPAD();
+ LZERO();
do {
put(*--p);
} while (p > buf);
- LPAD();
+ RPAD();
}
Home |
Main Index |
Thread Index |
Old Index