[Prex-devel] [PATCH 15/22] support field width for %s
Status: Beta
Brought to you by:
kohtani
From: <and...@gm...> - 2007-06-06 00:19:47
|
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 |