summaryrefslogtreecommitdiffstats
path: root/Settings.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-10-20 10:06:15 +0200
committerDaniel Lange <DLange@git.local>2020-10-20 10:06:15 +0200
commita0fb6e34f9e2dd83f535f3058f1a358637773298 (patch)
tree4ebdbe9ea599136b441eafa822d6b87575533307 /Settings.c
parent475fd1ec2ddd88a7b0a3109a89ed6c587f7761b7 (diff)
parent2899ed4cb00f4d887ee92c91e274ef098fd14f2b (diff)
Merge branch 'number-cpus-from-zero' of zevweiss/htop
* This changes the default to count CPUs from zero (instead of starting at one) * Settings logic is inverted, backwards compatibility is preserved
Diffstat (limited to 'Settings.c')
-rw-r--r--Settings.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Settings.c b/Settings.c
index ac8321a0..1f120f51 100644
--- a/Settings.c
+++ b/Settings.c
@@ -168,8 +168,11 @@ static bool Settings_read(Settings* this, const char* fileName, int initialCpuCo
this->detailedCPUTime = atoi(option[1]);
} else if (String_eq(option[0], "detailed_cpu_time")) {
this->detailedCPUTime = atoi(option[1]);
+ } else if (String_eq(option[0], "cpu_count_from_one")) {
+ this->countCPUsFromOne = atoi(option[1]);
} else if (String_eq(option[0], "cpu_count_from_zero")) {
- this->countCPUsFromZero = atoi(option[1]);
+ // old (inverted) naming also supported for backwards compatibility
+ this->countCPUsFromOne = !atoi(option[1]);
} else if (String_eq(option[0], "show_cpu_usage")) {
this->showCPUUsage = atoi(option[1]);
} else if (String_eq(option[0], "show_cpu_frequency")) {
@@ -268,7 +271,7 @@ bool Settings_write(Settings* this) {
fprintf(fd, "tree_view=%d\n", (int) this->treeView);
fprintf(fd, "header_margin=%d\n", (int) this->headerMargin);
fprintf(fd, "detailed_cpu_time=%d\n", (int) this->detailedCPUTime);
- fprintf(fd, "cpu_count_from_zero=%d\n", (int) this->countCPUsFromZero);
+ fprintf(fd, "cpu_count_from_one=%d\n", (int) this->countCPUsFromOne);
fprintf(fd, "show_cpu_usage=%d\n", (int) this->showCPUUsage);
fprintf(fd, "show_cpu_frequency=%d\n", (int) this->showCPUFrequency);
fprintf(fd, "update_process_names=%d\n", (int) this->updateProcessNames);
@@ -301,7 +304,7 @@ Settings* Settings_new(int initialCpuCount) {
this->highlightBaseName = false;
this->highlightMegabytes = false;
this->detailedCPUTime = false;
- this->countCPUsFromZero = false;
+ this->countCPUsFromOne = false;
this->showCPUUsage = true;
this->showCPUFrequency = false;
this->updateProcessNames = false;

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