summaryrefslogtreecommitdiffstats
path: root/freebsd
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-08-20 00:32:47 -0300
committerHisham Muhammad <hisham@gobolinux.org>2015-08-20 00:32:47 -0300
commit9428010121d849344b33b66dec312b6a51ea564f (patch)
treeae4284959359c87a1748240e5a568742e7e1db00 /freebsd
parent8bd603cb68fb5dd768b5b23ffe0c6f09f5340ceb (diff)
Make column width calculation dynamic.
Closes #228.
Diffstat (limited to 'freebsd')
-rw-r--r--freebsd/FreeBSDProcess.c35
-rw-r--r--freebsd/FreeBSDProcess.h3
2 files changed, 9 insertions, 29 deletions
diff --git a/freebsd/FreeBSDProcess.c b/freebsd/FreeBSDProcess.c
index 6e5720bb..b5734f81 100644
--- a/freebsd/FreeBSDProcess.c
+++ b/freebsd/FreeBSDProcess.c
@@ -75,32 +75,15 @@ ProcessFieldData Process_fields[] = {
[LAST_PROCESSFIELD] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, },
};
-char* Process_pidFormat = "%7u ";
-char* Process_tpgidFormat = "%7u ";
-
-void Process_setupColumnWidths() {
- int maxPid = Platform_getMaxPid();
- if (maxPid == -1) return;
- if (maxPid > 99999) {
- Process_fields[PID].title = " PID ";
- Process_fields[PPID].title = " PPID ";
- Process_fields[TPGID].title = " TPGID ";
- Process_fields[TGID].title = " TGID ";
- Process_fields[PGRP].title = " PGRP ";
- Process_fields[SESSION].title = " SESN ";
- Process_pidFormat = "%7u ";
- Process_tpgidFormat = "%7d ";
- } else {
- Process_fields[PID].title = " PID ";
- Process_fields[PPID].title = " PPID ";
- Process_fields[TPGID].title = "TPGID ";
- Process_fields[TGID].title = " TGID ";
- Process_fields[PGRP].title = " PGRP ";
- Process_fields[SESSION].title = " SESN ";
- Process_pidFormat = "%5u ";
- Process_tpgidFormat = "%5d ";
- }
-}
+ProcessPidColumn Process_pidColumns[] = {
+ { .id = PID, .label = "PID" },
+ { .id = PPID, .label = "PPID" },
+ { .id = TPGID, .label = "TPGID" },
+ { .id = TGID, .label = "TGID" },
+ { .id = PGRP, .label = "PGRP" },
+ { .id = SESSION, .label = "SESN" },
+ { .id = 0, .label = NULL },
+};
FreeBSDProcess* FreeBSDProcess_new(Settings* settings) {
FreeBSDProcess* this = calloc(sizeof(FreeBSDProcess), 1);
diff --git a/freebsd/FreeBSDProcess.h b/freebsd/FreeBSDProcess.h
index bf0acae8..e11d40d0 100644
--- a/freebsd/FreeBSDProcess.h
+++ b/freebsd/FreeBSDProcess.h
@@ -33,9 +33,6 @@ extern ProcessClass FreeBSDProcess_class;
extern ProcessFieldData Process_fields[];
extern char* Process_pidFormat;
-extern char* Process_tpgidFormat;
-
-void Process_setupColumnWidths();
FreeBSDProcess* FreeBSDProcess_new(Settings* settings);

© 2014-2024 Faster IT GmbH | imprint | privacy policy