projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b411228
)
pid1: use $COLUMNS info in status_vprintf()
author
Lennart Poettering
<lennart@poettering.net>
Wed, 17 Jul 2024 15:56:01 +0000
(17:56 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Fri, 19 Jul 2024 09:44:05 +0000
(11:44 +0200)
This way, we can work around the fact that "struct winsize" for
/dev/console might not be initialized the moment we open the device.
src/core/show-status.c
patch
|
blob
|
history
diff --git
a/src/core/show-status.c
b/src/core/show-status.c
index 57ad4db30b5adc433b0305d5227cb64075108026..7c7c10f96367ff66d6cdcba4abbdde027252a0c9 100644
(file)
--- a/
src/core/show-status.c
+++ b/
src/core/show-status.c
@@
-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;