diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-01-27 15:11:42 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-01-30 14:21:26 +0100 |
commit | a3c8285237c673189b28c897910cf6eb8629bfaf (patch) | |
tree | 1ba239046f4b8707a9eec2b1a2b8ccd86bac8945 /linux/LinuxProcess.c | |
parent | 03d6345c891b93b4658481f891fa2af5ce1c951b (diff) |
Refactor to tty_nr process field display
If no terminal name can be found, fall back to generic display method
with major and minor device numbers.
Print special value '(none)' in case both are zero.
Diffstat (limited to 'linux/LinuxProcess.c')
-rw-r--r-- | linux/LinuxProcess.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index 488b9372..79e73e84 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -607,15 +607,14 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces int attr = CRT_colors[DEFAULT_COLOR]; size_t n = sizeof(buffer) - 1; switch (field) { - case TTY_NR: { + case TTY_NR: if (lp->ttyDevice) { - xSnprintf(buffer, n, "%-9s", lp->ttyDevice + 5 /* skip "/dev/" */); - } else { - attr = CRT_colors[PROCESS_SHADOW]; - xSnprintf(buffer, n, "? "); + xSnprintf(buffer, n, "%-8s ", lp->ttyDevice + 5 /* skip "/dev/" */); + break; } - break; - } + + Process_writeField(this, str, field); + return; case CMINFLT: Process_colorNumber(str, lp->cminflt, coloring); return; case CMAJFLT: Process_colorNumber(str, lp->cmajflt, coloring); return; case M_DRS: Process_humanNumber(str, lp->m_drs * pageSizeKB, coloring); return; |