pid1: use $COLUMNS info in status_vprintf()

This way, we can work around the fact that "struct winsize" for
/dev/console might not be initialized the moment we open the device.
This commit is contained in:
Lennart Poettering
2024-07-19 11:44:05 +02:00
parent b411228199
commit 16044277e9
+8 -2
View File
@@ -72,8 +72,14 @@ int status_vprintf(const char *status, ShowStatusFlags flags, const char *format
int c;
c = fd_columns(fd);
if (c <= 0)
c = 80;
if (c <= 0) {
const char *env = getenv("COLUMNS");
if (env)
(void) safe_atoi(env, &c);
if (c <= 0)
c = 80;
}
sl = status ? strlen(status_indent) : 0;