From 9d45ff5be1ea8e398578315114ad0b48eb61ab76 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Tue, 20 Mar 2007 21:26:46 +0200 Subject: [PATCH] ftp: Don't pad the timestamp column with spaces. --- src/protocol/ftp/ftp.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c index 044af97ce..8218f744d 100644 --- a/src/protocol/ftp/ftp.c +++ b/src/protocol/ftp/ftp.c @@ -1165,13 +1165,22 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries, fmt = "%b %e %H:%M"; wr = strftime(date, sizeof(date), fmt, when_tm); - - while (wr < sizeof(date) - 1) date[wr++] = ' '; - date[sizeof(date) - 1] = '\0'; - add_to_string(&string, date); + add_html_to_string(&string, date, wr); } else #endif add_to_string(&string, " "); + /* TODO: Above, the number of spaces might not match the width + * of the string generated by strftime. It depends on the + * locale. So if ELinks knows the timestamps of some FTP + * files but not others, it may misalign the file names. + * Potential solutions: + * - Pad the strings to a compile-time fixed width. + * Con: If we choose a width that suffices for all known + * locales, then it will be stupidly large for most of them. + * - Generate an HTML table. + * Con: Bloats the HTML source. + * Any solution chosen here should also be applied to the + * file: protocol handler. */ add_char_to_string(&string, ' ');