summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-11-28 17:42:02 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-28 17:43:08 +0100
commit0b29e5074c441debd365f76d05d4f8d00e1211ed (patch)
tree7616aa9fa919e6511653f4cba9576dc7e4bd8744
parent6c306315c87271b56b65594915644e1ff19458a4 (diff)
Use 'N/A' instead of 'no perm' for more consistency
-rw-r--r--Process.c15
-rw-r--r--linux/LinuxProcess.c4
2 files changed, 11 insertions, 8 deletions
diff --git a/Process.c b/Process.c
index 4556d966..c3fe584c 100644
--- a/Process.c
+++ b/Process.c
@@ -130,6 +130,7 @@ void Process_colorNumber(RichString* str, unsigned long long number, bool colori
int processMegabytesColor = CRT_colors[PROCESS_MEGABYTES];
int processColor = CRT_colors[PROCESS];
int processShadowColor = CRT_colors[PROCESS_SHADOW];
+
if (!coloring) {
largeNumberColor = CRT_colors[PROCESS];
processMegabytesColor = CRT_colors[PROCESS];
@@ -137,22 +138,22 @@ void Process_colorNumber(RichString* str, unsigned long long number, bool colori
}
if (number == ULLONG_MAX) {
- int len = snprintf(buffer, 13, " no perm ");
+ int len = xSnprintf(buffer, sizeof(buffer), " N/A ");
RichString_appendn(str, CRT_colors[PROCESS_SHADOW], buffer, len);
} else if (number >= 100000LL * ONE_DECIMAL_T) {
- xSnprintf(buffer, 13, "%11llu ", number / ONE_DECIMAL_G);
+ xSnprintf(buffer, sizeof(buffer), "%11llu ", number / ONE_DECIMAL_G);
RichString_appendn(str, largeNumberColor, buffer, 12);
} else if (number >= 100LL * ONE_DECIMAL_T) {
- xSnprintf(buffer, 13, "%11llu ", number / ONE_DECIMAL_M);
+ xSnprintf(buffer, sizeof(buffer), "%11llu ", number / ONE_DECIMAL_M);
RichString_appendn(str, largeNumberColor, buffer, 8);
RichString_appendn(str, processMegabytesColor, buffer+8, 4);
} else if (number >= 10LL * ONE_DECIMAL_G) {
- xSnprintf(buffer, 13, "%11llu ", number / ONE_DECIMAL_K);
+ xSnprintf(buffer, sizeof(buffer), "%11llu ", number / ONE_DECIMAL_K);
RichString_appendn(str, largeNumberColor, buffer, 5);
RichString_appendn(str, processMegabytesColor, buffer+5, 3);
RichString_appendn(str, processColor, buffer+8, 4);
} else {
- xSnprintf(buffer, 13, "%11llu ", number);
+ xSnprintf(buffer, sizeof(buffer), "%11llu ", number);
RichString_appendn(str, largeNumberColor, buffer, 2);
RichString_appendn(str, processMegabytesColor, buffer+2, 3);
RichString_appendn(str, processColor, buffer+5, 3);
@@ -225,12 +226,14 @@ void Process_outputRate(RichString* str, char* buffer, int n, double rate, int c
int largeNumberColor = CRT_colors[LARGE_NUMBER];
int processMegabytesColor = CRT_colors[PROCESS_MEGABYTES];
int processColor = CRT_colors[PROCESS];
+
if (!coloring) {
largeNumberColor = CRT_colors[PROCESS];
processMegabytesColor = CRT_colors[PROCESS];
}
+
if (isnan(rate)) {
- int len = snprintf(buffer, n, " no perm ");
+ int len = xSnprintf(buffer, n, " N/A ");
RichString_appendn(str, CRT_colors[PROCESS_SHADOW], buffer, len);
} else if (rate < ONE_K) {
int len = snprintf(buffer, n, "%7.2f B/s ", rate);
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 6de4874c..7d4657ae 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -727,7 +727,7 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces
xSnprintf(buffer, n, "%-15.15s ", lp->procComm);
} else {
attr = CRT_colors[PROCESS_SHADOW];
- xSnprintf(buffer, n, "%-15.15s ", Process_isKernelThread(lp) ? kthreadID : "no perm");
+ xSnprintf(buffer, n, "%-15.15s ", Process_isKernelThread(lp) ? kthreadID : "N/A");
}
break;
}
@@ -739,7 +739,7 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces
xSnprintf(buffer, n, "%-15.15s ", lp->procExe + lp->procExeBasenameOffset);
} else {
attr = CRT_colors[PROCESS_SHADOW];
- xSnprintf(buffer, n, "%-15.15s ", Process_isKernelThread(lp) ? kthreadID : "no perm");
+ xSnprintf(buffer, n, "%-15.15s ", Process_isKernelThread(lp) ? kthreadID : "N/A");
}
break;
}

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