aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartosz Fenski <fenio@debian.org>2005-11-04 17:25:27 +0100
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:19 +0200
commit55a3aa9e6a59c1bf0248869d9f08e31ec4057c61 (patch)
treee45fc349e224501aa3c3dfedbbd6e8f04a8ab62e
parent435b6ae69f41d58f3eefdfcbd63e739387868057 (diff)
parent2c8c1a156130aa40be7dcaeb3ce2977a03cf50c2 (diff)
downloaddebian_htop-55a3aa9e6a59c1bf0248869d9f08e31ec4057c61.tar.gz
debian_htop-55a3aa9e6a59c1bf0248869d9f08e31ec4057c61.tar.bz2
debian_htop-55a3aa9e6a59c1bf0248869d9f08e31ec4057c61.zip
Imported Debian patch 0.5.4-1debian/0.5.4-1
-rw-r--r--CPUMeter.c16
-rw-r--r--CRT.c431
-rw-r--r--CRT.h27
-rw-r--r--CategoriesListBox.c21
-rw-r--r--CategoriesListBox.h4
-rw-r--r--ChangeLog13
-rw-r--r--CheckItem.c1
-rw-r--r--ClockMeter.c4
-rw-r--r--ColorsListBox.c98
-rw-r--r--ColorsListBox.h32
-rw-r--r--FunctionBar.c4
-rw-r--r--Header.c7
-rw-r--r--ListBox.c4
-rw-r--r--LoadAverageMeter.c6
-rw-r--r--LoadMeter.c4
-rw-r--r--Makefile.am3
-rw-r--r--Makefile.in13
-rw-r--r--MemoryMeter.c12
-rw-r--r--Meter.c16
-rw-r--r--Meter.h2
-rw-r--r--Process.c4
-rw-r--r--Process.h4
-rw-r--r--ProcessList.c14
-rw-r--r--ProcessList.h4
-rw-r--r--README4
-rw-r--r--Settings.c34
-rw-r--r--Settings.h3
-rw-r--r--SignalItem.c4
-rw-r--r--SwapMeter.c2
-rw-r--r--TODO4
-rw-r--r--TasksMeter.c2
-rw-r--r--UptimeMeter.c2
-rw-r--r--UsersTable.c4
-rw-r--r--aclocal.m4386
-rw-r--r--config.h6
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog7
-rw-r--r--htop.c35
-rw-r--r--htop.h4
40 files changed, 755 insertions, 508 deletions
diff --git a/CPUMeter.c b/CPUMeter.c
index d624802..8e9918b 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - CPUMeter.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -49,9 +49,9 @@ CPUMeter* CPUMeter_new(ProcessList* pl, int processor) {
Meter_init((Meter*)this, NULL, caption, 3);
((Meter*)this)->name = malloc(20);
sprintf(((Meter*)this)->name, "CPU(%d)", processor);
- ((Meter*)this)->attributes[0] = CRT_colors[CPU_NICE];
- ((Meter*)this)->attributes[1] = CRT_colors[CPU_NORMAL];
- ((Meter*)this)->attributes[2] = CRT_colors[CPU_KERNEL];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[CPU_NICE]);
+ ((Meter*)this)->attributes[1] = &(CRT_colors[CPU_NORMAL]);
+ ((Meter*)this)->attributes[2] = &(CRT_colors[CPU_KERNEL]);
((Meter*)this)->setValues = CPUMeter_setValues;
((Object*)this)->display = CPUMeter_display;
((Meter*)this)->total = 1.0;
@@ -76,11 +76,11 @@ void CPUMeter_display(Object* cast, RichString* out) {
RichString_prune(out);
sprintf(buffer, "%5.1f%% ", this->values[1] * 100.0);
RichString_append(out, CRT_colors[METER_TEXT], ":");
- RichString_append(out, this->attributes[1], buffer);
+ RichString_append(out, *(this->attributes[1]), buffer);
sprintf(buffer, "%5.1f%% ", this->values[2] * 100.0);
RichString_append(out, CRT_colors[METER_TEXT], "sys:");
- RichString_append(out, this->attributes[2], buffer);
+ RichString_append(out, *(this->attributes[2]), buffer);
sprintf(buffer, "%5.1f%% ", this->values[0] * 100.0);
RichString_append(out, CRT_colors[METER_TEXT], "low:");
- RichString_append(out, this->attributes[0], buffer);
+ RichString_append(out, *(this->attributes[0]), buffer);
}
diff --git a/CRT.c b/CRT.c
index e7786fa..fa14811 100644
--- a/CRT.c
+++ b/CRT.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - CRT.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -16,19 +16,16 @@ in the source distribution for its full text.
#include "debug.h"
-#define WHITE_PAIR 0
-#define BLUE_PAIR 1
-#define GREEN_PAIR 2
-#define RED_PAIR 3
-#define BROWN_PAIR 4
-#define CYAN_PAIR 5
-#define BLACK_PAIR 6
-#define BLACK_CYAN_PAIR 7
-#define RED_CYAN_PAIR 8
-#define BLACK_GREEN_PAIR 9
-#define BLACK_WHITE_PAIR 10
+#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j)
-#define MIN_UPDATE_SLICE 15
+#define Black COLOR_BLACK
+#define Red COLOR_RED
+#define Green COLOR_GREEN
+#define Yellow COLOR_YELLOW
+#define Blue COLOR_BLUE
+#define Magenta COLOR_MAGENTA
+#define Cyan COLOR_CYAN
+#define White COLOR_WHITE
//#link curses
@@ -98,16 +95,25 @@ extern int CRT_colors[LAST_COLORELEMENT];
}*/
+// TODO: centralize these in Settings.
+
/* private property */
int CRT_delay;
/* private property */
+int CRT_colorScheme;
+
+/* private property */
int CRT_colors[LAST_COLORELEMENT];
-void CRT_init() {
+// TODO: pass an instance of Settings instead.
+
+void CRT_init(int delay, int colorScheme) {
initscr();
noecho();
- halfdelay(MIN_UPDATE_SLICE);
+ CRT_delay = delay;
+ CRT_colorScheme = colorScheme;
+ halfdelay(CRT_delay);
nonl();
intrflush(stdscr, false);
keypad(stdscr, true);
@@ -134,70 +140,50 @@ void CRT_init() {
#endif
signal(SIGTERM, CRT_handleSIGTERM);
use_default_colors();
- init_pair(BLUE_PAIR, COLOR_BLUE, -1);
- init_pair(GREEN_PAIR, COLOR_GREEN, -1);
- init_pair(RED_PAIR, COLOR_RED, -1);
- init_pair(BROWN_PAIR, COLOR_YELLOW, -1);
- init_pair(CYAN_PAIR, COLOR_CYAN, -1);
- init_pair(BLACK_PAIR, COLOR_BLACK, -1);
- init_pair(BLACK_PAIR, COLOR_BLACK, -1);
- init_pair(BLACK_CYAN_PAIR, COLOR_BLACK, COLOR_CYAN);
- init_pair(RED_CYAN_PAIR, COLOR_RED, COLOR_CYAN);
- init_pair(BLACK_GREEN_PAIR, COLOR_BLACK, COLOR_GREEN);
- init_pair(BLACK_WHITE_PAIR, COLOR_BLACK, COLOR_WHITE);
- if (has_colors()) {
- CRT_colors[RESET_COLOR] = A_NORMAL;
- CRT_colors[DEFAULT_COLOR] = A_NORMAL;
- CRT_colors[FUNCTION_BAR] = COLOR_PAIR(BLACK_CYAN_PAIR);
- CRT_colors[FUNCTION_KEY] = A_NORMAL;
- CRT_colors[PANEL_HEADER_FOCUS] = COLOR_PAIR(BLACK_GREEN_PAIR);
- CRT_colors[PANEL_HEADER_UNFOCUS] = COLOR_PAIR(BLACK_GREEN_PAIR);
- CRT_colors[PANEL_HIGHLIGHT_FOCUS] = COLOR_PAIR(BLACK_CYAN_PAIR);
- CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = COLOR_PAIR(BLACK_WHITE_PAIR);
- CRT_colors[FAILED_SEARCH] = COLOR_PAIR(RED_CYAN_PAIR);
- CRT_colors[UPTIME] = A_BOLD | COLOR_PAIR(CYAN_PAIR);
- CRT_colors[LARGE_NUMBER] = A_BOLD | COLOR_PAIR(RED_PAIR);
- CRT_colors[METER_TEXT] = COLOR_PAIR(CYAN_PAIR);
- CRT_colors[METER_VALUE] = A_BOLD | COLOR_PAIR(CYAN_PAIR);
- CRT_colors[LED_COLOR] = COLOR_PAIR(GREEN_PAIR);
- CRT_colors[TASKS_RUNNING] = A_BOLD | COLOR_PAIR(GREEN_PAIR);
- CRT_colors[PROCESS] = A_NORMAL;
- CRT_colors[PROCESS_SHADOW] = A_BOLD | COLOR_PAIR(BLACK_PAIR);
- CRT_colors[PROCESS_TAG] = A_BOLD | COLOR_PAIR(BROWN_PAIR);
- CRT_colors[PROCESS_MEGABYTES] = COLOR_PAIR(CYAN_PAIR);
- CRT_colors[PROCESS_BASENAME] = A_BOLD | COLOR_PAIR(CYAN_PAIR);
- CRT_colors[PROCESS_TREE] = COLOR_PAIR(CYAN_PAIR);
- CRT_colors[PROCESS_R_STATE] = COLOR_PAIR(GREEN_PAIR);
- CRT_colors[PROCESS_HIGH_PRIORITY] = COLOR_PAIR(RED_PAIR);
- CRT_colors[PROCESS_LOW_PRIORITY] = COLOR_PAIR(RED_PAIR);
- CRT_colors[BAR_BORDER] = A_BOLD;
- CRT_colors[BAR_SHADOW] = A_BOLD | COLOR_PAIR(BLACK_PAIR);
- CRT_colors[SWAP] = COLOR_PAIR(RED_PAIR);
- CRT_colors[GRAPH_1] = A_BOLD | COLOR_PAIR(RED_PAIR);
- CRT_colors[GRAPH_2] = COLOR_PAIR(RED_PAIR);
- CRT_colors[GRAPH_3] = A_BOLD | COLOR_PAIR(BROWN_PAIR);
- CRT_colors[GRAPH_4] = A_BOLD | COLOR_PAIR(GREEN_PAIR);
- CRT_colors[GRAPH_5] = COLOR_PAIR(GREEN_PAIR);
- CRT_colors[GRAPH_6] = COLOR_PAIR(CYAN_PAIR);
- CRT_colors[GRAPH_7] = A_BOLD | COLOR_PAIR(BLUE_PAIR);
- CRT_colors[GRAPH_8] = COLOR_PAIR(BLUE_PAIR);
- CRT_colors[GRAPH_9] = A_BOLD | COLOR_PAIR(BLACK_PAIR);
- CRT_colors[MEMORY_USED] = COLOR_PAIR(GREEN_PAIR);
- CRT_colors[MEMORY_BUFFERS] = COLOR_PAIR(BLUE_PAIR);
- CRT_colors[MEMORY_CACHE] = COLOR_PAIR(BROWN_PAIR);
- CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | COLOR_PAIR(BLACK_PAIR);
- CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL;
- CRT_colors[LOAD_AVERAGE_ONE] = A_BOLD;
- CRT_colors[LOAD] = A_BOLD;
- CRT_colors[HELP_BOLD] = A_BOLD | COLOR_PAIR(CYAN_PAIR);
- CRT_colors[CPU_NICE] = COLOR_PAIR(BLUE_PAIR);
- CRT_colors[CPU_NORMAL] = COLOR_PAIR(GREEN_PAIR);
- CRT_colors[CPU_KERNEL] = COLOR_PAIR(RED_PAIR);
- CRT_colors[CLOCK] = A_BOLD;
- CRT_colors[CHECK_BOX] = COLOR_PAIR(CYAN_PAIR);
- CRT_colors[CHECK_MARK] = A_BOLD;
- CRT_colors[CHECK_TEXT] = A_NORMAL;
+ if (!has_colors())
+ CRT_colorScheme = 1;
+ CRT_setColors(CRT_colorScheme);
+
+ mousemask(BUTTON1_PRESSED, NULL);
+}
+
+void CRT_done() {
+ curs_set(1);
+ endwin();
+}
+
+int CRT_readKey() {
+ nocbreak();
+ cbreak();
+ int ret = getch();
+ halfdelay(CRT_delay);
+ return ret;
+}
+
+void CRT_handleSIGSEGV(int signal) {
+ CRT_done();
+ fprintf(stderr, "Aborted. Please report bug at http://htop.sf.net");
+ exit(1);
+}
+
+void CRT_handleSIGTERM(int signal) {
+ CRT_done();
+ exit(0);
+}
+
+void CRT_setColors(int colorScheme) {
+ CRT_colorScheme = colorScheme;
+ if (colorScheme == COLORSCHEME_BLACKNIGHT) {
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++)
+ init_pair((7-i)*8+j, i, j);
} else {
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++)
+ init_pair((7-i)*8+j, i, (j==0?-1:j));
+ }
+
+ if (colorScheme == COLORSCHEME_MONOCHROME) {
CRT_colors[RESET_COLOR] = A_NORMAL;
CRT_colors[DEFAULT_COLOR] = A_NORMAL;
CRT_colors[FUNCTION_BAR] = A_REVERSE;
@@ -249,31 +235,266 @@ void CRT_init() {
CRT_colors[CHECK_BOX] = A_BOLD;
CRT_colors[CHECK_MARK] = A_NORMAL;
CRT_colors[CHECK_TEXT] = A_NORMAL;
+ } else if (CRT_colorScheme == COLORSCHEME_BLACKONWHITE) {
+ CRT_colors[RESET_COLOR] = ColorPair(Black,White);
+ CRT_colors[DEFAULT_COLOR] = ColorPair(Black,White);
+ CRT_colors[FUNCTION_BAR] = ColorPair(Black,Cyan);
+ CRT_colors[FUNCTION_KEY] = ColorPair(Black,White);
+ CRT_colors[PANEL_HEADER_FOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HIGHLIGHT_FOCUS] = ColorPair(Black,Cyan);
+ CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = ColorPair(Blue,White);
+ CRT_colors[FAILED_SEARCH] = ColorPair(Red,Cyan);
+ CRT_colors[UPTIME] = ColorPair(Yellow,White);
+ CRT_colors[LARGE_NUMBER] = ColorPair(Red,White);
+ CRT_colors[METER_TEXT] = ColorPair(Blue,White);
+ CRT_colors[METER_VALUE] = ColorPair(Black,White);
+ CRT_colors[LED_COLOR] = ColorPair(Green,White);
+ CRT_colors[TASKS_RUNNING] = ColorPair(Green,White);
+ CRT_colors[PROCESS] = ColorPair(Black,White);
+ CRT_colors[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,White);
+ CRT_colors[PROCESS_TAG] = ColorPair(White,Blue);
+ CRT_colors[PROCESS_MEGABYTES] = ColorPair(Blue,White);
+ CRT_colors[PROCESS_BASENAME] = ColorPair(Green,White);
+ CRT_colors[PROCESS_TREE] = ColorPair(Blue,White);
+ CRT_colors[PROCESS_R_STATE] = ColorPair(Green,White);
+ CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,White);
+ CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,White);
+ CRT_colors[BAR_BORDER] = ColorPair(Blue,White);
+ CRT_colors[BAR_SHADOW] = ColorPair(Black,White);
+ CRT_colors[SWAP] = ColorPair(Red,White);
+ CRT_colors[GRAPH_1] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_2] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_3] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_4] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_5] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_6] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_7] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_8] = ColorPair(Yellow,White);
+ CRT_colors[GRAPH_9] = ColorPair(Yellow,White);
+ CRT_colors[MEMORY_USED] = ColorPair(Green,White);
+ CRT_colors[MEMORY_BUFFERS] = 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);
+ CRT_colors[LOAD_AVERAGE_ONE] = ColorPair(Black,White);
+ CRT_colors[LOAD] = ColorPair(Black,White);
+ CRT_colors[HELP_BOLD] = ColorPair(Blue,White);
+ CRT_colors[CPU_NICE] = ColorPair(Cyan,White);
+ CRT_colors[CPU_NORMAL] = ColorPair(Green,White);
+ CRT_colors[CPU_KERNEL] = ColorPair(Red,White);
+ CRT_colors[CLOCK] = ColorPair(White,White);
+ CRT_colors[CHECK_BOX] = ColorPair(Blue,White);
+ CRT_colors[CHECK_MARK] = ColorPair(Black,White);
+ CRT_colors[CHECK_TEXT] = ColorPair(Black,White);
+ } else if (CRT_colorScheme == COLORSCHEME_BLACKONWHITE2) {
+ CRT_colors[RESET_COLOR] = ColorPair(Black,Black);
+ CRT_colors[DEFAULT_COLOR] = ColorPair(Black,Black);
+ CRT_colors[FUNCTION_BAR] = ColorPair(Black,Cyan);
+ CRT_colors[FUNCTION_KEY] = ColorPair(Black,Black);
+ CRT_colors[PANEL_HEADER_FOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HIGHLIGHT_FOCUS] = ColorPair(Black,Cyan);
+ CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = ColorPair(Blue,Black);
+ CRT_colors[FAILED_SEARCH] = ColorPair(Red,Cyan);
+ CRT_colors[UPTIME] = ColorPair(Yellow,Black);
+ CRT_colors[LARGE_NUMBER] = ColorPair(Red,Black);
+ CRT_colors[METER_TEXT] = ColorPair(Blue,Black);
+ CRT_colors[METER_VALUE] = ColorPair(Black,Black);
+ CRT_colors[LED_COLOR] = ColorPair(Green,Black);
+ CRT_colors[TASKS_RUNNING] = ColorPair(Green,Black);
+ CRT_colors[PROCESS] = ColorPair(Black,Black);
+ CRT_colors[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black);
+ CRT_colors[PROCESS_TAG] = ColorPair(White,Blue);
+ CRT_colors[PROCESS_MEGABYTES] = ColorPair(Blue,Black);
+ CRT_colors[PROCESS_BASENAME] = ColorPair(Green,Black);
+ CRT_colors[PROCESS_TREE] = ColorPair(Blue,Black);
+ CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black);
+ CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black);
+ CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black);
+ CRT_colors[BAR_BORDER] = ColorPair(Blue,Black);
+ CRT_colors[BAR_SHADOW] = ColorPair(Black,Black);
+ CRT_colors[SWAP] = ColorPair(Red,Black);
+ CRT_colors[GRAPH_1] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_2] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_3] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_4] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_5] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_6] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_7] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_8] = ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_9] = ColorPair(Yellow,Black);
+ CRT_colors[MEMORY_USED] = ColorPair(Green,Black);
+ CRT_colors[MEMORY_BUFFERS] = 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);
+ CRT_colors[LOAD_AVERAGE_ONE] = ColorPair(Black,Black);
+ CRT_colors[LOAD] = ColorPair(White,Black);
+ CRT_colors[HELP_BOLD] = ColorPair(Blue,Black);
+ CRT_colors[CPU_NICE] = ColorPair(Cyan,Black);
+ CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
+ CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
+ CRT_colors[CLOCK] = ColorPair(White,Black);
+ CRT_colors[CHECK_BOX] = ColorPair(Blue,Black);
+ CRT_colors[CHECK_MARK] = ColorPair(Black,Black);
+ CRT_colors[CHECK_TEXT] = ColorPair(Black,Black);
+ } else if (CRT_colorScheme == COLORSCHEME_MIDNIGHT) {
+ CRT_colors[RESET_COLOR] = ColorPair(White,Blue);
+ CRT_colors[DEFAULT_COLOR] = ColorPair(White,Blue);
+ CRT_colors[FUNCTION_BAR] = ColorPair(Black,Cyan);
+ CRT_colors[FUNCTION_KEY] = A_NORMAL;
+ CRT_colors[PANEL_HEADER_FOCUS] = ColorPair(Black,Cyan);
+ CRT_colors[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Cyan);
+ CRT_colors[PANEL_HIGHLIGHT_FOCUS] = ColorPair(Black,White);
+ CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[FAILED_SEARCH] = ColorPair(Red,Cyan);
+ CRT_colors[UPTIME] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Blue);
+ CRT_colors[METER_TEXT] = ColorPair(Cyan,Blue);
+ CRT_colors[METER_VALUE] = A_BOLD | ColorPair(Cyan,Blue);
+ CRT_colors[LED_COLOR] = ColorPair(Green,Blue);
+ CRT_colors[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Blue);
+ CRT_colors[PROCESS] = ColorPair(White,Blue);
+ CRT_colors[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Blue);
+ CRT_colors[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[PROCESS_MEGABYTES] = ColorPair(Cyan,Blue);
+ CRT_colors[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Blue);
+ CRT_colors[PROCESS_TREE] = ColorPair(Cyan,Blue);
+ CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Blue);
+ CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Blue);
+ CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Blue);
+ CRT_colors[BAR_BORDER] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[BAR_SHADOW] = ColorPair(Cyan,Blue);
+ CRT_colors[SWAP] = ColorPair(Red,Blue);
+ CRT_colors[GRAPH_1] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[GRAPH_2] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[GRAPH_3] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[GRAPH_4] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[GRAPH_5] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[GRAPH_6] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[GRAPH_7] = A_BOLD | ColorPair(Yellow,Blue);
+ CRT_colors[GRAPH_8] = A_BOLD | ColorPair(Yellow,Blue);
+ 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_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);
+ CRT_colors[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White,Blue);
+ CRT_colors[LOAD] = A_BOLD | ColorPair(White,Blue);
+ CRT_colors[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Blue);
+ CRT_colors[CPU_NICE] = 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[CLOCK] = ColorPair(White,Blue);
+ CRT_colors[CHECK_BOX] = ColorPair(Cyan,Blue);
+ CRT_colors[CHECK_MARK] = A_BOLD | ColorPair(White,Blue);
+ CRT_colors[CHECK_TEXT] = A_NORMAL | ColorPair(White,Blue);
+ } else if (CRT_colorScheme == COLORSCHEME_BLACKNIGHT) {
+ CRT_colors[RESET_COLOR] = ColorPair(Cyan,Black);
+ CRT_colors[DEFAULT_COLOR] = ColorPair(Cyan,Black);
+ CRT_colors[FUNCTION_BAR] = ColorPair(Black,Green);
+ CRT_colors[FUNCTION_KEY] = ColorPair(Cyan,Black);
+ CRT_colors[PANEL_HEADER_FOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HIGHLIGHT_FOCUS] = ColorPair(Black,Cyan);
+ CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = ColorPair(Black,White);
+ CRT_colors[FAILED_SEARCH] = ColorPair(Red,Cyan);
+ CRT_colors[UPTIME] = ColorPair(Green,Black);
+ CRT_colors[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black);
+ CRT_colors[METER_TEXT] = ColorPair(Cyan,Black);
+ CRT_colors[METER_VALUE] = ColorPair(Green,Black);
+ CRT_colors[LED_COLOR] = ColorPair(Green,Black);
+ CRT_colors[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[PROCESS] = ColorPair(Cyan,Black);
+ CRT_colors[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black);
+ CRT_colors[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black);
+ CRT_colors[PROCESS_MEGABYTES] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[PROCESS_BASENAME] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[PROCESS_TREE] = ColorPair(Cyan,Black);
+ CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black);
+ CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black);
+ CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black);
+ CRT_colors[BAR_BORDER] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[BAR_SHADOW] = ColorPair(Cyan,Black);
+ CRT_colors[SWAP] = ColorPair(Red,Black);
+ CRT_colors[GRAPH_1] = A_BOLD | ColorPair(Red,Black);
+ CRT_colors[GRAPH_2] = ColorPair(Red,Black);
+ CRT_colors[GRAPH_3] = A_BOLD | ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_4] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[GRAPH_5] = ColorPair(Green,Black);
+ CRT_colors[GRAPH_6] = ColorPair(Cyan,Black);
+ CRT_colors[GRAPH_7] = A_BOLD | ColorPair(Blue,Black);
+ CRT_colors[GRAPH_8] = ColorPair(Blue,Black);
+ 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_CACHE] = ColorPair(Yellow,Black);
+ CRT_colors[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green,Black);
+ CRT_colors[LOAD_AVERAGE_FIVE] = ColorPair(Green,Black);
+ CRT_colors[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[LOAD] = A_BOLD;
+ CRT_colors[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black);
+ CRT_colors[CPU_NICE] = ColorPair(Blue,Black);
+ CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
+ CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
+ CRT_colors[CLOCK] = A_BOLD;
+ CRT_colors[CHECK_BOX] = ColorPair(Green,Black);
+ CRT_colors[CHECK_MARK] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[CHECK_TEXT] = ColorPair(Cyan,Black);
+ } else {
+ /* Default */
+ CRT_colors[RESET_COLOR] = ColorPair(White,Black);
+ CRT_colors[DEFAULT_COLOR] = ColorPair(White,Black);
+ CRT_colors[FUNCTION_BAR] = ColorPair(Black,Cyan);
+ CRT_colors[FUNCTION_KEY] = ColorPair(White,Black);
+ CRT_colors[PANEL_HEADER_FOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green);
+ CRT_colors[PANEL_HIGHLIGHT_FOCUS] = ColorPair(Black,Cyan);
+ CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = ColorPair(Black,White);
+ CRT_colors[FAILED_SEARCH] = ColorPair(Red,Cyan);
+ CRT_colors[UPTIME] = A_BOLD | ColorPair(Cyan,Black);
+ CRT_colors[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black);
+ CRT_colors[METER_TEXT] = ColorPair(Cyan,Black);
+ CRT_colors[METER_VALUE] = A_BOLD | ColorPair(Cyan,Black);
+ CRT_colors[LED_COLOR] = ColorPair(Green,Black);
+ CRT_colors[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[PROCESS] = A_NORMAL;
+ CRT_colors[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black);
+ CRT_colors[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black);
+ CRT_colors[PROCESS_MEGABYTES] = ColorPair(Cyan,Black);
+ CRT_colors[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black);
+ CRT_colors[PROCESS_TREE] = ColorPair(Cyan,Black);
+ CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black);
+ CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black);
+ CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black);
+ CRT_colors[BAR_BORDER] = A_BOLD;
+ CRT_colors[BAR_SHADOW] = A_BOLD | ColorPair(Black,Black);
+ CRT_colors[SWAP] = ColorPair(Red,Black);
+ CRT_colors[GRAPH_1] = A_BOLD | ColorPair(Red,Black);
+ CRT_colors[GRAPH_2] = ColorPair(Red,Black);
+ CRT_colors[GRAPH_3] = A_BOLD | ColorPair(Yellow,Black);
+ CRT_colors[GRAPH_4] = A_BOLD | ColorPair(Green,Black);
+ CRT_colors[GRAPH_5] = ColorPair(Green,Black);
+ CRT_colors[GRAPH_6] = ColorPair(Cyan,Black);
+ CRT_colors[GRAPH_7] = A_BOLD | ColorPair(Blue,Black);
+ CRT_colors[GRAPH_8] = ColorPair(Blue,Black);
+ 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_CACHE] = ColorPair(Yellow,Black);
+ CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Black);
+ CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL;
+ CRT_colors[LOAD_AVERAGE_ONE] = A_BOLD;
+ CRT_colors[LOAD] = A_BOLD;
+ CRT_colors[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black);
+ CRT_colors[CPU_NICE] = ColorPair(Blue,Black);
+ CRT_colors[CPU_NORMAL] = ColorPair(Green,Black);
+ CRT_colors[CPU_KERNEL] = ColorPair(Red,Black);
+ CRT_colors[CLOCK] = A_BOLD;
+ CRT_colors[CHECK_BOX] = ColorPair(Cyan,Black);
+ CRT_colors[CHECK_MARK] = A_BOLD;
+ CRT_colors[CHECK_TEXT] = A_NORMAL;
}
-
- mousemask(BUTTON1_PRESSED, NULL);
-}
-
-void CRT_done() {
- curs_set(1);
- endwin();
-}
-
-int CRT_readKey() {
- nocbreak();
- cbreak();
- int ret = getch();
- halfdelay(CRT_delay);
- return ret;
-}
-
-void CRT_handleSIGSEGV(int signal) {
- CRT_done();
- fprintf(stderr, "Aborted. Please report bug at http://htop.sf.net");
- exit(1);
-}
-
-void CRT_handleSIGTERM(int signal) {
- CRT_done();
- exit(0);
}
diff --git a/CRT.h b/CRT.h
index 8e08eee..2bdcd9d 100644
--- a/CRT.h
+++ b/CRT.h
@@ -3,8 +3,8 @@
#ifndef HEADER_CRT
#define HEADER_CRT
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - CRT.h
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -19,19 +19,12 @@ in the source distribution for its full text.
#include "debug.h"
-#define WHITE_PAIR 0
-#define BLUE_PAIR 1
-#define GREEN_PAIR 2
-#define RED_PAIR 3
-#define BROWN_PAIR 4
-#define CYAN_PAIR 5
-#define BLACK_PAIR 6
-#define BLACK_CYAN_PAIR 7
-#define RED_CYAN_PAIR 8
-#define BLACK_GREEN_PAIR 9
-#define BLACK_WHITE_PAIR 10
-
-#define MIN_UPDATE_SLICE 15
+#define COLORSCHEME_DEFAULT 0
+#define COLORSCHEME_MONOCHROME 1
+#define COLORSCHEME_BLACKONWHITE 2
+#define COLORSCHEME_BLACKONWHITE2 3
+#define COLORSCHEME_MIDNIGHT 4
+#define COLORSCHEME_BLACKNIGHT 5
//#link curses
@@ -96,6 +89,8 @@ typedef enum ColorElements_ {
extern int CRT_colors[LAST_COLORELEMENT];
+extern int CRT_colorScheme;
+
extern int CRT_delay;
void CRT_init();
@@ -108,4 +103,6 @@ void CRT_handleSIGSEGV(int signal);
void CRT_handleSIGTERM(int signal);
+void CRT_setColors(int colorScheme);
+
#endif
diff --git a/CategoriesListBox.c b/CategoriesListBox.c
index c2b6c67..249f75c 100644
--- a/CategoriesListBox.c
+++ b/CategoriesListBox.c
@@ -3,6 +3,7 @@
#include "AvailableMetersListBox.h"
#include "MetersListBox.h"
#include "DisplayOptionsListBox.h"
+#include "ColorsListBox.h"
#include "ListBox.h"
@@ -26,6 +27,9 @@ char* MetersFunctions[10] = {" ", " ", " ", "Type ", "Add L ", "
/* private property */
char* DisplayOptionsFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "};
+/* private property */
+char* ColorsFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "};
+
CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr) {
CategoriesListBox* this = (CategoriesListBox*) malloc(sizeof(CategoriesListBox));
ListBox* super = (ListBox*) this;
@@ -38,6 +42,7 @@ CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr)
ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Setup"));
ListBox_add(super, (Object*) ListItem_new(String_copy("Meters")));
ListBox_add(super, (Object*) ListItem_new(String_copy("Display options")));
+ ListBox_add(super, (Object*) ListItem_new(String_copy("Colors")));
return this;
}
@@ -73,7 +78,10 @@ HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) {
CategoriesListBox_makeMetersPage(this);
break;
case 1:
- CategoriesListBox_makeProcessListPage(this);
+ CategoriesListBox_makeDisplayOptionsPage(this);
+ break;
+ case 2:
+ CategoriesListBox_makeColorsPage(this);
break;
}
}
@@ -84,6 +92,8 @@ HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) {
return result;
}
+// TODO: factor out common code from these functions into a generic makePage
+
void CategoriesListBox_makeMetersPage(CategoriesListBox* this) {
FunctionBar* fuBar = FunctionBar_new(10, MetersFunctions, NULL, NULL);
ListBox* lbLeftMeters = (ListBox*) MetersListBox_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr);
@@ -95,9 +105,16 @@ void CategoriesListBox_makeMetersPage(CategoriesListBox* this) {
ScreenManager_setFunctionBar(this->scr, fuBar);
}
-void CategoriesListBox_makeProcessListPage(CategoriesListBox* this) {
+void CategoriesListBox_makeDisplayOptionsPage(CategoriesListBox* this) {
FunctionBar* fuBar = FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL);
ListBox* lbDisplayOptions = (ListBox*) DisplayOptionsListBox_new(this->settings, this->scr);
ScreenManager_add(this->scr, lbDisplayOptions, -1);
ScreenManager_setFunctionBar(this->scr, fuBar);
}
+
+void CategoriesListBox_makeColorsPage(CategoriesListBox* this) {
+ FunctionBar* fuBar = FunctionBar_new(10, ColorsFunctions, NULL, NULL);
+ ListBox* lbColors = (ListBox*) ColorsListBox_new(this->settings, this->scr);
+ ScreenManager_add(this->scr, lbColors, -1);
+ ScreenManager_setFunctionBar(this->scr, fuBar);
+}
diff --git a/CategoriesListBox.h b/CategoriesListBox.h
index df1a387..fa68d4b 100644
--- a/CategoriesListBox.h
+++ b/CategoriesListBox.h
@@ -31,6 +31,8 @@ HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch);
void CategoriesListBox_makeMetersPage(CategoriesListBox* this);
-void CategoriesListBox_makeProcessListPage(CategoriesListBox* this);
+void CategoriesListBox_makeDisplayOptionsPage(CategoriesListBox* this);
+
+void CategoriesListBox_makeColorsPage(CategoriesListBox* this);
#endif
diff --git a/ChangeLog b/ChangeLog
index 993a83d..f2eb9b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,17 @@
+What's new in version 0.5.4
+
+* Color schemes
+* -d flag, to configure delay between updates.
+ Note that the delay value is saved in ~/.htoprc.
+* BUGFIX: Update of meters was halting after help screen.
+ (thanks to Matt Moore)
+* BUGFIX: No longer display incorrect information
+ in first frame.
+* BUGFIX: Fix auto-detection of /proc/stat,
+ correcting CPU usage information on multiprocessor
+ systems.
+
What's new in version 0.5.3
* Read new field "steal" on newer /proc/stat files
diff --git a/CheckItem.c b/CheckItem.c
index 0c42867..de7c30b 100644
--- a/CheckItem.c
+++ b/CheckItem.c
@@ -17,6 +17,7 @@ typedef struct CheckItem_ {
Object super;
char* text;
bool* value;
+ bool radio;
} CheckItem;
extern char* CHECKITEM_CLASS;
diff --git a/ClockMeter.c b/ClockMeter.c
index 645910c..9469a35 100644
--- a/ClockMeter.c
+++ b/ClockMeter.c
@@ -30,7 +30,7 @@ struct ClockMeter_ {
ClockMeter* ClockMeter_new() {
ClockMeter* this = malloc(sizeof(ClockMeter));
Meter_init((Meter*)this, String_copy("Clock"), String_copy("Time: "), 1);
- ((Meter*)this)->attributes[0] = CRT_colors[CLOCK];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[CLOCK]);
((Meter*)this)->setValues = ClockMeter_setValues;
((Object*)this)->display = ClockMeter_display;
((Meter*)this)->total = 24 * 60;
@@ -50,5 +50,5 @@ void ClockMeter_setValues(Meter* cast) {
void ClockMeter_display(Object* cast, RichString* out) {
Meter* super = (Meter*) cast;
ClockMeter* this = (ClockMeter*) cast;
- RichString_write(out, super->attributes[0], this->clock);
+ RichString_write(out, *(super->attributes[0]), this->clock);
}
diff --git a/ColorsListBox.c b/ColorsListBox.c
new file mode 100644
index 0000000..37593bb
--- /dev/null
+++ b/ColorsListBox.c
@@ -0,0 +1,98 @@
+
+#include "CRT.h"
+#include "ColorsListBox.h"
+
+#include "ListBox.h"
+#include "CheckItem.h"
+#include "Settings.h"
+#include "ScreenManager.h"
+
+#include "debug.h"
+#include <assert.h>
+
+// TO ADD A NEW SCHEME:
+// * Increment the size of bool check in ColorsListBox.h
+// * Add the entry in the ColorSchemes array below in the file
+// * Add a define in CRT.h that matches the order of the array
+// * Add the colors in CRT_setColors
+
+/*{
+
+typedef struct ColorsListBox_ {
+ ListBox super;
+
+ Settings* settings;
+ ScreenManager* scr;
+ bool check[5];
+} ColorsListBox;
+
+}*/
+
+/* private property */
+static char* ColorSchemes[] = {
+ "Default",
+ "Monochromatic",
+ "Black on White",
+ "Light Terminal",
+ "MC",
+ "Black Night",
+ NULL
+};
+
+ColorsListBox* ColorsListBox_new(Settings* settings, ScreenManager* scr) {
+ ColorsListBox* this = (ColorsListBox*) malloc(sizeof(ColorsListBox));
+ ListBox* super = (ListBox*) this;
+ ListBox_init(super, 1, 1, 1, 1, CHECKITEM_CLASS, true);
+ ((Object*)this)->delete = ColorsListBox_delete;
+
+ this->settings = settings;
+ this->scr = scr;
+ super->eventHandler = ColorsListBox_eventHandler;
+
+ ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Colors"));
+ for (int i = 0; ColorSchemes[i] != NULL; i++) {
+ ListBox_add(super, (Object*) CheckItem_new(String_copy(ColorSchemes[i]), &(this->check[i])));
+ this->check[i] = false;
+ }
+ this->check[settings->colorScheme] = true;
+ return this;
+}
+
+void ColorsListBox_delete(Object* object) {
+ ListBox* super = (ListBox*) object;
+ ColorsListBox* this = (ColorsListBox*) object;
+ ListBox_done(super);
+ free(this);
+}
+
+HandlerResult ColorsListBox_eventHandler(ListBox* super, int ch) {
+ ColorsListBox* this = (ColorsListBox*) super;
+
+ HandlerResult result = IGNORED;
+ int mark = ListBox_getSelectedIndex(super);
+
+ switch(ch) {
+ case 0x0a:
+ case 0x0d:
+ case KEY_ENTER:
+ case ' ':
+ for (int i = 0; ColorSchemes[i] != NULL; i++) {
+ this->check[i] = false;
+ }
+ this->check[mark] = true;
+ this->settings->colorScheme = mark;
+ result = HANDLED;
+ }
+
+ if (result == HANDLED) {
+ Header* header = this->settings->header;
+ CRT_setColors(mark);
+ ListBox* lbMenu = (ListBox*) TypedVector_get(this->scr->items, 0);
+ Header_draw(header);
+ RichString_setAttr(&(super->header), CRT_colors[PANEL_HEADER_FOCUS]);
+ RichString_setAttr(&(lbMenu->header), CRT_colors[PANEL_HEADER_UNFOCUS]);
+ ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2);
+ }
+ return result;
+}
+
diff --git a/ColorsListBox.h b/ColorsListBox.h
new file mode 100644
index 0000000..df3b635
--- /dev/null
+++ b/ColorsListBox.h
@@ -0,0 +1,32 @@
+/* Do not edit this file. It was automatically genarated. */
+
+#ifndef HEADER_ColorsListBox
+#define HEADER_ColorsListBox
+
+
+#include "ListBox.h"
+#include "CheckItem.h"
+#include "Settings.h"
+#include "ScreenManager.h"
+
+#include "debug.h"
+#include <assert.h>
+
+
+typedef struct ColorsListBox_ {
+ ListBox super;
+
+ Settings* settings;
+ ScreenManager* scr;
+ bool check[5];
+} ColorsListBox;
+
+
+ColorsListBox* ColorsListBox_new(Settings* settings, ScreenManager* scr);
+
+void ColorsListBox_delete(Object* object);
+
+HandlerResult ColorsListBox_eventHandler(ListBox* super, int ch);
+
+
+#endif
diff --git a/FunctionBar.c b/FunctionBar.c
index d2ad57b..ecbef80 100644
--- a/FunctionBar.c
+++ b/FunctionBar.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - FunctionBar.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
diff --git a/Header.c b/Header.c
index 9068817..a101821 100644
--- a/Header.c
+++ b/Header.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - Header.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -36,7 +36,9 @@ typedef struct Header_ {
}*/
+#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
+#endif
Header* Header_new(ProcessList* pl) {
Header* this = malloc(sizeof(Header));
@@ -139,6 +141,7 @@ void Header_draw(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/ListBox.c b/ListBox.c
index a00f0dd..3d5352b 100644
--- a/ListBox.c
+++ b/ListBox.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - ListBox.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c
index 7add62d..3ef03cb 100644
--- a/LoadAverageMeter.c
+++ b/LoadAverageMeter.c
@@ -31,9 +31,9 @@ void LoadAverageMeter_scan(double* one, double* five, double* fifteen);
LoadAverageMeter* LoadAverageMeter_new() {
LoadAverageMeter* this = malloc(sizeof(LoadAverageMeter));
Meter_init((Meter*)this, String_copy("LoadAverage"), String_copy("Load average: "), 3);
- ((Meter*)this)->attributes[0] = CRT_colors[LOAD_AVERAGE_FIFTEEN];
- ((Meter*)this)->attributes[1] = CRT_colors[LOAD_AVERAGE_FIVE];
- ((Meter*)this)->attributes[2] = CRT_colors[LOAD_AVERAGE_ONE];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[LOAD_AVERAGE_FIFTEEN]);
+ ((Meter*)this)->attributes[1] = &(CRT_colors[LOAD_AVERAGE_FIVE]);
+ ((Meter*)this)->attributes[2] = &(CRT_colors[LOAD_AVERAGE_ONE]);
((Object*)this)->display = LoadAverageMeter_display;
((Meter*)this)->setValues = LoadAverageMeter_setValues;
Meter_setMode((Meter*)this, TEXT);
diff --git a/LoadMeter.c b/LoadMeter.c
index ce6b098..c2b2af7 100644
--- a/LoadMeter.c
+++ b/LoadMeter.c
@@ -26,7 +26,7 @@ struct LoadMeter_ {
LoadMeter* LoadMeter_new() {
LoadMeter* this = malloc(sizeof(LoadMeter));
Meter_init((Meter*)this, String_copy("Load"), String_copy("Load: "), 1);
- ((Meter*)this)->attributes[0] = CRT_colors[LOAD];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[LOAD]);
((Meter*)this)->setValues = LoadMeter_setValues;
((Object*)this)->display = LoadMeter_display;
Meter_setMode((Meter*)this, GRAPH);
@@ -58,5 +58,5 @@ void LoadMeter_display(Object* cast, RichString* out) {
char buffer[20];
RichString_prune(out);
sprintf(buffer, "%.2f ", ((Meter*)this)->values[0]);
- RichString_append(out, super->attributes[0], buffer);
+ RichString_append(out, *(super->attributes[0]), buffer);
}
diff --git a/Makefile.am b/Makefile.am
index 2302b3f..d1734a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,4 +18,5 @@ DisplayOptionsListBox.h FunctionBar.h Hashtable.h Header.h htop.h ListBox.h \
ListItem.h LoadAverageMeter.h LoadMeter.h MemoryMeter.h Meter.h \
MetersListBox.h Object.h Process.h ProcessList.h RichString.h ScreenManager.h \
Settings.h SignalItem.h SignalsListBox.h String.h SwapMeter.h TasksMeter.h \
-TypedVector.h UptimeMeter.h UsersTable.h CheckItem.c CheckItem.h
+TypedVector.h UptimeMeter.h UsersTable.h CheckItem.c CheckItem.h \
+ColorsListBox.c ColorsListBox.h
diff --git a/Makefile.in b/Makefile.in
index bdcceb7..14f7672 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -14,8 +14,6 @@
@SET_MAKE@
-SOURCES = $(htop_SOURCES)
-
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -68,7 +66,8 @@ am_htop_OBJECTS = AvailableMetersListBox.$(OBJEXT) \
Settings.$(OBJEXT) SignalItem.$(OBJEXT) \
SignalsListBox.$(OBJEXT) String.$(OBJEXT) SwapMeter.$(OBJEXT) \
TasksMeter.$(OBJEXT) TypedVector.$(OBJEXT) \
- UptimeMeter.$(OBJEXT) UsersTable.$(OBJEXT) CheckItem.$(OBJEXT)
+ UptimeMeter.$(OBJEXT) UsersTable.$(OBJEXT) CheckItem.$(OBJEXT) \
+ ColorsListBox.$(OBJEXT)
htop_OBJECTS = $(am_htop_OBJECTS)
htop_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
@@ -183,7 +182,8 @@ DisplayOptionsListBox.h FunctionBar.h Hashtable.h Header.h htop.h ListBox.h \
ListItem.h LoadAverageMeter.h LoadMeter.h MemoryMeter.h Meter.h \
MetersListBox.h Object.h Process.h ProcessList.h RichString.h ScreenManager.h \
Settings.h SignalItem.h SignalsListBox.h String.h SwapMeter.h TasksMeter.h \
-TypedVector.h UptimeMeter.h UsersTable.h CheckItem.c CheckItem.h
+TypedVector.h UptimeMeter.h UsersTable.h CheckItem.c CheckItem.h \
+ColorsListBox.c ColorsListBox.h
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -279,6 +279,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CategoriesListBox.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CheckItem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClockMeter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ColorsListBox.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DebugMemory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DisplayOptionsListBox.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionBar.Po@am__quote@
diff --git a/MemoryMeter.c b/MemoryMeter.c
index 01a9ac1..43029ff 100644
--- a/MemoryMeter.c
+++ b/MemoryMeter.c
@@ -35,9 +35,9 @@ struct MemoryMeter_ {
MemoryMeter* MemoryMeter_new(ProcessList* pl) {
MemoryMeter* this = malloc(sizeof(MemoryMeter));
Meter_init((Meter*)this, String_copy("Memory"), String_copy("Mem"), 3);
- ((Meter*)this)->attributes[0] = CRT_colors[MEMORY_USED];
- ((Meter*)this)->attributes[1] = CRT_colors[MEMORY_BUFFERS];
- ((Meter*)this)->attributes[2] = CRT_colors[MEMORY_CACHE];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[MEMORY_USED]);
+ ((Meter*)this)->attributes[1] = &(CRT_colors[MEMORY_BUFFERS]);
+ ((Meter*)this)->attributes[2] = &(CRT_colors[MEMORY_CACHE]);
((Meter*)this)->setValues = MemoryMeter_setValues;
((Object*)this)->display = MemoryMeter_display;
this->pl = pl;
@@ -88,11 +88,11 @@ void MemoryMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_VALUE], buffer);
sprintf(buffer, format, usedMem);
RichString_append(out, CRT_colors[METER_TEXT], "used:");
- RichString_append(out, meter->attributes[0], buffer);
+ RichString_append(out, *(meter->attributes[0]), buffer);
sprintf(buffer, format, buffersMem);
RichString_append(out, CRT_colors[METER_TEXT], "buffers:");
- RichString_append(out, meter->attributes[1], buffer);
+ RichString_append(out, *(meter->attributes[1]), buffer);
sprintf(buffer, format, cachedMem);
RichString_append(out, CRT_colors[METER_TEXT], "cache:");
- RichString_append(out, meter->attributes[2], buffer);
+ RichString_append(out, *(meter->attributes[2]), buffer);
}
diff --git a/Meter.c b/Meter.c
index 45cf7e2..2e436e5 100644
--- a/Meter.c
+++ b/Meter.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - Meter.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -46,7 +46,7 @@ struct Meter_ {
Method_Meter_draw draw;
Method_Meter_setValues setValues;
int items;
- int* attributes;
+ int** attributes;
double* values;
double total;
char* caption;
@@ -92,7 +92,7 @@ void Meter_init(Meter* this, char* name, char* caption, int items) {
this->items = items;
this->name = name;
this->caption = caption;
- this->attributes = malloc(sizeof(int) * items);
+ this->attributes = malloc(sizeof(int*) * items);
this->values = malloc(sizeof(double) * items);
this->displayBuffer.c = NULL;
this->mode = UNSET;
@@ -179,10 +179,10 @@ void Meter_drawBar(Meter* this, int x, int y, int w) {
nextOffset = MIN(nextOffset, w);
for (int j = offset; j < nextOffset; j++)
if (bar[j] == ' ') {
- if (CRT_hasColors) {
- bar[j] = '|';
- } else {
+ if (CRT_colorScheme == COLORSCHEME_MONOCHROME) {
bar[j] = Meter_barCharacters[i];
+ } else {
+ bar[j] = '|';
}
}
offset = nextOffset;
@@ -192,7 +192,7 @@ void Meter_drawBar(Meter* this, int x, int y, int w) {
// ...then print the buffer.
offset = 0;
for (int i = 0; i < this->items; i++) {
- attrset(this->attributes[i]);
+ attrset(*(this->attributes[i]));
mvaddnstr(y, x + offset, bar + offset, blockSizes[i]);
offset += blockSizes[i];
offset = MAX(offset, 0);
diff --git a/Meter.h b/Meter.h
index eec820a..fff0e93 100644
--- a/Meter.h
+++ b/Meter.h
@@ -49,7 +49,7 @@ struct Meter_ {
Method_Meter_draw draw;
Method_Meter_setValues setValues;
int items;
- int* attributes;
+ int** attributes;
double* values;
double total;
char* caption;
diff --git a/Process.c b/Process.c
index 98f5abe..8333a17 100644
--- a/Process.c
+++ b/Process.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - Process.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
diff --git a/Process.h b/Process.h
index 77b5427..2b3b755 100644
--- a/Process.h
+++ b/Process.h
@@ -3,8 +3,8 @@
#ifndef HEADER_Process
#define HEADER_Process
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - Process.h
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
diff --git a/ProcessList.c b/ProcessList.c
index 93394fb..d5d4ddc 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - ProcessList.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -541,14 +541,18 @@ void ProcessList_scan(ProcessList* this) {
status = fopen(PROCSTATFILE, "r");
assert(status != NULL);
for (int i = 0; i <= this->processorCount; i++) {
+ char buffer[256];
int cpuid;
- int fieldsread;
long int ioWait, irq, softIrq, steal;
ioWait = irq = softIrq = steal = 0;
+ // Dependending on your kernel version,
+ // 5, 7 or 8 of these fields will be set.
+ // The rest will remain at zero.
+ fgets(buffer, 255, status);
if (i == 0)
- fieldsread = fscanf(status, "cpu %ld %ld %ld %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal);
+ sscanf(buffer, "cpu %ld %ld %ld %ld %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal);
else {
- fieldsread = fscanf(status, "cpu%d %ld %ld %ld %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal);
+ sscanf(buffer, "cpu%d %ld %ld %ld %ld %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal);
assert(cpuid == i - 1);
}
// Fields existing on kernels >= 2.6
diff --git a/ProcessList.h b/ProcessList.h
index 7968674..5817bad 100644
--- a/ProcessList.h
+++ b/ProcessList.h
@@ -3,8 +3,8 @@
#ifndef HEADER_ProcessList
#define HEADER_ProcessList
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - ProcessList.h
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
diff --git a/README b/README
index 88ce1f4..fde7f8a 100644
--- a/README
+++ b/README
@@ -1,8 +1,8 @@
htop
-by Hisham Muhammad <lode@gobolinux.org>
+by Hisham Muhammad <loderunner@users.sourceforge.net>
-May, 2004 - July, 2005
+May, 2004 - September, 2005
Introduction
~~~~~~~~~~~~
diff --git a/Settings.c b/Settings.c
index 9172d11..0e01999 100644
--- a/Settings.c
+++ b/Settings.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - Settings.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -12,12 +12,16 @@ in the source distribution for its full text.
#include "debug.h"
+#define DEFAULT_DELAY 15
+
/*{
typedef struct Settings_ {
char* userSettings;
ProcessList* pl;
Header* header;
+ int colorScheme;
+ int delay;
} Settings;
}*/
@@ -30,6 +34,8 @@ Settings* Settings_new(ProcessList* pl, Header* header) {
home = getenv("HOME_ETC");
if (!home) home = getenv("HOME");
this->userSettings = String_cat(home, "/.htoprc");
+ this->colorScheme = 0;
+ this->delay = DEFAULT_DELAY;
bool ok = Settings_read(this, this->userSettings);
if (!ok) {
// TODO: how to get SYSCONFDIR correctly through Autoconf?
@@ -88,7 +94,6 @@ bool Settings_read(Settings* this, char* fileName) {
buffer[0] = '\0';
fgets(buffer, maxLine, fd);
char** option = String_split(buffer, '=');
- // fields
if (String_eq(option[0], "fields")) {
char* trim = String_trim(option[1]);
char** ids = String_split(trim, ' ');
@@ -99,49 +104,41 @@ bool Settings_read(Settings* this, char* fileName) {
}
this->pl->fields[i] = LAST_PROCESSFIELD;
String_freeArray(ids);
- // sort_key
} else if (String_eq(option[0], "sort_key")) {
this->pl->sortKey = atoi(option[1]);
- // sort_direction
} else if (String_eq(option[0], "sort_direction")) {
this->pl->direction = atoi(option[1]);
- // tree_view
} else if (String_eq(option[0], "tree_view")) {
this->pl->treeView = atoi(option[1]);
- // hide_threads
} else if (String_eq(option[0], "hide_threads")) {
this->pl->hideThreads = atoi(option[1]);
- // hide_kernel_threads
} else if (String_eq(option[0], "hide_kernel_threads")) {
this->pl->hideKernelThreads = atoi(option[1]);
- // hide_kernel_threads
} else if (String_eq(option[0], "hide_userland_threads")) {
this->pl->hideUserlandThreads = atoi(option[1]);
- // shadow_other_users
} else if (String_eq(option[0], "shadow_other_users")) {
this->pl->shadowOtherUsers = atoi(option[1]);
- // highlight_base_name
} else if (String_eq(option[0], "highlight_base_name")) {
this->pl->highlightBaseName = atoi(option[1]);
- // highlight_megabytes
} else if (String_eq(option[0], "highlight_megabytes")) {
this->pl->highlightMegabytes = atoi(option[1]);
- // header_margin
} else if (String_eq(option[0], "header_margin")) {
this->header->margin = atoi(option[1]);
- // left_meters
+ } else if (String_eq(option[0], "delay")) {
+ this->delay = atoi(option[1]);
+ } else if (String_eq(option[0], "color_scheme")) {
+ this->colorScheme = atoi(option[1]);
+ if (this->colorScheme < 0) this->colorScheme = 0;
+ if (this->colorScheme > 5) this->colorScheme = 5;
} else if (String_eq(option[0], "left_meters")) {
Settings_readMeters(this, option[1], LEFT_HEADER);
readMeters = true;
- // right_meters
} else if (String_eq(option[0], "right_meters")) {
Settings_readMeters(this, option[1], RIGHT_HEADER);
readMeters = true;
- // left_meter_modes
} else if (String_eq(option[0], "left_meter_modes")) {
Settings_readMeterModes(this, option[1], LEFT_HEADER);
readMeters = true;
- // right_meter_modes
} else if (String_eq(option[0], "right_meter_modes")) {
Settings_readMeterModes(this, option[1], RIGHT_HEADER);
readMeters = true;
@@ -181,9 +178,10 @@ bool Settings_write(Settings* this) {
fprintf(fd, "highlight_megabytes=%d\n", (int) this->pl->highlightMegabytes);
fprintf(fd, "tree_view=%d\n", (int) this->pl->treeView);
fprintf(fd, "header_margin=%d\n", (int) this->header->margin);
+ fprintf(fd, "color_scheme=%d\n", (int) this->colorScheme);
+ fprintf(fd, "delay=%d\n", (int) this->delay);
fprintf(fd, "left_meters=");
for (int i = 0; i < Header_size(this->header, LEFT_HEADER); i++) {
-fprintf(stderr, "Field #%d\n", i);
fprintf(fd, "%s ", Header_readMeterName(this->header, i, LEFT_HEADER));
}
fprintf(fd, "\n");
diff --git a/Settings.h b/Settings.h
index db35b2e..74f9c71 100644
--- a/Settings.h
+++ b/Settings.h
@@ -15,11 +15,12 @@ in the source distribution for its full text.
#include "debug.h"
-
typedef struct Settings_ {
char* userSettings;
ProcessList* pl;
Header* header;
+ int colorScheme;
+ int delay;
} Settings;
diff --git a/SignalItem.c b/SignalItem.c
index 795fb94..2cef877 100644
--- a/SignalItem.c
+++ b/SignalItem.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - SignalItem.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
diff --git a/SwapMeter.c b/SwapMeter.c
index 5fa8b31..b22f56a 100644
--- a/SwapMeter.c
+++ b/SwapMeter.c
@@ -33,7 +33,7 @@ struct SwapMeter_ {
SwapMeter* SwapMeter_new(ProcessList* pl) {
SwapMeter* this = malloc(sizeof(SwapMeter));
Meter_init((Meter*)this, String_copy("Swap"), String_copy("Swp"), 1);
- ((Meter*)this)->attributes[0] = CRT_colors[SWAP];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[SWAP]);
((Meter*)this)->setValues = SwapMeter_setValues;
((Object*)this)->display = SwapMeter_display;
this->pl = pl;
diff --git a/TODO b/TODO
index 575f648..b98017c 100644
--- a/TODO
+++ b/TODO
@@ -8,6 +8,6 @@ FEATURES:
* make bars display refresh independent from list refresh
* auto-calibrate delay
* add some more 'top' features
- * add command-line parameters
+ * add more command-line parameters
* show 'process view'
- * make colors and keybindings configurable, blah blah blah...
+ * make keybindings configurable, blah blah blah...
diff --git a/TasksMeter.c b/TasksMeter.c
index b822172..75291c8 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -28,7 +28,7 @@ struct TasksMeter_ {
TasksMeter* TasksMeter_new(ProcessList* pl) {
TasksMeter* this = malloc(sizeof(TasksMeter));
Meter_init((Meter*)this, String_copy("Tasks"), String_copy("Tasks: "), 1);
- ((Meter*)this)->attributes[0] = CRT_colors[TASKS_RUNNING];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[TASKS_RUNNING]);
((Object*)this)->display = TasksMeter_display;
((Meter*)this)->setValues = TasksMeter_setValues;
this->pl = pl;
diff --git a/UptimeMeter.c b/UptimeMeter.c
index 66a0d91..3b27a98 100644
--- a/UptimeMeter.c
+++ b/UptimeMeter.c
@@ -32,7 +32,7 @@ struct UptimeMeter_ {
UptimeMeter* UptimeMeter_new() {
UptimeMeter* this = malloc(sizeof(UptimeMeter));
Meter_init((Meter*)this, String_copy("Uptime"), String_copy("Uptime: "), 1);
- ((Meter*)this)->attributes[0] = CRT_colors[UPTIME];
+ ((Meter*)this)->attributes[0] = &(CRT_colors[UPTIME]);
((Object*)this)->display = UptimeMeter_display;
((Meter*)this)->setValues = UptimeMeter_setValues;
Meter_setMode((Meter*)this, TEXT);
diff --git a/UsersTable.c b/UsersTable.c
index 2c9c34f..e063a4c 100644
--- a/UsersTable.c
+++ b/UsersTable.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - UsersTable.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
diff --git a/aclocal.m4 b/aclocal.m4
index 7b25188..aef181a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.4 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -11,23 +11,11 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-# -*- Autoconf -*-
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-# Generated from amversion.in; do not edit by hand.
-
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
@@ -40,26 +28,15 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
- [AM_AUTOMAKE_VERSION([1.9.4])])
-
-# AM_AUX_DIR_EXPAND
+ [AM_AUTOMAKE_VERSION([1.9.6])])
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
@@ -106,26 +83,16 @@ AC_PREREQ([2.50])dnl
am_aux_dir=`cd $ac_aux_dir && pwd`
])
-# AM_CONDITIONAL -*- Autoconf -*-
-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# AM_CONDITIONAL -*- Autoconf -*-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 6
+# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@@ -149,26 +116,15 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# serial 7 -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
+# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@@ -177,7 +133,6 @@ fi])])
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
-
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
@@ -317,27 +272,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
-# Generate code to set up dependency tracking. -*- Autoconf -*-
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
-# Free Software Foundation, Inc.
+# Generate code to set up dependency tracking. -*- Autoconf -*-
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-#serial 2
+#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
@@ -396,30 +340,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
-# Do all the work for Automake. -*- Autoconf -*-
-
-# This macro actually does too much some checks are only needed if
-# your package does certain things. But this isn't really a big deal.
+# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# serial 12
-# serial 11
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
@@ -521,51 +454,27 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
-
-# Copyright (C) 2001, 2003 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
-# -*- Autoconf -*-
-# Copyright (C) 2003 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 1
+# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
@@ -580,26 +489,15 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
-# Check to see how 'make' treats includes. -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+# Check to see how 'make' treats includes. -*- Autoconf -*-
-# 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 2
+# serial 3
# AM_MAKE_INCLUDE()
# -----------------
@@ -643,27 +541,16 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# -*- Autoconf -*-
-
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 3
+# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -689,27 +576,16 @@ else
fi
])
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-
-# Copyright (C) 2003, 2004 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
+#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
@@ -763,26 +639,15 @@ else
fi
AC_SUBST([mkdir_p])])
-# Helper functions for option handling. -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# Helper functions for option handling. -*- Autoconf -*-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 2
+# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@@ -807,28 +672,16 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-#
-# Check to make sure that the build environment is sane.
-#
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-# serial 3
+# serial 4
# AM_SANITY_CHECK
# ---------------
@@ -871,25 +724,14 @@ Check your system clock])
fi
AC_MSG_RESULT(yes)])
-# AM_PROG_INSTALL_STRIP
-
-# Copyright (C) 2001, 2003 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+# AM_PROG_INSTALL_STRIP
+# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
@@ -912,25 +754,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 1
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
diff --git a/config.h b/config.h
index bc474c3..e028286 100644
--- a/config.h
+++ b/config.h
@@ -105,13 +105,13 @@
#define PACKAGE_NAME "htop"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "htop 0.5.3"
+#define PACKAGE_STRING "htop 0.5.4"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "htop"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.5.3"
+#define PACKAGE_VERSION "0.5.4"
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
@@ -120,7 +120,7 @@
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "0.5.3"
+#define VERSION "0.5.4"
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
diff --git a/configure b/configure
index c9e3cc5..fae2fc3 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for htop 0.5.3.
+# Generated by GNU Autoconf 2.59 for htop 0.5.4.
#
# Report bugs to <loderunner@users.sourceforge.net>.
#
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='htop'
PACKAGE_TARNAME='htop'
-PACKAGE_VERSION='0.5.3'
-PACKAGE_STRING='htop 0.5.3'
+PACKAGE_VERSION='0.5.4'
+PACKAGE_STRING='htop 0.5.4'
PACKAGE_BUGREPORT='loderunner@users.sourceforge.net'
ac_unique_file="htop.c"
@@ -780,7 +780,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 0.5.3 to adapt to many kinds of systems.
+\`configure' configures htop 0.5.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -842,7 +842,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of htop 0.5.3:";;
+ short | recursive ) echo "Configuration of htop 0.5.4:";;
esac
cat <<\_ACEOF
@@ -960,7 +960,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-htop configure 0.5.3
+htop configure 0.5.4
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -974,7 +974,7 @@ cat >&5 <<_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 0.5.3, which was
+It was created by htop $as_me 0.5.4, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1617,7 +1617,7 @@ fi
# Define the identity of the package.
PACKAGE='htop'
- VERSION='0.5.3'
+ VERSION='0.5.4'
cat >>confdefs.h <<_ACEOF
@@ -5629,7 +5629,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by htop $as_me 0.5.3, which was
+This file was extended by htop $as_me 0.5.4, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5692,7 +5692,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-htop config.status 0.5.3
+htop config.status 0.5.4
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 66f58ea..64a5acf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
-AC_INIT([htop],[0.5.3],[loderunner@users.sourceforge.net])
+AC_INIT([htop],[0.5.4],[loderunner@users.sourceforge.net])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([htop.c])
AC_CONFIG_HEADER([config.h])
diff --git a/debian/changelog b/debian/changelog
index c0e5e66..e4827de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+htop (0.5.4-1) unstable; urgency=low
+
+ * New upstream version.
+ - does not leave cruft on console on exit. (Closes: #334657)
+
+ -- Bartosz Fenski <fenio@debian.org> Fri, 4 Nov 2005 17:25:27 +0100
+
htop (0.5.3-1) unstable; urgency=low
* New upstream version.
diff --git a/htop.c b/htop.c
index d2bbc39..b851a70 100644
--- a/htop.c
+++ b/htop.c
@@ -1,6 +1,6 @@
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - htop.c
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -38,15 +38,16 @@ char htop_barCharacters[] = "|#*@$%&";
void printVersionFlag() {
clear();
- printf("htop " VERSION " - (C) 2004 Hisham Muhammad.\n");
+ printf("htop " VERSION " - (C) 2004,2005 Hisham Muhammad.\n");
printf("Released under the GNU GPL.\n\n");
exit(0);
}
void printHelpFlag() {
clear();
- printf("htop " VERSION " - (C) 2004 Hisham Muhammad.\n");
+ printf("htop " VERSION " - (C) 2004,2005 Hisham Muhammad.\n");
printf("Released under the GNU GPL.\n\n");
+ printf("-d DELAY Delay between updates, in tenths of seconds\n\n");
printf("Press F1 inside htop for online help.\n");
printf("See the man page for full info.\n\n");
exit(0);
@@ -55,6 +56,9 @@ void printHelpFlag() {
void showHelp() {
clear();
attrset(CRT_colors[HELP_BOLD]);
+ for (int i = 0; i < LINES; i++) {
+ move(i, 0); hline(' ', COLS);
+ }
mvaddstr(0, 0, "htop " VERSION " - (C) 2004 Hisham Muhammad.");
mvaddstr(1, 0, "Released under the GNU GPL. See man page for more info.");
attrset(CRT_colors[DEFAULT_COLOR]);
@@ -189,7 +193,7 @@ void showColumnConfig(ProcessList* pl) {
for (; i < LINES - 8; i++)
mvhline(5 + i, (COLS / 2) + 1, ' ', COLS / 2);
mvchgat(5 + currRow, (currCol) ? (COLS / 2) + 1 : 1, (COLS / 2) - 2,
- A_REVERSE, BLACK_CYAN_PAIR, NULL);
+ A_REVERSE, CRT_colors[PANEL_HIGHLIGHT_FOCUS], NULL);
refresh();
@@ -367,11 +371,18 @@ void Setup_run(Settings* settings, int headerHeight) {
int main(int argc, char** argv) {
+ int delay = -1;
+
if (argc > 0) {
if (String_eq(argv[1], "--help")) {
printHelpFlag();
} else if (String_eq(argv[1], "--version")) {
printVersionFlag();
+ } else if (String_eq(argv[1], "-d")) {
+ if (argc < 2) printHelpFlag();
+ sscanf(argv[2], "%d", &delay);
+ if (delay < 1) delay = 1;
+ if (delay > 100) delay = 100;
}
}
@@ -392,13 +403,17 @@ int main(int argc, char** argv) {
ProcessList* pl = NULL;
UsersTable* ut = UsersTable_new();
- CRT_init();
pl = ProcessList_new(ut);
- ProcessList_scan(pl);
Header* header = Header_new(pl);
settings = Settings_new(pl, header);
int headerHeight = Header_calculateHeight(header);
+
+ // FIXME: move delay code to settings
+ if (delay != -1)
+ settings->delay = delay;
+
+ CRT_init(settings->delay, settings->colorScheme);
lb = ListBox_new(0, headerHeight, COLS, LINES - headerHeight - 2, PROCESS_CLASS, false);
ListBox_setHeader(lb, ProcessList_printHeader(pl));
@@ -411,6 +426,9 @@ int main(int argc, char** argv) {
char* defaultFunctions[10] = {"Help ", "Setup ", "Search", "Invert", "Tree ",
"SortBy", "Nice -", "Nice +", "Kill ", "Quit "};
FunctionBar* defaultBar = FunctionBar_new(10, defaultFunctions, NULL, NULL);
+
+ ProcessList_scan(pl);
+ usleep(75000);
FunctionBar_draw(defaultBar, NULL);
@@ -584,6 +602,7 @@ int main(int argc, char** argv) {
refreshTimeout = 0;
break;
}
+ case '\012': // Enter
case '\014': // Ctrl+L
{
clear();
@@ -602,6 +621,8 @@ int main(int argc, char** argv) {
case KEY_F(2):
{
Setup_run(settings, headerHeight);
+ // TODO: shouldn't need this, colors should be dynamic
+ ListBox_setHeader(lb, ProcessList_printHeader(pl));
headerHeight = Header_calculateHeight(header);
ListBox_move(lb, 0, headerHeight);
ListBox_resize(lb, COLS, LINES-headerHeight-1);
diff --git a/htop.h b/htop.h
index 98efa1d..2f6be51 100644
--- a/htop.h
+++ b/htop.h
@@ -3,8 +3,8 @@
#ifndef HEADER_htop
#define HEADER_htop
/*
-htop
-(C) 2004 Hisham H. Muhammad
+htop - htop.h
+(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/

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