summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-10 18:30:19 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-10 19:46:49 -0400
commit75add28aa17678fbf5b10947027efe7ac75d113d (patch)
tree5ab5e810ed9401877c561b15c963b5a8fa5679a5 /src/shared/util.h
parentb8a2b0f76b133524224d384641e124b7f6c5b9af (diff)
systemctl: ellipsize job list only when necessary, highlight running
I was debugging systemd waiting on a missing disk, and noticed that the job listing could use some polishing. Jobs that are actually running are highlighted, so it's easier to see what very actually waiting for. Also, the needed widths are precalculated, to use available columns more ecomically.
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 38851237ab..a8e962ea50 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -647,4 +647,11 @@ static inline bool logind_running(void) {
return access("/run/systemd/seats/", F_OK) >= 0;
}
+static inline unsigned decimal_str_max(unsigned x) {
+ unsigned ans = 1;
+ while (x /= 10)
+ ans ++;
+ return ans;
+}
+
int unlink_noerrno(const char *path);