support field width for %s
---
 sys/lib/vsprintf.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/sys/lib/vsprintf.c b/sys/lib/vsprintf.c
index 394be4f..52a907f 100755
--- a/sys/lib/vsprintf.c
+++ b/sys/lib/vsprintf.c
@@ -116,9 +116,12 @@ int vsprintf(char *buf, const char *fmt, va_list args)
                        str = va_arg(args, char *);
                        if (str == NULL)
                                str = "<NULL>";
-                       for (; *str; str++) {
+                       for (; *str && width != 0; str++, width--) {
                                *p++ = *str;
                        }
+                       while (width-- > 0)
+                               *p++ = pad;
+
                        continue;
                case 'X':
                case 'x':
-- 
1.5.0.3.GIT




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Prex-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/prex-devel

Reply via email to