summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DisplayOptionsPanel.c1
-rw-r--r--InfoScreen.c2
-rw-r--r--README1
-rw-r--r--htop.c6
-rw-r--r--linux/LinuxProcess.c7
-rw-r--r--linux/LinuxProcessList.c17
6 files changed, 17 insertions, 17 deletions
diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c
index 1222d823..42375e6a 100644
--- a/DisplayOptionsPanel.c
+++ b/DisplayOptionsPanel.c
@@ -100,6 +100,7 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Also show CPU percentage numerically"), &(settings->showCPUUsage)));
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Also show CPU frequency"), &(settings->showCPUFrequency)));
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Enable the mouse"), &(settings->enableMouse)));
+ Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Enable vim mode"), &(settings->vimMode)));
#ifdef HAVE_LIBHWLOC
Panel_add(super, (Object*) CheckItem_newByRef(xStrdup("Show topology when selecting affinity by default"), &(settings->topologyAffinity)));
#endif
diff --git a/InfoScreen.c b/InfoScreen.c
index 93120006..5c586bdd 100644
--- a/InfoScreen.c
+++ b/InfoScreen.c
@@ -80,7 +80,7 @@ void InfoScreen_drawTitled(InfoScreen* this, const char* fmt, ...) {
va_start(ap, fmt);
attrset(CRT_colors[METER_TEXT]);
mvhline(0, 0, ' ', COLS);
- wmove(stdscr, 0, 0);
+ (void) wmove(stdscr, 0, 0);
vw_printw(stdscr, fmt, ap);
attrset(CRT_colors[DEFAULT_COLOR]);
this->display->needsRedraw = true;
diff --git a/README b/README
index 52c0bedb..7ed93480 100644
--- a/README
+++ b/README
@@ -5,6 +5,7 @@
[![Mailing List](https://img.shields.io/badge/Mailing%20List-htop-blue.svg)](https://groups.io/g/htop)
[![IRC #htop](https://img.shields.io/badge/IRC-htop-blue.svg)](https://webchat.freenode.net/#htop)
[![Github Release](https://img.shields.io/github/release/htop-dev/htop.svg)](https://github.com/htop-dev/htop/releases/latest)
+[![Download](https://api.bintray.com/packages/htop/source/htop/images/download.svg)](https://bintray.com/htop/source/htop/_latestVersion)
Introduction
------------
diff --git a/htop.c b/htop.c
index c7689c66..d9302a0c 100644
--- a/htop.c
+++ b/htop.c
@@ -29,14 +29,12 @@ in the source distribution for its full text.
//#link m
static void printVersionFlag() {
- fputs("htop " VERSION " - " COPYRIGHT "\n"
- "Released under the GNU GPL.\n\n",
- stdout);
+ fputs("htop " VERSION "\n", stdout);
exit(0);
}
static void printHelpFlag() {
- fputs("htop " VERSION " - " COPYRIGHT "\n"
+ fputs("htop " VERSION "\n"
"Released under the GNU GPL.\n\n"
"-C --no-color Use a monochrome color scheme\n"
"-m --no-mouse Disable the mouse\n"
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 3a150495..6bae9886 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -241,7 +241,7 @@ ProcessFieldData Process_fields[] = {
#ifdef HAVE_CGROUP
[CGROUP] = { .name = "CGROUP", .title = " CGROUP ", .description = "Which cgroup the process is in", .flags = PROCESS_FLAG_LINUX_CGROUP, },
#endif
- [OOM] = { .name = "OOM", .title = " OOM ", .description = "OOM (Out-of-Memory) killer score", .flags = PROCESS_FLAG_LINUX_OOM, },
+ [OOM] = { .name = "OOM", .title = " OOM ", .description = "OOM (Out-of-Memory) killer score", .flags = PROCESS_FLAG_LINUX_OOM, },
[IO_PRIORITY] = { .name = "IO_PRIORITY", .title = "IO ", .description = "I/O priority", .flags = PROCESS_FLAG_LINUX_IOPRIO, },
#ifdef HAVE_DELAYACCT
[PERCENT_CPU_DELAY] = { .name = "PERCENT_CPU_DELAY", .title = "CPUD% ", .description = "CPU delay %", .flags = 0, },
@@ -264,7 +264,6 @@ ProcessPidColumn Process_pidColumns[] = {
{ .id = TGID, .label = "TGID" },
{ .id = PGRP, .label = "PGRP" },
{ .id = SESSION, .label = "SID" },
- { .id = OOM, .label = "OOM" },
{ .id = 0, .label = NULL },
};
@@ -397,7 +396,7 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
#ifdef HAVE_CGROUP
case CGROUP: xSnprintf(buffer, n, "%-10s ", lp->cgroup); break;
#endif
- case OOM: xSnprintf(buffer, n, Process_pidFormat, lp->oom); break;
+ case OOM: xSnprintf(buffer, n, "%4u ", lp->oom); break;
case IO_PRIORITY: {
int klass = IOPriority_class(lp->ioPriority);
if (klass == IOPRIO_CLASS_NONE) {
@@ -493,7 +492,7 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
return strcmp(p1->cgroup ? p1->cgroup : "", p2->cgroup ? p2->cgroup : "");
#endif
case OOM:
- return (p2->oom - p1->oom);
+ return ((long)p2->oom - (long)p1->oom);
#ifdef HAVE_DELAYACCT
case PERCENT_CPU_DELAY:
return (p2->cpu_delay_percent > p1->cpu_delay_percent ? 1 : -1);
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 609b347c..732a86b7 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -275,7 +275,8 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
} else if (String_startsWith(buffer, "cpu")) {
cpus++;
} else if (String_startsWith(buffer, "btime ")) {
- sscanf(buffer, "btime %lld\n", &btime);
+ if (sscanf(buffer, "btime %lld\n", &btime) != 1)
+ CRT_fatalError("Failed to parse btime from " PROCSTATFILE);
break;
}
} while(true);
@@ -670,7 +671,7 @@ static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirn
char buffer[PROC_LINE_LENGTH + 1];
if (fgets(buffer, PROC_LINE_LENGTH, file)) {
unsigned int oom;
- int ok = sscanf(buffer, "%32u", &oom);
+ int ok = sscanf(buffer, "%u", &oom);
if (ok >= 1) {
process->oom = oom;
}
@@ -1062,9 +1063,9 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
}
static inline void LinuxProcessList_scanZfsArcstats(LinuxProcessList* lpl) {
- unsigned long long int dbufSize;
- unsigned long long int dnodeSize;
- unsigned long long int bonusSize;
+ unsigned long long int dbufSize = 0;
+ unsigned long long int dnodeSize = 0;
+ unsigned long long int bonusSize = 0;
FILE* file = fopen(PROCARCSTATSFILE, "r");
if (file == NULL) {
@@ -1142,10 +1143,10 @@ static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) {
char* ok = fgets(buffer, PROC_LINE_LENGTH, file);
if (!ok) buffer[0] = '\0';
if (i == 0)
- sscanf(buffer, "cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
+ (void) sscanf(buffer, "cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
else {
int cpuid;
- sscanf(buffer, "cpu%4d %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
+ (void) sscanf(buffer, "cpu%4d %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
assert(cpuid == i - 1);
}
// Guest time is already accounted in usertime
@@ -1235,7 +1236,7 @@ static inline double LinuxProcessList_scanCPUFrequency(LinuxProcessList* this) {
(sscanf(buffer, "cpu MHz : %lf", &frequency) == 1) ||
(sscanf(buffer, "cpu MHz: %lf", &frequency) == 1)
) {
- if (cpuid < 0) {
+ if (cpuid < 0 || cpuid > (cpus - 1)) {
CRT_fatalError(PROCCPUINFOFILE " is malformed: cpu MHz line without corresponding processor line");
}