aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:00:33 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:33 +0200
commitf75ab6d2c11e8a8e18191b087564aedebbeb96c5 (patch)
tree2a046e11678e798f3f9c7f7af4f9ac205c8d2731
parent2004bbc3ef28ada3acca05f5d5fa9108121a6784 (diff)
downloaddebian_htop-f75ab6d2c11e8a8e18191b087564aedebbeb96c5.tar.gz
debian_htop-f75ab6d2c11e8a8e18191b087564aedebbeb96c5.tar.bz2
debian_htop-f75ab6d2c11e8a8e18191b087564aedebbeb96c5.zip
Imported Upstream version 1.0.3upstream/1.0.3
-rw-r--r--Affinity.c4
-rw-r--r--AffinityPanel.c12
-rw-r--r--AffinityPanel.h2
-rw-r--r--AvailableColumnsPanel.c14
-rw-r--r--AvailableColumnsPanel.h2
-rw-r--r--AvailableMetersPanel.c22
-rw-r--r--AvailableMetersPanel.h2
-rw-r--r--BatteryMeter.c261
-rw-r--r--BatteryMeter.h2
-rw-r--r--CPUMeter.c158
-rw-r--r--CPUMeter.h14
-rw-r--r--CRT.c39
-rw-r--r--CRT.h10
-rw-r--r--CategoriesPanel.c20
-rw-r--r--CategoriesPanel.h2
-rw-r--r--ChangeLog17
-rw-r--r--CheckItem.c18
-rw-r--r--CheckItem.h8
-rw-r--r--ClockMeter.c13
-rw-r--r--ClockMeter.h2
-rw-r--r--ColorsPanel.c16
-rw-r--r--ColorsPanel.h2
-rw-r--r--ColumnsPanel.c19
-rw-r--r--ColumnsPanel.h2
-rw-r--r--DisplayOptionsPanel.c15
-rw-r--r--DisplayOptionsPanel.h2
-rw-r--r--FunctionBar.c33
-rw-r--r--FunctionBar.h6
-rw-r--r--Hashtable.c2
-rw-r--r--Header.c47
-rw-r--r--Header.h4
-rw-r--r--HostnameMeter.c10
-rw-r--r--HostnameMeter.h2
-rw-r--r--IOPriorityPanel.c2
-rw-r--r--IncSet.c213
-rw-r--r--IncSet.h56
-rw-r--r--ListItem.c33
-rw-r--r--ListItem.h8
-rw-r--r--LoadAverageMeter.c24
-rw-r--r--LoadAverageMeter.h4
-rw-r--r--Makefile.am12
-rw-r--r--Makefile.in29
-rw-r--r--MemoryMeter.c15
-rw-r--r--MemoryMeter.h2
-rw-r--r--Meter.c270
-rw-r--r--Meter.h101
-rw-r--r--MetersPanel.c14
-rw-r--r--MetersPanel.h2
-rw-r--r--Object.c59
-rw-r--r--Object.h39
-rw-r--r--OpenFilesScreen.c166
-rw-r--r--OpenFilesScreen.h11
-rw-r--r--Panel.c88
-rw-r--r--Panel.h31
-rw-r--r--Process.c334
-rw-r--r--Process.h122
-rw-r--r--ProcessList.c350
-rw-r--r--ProcessList.h20
-rw-r--r--README52
-rw-r--r--RichString.c30
-rw-r--r--RichString.h10
-rw-r--r--ScreenManager.c13
-rw-r--r--Settings.c19
-rw-r--r--Settings.h2
-rw-r--r--SignalsPanel.c33
-rw-r--r--SignalsPanel.h9
-rw-r--r--String.c25
-rw-r--r--String.h3
-rw-r--r--SwapMeter.c20
-rw-r--r--SwapMeter.h2
-rw-r--r--TasksMeter.c11
-rw-r--r--TasksMeter.h2
-rw-r--r--TraceScreen.c155
-rw-r--r--TraceScreen.h1
-rw-r--r--UptimeMeter.c10
-rw-r--r--UptimeMeter.h2
-rw-r--r--Vector.c73
-rw-r--r--Vector.h5
-rw-r--r--aclocal.m44
-rwxr-xr-xcompile21
-rwxr-xr-xconfig.guess221
-rw-r--r--config.h16
-rw-r--r--config.h.in6
-rwxr-xr-xconfig.sub58
-rwxr-xr-xconfigure1196
-rw-r--r--configure.ac19
-rwxr-xr-xdepcomp87
-rw-r--r--htop.121
-rw-r--r--htop.1.in19
-rw-r--r--htop.c518
-rw-r--r--htop.h6
-rw-r--r--htop.pngbin169 -> 3657 bytes
-rwxr-xr-xinstall-sh5
-rwxr-xr-xmissing49
-rwxr-xr-xscripts/MakeHeader.py4
95 files changed, 3251 insertions, 2263 deletions
diff --git a/Affinity.c b/Affinity.c
index ce30aed..3b1e311 100644
--- a/Affinity.c
+++ b/Affinity.c
@@ -20,9 +20,9 @@ typedef struct Affinity_ {
}*/
Affinity* Affinity_new() {
- Affinity* this = calloc(sizeof(Affinity), 1);
+ Affinity* this = calloc(1, sizeof(Affinity));
this->size = 8;
- this->cpus = calloc(sizeof(int), this->size);
+ this->cpus = calloc(this->size, sizeof(int));
return this;
}
diff --git a/AffinityPanel.c b/AffinityPanel.c
index 8c406fb..094a010 100644
--- a/AffinityPanel.c
+++ b/AffinityPanel.c
@@ -34,9 +34,17 @@ static HandlerResult AffinityPanel_eventHandler(Panel* this, int ch) {
return IGNORED;
}
+PanelClass AffinityPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = Panel_delete
+ },
+ .eventHandler = AffinityPanel_eventHandler
+};
+
Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity) {
- Panel* this = Panel_new(1, 1, 1, 1, CHECKITEM_CLASS, true, ListItem_compare);
- this->eventHandler = AffinityPanel_eventHandler;
+ Panel* this = Panel_new(1, 1, 1, 1, true, Class(CheckItem));
+ Object_setClass(this, Class(AffinityPanel));
Panel_setHeader(this, "Use CPUs:");
int curCpu = 0;
diff --git a/AffinityPanel.h b/AffinityPanel.h
index 392a259..63283c5 100644
--- a/AffinityPanel.h
+++ b/AffinityPanel.h
@@ -14,6 +14,8 @@ in the source distribution for its full text.
#include "ProcessList.h"
#include "ListItem.h"
+extern PanelClass AffinityPanel_class;
+
Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity);
Affinity* AffinityPanel_getAffinity(Panel* this);
diff --git a/AvailableColumnsPanel.c b/AvailableColumnsPanel.c
index fce9880..d954da8 100644
--- a/AvailableColumnsPanel.c
+++ b/AvailableColumnsPanel.c
@@ -63,15 +63,21 @@ static HandlerResult AvailableColumnsPanel_eventHandler(Panel* super, int ch) {
return result;
}
+PanelClass AvailableColumnsPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = AvailableColumnsPanel_delete
+ },
+ .eventHandler = AvailableColumnsPanel_eventHandler
+};
+
AvailableColumnsPanel* AvailableColumnsPanel_new(Settings* settings, Panel* columns, ScreenManager* scr) {
- AvailableColumnsPanel* this = (AvailableColumnsPanel*) malloc(sizeof(AvailableColumnsPanel));
+ AvailableColumnsPanel* this = AllocThis(AvailableColumnsPanel);
Panel* super = (Panel*) this;
- Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
- ((Object*)this)->delete = AvailableColumnsPanel_delete;
+ Panel_init(super, 1, 1, 1, 1, Class(ListItem), true);
this->settings = settings;
this->scr = scr;
- super->eventHandler = AvailableColumnsPanel_eventHandler;
Panel_setHeader(super, "Available Columns");
diff --git a/AvailableColumnsPanel.h b/AvailableColumnsPanel.h
index 6a32f9f..0a29e6a 100644
--- a/AvailableColumnsPanel.h
+++ b/AvailableColumnsPanel.h
@@ -22,6 +22,8 @@ typedef struct AvailableColumnsPanel_ {
} AvailableColumnsPanel;
+extern PanelClass AvailableColumnsPanel_class;
+
AvailableColumnsPanel* AvailableColumnsPanel_new(Settings* settings, Panel* columns, ScreenManager* scr);
#endif
diff --git a/AvailableMetersPanel.c b/AvailableMetersPanel.c
index 0cdb508..f582851 100644
--- a/AvailableMetersPanel.c
+++ b/AvailableMetersPanel.c
@@ -37,7 +37,7 @@ static void AvailableMetersPanel_delete(Object* object) {
free(this);
}
-static inline void AvailableMetersPanel_addHeader(Header* header, Panel* panel, MeterType* type, int param, HeaderSide side) {
+static inline void AvailableMetersPanel_addHeader(Header* header, Panel* panel, MeterClass* type, int param, HeaderSide side) {
Meter* meter = (Meter*) Header_addMeter(header, type, param, side);
Panel_add(panel, (Object*) Meter_toListItem(meter));
}
@@ -78,26 +78,32 @@ static HandlerResult AvailableMetersPanel_eventHandler(Panel* super, int ch) {
return result;
}
+PanelClass AvailableMetersPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = AvailableMetersPanel_delete
+ },
+ .eventHandler = AvailableMetersPanel_eventHandler
+};
+
AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Panel* leftMeters, Panel* rightMeters, ScreenManager* scr) {
- AvailableMetersPanel* this = (AvailableMetersPanel*) malloc(sizeof(AvailableMetersPanel));
+ AvailableMetersPanel* this = AllocThis(AvailableMetersPanel);
Panel* super = (Panel*) this;
- Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
- ((Object*)this)->delete = AvailableMetersPanel_delete;
+ Panel_init(super, 1, 1, 1, 1, Class(ListItem), true);
this->settings = settings;
this->leftPanel = leftMeters;
this->rightPanel = rightMeters;
this->scr = scr;
- super->eventHandler = AvailableMetersPanel_eventHandler;
Panel_setHeader(super, "Available meters");
for (int i = 1; Meter_types[i]; i++) {
- MeterType* type = Meter_types[i];
- if (type != &CPUMeter) {
+ MeterClass* type = Meter_types[i];
+ if (type != &CPUMeter_class) {
Panel_add(super, (Object*) ListItem_new(type->uiName, i << 16));
}
}
- MeterType* type = &CPUMeter;
+ MeterClass* type = &CPUMeter_class;
int cpus = settings->pl->cpuCount;
if (cpus > 1) {
Panel_add(super, (Object*) ListItem_new("CPU average", 0));
diff --git a/AvailableMetersPanel.h b/AvailableMetersPanel.h
index c34f0b2..281e285 100644
--- a/AvailableMetersPanel.h
+++ b/AvailableMetersPanel.h
@@ -23,6 +23,8 @@ typedef struct AvailableMetersPanel_ {
} AvailableMetersPanel;
+extern PanelClass AvailableMetersPanel_class;
+
AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Panel* leftMeters, Panel* rightMeters, ScreenManager* scr);
#endif
diff --git a/BatteryMeter.c b/BatteryMeter.c
index 071efd5..f2dfa6a 100644
--- a/BatteryMeter.c
+++ b/BatteryMeter.c
@@ -36,12 +36,13 @@ int BatteryMeter_attributes[] = {
static unsigned long int parseUevent(FILE * file, const char *key) {
char line[100];
unsigned long int dValue = 0;
+ char* saveptr;
while (fgets(line, sizeof line, file)) {
if (strncmp(line, key, strlen(key)) == 0) {
char *value;
- strtok(line, "=");
- value = strtok(NULL, "=");
+ strtok_r(line, "=", &saveptr);
+ value = strtok_r(NULL, "=", &saveptr);
dValue = atoi(value);
break;
}
@@ -55,169 +56,160 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
if (!batteryDir)
return 0;
- typedef struct listLbl {
- char *content;
- struct listLbl *next;
- } list;
-
- list *myList = NULL;
- list *newEntry;
-
- /*
- Some of this is based off of code found in kismet (they claim it came from gkrellm).
- Written for multi battery use...
- */
- for (const struct dirent* dirEntries = readdir((DIR *) batteryDir); dirEntries; dirEntries = readdir((DIR *) batteryDir)) {
- char* entryName = (char *) dirEntries->d_name;
+ #define MAX_BATTERIES 64
+ char* batteries[MAX_BATTERIES];
+ unsigned int nBatteries = 0;
+ memset(batteries, 0, MAX_BATTERIES * sizeof(char*));
+ struct dirent result;
+ struct dirent* dirEntry;
+ while (nBatteries < MAX_BATTERIES) {
+ int err = readdir_r(batteryDir, &result, &dirEntry);
+ if (err || !dirEntry)
+ break;
+ char* entryName = dirEntry->d_name;
if (strncmp(entryName, "BAT", 3))
continue;
-
- newEntry = calloc(1, sizeof(list));
- newEntry->next = myList;
- newEntry->content = entryName;
- myList = newEntry;
+ batteries[nBatteries] = strdup(entryName);
+ nBatteries++;
}
+ closedir(batteryDir);
unsigned long int total = 0;
- for (newEntry = myList; newEntry; newEntry = newEntry->next) {
- const char infoPath[30];
- const FILE *file;
- char line[50];
+ for (unsigned int i = 0; i < nBatteries; i++) {
+ char infoPath[30];
+ snprintf(infoPath, sizeof infoPath, "%s%s/%s", batteryPath, batteries[i], fileName);
- snprintf((char *) infoPath, sizeof infoPath, "%s%s/%s", batteryPath, newEntry->content, fileName);
-
- if ((file = fopen(infoPath, "r")) == NULL) {
- closedir(batteryDir);
- return 0;
+ FILE* file = fopen(infoPath, "r");
+ if (!file) {
+ break;
}
+ char line[50] = "";
for (unsigned short int i = 0; i < lineNum; i++) {
- fgets(line, sizeof line, (FILE *) file);
+ char* ok = fgets(line, sizeof line, file);
+ if (!ok) break;
}
- fclose((FILE *) file);
+ fclose(file);
- const char *foundNumTmp = String_getToken(line, wordNum);
- const unsigned long int foundNum = atoi(foundNumTmp);
- free((char *) foundNumTmp);
+ char *foundNumStr = String_getToken(line, wordNum);
+ const unsigned long int foundNum = atoi(foundNumStr);
+ free(foundNumStr);
total += foundNum;
}
- free(myList);
- free(newEntry);
- closedir(batteryDir);
+ for (unsigned int i = 0; i < nBatteries; i++) {
+ free(batteries[i]);
+ }
+
return total;
}
-static ACPresence chkIsOnline() {
- FILE *file = NULL;
+static ACPresence procAcpiCheck() {
ACPresence isOn = AC_ERROR;
+ const char *power_supplyPath = PROCDIR "/acpi/ac_adapter";
+ DIR *power_supplyDir = opendir(power_supplyPath);
+ if (!power_supplyDir) {
+ return AC_ERROR;
+ }
- if (access(PROCDIR "/acpi/ac_adapter", F_OK) == 0) {
- const char *power_supplyPath = PROCDIR "/acpi/ac_adapter";
- DIR *power_supplyDir = opendir(power_supplyPath);
- if (!power_supplyDir)
- return AC_ERROR;
-
- for (const struct dirent *dirEntries = readdir((DIR *) power_supplyDir); dirEntries; dirEntries = readdir((DIR *) power_supplyDir)) {
- char* entryName = (char *) dirEntries->d_name;
-
- if (entryName[0] != 'A')
- continue;
-
- char statePath[50];
- snprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
- file = fopen(statePath, "r");
-
- if (!file) {
- isOn = AC_ERROR;
- continue;
- }
-
- char line[100];
- fgets(line, sizeof line, file);
- line[sizeof(line) - 1] = '\0';
+ struct dirent result;
+ struct dirent* dirEntry;
+ for (;;) {
+ int err = readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
+ if (err || !dirEntry)
+ break;
- if (file) {
- fclose(file);
- file = NULL;
- }
+ char* entryName = (char *) dirEntry->d_name;
- const char *isOnline = String_getToken(line, 2);
+ if (entryName[0] != 'A')
+ continue;
- if (strcmp(isOnline, "on-line") == 0) {
- free((char *) isOnline);
- isOn = AC_PRESENT;
- // If any AC adapter is being used then stop
- break;
+ char statePath[50];
+ snprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
+ FILE* file = fopen(statePath, "r");
- } else {
- isOn = AC_ABSENT;
- }
- free((char *) isOnline);
+ if (!file) {
+ isOn = AC_ERROR;
+ continue;
}
- if (power_supplyDir)
- closedir(power_supplyDir);
-
- } else {
-
- const char *power_supplyPath = "/sys/class/power_supply";
-
- if (access("/sys/class/power_supply", F_OK) == 0) {
- const struct dirent *dirEntries;
- DIR *power_supplyDir = opendir(power_supplyPath);
- char *entryName;
+ char line[100];
+ fgets(line, sizeof line, file);
+ line[sizeof(line) - 1] = '\0';
- if (!power_supplyDir) {
- return AC_ERROR;
- }
-
- for (dirEntries = readdir((DIR *) power_supplyDir); dirEntries; dirEntries = readdir((DIR *) power_supplyDir)) {
- entryName = (char *) dirEntries->d_name;
+ fclose(file);
- if (strncmp(entryName, "A", 1)) {
- continue;
- }
+ const char *isOnline = String_getToken(line, 2);
- char onlinePath[50];
- snprintf((char *) onlinePath, sizeof onlinePath, "%s/%s/online", power_supplyPath, entryName);
- file = fopen(onlinePath, "r");
+ if (strcmp(isOnline, "on-line") == 0) {
+ isOn = AC_PRESENT;
+ } else {
+ isOn = AC_ABSENT;
+ }
+ free((char *) isOnline);
+ if (isOn == AC_PRESENT) {
+ break;
+ }
+ }
- if (!file) {
- isOn = AC_ERROR;
- continue;
- }
+ if (power_supplyDir)
+ closedir(power_supplyDir);
+ return isOn;
+}
- isOn = (fgetc(file) - '0');
+static ACPresence sysCheck() {
+ ACPresence isOn = AC_ERROR;
+ const char *power_supplyPath = "/sys/class/power_supply";
+ DIR *power_supplyDir = opendir(power_supplyPath);
+ if (!power_supplyDir) {
+ return AC_ERROR;
+ }
- if (file) {
- fclose(file);
- file = NULL;
- }
+ struct dirent result;
+ struct dirent* dirEntry;
+ for (;;) {
+ int err = readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
+ if (err || !dirEntry)
+ break;
- if (isOn == AC_PRESENT) {
- // If any AC adapter is being used then stop
- break;
- } else {
- continue;
- }
+ char* entryName = (char *) dirEntry->d_name;
+ if (strncmp(entryName, "A", 1)) {
+ continue;
+ }
+ char onlinePath[50];
+ snprintf((char *) onlinePath, sizeof onlinePath, "%s/%s/online", power_supplyPath, entryName);
+ FILE* file = fopen(onlinePath, "r");
+ if (!file) {
+ isOn = AC_ERROR;
+ } else {
+ isOn = (fgetc(file) - '0');
+ fclose(file);
+ if (isOn == AC_PRESENT) {
+ // If any AC adapter is being used then stop
+ break;
}
-
- if (power_supplyDir)
- closedir(power_supplyDir);
}
}
- // Just in case :-)
- if (file)
- fclose(file);
+ if (power_supplyDir)
+ closedir(power_supplyDir);
return isOn;
}
+static ACPresence chkIsOnline() {
+ if (access(PROCDIR "/acpi/ac_adapter", F_OK) == 0) {
+ return procAcpiCheck();
+ } else if (access("/sys/class/power_supply", F_OK) == 0) {
+ return sysCheck();
+ } else {
+ return AC_ERROR;
+ }
+}
+
static double getProcBatData() {
const unsigned long int totalFull = parseBatInfo("info", 3, 4);
if (totalFull == 0)
@@ -227,24 +219,25 @@ static double getProcBatData() {
if (totalRemain == 0)
return 0;
- double percent = totalFull > 0 ? ((double) totalRemain * 100) / (double) totalFull : 0;
- return percent;
+ return totalRemain * 100.0 / (double) totalFull;
}
static double getSysBatData() {
- const struct dirent *dirEntries;
const char *power_supplyPath = "/sys/class/power_supply/";
DIR *power_supplyDir = opendir(power_supplyPath);
if (!power_supplyDir)
return 0;
- char *entryName;
-
unsigned long int totalFull = 0;
unsigned long int totalRemain = 0;
- for (dirEntries = readdir((DIR *) power_supplyDir); dirEntries; dirEntries = readdir((DIR *) power_supplyDir)) {
- entryName = (char *) dirEntries->d_name;
+ struct dirent result;
+ struct dirent* dirEntry;
+ for (;;) {
+ int err = readdir_r((DIR *) power_supplyDir, &result, &dirEntry);
+ if (err || !dirEntry)
+ break;
+ char* entryName = (char *) dirEntry->d_name;
if (strncmp(entryName, "BAT", 3)) {
continue;
@@ -328,11 +321,13 @@ static void BatteryMeter_setValues(Meter * this, char *buffer, int len) {
return;
}
-MeterType BatteryMeter = {
+MeterClass BatteryMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete
+ },
.setValues = BatteryMeter_setValues,
- .display = NULL,
- .mode = TEXT_METERMODE,
- .items = 1,
+ .defaultMode = TEXT_METERMODE,
.total = 100.0,
.attributes = BatteryMeter_attributes,
.name = "Battery",
diff --git a/BatteryMeter.h b/BatteryMeter.h
index 56ed951..25fd3c9 100644
--- a/BatteryMeter.h
+++ b/BatteryMeter.h
@@ -22,6 +22,6 @@ typedef enum ACPresence_ {
extern int BatteryMeter_attributes[];
-extern MeterType BatteryMeter;
+extern MeterClass BatteryMeter_class;
#endif
diff --git a/CPUMeter.c b/CPUMeter.c
index 90555ff..95b397f 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -12,7 +12,6 @@ in the source distribution for its full text.
#include <assert.h>
#include <stdlib.h>
-#include <curses.h>
#include <string.h>
#include <math.h>
@@ -21,7 +20,7 @@ in the source distribution for its full text.
}*/
int CPUMeter_attributes[] = {
- CPU_NICE, CPU_NORMAL, CPU_KERNEL, CPU_IRQ, CPU_SOFTIRQ, CPU_IOWAIT, CPU_STEAL, CPU_GUEST
+ CPU_NICE, CPU_NORMAL, CPU_KERNEL, CPU_IRQ, CPU_SOFTIRQ, CPU_STEAL, CPU_GUEST, CPU_IOWAIT
};
#ifndef MIN
@@ -52,24 +51,29 @@ static void CPUMeter_setValues(Meter* this, char* buffer, int size) {
CPUData* cpuData = &(pl->cpus[cpu]);
double total = (double) ( cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod);
double percent;
- this->values[0] = cpuData->nicePeriod / total * 100.0;
- this->values[1] = cpuData->userPeriod / total * 100.0;
+ double* v = this->values;
+ v[0] = cpuData->nicePeriod / total * 100.0;
+ v[1] = cpuData->userPeriod / total * 100.0;
if (pl->detailedCPUTime) {
- this->values[2] = cpuData->systemPeriod / total * 100.0;
- this->values[3] = cpuData->irqPeriod / total * 100.0;
- this->values[4] = cpuData->softIrqPeriod / total * 100.0;
- this->values[5] = cpuData->ioWaitPeriod / total * 100.0;
- this->values[6] = cpuData->stealPeriod / total * 100.0;
- this->values[7] = cpuData->guestPeriod / total * 100.0;
- this->type->items = 8;
- percent = MIN(100.0, MAX(0.0, (this->values[0]+this->values[1]+this->values[2]+
- this->values[3]+this->values[4])));
+ v[2] = cpuData->systemPeriod / total * 100.0;
+ v[3] = cpuData->irqPeriod / total * 100.0;
+ v[4] = cpuData->softIrqPeriod / total * 100.0;
+ v[5] = cpuData->stealPeriod / total * 100.0;
+ v[6] = cpuData->guestPeriod / total * 100.0;
+ v[7] = cpuData->ioWaitPeriod / total * 100.0;
+ Meter_setItems(this, 8);
+ if (pl->accountGuestInCPUMeter) {
+ percent = v[0]+v[1]+v[2]+v[3]+v[4]+v[5]+v[6];
+ } else {
+ percent = v[0]+v[1]+v[2]+v[3]+v[4];
+ }
} else {
- this->values[2] = cpuData->systemAllPeriod / total * 100.0;
- this->values[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0;
- this->type->items = 4;
- percent = MIN(100.0, MAX(0.0, (this->values[0]+this->values[1]+this->values[2]+this->values[3])));
+ v[2] = cpuData->systemAllPeriod / total * 100.0;
+ v[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0;
+ Meter_setItems(this, 4);
+ percent = v[0]+v[1]+v[2]+v[3];
}
+ percent = MIN(100.0, MAX(0.0, percent));
if (isnan(percent)) percent = 0.0;
snprintf(buffer, size, "%5.1f%%", percent);
}
@@ -91,31 +95,33 @@ static void CPUMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[CPU_KERNEL], buffer);
sprintf(buffer, "%5.1f%% ", this->values[0]);
RichString_append(out, CRT_colors[METER_TEXT], "ni:");
- RichString_append(out, CRT_colors[CPU_NICE], buffer);
+ RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
sprintf(buffer, "%5.1f%% ", this->values[3]);
RichString_append(out, CRT_colors[METER_TEXT], "hi:");
RichString_append(out, CRT_colors[CPU_IRQ], buffer);
sprintf(buffer, "%5.1f%% ", this->values[4]);
RichString_append(out, CRT_colors[METER_TEXT], "si:");
RichString_append(out, CRT_colors[CPU_SOFTIRQ], buffer);
- sprintf(buffer, "%5.1f%% ", this->values[5]);
- RichString_append(out, CRT_colors[METER_TEXT], "wa:");
- RichString_append(out, CRT_colors[CPU_IOWAIT], buffer);
- sprintf(buffer, "%5.1f%% ", this->values[6]);
- RichString_append(out, CRT_colors[METER_TEXT], "st:");
- RichString_append(out, CRT_colors[CPU_STEAL], buffer);
- if (this->values[7]) {
- sprintf(buffer, "%5.1f%% ", this->values[7]);
+ if (this->values[5]) {
+ sprintf(buffer, "%5.1f%% ", this->values[5]);
+ RichString_append(out, CRT_colors[METER_TEXT], "st:");
+ RichString_append(out, CRT_colors[CPU_STEAL], buffer);
+ }
+ if (this->values[6]) {
+ sprintf(buffer, "%5.1f%% ", this->values[6]);
RichString_append(out, CRT_colors[METER_TEXT], "gu:");
RichString_append(out, CRT_colors[CPU_GUEST], buffer);
}
+ sprintf(buffer, "%5.1f%% ", this->values[7]);
+ RichString_append(out, CRT_colors[METER_TEXT], "wa:");
+ RichString_append(out, CRT_colors[CPU_IOWAIT], buffer);
} else {
sprintf(buffer, "%5.1f%% ", this->values[2]);
RichString_append(out, CRT_colors[METER_TEXT], "sys:");
RichString_append(out, CRT_colors[CPU_KERNEL], buffer);
sprintf(buffer, "%5.1f%% ", this->values[0]);
RichString_append(out, CRT_colors[METER_TEXT], "low:");
- RichString_append(out, CRT_colors[CPU_NICE], buffer);
+ RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
if (this->values[3]) {
sprintf(buffer, "%5.1f%% ", this->values[3]);
RichString_append(out, CRT_colors[METER_TEXT], "vir:");
@@ -126,7 +132,7 @@ static void CPUMeter_display(Object* cast, RichString* out) {
static void AllCPUsMeter_getRange(Meter* this, int* start, int* count) {
int cpus = this->pl->cpuCount;
- switch(this->type->name[0]) {
+ switch(Meter_name(this)[0]) {
default:
case 'A': // All
*start = 0;
@@ -146,19 +152,19 @@ static void AllCPUsMeter_getRange(Meter* this, int* start, int* count) {
static void AllCPUsMeter_init(Meter* this) {
int cpus = this->pl->cpuCount;
if (!this->drawData)
- this->drawData = calloc(sizeof(Meter*), cpus);
+ this->drawData = calloc(cpus, sizeof(Meter*));
Meter** meters = (Meter**) this->drawData;
int start, count;
AllCPUsMeter_getRange(this, &start, &count);
for (int i = 0; i < count; i++) {
if (!meters[i])
- meters[i] = Meter_new(this->pl, start+i+1, &CPUMeter);
- meters[i]->type->init(meters[i]);
+ meters[i] = Meter_new(this->pl, start+i+1, (MeterClass*) Class(CPUMeter));
+ Meter_init(meters[i]);
}
if (this->mode == 0)
this->mode = BAR_METERMODE;
int h = Meter_modes[this->mode]->h;
- if (strchr(this->type->name, '2'))
+ if (strchr(Meter_name(this), '2'))
this->h = h * ((count+1) / 2);
else
this->h = h * count;
@@ -172,7 +178,7 @@ static void AllCPUsMeter_done(Meter* this) {
Meter_delete((Object*)meters[i]);
}
-static void AllCPUsMeter_setMode(Meter* this, int mode) {
+static void AllCPUsMeter_updateMode(Meter* this, int mode) {
Meter** meters = (Meter**) this->drawData;
this->mode = mode;
int h = Meter_modes[mode]->h;
@@ -181,7 +187,7 @@ static void AllCPUsMeter_setMode(Meter* this, int mode) {
for (int i = 0; i < count; i++) {
Meter_setMode(meters[i], mode);
}
- if (strchr(this->type->name, '2'))
+ if (strchr(Meter_name(this), '2'))
this->h = h * ((count+1) / 2);
else
this->h = h * count;
@@ -214,11 +220,15 @@ static void SingleColCPUsMeter_draw(Meter* this, int x, int y, int w) {
}
}
-MeterType CPUMeter = {
+MeterClass CPUMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = CPUMeter_display
+ },
.setValues = CPUMeter_setValues,
- .display = CPUMeter_display,
- .mode = BAR_METERMODE,
- .items = 8,
+ .defaultMode = BAR_METERMODE,
+ .maxItems = 8,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "CPU",
@@ -227,9 +237,13 @@ MeterType CPUMeter = {
.init = CPUMeter_init
};
-MeterType AllCPUsMeter = {
- .mode = 0,
- .items = 1,
+MeterClass AllCPUsMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = CPUMeter_display
+ },
+ .defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "AllCPUs",
@@ -237,13 +251,17 @@ MeterType AllCPUsMeter = {
.caption = "CPU",
.draw = SingleColCPUsMeter_draw,
.init = AllCPUsMeter_init,
- .setMode = AllCPUsMeter_setMode,
+ .updateMode = AllCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
-MeterType AllCPUs2Meter = {
- .mode = 0,
- .items = 1,
+MeterClass AllCPUs2Meter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = CPUMeter_display
+ },
+ .defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "AllCPUs2",
@@ -251,13 +269,17 @@ MeterType AllCPUs2Meter = {
.caption = "CPU",
.draw = DualColCPUsMeter_draw,
.init = AllCPUsMeter_init,
- .setMode = AllCPUsMeter_setMode,
+ .updateMode = AllCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
-MeterType LeftCPUsMeter = {
- .mode = 0,
- .items = 1,
+MeterClass LeftCPUsMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = CPUMeter_display
+ },
+ .defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "LeftCPUs",
@@ -265,13 +287,17 @@ MeterType LeftCPUsMeter = {
.caption = "CPU",
.draw = SingleColCPUsMeter_draw,
.init = AllCPUsMeter_init,
- .setMode = AllCPUsMeter_setMode,
+ .updateMode = AllCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
-MeterType RightCPUsMeter = {
- .mode = 0,
- .items = 1,
+MeterClass RightCPUsMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = CPUMeter_display
+ },
+ .defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "RightCPUs",
@@ -279,13 +305,17 @@ MeterType RightCPUsMeter = {
.caption = "CPU",
.draw = SingleColCPUsMeter_draw,
.init = AllCPUsMeter_init,
- .setMode = AllCPUsMeter_setMode,
+ .updateMode = AllCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
-MeterType LeftCPUs2Meter = {
- .mode = 0,
- .items = 1,
+MeterClass LeftCPUs2Meter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = CPUMeter_display
+ },
+ .defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "LeftCPUs2",
@@ -293,13 +323,17 @@ MeterType LeftCPUs2Meter = {
.caption = "CPU",
.draw = DualColCPUsMeter_draw,
.init = AllCPUsMeter_init,
- .setMode = AllCPUsMeter_setMode,
+ .updateMode = AllCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
-MeterType RightCPUs2Meter = {
- .mode = 0,
- .items = 1,
+MeterClass RightCPUs2Meter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = CPUMeter_display
+ },
+ .defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "RightCPUs2",
@@ -307,7 +341,7 @@ MeterType RightCPUs2Meter = {
.caption = "CPU",
.draw = DualColCPUsMeter_draw,
.init = AllCPUsMeter_init,
- .setMode = AllCPUsMeter_setMode,
+ .updateMode = AllCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
diff --git a/CPUMeter.h b/CPUMeter.h
index 251fbdc..f91c759 100644
--- a/CPUMeter.h
+++ b/CPUMeter.h
@@ -20,19 +20,19 @@ extern int CPUMeter_attributes[];
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-extern MeterType CPUMeter;
+extern MeterClass CPUMeter_class;
-extern MeterType AllCPUsMeter;
+extern MeterClass AllCPUsMeter_class;
-extern MeterType AllCPUs2Meter;
+extern MeterClass AllCPUs2Meter_class;
-extern MeterType LeftCPUsMeter;
+extern MeterClass LeftCPUsMeter_class;
-extern MeterType RightCPUsMeter;
+extern MeterClass RightCPUsMeter_class;
-extern MeterType LeftCPUs2Meter;
+extern MeterClass LeftCPUs2Meter_class;
-extern MeterType RightCPUs2Meter;
+extern MeterClass RightCPUs2Meter_class;
#endif
diff --git a/CRT.c b/CRT.c
index 6cc979f..c0d1b82 100644
--- a/CRT.c
+++ b/CRT.c
@@ -9,8 +9,9 @@ in the source distribution for its full text.
#include "config.h"
#include "String.h"
+#include "RichString.h"
-#include <curses.h>
+#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
@@ -84,6 +85,7 @@ typedef enum ColorElements_ {
GRAPH_9,
MEMORY_USED,
MEMORY_BUFFERS,
+ MEMORY_BUFFERS_TEXT,
MEMORY_CACHE,
LOAD,
LOAD_AVERAGE_FIFTEEN,
@@ -96,6 +98,7 @@ typedef enum ColorElements_ {
HELP_BOLD,
HOSTNAME,
CPU_NICE,
+ CPU_NICE_TEXT,
CPU_NORMAL,
CPU_KERNEL,
CPU_IOWAIT,
@@ -106,20 +109,26 @@ typedef enum ColorElements_ {
LAST_COLORELEMENT
} ColorElements;
+void CRT_fatalError(const char* note) __attribute__ ((noreturn));
+
}*/
// TODO: centralize these in Settings.
static bool CRT_hasColors;
-int CRT_delay = 0;
+static int CRT_delay = 0;
int CRT_colorScheme = 0;
+bool CRT_utf8 = false;
+
int CRT_colors[LAST_COLORELEMENT] = { 0 };
int CRT_cursorX = 0;
+int CRT_scrollHAmount = 5;
+
char* CRT_termType;
void *backtraceArray[128];
@@ -128,7 +137,7 @@ static void CRT_handleSIGSEGV(int sgn) {
(void) sgn;
CRT_done();
#if __linux
- fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at http://htop.sf.net\n");
+ fprintf(stderr, "\n\nhtop " VERSION " aborting. Please report bug at http://hisham.hm/htop\n");
#ifdef HAVE_EXECINFO_H
size_t size = backtrace(backtraceArray, sizeof(backtraceArray) / sizeof(void *));
fprintf(stderr, "\n Please include in your report the following backtrace: \n");
@@ -158,7 +167,7 @@ void CRT_init(int delay, int colorScheme) {
noecho();
CRT_delay = delay;
CRT_colorScheme = colorScheme;
- halfdelay(CRT_delay);
+ halfdelay(CRT_delay/2);
nonl();
intrflush(stdscr, false);
keypad(stdscr, true);
@@ -170,9 +179,15 @@ void CRT_init(int delay, int colorScheme) {
CRT_hasColors = false;
}
CRT_termType = getenv("TERM");
+ if (String_eq(CRT_termType, "linux"))
+ CRT_scrollHAmount = 20;
+ else
+ CRT_scrollHAmount = 5;
if (String_eq(CRT_termType, "xterm") || String_eq(CRT_termType, "xterm-color") || String_eq(CRT_termType, "vt220")) {
define_key("\033[H", KEY_HOME);
define_key("\033[F", KEY_END);
+ define_key("\033[7~", KEY_HOME);
+ define_key("\033[8~", KEY_END);
define_key("\033OP", KEY_F(1));
define_key("\033OQ", KEY_F(2));
define_key("\033OR", KEY_F(3));
@@ -212,7 +227,7 @@ int CRT_readKey() {
cbreak();
nodelay(stdscr, FALSE);
int ret = getch();
- halfdelay(CRT_delay);
+ halfdelay(CRT_delay/2);
return ret;
}
@@ -223,7 +238,7 @@ void CRT_disableDelay() {
}
void CRT_enableDelay() {
- halfdelay(CRT_delay);
+ halfdelay(CRT_delay/2);
}
void CRT_setColors(int colorScheme) {
@@ -280,6 +295,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_DIM;
CRT_colors[MEMORY_USED] = A_BOLD;
CRT_colors[MEMORY_BUFFERS] = A_NORMAL;
+ CRT_colors[MEMORY_BUFFERS_TEXT] = A_NORMAL;
CRT_colors[MEMORY_CACHE] = A_NORMAL;
CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_DIM;
CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL;
@@ -292,6 +308,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = A_NORMAL;
CRT_colors[HOSTNAME] = A_BOLD;
CRT_colors[CPU_NICE] = A_NORMAL;
+ CRT_colors[CPU_NICE_TEXT] = A_NORMAL;
CRT_colors[CPU_NORMAL] = A_BOLD;
CRT_colors[CPU_KERNEL] = A_BOLD;
CRT_colors[CPU_IOWAIT] = A_NORMAL;
@@ -341,6 +358,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = ColorPair(Yellow,White);
CRT_colors[MEMORY_USED] = ColorPair(Green,White);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Cyan,White);
+ CRT_colors[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,White);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,White);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,White);
CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Black,White);
@@ -353,6 +371,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = ColorPair(Black,White);
CRT_colors[HOSTNAME] = ColorPair(Black,White);
CRT_colors[CPU_NICE] = ColorPair(Cyan,White);
+ CRT_colors[CPU_NICE_TEXT] = ColorPair(Cyan,White);
CRT_colors[CPU_NORMAL] = ColorPair(Green,White);
CRT_colors[CPU_KERNEL] = ColorPair(Red,White);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, White);
@@ -402,6 +421,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = ColorPair(Yellow,Black);
CRT_colors[MEMORY_USED] = ColorPair(Green,Black);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Cyan,Black);
+ CRT_colors[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,Black);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,Black);
CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Black,Black);
@@ -414,6 +434,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = ColorPair(Black,Black);
CRT_colors[HOSTNAME] = ColorPair(White,Black);
CRT_colors[CPU_NICE] = ColorPair(Cyan,Black);
+ CRT_colors[CPU_NICE_TEXT] = ColorPair(Cyan,Black);
CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black);
@@ -463,6 +484,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Yellow,Blue);
CRT_colors[MEMORY_USED] = A_BOLD | ColorPair(Green,Blue);
CRT_colors[MEMORY_BUFFERS] = A_BOLD | ColorPair(Cyan,Blue);
+ CRT_colors[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Cyan,Blue);
CRT_colors[MEMORY_CACHE] = A_BOLD | ColorPair(Yellow,Blue);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Blue);
CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL | ColorPair(White,Blue);
@@ -475,6 +497,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = A_NORMAL | ColorPair(White,Blue);
CRT_colors[HOSTNAME] = ColorPair(White,Blue);
CRT_colors[CPU_NICE] = A_BOLD | ColorPair(Cyan,Blue);
+ CRT_colors[CPU_NICE_TEXT] = A_BOLD | ColorPair(Cyan,Blue);
CRT_colors[CPU_NORMAL] = A_BOLD | ColorPair(Green,Blue);
CRT_colors[CPU_KERNEL] = A_BOLD | ColorPair(Red,Blue);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Blue,Blue);
@@ -524,6 +547,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Black,Black);
CRT_colors[MEMORY_USED] = ColorPair(Green,Black);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Blue,Black);
+ CRT_colors[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green,Black);
CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Green,Black);
@@ -536,6 +560,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = ColorPair(Cyan,Black);
CRT_colors[HOSTNAME] = ColorPair(Green,Black);
CRT_colors[CPU_NICE] = ColorPair(Blue,Black);
+ CRT_colors[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
CRT_colors[CPU_IOWAIT] = ColorPair(Yellow,Black);
@@ -586,6 +611,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[GRAPH_9] = A_BOLD | ColorPair(Black,Black);
CRT_colors[MEMORY_USED] = ColorPair(Green,Black);
CRT_colors[MEMORY_BUFFERS] = ColorPair(Blue,Black);
+ CRT_colors[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[MEMORY_CACHE] = ColorPair(Yellow,Black);
CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Black);
CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL;
@@ -598,6 +624,7 @@ void CRT_setColors(int colorScheme) {
CRT_colors[CHECK_TEXT] = A_NORMAL;
CRT_colors[HOSTNAME] = A_BOLD;
CRT_colors[CPU_NICE] = ColorPair(Blue,Black);
+ CRT_colors[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black);
CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
CRT_colors[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Black);
diff --git a/CRT.h b/CRT.h
index 7916b16..883c675 100644
--- a/CRT.h
+++ b/CRT.h
@@ -76,6 +76,7 @@ typedef enum ColorElements_ {
GRAPH_9,
MEMORY_USED,
MEMORY_BUFFERS,
+ MEMORY_BUFFERS_TEXT,
MEMORY_CACHE,
LOAD,
LOAD_AVERAGE_FIFTEEN,
@@ -88,6 +89,7 @@ typedef enum ColorElements_ {
HELP_BOLD,
HOSTNAME,
CPU_NICE,
+ CPU_NICE_TEXT,
CPU_NORMAL,
CPU_KERNEL,
CPU_IOWAIT,
@@ -98,17 +100,21 @@ typedef enum ColorElements_ {
LAST_COLORELEMENT
} ColorElements;
+void CRT_fatalError(const char* note) __attribute__ ((noreturn));
-// TODO: centralize these in Settings.
-extern int CRT_delay;
+// TODO: centralize these in Settings.
extern int CRT_colorScheme;
+extern bool CRT_utf8;
+
extern int CRT_colors[LAST_COLORELEMENT];
extern int CRT_cursorX;
+extern int CRT_scrollHAmount;
+
char* CRT_termType;
void *backtraceArray[128];
diff --git a/CategoriesPanel.c b/CategoriesPanel.c
index 0114ae4..bf6ee54 100644
--- a/CategoriesPanel.c
+++ b/CategoriesPanel.c
@@ -101,6 +101,12 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
result = HANDLED;
break;
}
+ default:
+ if (isalpha(ch))
+ result = Panel_selectByTyping(super, ch);
+ if (result == BREAK_LOOP)
+ result = IGNORED;
+ break;
}
if (result == HANDLED) {
@@ -126,15 +132,21 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
return result;
}
+PanelClass CategoriesPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = CategoriesPanel_delete
+ },
+ .eventHandler = CategoriesPanel_eventHandler
+};
+
CategoriesPanel* CategoriesPanel_new(Settings* settings, ScreenManager* scr) {
- CategoriesPanel* this = (CategoriesPanel*) malloc(sizeof(CategoriesPanel));
+ CategoriesPanel* this = AllocThis(CategoriesPanel);
Panel* super = (Panel*) this;
- Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
- ((Object*)this)->delete = CategoriesPanel_delete;
+ Panel_init(super, 1, 1, 1, 1, Class(ListItem), true);
this->settings = settings;
this->scr = scr;
- super->eventHandler = CategoriesPanel_eventHandler;
Panel_setHeader(super, "Setup");
Panel_add(super, (Object*) ListItem_new("Meters", 0));
Panel_add(super, (Object*) ListItem_new("Display options", 0));
diff --git a/CategoriesPanel.h b/CategoriesPanel.h
index 1311fe2..9d30330 100644
--- a/CategoriesPanel.h
+++ b/CategoriesPanel.h
@@ -23,6 +23,8 @@ typedef struct CategoriesPanel_ {
void CategoriesPanel_makeMetersPage(CategoriesPanel* this);
+extern PanelClass CategoriesPanel_class;
+
CategoriesPanel* CategoriesPanel_new(Settings* settings, ScreenManager* scr);
#endif
diff --git a/ChangeLog b/ChangeLog
index a866a6a..1aafc65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,21 @@
+What's new in version 1.0.3
+
+* Tag all children ('c' key)
+* Fixes in accounting of guest time when using virtualization
+ (thanks to Patrick Marlier)
+* Performance improvements
+ (thanks to Jann Horn)
+* Further performance improvements due to conditional parsing
+ of IO data depending on selected fields.
+* Better consistency in coloring.
+* Increase limit of buffer when tracing a deep nested process tree.
+* Display pagefault stats.
+* BUGFIX: Fix crash when adding meters and toggling detailed CPU time.
+ (thanks to Dawid Gajownik)
+* Add column to track the OOM-killer score of processes
+ (thanks to Leigh Simpson)
+
What's new in version 1.0.2
* Add IO priority support ('i' key)
diff --git a/CheckItem.c b/CheckItem.c
index 0fb40cf..ea83e6f 100644
--- a/CheckItem.c
+++ b/CheckItem.c
@@ -18,18 +18,12 @@ in the source distribution for its full text.
typedef struct CheckItem_ {
Object super;
char* text;
- bool value;
bool* ref;
+ bool value;
} CheckItem;
}*/
-#ifdef DEBUG
-char* CHECKITEM_CLASS = "CheckItem";
-#else
-#define CHECKITEM_CLASS NULL
-#endif
-
static void CheckItem_delete(Object* cast) {
CheckItem* this = (CheckItem*)cast;
assert (this != NULL);
@@ -50,11 +44,13 @@ static void CheckItem_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[CHECK_TEXT], this->text);
}
+ObjectClass CheckItem_class = {
+ .display = CheckItem_display,
+ .delete = CheckItem_delete
+};
+
CheckItem* CheckItem_new(char* text, bool* ref, bool value) {
- CheckItem* this = malloc(sizeof(CheckItem));
- Object_setClass(this, CHECKITEM_CLASS);
- ((Object*)this)->display = CheckItem_display;
- ((Object*)this)->delete = CheckItem_delete;
+ CheckItem* this = AllocThis(CheckItem);
this->text = text;
this->value = value;
this->ref = ref;
diff --git a/CheckItem.h b/CheckItem.h
index 6c70790..86d4aa5 100644
--- a/CheckItem.h
+++ b/CheckItem.h
@@ -14,16 +14,12 @@ in the source distribution for its full text.
typedef struct CheckItem_ {
Object super;
char* text;
- bool value;
bool* ref;
+ bool value;
} CheckItem;
-#ifdef DEBUG
-extern char* CHECKITEM_CLASS;
-#else
-#define CHECKITEM_CLASS NULL
-#endif
+extern ObjectClass CheckItem_class;
CheckItem* CheckItem_new(char* text, bool* ref, bool value);
diff --git a/ClockMeter.c b/ClockMeter.c
index 7edf5bf..25a1e2e 100644
--- a/ClockMeter.c
+++ b/ClockMeter.c
@@ -21,17 +21,20 @@ int ClockMeter_attributes[] = {
static void ClockMeter_setValues(Meter* this, char* buffer, int size) {
time_t t = time(NULL);
- struct tm *lt = localtime(&t);
+ struct tm result;
+ struct tm *lt = localtime_r(&t, &result);
this->values[0] = lt->tm_hour * 60 + lt->tm_min;
strftime(buffer, size, "%H:%M:%S", lt);
}
-MeterType ClockMeter = {
+MeterClass ClockMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete
+ },
.setValues = ClockMeter_setValues,
- .display = NULL,
- .mode = TEXT_METERMODE,
+ .defaultMode = TEXT_METERMODE,
.total = 100.0,
- .items = 1,
.attributes = ClockMeter_attributes,
.name = "Clock",
.uiName = "Clock",
diff --git a/ClockMeter.h b/ClockMeter.h
index ed19786..3e0aef5 100644
--- a/ClockMeter.h
+++ b/ClockMeter.h
@@ -13,6 +13,6 @@ in the source distribution for its full text.
extern int ClockMeter_attributes[];
-extern MeterType ClockMeter;
+extern MeterClass ClockMeter_class;
#endif
diff --git a/ColorsPanel.c b/ColorsPanel.c
index bf94bf5..4e28d01 100644
--- a/ColorsPanel.c
+++ b/ColorsPanel.c
@@ -51,7 +51,7 @@ static void ColorsPanel_delete(Object* object) {
free(this);
}
-static HandlerResult ColorsPanel_EventHandler(Panel* super, int ch) {
+static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) {
ColorsPanel* this = (ColorsPanel*) super;
HandlerResult result = IGNORED;
@@ -83,15 +83,21 @@ static HandlerResult ColorsPanel_EventHandler(Panel* super, int ch) {
return result;
}
+PanelClass ColorsPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = ColorsPanel_delete
+ },
+ .eventHandler = ColorsPanel_eventHandler
+};
+
ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr) {
- ColorsPanel* this = (ColorsPanel*) malloc(sizeof(ColorsPanel));
+ ColorsPanel* this = AllocThis(ColorsPanel);
Panel* super = (Panel*) this;
- Panel_init(super, 1, 1, 1, 1, CHECKITEM_CLASS, true);
- ((Object*)this)->delete = ColorsPanel_delete;
+ Panel_init(super, 1, 1, 1, 1, Class(CheckItem), true);
this->settings = settings;
this->scr = scr;
- super->eventHandler = ColorsPanel_EventHandler;
Panel_setHeader(super, "Colors");
for (int i = 0; ColorSchemes[i] != NULL; i++) {
diff --git a/ColorsPanel.h b/ColorsPanel.h
index 61b89c0..10dcb50 100644
--- a/ColorsPanel.h
+++ b/ColorsPanel.h
@@ -27,6 +27,8 @@ typedef struct ColorsPanel_ {
} ColorsPanel;
+extern PanelClass ColorsPanel_class;
+
ColorsPanel* ColorsPanel_new(Settings* settings, ScreenManager* scr);
#endif
diff --git a/ColumnsPanel.c b/ColumnsPanel.c
index d6b442a..f4eed99 100644
--- a/ColumnsPanel.c
+++ b/ColumnsPanel.c
@@ -82,15 +82,21 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) {
return result;
}
+PanelClass ColumnsPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = ColumnsPanel_delete
+ },
+ .eventHandler = ColumnsPanel_eventHandler
+};
+
ColumnsPanel* ColumnsPanel_new(Settings* settings, ScreenManager* scr) {
- ColumnsPanel* this = (ColumnsPanel*) malloc(sizeof(ColumnsPanel));
+ ColumnsPanel* this = AllocThis(ColumnsPanel);
Panel* super = (Panel*) this;
- Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
- ((Object*)this)->delete = ColumnsPanel_delete;
+ Panel_init(super, 1, 1, 1, 1, Class(ListItem), true);
this->settings = settings;
this->scr = scr;
- super->eventHandler = ColumnsPanel_eventHandler;
Panel_setHeader(super, "Active Columns");
ProcessField* fields = this->settings->pl->fields;
@@ -116,11 +122,14 @@ void ColumnsPanel_update(Panel* super) {
// FIXME: this is crappily inefficient
free(this->settings->pl->fields);
this->settings->pl->fields = (ProcessField*) malloc(sizeof(ProcessField) * (size+1));
+ this->settings->pl->flags = 0;
for (int i = 0; i < size; i++) {
char* text = ((ListItem*) Panel_get(super, i))->value;
int j = ColumnsPanel_fieldNameToIndex(text);
- if (j > 0)
+ if (j > 0) {
this->settings->pl->fields[i] = j;
+ this->settings->pl->flags |= Process_fieldFlags[j];
+ }
}
this->settings->pl->fields[size] = 0;
}
diff --git a/ColumnsPanel.h b/ColumnsPanel.h
index 2ebb387..122d9f9 100644
--- a/ColumnsPanel.h
+++ b/ColumnsPanel.h
@@ -21,6 +21,8 @@ typedef struct ColumnsPanel_ {
} ColumnsPanel;
+extern PanelClass ColumnsPanel_class;
+
ColumnsPanel* ColumnsPanel_new(Settings* settings, ScreenManager* scr);
int ColumnsPanel_fieldNameToIndex(const char* name);
diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c
index 7ec035b..6153313 100644
--- a/DisplayOptionsPanel.c
+++ b/DisplayOptionsPanel.c
@@ -61,15 +61,21 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
return result;
}
+PanelClass DisplayOptionsPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = DisplayOptionsPanel_delete
+ },
+ .eventHandler = DisplayOptionsPanel_eventHandler
+};
+
DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager* scr) {
- DisplayOptionsPanel* this = (DisplayOptionsPanel*) malloc(sizeof(DisplayOptionsPanel));
+ DisplayOptionsPanel* this = AllocThis(DisplayOptionsPanel);
Panel* super = (Panel*) this;
- Panel_init(super, 1, 1, 1, 1, CHECKITEM_CLASS, true);
- ((Object*)this)->delete = DisplayOptionsPanel_delete;
+ Panel_init(super, 1, 1, 1, 1, Class(CheckItem), true);
this->settings = settings;
this->scr = scr;
- super->eventHandler = DisplayOptionsPanel_eventHandler;
Panel_setHeader(super, "Display options");
Panel_add(super, (Object*) CheckItem_new(strdup("Tree view"), &(settings->pl->treeView), false));
@@ -84,5 +90,6 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
Panel_add(super, (Object*) CheckItem_new(strdup("Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest)"), &(settings->pl->detailedCPUTime), false));
Panel_add(super, (Object*) CheckItem_new(strdup("Count CPUs from 0 instead of 1"), &(settings->pl->countCPUsFromZero), false));
Panel_add(super, (Object*) CheckItem_new(strdup("Update process names on every refresh"), &(settings->pl->updateProcessNames), false));
+ Panel_add(super, (Object*) CheckItem_new(strdup("Add guest time in CPU meter percentage"), &(settings->pl->accountGuestInCPUMeter), false));
return this;
}
diff --git a/DisplayOptionsPanel.h b/DisplayOptionsPanel.h
index 1e013f3..2a7509a 100644
--- a/DisplayOptionsPanel.h
+++ b/DisplayOptionsPanel.h
@@ -21,6 +21,8 @@ typedef struct DisplayOptionsPanel_ {
} DisplayOptionsPanel;
+extern PanelClass DisplayOptionsPanel_class;
+
DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager* scr);
#endif
diff --git a/FunctionBar.c b/FunctionBar.c
index dc4368e..1c6066a 100644
--- a/FunctionBar.c
+++ b/FunctionBar.c
@@ -13,7 +13,6 @@ in the source distribution for its full text.
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
-#include <curses.h>
/*{
#include "Object.h"
@@ -29,31 +28,31 @@ typedef struct FunctionBar_ {
}*/
-#ifdef DEBUG
-char* FUNCTIONBAR_CLASS = "FunctionBar";
-#else
-#define FUNCTIONBAR_CLASS NULL
-#endif
-
static const char* FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL};
static const char* FunctionBar_FLabels[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", NULL};
static int FunctionBar_FEvents[] = {KEY_F(1), KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), KEY_F(10)};
+ObjectClass FunctionBar_class = {
+ .delete = FunctionBar_delete
+};
+
FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* events) {
- FunctionBar* this = malloc(sizeof(FunctionBar));
- Object_setClass(this, FUNCTIONBAR_CLASS);
- ((Object*) this)->delete = FunctionBar_delete;
- this->functions = (char**) functions;
+ FunctionBar* this = AllocThis(FunctionBar);
+ this->functions = calloc(16, sizeof(char*));
+ if (!functions) {
+ functions = FunctionBar_FLabels;
+ }
+ for (int i = 0; i < 15 && functions[i]; i++) {
+ this->functions[i] = strdup(functions[i]);
+ }
if (keys && events) {
this->staticData = false;
- this->functions = malloc(sizeof(char*) * 15);
this->keys = malloc(sizeof(char*) * 15);
this->events = malloc(sizeof(int) * 15);
int i = 0;
while (i < 15 && functions[i]) {
- this->functions[i] = strdup(functions[i]);
this->keys[i] = strdup(keys[i]);
this->events[i] = events[i];
i++;
@@ -61,7 +60,6 @@ FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* eve
this->size = i;
} else {
this->staticData = true;
- this->functions = (char**)( functions ? functions : FunctionBar_FLabels );
this->keys = (char**) FunctionBar_FKeys;
this->events = FunctionBar_FEvents;
this->size = 10;
@@ -71,12 +69,14 @@ FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* eve
void FunctionBar_delete(Object* cast) {
FunctionBar* this = (FunctionBar*) cast;
+ for (int i = 0; i < 15 && this->functions[i]; i++) {
+ free(this->functions[i]);
+ }
+ free(this->functions);
if (!this->staticData) {
for (int i = 0; i < this->size; i++) {
- free(this->functions[i]);
free(this->keys[i]);
}
- free(this->functions);
free(this->keys);
free(this->events);
}
@@ -84,7 +84,6 @@ void FunctionBar_delete(Object* cast) {
}
void FunctionBar_setLabel(FunctionBar* this, int event, const char* text) {
- assert(!this->staticData);
for (int i = 0; i < this->size; i++) {
if (this->events[i] == event) {
free(this->functions[i]);
diff --git a/FunctionBar.h b/FunctionBar.h
index 584d7fd..68e28f9 100644
--- a/FunctionBar.h
+++ b/FunctionBar.h
@@ -21,11 +21,7 @@ typedef struct FunctionBar_ {
} FunctionBar;
-#ifdef DEBUG
-extern char* FUNCTIONBAR_CLASS;
-#else
-#define FUNCTIONBAR_CLASS NULL
-#endif
+extern ObjectClass FunctionBar_class;
FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* events);
diff --git a/Hashtable.c b/Hashtable.c
index 9d84db8..0f61519 100644
--- a/Hashtable.c
+++ b/Hashtable.c
@@ -76,7 +76,7 @@ Hashtable* Hashtable_new(int size, bool owner) {
this = (Hashtable*) malloc(sizeof(Hashtable));
this->items = 0;
this->size = size;
- this->buckets = (HashtableItem**) calloc(sizeof(HashtableItem*), size);
+ this->buckets = (HashtableItem**) calloc(size, sizeof(HashtableItem*));
this->owner = owner;
assert(Hashtable_isConsistent(this));
return this;
diff --git a/Header.c b/Header.c
index ea1078f..5558684 100644
--- a/Header.c
+++ b/Header.c
@@ -37,9 +37,9 @@ typedef struct Header_ {
Vector* leftMeters;
Vector* rightMeters;
ProcessList* pl;
- bool margin;
int height;
int pad;
+ bool margin;
} Header;
}*/
@@ -49,9 +49,9 @@ typedef struct Header_ {
#endif
Header* Header_new(ProcessList* pl) {
- Header* this = calloc(sizeof(Header), 1);
- this->leftMeters = Vector_new(METER_CLASS, true, DEFAULT_SIZE, NULL);
- this->rightMeters = Vector_new(METER_CLASS, true, DEFAULT_SIZE, NULL);
+ Header* this = calloc(1, sizeof(Header));
+ this->leftMeters = Vector_new(Class(Meter), true, DEFAULT_SIZE);
+ this->rightMeters = Vector_new(Class(Meter), true, DEFAULT_SIZE);
this->margin = true;
this->pl = pl;
return this;
@@ -71,11 +71,11 @@ void Header_createMeter(Header* this, char* name, HeaderSide side) {
char* paren = strchr(name, '(');
int param = 0;
if (paren) {
- int ok = sscanf(paren, "(%d)", &param);
+ int ok = sscanf(paren, "(%10d)", &param);
if (!ok) param = 0;
*paren = '\0';
}
- for (MeterType** type = Meter_types; *type; type++) {
+ for (MeterClass** type = Meter_types; *type; type++) {
if (String_eq(name, (*type)->name)) {
Vector_add(meters, Meter_new(this->pl, param, *type));
break;
@@ -94,7 +94,7 @@ void Header_setMode(Header* this, int i, MeterModeId mode, HeaderSide side) {
Meter_setMode(meter, mode);
}
-Meter* Header_addMeter(Header* this, MeterType* type, int param, HeaderSide side) {
+Meter* Header_addMeter(Header* this, MeterClass* type, int param, HeaderSide side) {
Vector* meters = side == LEFT_HEADER
? this->leftMeters
: this->rightMeters;
@@ -118,10 +118,10 @@ char* Header_readMeterName(Header* this, int i, HeaderSide side) {
: this->rightMeters;
Meter* meter = (Meter*) Vector_get(meters, i);
- int nameLen = strlen(meter->type->name);
+ int nameLen = strlen(Meter_name(meter));
int len = nameLen + 100;
char* name = malloc(len);
- strncpy(name, meter->type->name, nameLen);
+ strncpy(name, Meter_name(meter), nameLen);
name[nameLen] = '\0';
if (meter->param)
snprintf(name + nameLen, len - nameLen, "(%d)", meter->param);
@@ -140,38 +140,37 @@ MeterModeId Header_readMeterMode(Header* this, int i, HeaderSide side) {
void Header_defaultMeters(Header* this, int cpuCount) {
if (cpuCount > 8) {
- Vector_add(this->leftMeters, Meter_new(this->pl, 0, &LeftCPUs2Meter));
- Vector_add(this->rightMeters, Meter_new(this->pl, 0, &RightCPUs2Meter));
+ Vector_add(this->leftMeters, Meter_new(this->pl, 0, (MeterClass*) Class(LeftCPUs2Meter)));
+ Vector_add(this->rightMeters, Meter_new(this->pl, 0, (MeterClass*) Class(RightCPUs2Meter)));
} else if (cpuCount > 4) {
- Vector_add(this->leftMeters, Meter_new(this->pl, 0, &LeftCPUsMeter));
- Vector_add(this->rightMeters, Meter_new(this->pl, 0, &RightCPUsMeter));
+ Vector_add(this->leftMeters, Meter_new(this->pl, 0, (MeterClass*) Class(LeftCPUsMeter)));
+ Vector_add(this->rightMeters, Meter_new(this->pl, 0, (MeterClass*) Class(RightCPUsMeter)));
} else {
- Vector_add(this->leftMeters, Meter_new(this->pl, 0, &AllCPUsMeter));
+ Vector_add(this->leftMeters, Meter_new(this->pl, 0, (MeterClass*) Class(AllCPUsMeter)));
}
- Vector_add(this->leftMeters, Meter_new(this->pl, 0, &MemoryMeter));
- Vector_add(this->leftMeters, Meter_new(this->pl, 0, &SwapMeter));
- Vector_add(this->rightMeters, Meter_new(this->pl, 0, &TasksMeter));
- Vector_add(this->rightMeters, Meter_new(this->pl, 0, &LoadAverageMeter));
- Vector_add(this->rightMeters, Meter_new(this->pl, 0, &UptimeMeter));
+ Vector_add(this->leftMeters, Meter_new(this->pl, 0, (MeterClass*) Class(MemoryMeter)));
+ Vector_add(this->leftMeters, Meter_new(this->pl, 0, (MeterClass*) Class(SwapMeter)));
+ Vector_add(this->rightMeters, Meter_new(this->pl, 0, (MeterClass*) Class(TasksMeter)));
+ Vector_add(this->rightMeters, Meter_new(this->pl, 0, (MeterClass*) Class(LoadAverageMeter)));
+ Vector_add(this->rightMeters, Meter_new(this->pl, 0, (MeterClass*) Class(UptimeMeter)));
}
void Header_reinit(Header* this) {
for (int i = 0; i < Vector_size(this->leftMeters); i++) {
Meter* meter = (Meter*) Vector_get(this->leftMeters, i);
- if (meter->type->init)
- meter->type->init(meter);
+ if (Meter_initFn(meter))
+ Meter_init(meter);
}
for (int i = 0; i < Vector_size(this->rightMeters); i++) {
Meter* meter = (Meter*) Vector_get(this->rightMeters, i);
- if (meter->type->init)
- meter->type->init(meter);
+ if (Meter_initFn(meter))
+ Meter_init(meter);
}
}
void Header_draw(const Header* this) {
int height = this->height;
int pad = this->pad;
-
attrset(CRT_colors[RESET_COLOR]);
for (int y = 0; y < height; y++) {
mvhline(y, 0, ' ', COLS);
diff --git a/Header.h b/Header.h
index 938d141..e778459 100644
--- a/Header.h
+++ b/Header.h
@@ -21,9 +21,9 @@ typedef struct Header_ {
Vector* leftMeters;
Vector* rightMeters;
ProcessList* pl;
- bool margin;
int height;
int pad;
+ bool margin;
} Header;
@@ -39,7 +39,7 @@ void Header_createMeter(Header* this, char* name, HeaderSide side);
void Header_setMode(Header* this, int i, MeterModeId mode, HeaderSide side);
-Meter* Header_addMeter(Header* this, MeterType* type, int param, HeaderSide side);
+Meter* Header_addMeter(Header* this, MeterClass* type, int param, HeaderSide side);
int Header_size(Header* this, HeaderSide side);
diff --git a/HostnameMeter.c b/HostnameMeter.c
index 0498ab7..b46541c 100644
--- a/HostnameMeter.c
+++ b/HostnameMeter.c
@@ -24,12 +24,14 @@ static void HostnameMeter_setValues(Meter* this, char* buffer, int size) {
gethostname(buffer, size-1);
}
-MeterType HostnameMeter = {
+MeterClass HostnameMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete
+ },
.setValues = HostnameMeter_setValues,
- .display = NULL,
- .mode = TEXT_METERMODE,
+ .defaultMode = TEXT_METERMODE,
.total = 100.0,
- .items = 1,
.attributes = HostnameMeter_attributes,
.name = "Hostname",
.uiName = "Hostname",
diff --git a/HostnameMeter.h b/HostnameMeter.h
index addc753..3697dff 100644
--- a/HostnameMeter.h
+++ b/HostnameMeter.h
@@ -13,6 +13,6 @@ in the source distribution for its full text.
extern int HostnameMeter_attributes[];
-extern MeterType HostnameMeter;
+extern MeterClass HostnameMeter_class;
#endif
diff --git a/IOPriorityPanel.c b/IOPriorityPanel.c
index bc80b7d..04d98b1 100644
--- a/IOPriorityPanel.c
+++ b/IOPriorityPanel.c
@@ -14,7 +14,7 @@ in the source distribution for its full text.
}*/
Panel* IOPriorityPanel_new(IOPriority currPrio) {
- Panel* this = Panel_new(1, 1, 1, 1, LISTITEM_CLASS, true, ListItem_compare);
+ Panel* this = Panel_new(1, 1, 1, 1, true, Class(ListItem));
Panel_setHeader(this, "IO Priority:");
Panel_add(this, (Object*) ListItem_new("None (based on nice)", IOPriority_None));
diff --git a/IncSet.c b/IncSet.c
new file mode 100644
index 0000000..40aa923
--- /dev/null
+++ b/IncSet.c
@@ -0,0 +1,213 @@
+/*
+htop - IncSet.c
+(C) 2005-2012 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "IncSet.h"
+#include "String.h"
+#include "Panel.h"
+#include "ListItem.h"
+#include "CRT.h"
+#include <string.h>
+#include <stdlib.h>
+
+/*{
+
+#include "FunctionBar.h"
+#include "Panel.h"
+#include <stdbool.h>
+
+#define INCMODE_MAX 40
+
+typedef enum {
+ INC_SEARCH = 0,
+ INC_FILTER = 1
+} IncType;
+
+#define IncSet_filter(inc_) (inc_->filtering ? inc_->modes[INC_FILTER].buffer : NULL)
+
+typedef struct IncMode_ {
+ char buffer[INCMODE_MAX+1];
+ int index;
+ FunctionBar* bar;
+ bool isFilter;
+} IncMode;
+
+typedef struct IncSet_ {
+ IncMode modes[2];
+ IncMode* active;
+ FunctionBar* bar;
+ FunctionBar* defaultBar;
+ bool filtering;
+} IncSet;
+
+typedef const char* (*IncMode_GetPanelValue)(Panel*, int);
+
+}*/
+
+static void IncMode_reset(IncMode* mode) {
+ mode->index = 0;
+ mode->buffer[0] = 0;
+}
+
+static const char* searchFunctions[] = {"Next ", "Cancel ", " Search: ", NULL};
+static const char* searchKeys[] = {"F3", "Esc", " "};
+static int searchEvents[] = {KEY_F(3), 27, ERR};
+
+static inline void IncMode_initSearch(IncMode* search) {
+ memset(search, 0, sizeof(IncMode));
+ search->bar = FunctionBar_new(searchFunctions, searchKeys, searchEvents);
+ search->isFilter = false;
+}
+
+static const char* filterFunctions[] = {"Done ", "Clear ", " Filter: ", NULL};
+static const char* filterKeys[] = {"Enter", "Esc", " "};
+static int filterEvents[] = {13, 27, ERR};
+
+static inline void IncMode_initFilter(IncMode* filter) {
+ memset(filter, 0, sizeof(IncMode));
+ filter->bar = FunctionBar_new(filterFunctions, filterKeys, filterEvents);
+ filter->isFilter = true;
+}
+
+static inline void IncMode_done(IncMode* mode) {
+ FunctionBar_delete((Object*)mode->bar);
+}
+
+IncSet* IncSet_new(FunctionBar* bar) {
+ IncSet* this = calloc(1, sizeof(IncSet));
+ IncMode_initSearch(&(this->modes[INC_SEARCH]));
+ IncMode_initFilter(&(this->modes[INC_FILTER]));
+ this->active = NULL;
+ this->filtering = false;
+ this->bar = bar;
+ this->defaultBar = bar;
+ return this;
+}
+
+void IncSet_delete(IncSet* this) {
+ IncMode_done(&(this->modes[0]));
+ IncMode_done(&(this->modes[1]));
+ free(this);
+}
+
+static void updateWeakPanel(IncSet* this, Panel* panel, Vector* lines) {
+ Object* selected = Panel_getSelected(panel);
+ Panel_prune(panel);
+ if (this->filtering) {
+ int n = 0;
+ const char* incFilter = this->modes[INC_FILTER].buffer;
+ for (int i = 0; i < Vector_size(lines); i++) {
+ ListItem* line = (ListItem*)Vector_get(lines, i);
+ if (String_contains_i(line->value, incFilter)) {
+ Panel_add(panel, (Object*)line);
+ if (selected == (Object*)line) Panel_setSelected(panel, n);
+ n++;
+ }
+ }
+ } else {
+ for (int i = 0; i < Vector_size(lines); i++) {
+ Object* line = Vector_get(lines, i);
+ Panel_add(panel, line);
+ if (selected == line) Panel_setSelected(panel, i);
+ }
+ }
+}
+
+static void search(IncMode* mode, Panel* panel, IncMode_GetPanelValue getPanelValue) {
+ int size = Panel_size(panel);
+ bool found = false;
+ for (int i = 0; i < size; i++) {
+ if (String_contains_i(getPanelValue(panel, i), mode->buffer)) {
+ Panel_setSelected(panel, i);
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ FunctionBar_draw(mode->bar, mode->buffer);
+ else
+ FunctionBar_drawAttr(mode->bar, mode->buffer, CRT_colors[FAILED_SEARCH]);
+}
+
+bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue getPanelValue, Vector* lines) {
+ if (ch == ERR)
+ return true;
+ IncMode* mode = this->active;
+ int size = Panel_size(panel);
+ bool filterChange = false;
+ bool doSearch = true;
+ if (ch == KEY_F(3)) {
+ if (size == 0) return true;
+ int here = Panel_getSelectedIndex(panel);
+ int i = here;
+ for(;;) {
+ i++;
+ if (i == size) i = 0;
+ if (i == here) break;
+ if (String_contains_i(getPanelValue(panel, i), mode->buffer)) {
+ Panel_setSelected(panel, i);
+ break;
+ }
+ }
+ doSearch = false;
+ } else if (isprint((char)ch) && (mode->index < INCMODE_MAX)) {
+ mode->buffer[mode->index] = ch;
+ mode->index++;
+ mode->buffer[mode->index] = 0;
+ if (mode->isFilter) {
+ filterChange = true;
+ if (mode->index == 1) this->filtering = true;
+ }
+ } else if ((ch == KEY_BACKSPACE || ch == 127) && (mode->index > 0)) {
+ mode->index--;
+ mode->buffer[mode->index] = 0;
+ if (mode->isFilter) {
+ filterChange = true;
+ if (mode->index == 0) {
+ this->filtering = false;
+ IncMode_reset(mode);
+ }
+ }
+ } else {
+ if (mode->isFilter) {
+ filterChange = true;
+ if (ch == 27) {
+ this->filtering = false;
+ IncMode_reset(mode);
+ }
+ } else {
+ IncMode_reset(mode);
+ }
+ this->active = NULL;
+ this->bar = this->defaultBar;
+ FunctionBar_draw(this->defaultBar, NULL);
+ doSearch = false;
+ }
+ if (doSearch) {
+ search(mode, panel, getPanelValue);
+ }
+ if (filterChange && lines) {
+ updateWeakPanel(this, panel, lines);
+ }
+ return filterChange;
+}
+
+const char* IncSet_getListItemValue(Panel* panel, int i) {
+ ListItem* l = (ListItem*) Panel_get(panel, i);
+ if (l)
+ return l->value;
+ return "";
+}
+
+void IncSet_activate(IncSet* this, IncType type) {
+ this->active = &(this->modes[type]);
+ this->bar = this->active->bar;
+ FunctionBar_draw(this->active->bar, this->active->buffer);
+}
+
+void IncSet_drawBar(IncSet* this) {
+ FunctionBar_draw(this->bar, this->active ? this->active->buffer : NULL);
+}
diff --git a/IncSet.h b/IncSet.h
new file mode 100644
index 0000000..c528f18
--- /dev/null
+++ b/IncSet.h
@@ -0,0 +1,56 @@
+/* Do not edit this file. It was automatically generated. */
+
+#ifndef HEADER_IncSet
+#define HEADER_IncSet
+/*
+htop - IncSet.h
+(C) 2005-2012 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+
+#include "FunctionBar.h"
+#include "Panel.h"
+#include <stdbool.h>
+
+#define INCMODE_MAX 40
+
+typedef enum {
+ INC_SEARCH = 0,
+ INC_FILTER = 1
+} IncType;
+
+#define IncSet_filter(inc_) (inc_->filtering ? inc_->modes[INC_FILTER].buffer : NULL)
+
+typedef struct IncMode_ {
+ char buffer[INCMODE_MAX+1];
+ int index;
+ FunctionBar* bar;
+ bool isFilter;
+} IncMode;
+
+typedef struct IncSet_ {
+ IncMode modes[2];
+ IncMode* active;
+ FunctionBar* bar;
+ FunctionBar* defaultBar;
+ bool filtering;
+} IncSet;
+
+typedef const char* (*IncMode_GetPanelValue)(Panel*, int);
+
+
+IncSet* IncSet_new(FunctionBar* bar);
+
+void IncSet_delete(IncSet* this);
+
+bool IncSet_handleKey(IncSet* this, int ch, Panel* panel, IncMode_GetPanelValue getPanelValue, Vector* lines);
+
+const char* IncSet_getListItemValue(Panel* panel, int i);
+
+void IncSet_activate(IncSet* this, IncType type);
+
+void IncSet_drawBar(IncSet* this);
+
+#endif
diff --git a/ListItem.c b/ListItem.c
index 9beed0c..140ebdc 100644
--- a/ListItem.c
+++ b/ListItem.c
@@ -26,12 +26,6 @@ typedef struct ListItem_ {
}*/
-#ifdef DEBUG
-char* LISTITEM_CLASS = "ListItem";
-#else
-#define LISTITEM_CLASS NULL
-#endif
-
static void ListItem_delete(Object* cast) {
ListItem* this = (ListItem*)cast;
free(this->value);
@@ -41,27 +35,34 @@ static void ListItem_delete(Object* cast) {
static void ListItem_display(Object* cast, RichString* out) {
ListItem* this = (ListItem*)cast;
assert (this != NULL);
+ /*
int len = strlen(this->value)+1;
char buffer[len+1];
snprintf(buffer, len, "%s", this->value);
- RichString_write(out, CRT_colors[DEFAULT_COLOR], buffer);
+ */
+ RichString_write(out, CRT_colors[DEFAULT_COLOR], this->value/*buffer*/);
}
+ObjectClass ListItem_class = {
+ .display = ListItem_display,
+ .delete = ListItem_delete,
+ .compare = ListItem_compare
+};
+
ListItem* ListItem_new(const char* value, int key) {
- ListItem* this = malloc(sizeof(ListItem));
- Object_setClass(this, LISTITEM_CLASS);
- ((Object*)this)->display = ListItem_display;
- ((Object*)this)->delete = ListItem_delete;
+ ListItem* this = AllocThis(ListItem);
this->value = strdup(value);
this->key = key;
return this;
}
-void ListItem_append(ListItem* this, char* text) {
- char* buf = malloc(strlen(this->value) + strlen(text) + 1);
- sprintf(buf, "%s%s", this->value, text);
- free(this->value);
- this->value = buf;
+void ListItem_append(ListItem* this, const char* text) {
+ int oldLen = strlen(this->value);
+ int textLen = strlen(text);
+ int newLen = strlen(this->value) + textLen;
+ this->value = realloc(this->value, newLen + 1);
+ memcpy(this->value + oldLen, text, textLen);
+ this->value[newLen] = '\0';
}
const char* ListItem_getRef(ListItem* this) {
diff --git a/ListItem.h b/ListItem.h
index 8df792c..a3ca075 100644
--- a/ListItem.h
+++ b/ListItem.h
@@ -18,15 +18,11 @@ typedef struct ListItem_ {
} ListItem;
-#ifdef DEBUG
-extern char* LISTITEM_CLASS;
-#else
-#define LISTITEM_CLASS NULL
-#endif
+extern ObjectClass ListItem_class;
ListItem* ListItem_new(const char* value, int key);
-void ListItem_append(ListItem* this, char* text);
+void ListItem_append(ListItem* this, const char* text);
const char* ListItem_getRef(ListItem* this);
diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c
index 9d5071b..850f802 100644
--- a/LoadAverageMeter.c
+++ b/LoadAverageMeter.c
@@ -9,7 +9,6 @@ in the source distribution for its full text.
#include "CRT.h"
-#include <curses.h>
#include <assert.h>
/*{
@@ -67,11 +66,15 @@ static void LoadMeter_display(Object* cast, RichString* out) {
RichString_write(out, CRT_colors[LOAD], buffer);
}
-MeterType LoadAverageMeter = {
+MeterClass LoadAverageMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = LoadAverageMeter_display,
+ },
.setValues = LoadAverageMeter_setValues,
- .display = LoadAverageMeter_display,
- .mode = TEXT_METERMODE,
- .items = 3,
+ .defaultMode = TEXT_METERMODE,
+ .maxItems = 3,
.total = 100.0,
.attributes = LoadAverageMeter_attributes,
.name = "LoadAverage",
@@ -79,11 +82,14 @@ MeterType LoadAverageMeter = {
.caption = "Load average: "
};
-MeterType LoadMeter = {
+MeterClass LoadMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = LoadMeter_display,
+ },
.setValues = LoadMeter_setValues,
- .display = LoadMeter_display,
- .mode = TEXT_METERMODE,
- .items = 1,
+ .defaultMode = TEXT_METERMODE,
.total = 100.0,
.attributes = LoadMeter_attributes,
.name = "Load",
diff --git a/LoadAverageMeter.h b/LoadAverageMeter.h
index b30680f..bd18f4d 100644
--- a/LoadAverageMeter.h
+++ b/LoadAverageMeter.h
@@ -15,8 +15,8 @@ extern int LoadAverageMeter_attributes[];
extern int LoadMeter_attributes[];
-extern MeterType LoadAverageMeter;
+extern MeterClass LoadAverageMeter_class;
-extern MeterType LoadMeter;
+extern MeterClass LoadMeter_class;
#endif
diff --git a/Makefile.am b/Makefile.am
index 05a72e7..820e2e5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,16 +20,16 @@ LoadAverageMeter.c MemoryMeter.c Meter.c MetersPanel.c Object.c Panel.c \
BatteryMeter.c Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \
IOPriorityPanel.c SignalsPanel.c String.c SwapMeter.c TasksMeter.c TraceScreen.c \
UptimeMeter.c UsersTable.c Vector.c AvailableColumnsPanel.c AffinityPanel.c \
-HostnameMeter.c OpenFilesScreen.c Affinity.c IOPriority.c
+HostnameMeter.c OpenFilesScreen.c Affinity.c IOPriority.c IncSet.c
myhtopheaders = AvailableColumnsPanel.h AvailableMetersPanel.h \
CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h \
IOPriorityPanel.h CPUMeter.h CRT.h DisplayOptionsPanel.h FunctionBar.h \
Hashtable.h Header.h htop.h ListItem.h LoadAverageMeter.h MemoryMeter.h \
BatteryMeter.h Meter.h MetersPanel.h Object.h Panel.h ProcessList.h RichString.h \
-ScreenManager.h Settings.h SignalsPanel.h String.h \
-SwapMeter.h TasksMeter.h TraceScreen.h UptimeMeter.h UsersTable.h Vector.h \
-Process.h AffinityPanel.h HostnameMeter.h OpenFilesScreen.h Affinity.h IOPriority.h
+ScreenManager.h Settings.h SignalsPanel.h String.h SwapMeter.h TasksMeter.h \
+TraceScreen.h UptimeMeter.h UsersTable.h Vector.h Process.h AffinityPanel.h \
+HostnameMeter.h OpenFilesScreen.h Affinity.h IOPriority.h IncSet.h
SUFFIXES = .h
@@ -37,13 +37,13 @@ BUILT_SOURCES = $(myhtopheaders)
htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h
profile:
- $(MAKE) all CFLAGS="" AM_CPPFLAGS="-pg -O2"
+ $(MAKE) all CFLAGS="-pg" AM_CPPFLAGS="-pg -O2 -DNDEBUG"
debug:
$(MAKE) all CFLAGS="" AM_CPPFLAGS="-ggdb -DDEBUG"
.c.h:
- scripts/MakeHeader.py $<
+ @srcdir@/scripts/MakeHeader.py $<
cppcheck:
cppcheck -q -v . --enable=all -DHAVE_CGROUP -DHAVE_OPENVZ -DHAVE_TASKSTATS
diff --git a/Makefile.in b/Makefile.in
index b818ec9..9cc52b7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -82,7 +82,7 @@ am__objects_2 = htop-AvailableMetersPanel.$(OBJEXT) \
htop-AvailableColumnsPanel.$(OBJEXT) \
htop-AffinityPanel.$(OBJEXT) htop-HostnameMeter.$(OBJEXT) \
htop-OpenFilesScreen.$(OBJEXT) htop-Affinity.$(OBJEXT) \
- htop-IOPriority.$(OBJEXT)
+ htop-IOPriority.$(OBJEXT) htop-IncSet.$(OBJEXT)
am_htop_OBJECTS = $(am__objects_1) $(am__objects_2)
htop_OBJECTS = $(am_htop_OBJECTS)
htop_LDADD = $(LDADD)
@@ -274,16 +274,16 @@ LoadAverageMeter.c MemoryMeter.c Meter.c MetersPanel.c Object.c Panel.c \
BatteryMeter.c Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \
IOPriorityPanel.c SignalsPanel.c String.c SwapMeter.c TasksMeter.c TraceScreen.c \
UptimeMeter.c UsersTable.c Vector.c AvailableColumnsPanel.c AffinityPanel.c \
-HostnameMeter.c OpenFilesScreen.c Affinity.c IOPriority.c
+HostnameMeter.c OpenFilesScreen.c Affinity.c IOPriority.c IncSet.c
myhtopheaders = AvailableColumnsPanel.h AvailableMetersPanel.h \
CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h \
IOPriorityPanel.h CPUMeter.h CRT.h DisplayOptionsPanel.h FunctionBar.h \
Hashtable.h Header.h htop.h ListItem.h LoadAverageMeter.h MemoryMeter.h \
BatteryMeter.h Meter.h MetersPanel.h Object.h Panel.h ProcessList.h RichString.h \
-ScreenManager.h Settings.h SignalsPanel.h String.h \
-SwapMeter.h TasksMeter.h TraceScreen.h UptimeMeter.h UsersTable.h Vector.h \
-Process.h AffinityPanel.h HostnameMeter.h OpenFilesScreen.h Affinity.h IOPriority.h
+ScreenManager.h Settings.h SignalsPanel.h String.h SwapMeter.h TasksMeter.h \
+TraceScreen.h UptimeMeter.h UsersTable.h Vector.h Process.h AffinityPanel.h \
+HostnameMeter.h OpenFilesScreen.h Affinity.h IOPriority.h IncSet.h
SUFFIXES = .h
BUILT_SOURCES = $(myhtopheaders)
@@ -418,6 +418,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-HostnameMeter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-IOPriority.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-IOPriorityPanel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-IncSet.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-ListItem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-LoadAverageMeter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-MemoryMeter.Po@am__quote@
@@ -1036,6 +1037,20 @@ htop-IOPriority.obj: IOPriority.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -c -o htop-IOPriority.obj `if test -f 'IOPriority.c'; then $(CYGPATH_W) 'IOPriority.c'; else $(CYGPATH_W) '$(srcdir)/IOPriority.c'; fi`
+htop-IncSet.o: IncSet.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -MT htop-IncSet.o -MD -MP -MF $(DEPDIR)/htop-IncSet.Tpo -c -o htop-IncSet.o `test -f 'IncSet.c' || echo '$(srcdir)/'`IncSet.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/htop-IncSet.Tpo $(DEPDIR)/htop-IncSet.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='IncSet.c' object='htop-IncSet.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -c -o htop-IncSet.o `test -f 'IncSet.c' || echo '$(srcdir)/'`IncSet.c
+
+htop-IncSet.obj: IncSet.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -MT htop-IncSet.obj -MD -MP -MF $(DEPDIR)/htop-IncSet.Tpo -c -o htop-IncSet.obj `if test -f 'IncSet.c'; then $(CYGPATH_W) 'IncSet.c'; else $(CYGPATH_W) '$(srcdir)/IncSet.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/htop-IncSet.Tpo $(DEPDIR)/htop-IncSet.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='IncSet.c' object='htop-IncSet.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -c -o htop-IncSet.obj `if test -f 'IncSet.c'; then $(CYGPATH_W) 'IncSet.c'; else $(CYGPATH_W) '$(srcdir)/IncSet.c'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
@@ -1470,13 +1485,13 @@ uninstall-man: uninstall-man1
profile:
- $(MAKE) all CFLAGS="" AM_CPPFLAGS="-pg -O2"
+ $(MAKE) all CFLAGS="-pg" AM_CPPFLAGS="-pg -O2 -DNDEBUG"
debug:
$(MAKE) all CFLAGS="" AM_CPPFLAGS="-ggdb -DDEBUG"
.c.h:
- scripts/MakeHeader.py $<
+ @srcdir@/scripts/MakeHeader.py $<
cppcheck:
cppcheck -q -v . --enable=all -DHAVE_CGROUP -DHAVE_OPENVZ -DHAVE_TASKSTATS
diff --git a/MemoryMeter.c b/MemoryMeter.c
index fa897d7..0151625 100644
--- a/MemoryMeter.c
+++ b/MemoryMeter.c
@@ -11,7 +11,6 @@ in the source distribution for its full text.
#include "ProcessList.h"
#include <stdlib.h>
-#include <curses.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
@@ -53,17 +52,21 @@ static void MemoryMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[MEMORY_USED], buffer);
sprintf(buffer, format, buffersMem);
RichString_append(out, CRT_colors[METER_TEXT], "buffers:");
- RichString_append(out, CRT_colors[MEMORY_BUFFERS], buffer);
+ RichString_append(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer);
sprintf(buffer, format, cachedMem);
RichString_append(out, CRT_colors[METER_TEXT], "cache:");
RichString_append(out, CRT_colors[MEMORY_CACHE], buffer);
}
-MeterType MemoryMeter = {
+MeterClass MemoryMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = MemoryMeter_display,
+ },
.setValues = MemoryMeter_setValues,
- .display = MemoryMeter_display,
- .mode = BAR_METERMODE,
- .items = 3,
+ .defaultMode = BAR_METERMODE,
+ .maxItems = 3,
.total = 100.0,
.attributes = MemoryMeter_attributes,
"Memory",
diff --git a/MemoryMeter.h b/MemoryMeter.h
index 8fa1e42..6ddae92 100644
--- a/MemoryMeter.h
+++ b/MemoryMeter.h
@@ -13,6 +13,6 @@ in the source distribution for its full text.
extern int MemoryMeter_attributes[];
-extern MeterType MemoryMeter;
+extern MeterClass MemoryMeter_class;
#endif
diff --git a/Meter.c b/Meter.c
index b009d66..3abd708 100644
--- a/Meter.c
+++ b/Meter.c
@@ -21,17 +21,14 @@ in the source distribution for its full text.
#include "CRT.h"
#include "String.h"
#include "ListItem.h"
+#include "Settings.h"
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
-#include <time.h>
-
-#ifndef USE_FUNKY_MODES
-#define USE_FUNKY_MODES 1
-#endif
+#include <sys/time.h>
#define METER_BUFFER_LEN 128
@@ -40,44 +37,53 @@ in the source distribution for its full text.
#include "ProcessList.h"
typedef struct Meter_ Meter;
-typedef struct MeterType_ MeterType;
-typedef struct MeterMode_ MeterMode;
-typedef void(*MeterType_Init)(Meter*);
-typedef void(*MeterType_Done)(Meter*);
-typedef void(*MeterType_SetMode)(Meter*, int);
+typedef void(*Meter_Init)(Meter*);
+typedef void(*Meter_Done)(Meter*);
+typedef void(*Meter_UpdateMode)(Meter*, int);
typedef void(*Meter_SetValues)(Meter*, char*, int);
typedef void(*Meter_Draw)(Meter*, int, int, int);
-struct MeterMode_ {
- Meter_Draw draw;
- const char* uiName;
- int h;
-};
-
-struct MeterType_ {
- Meter_SetValues setValues;
- Object_Display display;
- int mode;
- int items;
- double total;
- int* attributes;
+typedef struct MeterClass_ {
+ ObjectClass super;
+ const Meter_Init init;
+ const Meter_Done done;
+ const Meter_UpdateMode updateMode;
+ const Meter_Draw draw;
+ const Meter_SetValues setValues;
+ const int defaultMode;
+ const double total;
+ const int* attributes;
const char* name;
const char* uiName;
const char* caption;
- MeterType_Init init;
- MeterType_Done done;
- MeterType_SetMode setMode;
- Meter_Draw draw;
-};
+ const char maxItems;
+ char curItems;
+} MeterClass;
+
+#define As_Meter(this_) ((MeterClass*)((this_)->super.klass))
+#define Meter_initFn(this_) As_Meter(this_)->init
+#define Meter_init(this_) As_Meter(this_)->init((Meter*)(this_))
+#define Meter_done(this_) As_Meter(this_)->done((Meter*)(this_))
+#define Meter_updateModeFn(this_) As_Meter(this_)->updateMode
+#define Meter_updateMode(this_, m_) As_Meter(this_)->updateMode((Meter*)(this_), m_)
+#define Meter_drawFn(this_) As_Meter(this_)->draw
+#define Meter_doneFn(this_) As_Meter(this_)->done
+#define Meter_setValues(this_, c_, i_) As_Meter(this_)->setValues((Meter*)(this_), c_, i_)
+#define Meter_defaultMode(this_) As_Meter(this_)->defaultMode
+#define Meter_getItems(this_) As_Meter(this_)->curItems
+#define Meter_setItems(this_, n_) As_Meter(this_)->curItems = (n_)
+#define Meter_attributes(this_) As_Meter(this_)->attributes
+#define Meter_name(this_) As_Meter(this_)->name
+#define Meter_uiName(this_) As_Meter(this_)->uiName
struct Meter_ {
Object super;
+ Meter_Draw draw;
+
char* caption;
- MeterType* type;
int mode;
int param;
- Meter_Draw draw;
void* drawData;
int h;
ProcessList* pl;
@@ -85,24 +91,26 @@ struct Meter_ {
double total;
};
-#ifdef USE_FUNKY_MODES
-typedef struct GraphData_ {
- time_t time;
- double values[METER_BUFFER_LEN];
-} GraphData;
-#endif
+typedef struct MeterMode_ {
+ Meter_Draw draw;
+ const char* uiName;
+ int h;
+} MeterMode;
typedef enum {
CUSTOM_METERMODE = 0,
BAR_METERMODE,
TEXT_METERMODE,
-#ifdef USE_FUNKY_MODES
GRAPH_METERMODE,
LED_METERMODE,
-#endif
LAST_METERMODE
} MeterModeId;
+typedef struct GraphData_ {
+ struct timeval time;
+ double values[METER_BUFFER_LEN];
+} GraphData;
+
}*/
#ifndef MIN
@@ -112,47 +120,50 @@ typedef enum {
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-#ifdef DEBUG
-char* METER_CLASS = "Meter";
-#else
-#define METER_CLASS NULL
-#endif
+MeterClass Meter_class = {
+ .super = {
+ .extends = Class(Object)
+ }
+};
-MeterType* Meter_types[] = {
- &CPUMeter,
- &ClockMeter,
- &LoadAverageMeter,
- &LoadMeter,
- &MemoryMeter,
- &SwapMeter,
- &TasksMeter,
- &UptimeMeter,
- &BatteryMeter,
- &HostnameMeter,
- &AllCPUsMeter,
- &AllCPUs2Meter,
- &LeftCPUsMeter,
- &RightCPUsMeter,
- &LeftCPUs2Meter,
- &RightCPUs2Meter,
+MeterClass* Meter_types[] = {
+ &CPUMeter_class,
+ &ClockMeter_class,
+ &LoadAverageMeter_class,
+ &LoadMeter_class,
+ &MemoryMeter_class,
+ &SwapMeter_class,
+ &TasksMeter_class,
+ &UptimeMeter_class,
+ &BatteryMeter_class,
+ &HostnameMeter_class,
+ &AllCPUsMeter_class,
+ &AllCPUs2Meter_class,
+ &LeftCPUsMeter_class,
+ &RightCPUsMeter_class,
+ &LeftCPUs2Meter_class,
+ &RightCPUs2Meter_class,
+ &BlankMeter_class,
NULL
};
-Meter* Meter_new(ProcessList* pl, int param, MeterType* type) {
- Meter* this = calloc(sizeof(Meter), 1);
- Object_setClass(this, METER_CLASS);
- ((Object*)this)->delete = Meter_delete;
- ((Object*)this)->display = type->display;
+Meter* Meter_new(ProcessList* pl, int param, MeterClass* type) {
+ Meter* this = calloc(1, sizeof(Meter));
+ Object_setClass(this, type);
this->h = 1;
- this->type = type;
this->param = param;
this->pl = pl;
- this->values = calloc(sizeof(double), type->items);
+ char maxItems = type->maxItems;
+ if (maxItems == 0) {
+ maxItems = 1;
+ }
+ type->curItems = maxItems;
+ this->values = calloc(maxItems, sizeof(double));
this->total = type->total;
this->caption = strdup(type->caption);
- if (this->type->init)
- this->type->init(this);
- Meter_setMode(this, type->mode);
+ if (Meter_initFn(this))
+ Meter_init(this);
+ Meter_setMode(this, type->defaultMode);
return this;
}
@@ -160,8 +171,8 @@ void Meter_delete(Object* cast) {
if (!cast)
return;
Meter* this = (Meter*) cast;
- if (this->type->done) {
- this->type->done(this);
+ if (Meter_doneFn(this)) {
+ Meter_done(this);
}
if (this->drawData)
free(this->drawData);
@@ -176,12 +187,10 @@ void Meter_setCaption(Meter* this, const char* caption) {
}
static inline void Meter_displayBuffer(Meter* this, char* buffer, RichString* out) {
- MeterType* type = this->type;
- Object_Display display = ((Object*)this)->display;
- if (display) {
- display((Object*)this, out);
+ if (Object_displayFn(this)) {
+ Object_display(this, out);
} else {
- RichString_write(out, CRT_colors[type->attributes[0]], buffer);
+ RichString_write(out, CRT_colors[Meter_attributes(this)[0]], buffer);
}
}
@@ -191,10 +200,10 @@ void Meter_setMode(Meter* this, int modeIndex) {
if (!modeIndex)
modeIndex = 1;
assert(modeIndex < LAST_METERMODE);
- if (this->type->mode == 0) {
- this->draw = this->type->draw;
- if (this->type->setMode)
- this->type->setMode(this, modeIndex);
+ if (Meter_defaultMode(this) == CUSTOM_METERMODE) {
+ this->draw = Meter_drawFn(this);
+ if (Meter_updateModeFn(this))
+ Meter_updateMode(this, modeIndex);
} else {
assert(modeIndex >= 1);
if (this->drawData)
@@ -209,7 +218,6 @@ void Meter_setMode(Meter* this, int modeIndex) {
}
ListItem* Meter_toListItem(Meter* this) {
- MeterType* type = this->type;
char mode[21];
if (this->mode)
snprintf(mode, 20, " [%s]", Meter_modes[this->mode]->uiName);
@@ -221,21 +229,20 @@ ListItem* Meter_toListItem(Meter* this) {
else
number[0] = '\0';
char buffer[51];
- snprintf(buffer, 50, "%s%s%s", type->uiName, number, mode);
+ snprintf(buffer, 50, "%s%s%s", Meter_uiName(this), number, mode);
return ListItem_new(buffer, 0);
}
/* ---------- TextMeterMode ---------- */
static void TextMeterMode_draw(Meter* this, int x, int y, int w) {
- MeterType* type = this->type;
char buffer[METER_BUFFER_LEN];
- type->setValues(this, buffer, METER_BUFFER_LEN - 1);
+ Meter_setValues(this, buffer, METER_BUFFER_LEN - 1);
+ (void) w;
attrset(CRT_colors[METER_TEXT]);
mvaddstr(y, x, this->caption);
int captionLen = strlen(this->caption);
- w -= captionLen;
x += captionLen;
mvhline(y, x, ' ', CRT_colors[DEFAULT_COLOR]);
attrset(CRT_colors[RESET_COLOR]);
@@ -250,9 +257,8 @@ static void TextMeterMode_draw(Meter* this, int x, int y, int w) {
static char BarMeterMode_characters[] = "|#*@$%&";
static void BarMeterMode_draw(Meter* this, int x, int y, int w) {
- MeterType* type = this->type;
char buffer[METER_BUFFER_LEN];
- type->setValues(this, buffer, METER_BUFFER_LEN - 1);
+ Meter_setValues(this, buffer, METER_BUFFER_LEN - 1);
w -= 2;
attrset(CRT_colors[METER_TEXT]);
@@ -282,7 +288,8 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) {
// First draw in the bar[] buffer...
int offset = 0;
- for (int i = 0; i < type->items; i++) {
+ int items = Meter_getItems(this);
+ for (int i = 0; i < items; i++) {
double value = this->values[i];
value = MAX(value, 0);
value = MIN(value, this->total);
@@ -307,8 +314,8 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) {
// ...then print the buffer.
offset = 0;
- for (int i = 0; i < type->items; i++) {
- attrset(CRT_colors[type->attributes[i]]);
+ for (int i = 0; i < items; i++) {
+ attrset(CRT_colors[Meter_attributes(this)[i]]);
mvaddnstr(y, x + offset, bar + offset, blockSizes[i]);
offset += blockSizes[i];
offset = MAX(offset, 0);
@@ -323,8 +330,6 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) {
attrset(CRT_colors[RESET_COLOR]);
}
-#ifdef USE_FUNKY_MODES
-
/* ---------- GraphMeterMode ---------- */
#define DrawDot(a,y,c) do { attrset(a); mvaddch(y, x+k, c); } while(0)
@@ -343,23 +348,25 @@ static const char* GraphMeterMode_characters = "^`'-.,_~'`-.,_~'`-.,_";
static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
- if (!this->drawData) this->drawData = calloc(sizeof(GraphData), 1);
+ if (!this->drawData) this->drawData = calloc(1, sizeof(GraphData));
GraphData* data = (GraphData*) this->drawData;
const int nValues = METER_BUFFER_LEN;
- time_t now = time(NULL);
- if (now > data->time) {
- data->time = now;
+ struct timeval now;
+ gettimeofday(&now, NULL);
+ if (!timercmp(&now, &(data->time), <)) {
+ struct timeval delay = { .tv_sec = (int)(DEFAULT_DELAY/10), .tv_usec = (DEFAULT_DELAY-((int)(DEFAULT_DELAY/10)*10)) * 100000 };
+ timeradd(&now, &delay, &(data->time));
for (int i = 0; i < nValues - 1; i++)
data->values[i] = data->values[i+1];
- MeterType* type = this->type;
char buffer[nValues];
- type->setValues(this, buffer, nValues - 1);
+ Meter_setValues(this, buffer, nValues - 1);
double value = 0.0;
- for (int i = 0; i < type->items; i++)
+ int items = Meter_getItems(this);
+ for (int i = 0; i < items; i++)
value += this->values[i];
value /= this->total;
data->values[nValues - 1] = value;
@@ -383,28 +390,39 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
/* ---------- LEDMeterMode ---------- */
-static const char* LEDMeterMode_digits[3][10] = {
+static const char* LEDMeterMode_digitsAscii[3][10] = {
{ " __ "," "," __ "," __ "," "," __ "," __ "," __ "," __ "," __ "},
{ "| |"," |"," __|"," __|","|__|","|__ ","|__ "," |","|__|","|__|"},
{ "|__|"," |","|__ "," __|"," |"," __|","|__|"," |","|__|"," __|"},
};
+static const char* LEDMeterMode_digitsUtf8[3][10] = {
+ { "┌──┐"," ┐ ","╶──┐","╶──┐","╷ ╷","┌──╴","┌──╴","╶──┐","┌──┐","┌──┐"},
+ { "│ │"," │ ","┌──┘"," ──┤","└──┤","└──┐","├──┐"," │","├──┤","└──┤"},
+ { "└──┘"," ╵ ","└──╴","╶──┘"," ╵","╶──┘","└──┘"," ╵","└──┘"," ──┘"},
+};
+
static void LEDMeterMode_drawDigit(int x, int y, int n) {
- for (int i = 0; i < 3; i++)
- mvaddstr(y+i, x, LEDMeterMode_digits[i][n]);
+ if (CRT_utf8) {
+ for (int i = 0; i < 3; i++)
+ mvaddstr(y+i, x, LEDMeterMode_digitsUtf8[i][n]);
+ } else {
+ for (int i = 0; i < 3; i++)
+ mvaddstr(y+i, x, LEDMeterMode_digitsAscii[i][n]);
+ }
}
static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
(void) w;
- MeterType* type = this->type;
char buffer[METER_BUFFER_LEN];
- type->setValues(this, buffer, METER_BUFFER_LEN - 1);
+ Meter_setValues(this, buffer, METER_BUFFER_LEN - 1);
RichString_begin(out);
Meter_displayBuffer(this, buffer, &out);
+ int yText = CRT_utf8 ? y+1 : y+2;
attrset(CRT_colors[LED_COLOR]);
- mvaddstr(y+2, x, this->caption);
+ mvaddstr(yText, x, this->caption);
int xx = x + strlen(this->caption);
int len = RichString_sizeVal(out);
for (int i = 0; i < len; i++) {
@@ -413,7 +431,7 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
LEDMeterMode_drawDigit(xx, y, c-48);
xx += 4;
} else {
- mvaddch(y+2, xx, c);
+ mvaddch(yText, xx, c);
xx += 1;
}
}
@@ -421,8 +439,6 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
RichString_end(out);
}
-#endif
-
static MeterMode BarMeterMode = {
.uiName = "Bar",
.h = 1,
@@ -435,8 +451,6 @@ static MeterMode TextMeterMode = {
.draw = TextMeterMode_draw,
};
-#ifdef USE_FUNKY_MODES
-
static MeterMode GraphMeterMode = {
.uiName = "Graph",
.h = 3,
@@ -449,15 +463,41 @@ static MeterMode LEDMeterMode = {
.draw = LEDMeterMode_draw,
};
-#endif
-
MeterMode* Meter_modes[] = {
NULL,
&BarMeterMode,
&TextMeterMode,
-#ifdef USE_FUNKY_MODES
&GraphMeterMode,
&LEDMeterMode,
-#endif
NULL
};
+
+/* Blank meter */
+
+static void BlankMeter_setValues(Meter* this, char* buffer, int size) {
+ (void) this; (void) buffer; (void) size;
+}
+
+static void BlankMeter_display(Object* cast, RichString* out) {
+ (void) cast;
+ RichString_prune(out);
+}
+
+int BlankMeter_attributes[] = {
+ DEFAULT_COLOR
+};
+
+MeterClass BlankMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = BlankMeter_display,
+ },
+ .setValues = BlankMeter_setValues,
+ .defaultMode = TEXT_METERMODE,
+ .total = 100.0,
+ .attributes = BlankMeter_attributes,
+ .name = "Blank",
+ .uiName = "Blank",
+ .caption = ""
+};
diff --git a/Meter.h b/Meter.h
index 0882724..2f58b8f 100644
--- a/Meter.h
+++ b/Meter.h
@@ -9,54 +9,59 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
-#ifndef USE_FUNKY_MODES
-#define USE_FUNKY_MODES 1
-#endif
-
#define METER_BUFFER_LEN 128
#include "ListItem.h"
#include "ProcessList.h"
typedef struct Meter_ Meter;
-typedef struct MeterType_ MeterType;
-typedef struct MeterMode_ MeterMode;
-typedef void(*MeterType_Init)(Meter*);
-typedef void(*MeterType_Done)(Meter*);
-typedef void(*MeterType_SetMode)(Meter*, int);
+typedef void(*Meter_Init)(Meter*);
+typedef void(*Meter_Done)(Meter*);
+typedef void(*Meter_UpdateMode)(Meter*, int);
typedef void(*Meter_SetValues)(Meter*, char*, int);
typedef void(*Meter_Draw)(Meter*, int, int, int);
-struct MeterMode_ {
- Meter_Draw draw;
- const char* uiName;
- int h;
-};
-
-struct MeterType_ {
- Meter_SetValues setValues;
- Object_Display display;
- int mode;
- int items;
- double total;
- int* attributes;
+typedef struct MeterClass_ {
+ ObjectClass super;
+ const Meter_Init init;
+ const Meter_Done done;
+ const Meter_UpdateMode updateMode;
+ const Meter_Draw draw;
+ const Meter_SetValues setValues;
+ const int defaultMode;
+ const double total;
+ const int* attributes;
const char* name;
const char* uiName;
const char* caption;
- MeterType_Init init;
- MeterType_Done done;
- MeterType_SetMode setMode;
- Meter_Draw draw;
-};
+ const char maxItems;
+ char curItems;
+} MeterClass;
+
+#define As_Meter(this_) ((MeterClass*)((this_)->super.klass))
+#define Meter_initFn(this_) As_Meter(this_)->init
+#define Meter_init(this_) As_Meter(this_)->init((Meter*)(this_))
+#define Meter_done(this_) As_Meter(this_)->done((Meter*)(this_))
+#define Meter_updateModeFn(this_) As_Meter(this_)->updateMode
+#define Meter_updateMode(this_, m_) As_Meter(this_)->updateMode((Meter*)(this_), m_)
+#define Meter_drawFn(this_) As_Meter(this_)->draw
+#define Meter_doneFn(this_) As_Meter(this_)->done
+#define Meter_setValues(this_, c_, i_) As_Meter(this_)->setValues((Meter*)(this_), c_, i_)
+#define Meter_defaultMode(this_) As_Meter(this_)->defaultMode
+#define Meter_getItems(this_) As_Meter(this_)->curItems
+#define Meter_setItems(this_, n_) As_Meter(this_)->curItems = (n_)
+#define Meter_attributes(this_) As_Meter(this_)->attributes
+#define Meter_name(this_) As_Meter(this_)->name
+#define Meter_uiName(this_) As_Meter(this_)->uiName
struct Meter_ {
Object super;
+ Meter_Draw draw;
+
char* caption;
- MeterType* type;
int mode;
int param;
- Meter_Draw draw;
void* drawData;
int h;
ProcessList* pl;
@@ -64,24 +69,26 @@ struct Meter_ {
double total;
};
-#ifdef USE_FUNKY_MODES
-typedef struct GraphData_ {
- time_t time;
- double values[METER_BUFFER_LEN];
-} GraphData;
-#endif
+typedef struct MeterMode_ {
+ Meter_Draw draw;
+ const char* uiName;
+ int h;
+} MeterMode;
typedef enum {
CUSTOM_METERMODE = 0,
BAR_METERMODE,
TEXT_METERMODE,
-#ifdef USE_FUNKY_MODES
GRAPH_METERMODE,
LED_METERMODE,
-#endif
LAST_METERMODE
} MeterModeId;
+typedef struct GraphData_ {
+ struct timeval time;
+ double values[METER_BUFFER_LEN];
+} GraphData;
+
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
@@ -90,15 +97,11 @@ typedef enum {
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-#ifdef DEBUG
-extern char* METER_CLASS;
-#else
-#define METER_CLASS NULL
-#endif
+extern MeterClass Meter_class;
-extern MeterType* Meter_types[];
+extern MeterClass* Meter_types[];
-Meter* Meter_new(ProcessList* pl, int param, MeterType* type);
+Meter* Meter_new(ProcessList* pl, int param, MeterClass* type);
void Meter_delete(Object* cast);
@@ -112,20 +115,18 @@ ListItem* Meter_toListItem(Meter* this);
/* ---------- BarMeterMode ---------- */
-#ifdef USE_FUNKY_MODES
-
/* ---------- GraphMeterMode ---------- */
#define DrawDot(a,y,c) do { attrset(a); mvaddch(y, x+k, c); } while(0)
/* ---------- LEDMeterMode ---------- */
-#endif
+extern MeterMode* Meter_modes[];
-#ifdef USE_FUNKY_MODES
+/* Blank meter */
-#endif
+extern int BlankMeter_attributes[];
-extern MeterMode* Meter_modes[];
+extern MeterClass BlankMeter_class;
#endif
diff --git a/MetersPanel.c b/MetersPanel.c
index 8302c5a..0e755f5 100644
--- a/MetersPanel.c
+++ b/MetersPanel.c
@@ -92,16 +92,22 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
return result;
}
+PanelClass MetersPanel_class = {
+ .super = {
+ .extends = Class(Panel),
+ .delete = MetersPanel_delete
+ },
+ .eventHandler = MetersPanel_eventHandler
+};
+
MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* meters, ScreenManager* scr) {
- MetersPanel* this = (MetersPanel*) malloc(sizeof(MetersPanel));
+ MetersPanel* this = AllocThis(MetersPanel);
Panel* super = (Panel*) this;
- Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
- ((Object*)this)->delete = MetersPanel_delete;
+ Panel_init(super, 1, 1, 1, 1, Class(ListItem), true);
this->settings = settings;
this->meters = meters;
this->scr = scr;
- super->eventHandler = MetersPanel_eventHandler;
Panel_setHeader(super, header);
for (int i = 0; i < Vector_size(meters); i++) {
Meter* meter = (Meter*) Vector_get(meters, i);
diff --git a/MetersPanel.h b/MetersPanel.h
index 4aa2c3d..56c83e7 100644
--- a/MetersPanel.h
+++ b/MetersPanel.h
@@ -22,6 +22,8 @@ typedef struct MetersPanel_ {
} MetersPanel;
+extern PanelClass MetersPanel_class;
+
MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* meters, ScreenManager* scr);
#endif
diff --git a/Object.c b/Object.c
index 395bd10..2399e50 100644
--- a/Object.c
+++ b/Object.c
@@ -1,51 +1,62 @@
/*
htop - Object.c
-(C) 2004-2011 Hisham H. Muhammad
+(C) 2004-2012 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "Object.h"
-#include "CRT.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-
/*{
#include "RichString.h"
-#ifndef DEBUG
-#define Object_setClass(obj, class)
-#endif
-
typedef struct Object_ Object;
typedef void(*Object_Display)(Object*, RichString*);
typedef int(*Object_Compare)(const void*, const void*);
typedef void(*Object_Delete)(Object*);
+#define Object_getClass(obj_) ((Object*)(obj_))->klass
+#define Object_setClass(obj_, class_) Object_getClass(obj_) = (ObjectClass*) class_
+
+#define Object_delete(obj_) Object_getClass(obj_)->delete((Object*)(obj_))
+#define Object_displayFn(obj_) Object_getClass(obj_)->display
+#define Object_display(obj_, str_) Object_getClass(obj_)->display((Object*)(obj_), str_)
+#define Object_compare(obj_, other_) Object_getClass(obj_)->compare((const void*)(obj_), other_)
+
+#define Class(class_) ((ObjectClass*)(&(class_ ## _class)))
+
+#define AllocThis(class_) (class_*) malloc(sizeof(class_)); Object_setClass(this, Class(class_));
+
+typedef struct ObjectClass_ {
+ const void* extends;
+ const Object_Display display;
+ const Object_Delete delete;
+ const Object_Compare compare;
+} ObjectClass;
+
struct Object_ {
- #ifdef DEBUG
- char* class;
- #endif
- Object_Display display;
- Object_Delete delete;
+ ObjectClass* klass;
};
-}*/
-#ifdef DEBUG
-char* OBJECT_CLASS = "Object";
+}*/
-#else
-#define OBJECT_CLASS NULL
-#endif
+ObjectClass Object_class = {
+ .extends = NULL
+};
#ifdef DEBUG
-void Object_setClass(void* this, char* class) {
- ((Object*)this)->class = class;
+bool Object_isA(Object* o, const ObjectClass* klass) {
+ if (!o)
+ return false;
+ const ObjectClass* type = o->klass;
+ while (type) {
+ if (type == klass)
+ return true;
+ type = type->extends;
+ }
+ return false;
}
#endif
diff --git a/Object.h b/Object.h
index 8ebc1d5..bfabe6f 100644
--- a/Object.h
+++ b/Object.h
@@ -4,41 +4,48 @@
#define HEADER_Object
/*
htop - Object.h
-(C) 2004-2011 Hisham H. Muhammad
+(C) 2004-2012 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "RichString.h"
-#ifndef DEBUG
-#define Object_setClass(obj, class)
-#endif
-
typedef struct Object_ Object;
typedef void(*Object_Display)(Object*, RichString*);
typedef int(*Object_Compare)(const void*, const void*);
typedef void(*Object_Delete)(Object*);
+#define Object_getClass(obj_) ((Object*)(obj_))->klass
+#define Object_setClass(obj_, class_) Object_getClass(obj_) = (ObjectClass*) class_
+
+#define Object_delete(obj_) Object_getClass(obj_)->delete((Object*)(obj_))
+#define Object_displayFn(obj_) Object_getClass(obj_)->display
+#define Object_display(obj_, str_) Object_getClass(obj_)->display((Object*)(obj_), str_)
+#define Object_compare(obj_, other_) Object_getClass(obj_)->compare((const void*)(obj_), other_)
+
+#define Class(class_) ((ObjectClass*)(&(class_ ## _class)))
+
+#define AllocThis(class_) (class_*) malloc(sizeof(class_)); Object_setClass(this, Class(class_));
+
+typedef struct ObjectClass_ {
+ const void* extends;
+ const Object_Display display;
+ const Object_Delete delete;
+ const Object_Compare compare;
+} ObjectClass;
+
struct Object_ {
- #ifdef DEBUG
- char* class;
- #endif
- Object_Display display;
- Object_Delete delete;
+ ObjectClass* klass;
};
-#ifdef DEBUG
-extern char* OBJECT_CLASS;
-#else
-#define OBJECT_CLASS NULL
-#endif
+extern ObjectClass Object_class;
#ifdef DEBUG
-void Object_setClass(void* this, char* class);
+bool Object_isA(Object* o, const ObjectClass* klass);
#endif
diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c
index 9adf8b4..7dfc32a 100644
--- a/OpenFilesScreen.c
+++ b/OpenFilesScreen.c
@@ -10,6 +10,8 @@ in the source distribution for its full text.
#include "CRT.h"
#include "ProcessList.h"
#include "ListItem.h"
+#include "IncSet.h"
+#include "String.h"
#include <string.h>
#include <stdio.h>
@@ -26,14 +28,18 @@ in the source distribution for its full text.
#include "Panel.h"
#include "FunctionBar.h"
-typedef struct OpenFiles_ProcessData_ {
+typedef struct OpenFiles_Data_ {
char* data[256];
- struct OpenFiles_FileData_* files;
+} OpenFiles_Data;
+
+typedef struct OpenFiles_ProcessData_ {
+ OpenFiles_Data data;
int error;
+ struct OpenFiles_FileData_* files;
} OpenFiles_ProcessData;
typedef struct OpenFiles_FileData_ {
- char* data[256];
+ OpenFiles_Data data;
struct OpenFiles_FileData_* next;
} OpenFiles_FileData;
@@ -42,23 +48,20 @@ typedef struct OpenFilesScreen_ {
pid_t pid;
Panel* display;
FunctionBar* bar;
- bool tracing;
} OpenFilesScreen;
}*/
-static const char* ofsFunctions[] = {"Refresh", "Done ", NULL};
+static const char* ofsFunctions[] = {"Search ", "Filter ", "Refresh", "Done ", NULL};
-static const char* ofsKeys[] = {"F5", "Esc"};
+static const char* ofsKeys[] = {"F3", "F4", "F5", "Esc"};
-static int ofsEvents[] = {KEY_F(5), 27};
+static int ofsEvents[] = {KEY_F(3), KEY_F(4), KEY_F(5), 27};
OpenFilesScreen* OpenFilesScreen_new(Process* process) {
OpenFilesScreen* this = (OpenFilesScreen*) malloc(sizeof(OpenFilesScreen));
this->process = process;
- this->display = Panel_new(0, 1, COLS, LINES-3, LISTITEM_CLASS, true, ListItem_compare);
- this->bar = FunctionBar_new(ofsFunctions, ofsKeys, ofsEvents);
- this->tracing = true;
+ this->display = Panel_new(0, 1, COLS, LINES-3, false, Class(ListItem));
if (Process_isThread(process))
this->pid = process->tgid;
else
@@ -68,36 +71,33 @@ OpenFilesScreen* OpenFilesScreen_new(Process* process) {
void OpenFilesScreen_delete(OpenFilesScreen* this) {
Panel_delete((Object*)this->display);
- FunctionBar_delete((Object*)this->bar);
free(this);
}
-static void OpenFilesScreen_draw(OpenFilesScreen* this) {
+static void OpenFilesScreen_draw(OpenFilesScreen* this, IncSet* inc) {
attrset(CRT_colors[METER_TEXT]);
mvhline(0, 0, ' ', COLS);
- mvprintw(0, 0, "Files open in process %d - %s", this->pid, this->process->comm);
+ mvprintw(0, 0, "Snapshot of files open in process %d - %s", this->pid, this->process->comm);
attrset(CRT_colors[DEFAULT_COLOR]);
Panel_draw(this->display, true);
- FunctionBar_draw(this->bar, NULL);
+ IncSet_drawBar(inc);
}
static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) {
char command[1025];
snprintf(command, 1024, "lsof -P -p %d -F 2> /dev/null", pid);
FILE* fd = popen(command, "r");
- OpenFiles_ProcessData* process = calloc(sizeof(OpenFiles_ProcessData), 1);
- OpenFiles_FileData* file = NULL;
- OpenFiles_ProcessData* item = process;
- bool anyRead = false;
+ OpenFiles_ProcessData* pdata = calloc(1, sizeof(OpenFiles_ProcessData));
+ OpenFiles_FileData* fdata = NULL;
+ OpenFiles_Data* item = &(pdata->data);
if (!fd) {
- process->error = 127;
- return process;
+ pdata->error = 127;
+ return pdata;
}
while (!feof(fd)) {
int cmd = fgetc(fd);
- if (cmd == EOF && !anyRead)
+ if (cmd == EOF)
break;
- anyRead = true;
char* entry = malloc(1024);
if (!fgets(entry, 1024, fd)) {
free(entry);
@@ -106,54 +106,65 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(pid_t pid) {
char* newline = strrchr(entry, '\n');
*newline = '\0';
if (cmd == 'f') {
- OpenFiles_FileData* nextFile = calloc(sizeof(OpenFiles_ProcessData), 1);
- if (file == NULL) {
- process->files = nextFile;
+ OpenFiles_FileData* nextFile = calloc(1, sizeof(OpenFiles_FileData));
+ if (fdata == NULL) {
+ pdata->files = nextFile;
} else {
- file->next = nextFile;
+ fdata->next = nextFile;
}
- file = nextFile;
- item = (OpenFiles_ProcessData*) file;
+ fdata = nextFile;
+ item = &(fdata->data);
}
+ assert(cmd >= 0 && cmd <= 0xff);
item->data[cmd] = entry;
}
- process->error = pclose(fd);
- return process;
+ pdata->error = pclose(fd);
+ return pdata;
}
-static void OpenFilesScreen_scan(OpenFilesScreen* this) {
+static inline void addLine(const char* line, Vector* lines, Panel* panel, const char* incFilter) {
+ Vector_add(lines, (Object*) ListItem_new(line, 0));
+ if (!incFilter || String_contains_i(line, incFilter))
+ Panel_add(panel, (Object*)Vector_get(lines, Vector_size(lines)-1));
+}
+
+static inline void OpenFiles_Data_clear(OpenFiles_Data* data) {
+ for (int i = 0; i < 255; i++)
+ if (data->data[i])
+ free(data->data[i]);
+}
+
+static void OpenFilesScreen_scan(OpenFilesScreen* this, Vector* lines, IncSet* inc) {
Panel* panel = this->display;
- int idx = MAX(Panel_getSelectedIndex(panel), 0);
+ int idx = Panel_getSelectedIndex(panel);
Panel_prune(panel);
- OpenFiles_ProcessData* process = OpenFilesScreen_getProcessData(this->pid);
- if (process->error == 127) {
- Panel_add(panel, (Object*) ListItem_new("Could not execute 'lsof'. Please make sure it is available in your $PATH.", 0));
- } else if (process->error == 1) {
- Panel_add(panel, (Object*) ListItem_new("Failed listing open files.", 0));
+ OpenFiles_ProcessData* pdata = OpenFilesScreen_getProcessData(this->pid);
+ if (pdata->error == 127) {
+ addLine("Could not execute 'lsof'. Please make sure it is available in your $PATH.", lines, panel, IncSet_filter(inc));
+ } else if (pdata->error == 1) {
+ addLine("Failed listing open files.", lines, panel, IncSet_filter(inc));
} else {
- OpenFiles_FileData* file = process->files;
- while (file) {
+ OpenFiles_FileData* fdata = pdata->files;
+ while (fdata) {
char entry[1024];
+ char** data = fdata->data.data;
sprintf(entry, "%5s %4s %10s %10s %10s %s",
- file->data['f'] ? file->data['f'] : "",
- file->data['t'] ? file->data['t'] : "",
- file->data['D'] ? file->data['D'] : "",
- file->data['s'] ? file->data['s'] : "",
- file->data['i'] ? file->data['i'] : "",
- file->data['n'] ? file->data['n'] : "");
- Panel_add(panel, (Object*) ListItem_new(entry, 0));
- for (int i = 0; i < 255; i++)
- if (file->data[i])
- free(file->data[i]);
- OpenFiles_FileData* old = file;
- file = file->next;
+ data['f'] ? data['f'] : "",
+ data['t'] ? data['t'] : "",
+ data['D'] ? data['D'] : "",
+ data['s'] ? data['s'] : "",
+ data['i'] ? data['i'] : "",
+ data['n'] ? data['n'] : "");
+ addLine(entry, lines, panel, IncSet_filter(inc));
+ OpenFiles_Data_clear(&fdata->data);
+ OpenFiles_FileData* old = fdata;
+ fdata = fdata->next;
free(old);
}
- for (int i = 0; i < 255; i++)
- if (process->data[i])
- free(process->data[i]);
+ OpenFiles_Data_clear(&pdata->data);
}
- free(process);
+ free(pdata);
+ Vector_insertionSort(lines);
Vector_insertionSort(panel->items);
Panel_setSelected(panel, idx);
}
@@ -161,14 +172,24 @@ static void OpenFilesScreen_scan(OpenFilesScreen* this) {
void OpenFilesScreen_run(OpenFilesScreen* this) {
Panel* panel = this->display;
Panel_setHeader(panel, " FD TYPE DEVICE SIZE NODE NAME");
- OpenFilesScreen_scan(this);
- OpenFilesScreen_draw(this);
- //CRT_disableDelay();
+
+ FunctionBar* bar = FunctionBar_new(ofsFunctions, ofsKeys, ofsEvents);
+ IncSet* inc = IncSet_new(bar);
+
+ Vector* lines = Vector_new(panel->items->type, true, DEFAULT_SIZE);
+
+ OpenFilesScreen_scan(this, lines, inc);
+ OpenFilesScreen_draw(this, inc);
bool looping = true;
while (looping) {
+
Panel_draw(panel, true);
+
+ if (inc->active)
+ move(LINES-1, CRT_cursorX);
int ch = getch();
+
if (ch == KEY_MOUSE) {
MEVENT mevent;
int ok = getmouse(&mevent);
@@ -177,19 +198,33 @@ void OpenFilesScreen_run(OpenFilesScreen* this) {
Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV);
ch = 0;
} if (mevent.y == LINES - 1)
- ch = FunctionBar_synthesizeEvent(this->bar, mevent.x);
+ ch = FunctionBar_synthesizeEvent(inc->bar, mevent.x);
+ }
+
+ if (inc->active) {
+ IncSet_handleKey(inc, ch, panel, IncSet_getListItemValue, lines);
+ continue;
}
+
switch(ch) {
case ERR:
continue;
+ case KEY_F(3):
+ case '/':
+ IncSet_activate(inc, INC_SEARCH);
+ break;
+ case KEY_F(4):
+ case '\\':
+ IncSet_activate(inc, INC_FILTER);
+ break;
case KEY_F(5):
clear();
- OpenFilesScreen_scan(this);
- OpenFilesScreen_draw(this);
+ OpenFilesScreen_scan(this, lines, inc);
+ OpenFilesScreen_draw(this, inc);
break;
case '\014': // Ctrl+L
clear();
- OpenFilesScreen_draw(this);
+ OpenFilesScreen_draw(this, inc);
break;
case 'q':
case 27:
@@ -198,11 +233,14 @@ void OpenFilesScreen_run(OpenFilesScreen* this) {
break;
case KEY_RESIZE:
Panel_resize(panel, COLS, LINES-2);
- OpenFilesScreen_draw(this);
+ OpenFilesScreen_draw(this, inc);
break;
default:
Panel_onKey(panel, ch);
}
}
- //CRT_enableDelay();
+
+ Vector_delete(lines);
+ FunctionBar_delete((Object*)bar);
+ IncSet_delete(inc);
}
diff --git a/OpenFilesScreen.h b/OpenFilesScreen.h
index 248cac4..b3cdd97 100644
--- a/OpenFilesScreen.h
+++ b/OpenFilesScreen.h
@@ -13,14 +13,18 @@ in the source distribution for its full text.
#include "Panel.h"
#include "FunctionBar.h"
-typedef struct OpenFiles_ProcessData_ {
+typedef struct OpenFiles_Data_ {
char* data[256];
- struct OpenFiles_FileData_* files;
+} OpenFiles_Data;
+
+typedef struct OpenFiles_ProcessData_ {
+ OpenFiles_Data data;
int error;
+ struct OpenFiles_FileData_* files;
} OpenFiles_ProcessData;
typedef struct OpenFiles_FileData_ {
- char* data[256];
+ OpenFiles_Data data;
struct OpenFiles_FileData_* next;
} OpenFiles_FileData;
@@ -29,7 +33,6 @@ typedef struct OpenFilesScreen_ {
pid_t pid;
Panel* display;
FunctionBar* bar;
- bool tracing;
} OpenFilesScreen;
diff --git a/Panel.c b/Panel.c
index d0f69bf..26b1190 100644
--- a/Panel.c
+++ b/Panel.c
@@ -18,7 +18,6 @@ in the source distribution for its full text.
#include <ctype.h>
#include <string.h>
#include <assert.h>
-#include <curses.h>
//#link curses
@@ -38,19 +37,28 @@ typedef enum HandlerResult_ {
typedef HandlerResult(*Panel_EventHandler)(Panel*, int);
+typedef struct PanelClass_ {
+ const ObjectClass super;
+ const Panel_EventHandler eventHandler;
+} PanelClass;
+
+#define As_Panel(this_) ((PanelClass*)((this_)->super.klass))
+#define Panel_eventHandlerFn(this_) As_Panel(this_)->eventHandler
+#define Panel_eventHandler(this_, ev_) As_Panel(this_)->eventHandler((Panel*)(this_), ev_)
+
struct Panel_ {
Object super;
+ PanelClass* class;
int x, y, w, h;
WINDOW* window;
Vector* items;
int selected;
- int scrollV, scrollH;
- int scrollHAmount;
int oldSelected;
+ char* eventHandlerBuffer;
+ int scrollV;
+ short scrollH;
bool needsRedraw;
RichString header;
- Panel_EventHandler eventHandler;
- char* eventHandlerBuffer;
};
}*/
@@ -62,22 +70,24 @@ struct Panel_ {
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-#ifdef DEBUG
-char* PANEL_CLASS = "Panel";
-#else
-#define PANEL_CLASS NULL
-#endif
-
#define KEY_CTRLN 0016 /* control-n key */
#define KEY_CTRLP 0020 /* control-p key */
#define KEY_CTRLF 0006 /* control-f key */
#define KEY_CTRLB 0002 /* control-b key */
-Panel* Panel_new(int x, int y, int w, int h, char* type, bool owner, Object_Compare compare) {
+PanelClass Panel_class = {
+ .super = {
+ .extends = Class(Object),
+ .delete = Panel_delete
+ },
+ .eventHandler = Panel_selectByTyping
+};
+
+Panel* Panel_new(int x, int y, int w, int h, bool owner, ObjectClass* type) {
Panel* this;
this = malloc(sizeof(Panel));
+ Object_setClass(this, Class(Panel));
Panel_init(this, x, y, w, h, type, owner);
- this->items->compare = compare;
return this;
}
@@ -87,27 +97,19 @@ void Panel_delete(Object* cast) {
free(this);
}
-void Panel_init(Panel* this, int x, int y, int w, int h, char* type, bool owner) {
- Object* super = (Object*) this;
- Object_setClass(this, PANEL_CLASS);
- super->delete = Panel_delete;
+void Panel_init(Panel* this, int x, int y, int w, int h, ObjectClass* type, bool owner) {
this->x = x;
this->y = y;
this->w = w;
this->h = h;
- this->eventHandler = NULL;
this->eventHandlerBuffer = NULL;
- this->items = Vector_new(type, owner, DEFAULT_SIZE, ListItem_compare);
+ this->items = Vector_new(type, owner, DEFAULT_SIZE);
this->scrollV = 0;
this->scrollH = 0;
this->selected = 0;
this->oldSelected = 0;
this->needsRedraw = true;
RichString_beginAllocated(this->header);
- if (String_eq(CRT_termType, "linux"))
- this->scrollHAmount = 20;
- else
- this->scrollHAmount = 5;
}
void Panel_done(Panel* this) {
@@ -129,10 +131,6 @@ inline void Panel_setHeader(Panel* this, const char* header) {
this->needsRedraw = true;
}
-void Panel_setEventHandler(Panel* this, Panel_EventHandler eh) {
- this->eventHandler = eh;
-}
-
void Panel_move(Panel* this, int x, int y) {
assert (this != NULL);
@@ -238,8 +236,8 @@ void Panel_setSelected(Panel* this, int selected) {
selected = MAX(0, MIN(Vector_size(this->items) - 1, selected));
this->selected = selected;
- if (this->eventHandler) {
- this->eventHandler(this, EVENT_SETSELECTED);
+ if (Panel_eventHandlerFn(this)) {
+ Panel_eventHandler(this, EVENT_SETSELECTED);
}
}
@@ -292,22 +290,21 @@ void Panel_draw(Panel* this, bool focus) {
for(int i = first, j = 0; j < this->h && i < last; i++, j++) {
Object* itemObj = Vector_get(this->items, i);
+ assert(itemObj); if(!itemObj) continue;
RichString_begin(item);
- itemObj->display(itemObj, &item);
+ Object_display(itemObj, &item);
int itemLen = RichString_sizeVal(item);
int amt = MIN(itemLen - scrollH, this->w);
- if (i == this->selected) {
+ bool selected = (i == this->selected);
+ if (selected) {
attrset(highlight);
RichString_setAttr(&item, highlight);
- mvhline(y + j, x+0, ' ', this->w);
- if (amt > 0)
- RichString_printoffnVal(item, y+j, x+0, scrollH, amt);
- attrset(CRT_colors[RESET_COLOR]);
- } else {
- mvhline(y+j, x+0, ' ', this->w);
- if (amt > 0)
- RichString_printoffnVal(item, y+j, x+0, scrollH, amt);
}
+ mvhline(y + j, x, ' ', this->w);
+ if (amt > 0)
+ RichString_printoffnVal(item, y+j, x, scrollH, amt);
+ if (selected)
+ attrset(CRT_colors[RESET_COLOR]);
RichString_end(item);
}
for (int i = y + (last - first); i < y + this->h; i++)
@@ -316,23 +313,24 @@ void Panel_draw(Panel* this, bool focus) {
} else {
Object* oldObj = Vector_get(this->items, this->oldSelected);
+ assert(oldObj);
RichString_begin(old);
- oldObj->display(oldObj, &old);
+ Object_display(oldObj, &old);
int oldLen = RichString_sizeVal(old);
Object* newObj = Vector_get(this->items, this->selected);
RichString_begin(new);
- newObj->display(newObj, &new);
+ Object_display(newObj, &new);
int newLen = RichString_sizeVal(new);
mvhline(y+ this->oldSelected - this->scrollV, x+0, ' ', this->w);
if (scrollH < oldLen)
RichString_printoffnVal(old, y+this->oldSelected - this->scrollV, x,
- this->scrollH, MIN(oldLen - scrollH, this->w));
+ scrollH, MIN(oldLen - scrollH, this->w));
attrset(highlight);
mvhline(y+this->selected - this->scrollV, x+0, ' ', this->w);
RichString_setAttr(&new, highlight);
if (scrollH < newLen)
RichString_printoffnVal(new, y+this->selected - this->scrollV, x,
- this->scrollH, MIN(newLen - scrollH, this->w));
+ scrollH, MIN(newLen - scrollH, this->w));
attrset(CRT_colors[RESET_COLOR]);
RichString_end(new);
RichString_end(old);
@@ -379,13 +377,13 @@ bool Panel_onKey(Panel* this, int key) {
case KEY_LEFT:
case KEY_CTRLB:
if (this->scrollH > 0) {
- this->scrollH -= 5;
+ this->scrollH -= CRT_scrollHAmount;
this->needsRedraw = true;
}
return true;
case KEY_RIGHT:
case KEY_CTRLF:
- this->scrollH += 5;
+ this->scrollH += CRT_scrollHAmount;
this->needsRedraw = true;
return true;
case KEY_PPAGE:
diff --git a/Panel.h b/Panel.h
index 3f35583..91c0a40 100644
--- a/Panel.h
+++ b/Panel.h
@@ -26,19 +26,28 @@ typedef enum HandlerResult_ {
typedef HandlerResult(*Panel_EventHandler)(Panel*, int);
+typedef struct PanelClass_ {
+ const ObjectClass super;
+ const Panel_EventHandler eventHandler;
+} PanelClass;
+
+#define As_Panel(this_) ((PanelClass*)((this_)->super.klass))
+#define Panel_eventHandlerFn(this_) As_Panel(this_)->eventHandler
+#define Panel_eventHandler(this_, ev_) As_Panel(this_)->eventHandler((Panel*)(this_), ev_)
+
struct Panel_ {
Object super;
+ PanelClass* class;
int x, y, w, h;
WINDOW* window;
Vector* items;
int selected;
- int scrollV, scrollH;
- int scrollHAmount;
int oldSelected;
+ char* eventHandlerBuffer;
+ int scrollV;
+ short scrollH;
bool needsRedraw;
RichString header;
- Panel_EventHandler eventHandler;
- char* eventHandlerBuffer;
};
@@ -49,22 +58,18 @@ struct Panel_ {
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-#ifdef DEBUG
-extern char* PANEL_CLASS;
-#else
-#define PANEL_CLASS NULL
-#endif
-
#define KEY_CTRLN 0016 /* control-n key */
#define KEY_CTRLP 0020 /* control-p key */
#define KEY_CTRLF 0006 /* control-f key */
#define KEY_CTRLB 0002 /* control-b key */
-Panel* Panel_new(int x, int y, int w, int h, char* type, bool owner, Object_Compare compare);
+extern PanelClass Panel_class;
+
+Panel* Panel_new(int x, int y, int w, int h, bool owner, ObjectClass* type);
void Panel_delete(Object* cast);
-void Panel_init(Panel* this, int x, int y, int w, int h, char* type, bool owner);
+void Panel_init(Panel* this, int x, int y, int w, int h, ObjectClass* type, bool owner);
void Panel_done(Panel* this);
@@ -72,8 +77,6 @@ RichString* Panel_getHeader(Panel* this);
extern void Panel_setHeader(Panel* this, const char* header);
-void Panel_setEventHandler(Panel* this, Panel_EventHandler eh);
-
void Panel_move(Panel* this, int x, int y);
void Panel_resize(Panel* this, int w, int h);
diff --git a/Process.c b/Process.c
index 99e9f13..4efd854 100644
--- a/Process.c
+++ b/Process.c
@@ -45,6 +45,12 @@ in the source distribution for its full text.
#include "IOPriority.h"
#include <sys/types.h>
+#define PROCESS_FLAG_IO 1
+#define PROCESS_FLAG_IOPRIO 2
+#define PROCESS_FLAG_OPENVZ 4
+#define PROCESS_FLAG_VSERVER 8
+#define PROCESS_FLAG_CGROUP 16
+
#ifndef Process_isKernelThread
#define Process_isKernelThread(_process) (_process->pgrp == 0)
#endif
@@ -75,6 +81,9 @@ typedef enum ProcessField_ {
#ifdef HAVE_CGROUP
CGROUP,
#endif
+ #ifdef HAVE_OOM
+ OOM,
+ #endif
IO_PRIORITY,
LAST_PROCESSFIELD
} ProcessField;
@@ -85,7 +94,6 @@ typedef struct Process_ {
Object super;
struct ProcessList_ *pl;
- bool updated;
pid_t pid;
char* comm;
@@ -101,12 +109,12 @@ typedef struct Process_ {
pid_t tgid;
int tpgid;
unsigned long int flags;
- #ifdef DEBUG
- unsigned long int minflt;
- unsigned long int cminflt;
- unsigned long int majflt;
- unsigned long int cmajflt;
- #endif
+
+ uid_t st_uid;
+ float percent_cpu;
+ float percent_mem;
+ char* user;
+
unsigned long long int utime;
unsigned long long int stime;
unsigned long long int cutime;
@@ -117,6 +125,53 @@ typedef struct Process_ {
IOPriority ioPriority;
char starttime_show[8];
time_t starttime_ctime;
+
+ #ifdef HAVE_TASKSTATS
+ unsigned long long io_rchar;
+ unsigned long long io_wchar;
+ unsigned long long io_syscr;
+ unsigned long long io_syscw;
+ unsigned long long io_read_bytes;
+ unsigned long long io_write_bytes;
+ unsigned long long io_cancelled_write_bytes;
+ double io_rate_read_bps;
+ unsigned long long io_rate_read_time;
+ double io_rate_write_bps;
+ unsigned long long io_rate_write_time;
+ #endif
+
+ int processor;
+ long m_size;
+ long m_resident;
+ long m_share;
+ long m_trs;
+ long m_drs;
+ long m_lrs;
+ long m_dt;
+
+ #ifdef HAVE_OPENVZ
+ unsigned int ctid;
+ unsigned int vpid;
+ #endif
+ #ifdef HAVE_VSERVER
+ unsigned int vxid;
+ #endif
+
+ #ifdef HAVE_CGROUP
+ char* cgroup;
+ #endif
+ #ifdef HAVE_OOM
+ unsigned int oom;
+ #endif
+
+ int exit_signal;
+ int basenameOffset;
+ bool updated;
+
+ unsigned long int minflt;
+ unsigned long int cminflt;
+ unsigned long int majflt;
+ unsigned long int cmajflt;
#ifdef DEBUG
long int itrealvalue;
unsigned long int vsize;
@@ -135,52 +190,11 @@ typedef struct Process_ {
unsigned long int nswap;
unsigned long int cnswap;
#endif
- int exit_signal;
- int processor;
- int m_size;
- int m_resident;
- int m_share;
- int m_trs;
- int m_drs;
- int m_lrs;
- int m_dt;
- uid_t st_uid;
- float percent_cpu;
- float percent_mem;
- char* user;
- #ifdef HAVE_OPENVZ
- unsigned int ctid;
- unsigned int vpid;
- #endif
- #ifdef HAVE_VSERVER
- unsigned int vxid;
- #endif
- #ifdef HAVE_TASKSTATS
- unsigned long long io_rchar;
- unsigned long long io_wchar;
- unsigned long long io_syscr;
- unsigned long long io_syscw;
- unsigned long long io_read_bytes;
- unsigned long long io_write_bytes;
- unsigned long long io_cancelled_write_bytes;
- double io_rate_read_bps;
- unsigned long long io_rate_read_time;
- double io_rate_write_bps;
- unsigned long long io_rate_write_time;
- #endif
- #ifdef HAVE_CGROUP
- char* cgroup;
- #endif
+
} Process;
}*/
-#ifdef DEBUG
-char* PROCESS_CLASS = "Process";
-#else
-#define PROCESS_CLASS NULL
-#endif
-
const char *Process_fieldNames[] = {
"", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION",
"TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT",
@@ -203,13 +217,44 @@ const char *Process_fieldNames[] = {
#ifdef HAVE_CGROUP
"CGROUP",
#endif
+#ifdef HAVE_OOM
+ "OOM",
+#endif
"IO_PRIORITY",
"*** report bug! ***"
};
+const int Process_fieldFlags[] = {
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
+#ifdef HAVE_OPENVZ
+ PROCESS_FLAG_OPENVZ, PROCESS_FLAG_OPENVZ,
+#endif
+#ifdef HAVE_VSERVER
+ PROCESS_FLAG_VSERVER,
+#endif
+#ifdef HAVE_TASKSTATS
+ PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO,
+ PROCESS_FLAG_IO, PROCESS_FLAG_IO, PROCESS_FLAG_IO,
+#endif
+#ifdef HAVE_CGROUP
+ PROCESS_FLAG_CGROUP,
+#endif
+#ifdef HAVE_OOM
+ 0,
+#endif
+ PROCESS_FLAG_IOPRIO
+};
+
const char *Process_fieldTitles[] = {
"", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ",
- " TTY ", " TPGID ", "- ", "- ", "- ", "- ", "- ",
+ " TTY ", " TPGID ", "- ", " MINFLT ", " CMINFLT ", " MAJFLT ", " CMAJFLT ",
" UTIME+ ", " STIME+ ", " CUTIME+ ", " CSTIME+ ", "PRI ", " NI ", "- ",
"START ", "- ", "- ", "- ", "- ", "- ", "- ",
"- ", "- ", "- ", "- ", "- ", "- ", "- ",
@@ -223,12 +268,15 @@ const char *Process_fieldTitles[] = {
" VXID ",
#endif
#ifdef HAVE_TASKSTATS
- " RD_CHAR ", " WR_CHAR ", " RD_SYSC ", " WR_SYSC ", " IO_RBYTES ", " IO_WBYTES ", " IO_CANCEL ",
- " IORR ", " IOWR ", " IO ",
+ " RD_CHAR ", " WR_CHAR ", " RD_SYSC ", " WR_SYSC ", " IO_RBYTES ", " IO_WBYTES ", " IO_CANCEL ",
+ " IORR ", " IOWR ", " IORW ",
#endif
#ifdef HAVE_CGROUP
" CGROUP ",
#endif
+#ifdef HAVE_OOM
+ " OOM ",
+#endif
"IO ",
"*** report bug! ***"
};
@@ -251,6 +299,9 @@ void Process_getMaxPid() {
Process_fieldTitles[TGID] = " TGID ";
Process_fieldTitles[PGRP] = " PGRP ";
Process_fieldTitles[SESSION] = " SESN ";
+ #ifdef HAVE_OOM
+ Process_fieldTitles[OOM] = " OOM ";
+ #endif
Process_pidFormat = "%7u ";
Process_tpgidFormat = "%7d ";
} else {
@@ -260,57 +311,94 @@ void Process_getMaxPid() {
Process_fieldTitles[TGID] = " TGID ";
Process_fieldTitles[PGRP] = " PGRP ";
Process_fieldTitles[SESSION] = " SESN ";
+ #ifdef HAVE_OOM
+ Process_fieldTitles[OOM] = " OOM ";
+ #endif
Process_pidFormat = "%5u ";
Process_tpgidFormat = "%5d ";
}
}
-#define ONE_K 1024
+#define ONE_K 1024L
#define ONE_M (ONE_K * ONE_K)
#define ONE_G (ONE_M * ONE_K)
-static void Process_humanNumber(Process* this, RichString* str, unsigned long number) {
+#define ONE_DECIMAL_K 1000L
+#define ONE_DECIMAL_M (ONE_DECIMAL_K * ONE_DECIMAL_K)
+#define ONE_DECIMAL_G (ONE_DECIMAL_M * ONE_DECIMAL_K)
+
+static void Process_humanNumber(RichString* str, unsigned long number, bool coloring) {
char buffer[11];
int len;
- if(number >= (10 * ONE_M)) {
- if(number >= (100 * ONE_M)) {
+
+ 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(number >= (10 * ONE_DECIMAL_M)) {
+ #ifdef __LP64__
+ if(number >= (100 * ONE_DECIMAL_G)) {
+ len = snprintf(buffer, 10, "%4ldT ", number / ONE_G);
+ RichString_appendn(str, largeNumberColor, buffer, len);
+ return;
+ } else if (number >= (1000 * ONE_DECIMAL_M)) {
+ len = snprintf(buffer, 10, "%4.1lfT ", (double)number / ONE_G);
+ RichString_appendn(str, largeNumberColor, buffer, len);
+ return;
+ }
+ #endif
+ if(number >= (100 * ONE_DECIMAL_M)) {
len = snprintf(buffer, 10, "%4ldG ", number / ONE_M);
- RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, len);
- } else {
- len = snprintf(buffer, 10, "%3.1fG ", (float)number / ONE_M);
- RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, len);
+ RichString_appendn(str, largeNumberColor, buffer, len);
+ return;
}
+ len = snprintf(buffer, 10, "%4.1lfG ", (double)number / ONE_M);
+ RichString_appendn(str, largeNumberColor, buffer, len);
+ return;
} else if (number >= 100000) {
len = snprintf(buffer, 10, "%4ldM ", number / ONE_K);
- int attr = this->pl->highlightMegabytes
- ? CRT_colors[PROCESS_MEGABYTES]
- : CRT_colors[PROCESS];
- RichString_appendn(str, attr, buffer, len);
- } else if (this->pl->highlightMegabytes && number >= 1000) {
+ RichString_appendn(str, processMegabytesColor, buffer, len);
+ return;
+ } else if (number >= 1000) {
len = snprintf(buffer, 10, "%2ld", number/1000);
- RichString_appendn(str, CRT_colors[PROCESS_MEGABYTES], buffer, len);
+ RichString_appendn(str, processMegabytesColor, buffer, len);
number %= 1000;
- len = snprintf(buffer, 10, "%03ld ", number);
- RichString_appendn(str, CRT_colors[PROCESS], buffer, len);
- } else {
- len = snprintf(buffer, 10, "%5ld ", number);
- RichString_appendn(str, CRT_colors[PROCESS], buffer, len);
+ len = snprintf(buffer, 10, "%03lu ", number);
+ RichString_appendn(str, processColor, buffer, len);
+ return;
}
+ len = snprintf(buffer, 10, "%5lu ", number);
+ RichString_appendn(str, processColor, buffer, len);
}
-static void Process_colorNumber(RichString* str, unsigned long long number) {
+static void Process_colorNumber(RichString* str, unsigned long long number, bool coloring) {
char buffer[14];
+
+ int largeNumberColor = CRT_colors[LARGE_NUMBER];
+ 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];
+ processShadowColor = CRT_colors[PROCESS];
+ }
+
if (number > 10000000000) {
snprintf(buffer, 13, "%11lld ", number / 1000);
- RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, 5);
- RichString_appendn(str, CRT_colors[PROCESS_MEGABYTES], buffer+5, 3);
- RichString_appendn(str, CRT_colors[PROCESS], buffer+8, 4);
+ RichString_appendn(str, largeNumberColor, buffer, 5);
+ RichString_appendn(str, processMegabytesColor, buffer+5, 3);
+ RichString_appendn(str, processColor, buffer+8, 4);
} else {
- snprintf(buffer, 13, "%11lld ", number);
- RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, 2);
- RichString_appendn(str, CRT_colors[PROCESS_MEGABYTES], buffer+2, 3);
- RichString_appendn(str, CRT_colors[PROCESS], buffer+5, 3);
- RichString_appendn(str, CRT_colors[PROCESS_SHADOW], buffer+8, 4);
+ snprintf(buffer, 13, "%11llu ", number);
+ RichString_appendn(str, largeNumberColor, buffer, 2);
+ RichString_appendn(str, processMegabytesColor, buffer+2, 3);
+ RichString_appendn(str, processColor, buffer+5, 3);
+ RichString_appendn(str, processShadowColor, buffer+8, 4);
}
}
@@ -348,20 +436,24 @@ static inline void Process_writeCommand(Process* this, int attr, int baseattr, R
RichString_append(str, attr, this->comm);
if (this->pl->highlightBaseName) {
int finish = RichString_size(str) - 1;
- int space = RichString_findChar(str, ' ', start);
- if (space != -1)
- finish = space - 1;
- for (;;) {
- int slash = RichString_findChar(str, '/', start);
- if (slash == -1 || slash > finish)
- break;
- start = slash + 1;
+ if (this->basenameOffset != -1)
+ finish = (start + this->basenameOffset) - 1;
+ int colon = RichString_findChar(str, ':', start);
+ if (colon != -1 && colon < finish) {
+ finish = colon;
+ } else {
+ for (int i = finish - start; i >= 0; i--) {
+ if (this->comm[i] == '/') {
+ start += i+1;
+ break;
+ }
+ }
}
RichString_setAttrn(str, baseattr, start, finish);
}
}
-static inline void Process_outputRate(Process* this, RichString* str, int attr, char* buffer, int n, double rate) {
+static inline void Process_outputRate(RichString* str, int attr, char* buffer, int n, double rate, int coloring) {
rate = rate / 1024;
if (rate < 0.01)
snprintf(buffer, n, " 0 ");
@@ -370,17 +462,18 @@ static inline void Process_outputRate(Process* this, RichString* str, int attr,
else if (rate <= 100)
snprintf(buffer, n, "%5.1f ", rate);
else {
- Process_humanNumber(this, str, rate);
+ Process_humanNumber(str, rate, coloring);
return;
}
RichString_append(str, attr, buffer);
}
static void Process_writeField(Process* this, RichString* str, ProcessField field) {
- char buffer[128]; buffer[127] = '\0';
+ char buffer[256]; buffer[255] = '\0';
int attr = CRT_colors[DEFAULT_COLOR];
int baseattr = CRT_colors[PROCESS_BASENAME];
int n = sizeof(buffer) - 1;
+ bool coloring = this->pl->highlightMegabytes;
switch (field) {
case PID: snprintf(buffer, n, Process_pidFormat, this->pid); break;
@@ -390,6 +483,10 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break;
case TGID: snprintf(buffer, n, Process_pidFormat, this->tgid); break;
case TPGID: snprintf(buffer, n, Process_tpgidFormat, this->tpgid); break;
+ case MINFLT: Process_colorNumber(str, this->minflt, coloring); return;
+ case CMINFLT: Process_colorNumber(str, this->cminflt, coloring); return;
+ case MAJFLT: Process_colorNumber(str, this->majflt, coloring); return;
+ case CMAJFLT: Process_colorNumber(str, this->cmajflt, coloring); return;
case PROCESSOR: snprintf(buffer, n, "%3d ", ProcessList_cpuId(this->pl, this->processor)); break;
case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break;
case COMM: {
@@ -449,13 +546,13 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
: attr;
break;
}
- case M_DRS: Process_humanNumber(this, str, this->m_drs * PAGE_SIZE_KB); return;
- case M_DT: Process_humanNumber(this, str, this->m_dt * PAGE_SIZE_KB); return;
- case M_LRS: Process_humanNumber(this, str, this->m_lrs * PAGE_SIZE_KB); return;
- case M_TRS: Process_humanNumber(this, str, this->m_trs * PAGE_SIZE_KB); return;
- case M_SIZE: Process_humanNumber(this, str, this->m_size * PAGE_SIZE_KB); return;
- case M_RESIDENT: Process_humanNumber(this, str, this->m_resident * PAGE_SIZE_KB); return;
- case M_SHARE: Process_humanNumber(this, str, this->m_share * PAGE_SIZE_KB); return;
+ case M_DRS: Process_humanNumber(str, this->m_drs * PAGE_SIZE_KB, coloring); return;
+ case M_DT: Process_humanNumber(str, this->m_dt * PAGE_SIZE_KB, coloring); return;
+ case M_LRS: Process_humanNumber(str, this->m_lrs * PAGE_SIZE_KB, coloring); return;
+ case M_TRS: Process_humanNumber(str, this->m_trs * PAGE_SIZE_KB, coloring); return;
+ case M_SIZE: Process_humanNumber(str, this->m_size * PAGE_SIZE_KB, coloring); return;
+ case M_RESIDENT: Process_humanNumber(str, this->m_resident * PAGE_SIZE_KB, coloring); return;
+ case M_SHARE: Process_humanNumber(str, this->m_share * PAGE_SIZE_KB, coloring); return;
case ST_UID: snprintf(buffer, n, "%4d ", this->st_uid); break;
case USER: {
if (Process_getuid != (int) this->st_uid)
@@ -503,20 +600,23 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
case VXID: snprintf(buffer, n, "%5u ", this->vxid); break;
#endif
#ifdef HAVE_TASKSTATS
- case RCHAR: snprintf(buffer, n, "%12llu ", this->io_rchar); break;
- case WCHAR: snprintf(buffer, n, "%12llu ", this->io_wchar); break;
- case SYSCR: snprintf(buffer, n, "%10llu ", this->io_syscr); break;
- case SYSCW: snprintf(buffer, n, "%10llu ", this->io_syscw); break;
- case RBYTES: Process_colorNumber(str, this->io_read_bytes); return;
- case WBYTES: Process_colorNumber(str, this->io_write_bytes); return;
- case CNCLWB: snprintf(buffer, n, "%10llu ", this->io_cancelled_write_bytes); break;
- case IO_READ_RATE: Process_outputRate(this, str, attr, buffer, n, this->io_rate_read_bps); return;
- case IO_WRITE_RATE: Process_outputRate(this, str, attr, buffer, n, this->io_rate_write_bps); return;
- case IO_RATE: Process_outputRate(this, str, attr, buffer, n, this->io_rate_read_bps + this->io_rate_write_bps); return;
+ case RCHAR: Process_colorNumber(str, this->io_rchar, coloring); return;
+ case WCHAR: Process_colorNumber(str, this->io_wchar, coloring); return;
+ case SYSCR: Process_colorNumber(str, this->io_syscr, coloring); return;
+ case SYSCW: Process_colorNumber(str, this->io_syscw, coloring); return;
+ case RBYTES: Process_colorNumber(str, this->io_read_bytes, coloring); return;
+ case WBYTES: Process_colorNumber(str, this->io_write_bytes, coloring); return;
+ case CNCLWB: Process_colorNumber(str, this->io_cancelled_write_bytes, coloring); return;
+ case IO_READ_RATE: Process_outputRate(str, attr, buffer, n, this->io_rate_read_bps, coloring); return;
+ case IO_WRITE_RATE: Process_outputRate(str, attr, buffer, n, this->io_rate_write_bps, coloring); return;
+ case IO_RATE: Process_outputRate(str, attr, buffer, n, this->io_rate_read_bps + this->io_rate_write_bps, coloring); return;
#endif
#ifdef HAVE_CGROUP
case CGROUP: snprintf(buffer, n, "%-10s ", this->cgroup); break;
#endif
+ #ifdef HAVE_OOM
+ case OOM: snprintf(buffer, n, Process_pidFormat, this->oom); break;
+ #endif
case IO_PRIORITY: {
int klass = IOPriority_class(this->ioPriority);
if (klass == IOPRIO_CLASS_NONE) {
@@ -564,11 +664,16 @@ void Process_delete(Object* cast) {
free(this);
}
+ObjectClass Process_class = {
+ .extends = Class(Object),
+ .display = Process_display,
+ .delete = Process_delete,
+ .compare = Process_compare
+};
+
Process* Process_new(struct ProcessList_ *pl) {
- Process* this = calloc(sizeof(Process), 1);
- Object_setClass(this, PROCESS_CLASS);
- ((Object*)this)->display = Process_display;
- ((Object*)this)->delete = Process_delete;
+ Process* this = calloc(1, sizeof(Process));
+ Object_setClass(this, Class(Process));
this->pid = 0;
this->pl = pl;
this->tag = false;
@@ -578,6 +683,7 @@ Process* Process_new(struct ProcessList_ *pl) {
this->utime = 0;
this->stime = 0;
this->comm = NULL;
+ this->basenameOffset = -1;
this->indent = 0;
#ifdef HAVE_CGROUP
this->cgroup = NULL;
@@ -781,6 +887,10 @@ int Process_compare(const void* v1, const void* v2) {
case CGROUP:
return strcmp(p1->cgroup ? p1->cgroup : "", p2->cgroup ? p2->cgroup : "");
#endif
+ #ifdef HAVE_OOM
+ case OOM:
+ return (p1->oom - p2->oom);
+ #endif
case IO_PRIORITY:
return Process_effectiveIOPriority(p1) - Process_effectiveIOPriority(p2);
default:
diff --git a/Process.h b/Process.h
index c5f5934..19083fd 100644
--- a/Process.h
+++ b/Process.h
@@ -24,6 +24,12 @@ in the source distribution for its full text.
#include "IOPriority.h"
#include <sys/types.h>
+#define PROCESS_FLAG_IO 1
+#define PROCESS_FLAG_IOPRIO 2
+#define PROCESS_FLAG_OPENVZ 4
+#define PROCESS_FLAG_VSERVER 8
+#define PROCESS_FLAG_CGROUP 16
+
#ifndef Process_isKernelThread
#define Process_isKernelThread(_process) (_process->pgrp == 0)
#endif
@@ -54,6 +60,9 @@ typedef enum ProcessField_ {
#ifdef HAVE_CGROUP
CGROUP,
#endif
+ #ifdef HAVE_OOM
+ OOM,
+ #endif
IO_PRIORITY,
LAST_PROCESSFIELD
} ProcessField;
@@ -64,7 +73,6 @@ typedef struct Process_ {
Object super;
struct ProcessList_ *pl;
- bool updated;
pid_t pid;
char* comm;
@@ -80,12 +88,12 @@ typedef struct Process_ {
pid_t tgid;
int tpgid;
unsigned long int flags;
- #ifdef DEBUG
- unsigned long int minflt;
- unsigned long int cminflt;
- unsigned long int majflt;
- unsigned long int cmajflt;
- #endif
+
+ uid_t st_uid;
+ float percent_cpu;
+ float percent_mem;
+ char* user;
+
unsigned long long int utime;
unsigned long long int stime;
unsigned long long int cutime;
@@ -96,6 +104,53 @@ typedef struct Process_ {
IOPriority ioPriority;
char starttime_show[8];
time_t starttime_ctime;
+
+ #ifdef HAVE_TASKSTATS
+ unsigned long long io_rchar;
+ unsigned long long io_wchar;
+ unsigned long long io_syscr;
+ unsigned long long io_syscw;
+ unsigned long long io_read_bytes;
+ unsigned long long io_write_bytes;
+ unsigned long long io_cancelled_write_bytes;
+ double io_rate_read_bps;
+ unsigned long long io_rate_read_time;
+ double io_rate_write_bps;
+ unsigned long long io_rate_write_time;
+ #endif
+
+ int processor;
+ long m_size;
+ long m_resident;
+ long m_share;
+ long m_trs;
+ long m_drs;
+ long m_lrs;
+ long m_dt;
+
+ #ifdef HAVE_OPENVZ
+ unsigned int ctid;
+ unsigned int vpid;
+ #endif
+ #ifdef HAVE_VSERVER
+ unsigned int vxid;
+ #endif
+
+ #ifdef HAVE_CGROUP
+ char* cgroup;
+ #endif
+ #ifdef HAVE_OOM
+ unsigned int oom;
+ #endif
+
+ int exit_signal;
+ int basenameOffset;
+ bool updated;
+
+ unsigned long int minflt;
+ unsigned long int cminflt;
+ unsigned long int majflt;
+ unsigned long int cmajflt;
#ifdef DEBUG
long int itrealvalue;
unsigned long int vsize;
@@ -114,64 +169,31 @@ typedef struct Process_ {
unsigned long int nswap;
unsigned long int cnswap;
#endif
- int exit_signal;
- int processor;
- int m_size;
- int m_resident;
- int m_share;
- int m_trs;
- int m_drs;
- int m_lrs;
- int m_dt;
- uid_t st_uid;
- float percent_cpu;
- float percent_mem;
- char* user;
- #ifdef HAVE_OPENVZ
- unsigned int ctid;
- unsigned int vpid;
- #endif
- #ifdef HAVE_VSERVER
- unsigned int vxid;
- #endif
- #ifdef HAVE_TASKSTATS
- unsigned long long io_rchar;
- unsigned long long io_wchar;
- unsigned long long io_syscr;
- unsigned long long io_syscw;
- unsigned long long io_read_bytes;
- unsigned long long io_write_bytes;
- unsigned long long io_cancelled_write_bytes;
- double io_rate_read_bps;
- unsigned long long io_rate_read_time;
- double io_rate_write_bps;
- unsigned long long io_rate_write_time;
- #endif
- #ifdef HAVE_CGROUP
- char* cgroup;
- #endif
-} Process;
+} Process;
-#ifdef DEBUG
-extern char* PROCESS_CLASS;
-#else
-#define PROCESS_CLASS NULL
-#endif
extern const char *Process_fieldNames[];
+extern const int Process_fieldFlags[];
+
extern const char *Process_fieldTitles[];
void Process_getMaxPid();
-#define ONE_K 1024
+#define ONE_K 1024L
#define ONE_M (ONE_K * ONE_K)
#define ONE_G (ONE_M * ONE_K)
+#define ONE_DECIMAL_K 1000L
+#define ONE_DECIMAL_M (ONE_DECIMAL_K * ONE_DECIMAL_K)
+#define ONE_DECIMAL_G (ONE_DECIMAL_M * ONE_DECIMAL_K)
+
void Process_delete(Object* cast);
+extern ObjectClass Process_class;
+
Process* Process_new(struct ProcessList_ *pl);
void Process_toggleTag(Process* this);
diff --git a/ProcessList.c b/ProcessList.c
index 04adac5..d362115 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -24,6 +24,9 @@ in the source distribution for its full text.
#include <string.h>
#include <time.h>
#include <assert.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
/*{
#include "Vector.h"
@@ -31,7 +34,6 @@ in the source distribution for its full text.
#include "UsersTable.h"
#include "Panel.h"
#include "Process.h"
-#include <sys/types.h>
#ifndef PROCDIR
#define PROCDIR "/proc"
@@ -68,12 +70,6 @@ typedef enum TreeStr_ {
TREE_STR_COUNT
} TreeStr;
-typedef enum TreeType_ {
- TREE_TYPE_AUTO,
- TREE_TYPE_ASCII,
- TREE_TYPE_UTF8,
-} TreeType;
-
typedef struct CPUData_ {
unsigned long long int totalTime;
unsigned long long int userTime;
@@ -103,6 +99,7 @@ typedef struct CPUData_ {
} CPUData;
typedef struct ProcessList_ {
+ const char **treeStr;
Vector* processes;
Vector* processes2;
Hashtable* processTable;
@@ -110,9 +107,7 @@ typedef struct ProcessList_ {
Panel* panel;
int following;
- bool userOnly;
uid_t userId;
- bool filtering;
const char* incFilter;
Hashtable* pidWhiteList;
@@ -138,6 +133,7 @@ typedef struct ProcessList_ {
unsigned long long int usedSwap;
unsigned long long int freeSwap;
+ int flags;
ProcessField* fields;
ProcessField sortKey;
int direction;
@@ -154,7 +150,8 @@ typedef struct ProcessList_ {
bool detailedCPUTime;
bool countCPUsFromZero;
bool updateProcessNames;
- const char **treeStr;
+ bool accountGuestInCPUMeter;
+ bool userOnly;
} ProcessList;
@@ -182,16 +179,32 @@ const char *ProcessList_treeStrUtf8[TREE_STR_COUNT] = {
"\xe2\x94\x80", // TREE_STR_SHUT ─
};
+static ssize_t xread(int fd, void *buf, size_t count) {
+ // Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested.
+ size_t alreadyRead = 0;
+ for(;;) {
+ ssize_t res = read(fd, buf, count);
+ if (res == -1 && errno == EINTR) continue;
+ if (res > 0) {
+ buf = ((char*)buf)+res;
+ count -= res;
+ alreadyRead += res;
+ }
+ if (res == -1) return -1;
+ if (count == 0 || res == 0) return alreadyRead;
+ }
+}
+
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
ProcessList* this;
- this = calloc(sizeof(ProcessList), 1);
- this->processes = Vector_new(PROCESS_CLASS, true, DEFAULT_SIZE, Process_compare);
+ this = calloc(1, sizeof(ProcessList));
+ this->processes = Vector_new(Class(Process), true, DEFAULT_SIZE);
this->processTable = Hashtable_new(140, false);
this->usersTable = usersTable;
this->pidWhiteList = pidWhiteList;
/* tree-view auxiliary buffers */
- this->processes2 = Vector_new(PROCESS_CLASS, true, DEFAULT_SIZE, Process_compare);
+ this->processes2 = Vector_new(Class(Process), true, DEFAULT_SIZE);
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
@@ -204,28 +217,32 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
fgets(buffer, 255, file);
} while (String_startsWith(buffer, "cpu"));
fclose(file);
- this->cpuCount = cpus - 1;
+ this->cpuCount = MAX(cpus - 1, 1);
#ifdef HAVE_LIBHWLOC
this->topologyOk = false;
int topoErr = hwloc_topology_init(&this->topology);
if (topoErr == 0) {
topoErr = hwloc_topology_load(this->topology);
+ }
+ if (topoErr == 0) {
this->topologyOk = true;
}
#endif
- this->cpus = calloc(sizeof(CPUData), cpus);
+ this->cpus = calloc(cpus, sizeof(CPUData));
for (int i = 0; i < cpus; i++) {
this->cpus[i].totalTime = 1;
this->cpus[i].totalPeriod = 1;
}
- this->fields = calloc(sizeof(ProcessField), LAST_PROCESSFIELD+1);
+ this->fields = calloc(LAST_PROCESSFIELD+1, sizeof(ProcessField));
// TODO: turn 'fields' into a Vector,
// (and ProcessFields into proper objects).
+ this->flags = 0;
for (int i = 0; defaultHeaders[i]; i++) {
this->fields[i] = defaultHeaders[i];
+ this->fields[i] |= Process_fieldFlags[defaultHeaders[i]];
}
this->sortKey = PERCENT_CPU;
this->direction = 1;
@@ -244,6 +261,9 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
this->treeStr = NULL;
this->following = -1;
+ if (CRT_utf8)
+ this->treeStr = CRT_utf8 ? ProcessList_treeStrUtf8 : ProcessList_treeStrAscii;
+
return this;
}
@@ -313,7 +333,7 @@ int ProcessList_size(ProcessList* this) {
}
static void ProcessList_buildTree(ProcessList* this, pid_t pid, int level, int indent, int direction, bool show) {
- Vector* children = Vector_new(PROCESS_CLASS, false, DEFAULT_SIZE, Process_compare);
+ Vector* children = Vector_new(Class(Process), false, DEFAULT_SIZE);
for (int i = Vector_size(this->processes) - 1; i >= 0; i--) {
Process* process = (Process*) (Vector_get(this->processes, i));
@@ -386,46 +406,77 @@ void ProcessList_sort(ProcessList* this) {
static bool ProcessList_readStatFile(Process *process, const char* dirname, const char* name, char* command) {
char filename[MAX_NAME+1];
snprintf(filename, MAX_NAME, "%s/%s/stat", dirname, name);
- FILE* file = fopen(filename, "r");
- if (!file)
+ int fd = open(filename, O_RDONLY);
+ if (fd == -1)
return false;
- static char buf[MAX_READ];
+ static char buf[MAX_READ+1];
- int size = fread(buf, 1, MAX_READ, file);
- if (!size) { fclose(file); return false; }
+ int size = xread(fd, buf, MAX_READ);
+ close(fd);
+ if (size <= 0) return false;
+ buf[size] = '\0';
assert(process->pid == atoi(buf));
char *location = strchr(buf, ' ');
- if (!location) { fclose(file); return false; }
+ if (!location) return false;
location += 2;
char *end = strrchr(location, ')');
- if (!end) { fclose(file); return false; }
+ if (!end) return false;
int commsize = end - location;
memcpy(command, location, commsize);
command[commsize] = '\0';
location = end + 2;
- int num = sscanf(location,
- "%c %d %u %u %u "
- "%d %lu "
- "%*u %*u %*u %*u "
- "%llu %llu %llu %llu "
- "%ld %ld %ld "
- "%*d %*u %*u %*d %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u "
- "%d %d",
- &process->state, &process->ppid, &process->pgrp, &process->session, &process->tty_nr,
- &process->tpgid, &process->flags,
- &process->utime, &process->stime, &process->cutime, &process->cstime,
- &process->priority, &process->nice, &process->nlwp,
- &process->exit_signal, &process->processor);
- fclose(file);
- return (num == 16);
+ process->state = location[0];
+ location += 2;
+ process->ppid = strtol(location, &location, 10);
+ location += 1;
+ process->pgrp = strtoul(location, &location, 10);
+ location += 1;
+ process->session = strtoul(location, &location, 10);
+ location += 1;
+ process->tty_nr = strtoul(location, &location, 10);
+ location += 1;
+ process->tpgid = strtol(location, &location, 10);
+ location += 1;
+ process->flags = strtoul(location, &location, 10);
+ location += 1;
+ process->minflt = strtoull(location, &location, 10);
+ location += 1;
+ process->cminflt = strtoull(location, &location, 10);
+ location += 1;
+ process->majflt = strtoull(location, &location, 10);
+ location += 1;
+ process->cmajflt = strtoull(location, &location, 10);
+ location += 1;
+ process->utime = strtoull(location, &location, 10);
+ location += 1;
+ process->stime = strtoull(location, &location, 10);
+ location += 1;
+ process->cutime = strtoull(location, &location, 10);
+ location += 1;
+ process->cstime = strtoull(location, &location, 10);
+ location += 1;
+ process->priority = strtol(location, &location, 10);
+ location += 1;
+ process->nice = strtol(location, &location, 10);
+ location += 1;
+ process->nlwp = strtol(location, &location, 10);
+ location += 1;
+ for (int i=0; i<17; i++) location = strchr(location, ' ')+1;
+ process->exit_signal = strtol(location, &location, 10);
+ location += 1;
+ assert(location != NULL);
+ process->processor = strtol(location, &location, 10);
+ assert(location == NULL);
+
+ return true;
}
-static bool ProcessList_statProcessDir(Process* process, const char* dirname, char* name) {
+static bool ProcessList_statProcessDir(Process* process, const char* dirname, char* name, time_t curTime) {
char filename[MAX_NAME+1];
filename[MAX_NAME] = '\0';
@@ -440,60 +491,65 @@ static bool ProcessList_statProcessDir(Process* process, const char* dirname, ch
time_t ctime = sstat.st_ctime;
process->starttime_ctime = ctime;
(void) localtime_r((time_t*) &ctime, &date);
- strftime(process->starttime_show, 7, ((ctime > time(NULL) - 86400) ? "%R " : "%b%d "), &date);
+ strftime(process->starttime_show, 7, ((ctime > curTime - 86400) ? "%R " : "%b%d "), &date);
return true;
}
#ifdef HAVE_TASKSTATS
-static void ProcessList_readIoFile(Process* process, const char* dirname, char* name) {
+static void ProcessList_readIoFile(Process* process, const char* dirname, char* name, unsigned long long now) {
char filename[MAX_NAME+1];
filename[MAX_NAME] = '\0';
snprintf(filename, MAX_NAME, "%s/%s/io", dirname, name);
- FILE* file = fopen(filename, "r");
- if (!file)
+ int fd = open(filename, O_RDONLY);
+ if (fd == -1)
return;
- char buffer[256];
- buffer[255] = '\0';
- struct timeval tv;
- gettimeofday(&tv,NULL);
- unsigned long long now = tv.tv_sec*1000+tv.tv_usec/1000;
+ char buffer[1024];
+ ssize_t buflen = xread(fd, buffer, 1023);
+ close(fd);
+ if (buflen < 1) return;
+ buffer[buflen] = '\0';
unsigned long long last_read = process->io_read_bytes;
unsigned long long last_write = process->io_write_bytes;
- while (fgets(buffer, 255, file)) {
- switch (buffer[0]) {
+ char *buf = buffer;
+ char *line = NULL;
+ while ((line = strsep(&buf, "\n")) != NULL) {
+ switch (line[0]) {
case 'r':
- if (buffer[1] == 'c')
- sscanf(buffer, "rchar: %llu", &process->io_rchar);
- else if (sscanf(buffer, "read_bytes: %llu", &process->io_read_bytes)) {
+ if (line[1] == 'c' && strncmp(line+2, "har: ", 5) == 0)
+ process->io_rchar = strtoull(line+7, NULL, 10);
+ else if (strncmp(line+1, "ead_bytes: ", 11) == 0) {
+ process->io_read_bytes = strtoull(line+12, NULL, 10);
process->io_rate_read_bps =
((double)(process->io_read_bytes - last_read))/(((double)(now - process->io_rate_read_time))/1000);
process->io_rate_read_time = now;
}
break;
case 'w':
- if (buffer[1] == 'c')
- sscanf(buffer, "wchar: %llu", &process->io_wchar);
- else if (sscanf(buffer, "write_bytes: %llu", &process->io_write_bytes)) {
+ if (line[1] == 'c' && strncmp(line+2, "har: ", 5) == 0)
+ process->io_wchar = strtoull(line+7, NULL, 10);
+ else if (strncmp(line+1, "rite_bytes: ", 12) == 0) {
+ process->io_write_bytes = strtoull(line+13, NULL, 10);
process->io_rate_write_bps =
((double)(process->io_write_bytes - last_write))/(((double)(now - process->io_rate_write_time))/1000);
process->io_rate_write_time = now;
}
break;
case 's':
- if (buffer[5] == 'r')
- sscanf(buffer, "syscr: %llu", &process->io_syscr);
- else
- sscanf(buffer, "syscw: %llu", &process->io_syscw);
+ if (line[5] == 'r' && strncmp(line+1, "yscr: ", 6) == 0)
+ process->io_syscr = strtoull(line+7, NULL, 10);
+ else if (strncmp(line+1, "yscw: ", 6) == 0)
+ sscanf(line, "syscw: %32llu", &process->io_syscw);
+ process->io_syscw = strtoull(line+7, NULL, 10);
break;
case 'c':
- sscanf(buffer, "cancelled_write_bytes: %llu", &process->io_cancelled_write_bytes);
+ if (strncmp(line+1, "ancelled_write_bytes: ", 22) == 0)
+ process->io_cancelled_write_bytes = strtoull(line+23, NULL, 10);
}
}
- fclose(file);
}
#endif
@@ -501,16 +557,24 @@ static void ProcessList_readIoFile(Process* process, const char* dirname, char*
static bool ProcessList_readStatmFile(Process* process, const char* dirname, const char* name) {
char filename[MAX_NAME+1];
snprintf(filename, MAX_NAME, "%s/%s/statm", dirname, name);
- FILE* file = fopen(filename, "r");
- if (!file)
+ int fd = open(filename, O_RDONLY);
+ if (fd == -1)
return false;
-
- int num = fscanf(file, "%32d %32d %32d %32d %32d %32d %32d",
- &process->m_size, &process->m_resident, &process->m_share,
- &process->m_trs, &process->m_lrs, &process->m_drs,
- &process->m_dt);
- fclose(file);
- return (num == 7);
+ char buf[256];
+ ssize_t rres = xread(fd, buf, 255);
+ close(fd);
+ if (rres < 1) return false;
+
+ char *p = buf;
+ errno = 0;
+ process->m_size = strtol(p, &p, 10); if (*p == ' ') p++;
+ process->m_resident = strtol(p, &p, 10); if (*p == ' ') p++;
+ process->m_share = strtol(p, &p, 10); if (*p == ' ') p++;
+ process->m_trs = strtol(p, &p, 10); if (*p == ' ') p++;
+ process->m_lrs = strtol(p, &p, 10); if (*p == ' ') p++;
+ process->m_drs = strtol(p, &p, 10); if (*p == ' ') p++;
+ process->m_dt = strtol(p, &p, 10);
+ return (errno == 0);
}
#ifdef HAVE_OPENVZ
@@ -582,7 +646,7 @@ static void ProcessList_readVServerData(Process* process, const char* dirname, c
while (fgets(buffer, 255, file)) {
if (String_startsWith(buffer, "VxID:")) {
int vxid;
- int ok = sscanf(buffer, "VxID:\t%d", &vxid);
+ int ok = sscanf(buffer, "VxID:\t%32d", &vxid);
if (ok >= 1) {
process->vxid = vxid;
}
@@ -590,7 +654,7 @@ static void ProcessList_readVServerData(Process* process, const char* dirname, c
#if defined HAVE_ANCIENT_VSERVER
else if (String_startsWith(buffer, "s_context:")) {
int vxid;
- int ok = sscanf(buffer, "s_context:\t%d", &vxid);
+ int ok = sscanf(buffer, "s_context:\t%32d", &vxid);
if (ok >= 1) {
process->vxid = vxid;
}
@@ -602,37 +666,71 @@ static void ProcessList_readVServerData(Process* process, const char* dirname, c
#endif
+#ifdef HAVE_OOM
+
+static void ProcessList_readOomData(Process* process, const char* dirname, const char* name) {
+ char filename[MAX_NAME+1];
+ snprintf(filename, MAX_NAME, "%s/%s/oom_score", dirname, name);
+ FILE* file = fopen(filename, "r");
+ if (!file)
+ return;
+ char buffer[256];
+ if (fgets(buffer, 255, file)) {
+ unsigned int oom;
+ int ok = sscanf(buffer, "%32u", &oom);
+ if (ok >= 1) {
+ process->oom = oom;
+ }
+ }
+ fclose(file);
+}
+
+#endif
+
static bool ProcessList_readCmdlineFile(Process* process, const char* dirname, const char* name) {
if (Process_isKernelThread(process))
return true;
char filename[MAX_NAME+1];
snprintf(filename, MAX_NAME, "%s/%s/cmdline", dirname, name);
- FILE* file = fopen(filename, "r");
- if (!file)
+ int fd = open(filename, O_RDONLY);
+ if (fd == -1)
return false;
char command[4096+1]; // max cmdline length on Linux
- int amtRead = fread(command, 1, sizeof(command) - 1, file);
+ int amtRead = xread(fd, command, sizeof(command) - 1);
+ close(fd);
+ int tokenEnd = 0;
if (amtRead > 0) {
for (int i = 0; i < amtRead; i++)
if (command[i] == '\0' || command[i] == '\n') {
+ if (tokenEnd == 0) {
+ tokenEnd = i;
+ }
command[i] = ' ';
}
}
+ if (tokenEnd == 0) {
+ tokenEnd = amtRead;
+ }
command[amtRead] = '\0';
- fclose(file);
free(process->comm);
process->comm = strdup(command);
+ process->basenameOffset = tokenEnd;
return true;
}
-static bool ProcessList_processEntries(ProcessList* this, const char* dirname, Process* parent, double period) {
+static bool ProcessList_processEntries(ProcessList* this, const char* dirname, Process* parent, double period, struct timeval tv) {
DIR* dir;
struct dirent* entry;
+ time_t curTime = tv.tv_sec;
+ #ifdef HAVE_TASKSTATS
+ unsigned long long now = tv.tv_sec*1000LL+tv.tv_usec/1000LL;
+ #endif
+
dir = opendir(dirname);
if (!dir) return false;
int cpus = this->cpuCount;
@@ -640,17 +738,24 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
bool hideUserlandThreads = this->hideUserlandThreads;
while ((entry = readdir(dir)) != NULL) {
char* name = entry->d_name;
+
+ // The RedHat kernel hides threads with a dot.
+ // I believe this is non-standard.
+ if ((!this->hideThreads) && name[0] == '.') {
+ name++;
+ }
+
+ // Just skip all non-number directories.
+ if (name[0] < '0' || name[0] > '9') {
+ continue;
+ }
+
// filename is a number: process directory
int pid = atoi(name);
if (parent && pid == parent->pid)
continue;
- // The RedHat kernel hides threads with a dot.
- // I believe this is non-standard.
- if ((!this->hideThreads) && pid == 0 && name[0] == '.') {
- pid = atoi(name + 1);
- }
if (pid <= 0)
continue;
@@ -670,10 +775,11 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
char subdirname[MAX_NAME+1];
snprintf(subdirname, MAX_NAME, "%s/%s/task", dirname, name);
- ProcessList_processEntries(this, subdirname, process, period);
+ ProcessList_processEntries(this, subdirname, process, period, tv);
#ifdef HAVE_TASKSTATS
- ProcessList_readIoFile(process, dirname, name);
+ if (this->flags & PROCESS_FLAG_IO)
+ ProcessList_readIoFile(process, dirname, name, now);
#endif
if (! ProcessList_readStatmFile(process, dirname, name))
@@ -685,7 +791,8 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
unsigned long long int lasttimes = (process->utime + process->stime);
if (! ProcessList_readStatFile(process, dirname, name, command))
goto errorReadingProcess;
- Process_updateIOPriority(process);
+ if (this->flags & PROCESS_FLAG_IOPRIO)
+ Process_updateIOPriority(process);
float percent_cpu = (process->utime + process->stime - lasttimes) / period * 100.0;
process->percent_cpu = MAX(MIN(percent_cpu, cpus*100.0), 0.0);
if (isnan(process->percent_cpu)) process->percent_cpu = 0.0;
@@ -693,23 +800,30 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
if(!existingProcess) {
- if (! ProcessList_statProcessDir(process, dirname, name))
+ if (! ProcessList_statProcessDir(process, dirname, name, curTime))
goto errorReadingProcess;
process->user = UsersTable_getRef(this->usersTable, process->st_uid);
#ifdef HAVE_OPENVZ
- ProcessList_readOpenVZData(process, dirname, name);
+ if (this->flags & PROCESS_FLAG_OPENVZ)
+ ProcessList_readOpenVZData(process, dirname, name);
#endif
#ifdef HAVE_CGROUP
- ProcessList_readCGroupFile(process, dirname, name);
+ if (this->flags & PROCESS_FLAG_CGROUP)
+ ProcessList_readCGroupFile(process, dirname, name);
#endif
#ifdef HAVE_VSERVER
- ProcessList_readVServerData(process, dirname, name);
+ if (this->flags & PROCESS_FLAG_VSERVER)
+ ProcessList_readVServerData(process, dirname, name);
#endif
+ #ifdef HAVE_OOM
+ ProcessList_readOomData(process, dirname, name);
+ #endif
+
if (! ProcessList_readCmdlineFile(process, dirname, name))
goto errorReadingProcess;
@@ -723,10 +837,12 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
if (process->state == 'Z') {
free(process->comm);
+ process->basenameOffset = -1;
process->comm = strdup(command);
} else if (Process_isThread(process)) {
if (this->showThreadNames || Process_isKernelThread(process) || process->state == 'Z') {
free(process->comm);
+ process->basenameOffset = -1;
process->comm = strdup(command);
} else if (this->showingThreadNames) {
if (! ProcessList_readCmdlineFile(process, dirname, name))
@@ -750,6 +866,7 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
errorReadingProcess: {
if (process->comm) {
free(process->comm);
+ process->basenameOffset = -1;
process->comm = NULL;
}
if (existingProcess)
@@ -763,7 +880,7 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
}
void ProcessList_scan(ProcessList* this) {
- unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime, virtalltime;
+ unsigned long long int usertime, nicetime, systemtime, idletime;
unsigned long long int swapFree = 0;
FILE* file = fopen(PROCMEMINFOFILE, "r");
@@ -771,6 +888,7 @@ void ProcessList_scan(ProcessList* this) {
CRT_fatalError("Cannot open " PROCMEMINFOFILE);
}
int cpus = this->cpuCount;
+ assert(cpus > 0);
{
char buffer[128];
while (fgets(buffer, 128, file)) {
@@ -778,25 +896,25 @@ void ProcessList_scan(ProcessList* this) {
switch (buffer[0]) {
case 'M':
if (String_startsWith(buffer, "MemTotal:"))
- sscanf(buffer, "MemTotal: %llu kB", &this->totalMem);
+ sscanf(buffer, "MemTotal: %32llu kB", &this->totalMem);
else if (String_startsWith(buffer, "MemFree:"))
- sscanf(buffer, "MemFree: %llu kB", &this->freeMem);
+ sscanf(buffer, "MemFree: %32llu kB", &this->freeMem);
else if (String_startsWith(buffer, "MemShared:"))
- sscanf(buffer, "MemShared: %llu kB", &this->sharedMem);
+ sscanf(buffer, "MemShared: %32llu kB", &this->sharedMem);
break;
case 'B':
if (String_startsWith(buffer, "Buffers:"))
- sscanf(buffer, "Buffers: %llu kB", &this->buffersMem);
+ sscanf(buffer, "Buffers: %32llu kB", &this->buffersMem);
break;
case 'C':
if (String_startsWith(buffer, "Cached:"))
- sscanf(buffer, "Cached: %llu kB", &this->cachedMem);
+ sscanf(buffer, "Cached: %32llu kB", &this->cachedMem);
break;
case 'S':
if (String_startsWith(buffer, "SwapTotal:"))
- sscanf(buffer, "SwapTotal: %llu kB", &this->totalSwap);
+ sscanf(buffer, "SwapTotal: %32llu kB", &this->totalSwap);
if (String_startsWith(buffer, "SwapFree:"))
- sscanf(buffer, "SwapFree: %llu kB", &swapFree);
+ sscanf(buffer, "SwapFree: %32llu kB", &swapFree);
break;
}
}
@@ -813,24 +931,28 @@ void ProcessList_scan(ProcessList* this) {
for (int i = 0; i <= cpus; i++) {
char buffer[256];
int cpuid;
- unsigned long long int ioWait, irq, softIrq, steal, guest;
- ioWait = irq = softIrq = steal = guest = 0;
+ unsigned long long int ioWait, irq, softIrq, steal, guest, guestnice;
+ unsigned long long int systemalltime, idlealltime, totaltime, virtalltime;
+ ioWait = irq = softIrq = steal = guest = guestnice = 0;
// Dependending on your kernel version,
- // 5, 7 or 8 of these fields will be set.
+ // 5, 7, 8 or 9 of these fields will be set.
// The rest will remain at zero.
fgets(buffer, 255, file);
if (i == 0)
- sscanf(buffer, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest);
+ sscanf(buffer, "cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
else {
- sscanf(buffer, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest);
+ 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
+ usertime = usertime - guest;
+ nicetime = nicetime - guestnice;
// Fields existing on kernels >= 2.6
// (and RHEL's patched kernel 2.4...)
idlealltime = idletime + ioWait;
systemalltime = systemtime + irq + softIrq;
- virtalltime = steal + guest;
- totaltime = usertime + nicetime + systemalltime + idlealltime + virtalltime;
+ virtalltime = guest + guestnice;
+ totaltime = usertime + nicetime + systemalltime + idlealltime + steal + virtalltime;
CPUData* cpuData = &(this->cpus[i]);
assert (usertime >= cpuData->userTime);
assert (nicetime >= cpuData->niceTime);
@@ -843,7 +965,7 @@ void ProcessList_scan(ProcessList* this) {
assert (irq >= cpuData->irqTime);
assert (softIrq >= cpuData->softIrqTime);
assert (steal >= cpuData->stealTime);
- assert (guest >= cpuData->guestTime);
+ assert (virtalltime >= cpuData->guestTime);
cpuData->userPeriod = usertime - cpuData->userTime;
cpuData->nicePeriod = nicetime - cpuData->niceTime;
cpuData->systemPeriod = systemtime - cpuData->systemTime;
@@ -854,7 +976,7 @@ void ProcessList_scan(ProcessList* this) {
cpuData->irqPeriod = irq - cpuData->irqTime;
cpuData->softIrqPeriod = softIrq - cpuData->softIrqTime;
cpuData->stealPeriod = steal - cpuData->stealTime;
- cpuData->guestPeriod = guest - cpuData->guestTime;
+ cpuData->guestPeriod = virtalltime - cpuData->guestTime;
cpuData->totalPeriod = totaltime - cpuData->totalTime;
cpuData->userTime = usertime;
cpuData->niceTime = nicetime;
@@ -866,7 +988,7 @@ void ProcessList_scan(ProcessList* this) {
cpuData->irqTime = irq;
cpuData->softIrqTime = softIrq;
cpuData->stealTime = steal;
- cpuData->guestTime = guest;
+ cpuData->guestTime = virtalltime;
cpuData->totalTime = totaltime;
}
double period = (double)this->cpus[0].totalPeriod / cpus; fclose(file);
@@ -882,7 +1004,9 @@ void ProcessList_scan(ProcessList* this) {
this->kernelThreads = 0;
this->runningTasks = 0;
- ProcessList_processEntries(this, PROCDIR, NULL, period);
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ ProcessList_processEntries(this, PROCDIR, NULL, period, tv);
this->showingThreadNames = this->showThreadNames;
@@ -918,18 +1042,16 @@ void ProcessList_expandTree(ProcessList* this) {
}
}
-void ProcessList_rebuildPanel(ProcessList* this, bool flags, int following, bool userOnly, uid_t userId, bool filtering, const char* incFilter) {
+void ProcessList_rebuildPanel(ProcessList* this, bool flags, int following, bool userOnly, uid_t userId, const char* incFilter) {
if (!flags) {
following = this->following;
userOnly = this->userOnly;
userId = this->userId;
- filtering = this->filtering;
incFilter = this->incFilter;
} else {
this->following = following;
this->userOnly = userOnly;
this->userId = userId;
- this->filtering = filtering;
this->incFilter = incFilter;
}
@@ -946,7 +1068,7 @@ void ProcessList_rebuildPanel(ProcessList* this, bool flags, int following, bool
if ( (!p->show)
|| (userOnly && (p->st_uid != userId))
- || (filtering && !(String_contains_i(p->comm, incFilter)))
+ || (incFilter && !(String_contains_i(p->comm, incFilter)))
|| (this->pidWhiteList && !Hashtable_get(this->pidWhiteList, p->pid)) )
hidden = true;
diff --git a/ProcessList.h b/ProcessList.h
index 34bd5e8..1f3549a 100644
--- a/ProcessList.h
+++ b/ProcessList.h
@@ -14,7 +14,6 @@ in the source distribution for its full text.
#include "UsersTable.h"
#include "Panel.h"
#include "Process.h"
-#include <sys/types.h>
#ifndef PROCDIR
#define PROCDIR "/proc"
@@ -51,12 +50,6 @@ typedef enum TreeStr_ {
TREE_STR_COUNT
} TreeStr;
-typedef enum TreeType_ {
- TREE_TYPE_AUTO,
- TREE_TYPE_ASCII,
- TREE_TYPE_UTF8,
-} TreeType;
-
typedef struct CPUData_ {
unsigned long long int totalTime;
unsigned long long int userTime;
@@ -86,6 +79,7 @@ typedef struct CPUData_ {
} CPUData;
typedef struct ProcessList_ {
+ const char **treeStr;
Vector* processes;
Vector* processes2;
Hashtable* processTable;
@@ -93,9 +87,7 @@ typedef struct ProcessList_ {
Panel* panel;
int following;
- bool userOnly;
uid_t userId;
- bool filtering;
const char* incFilter;
Hashtable* pidWhiteList;
@@ -121,6 +113,7 @@ typedef struct ProcessList_ {
unsigned long long int usedSwap;
unsigned long long int freeSwap;
+ int flags;
ProcessField* fields;
ProcessField sortKey;
int direction;
@@ -137,7 +130,8 @@ typedef struct ProcessList_ {
bool detailedCPUTime;
bool countCPUsFromZero;
bool updateProcessNames;
- const char **treeStr;
+ bool accountGuestInCPUMeter;
+ bool userOnly;
} ProcessList;
@@ -178,6 +172,10 @@ void ProcessList_sort(ProcessList* this);
#endif
+#ifdef HAVE_OOM
+
+#endif
+
void ProcessList_scan(ProcessList* this);
@@ -185,6 +183,6 @@ ProcessField ProcessList_keyAt(ProcessList* this, int at);
void ProcessList_expandTree(ProcessList* this);
-void ProcessList_rebuildPanel(ProcessList* this, bool flags, int following, bool userOnly, uid_t userId, bool filtering, const char* incFilter);
+void ProcessList_rebuildPanel(ProcessList* this, bool flags, int following, bool userOnly, uid_t userId, const char* incFilter);
#endif
diff --git a/README b/README
index 5038677..f713e1c 100644
--- a/README
+++ b/README
@@ -1,11 +1,17 @@
-
htop
-by Hisham Muhammad <loderunner@users.sourceforge.net>
+====
+
+by Hisham Muhammad <hisham@gobolinux.org>
+
+May, 2004 - January, 2014
-May, 2004 - December, 2010
+Note
+----
+
+![Alert](http://i.imgur.com/ugIqB9s.png) **Mac users, [click here](https://www.bountysource.com/fundraisers/554-mac-os-x-support-in-the-official-htop-1-x-tree)!** The htop version you are using is a 5-year old fork -- help bring htop 1.x to the Mac!
Introduction
-~~~~~~~~~~~~
+------------
This is htop, an interactive process viewer.
It requires ncurses. It is tested with Linux 2.6,
@@ -23,28 +29,32 @@ and is reasonably complete, but there is still room for
improvement. Read the TODO file to see what's known to be missing.
Comparison between 'htop' and 'top'
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- * In 'htop' you can scroll the list vertically and horizontally
- to see all processes and full command lines.
- * In 'top' you are subject to a delay for each unassigned
- key you press (especially annoying when multi-key escape
- sequences are triggered by accident).
- * 'htop' starts faster ('top' seems to collect data for a while
- before displaying anything).
- * In 'htop' you don't need to type the process number to
- kill a process, in 'top' you do.
- * In 'htop' you don't need to type the process number or
- the priority value to renice a process, in 'top' you do.
- * In 'htop' you can kill multiple processes at once.
- * 'top' is older, hence, more tested.
+-----------------------------------
+
+* In 'htop' you can scroll the list vertically and horizontally
+ to see all processes and full command lines.
+* In 'top' you are subject to a delay for each unassigned
+ key you press (especially annoying when multi-key escape
+ sequences are triggered by accident).
+* 'htop' starts faster ('top' seems to collect data for a while
+ before displaying anything).
+* In 'htop' you don't need to type the process number to
+ kill a process, in 'top' you do.
+* In 'htop' you don't need to type the process number or
+ the priority value to renice a process, in 'top' you do.
+* In 'htop' you can kill multiple processes at once.
+* 'top' is older, hence, more tested.
Compilation instructions
-~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------
This program is distributed as a standard autotools-based package.
See the INSTALL file for detailed instructions, but you are
-probably used to the common "configure/make/make install" routine.
+probably used to the common `./configure`/`make`/`make install` routine.
+
+When fetching the code from the development repository, you need
+to run the `./autogen.sh` script, which in turn requires autotools
+to be installed.
See the manual page (man htop) or the on-line help ('F1' or 'h'
inside htop) for a list of supported key commands.
diff --git a/RichString.c b/RichString.c
index eca2293..34720c1 100644
--- a/RichString.c
+++ b/RichString.c
@@ -21,6 +21,8 @@ in the source distribution for its full text.
#include <ncursesw/curses.h>
#elif HAVE_NCURSES_NCURSES_H
#include <ncurses/ncurses.h>
+#elif HAVE_NCURSES_CURSES_H
+#include <ncurses/curses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
@@ -83,16 +85,15 @@ static inline void RichString_setLen(RichString* this, int len) {
#ifdef HAVE_LIBNCURSESW
-inline void RichString_appendn(RichString* this, int attrs, const char* data_c, int len) {
+static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) {
wchar_t data[len+1];
len = mbstowcs(data, data_c, len);
if (len<0)
return;
- int oldLen = this->chlen;
- int newLen = len + oldLen;
+ int newLen = from + len;
RichString_setLen(this, newLen);
- for (int i = oldLen, j = 0; i < newLen; i++, j++) {
- memset(&this->chptr[i], 0, sizeof(this->chptr[i]));
+ memset(&this->chptr[from], 0, sizeof(CharType) * (newLen - from));
+ for (int i = from, j = 0; i < newLen; i++, j++) {
this->chptr[i].chars[0] = data[j];
this->chptr[i].attr = attrs;
}
@@ -120,11 +121,10 @@ int RichString_findChar(RichString* this, char c, int start) {
#else
-inline void RichString_appendn(RichString* this, int attrs, const char* data_c, int len) {
- int oldLen = this->chlen;
- int newLen = len + oldLen;
+static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) {
+ int newLen = from + len;
RichString_setLen(this, newLen);
- for (int i = oldLen, j = 0; i < newLen; i++, j++)
+ for (int i = from, j = 0; i < newLen; i++, j++)
this->chptr[i] = (isprint(data_c[j]) ? data_c[j] : '?') | attrs;
this->chptr[newLen] = 0;
}
@@ -154,17 +154,21 @@ void RichString_prune(RichString* this) {
free(this->chptr);
this->chptr = this->chstr;
this->chlen = 0;
+ RichString_setChar(this, 0, 0);
}
void RichString_setAttr(RichString* this, int attrs) {
RichString_setAttrn(this, attrs, 0, this->chlen - 1);
}
-inline void RichString_append(RichString* this, int attrs, const char* data) {
- RichString_appendn(this, attrs, data, strlen(data));
+void RichString_append(RichString* this, int attrs, const char* data) {
+ RichString_writeFrom(this, attrs, data, this->chlen, strlen(data));
+}
+
+void RichString_appendn(RichString* this, int attrs, const char* data, int len) {
+ RichString_writeFrom(this, attrs, data, this->chlen, len);
}
void RichString_write(RichString* this, int attrs, const char* data) {
- RichString_setLen(this, 0);
- RichString_appendn(this, attrs, data, strlen(data));
+ RichString_writeFrom(this, attrs, data, 0, strlen(data));
}
diff --git a/RichString.h b/RichString.h
index 1b4d244..a9cb3f6 100644
--- a/RichString.h
+++ b/RichString.h
@@ -19,6 +19,8 @@ in the source distribution for its full text.
#include <ncursesw/curses.h>
#elif HAVE_NCURSES_NCURSES_H
#include <ncurses/ncurses.h>
+#elif HAVE_NCURSES_CURSES_H
+#include <ncurses/curses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_CURSES_H
@@ -61,16 +63,12 @@ typedef struct RichString_ {
#ifdef HAVE_LIBNCURSESW
-extern void RichString_appendn(RichString* this, int attrs, const char* data_c, int len);
-
extern void RichString_setAttrn(RichString* this, int attrs, int start, int finish);
int RichString_findChar(RichString* this, char c, int start);
#else
-extern void RichString_appendn(RichString* this, int attrs, const char* data_c, int len);
-
void RichString_setAttrn(RichString* this, int attrs, int start, int finish);
int RichString_findChar(RichString* this, char c, int start);
@@ -81,7 +79,9 @@ void RichString_prune(RichString* this);
void RichString_setAttr(RichString* this, int attrs);
-extern void RichString_append(RichString* this, int attrs, const char* data);
+void RichString_append(RichString* this, int attrs, const char* data);
+
+void RichString_appendn(RichString* this, int attrs, const char* data, int len);
void RichString_write(RichString* this, int attrs, const char* data);
diff --git a/ScreenManager.c b/ScreenManager.c
index 744ea2b..646ee2f 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -52,8 +52,8 @@ ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation ori
this->y2 = y2;
this->fuBar = NULL;
this->orientation = orientation;
- this->panels = Vector_new(PANEL_CLASS, owner, DEFAULT_SIZE, NULL);
- this->fuBars = Vector_new(FUNCTIONBAR_CLASS, true, DEFAULT_SIZE, NULL);
+ this->panels = Vector_new(Class(Panel), owner, DEFAULT_SIZE);
+ this->fuBars = Vector_new(Class(FunctionBar), true, DEFAULT_SIZE);
this->panelCount = 0;
this->header = header;
this->owner = owner;
@@ -144,7 +144,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
this->lastScan = now;
}
Header_draw(this->header);
- ProcessList_rebuildPanel(this->header->pl, false, false, false, false, false, NULL);
+ ProcessList_rebuildPanel(this->header->pl, false, false, false, false, NULL);
}
for (int i = 0; i < panels; i++) {
Panel* panel = (Panel*) Vector_get(this->panels, i);
@@ -173,7 +173,8 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
for (int i = 0; i < this->panelCount; i++) {
Panel* panel = (Panel*) Vector_get(this->panels, i);
if (mevent.x > panel->x && mevent.x <= panel->x+panel->w &&
- mevent.y > panel->y && mevent.y <= panel->y+panel->h) {
+ mevent.y > panel->y && mevent.y <= panel->y+panel->h &&
+ (this->allowFocusChange || panelFocus == panel) ) {
focus = i;
panelFocus = panel;
Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1);
@@ -184,8 +185,8 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
}
}
- if (panelFocus->eventHandler) {
- HandlerResult result = panelFocus->eventHandler(panelFocus, ch);
+ if (Panel_eventHandlerFn(panelFocus)) {
+ HandlerResult result = Panel_eventHandler(panelFocus, ch);
if (result == HANDLED) {
continue;
} else if (result == BREAK_LOOP) {
diff --git a/Settings.c b/Settings.c
index fd200a7..cd9e6c1 100644
--- a/Settings.c
+++ b/Settings.c
@@ -27,8 +27,8 @@ typedef struct Settings_ {
ProcessList* pl;
Header* header;
int colorScheme;
- bool changed;
int delay;
+ bool changed;
} Settings;
}*/
@@ -61,7 +61,7 @@ static void Settings_readMeterModes(Settings* this, char* line, HeaderSide side)
String_freeArray(ids);
}
-static bool Settings_read(Settings* this, char* fileName, int cpuCount) {
+static bool Settings_read(Settings* this, const char* fileName, int cpuCount) {
FILE* fd = fopen(fileName, "r");
if (!fd)
return false;
@@ -82,11 +82,13 @@ static bool Settings_read(Settings* this, char* fileName, int cpuCount) {
char** ids = String_split(trim, ' ', &nIds);
free(trim);
int i, j;
+ this->pl->flags = 0;
for (j = 0, i = 0; i < LAST_PROCESSFIELD && ids[i]; i++) {
// This "+1" is for compatibility with the older enum format.
int id = atoi(ids[i]) + 1;
if (id > 0 && id < LAST_PROCESSFIELD) {
this->pl->fields[j] = id;
+ this->pl->flags |= Process_fieldFlags[id];
j++;
}
}
@@ -126,6 +128,8 @@ static bool Settings_read(Settings* this, char* fileName, int cpuCount) {
this->pl->countCPUsFromZero = atoi(option[1]);
} else if (String_eq(option[0], "update_process_names")) {
this->pl->updateProcessNames = atoi(option[1]);
+ } else if (String_eq(option[0], "account_guest_in_cpu_meter")) {
+ this->pl->accountGuestInCPUMeter = atoi(option[1]);
} else if (String_eq(option[0], "delay")) {
this->delay = atoi(option[1]);
} else if (String_eq(option[0], "color_scheme")) {
@@ -186,6 +190,7 @@ bool Settings_write(Settings* this) {
fprintf(fd, "detailed_cpu_time=%d\n", (int) this->pl->detailedCPUTime);
fprintf(fd, "cpu_count_from_zero=%d\n", (int) this->pl->countCPUsFromZero);
fprintf(fd, "update_process_names=%d\n", (int) this->pl->updateProcessNames);
+ fprintf(fd, "account_guest_in_cpu_meter=%d\n", (int) this->pl->accountGuestInCPUMeter);
fprintf(fd, "color_scheme=%d\n", (int) this->colorScheme);
fprintf(fd, "delay=%d\n", (int) this->delay);
fprintf(fd, "left_meters=");
@@ -238,12 +243,14 @@ Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
htopDir = String_cat(home, "/.config/htop");
}
legacyDotfile = String_cat(home, "/.htoprc");
- mkdir(configDir, 0700);
- mkdir(htopDir, 0700);
+ (void) mkdir(configDir, 0700);
+ (void) mkdir(htopDir, 0700);
free(htopDir);
free(configDir);
struct stat st;
- lstat(legacyDotfile, &st);
+ if (lstat(legacyDotfile, &st) != 0) {
+ st.st_mode = 0;
+ }
if (access(legacyDotfile, R_OK) != 0 || S_ISLNK(st.st_mode)) {
free(legacyDotfile);
legacyDotfile = NULL;
@@ -258,7 +265,6 @@ Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
// Transition to new location and delete old configuration file
if (Settings_write(this))
unlink(legacyDotfile);
- free(legacyDotfile);
}
} else {
this->changed = true;
@@ -273,5 +279,6 @@ Settings* Settings_new(ProcessList* pl, Header* header, int cpuCount) {
pl->highlightThreads = false;
}
}
+ free(legacyDotfile);
return this;
}
diff --git a/Settings.h b/Settings.h
index af54222..28fe552 100644
--- a/Settings.h
+++ b/Settings.h
@@ -20,8 +20,8 @@ typedef struct Settings_ {
ProcessList* pl;
Header* header;
int colorScheme;
- bool changed;
int delay;
+ bool changed;
} Settings;
diff --git a/SignalsPanel.c b/SignalsPanel.c
index e1a88b5..a52e528 100644
--- a/SignalsPanel.c
+++ b/SignalsPanel.c
@@ -5,6 +5,7 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
+#include "Panel.h"
#include "SignalsPanel.h"
#include "ListItem.h"
@@ -16,26 +17,14 @@ in the source distribution for its full text.
#include <ctype.h>
/*{
-#include "Panel.h"
typedef struct SignalItem_ {
const char* name;
int number;
} SignalItem;
-typedef struct SignalsPanel_ {
- Panel super;
-} SignalsPanel;
-
}*/
-static void SignalsPanel_delete(Object* object) {
- Panel* super = (Panel*) object;
- SignalsPanel* this = (SignalsPanel*) object;
- Panel_done(super);
- free(this);
-}
-
static SignalItem signals[] = {
{ .name = " 0 Cancel", .number = 0 },
{ .name = " 1 SIGHUP", .number = 1 },
@@ -73,21 +62,11 @@ static SignalItem signals[] = {
{ .name = "31 SIGSYS", .number = 31 },
};
-SignalsPanel* SignalsPanel_new(int x, int y, int w, int h) {
- SignalsPanel* this = (SignalsPanel*) malloc(sizeof(SignalsPanel));
- Panel* super = (Panel*) this;
- Panel_init(super, x, y, w, h, LISTITEM_CLASS, true);
- ((Object*)this)->delete = SignalsPanel_delete;
-
+Panel* SignalsPanel_new() {
+ Panel* this = Panel_new(1, 1, 1, 1, true, Class(ListItem));
for(unsigned int i = 0; i < sizeof(signals)/sizeof(SignalItem); i++)
- Panel_set(super, i, (Object*) ListItem_new(signals[i].name, signals[i].number));
- SignalsPanel_reset(this);
+ Panel_set(this, i, (Object*) ListItem_new(signals[i].name, signals[i].number));
+ Panel_setHeader(this, "Send signal:");
+ Panel_setSelected(this, 16); // 16th item is SIGTERM
return this;
}
-
-void SignalsPanel_reset(SignalsPanel* this) {
- Panel* super = (Panel*) this;
-
- Panel_setHeader(super, "Send signal:");
- Panel_setSelected(super, 16); // 16th item is SIGTERM
-}
diff --git a/SignalsPanel.h b/SignalsPanel.h
index 598c70f..da75354 100644
--- a/SignalsPanel.h
+++ b/SignalsPanel.h
@@ -9,20 +9,13 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
-#include "Panel.h"
typedef struct SignalItem_ {
const char* name;
int number;
} SignalItem;
-typedef struct SignalsPanel_ {
- Panel super;
-} SignalsPanel;
-
-SignalsPanel* SignalsPanel_new(int x, int y, int w, int h);
-
-void SignalsPanel_reset(SignalsPanel* this);
+Panel* SignalsPanel_new();
#endif
diff --git a/String.c b/String.c
index 173932c..cbfd687 100644
--- a/String.c
+++ b/String.c
@@ -16,6 +16,7 @@ in the source distribution for its full text.
/*{
#define String_startsWith(s, match) (strstr((s), (match)) == (s))
+#define String_contains_i(s1, s2) (strcasestr(s1, s2) != NULL)
}*/
char* String_cat(const char* s1, const char* s2) {
@@ -67,7 +68,13 @@ char** String_split(const char* s, char sep, int* n) {
ctr++;
if (ctr == blocks) {
blocks += rate;
- out = (char**) realloc(out, sizeof(char*) * blocks);
+ char** newOut = (char**) realloc(out, sizeof(char*) * blocks);
+ if (newOut) {
+ out = newOut;
+ } else {
+ blocks -= rate;
+ break;
+ }
}
s += size + 1;
}
@@ -78,7 +85,10 @@ char** String_split(const char* s, char sep, int* n) {
out[ctr] = token;
ctr++;
}
- out = realloc(out, sizeof(char*) * (ctr + 1));
+ char** newOut = realloc(out, sizeof(char*) * (ctr + 1));
+ if (newOut) {
+ out = newOut;
+ }
out[ctr] = NULL;
*n = ctr;
return out;
@@ -91,17 +101,6 @@ void String_freeArray(char** s) {
free(s);
}
-int String_contains_i(const char* s, const char* match) {
- int lens = strlen(s);
- int lenmatch = strlen(match);
- for (int i = 0; i < lens-lenmatch; i++) {
- if (strncasecmp(s, match, strlen(match)) == 0)
- return 1;
- s++;
- }
- return 0;
-}
-
char* String_getToken(const char* line, const unsigned short int numMatch) {
const unsigned short int len = strlen(line);
char inWord = 0;
diff --git a/String.h b/String.h
index 0662aa1..cb7f1ac 100644
--- a/String.h
+++ b/String.h
@@ -10,6 +10,7 @@ in the source distribution for its full text.
*/
#define String_startsWith(s, match) (strstr((s), (match)) == (s))
+#define String_contains_i(s1, s2) (strcasestr(s1, s2) != NULL)
char* String_cat(const char* s1, const char* s2);
@@ -21,8 +22,6 @@ char** String_split(const char* s, char sep, int* n);
void String_freeArray(char** s);
-int String_contains_i(const char* s, const char* match);
-
char* String_getToken(const char* line, const unsigned short int numMatch);
#endif
diff --git a/SwapMeter.c b/SwapMeter.c
index 48a7dae..2cb86d5 100644
--- a/SwapMeter.c
+++ b/SwapMeter.c
@@ -11,7 +11,6 @@ in the source distribution for its full text.
#include "ProcessList.h"
#include <stdlib.h>
-#include <curses.h>
#include <string.h>
#include <math.h>
#include <sys/param.h>
@@ -31,18 +30,14 @@ int SwapMeter_attributes[] = {
/* NOTE: Value is in kilobytes */
static void SwapMeter_humanNumber(char* buffer, const long int* value) {
- if (*value >= 10*GIGABYTE)
- sprintf(buffer, "%ldG ", *value / GIGABYTE);
- else if (*value >= 10*MEGABYTE)
- sprintf(buffer, "%ldM ", *value / MEGABYTE);
- else
- sprintf(buffer, "%ldK ", *value);
+ sprintf(buffer, "%ldM ", *value / MEGABYTE);
}
static void SwapMeter_setValues(Meter* this, char* buffer, int len) {
long int usedSwap = this->pl->usedSwap;
this->total = this->pl->totalSwap;
this->values[0] = usedSwap;
+
snprintf(buffer, len, "%ld/%ldMB", (long int) usedSwap / MEGABYTE, (long int) this->total / MEGABYTE);
}
@@ -59,11 +54,14 @@ static void SwapMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_VALUE], buffer);
}
-MeterType SwapMeter = {
+MeterClass SwapMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = SwapMeter_display,
+ },
.setValues = SwapMeter_setValues,
- .display = SwapMeter_display,
- .mode = BAR_METERMODE,
- .items = 1,
+ .defaultMode = BAR_METERMODE,
.total = 100.0,
.attributes = SwapMeter_attributes,
.name = "Swap",
diff --git a/SwapMeter.h b/SwapMeter.h
index 5b5c940..bb46a38 100644
--- a/SwapMeter.h
+++ b/SwapMeter.h
@@ -18,6 +18,6 @@ in the source distribution for its full text.
extern int SwapMeter_attributes[];
/* NOTE: Value is in kilobytes */
-extern MeterType SwapMeter;
+extern MeterClass SwapMeter_class;
#endif
diff --git a/TasksMeter.c b/TasksMeter.c
index cfe0309..22a125e 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -55,11 +55,14 @@ static void TasksMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_TEXT], " running");
}
-MeterType TasksMeter = {
+MeterClass TasksMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete,
+ .display = TasksMeter_display,
+ },
.setValues = TasksMeter_setValues,
- .display = TasksMeter_display,
- .mode = TEXT_METERMODE,
- .items = 1,
+ .defaultMode = TEXT_METERMODE,
.total = 100.0,
.attributes = TasksMeter_attributes,
.name = "Tasks",
diff --git a/TasksMeter.h b/TasksMeter.h
index cc6a60a..a7a0db7 100644
--- a/TasksMeter.h
+++ b/TasksMeter.h
@@ -13,6 +13,6 @@ in the source distribution for its full text.
extern int TasksMeter_attributes[];
-extern MeterType TasksMeter;
+extern MeterClass TasksMeter_class;
#endif
diff --git a/TraceScreen.c b/TraceScreen.c
index c7250f6..5823022 100644
--- a/TraceScreen.c
+++ b/TraceScreen.c
@@ -10,6 +10,8 @@ in the source distribution for its full text.
#include "CRT.h"
#include "ProcessList.h"
#include "ListItem.h"
+#include "IncSet.h"
+#include "String.h"
#include <stdio.h>
#include <unistd.h>
@@ -30,39 +32,49 @@ in the source distribution for its full text.
typedef struct TraceScreen_ {
Process* process;
Panel* display;
- FunctionBar* bar;
bool tracing;
} TraceScreen;
}*/
-static const char* tsFunctions[] = {"AutoScroll ", "Stop Tracing ", "Done ", NULL};
+static const char* tsFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL};
-static const char* tsKeys[] = {"F4", "F5", "Esc"};
+static const char* tsKeys[] = {"F3", "F4", "F8", "F9", "Esc"};
-static int tsEvents[] = {KEY_F(4), KEY_F(5), 27};
+static int tsEvents[] = {KEY_F(3), KEY_F(4), KEY_F(8), KEY_F(9), 27};
TraceScreen* TraceScreen_new(Process* process) {
TraceScreen* this = (TraceScreen*) malloc(sizeof(TraceScreen));
this->process = process;
- this->display = Panel_new(0, 1, COLS, LINES-2, LISTITEM_CLASS, true, ListItem_compare);
- this->bar = FunctionBar_new(tsFunctions, tsKeys, tsEvents);
+ this->display = Panel_new(0, 1, COLS, LINES-2, false, Class(ListItem));
this->tracing = true;
return this;
}
void TraceScreen_delete(TraceScreen* this) {
Panel_delete((Object*)this->display);
- FunctionBar_delete((Object*)this->bar);
free(this);
}
-static void TraceScreen_draw(TraceScreen* this) {
+static void TraceScreen_draw(TraceScreen* this, IncSet* inc) {
attrset(CRT_colors[PANEL_HEADER_FOCUS]);
mvhline(0, 0, ' ', COLS);
mvprintw(0, 0, "Trace of process %d - %s", this->process->pid, this->process->comm);
attrset(CRT_colors[DEFAULT_COLOR]);
- FunctionBar_draw(this->bar, NULL);
+ IncSet_drawBar(inc);
+}
+
+static inline void addLine(const char* line, Vector* lines, Panel* panel, const char* incFilter) {
+ Vector_add(lines, (Object*) ListItem_new(line, 0));
+ if (!incFilter || String_contains_i(line, incFilter))
+ Panel_add(panel, (Object*)Vector_get(lines, Vector_size(lines)-1));
+}
+
+static inline void appendLine(const char* line, Vector* lines, Panel* panel, const char* incFilter) {
+ ListItem* last = (ListItem*)Vector_get(lines, Vector_size(lines)-1);
+ ListItem_append(last, line);
+ if (incFilter && Panel_get(panel, Panel_size(panel)-1) != (Object*)last && String_contains_i(line, incFilter))
+ Panel_add(panel, (Object*)last);
}
void TraceScreen_run(TraceScreen* this) {
@@ -75,9 +87,11 @@ void TraceScreen_run(TraceScreen* this) {
if (child == -1) return;
if (child == 0) {
dup2(fdpair[1], STDERR_FILENO);
- fcntl(fdpair[1], F_SETFL, O_NONBLOCK);
- sprintf(buffer, "%d", this->process->pid);
- execlp("strace", "strace", "-p", buffer, NULL);
+ int ok = fcntl(fdpair[1], F_SETFL, O_NONBLOCK);
+ if (ok != -1) {
+ sprintf(buffer, "%d", this->process->pid);
+ execlp("strace", "strace", "-p", buffer, NULL);
+ }
const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH.";
write(fdpair[1], message, strlen(message));
exit(1);
@@ -86,47 +100,63 @@ void TraceScreen_run(TraceScreen* this) {
FILE* strace = fdopen(fdpair[0], "r");
Panel* panel = this->display;
int fd_strace = fileno(strace);
- TraceScreen_draw(this);
CRT_disableDelay();
bool contLine = false;
bool follow = false;
bool looping = true;
+
+ FunctionBar* bar = FunctionBar_new(tsFunctions, tsKeys, tsEvents);
+ IncSet* inc = IncSet_new(bar);
+
+ Vector* lines = Vector_new(panel->items->type, true, DEFAULT_SIZE);
+
+ TraceScreen_draw(this, inc);
+
while (looping) {
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(fd_strace, &fds);
- struct timeval tv;
- tv.tv_sec = 0; tv.tv_usec = 500;
- int ready = select(fd_strace+1, &fds, NULL, NULL, &tv);
- int nread = 0;
- if (ready > 0)
- nread = fread(buffer, 1, 1000, strace);
- if (nread && this->tracing) {
- char* line = buffer;
- buffer[nread] = '\0';
- for (int i = 0; i < nread; i++) {
- if (buffer[i] == '\n') {
- buffer[i] = '\0';
- if (contLine) {
- ListItem_append((ListItem*)Panel_get(panel,
- Panel_size(panel)-1), line);
- contLine = false;
- } else {
- Panel_add(panel, (Object*) ListItem_new(line, 0));
+
+ Panel_draw(panel, true);
+ const char* incFilter = IncSet_filter(inc);
+
+ if (inc->active)
+ move(LINES-1, CRT_cursorX);
+ int ch = getch();
+
+ if (ch == ERR) {
+ fd_set fds;
+ FD_ZERO(&fds);
+// FD_SET(STDIN_FILENO, &fds);
+ FD_SET(fd_strace, &fds);
+ struct timeval tv;
+ tv.tv_sec = 0; tv.tv_usec = 500;
+ int ready = select(fd_strace+1, &fds, NULL, NULL, &tv);
+ int nread = 0;
+ if (ready > 0 && FD_ISSET(fd_strace, &fds))
+ nread = fread(buffer, 1, 1000, strace);
+ if (nread && this->tracing) {
+ char* line = buffer;
+ buffer[nread] = '\0';
+ for (int i = 0; i < nread; i++) {
+ if (buffer[i] == '\n') {
+ buffer[i] = '\0';
+ if (contLine) {
+ appendLine(line, lines, panel, incFilter);
+ contLine = false;
+ } else {
+ addLine(line, lines, panel, incFilter);
+ }
+ line = buffer+i+1;
}
- line = buffer+i+1;
}
+ if (line < buffer+nread) {
+ addLine(line, lines, panel, incFilter);
+ buffer[nread] = '\0';
+ contLine = true;
+ }
+ if (follow)
+ Panel_setSelected(panel, Panel_size(panel)-1);
}
- if (line < buffer+nread) {
- Panel_add(panel, (Object*) ListItem_new(line, 0));
- buffer[nread] = '\0';
- contLine = true;
- }
- if (follow)
- Panel_setSelected(panel, Panel_size(panel)-1);
- Panel_draw(panel, true);
}
- int ch = getch();
+
if (ch == KEY_MOUSE) {
MEVENT mevent;
int ok = getmouse(&mevent);
@@ -136,28 +166,43 @@ void TraceScreen_run(TraceScreen* this) {
follow = false;
ch = 0;
} if (mevent.y == LINES - 1)
- ch = FunctionBar_synthesizeEvent(this->bar, mevent.x);
+ ch = FunctionBar_synthesizeEvent(inc->bar, mevent.x);
}
+
+ if (inc->active) {
+ IncSet_handleKey(inc, ch, panel, IncSet_getListItemValue, lines);
+ continue;
+ }
+
switch(ch) {
case ERR:
continue;
- case KEY_F(5):
- this->tracing = !this->tracing;
- FunctionBar_setLabel(this->bar, KEY_F(5), this->tracing?"Stop Tracing ":"Resume Tracing ");
- TraceScreen_draw(this);
- break;
case KEY_HOME:
Panel_setSelected(panel, 0);
break;
case KEY_END:
Panel_setSelected(panel, Panel_size(panel)-1);
break;
- case 'f':
+ case KEY_F(3):
+ case '/':
+ IncSet_activate(inc, INC_SEARCH);
+ break;
case KEY_F(4):
+ case '\\':
+ IncSet_activate(inc, INC_FILTER);
+ break;
+ case 'f':
+ case KEY_F(8):
follow = !follow;
if (follow)
Panel_setSelected(panel, Panel_size(panel)-1);
break;
+ case 't':
+ case KEY_F(9):
+ this->tracing = !this->tracing;
+ FunctionBar_setLabel(bar, KEY_F(9), this->tracing?"Stop Tracing ":"Resume Tracing ");
+ TraceScreen_draw(this, inc);
+ break;
case 'q':
case 27:
case KEY_F(10):
@@ -165,14 +210,18 @@ void TraceScreen_run(TraceScreen* this) {
break;
case KEY_RESIZE:
Panel_resize(panel, COLS, LINES-2);
- TraceScreen_draw(this);
+ TraceScreen_draw(this, inc);
break;
default:
follow = false;
Panel_onKey(panel, ch);
}
- Panel_draw(panel, true);
}
+
+ IncSet_delete(inc);
+ FunctionBar_delete((Object*)bar);
+ Vector_delete(lines);
+
kill(child, SIGTERM);
waitpid(child, NULL, 0);
fclose(strace);
diff --git a/TraceScreen.h b/TraceScreen.h
index 62fb67a..03d1856 100644
--- a/TraceScreen.h
+++ b/TraceScreen.h
@@ -16,7 +16,6 @@ in the source distribution for its full text.
typedef struct TraceScreen_ {
Process* process;
Panel* display;
- FunctionBar* bar;
bool tracing;
} TraceScreen;
diff --git a/UptimeMeter.c b/UptimeMeter.c
index d31f911..9e28817 100644
--- a/UptimeMeter.c
+++ b/UptimeMeter.c
@@ -49,11 +49,13 @@ static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
snprintf(buffer, len, "%s%02d:%02d:%02d", daysbuf, hours, minutes, seconds);
}
-MeterType UptimeMeter = {
+MeterClass UptimeMeter_class = {
+ .super = {
+ .extends = Class(Meter),
+ .delete = Meter_delete
+ },
.setValues = UptimeMeter_setValues,
- .display = NULL,
- .mode = TEXT_METERMODE,
- .items = 1,
+ .defaultMode = TEXT_METERMODE,
.total = 100.0,
.attributes = UptimeMeter_attributes,
.name = "Uptime",
diff --git a/UptimeMeter.h b/UptimeMeter.h
index 78814de..fe0bbba 100644
--- a/UptimeMeter.h
+++ b/UptimeMeter.h
@@ -13,6 +13,6 @@ in the source distribution for its full text.
extern int UptimeMeter_attributes[];
-extern MeterType UptimeMeter;
+extern MeterClass UptimeMeter_class;
#endif
diff --git a/Vector.c b/Vector.c
index 955d99c..f3212f8 100644
--- a/Vector.c
+++ b/Vector.c
@@ -23,17 +23,16 @@ in the source distribution for its full text.
typedef struct Vector_ {
Object **array;
- Object_Compare compare;
+ ObjectClass* type;
int arraySize;
int growthRate;
int items;
- char* vectorType;
bool owner;
} Vector;
}*/
-Vector* Vector_new(char* vectorType_, bool owner, int size, Object_Compare compare) {
+Vector* Vector_new(ObjectClass* type, bool owner, int size) {
Vector* this;
if (size == DEFAULT_SIZE)
@@ -43,9 +42,8 @@ Vector* Vector_new(char* vectorType_, bool owner, int size, Object_Compare compa
this->array = (Object**) calloc(size, sizeof(Object*));
this->arraySize = size;
this->items = 0;
- this->vectorType = vectorType_;
+ this->type = type;
this->owner = owner;
- this->compare = compare;
return this;
}
@@ -53,7 +51,7 @@ void Vector_delete(Vector* this) {
if (this->owner) {
for (int i = 0; i < this->items; i++)
if (this->array[i])
- (this->array[i])->delete(this->array[i]);
+ Object_delete(this->array[i]);
}
free(this->array);
free(this);
@@ -65,7 +63,7 @@ static inline bool Vector_isConsistent(Vector* this) {
assert(this->items <= this->arraySize);
if (this->owner) {
for (int i = 0; i < this->items; i++)
- if (this->array[i] && this->array[i]->class != this->vectorType)
+ if (this->array[i] && !Object_isA(this->array[i], this->type))
return false;
return true;
} else {
@@ -87,14 +85,13 @@ int Vector_count(Vector* this) {
void Vector_prune(Vector* this) {
assert(Vector_isConsistent(this));
- int i;
-
- for (i = 0; i < this->items; i++)
- if (this->array[i]) {
- if (this->owner)
- (this->array[i])->delete(this->array[i]);
- this->array[i] = NULL;
- }
+ if (this->owner) {
+ for (int i = 0; i < this->items; i++)
+ if (this->array[i]) {
+ Object_delete(this->array[i]);
+ //this->array[i] = NULL;
+ }
+ }
this->items = 0;
}
@@ -163,42 +160,41 @@ static void insertionSort(Object** array, int left, int right, Object_Compare co
}
void Vector_quickSort(Vector* this) {
- assert(this->compare);
+ assert(this->type->compare);
assert(Vector_isConsistent(this));
- Object_Compare compare = this->compare;
- quickSort(this->array, 0, this->items - 1, compare);
+ quickSort(this->array, 0, this->items - 1, this->type->compare);
assert(Vector_isConsistent(this));
}
void Vector_insertionSort(Vector* this) {
- assert(this->compare);
+ assert(this->type->compare);
assert(Vector_isConsistent(this));
- Object_Compare compare = this->compare;
- insertionSort(this->array, 0, this->items - 1, compare);
+ insertionSort(this->array, 0, this->items - 1, this->type->compare);
assert(Vector_isConsistent(this));
}
static void Vector_checkArraySize(Vector* this) {
assert(Vector_isConsistent(this));
if (this->items >= this->arraySize) {
- int i;
- i = this->arraySize;
+ //int i;
+ //i = this->arraySize;
this->arraySize = this->items + this->growthRate;
this->array = (Object**) realloc(this->array, sizeof(Object*) * this->arraySize);
- for (; i < this->arraySize; i++)
- this->array[i] = NULL;
+ //for (; i < this->arraySize; i++)
+ // this->array[i] = NULL;
}
assert(Vector_isConsistent(this));
}
void Vector_insert(Vector* this, int idx, void* data_) {
- assert(idx >= 0);
- assert(((Object*)data_)->class == this->vectorType);
Object* data = data_;
+ assert(idx >= 0);
+ assert(idx <= this->items);
+ assert(Object_isA(data, this->type));
assert(Vector_isConsistent(this));
Vector_checkArraySize(this);
- assert(this->array[this->items] == NULL);
+ //assert(this->array[this->items] == NULL);
for (int i = this->items; i > idx; i--) {
this->array[i] = this->array[i-1];
}
@@ -211,11 +207,11 @@ Object* Vector_take(Vector* this, int idx) {
assert(idx >= 0 && idx < this->items);
assert(Vector_isConsistent(this));
Object* removed = this->array[idx];
- assert (removed != NULL);
+ //assert (removed != NULL);
this->items--;
for (int i = idx; i < this->items; i++)
this->array[i] = this->array[i+1];
- this->array[this->items] = NULL;
+ //this->array[this->items] = NULL;
assert(Vector_isConsistent(this));
return removed;
}
@@ -223,7 +219,7 @@ Object* Vector_take(Vector* this, int idx) {
Object* Vector_remove(Vector* this, int idx) {
Object* removed = Vector_take(this, idx);
if (this->owner) {
- removed->delete(removed);
+ Object_delete(removed);
return NULL;
} else
return removed;
@@ -250,9 +246,9 @@ void Vector_moveDown(Vector* this, int idx) {
}
void Vector_set(Vector* this, int idx, void* data_) {
- assert(idx >= 0);
- assert(((Object*)data_)->class == this->vectorType);
Object* data = data_;
+ assert(idx >= 0);
+ assert(Object_isA((Object*)data, this->type));
assert(Vector_isConsistent(this));
Vector_checkArraySize(this);
@@ -263,7 +259,7 @@ void Vector_set(Vector* this, int idx, void* data_) {
Object* removed = this->array[idx];
assert (removed != NULL);
if (this->owner) {
- removed->delete(removed);
+ Object_delete(removed);
}
}
}
@@ -306,8 +302,8 @@ static void Vector_merge(Vector* this, Vector* v2) {
*/
void Vector_add(Vector* this, void* data_) {
- assert(data_ && ((Object*)data_)->class == this->vectorType);
Object* data = data_;
+ assert(Object_isA((Object*)data, this->type));
assert(Vector_isConsistent(this));
int i = this->items;
Vector_set(this, this->items, data);
@@ -316,13 +312,14 @@ void Vector_add(Vector* this, void* data_) {
}
inline int Vector_indexOf(Vector* this, void* search_, Object_Compare compare) {
- assert(((Object*)search_)->class == this->vectorType);
- assert(this->compare);
Object* search = search_;
+ assert(Object_isA((Object*)search, this->type));
+ assert(compare);
assert(Vector_isConsistent(this));
for (int i = 0; i < this->items; i++) {
Object* o = (Object*)this->array[i];
- if (o && compare(search, o) == 0)
+ assert(o);
+ if (compare(search, o) == 0)
return i;
}
return -1;
diff --git a/Vector.h b/Vector.h
index 24e2976..9b28477 100644
--- a/Vector.h
+++ b/Vector.h
@@ -19,16 +19,15 @@ in the source distribution for its full text.
typedef struct Vector_ {
Object **array;
- Object_Compare compare;
+ ObjectClass* type;
int arraySize;
int growthRate;
int items;
- char* vectorType;
bool owner;
} Vector;
-Vector* Vector_new(char* vectorType_, bool owner, int size, Object_Compare compare);
+Vector* Vector_new(ObjectClass* type, bool owner, int size);
void Vector_delete(Vector* this);
diff --git a/aclocal.m4 b/aclocal.m4
index c4d5430..ea25f92 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
-[m4_warning([this file was generated for autoconf 2.65.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
diff --git a/compile b/compile
index 1b1d232..c0096a7 100755
--- a/compile
+++ b/compile
@@ -1,9 +1,10 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
-scriptversion=2005-05-14.22
+scriptversion=2009-10-06.20; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
+# Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -17,8 +18,7 @@ scriptversion=2005-05-14.22
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -103,13 +103,13 @@ if test -z "$ofile" || test -z "$cfile"; then
fi
# Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
-# Note: use `[/.-]' here to ensure that we don't use the same name
+# Note: use `[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
-lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
@@ -124,9 +124,9 @@ trap "rmdir '$lockdir'; exit 1" 1 2 15
ret=$?
if test -f "$cofile"; then
- mv "$cofile" "$ofile"
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
- mv "${cofile}bj" "$ofile"
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
@@ -138,5 +138,6 @@ exit $ret
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/config.guess b/config.guess
index 7b24a87..dc84c68 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2008-11-15'
+timestamp='2009-11-20'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2008-11-15'
# the same distribution terms that you use for the rest of that program.
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner. Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
+ | grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -324,12 +324,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
@@ -337,7 +343,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if echo '\n#ifdef __amd64\nIS_64BIT_ARCH\n#endif' | \
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
@@ -653,7 +659,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
+ grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -804,12 +810,12 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
- *:Interix*:[3456]*)
+ *:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
- EM64T | authenticamd | genuineintel)
+ authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -819,6 +825,9 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -848,6 +857,20 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -870,6 +893,17 @@ EOF
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit ;;
+ i*86:Linux:*:*)
+ LIBC=gnu
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
@@ -879,78 +913,34 @@ EOF
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- mips:Linux:*:*)
+ mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
- #undef mips
- #undef mipsel
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
+ CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
+ CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -959,8 +949,11 @@ EOF
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
@@ -983,66 +976,6 @@ EOF
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^LIBC/{
- s: ::g
- p
- }'`"
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -1071,7 +1004,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1115,8 +1048,11 @@ EOF
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
@@ -1154,6 +1090,16 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1166,7 +1112,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1259,6 +1205,16 @@ EOF
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
+ i386)
+ eval $set_cc_for_build
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ UNAME_PROCESSOR="x86_64"
+ fi
+ fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1340,6 +1296,9 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
diff --git a/config.h b/config.h
index 9852b8c..03f7ffb 100644
--- a/config.h
+++ b/config.h
@@ -11,7 +11,7 @@
/* #undef HAVE_CGROUP */
/* Define to 1 if you have the <curses.h> header file. */
-#define HAVE_CURSES_H 1
+/* #undef HAVE_CURSES_H */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
@@ -53,6 +53,9 @@
/* Define to 1 if you have the <ncursesw/curses.h> header file. */
#define HAVE_NCURSESW_CURSES_H 1
+/* Define to 1 if you have the <ncurses/curses.h> header file. */
+/* #undef HAVE_NCURSES_CURSES_H */
+
/* Define to 1 if you have the <ncurses.h> header file. */
/* #undef HAVE_NCURSES_H */
@@ -62,6 +65,9 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
+/* Define if OOM score support enabled. */
+/* #undef HAVE_OOM */
+
/* Define if openvz support enabled. */
/* #undef HAVE_OPENVZ */
@@ -140,13 +146,13 @@
#define PACKAGE "htop"
/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "loderunner@users.sourceforge.net"
+#define PACKAGE_BUGREPORT "hisham@gobolinux.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "htop"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "htop 1.0.2"
+#define PACKAGE_STRING "htop 1.0.3"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "htop"
@@ -155,7 +161,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.0.2"
+#define PACKAGE_VERSION "1.0.3"
/* Path of proc filesystem */
#define PROCDIR "/proc"
@@ -189,7 +195,7 @@
/* Version number of package */
-#define VERSION "1.0.2"
+#define VERSION "1.0.3"
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
diff --git a/config.h.in b/config.h.in
index 2408911..24d0423 100644
--- a/config.h.in
+++ b/config.h.in
@@ -52,6 +52,9 @@
/* Define to 1 if you have the <ncursesw/curses.h> header file. */
#undef HAVE_NCURSESW_CURSES_H
+/* Define to 1 if you have the <ncurses/curses.h> header file. */
+#undef HAVE_NCURSES_CURSES_H
+
/* Define to 1 if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H
@@ -61,6 +64,9 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
+/* Define if OOM score support enabled. */
+#undef HAVE_OOM
+
/* Define if openvz support enabled. */
#undef HAVE_OPENVZ
diff --git a/config.sub b/config.sub
index 053e738..2a55a50 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2008-09-08'
+timestamp='2009-11-20'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2008-09-08'
# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
@@ -122,6 +125,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -148,10 +152,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray)
+ -apple | -axis | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
+ -bluegene*)
+ os=-cnk
+ ;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -249,6 +256,7 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
@@ -270,6 +278,7 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | moxie \
| mt \
| msp430 \
| nios | nios2 \
@@ -278,20 +287,22 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
+ | rx \
| score \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
+ | ubicom32 \
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12)
+ m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
@@ -331,9 +342,10 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -361,8 +373,8 @@ case $basic_machine in
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
@@ -370,6 +382,7 @@ case $basic_machine in
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
+ | ubicom32-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
@@ -443,6 +456,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -459,6 +476,10 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
c90)
basic_machine=c90-cray
os=-unicos
@@ -711,6 +732,9 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
+ microblaze)
+ basic_machine=microblaze-xilinx
+ ;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -1182,7 +1206,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1232,6 +1256,9 @@ case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1252,10 +1279,11 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
+ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1274,7 +1302,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1604,7 +1632,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
- -aix*)
+ -cnk*|-aix*)
vendor=ibm
;;
-beos*)
diff --git a/configure b/configure
index 7d910e1..ed8d76e 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,11 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for htop 1.0.2.
+# Generated by GNU Autoconf 2.69 for htop 1.0.3.
#
-# Report bugs to <loderunner@users.sourceforge.net>.
+# Report bugs to <hisham@gobolinux.org>.
#
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -91,6 +89,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -135,6 +134,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -168,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -221,14 +246,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
- # We cannot yet assume a decent shell, so we have to provide a
- # neutralization value for shells without unset; and this also
- # works around shells that cannot unset nonexistent variables.
- BASH_ENV=/dev/null
- ENV=/dev/null
- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
if test x$as_have_required = xno; then :
@@ -239,10 +275,10 @@ fi
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org and
-$0: loderunner@users.sourceforge.net about your system,
-$0: including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
+$0: hisham@gobolinux.org about your system, including any
+$0: error possibly output before this message. Then install
+$0: a modern shell, or manually run the script under such a
+$0: shell if you do have one."
fi
exit 1
fi
@@ -327,10 +363,18 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -367,19 +411,19 @@ else
fi # as_fn_arith
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
- $as_echo "$as_me: error: $1" >&2
+ $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
@@ -452,6 +496,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -486,16 +534,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -507,28 +555,8 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -543,7 +571,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
@@ -562,9 +590,9 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='htop'
PACKAGE_TARNAME='htop'
-PACKAGE_VERSION='1.0.2'
-PACKAGE_STRING='htop 1.0.2'
-PACKAGE_BUGREPORT='loderunner@users.sourceforge.net'
+PACKAGE_VERSION='1.0.3'
+PACKAGE_STRING='htop 1.0.3'
+PACKAGE_BUGREPORT='hisham@gobolinux.org'
PACKAGE_URL=''
# Factoring default headers for most tests.
@@ -735,6 +763,7 @@ enable_taskstats
enable_unicode
enable_native_affinity
enable_hwloc
+enable_oom
'
ac_precious_vars='build_alias
host_alias
@@ -807,8 +836,9 @@ do
fi
case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -853,7 +883,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
+ as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -879,7 +909,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
+ as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1083,7 +1113,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
+ as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1099,7 +1129,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
+ as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1129,8 +1159,8 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) as_fn_error "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information."
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
;;
*=*)
@@ -1138,7 +1168,7 @@ Try \`$0 --help' for more information."
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
- as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
@@ -1148,7 +1178,7 @@ Try \`$0 --help' for more information."
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -1156,13 +1186,13 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- as_fn_error "missing argument to $ac_option"
+ as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
- fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
@@ -1185,7 +1215,7 @@ do
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
- as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1199,8 +1229,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1215,9 +1243,9 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- as_fn_error "working directory cannot be determined"
+ as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- as_fn_error "pwd does not report name of working directory"
+ as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
@@ -1256,11 +1284,11 @@ else
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1286,7 +1314,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures htop 1.0.2 to adapt to many kinds of systems.
+\`configure' configures htop 1.0.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1300,7 +1328,7 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
+ -q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
@@ -1357,7 +1385,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of htop 1.0.2:";;
+ short | recursive ) echo "Configuration of htop 1.0.3:";;
esac
cat <<\_ACEOF
@@ -1386,6 +1414,7 @@ Optional Features:
sched_getaffinity for affinity support, disables
hwloc
--enable-hwloc enable hwloc support for CPU affinity
+ --enable-oom enable OOM score reporting
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1408,7 +1437,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to <loderunner@users.sourceforge.net>.
+Report bugs to <hisham@gobolinux.org>.
_ACEOF
ac_status=$?
fi
@@ -1471,10 +1500,10 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-htop configure 1.0.2
-generated by GNU Autoconf 2.65
+htop configure 1.0.3
+generated by GNU Autoconf 2.69
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1518,7 +1547,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -1544,7 +1573,7 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
+ test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
@@ -1555,7 +1584,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -1568,10 +1597,10 @@ fi
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
@@ -1607,7 +1636,7 @@ if ac_fn_c_try_cpp "$LINENO"; then :
else
ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
@@ -1630,17 +1659,15 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( cat <<\_ASBOX
-## ----------------------------------------------- ##
-## Report this to loderunner@users.sourceforge.net ##
-## ----------------------------------------------- ##
-_ASBOX
+( $as_echo "## ----------------------------------- ##
+## Report this to hisham@gobolinux.org ##
+## ----------------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
@@ -1649,7 +1676,7 @@ eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
@@ -1690,7 +1717,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
@@ -1704,7 +1731,7 @@ ac_fn_c_check_header_compile ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1722,7 +1749,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
@@ -1753,7 +1780,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
+ test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -1767,7 +1794,7 @@ fi
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
@@ -1780,7 +1807,7 @@ ac_fn_c_check_func ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1835,7 +1862,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
@@ -1848,7 +1875,7 @@ ac_fn_c_check_type ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
@@ -1889,15 +1916,15 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by htop $as_me 1.0.2, which was
-generated by GNU Autoconf 2.65. Invocation command line was
+It was created by htop $as_me 1.0.3, which was
+generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2007,11 +2034,9 @@ trap 'exit_status=$?
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ $as_echo "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
@@ -2045,11 +2070,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ $as_echo "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
@@ -2062,11 +2085,9 @@ _ASBOX
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
+ $as_echo "## ------------------- ##
## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
@@ -2080,11 +2101,9 @@ _ASBOX
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ $as_echo "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
cat confdefs.h
echo
@@ -2139,7 +2158,12 @@ _ACEOF
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
- ac_site_file1=$CONFIG_SITE
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
@@ -2154,7 +2178,11 @@ do
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
@@ -2230,7 +2258,7 @@ if $ac_cache_corrupted; then
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
@@ -2255,7 +2283,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2267,7 +2295,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2295,7 +2323,7 @@ if test -z "$ac_cv_prog_CC"; then
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -2307,7 +2335,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2348,7 +2376,7 @@ if test -z "$CC"; then
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2360,7 +2388,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2388,7 +2416,7 @@ if test -z "$CC"; then
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2401,7 +2429,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -2447,7 +2475,7 @@ if test -z "$CC"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2459,7 +2487,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2491,7 +2519,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -2503,7 +2531,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2545,8 +2573,8 @@ fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "no acceptable C compiler found in \$PATH
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -2660,9 +2688,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "C compiler cannot create executables
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -2704,8 +2731,8 @@ done
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -2762,9 +2789,9 @@ $as_echo "$ac_try_echo"; } >&5
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
+as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
@@ -2775,7 +2802,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2815,8 +2842,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
@@ -2826,7 +2853,7 @@ OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2863,7 +2890,7 @@ ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
@@ -2941,7 +2968,7 @@ else
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
@@ -2950,8 +2977,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3049,7 +3075,7 @@ if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then :
+ if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
@@ -3079,7 +3105,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -3095,11 +3121,11 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -3138,7 +3164,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -3154,18 +3180,18 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
@@ -3177,7 +3203,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
@@ -3191,7 +3217,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -3226,7 +3252,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
- as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
@@ -3240,7 +3266,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -3257,7 +3283,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -3292,7 +3318,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
- as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
@@ -3307,7 +3333,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3424,8 +3450,7 @@ do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -3437,7 +3462,7 @@ done
ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
-if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+if test "x$ac_cv_header_minix_config_h" = xyes; then :
MINIX=yes
else
MINIX=
@@ -3459,14 +3484,14 @@ $as_echo "#define _MINIX 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
+if ${ac_cv_safe_to_define___extensions__+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-# define __EXTENSIONS__ 1
- $ac_includes_default
+# define __EXTENSIONS__ 1
+ $ac_includes_default
int
main ()
{
@@ -3498,16 +3523,22 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
- for ac_t in install-sh install.sh shtool; do
- if test -f "$ac_dir/$ac_t"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/$ac_t -c"
- break 2
- fi
- done
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
done
if test -z "$ac_aux_dir"; then
- as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -3521,27 +3552,27 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
- as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -3559,14 +3590,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
@@ -3574,7 +3605,7 @@ fi
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -3592,14 +3623,14 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
$as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; then :
+if ${ac_cv_target+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$target_alias" = x; then
ac_cv_target=$ac_cv_host
else
ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
fi
fi
@@ -3607,7 +3638,7 @@ fi
$as_echo "$ac_cv_target" >&6; }
case $ac_cv_target in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
esac
target=$ac_cv_target
ac_save_IFS=$IFS; IFS='-'
@@ -3649,7 +3680,7 @@ am__api_version='1.11'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -3669,7 +3700,7 @@ case $as_dir/ in #((
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -3736,11 +3767,11 @@ am_lf='
'
case `pwd` in
*[\\\"\#\$\&\'\`$am_lf]*)
- as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
esac
# Do `set' in a subshell so we don't clobber the current shell's
@@ -3762,7 +3793,7 @@ if (
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
- as_fn_error "ls -t appears to fail. Make sure there is not a broken
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
alias in your environment" "$LINENO" 5
fi
@@ -3772,7 +3803,7 @@ then
# Ok.
:
else
- as_fn_error "newly created file is older than distributed files!
+ as_fn_error $? "newly created file is older than distributed files!
Check your system clock" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -3826,7 +3857,7 @@ if test "$cross_compiling" != no; then
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
@@ -3838,7 +3869,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3866,7 +3897,7 @@ if test -z "$ac_cv_prog_STRIP"; then
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
@@ -3878,7 +3909,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3919,7 +3950,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
- if test "${ac_cv_path_mkdir+set}" = set; then :
+ if ${ac_cv_path_mkdir+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -3929,7 +3960,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
- { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
@@ -3970,7 +4001,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
@@ -3982,7 +4013,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4010,7 +4041,7 @@ done
$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
$as_echo_n "(cached) " >&6
else
cat >conftest.make <<\_ACEOF
@@ -4018,7 +4049,7 @@ SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -4114,7 +4145,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
am__isrc=' -I$(srcdir)'
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
- as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
fi
fi
@@ -4130,7 +4161,7 @@ fi
# Define the identity of the package.
PACKAGE='htop'
- VERSION='1.0.2'
+ VERSION='1.0.3'
cat >>confdefs.h <<_ACEOF
@@ -4173,7 +4204,7 @@ depcc="$CC" am_compiler_list=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
$as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4313,7 +4344,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -4325,7 +4356,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4353,7 +4384,7 @@ if test -z "$ac_cv_prog_CC"; then
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -4365,7 +4396,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4406,7 +4437,7 @@ if test -z "$CC"; then
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -4418,7 +4449,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4446,7 +4477,7 @@ if test -z "$CC"; then
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -4459,7 +4490,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -4505,7 +4536,7 @@ if test -z "$CC"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -4517,7 +4548,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4549,7 +4580,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -4561,7 +4592,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4603,8 +4634,8 @@ fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "no acceptable C compiler found in \$PATH
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -4633,7 +4664,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4670,7 +4701,7 @@ ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
@@ -4748,7 +4779,7 @@ else
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
@@ -4757,8 +4788,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4852,7 +4882,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
fi
set dummy $CC; ac_cc=`$as_echo "$2" |
sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5128,7 +5158,7 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -5148,7 +5178,7 @@ do
for ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+ as_fn_executable_p "$ac_path_SED" || continue
# Check for GNU ac_path_SED and select it if it is found.
# Check for GNU $ac_path_SED
case `"$ac_path_SED" --version 2>&1` in
@@ -5183,7 +5213,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_SED"; then
- as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
fi
else
ac_cv_path_SED=$SED
@@ -5210,7 +5240,7 @@ Xsed="$SED -e 1s/^X//"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
$as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then :
+if ${ac_cv_path_FGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -5227,7 +5257,7 @@ do
for ac_prog in fgrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+ as_fn_executable_p "$ac_path_FGREP" || continue
# Check for GNU ac_path_FGREP and select it if it is found.
# Check for GNU $ac_path_FGREP
case `"$ac_path_FGREP" --version 2>&1` in
@@ -5262,7 +5292,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_FGREP"; then
- as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_FGREP=$FGREP
@@ -5341,7 +5371,7 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
$as_echo_n "checking for non-GNU ld... " >&6; }
fi
-if test "${lt_cv_path_LD+set}" = set; then :
+if ${lt_cv_path_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$LD"; then
@@ -5378,10 +5408,10 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
-test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+if ${lt_cv_prog_gnu_ld+:} false; then :
$as_echo_n "(cached) " >&6
else
# I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -5408,7 +5438,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then :
+if ${lt_cv_path_NM+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$NM"; then
@@ -5471,7 +5501,7 @@ else
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_DUMPBIN+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$DUMPBIN"; then
@@ -5483,7 +5513,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5515,7 +5545,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_DUMPBIN"; then
@@ -5527,7 +5557,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5587,7 +5617,7 @@ test -z "$NM" && NM=nm
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then :
+if ${lt_cv_nm_interface+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_nm_interface="BSD nm"
@@ -5622,7 +5652,7 @@ fi
# find the maximum length of command line arguments
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
$as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+if ${lt_cv_sys_max_cmd_len+:} false; then :
$as_echo_n "(cached) " >&6
else
i=0
@@ -5819,7 +5849,7 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
$as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then :
+if ${lt_cv_ld_reload_flag+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_ld_reload_flag='-r'
@@ -5855,7 +5885,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}objdump; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_OBJDUMP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJDUMP"; then
@@ -5867,7 +5897,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5895,7 +5925,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then
set dummy objdump; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJDUMP"; then
@@ -5907,7 +5937,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJDUMP="objdump"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5954,7 +5984,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
$as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then :
+if ${lt_cv_deplibs_check_method+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -6176,7 +6206,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AR"; then
@@ -6188,7 +6218,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6216,7 +6246,7 @@ if test -z "$ac_cv_prog_AR"; then
set dummy ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AR"; then
@@ -6228,7 +6258,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6281,7 +6311,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
@@ -6293,7 +6323,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6321,7 +6351,7 @@ if test -z "$ac_cv_prog_STRIP"; then
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
@@ -6333,7 +6363,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6380,7 +6410,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$RANLIB"; then
@@ -6392,7 +6422,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6420,7 +6450,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
set dummy ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_RANLIB"; then
@@ -6432,7 +6462,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6549,7 +6579,7 @@ compiler=$CC
# Check for command to grab the raw symbol name followed by C symbol from nm.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -6920,7 +6950,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
CFLAGS="$CFLAGS -belf"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then :
+if ${lt_cv_cc_needs_belf+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_ext=c
@@ -6996,7 +7026,7 @@ need_locks="$enable_libtool_lock"
set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$DSYMUTIL"; then
@@ -7008,7 +7038,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7036,7 +7066,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
set dummy dsymutil; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_DSYMUTIL"; then
@@ -7048,7 +7078,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7088,7 +7118,7 @@ fi
set dummy ${ac_tool_prefix}nmedit; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_NMEDIT+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$NMEDIT"; then
@@ -7100,7 +7130,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7128,7 +7158,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then
set dummy nmedit; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_NMEDIT"; then
@@ -7140,7 +7170,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_NMEDIT="nmedit"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7180,7 +7210,7 @@ fi
set dummy ${ac_tool_prefix}lipo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then :
+if ${ac_cv_prog_LIPO+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$LIPO"; then
@@ -7192,7 +7222,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7220,7 +7250,7 @@ if test -z "$ac_cv_prog_LIPO"; then
set dummy lipo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_LIPO"; then
@@ -7232,7 +7262,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_LIPO="lipo"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7272,7 +7302,7 @@ fi
set dummy ${ac_tool_prefix}otool; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then :
+if ${ac_cv_prog_OTOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OTOOL"; then
@@ -7284,7 +7314,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7312,7 +7342,7 @@ if test -z "$ac_cv_prog_OTOOL"; then
set dummy otool; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OTOOL"; then
@@ -7324,7 +7354,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OTOOL="otool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7364,7 +7394,7 @@ fi
set dummy ${ac_tool_prefix}otool64; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_OTOOL64+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OTOOL64"; then
@@ -7376,7 +7406,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7404,7 +7434,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then
set dummy otool64; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OTOOL64"; then
@@ -7416,7 +7446,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OTOOL64="otool64"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7479,7 +7509,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
$as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+if ${lt_cv_apple_cc_single_mod+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_apple_cc_single_mod=no
@@ -7508,7 +7538,7 @@ fi
$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_ld_exported_symbols_list=no
@@ -7540,7 +7570,7 @@ fi
$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
$as_echo_n "checking for -force_load linker flag... " >&6; }
-if test "${lt_cv_ld_force_load+set}" = set; then :
+if ${lt_cv_ld_force_load+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_ld_force_load=no
@@ -7609,7 +7639,7 @@ for ac_header in dlfcn.h
do :
ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
"
-if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_DLFCN_H 1
_ACEOF
@@ -7736,7 +7766,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
$as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then :
+if ${lt_cv_objdir+:} false; then :
$as_echo_n "(cached) " >&6
else
rm -f .libs 2>/dev/null
@@ -7814,7 +7844,7 @@ file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MAGIC_CMD in
@@ -7880,7 +7910,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
$as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MAGIC_CMD in
@@ -8022,7 +8052,7 @@ if test "$GCC" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_rtti_exceptions=no
@@ -8374,7 +8404,7 @@ $as_echo "$lt_prog_compiler_pic" >&6; }
if test -n "$lt_prog_compiler_pic"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_pic_works=no
@@ -8433,7 +8463,7 @@ fi
wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+if ${lt_cv_prog_compiler_static_works+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_static_works=no
@@ -8476,7 +8506,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_c_o=no
@@ -8531,7 +8561,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+if ${lt_cv_prog_compiler_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_c_o=no
@@ -9351,7 +9381,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
# (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
$as_echo_n "checking if $CC understands -b... " >&6; }
-if test "${lt_cv_prog_compiler__b+set}" = set; then :
+if ${lt_cv_prog_compiler__b+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler__b=no
@@ -9723,7 +9753,7 @@ x|xyes)
# to ld, don't add -lc before -lgcc.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-if test "${lt_cv_archive_cmds_need_lc+set}" = set; then :
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
$as_echo_n "(cached) " >&6
else
$RM conftest*
@@ -10365,7 +10395,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
shlibpath_overrides_runpath=no
# Some binutils ld are patched to set DT_RUNPATH
- if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then :
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_shlibpath_overrides_runpath=no
@@ -10785,7 +10815,7 @@ else
# if libdl is installed we need to link against it
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -10819,7 +10849,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
@@ -10833,12 +10863,12 @@ fi
*)
ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = x""yes; then :
+if test "x$ac_cv_func_shl_load" = xyes; then :
lt_cv_dlopen="shl_load"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
$as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+if ${ac_cv_lib_dld_shl_load+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -10872,16 +10902,16 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
else
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = x""yes; then :
+if test "x$ac_cv_func_dlopen" = xyes; then :
lt_cv_dlopen="dlopen"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -10915,12 +10945,12 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
$as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+if ${ac_cv_lib_svld_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -10954,12 +10984,12 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
$as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+if ${ac_cv_lib_dld_dld_link+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -10993,7 +11023,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
fi
@@ -11034,7 +11064,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
$as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then :
+if ${lt_cv_dlopen_self+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -11140,7 +11170,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; }
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then :
+if ${lt_cv_dlopen_self_static+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -11390,7 +11420,7 @@ CC="$lt_save_CC"
# Checks for libraries.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil in -lm" >&5
$as_echo_n "checking for ceil in -lm... " >&6; }
-if test "${ac_cv_lib_m_ceil+set}" = set; then :
+if ${ac_cv_lib_m_ceil+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -11424,7 +11454,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_ceil" >&5
$as_echo "$ac_cv_lib_m_ceil" >&6; }
-if test "x$ac_cv_lib_m_ceil" = x""yes; then :
+if test "x$ac_cv_lib_m_ceil" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
@@ -11442,7 +11472,7 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Header+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11469,8 +11499,7 @@ fi
eval ac_res=\$$as_ac_Header
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
_ACEOF
@@ -11483,7 +11512,7 @@ done
if test $ac_header_dirent = dirent.h; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11517,11 +11546,11 @@ for ac_lib in '' dir; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_opendir+set}" = set; then :
+ if ${ac_cv_search_opendir+:} false; then :
break
fi
done
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
@@ -11540,7 +11569,7 @@ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11574,11 +11603,11 @@ for ac_lib in '' x; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_opendir+set}" = set; then :
+ if ${ac_cv_search_opendir+:} false; then :
break
fi
done
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
@@ -11598,7 +11627,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11708,12 +11737,11 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
-for ac_header in stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h
+for ac_header in stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -11729,7 +11757,7 @@ done
for ac_header in execinfo.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
-if test "x$ac_cv_header_execinfo_h" = x""yes; then :
+if test "x$ac_cv_header_execinfo_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_EXECINFO_H 1
_ACEOF
@@ -11744,84 +11772,66 @@ done
# Checks for typedefs, structures, and compiler characteristics.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then :
+if ${ac_cv_header_stdbool_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <stdbool.h>
-#ifndef bool
- "error: bool is not defined"
-#endif
-#ifndef false
- "error: false is not defined"
-#endif
-#if false
- "error: false is not 0"
-#endif
-#ifndef true
- "error: true is not defined"
-#endif
-#if true != 1
- "error: true is not 1"
-#endif
-#ifndef __bool_true_false_are_defined
- "error: __bool_true_false_are_defined is not defined"
-#endif
-
- struct s { _Bool s: 1; _Bool t; } s;
-
- char a[true == 1 ? 1 : -1];
- char b[false == 0 ? 1 : -1];
- char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- char d[(bool) 0.5 == true ? 1 : -1];
- bool e = &s;
- char f[(_Bool) 0.0 == false ? 1 : -1];
- char g[true];
- char h[sizeof (_Bool)];
- char i[sizeof s.t];
- enum { j = false, k = true, l = false * true, m = true * 256 };
- /* The following fails for
- HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
- _Bool n[m];
- char o[sizeof n == m * sizeof n[0] ? 1 : -1];
- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-# if defined __xlc__ || defined __GNUC__
- /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
- reported by James Lemley on 2005-10-05; see
- http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
- This test is not quite right, since xlc is allowed to
- reject this program, as the initializer for xlcbug is
- not one of the forms that C requires support for.
- However, doing the test right would require a runtime
- test, and that would make cross-compilation harder.
- Let us hope that IBM fixes the xlc bug, and also adds
- support for this kind of constant expression. In the
- meantime, this test will reject xlc, which is OK, since
- our stdbool.h substitute should suffice. We also test
- this with GCC, where it should work, to detect more
- quickly whether someone messes up the test in the
- future. */
- char digs[] = "0123456789";
- int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-# endif
- /* Catch a bug in an HP-UX C compiler. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- */
- _Bool q = true;
- _Bool *pq = &q;
+ #include <stdbool.h>
+ #ifndef bool
+ "error: bool is not defined"
+ #endif
+ #ifndef false
+ "error: false is not defined"
+ #endif
+ #if false
+ "error: false is not 0"
+ #endif
+ #ifndef true
+ "error: true is not defined"
+ #endif
+ #if true != 1
+ "error: true is not 1"
+ #endif
+ #ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+ #endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ /* See body of main program for 'e'. */
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
int
main ()
{
- *pq |= q;
- *pq |= ! q;
- /* Refer to every declared value, to avoid compiler optimizations. */
- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
- + !m + !n + !o + !p + !q + !pq);
+ bool e = &s;
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
;
return 0;
@@ -11836,8 +11846,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
$as_echo "$ac_cv_header_stdbool_h" >&6; }
-ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = x""yes; then :
+ ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__BOOL 1
@@ -11846,6 +11856,7 @@ _ACEOF
fi
+
if test $ac_cv_header_stdbool_h = yes; then
$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
@@ -11854,7 +11865,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11863,11 +11874,11 @@ else
int
main ()
{
-/* FIXME: Include the comments suggested by Paul. */
+
#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
+ /* Ultrix mips cc rejects this sort of thing. */
typedef int charset[2];
- const charset cs;
+ const charset cs = { 0, 0 };
/* SunOS 4.1.1 cc rejects this. */
char const *const *pcpcc;
char **ppc;
@@ -11884,8 +11895,9 @@ main ()
++pcpcc;
ppc = (char**) pcpcc;
pcpcc = (char const *const *) ppc;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
+ { /* SCO 3.2v4 cc rejects this sort of thing. */
+ char tx;
+ char *t = &tx;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
@@ -11901,10 +11913,10 @@ main ()
iptr p = 0;
++p;
}
- { /* AIX XL C 1.02.0.0 rejects this saying
+ { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
+ struct s { int j; const int *ap[3]; } bx;
+ struct s *b = &bx; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
@@ -11933,7 +11945,7 @@ $as_echo "#define const /**/" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
-if test "x$ac_cv_type_pid_t" = x""yes; then :
+if test "x$ac_cv_type_pid_t" = xyes; then :
else
@@ -11945,7 +11957,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if test "${ac_cv_type_uid_t+set}" = set; then :
+if ${ac_cv_type_uid_t+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11977,7 +11989,7 @@ fi
# Checks for library functions.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether closedir returns void" >&5
$as_echo_n "checking whether closedir returns void... " >&6; }
-if test "${ac_cv_func_closedir_void+set}" = set; then :
+if ${ac_cv_func_closedir_void+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -12019,7 +12031,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then :
+if ${ac_cv_type_signal+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12052,7 +12064,7 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
+if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
$as_echo_n "(cached) " >&6
else
rm -f conftest.sym conftest.file
@@ -12114,7 +12126,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
$as_echo_n "checking whether stat accepts an empty string... " >&6; }
-if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then :
+if ${ac_cv_func_stat_empty_string_bug+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -12162,8 +12174,7 @@ for ac_func in memmove strncasecmp strstr strdup
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -12191,7 +12202,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
- as_fn_error "htop is written in C99. A newer version of gcc is required." "$LINENO" 5
+ as_fn_error $? "htop is written in C99. A newer version of gcc is required." "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_cflags"
@@ -12293,7 +12304,7 @@ fi
if test "x$enable_unicode" = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for refresh in -lncursesw" >&5
$as_echo_n "checking for refresh in -lncursesw... " >&6; }
-if test "${ac_cv_lib_ncursesw_refresh+set}" = set; then :
+if ${ac_cv_lib_ncursesw_refresh+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -12327,7 +12338,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_refresh" >&5
$as_echo "$ac_cv_lib_ncursesw_refresh" >&6; }
-if test "x$ac_cv_lib_ncursesw_refresh" = x""yes; then :
+if test "x$ac_cv_lib_ncursesw_refresh" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNCURSESW 1
_ACEOF
@@ -12337,14 +12348,14 @@ _ACEOF
else
missing_libraries="$missing_libraries libncursesw"
- as_fn_error "You may want to use --disable-unicode or install libncursesw." "$LINENO" 5
+ as_fn_error $? "You may want to use --disable-unicode or install libncursesw." "$LINENO" 5
fi
for ac_header in ncursesw/curses.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "ncursesw/curses.h" "ac_cv_header_ncursesw_curses_h" "$ac_includes_default"
-if test "x$ac_cv_header_ncursesw_curses_h" = x""yes; then :
+if test "x$ac_cv_header_ncursesw_curses_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_NCURSESW_CURSES_H 1
_ACEOF
@@ -12353,16 +12364,25 @@ else
for ac_header in ncurses/ncurses.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default"
-if test "x$ac_cv_header_ncurses_ncurses_h" = x""yes; then :
+if test "x$ac_cv_header_ncurses_ncurses_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_NCURSES_NCURSES_H 1
_ACEOF
:
else
+ for ac_header in ncurses/curses.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "ncurses/curses.h" "ac_cv_header_ncurses_curses_h" "$ac_includes_default"
+if test "x$ac_cv_header_ncurses_curses_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_NCURSES_CURSES_H 1
+_ACEOF
+ :
+else
for ac_header in ncurses.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default"
-if test "x$ac_cv_header_ncurses_h" = x""yes; then :
+if test "x$ac_cv_header_ncurses_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_NCURSES_H 1
_ACEOF
@@ -12381,10 +12401,14 @@ fi
done
+fi
+
+done
+
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for refresh in -lncurses" >&5
$as_echo_n "checking for refresh in -lncurses... " >&6; }
-if test "${ac_cv_lib_ncurses_refresh+set}" = set; then :
+if ${ac_cv_lib_ncurses_refresh+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -12418,7 +12442,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_refresh" >&5
$as_echo "$ac_cv_lib_ncurses_refresh" >&6; }
-if test "x$ac_cv_lib_ncurses_refresh" = x""yes; then :
+if test "x$ac_cv_lib_ncurses_refresh" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNCURSES 1
_ACEOF
@@ -12432,12 +12456,39 @@ fi
for ac_header in curses.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
-if test "x$ac_cv_header_curses_h" = x""yes; then :
+if test "x$ac_cv_header_curses_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_CURSES_H 1
_ACEOF
:
else
+ for ac_header in ncurses/curses.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "ncurses/curses.h" "ac_cv_header_ncurses_curses_h" "$ac_includes_default"
+if test "x$ac_cv_header_ncurses_curses_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_NCURSES_CURSES_H 1
+_ACEOF
+ :
+else
+ for ac_header in ncurses/ncurses.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default"
+if test "x$ac_cv_header_ncurses_ncurses_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_NCURSES_NCURSES_H 1
+_ACEOF
+ :
+else
+ for ac_header in ncurses.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default"
+if test "x$ac_cv_header_ncurses_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_NCURSES_H 1
+_ACEOF
+ :
+else
missing_headers="$missing_headers $ac_header"
fi
@@ -12445,22 +12496,34 @@ done
fi
+done
+
+fi
+
+done
+
+fi
+
+done
+
+fi
+
if test ! -z "$missing_libraries"; then
- as_fn_error "missing libraries: $missing_libraries" "$LINENO" 5
+ as_fn_error $? "missing libraries: $missing_libraries" "$LINENO" 5
fi
if test ! -z "$missing_headers"; then
- as_fn_error "missing headers: $missing_headers" "$LINENO" 5
+ as_fn_error $? "missing headers: $missing_headers" "$LINENO" 5
fi
if test "x$cross_compiling" = xno; then
as_ac_File=`$as_echo "ac_cv_file_$PROCDIR/stat" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $PROCDIR/stat" >&5
$as_echo_n "checking for $PROCDIR/stat... " >&6; }
-if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_File+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
- as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "$PROCDIR/stat"; then
eval "$as_ac_File=yes"
else
@@ -12470,21 +12533,20 @@ fi
eval ac_res=\$$as_ac_File
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_File
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
else
- as_fn_error "Cannot find /proc/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help." "$LINENO" 5
+ as_fn_error $? "Cannot find /proc/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help." "$LINENO" 5
fi
as_ac_File=`$as_echo "ac_cv_file_$PROCDIR/meminfo" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $PROCDIR/meminfo" >&5
$as_echo_n "checking for $PROCDIR/meminfo... " >&6; }
-if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_File+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
- as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "$PROCDIR/meminfo"; then
eval "$as_ac_File=yes"
else
@@ -12494,11 +12556,10 @@ fi
eval ac_res=\$$as_ac_File
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_File
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
else
- as_fn_error "Cannot find /proc/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help." "$LINENO" 5
+ as_fn_error $? "Cannot find /proc/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help." "$LINENO" 5
fi
fi
@@ -12516,8 +12577,8 @@ $as_echo_n "checking for usable sched_setaffinity... " >&6; }
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run test program while cross compiling
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -12569,7 +12630,7 @@ if test "x$enable_hwloc" = xyes
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hwloc_linux_get_tid_cpubind in -lhwloc" >&5
$as_echo_n "checking for hwloc_linux_get_tid_cpubind in -lhwloc... " >&6; }
-if test "${ac_cv_lib_hwloc_hwloc_linux_get_tid_cpubind+set}" = set; then :
+if ${ac_cv_lib_hwloc_hwloc_linux_get_tid_cpubind+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -12603,7 +12664,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hwloc_hwloc_linux_get_tid_cpubind" >&5
$as_echo "$ac_cv_lib_hwloc_hwloc_linux_get_tid_cpubind" >&6; }
-if test "x$ac_cv_lib_hwloc_hwloc_linux_get_tid_cpubind" = x""yes; then :
+if test "x$ac_cv_lib_hwloc_hwloc_linux_get_tid_cpubind" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBHWLOC 1
_ACEOF
@@ -12617,7 +12678,7 @@ fi
for ac_header in hwloc.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "hwloc.h" "ac_cv_header_hwloc_h" "$ac_includes_default"
-if test "x$ac_cv_header_hwloc_h" = x""yes; then :
+if test "x$ac_cv_header_hwloc_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_HWLOC_H 1
_ACEOF
@@ -12630,6 +12691,19 @@ done
fi
+# Check whether --enable-oom was given.
+if test "${enable_oom+set}" = set; then :
+ enableval=$enable_oom;
+else
+ enable_oom="no"
+fi
+
+if test "x$enable_oom" = xyes; then
+
+$as_echo "#define HAVE_OOM 1" >>confdefs.h
+
+fi
+
ac_config_files="$ac_config_files Makefile htop.1"
cat >confcache <<\_ACEOF
@@ -12696,10 +12770,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
+ if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -12715,6 +12800,7 @@ DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -12730,11 +12816,11 @@ LTLIBOBJS=$ac_ltlibobjs
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
- as_fn_error "conditional \"AMDEP\" was never defined.
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
- as_fn_error "conditional \"am__fastdepCC\" was never defined.
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -n "$EXEEXT"; then
@@ -12746,7 +12832,7 @@ else
fi
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -12847,6 +12933,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -12892,19 +12979,19 @@ export LANGUAGE
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
- $as_echo "$as_me: error: $1" >&2
+ $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
@@ -13042,16 +13129,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -13100,7 +13187,7 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
@@ -13111,28 +13198,16 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -13153,8 +13228,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by htop $as_me 1.0.2, which was
-generated by GNU Autoconf 2.65. Invocation command line was
+This file was extended by htop $as_me 1.0.3, which was
+generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -13213,17 +13288,17 @@ $config_headers
Configuration commands:
$config_commands
-Report bugs to <loderunner@users.sourceforge.net>."
+Report bugs to <hisham@gobolinux.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-htop config.status 1.0.2
-configured by $0, generated by GNU Autoconf 2.65,
+htop config.status 1.0.3
+configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -13241,11 +13316,16 @@ ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
+ --*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$1
ac_optarg=$2
@@ -13267,6 +13347,7 @@ do
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
@@ -13279,7 +13360,7 @@ do
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
- as_fn_error "ambiguous option: \`$1'
+ as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
@@ -13288,7 +13369,7 @@ Try \`$0 --help' for more information.";;
ac_cs_silent=: ;;
# This is an error.
- -*) as_fn_error "unrecognized option: \`$1'
+ -*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
@@ -13308,7 +13389,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
@@ -13608,7 +13689,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"htop.1") CONFIG_FILES="$CONFIG_FILES htop.1" ;;
- *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
@@ -13631,9 +13712,10 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
@@ -13641,12 +13723,13 @@ $debug ||
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
@@ -13663,12 +13746,12 @@ if test "x$ac_cr" = x; then
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\r'
+ ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
@@ -13677,18 +13760,18 @@ _ACEOF
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
@@ -13696,7 +13779,7 @@ done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
@@ -13744,7 +13827,7 @@ t delim
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
@@ -13776,21 +13859,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || as_fn_error "could not setup config files machinery" "$LINENO" 5
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
s/^[^=]*=[ ]*$//
}'
fi
@@ -13802,7 +13893,7 @@ fi # test -n "$CONFIG_FILES"
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
@@ -13814,11 +13905,11 @@ _ACEOF
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
- ac_t=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_t"; then
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
break
elif $ac_last_try; then
- as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
@@ -13903,7 +13994,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
- as_fn_error "could not setup config headers machinery" "$LINENO" 5
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
@@ -13916,7 +14007,7 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -13935,7 +14026,7 @@ do
for ac_f
do
case $ac_f in
- -) ac_f="$tmp/stdin";;
+ -) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -13944,7 +14035,7 @@ do
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
@@ -13970,8 +14061,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -14107,23 +14198,24 @@ s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
+which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
+which seems to be undefined. Please make sure it is defined" >&2;}
- rm -f "$tmp/stdin"
+ rm -f "$ac_tmp/stdin"
case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
@@ -14132,21 +14224,21 @@ which seems to be undefined. Please make sure it is defined." >&2;}
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
- } >"$tmp/config.h" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
- if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
- mv "$tmp/config.h" "$ac_file" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
- || as_fn_error "could not create -" "$LINENO" 5
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
fi
# Compute "$ac_file"'s index in $config_headers.
_am_arg="$ac_file"
@@ -14936,7 +15028,7 @@ _ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
- as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
@@ -14957,7 +15049,7 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || as_fn_exit $?
+ $ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
diff --git a/configure.ac b/configure.ac
index ff6901b..2b934e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.65)
-AC_INIT([htop],[1.0.2],[loderunner@users.sourceforge.net])
+AC_INIT([htop],[1.0.3],[hisham@gobolinux.org])
# The following two lines are required by hwloc scripts
AC_USE_SYSTEM_EXTENSIONS
@@ -27,7 +27,7 @@ AC_CHECK_LIB([m], [ceil], [], [missing_libraries="$missing_libraries libm"])
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
-AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h],[:],[
+AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h],[:],[
missing_headers="$missing_headers $ac_header"
])
AC_CHECK_HEADERS([execinfo.h],[:],[:])
@@ -94,11 +94,15 @@ if test "x$enable_unicode" = xyes; then
AC_MSG_ERROR([You may want to use --disable-unicode or install libncursesw.])
])
AC_CHECK_HEADERS([ncursesw/curses.h],[:],
- [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
- [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])
+ [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
+ [AC_CHECK_HEADERS([ncurses/curses.h],[:],
+ [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])])
else
AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"])
- AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])
+ AC_CHECK_HEADERS([curses.h],[:],
+ [AC_CHECK_HEADERS([ncurses/curses.h],[:],
+ [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
+ [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])])
fi
if test ! -z "$missing_libraries"; then
@@ -141,5 +145,10 @@ then
AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"])
fi
+AC_ARG_ENABLE(oom, [AC_HELP_STRING([--enable-oom], [enable OOM score reporting])], ,enable_oom="no")
+if test "x$enable_oom" = xyes; then
+ AC_DEFINE(HAVE_OOM, 1, [Define if OOM score support enabled.])
+fi
+
AC_CONFIG_FILES([Makefile htop.1])
AC_OUTPUT
diff --git a/depcomp b/depcomp
index e5f9736..df8eea7 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2007-03-29.01
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
+# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ scriptversion=2007-03-29.01
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
depmode=dashmstdout
fi
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u="sed s,\\\\\\\\,/,g"
+ depmode=msvisualcpp
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -192,14 +199,14 @@ sgi)
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
-' ' ' >> $depfile
- echo >> $depfile
+' ' ' >> "$depfile"
+ echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
- >> $depfile
+ >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -328,7 +335,12 @@ hp2)
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
- sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@@ -404,7 +416,7 @@ dashmstdout)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -455,32 +467,39 @@ makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
- cleared=no
- for arg in "$@"; do
+ cleared=no eat=no
+ for arg
+ do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
- obj_suffix="`echo $object | sed 's/^.*\././'`"
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
@@ -500,7 +519,7 @@ cpp)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -538,13 +557,27 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout, regardless of -o,
- # because we must use -o when running libtool.
+ # always write the preprocessed file to stdout.
"$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
IFS=" "
for arg
do
case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
@@ -557,16 +590,23 @@ msvisualcpp)
;;
esac
done
- "$@" -E |
- sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
none)
exec "$@"
;;
@@ -585,5 +625,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/htop.1 b/htop.1
index ae654d0..72fff27 100644
--- a/htop.1
+++ b/htop.1
@@ -1,4 +1,4 @@
-.TH "HTOP" "1" "2011" "htop 1.0.2" "Utils"
+.TH "HTOP" "1" "2011" "htop 1.0.3" "Utils"
.SH "NAME"
htop \- interactive process viewer
.SH "SYNOPSIS"
@@ -17,7 +17,7 @@ entering their PIDs.
.br
.SH "COMMAND-LINE OPTIONS"
.LP
-Mandatory arguments to long options are madatory for short options too.
+Mandatory arguments to long options are mandatory for short options too.
.LP
.TP
\fB\-d \-\-delay=DELAY\fR
@@ -91,9 +91,11 @@ between them as a tree. Toggling the key will switch between tree and
your previously selected sort view. Selecting a sort view will exit
tree view.
.TP
-.B F6, <, >
-Select a field for sorting. The current sort field is indicated by a
-highlight in the header.
+.B F6
+On sorted view, select a field for sorting, also accessible through < and >.
+The current sort field is indicated by a highlight in the header.
+On tree view, expand or collapse the current subtree. A "+" indicator in the
+tree node indicates that it is collapsed.
.TP
.B F7, ]
Increase the selected process's priority (subtract from 'nice' value).
@@ -190,7 +192,7 @@ The state of the process:
\fBS\fR for sleeping (idle)
\fBR\fR for running
\fBD\fR for disk sleep (uninterruptible)
- \fBZ\fR for zombie (waiting for parent to read it's exit status)
+ \fBZ\fR for zombie (waiting for parent to read its exit status)
\fBT\fR for traced or suspended (e.g by SIGTSTP)
\fBW\fR for paging
.TP
@@ -231,7 +233,7 @@ executing system calls on behalf of all the process's waited-for children (see
STIME above).
.TP
.B PRIORITY (PRI)
-The kernels internal priority for the process, usually just it's nice value
+The kernel's internal priority for the process, usually just its nice value
plus twenty. Different for real-time processes.
.TP
.B PERCENT_MEM
@@ -313,6 +315,9 @@ OpenVZ process ID.
.B VXID
VServer process ID.
.TP
+.B OOM
+OOM killer score.
+.TP
.B All other flags
Currently unsupported (always displays '-').
@@ -321,7 +326,7 @@ proc(5), top(1), free(1), ps(1), uptime(1)
.SH "AUTHORS"
.LP
-htop is developed by Hisham Muhammad <loderunner@users.sourceforge.net>.
+htop is developed by Hisham Muhammad <hisham@gobolinux.org>.
.LP
This man page was written by Bartosz Fenski <fenio@o2.pl> for the Debian
GNU/Linux distribution (but it may be used by others). It was updated by Hisham
diff --git a/htop.1.in b/htop.1.in
index bd8b909..a0e2a26 100644
--- a/htop.1.in
+++ b/htop.1.in
@@ -17,7 +17,7 @@ entering their PIDs.
.br
.SH "COMMAND-LINE OPTIONS"
.LP
-Mandatory arguments to long options are madatory for short options too.
+Mandatory arguments to long options are mandatory for short options too.
.LP
.TP
\fB\-d \-\-delay=DELAY\fR
@@ -91,9 +91,11 @@ between them as a tree. Toggling the key will switch between tree and
your previously selected sort view. Selecting a sort view will exit
tree view.
.TP
-.B F6, <, >
-Select a field for sorting. The current sort field is indicated by a
-highlight in the header.
+.B F6
+On sorted view, select a field for sorting, also accessible through < and >.
+The current sort field is indicated by a highlight in the header.
+On tree view, expand or collapse the current subtree. A "+" indicator in the
+tree node indicates that it is collapsed.
.TP
.B F7, ]
Increase the selected process's priority (subtract from 'nice' value).
@@ -190,7 +192,7 @@ The state of the process:
\fBS\fR for sleeping (idle)
\fBR\fR for running
\fBD\fR for disk sleep (uninterruptible)
- \fBZ\fR for zombie (waiting for parent to read it's exit status)
+ \fBZ\fR for zombie (waiting for parent to read its exit status)
\fBT\fR for traced or suspended (e.g by SIGTSTP)
\fBW\fR for paging
.TP
@@ -231,7 +233,7 @@ executing system calls on behalf of all the process's waited-for children (see
STIME above).
.TP
.B PRIORITY (PRI)
-The kernels internal priority for the process, usually just it's nice value
+The kernel's internal priority for the process, usually just its nice value
plus twenty. Different for real-time processes.
.TP
.B PERCENT_MEM
@@ -313,6 +315,9 @@ OpenVZ process ID.
.B VXID
VServer process ID.
.TP
+.B OOM
+OOM killer score.
+.TP
.B All other flags
Currently unsupported (always displays '-').
@@ -321,7 +326,7 @@ proc(5), top(1), free(1), ps(1), uptime(1)
.SH "AUTHORS"
.LP
-htop is developed by Hisham Muhammad <loderunner@users.sourceforge.net>.
+htop is developed by Hisham Muhammad <hisham@gobolinux.org>.
.LP
This man page was written by Bartosz Fenski <fenio@o2.pl> for the Debian
GNU/Linux distribution (but it may be used by others). It was updated by Hisham
diff --git a/htop.c b/htop.c
index 44aa857..b343809 100644
--- a/htop.c
+++ b/htop.c
@@ -23,6 +23,7 @@ in the source distribution for its full text.
#include "OpenFilesScreen.h"
#include "AffinityPanel.h"
#include "IOPriorityPanel.h"
+#include "IncSet.h"
#include <unistd.h>
#include <math.h>
@@ -35,12 +36,11 @@ in the source distribution for its full text.
#include <string.h>
#include <sys/param.h>
#include <sys/time.h>
+#include <time.h>
//#link m
-#define INCSEARCH_MAX 40
-
-#define COPYRIGHT "(C) 2004-2011 Hisham Muhammad"
+#define COPYRIGHT "(C) 2004-2012 Hisham Muhammad"
static void printVersionFlag() {
fputs("htop " VERSION " - " COPYRIGHT "\n"
@@ -49,6 +49,8 @@ static void printVersionFlag() {
exit(0);
}
+static const char* defaultFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL};
+
static void printHelpFlag() {
fputs("htop " VERSION " - " COPYRIGHT "\n"
"Released under the GNU GPL.\n\n"
@@ -67,6 +69,43 @@ static void printHelpFlag() {
exit(0);
}
+static struct { const char* key; const char* info; } helpLeft[] = {
+ { .key = " Arrows: ", .info = "scroll process list" },
+ { .key = " Digits: ", .info = "incremental PID search" },
+ { .key = " F3 /: ", .info = "incremental name search" },
+ { .key = " F4 \\: ",.info = "incremental name filtering" },
+ { .key = " F5 t: ", .info = "tree view" },
+ { .key = " u: ", .info = "show processes of a single user" },
+ { .key = " H: ", .info = "hide/show user threads" },
+ { .key = " K: ", .info = "hide/show kernel threads" },
+ { .key = " F: ", .info = "cursor follows process" },
+ { .key = " F6 + -: ", .info = "expand/collapse tree" },
+ { .key = " P M T: ", .info = "sort by CPU%, MEM% or TIME" },
+ { .key = " I: ", .info = "invert sort order" },
+ { .key = " F6 >: ", .info = "select sort column" },
+ { .key = NULL, .info = NULL }
+};
+
+static struct { const char* key; const char* info; } helpRight[] = {
+ { .key = " Space: ", .info = "tag process" },
+ { .key = " c: ", .info = "tag process and its children" },
+ { .key = " U: ", .info = "untag all processes" },
+ { .key = " F9 k: ", .info = "kill process/tagged processes" },
+ { .key = " F7 ]: ", .info = "higher priority (root only)" },
+ { .key = " F8 [: ", .info = "lower priority (+ nice)" },
+#if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
+ { .key = " a: ", .info = "set CPU affinity" },
+#endif
+ { .key = " i: ", .info = "set IO prority" },
+ { .key = " l: ", .info = "list open files with lsof" },
+ { .key = " s: ", .info = "trace syscalls with strace" },
+ { .key = " ", .info = "" },
+ { .key = " F2 S: ", .info = "setup" },
+ { .key = " F1 h: ", .info = "show this help screen" },
+ { .key = " F10 q: ", .info = "quit" },
+ { .key = NULL, .info = NULL }
+};
+
static void showHelp(ProcessList* pl) {
clear();
attrset(CRT_colors[HELP_BOLD]);
@@ -82,17 +121,17 @@ static void showHelp(ProcessList* pl) {
#define addattrstr(a,s) attrset(a);addstr(s)
addattrstr(CRT_colors[BAR_BORDER], "[");
if (pl->detailedCPUTime) {
- addattrstr(CRT_colors[CPU_NICE], "low"); addstr("/");
+ addattrstr(CRT_colors[CPU_NICE_TEXT], "low"); addstr("/");
addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/");
addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/");
addattrstr(CRT_colors[CPU_IRQ], "irq"); addstr("/");
addattrstr(CRT_colors[CPU_SOFTIRQ], "soft-irq"); addstr("/");
- addattrstr(CRT_colors[CPU_IOWAIT], "io-wait"); addstr("/");
addattrstr(CRT_colors[CPU_STEAL], "steal"); addstr("/");
- addattrstr(CRT_colors[CPU_GUEST], "guest");
+ addattrstr(CRT_colors[CPU_GUEST], "guest"); addstr("/");
+ addattrstr(CRT_colors[CPU_IOWAIT], "io-wait");
addattrstr(CRT_colors[BAR_SHADOW], " used%");
} else {
- addattrstr(CRT_colors[CPU_NICE], "low-priority"); addstr("/");
+ addattrstr(CRT_colors[CPU_NICE_TEXT], "low-priority"); addstr("/");
addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/");
addattrstr(CRT_colors[CPU_KERNEL], "kernel"); addstr("/");
addattrstr(CRT_colors[CPU_STEAL], "virtualiz");
@@ -103,7 +142,7 @@ static void showHelp(ProcessList* pl) {
mvaddstr(4, 0, "Memory bar: ");
addattrstr(CRT_colors[BAR_BORDER], "[");
addattrstr(CRT_colors[MEMORY_USED], "used"); addstr("/");
- addattrstr(CRT_colors[MEMORY_BUFFERS], "buffers"); addstr("/");
+ addattrstr(CRT_colors[MEMORY_BUFFERS_TEXT], "buffers"); addstr("/");
addattrstr(CRT_colors[MEMORY_CACHE], "cache");
addattrstr(CRT_colors[BAR_SHADOW], " used/total");
addattrstr(CRT_colors[BAR_BORDER], "]");
@@ -119,44 +158,11 @@ static void showHelp(ProcessList* pl) {
mvaddstr(7, 0, "In monochrome, meters are displayed through different chars, in order: |#*@$%&");
}
mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep");
- mvaddstr( 9, 0, " Arrows: scroll process list F5 t: tree view");
- mvaddstr(10, 0, " Digits: incremental PID search u: show processes of a single user");
- mvaddstr(11, 0, " F3 /: incremental name search H: hide/show user threads");
- mvaddstr(12, 0, " F4 \\: incremental name filtering K: hide/show kernel threads");
- mvaddstr(13, 0, " Space: tag processes F: cursor follows process");
- mvaddstr(14, 0, " U: untag all processes + -: expand/collapse tree");
- mvaddstr(15, 0, " F9 k: kill process/tagged processes P M T: sort by CPU%, MEM% or TIME");
- mvaddstr(16, 0, " ] F7: higher priority (root only) i: set IO priority");
- mvaddstr(17, 0, " [ F8: lower priority (+ nice) I: invert sort order");
-#if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
- if (pl->cpuCount > 1)
- mvaddstr(18, 0, " a: set CPU affinity F6 >: select sort column");
- else
-#endif
- mvaddstr(18, 0, " F6 >: select sort column");
- mvaddstr(19, 0, " F2 S: setup l: list open files with lsof");
- mvaddstr(20, 0, " F1 h: show this help screen s: trace syscalls with strace");
- mvaddstr(21, 0, " F10 q: quit");
-
+ for (int i = 0; helpLeft[i].info; i++) { mvaddstr(9+i, 9, helpLeft[i].info); }
+ for (int i = 0; helpRight[i].info; i++) { mvaddstr(9+i, 49, helpRight[i].info); }
attrset(CRT_colors[HELP_BOLD]);
- mvaddstr( 9, 0, " Arrows"); mvaddstr( 9,40, " F5 t");
- mvaddstr(10, 0, " Digits"); mvaddstr(10,40, " u");
- mvaddstr(11, 0, " F3 /"); mvaddstr(11,40, " H");
- mvaddstr(12, 0, " F4 \\"); mvaddstr(12,40, " K");
- mvaddstr(13, 0, " Space"); mvaddstr(13,40, " F");
- mvaddstr(14, 0, " U"); mvaddstr(14,40, " + -");
- mvaddstr(15, 0, " F9 k"); mvaddstr(15,40, "P M T");
- mvaddstr(16, 0, " ] F7"); mvaddstr(16,40, " i");
- mvaddstr(17, 0, " [ F8"); mvaddstr(17,40, " I");
- mvaddstr(18,40, " F6 >");
-#if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
- if (pl->cpuCount > 1)
- mvaddstr(18, 0, " a:");
-#endif
- mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " l");
- mvaddstr(20, 0, " ? F1 h"); mvaddstr(20,40, " s");
- mvaddstr(21, 0, " F10 q");
- attrset(CRT_colors[DEFAULT_COLOR]);
+ for (int i = 0; helpLeft[i].key; i++) { mvaddstr(9+i, 0, helpLeft[i].key); }
+ for (int i = 0; helpRight[i].key; i++) { mvaddstr(9+i, 40, helpRight[i].key); }
attrset(CRT_colors[HELP_BOLD]);
mvaddstr(23,0, "Press any key to return.");
@@ -208,11 +214,17 @@ static bool changePriority(Panel* panel, int delta) {
return anyTagged;
}
+static int selectedPid(Panel* panel) {
+ Process* p = (Process*) Panel_getSelected(panel);
+ if (p) {
+ return p->pid;
+ }
+ return -1;
+}
+
static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, const char** keyLabels, FunctionBar* prevBar, Header* header) {
const char* fuKeys[] = {"Enter", "Esc", NULL};
int fuEvents[] = {13, 27};
- if (!list->eventHandler)
- Panel_setEventHandler(list, Panel_selectByTyping);
ScreenManager* scr = ScreenManager_new(0, y, 0, -1, HORIZONTAL, header, false);
scr->allowFocusChange = false;
ScreenManager_add(scr, list, FunctionBar_new(keyLabels, fuKeys, fuEvents), x - 1);
@@ -220,9 +232,9 @@ static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, const cha
Panel* panelFocus;
int ch;
bool unfollow = false;
+ int pid = selectedPid(panel);
if (header->pl->following == -1) {
- Process* p = (Process*)Panel_getSelected(panel);
- header->pl->following = p ? p->pid : -1;
+ header->pl->following = pid;
unfollow = true;
}
ScreenManager_run(scr, &panelFocus, &ch);
@@ -234,7 +246,11 @@ static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, const cha
Panel_resize(panel, COLS, LINES-y-1);
FunctionBar_draw(prevBar, NULL);
if (panelFocus == list && ch == 13) {
- return Panel_getSelected(list);
+ Process* selected = (Process*)Panel_getSelected(panel);
+ if (selected && selected->pid == pid)
+ return Panel_getSelected(list);
+ else
+ beep();
}
return NULL;
}
@@ -255,23 +271,83 @@ static bool setUserOnly(const char* userName, bool* userOnly, uid_t* userId) {
return false;
}
-static inline void setSortKey(ProcessList* pl, ProcessField sortKey, Panel* panel, Settings* settings) {
+static void setTreeView(ProcessList* pl, FunctionBar* fuBar, bool mode) {
+ if (mode) {
+ FunctionBar_setLabel(fuBar, KEY_F(5), "Sorted");
+ FunctionBar_setLabel(fuBar, KEY_F(6), "Collap");
+ } else {
+ FunctionBar_setLabel(fuBar, KEY_F(5), "Tree ");
+ FunctionBar_setLabel(fuBar, KEY_F(6), "SortBy");
+ }
+ if (mode != pl->treeView) {
+ FunctionBar_draw(fuBar, NULL);
+ }
+ pl->treeView = mode;
+}
+
+static inline void setSortKey(ProcessList* pl, FunctionBar* fuBar, ProcessField sortKey, Panel* panel, Settings* settings) {
pl->sortKey = sortKey;
pl->direction = 1;
- pl->treeView = false;
+ setTreeView(pl, fuBar, false);
settings->changed = true;
ProcessList_printHeader(pl, Panel_getHeader(panel));
}
-typedef struct IncBuffer_ {
- char buffer[INCSEARCH_MAX];
- int index;
- FunctionBar* bar;
-} IncBuffer;
+static const char* getMainPanelValue(Panel* panel, int i) {
+ Process* p = (Process*) Panel_get(panel, i);
+ if (p)
+ return p->comm;
+ return "";
+}
+
+static void tagAllChildren(Panel* panel, Process* parent) {
+ parent->tag = true;
+ pid_t ppid = parent->pid;
+ for (int i = 0; i < Panel_size(panel); i++) {
+ Process* p = (Process*) Panel_get(panel, i);
+ if (!p->tag && p->ppid == ppid) {
+ tagAllChildren(panel, p);
+ }
+ }
+}
+
+static bool expandCollapse(Panel* panel) {
+ Process* p = (Process*) Panel_getSelected(panel);
+ if (!p) return false;
+ p->showChildren = !p->showChildren;
+ return true;
+}
+
+void sortBy(Panel* panel, ProcessList* pl, Settings* settings, int headerHeight, FunctionBar* defaultBar, Header* header) {
+ Panel* sortPanel = Panel_new(0, 0, 0, 0, true, Class(ListItem));
+ Panel_setHeader(sortPanel, "Sort by");
+ const char* fuFunctions[] = {"Sort ", "Cancel ", NULL};
+ ProcessField* fields = pl->fields;
+ for (int i = 0; fields[i]; i++) {
+ char* name = String_trim(Process_fieldNames[fields[i]]);
+ Panel_add(sortPanel, (Object*) ListItem_new(name, fields[i]));
+ if (fields[i] == pl->sortKey)
+ Panel_setSelected(sortPanel, i);
+ free(name);
+ }
+ ListItem* field = (ListItem*) pickFromVector(panel, sortPanel, 15, headerHeight, fuFunctions, defaultBar, header);
+ if (field) {
+ settings->changed = true;
+ setSortKey(pl, defaultBar, field->key, panel, settings);
+ } else {
+ ProcessList_printHeader(pl, Panel_getHeader(panel));
+ }
+ Object_delete(sortPanel);
+}
-static void IncBuffer_reset(IncBuffer* inc) {
- inc->index = 0;
- inc->buffer[0] = 0;
+static void millisleep(unsigned long millisec) {
+ struct timespec req = {
+ .tv_sec = 0,
+ .tv_nsec = millisec * 1000000L
+ };
+ while(nanosleep(&req,&req)==-1) {
+ continue;
+ }
}
int main(int argc, char** argv) {
@@ -280,7 +356,6 @@ int main(int argc, char** argv) {
bool userOnly = false;
uid_t userId = 0;
int usecolors = 1;
- TreeType treeType = TREE_TYPE_AUTO;
char *argCopy;
char *pid;
Hashtable *pidWhiteList = NULL;
@@ -332,7 +407,7 @@ int main(int argc, char** argv) {
}
break;
case 'd':
- if (sscanf(optarg, "%d", &delay) == 1) {
+ if (sscanf(optarg, "%16d", &delay) == 1) {
if (delay < 1) delay = 1;
if (delay > 100) delay = 100;
} else {
@@ -349,9 +424,10 @@ int main(int argc, char** argv) {
case 'C':
usecolors=0;
break;
- case 'p':
+ case 'p': {
argCopy = strdup(optarg);
- pid = strtok(argCopy, ",");
+ char* saveptr;
+ pid = strtok_r(argCopy, ",", &saveptr);
if( !pidWhiteList ) {
pidWhiteList = Hashtable_new(8, false);
@@ -360,11 +436,12 @@ int main(int argc, char** argv) {
while( pid ) {
unsigned int num_pid = atoi(pid);
Hashtable_put(pidWhiteList, num_pid, (void *) 1);
- pid = strtok(NULL, ",");
+ pid = strtok_r(NULL, ",", &saveptr);
}
free(argCopy);
break;
+ }
default:
exit(1);
}
@@ -383,11 +460,23 @@ int main(int argc, char** argv) {
bool doRecalculate = false;
Settings* settings;
- Panel* killPanel = NULL;
-
ProcessList* pl = NULL;
UsersTable* ut = UsersTable_new();
+#ifdef HAVE_LIBNCURSESW
+ char *locale = setlocale(LC_ALL, NULL);
+ if (locale == NULL || locale[0] == '\0')
+ locale = setlocale(LC_CTYPE, NULL);
+ if (locale != NULL &&
+ (strstr(locale, "UTF-8") ||
+ strstr(locale, "utf-8") ||
+ strstr(locale, "UTF8") ||
+ strstr(locale, "utf8")))
+ CRT_utf8 = true;
+ else
+ CRT_utf8 = false;
+#endif
+
pl = ProcessList_new(ut, pidWhiteList);
Process_getMaxPid();
@@ -401,68 +490,25 @@ int main(int argc, char** argv) {
if (!usecolors)
settings->colorScheme = COLORSCHEME_MONOCHROME;
- if (treeType == TREE_TYPE_AUTO) {
-#ifdef HAVE_LIBNCURSESW
- char *locale = setlocale(LC_ALL, NULL);
- if (locale == NULL || locale[0] == '\0')
- locale = setlocale(LC_CTYPE, NULL);
- if (locale != NULL &&
- (strstr(locale, "UTF-8") ||
- strstr(locale, "utf-8") ||
- strstr(locale, "UTF8") ||
- strstr(locale, "utf8")))
- treeType = TREE_TYPE_UTF8;
- else
- treeType = TREE_TYPE_ASCII;
-#else
- treeType = TREE_TYPE_ASCII;
-#endif
- }
- switch (treeType) {
- default:
- case TREE_TYPE_ASCII:
- pl->treeStr = ProcessList_treeStrAscii;
- break;
- case TREE_TYPE_UTF8:
- pl->treeStr = ProcessList_treeStrUtf8;
- break;
- }
-
CRT_init(settings->delay, settings->colorScheme);
- Panel* panel = Panel_new(0, headerHeight, COLS, LINES - headerHeight - 2, PROCESS_CLASS, false, NULL);
+ Panel* panel = Panel_new(0, headerHeight, COLS, LINES - headerHeight - 2, false, &Process_class);
ProcessList_setPanel(pl, panel);
+ FunctionBar* defaultBar = FunctionBar_new(defaultFunctions, NULL, NULL);
+ setTreeView(pl, defaultBar, pl->treeView);
+
if (sortKey > 0) {
pl->sortKey = sortKey;
- pl->treeView = false;
+ setTreeView(pl, defaultBar, false);
pl->direction = 1;
}
ProcessList_printHeader(pl, Panel_getHeader(panel));
- IncBuffer incSearch, incFilter;
- bool filtering = false;
-
- memset(&incSearch, 0, sizeof(IncBuffer));
- const char* searchFunctions[] = {"Next ", "Cancel ", " Search: ", NULL};
- const char* searchKeys[] = {"F3", "Esc", " "};
- int searchEvents[] = {KEY_F(3), 27, ERR};
- incSearch.bar = FunctionBar_new(searchFunctions, searchKeys, searchEvents);
-
- memset(&incFilter, 0, sizeof(IncBuffer));
- const char* filterFunctions[] = {"Done ", "Clear ", " Filter: ", NULL};
- const char* filterKeys[] = {"Enter", "Esc", " "};
- int filterEvents[] = {13, 27, ERR};
- incFilter.bar = FunctionBar_new(filterFunctions, filterKeys, filterEvents);
-
- IncBuffer* incMode = NULL;
-
- const char* defaultFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ",
- "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL};
- FunctionBar* defaultBar = FunctionBar_new(defaultFunctions, NULL, NULL);
+ IncSet* inc = IncSet_new(defaultBar);
ProcessList_scan(pl);
- usleep(75000);
+ millisleep(75);
FunctionBar_draw(defaultBar, NULL);
@@ -470,21 +516,24 @@ int main(int argc, char** argv) {
bool follow = false;
struct timeval tv;
- double newTime = 0.0;
double oldTime = 0.0;
- bool recalculate;
int ch = ERR;
int closeTimeout = 0;
+ bool idle = false;
+
+ bool collapsed = false;
+
while (!quit) {
gettimeofday(&tv, NULL);
- newTime = ((double)tv.tv_sec * 10) + ((double)tv.tv_usec / 100000);
- recalculate = (newTime - oldTime > CRT_delay);
- Process* p = (Process*)Panel_getSelected(panel);
- int following = (follow && p) ? p->pid : -1;
- if (recalculate)
+ double newTime = ((double)tv.tv_sec * 10) + ((double)tv.tv_usec / 100000);
+ bool recalculate = (newTime - oldTime > settings->delay);
+ int following = follow ? selectedPid(panel) : -1;
+ if (recalculate) {
+ Header_draw(header);
oldTime = newTime;
+ }
if (doRefresh) {
if (recalculate || doRecalculate) {
ProcessList_scan(pl);
@@ -494,20 +543,36 @@ int main(int argc, char** argv) {
ProcessList_sort(pl);
refreshTimeout = 1;
}
- ProcessList_rebuildPanel(pl, true, following, userOnly, userId, filtering, incFilter.buffer);
+ ProcessList_rebuildPanel(pl, true, following, userOnly, userId, IncSet_filter(inc));
+ idle = false;
}
doRefresh = true;
- Header_draw(header);
+ if (pl->treeView) {
+ Process* p = (Process*) Panel_getSelected(panel);
+ if (p) {
+ if (!p->showChildren && !collapsed) {
+ FunctionBar_setLabel(defaultBar, KEY_F(6), "Expand");
+ FunctionBar_draw(defaultBar, NULL);
+ } else if (p->showChildren && collapsed) {
+ FunctionBar_setLabel(defaultBar, KEY_F(6), "Collap");
+ FunctionBar_draw(defaultBar, NULL);
+ }
+ collapsed = !p->showChildren;
+ }
+ }
- Panel_draw(panel, true);
+ if (!idle) {
+ Panel_draw(panel, true);
+ }
+
int prev = ch;
- if (incMode)
+ if (inc->active)
move(LINES-1, CRT_cursorX);
ch = getch();
if (ch == ERR) {
- if (!incMode)
+ if (!inc->active)
refreshTimeout--;
if (prev == ch && !recalculate) {
closeTimeout++;
@@ -516,85 +581,10 @@ int main(int argc, char** argv) {
}
} else
closeTimeout = 0;
+ idle = true;
continue;
}
-
- if (incMode) {
- doRefresh = false;
- int size = Panel_size(panel);
- if (ch == KEY_F(3)) {
- if (Panel_size(panel) == 0) continue;
- int here = Panel_getSelectedIndex(panel);
- int i = here+1;
- while (i != here) {
- if (i == size)
- i = 0;
- Process* p = (Process*) Panel_get(panel, i);
- if (String_contains_i(p->comm, incMode->buffer)) {
- Panel_setSelected(panel, i);
- break;
- }
- i++;
- }
- continue;
- } else if (isprint((char)ch) && (incMode->index < INCSEARCH_MAX)) {
- incMode->buffer[incMode->index] = ch;
- incMode->index++;
- incMode->buffer[incMode->index] = 0;
- if (incMode == &incFilter) {
- doRefresh = true;
- if (incFilter.index == 1) filtering = true;
- }
- } else if ((ch == KEY_BACKSPACE || ch == 127) && (incMode->index > 0)) {
- incMode->index--;
- incMode->buffer[incMode->index] = 0;
- if (incMode == &incFilter) {
- doRefresh = true;
- if (incFilter.index == 0) {
- filtering = false;
- IncBuffer_reset(incMode);
- }
- }
- } else {
- if (incMode == &incFilter) {
- doRefresh = true;
- if (ch == 27) {
- filtering = false;
- IncBuffer_reset(incMode);
- }
- }
- incMode = NULL;
- FunctionBar_draw(defaultBar, NULL);
- continue;
- }
-
- bool found = false;
- for (int i = 0; i < size; i++) {
- Process* p = (Process*) Panel_get(panel, i);
- if (String_contains_i(p->comm, incSearch.buffer)) {
- Panel_setSelected(panel, i);
- found = true;
- break;
- }
- }
- if (found)
- FunctionBar_draw(incMode->bar, incMode->buffer);
- else
- FunctionBar_drawAttr(incMode->bar, incMode->buffer, CRT_colors[FAILED_SEARCH]);
- continue;
- }
- if (isdigit((char)ch)) {
- if (Panel_size(panel) == 0) continue;
- pid_t pid = ch-48 + acc;
- for (int i = 0; i < ProcessList_size(pl) && ((Process*) Panel_getSelected(panel))->pid != pid; i++)
- Panel_setSelected(panel, i);
- acc = pid * 10;
- if (acc > 10000000)
- acc = 0;
- continue;
- } else {
- acc = 0;
- }
+ idle = false;
if (ch == KEY_MOUSE) {
MEVENT mevent;
@@ -606,9 +596,9 @@ int main(int argc, char** argv) {
ProcessField field = ProcessList_keyAt(pl, x);
if (field == pl->sortKey) {
ProcessList_invertSortOrder(pl);
- pl->treeView = false;
+ setTreeView(pl, defaultBar, false);
} else {
- setSortKey(pl, field, panel, settings);
+ setSortKey(pl, defaultBar, field, panel, settings);
}
refreshTimeout = 0;
continue;
@@ -619,10 +609,7 @@ int main(int argc, char** argv) {
follow = true;
continue;
} if (mevent.y == LINES - 1) {
- FunctionBar* bar;
- if (incMode) bar = incMode->bar;
- else bar = defaultBar;
- ch = FunctionBar_synthesizeEvent(bar, mevent.x);
+ ch = FunctionBar_synthesizeEvent(inc->bar, mevent.x);
}
} else if (mevent.bstate & BUTTON4_CLICKED) {
ch = KEY_UP;
@@ -634,24 +621,51 @@ int main(int argc, char** argv) {
}
}
+ if (inc->active) {
+ doRefresh = IncSet_handleKey(inc, ch, panel, getMainPanelValue, NULL);
+ continue;
+ }
+
+ if (isdigit((char)ch)) {
+ if (Panel_size(panel) == 0) continue;
+ pid_t pid = ch-48 + acc;
+ for (int i = 0; i < ProcessList_size(pl); i++) {
+ Panel_setSelected(panel, i);
+ Process* p = (Process*) Panel_getSelected(panel);
+ if (p && p->pid == pid) {
+ break;
+ }
+ }
+ acc = pid * 10;
+ if (acc > 10000000)
+ acc = 0;
+ continue;
+ } else {
+ acc = 0;
+ }
+
switch (ch) {
case KEY_RESIZE:
Panel_resize(panel, COLS, LINES-headerHeight-1);
- if (incMode)
- FunctionBar_draw(incMode->bar, incMode->buffer);
- else
- FunctionBar_draw(defaultBar, NULL);
+ IncSet_drawBar(inc);
break;
case 'M':
{
refreshTimeout = 0;
- setSortKey(pl, PERCENT_MEM, panel, settings);
+ setSortKey(pl, defaultBar, PERCENT_MEM, panel, settings);
break;
}
case 'T':
{
refreshTimeout = 0;
- setSortKey(pl, TIME, panel, settings);
+ setSortKey(pl, defaultBar, TIME, panel, settings);
+ break;
+ }
+ case 'c':
+ {
+ Process* p = (Process*) Panel_getSelected(panel);
+ if (!p) break;
+ tagAllChildren(panel, p);
break;
}
case 'U':
@@ -666,7 +680,7 @@ int main(int argc, char** argv) {
case 'P':
{
refreshTimeout = 0;
- setSortKey(pl, PERCENT_CPU, panel, settings);
+ setSortKey(pl, defaultBar, PERCENT_CPU, panel, settings);
break;
}
case KEY_F(1):
@@ -740,7 +754,7 @@ int main(int argc, char** argv) {
}
case 'u':
{
- Panel* usersPanel = Panel_new(0, 0, 0, 0, LISTITEM_CLASS, true, ListItem_compare);
+ Panel* usersPanel = Panel_new(0, 0, 0, 0, true, Class(ListItem));
Panel_setHeader(usersPanel, "Show processes of:");
UsersTable_foreach(ut, addUserToVector, usersPanel);
Vector_insertionSort(usersPanel->items);
@@ -762,22 +776,18 @@ int main(int argc, char** argv) {
case '=':
case '-':
{
- Process* p = (Process*) Panel_getSelected(panel);
- if (!p) break;
- p->showChildren = !p->showChildren;
- refreshTimeout = 0;
- doRecalculate = true;
+ if (expandCollapse(panel)) {
+ doRecalculate = true;
+ refreshTimeout = 0;
+ }
break;
}
case KEY_F(9):
case 'k':
{
- if (!killPanel) {
- killPanel = (Panel*) SignalsPanel_new(0, 0, 0, 0);
- }
- SignalsPanel_reset((SignalsPanel*) killPanel);
+ Panel* signalsPanel = (Panel*) SignalsPanel_new();
const char* fuFunctions[] = {"Send ", "Cancel ", NULL};
- ListItem* sgn = (ListItem*) pickFromVector(panel, killPanel, 15, headerHeight, fuFunctions, defaultBar, header);
+ ListItem* sgn = (ListItem*) pickFromVector(panel, signalsPanel, 15, headerHeight, fuFunctions, defaultBar, header);
if (sgn) {
if (sgn->key != 0) {
Panel_setHeader(panel, "Sending...");
@@ -788,6 +798,7 @@ int main(int argc, char** argv) {
}
}
ProcessList_printHeader(pl, Panel_getHeader(panel));
+ Panel_delete((Object*)signalsPanel);
refreshTimeout = 0;
break;
}
@@ -824,31 +835,25 @@ int main(int argc, char** argv) {
break;
case '<':
case ',':
- case KEY_F(18):
case '>':
case '.':
+ {
+ sortBy(panel, pl, settings, headerHeight, defaultBar, header);
+ refreshTimeout = 0;
+ break;
+ }
+ case KEY_F(18):
case KEY_F(6):
{
- Panel* sortPanel = Panel_new(0, 0, 0, 0, LISTITEM_CLASS, true, ListItem_compare);
- Panel_setHeader(sortPanel, "Sort by");
- const char* fuFunctions[] = {"Sort ", "Cancel ", NULL};
- ProcessField* fields = pl->fields;
- for (int i = 0; fields[i]; i++) {
- char* name = String_trim(Process_fieldTitles[fields[i]]);
- Panel_add(sortPanel, (Object*) ListItem_new(name, fields[i]));
- if (fields[i] == pl->sortKey)
- Panel_setSelected(sortPanel, i);
- free(name);
- }
- ListItem* field = (ListItem*) pickFromVector(panel, sortPanel, 15, headerHeight, fuFunctions, defaultBar, header);
- if (field) {
- settings->changed = true;
- setSortKey(pl, field->key, panel, settings);
+ if (pl->treeView) {
+ if (expandCollapse(panel)) {
+ doRecalculate = true;
+ refreshTimeout = 0;
+ }
} else {
- ProcessList_printHeader(pl, Panel_getHeader(panel));
+ sortBy(panel, pl, settings, headerHeight, defaultBar, header);
+ refreshTimeout = 0;
}
- ((Object*)sortPanel)->delete((Object*)sortPanel);
- refreshTimeout = 0;
break;
}
case 'i':
@@ -891,21 +896,19 @@ int main(int argc, char** argv) {
}
case KEY_F(3):
case '/':
- incMode = &incSearch;
- IncBuffer_reset(incMode);
- FunctionBar_draw(incSearch.bar, incSearch.buffer);
+ IncSet_activate(inc, INC_SEARCH);
break;
case KEY_F(4):
case '\\':
- incMode = &incFilter;
+ IncSet_activate(inc, INC_FILTER);
refreshTimeout = 0;
doRefresh = true;
- FunctionBar_draw(incFilter.bar, incFilter.buffer);
continue;
case 't':
case KEY_F(5):
refreshTimeout = 0;
- pl->treeView = !pl->treeView;
+ collapsed = false;
+ setTreeView(pl, defaultBar, !pl->treeView);
if (pl->treeView) pl->direction = 1;
ProcessList_printHeader(pl, Panel_getHeader(panel));
ProcessList_expandTree(pl);
@@ -943,12 +946,9 @@ int main(int argc, char** argv) {
Settings_write(settings);
Header_delete(header);
ProcessList_delete(pl);
- FunctionBar_delete((Object*)incFilter.bar);
- FunctionBar_delete((Object*)incSearch.bar);
+ IncSet_delete(inc);
FunctionBar_delete((Object*)defaultBar);
Panel_delete((Object*)panel);
- if (killPanel)
- ((Object*)killPanel)->delete((Object*)killPanel);
UsersTable_delete(ut);
Settings_delete(settings);
if(pidWhiteList) {
diff --git a/htop.h b/htop.h
index 8d8ed7e..354a2f9 100644
--- a/htop.h
+++ b/htop.h
@@ -11,13 +11,11 @@ in the source distribution for its full text.
//#link m
-#define INCSEARCH_MAX 40
-
-#define COPYRIGHT "(C) 2004-2011 Hisham Muhammad"
+#define COPYRIGHT "(C) 2004-2012 Hisham Muhammad"
typedef bool(*ForeachProcessFn)(Process*, size_t);
-typedef struct IncBuffer_;
+void sortBy(Panel* panel, ProcessList* pl, Settings* settings, int headerHeight, FunctionBar* defaultBar, Header* header);
int main(int argc, char** argv);
diff --git a/htop.png b/htop.png
index 2b16ebd..b040135 100644
--- a/htop.png
+++ b/htop.png
Binary files differ
diff --git a/install-sh b/install-sh
index a5897de..6781b98 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2006-12-25.00
+scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -515,5 +515,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/missing b/missing
index 1c8ff70..28055d2 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2006-05-10.23
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -89,6 +87,9 @@ Supported PROGRAM values:
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
@@ -106,15 +107,22 @@ Send bug reports to <bug-automake@gnu.org>."
esac
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
-# the program).
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
case $1 in
- lex|yacc)
+ lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
- tar)
+ tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
@@ -138,7 +146,7 @@ esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case $1 in
+case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -148,7 +156,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch aclocal.m4
;;
- autoconf)
+ autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
@@ -157,7 +165,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch configure
;;
- autoheader)
+ autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
@@ -187,7 +195,7 @@ WARNING: \`$1' is $msg. You should only need it if
while read f; do touch "$f"; done
;;
- autom4te)
+ autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
@@ -210,7 +218,7 @@ WARNING: \`$1' is needed, but is $msg.
fi
;;
- bison|yacc)
+ bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
@@ -240,7 +248,7 @@ WARNING: \`$1' $msg. You should only need it if
fi
;;
- lex|flex)
+ lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
@@ -263,7 +271,7 @@ WARNING: \`$1' is $msg. You should only need it if
fi
;;
- help2man)
+ help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
@@ -277,11 +285,11 @@ WARNING: \`$1' is $msg. You should only need it if
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
- exit 1
+ exit $?
fi
;;
- makeinfo)
+ makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -310,7 +318,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
- tar)
+ tar*)
shift
# We have already tried tar in the generic part.
@@ -363,5 +371,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/scripts/MakeHeader.py b/scripts/MakeHeader.py
index 55eeed4..c0fdc85 100755
--- a/scripts/MakeHeader.py
+++ b/scripts/MakeHeader.py
@@ -28,8 +28,8 @@ selfheader = '#include "' + name + '.h"'
out.write( "/* Do not edit this file. It was automatically generated. */" )
out.write( "" )
-out.write( "#ifndef HEADER_" + name )
-out.write( "#define HEADER_" + name )
+out.write( "#ifndef HEADER_" + os.path.basename(name) )
+out.write( "#define HEADER_" + os.path.basename(name) )
is_blank = False
for line in file.readlines():
line = line[:-1]

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