From 37d8b77856be9eb9581c3c61d3f7193b3aec6b5c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 6 Feb 2002 00:19:11 +0000 Subject: Update. * elf/rtld.c (process_dl_debug): Correct printing help message. * elf/dl-misc.c (_dl_debug_vdprintf): Implement precision handling for %s. --- elf/dl-misc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'elf/dl-misc.c') diff --git a/elf/dl-misc.c b/elf/dl-misc.c index ab883acb3c..364940b23f 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -135,6 +135,7 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg) /* It is a format specifier. */ char fill = ' '; int width = -1; + int prec = -1; #if LONG_MAX != INT_MAX int long_mod = 0; #endif @@ -154,6 +155,13 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg) ++fmt; } + /* Handle precision. */ + if (*fmt == '.' && fmt[1] == '*') + { + prec = va_arg (arg, int); + fmt += 2; + } + /* Recognize the l modifier. It is only important on some platforms where long and int have a different size. We can use the same code for size_t. */ @@ -202,6 +210,8 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg) /* Get the string argument. */ iov[niov].iov_base = va_arg (arg, char *); iov[niov].iov_len = strlen (iov[niov].iov_base); + if (prec != -1) + iov[niov].iov_len = MIN (prec, iov[niov].iov_len ); ++niov; break; -- cgit v1.2.3