mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl/libc: Indicate truncated lines in printf with '...'
Append '...' to lines exceeding the maximum line length instead of silently truncating them. Suggested-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Philipp Rudo <prudo@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
f7430027b4
commit
36fed0e6c6
@@ -410,11 +410,17 @@ void snprintf(char *buf, unsigned long size, const char *fmt, ...)
|
||||
*/
|
||||
void printf(const char *fmt, ...)
|
||||
{
|
||||
char buf[81];
|
||||
char buf[LINE_LENGTH + 1];
|
||||
int len;
|
||||
va_list va;
|
||||
|
||||
va_start(va, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, va);
|
||||
len = vsnprintf(buf, sizeof(buf), fmt, va);
|
||||
if (len > LINE_LENGTH) {
|
||||
buf[LINE_LENGTH - 1] = '.';
|
||||
buf[LINE_LENGTH - 2] = '.';
|
||||
buf[LINE_LENGTH - 3] = '.';
|
||||
}
|
||||
sclp_print(buf);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
|
||||
#define MIB (1024ULL * 1024)
|
||||
#define LINE_LENGTH 80 /* max line length printed by printf */
|
||||
|
||||
void printf(const char *, ...);
|
||||
void snprintf(char *buf, unsigned long size, const char *fmt, ...);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
/* max command line length */
|
||||
#define COMMAND_LINE_SIZE 896
|
||||
#define BOOT_MENU_ENTRIES 63
|
||||
#define LINE_LENGTH 80
|
||||
#define PARAM_SIZE 8
|
||||
#define TEXT_OFFSET 4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user