diff -Nru htop-1.0/Affinity.c htop-1.0.1/Affinity.c --- htop-1.0/Affinity.c 2011-09-21 12:55:58.000000000 +0000 +++ htop-1.0.1/Affinity.c 2011-12-26 21:29:26.000000000 +0000 @@ -1,6 +1,12 @@ +/* +htop - Affinity.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ -#include "config.h" #include "Affinity.h" + #include /*{ diff -Nru htop-1.0/Affinity.h htop-1.0.1/Affinity.h --- htop-1.0/Affinity.h 2011-09-21 12:56:25.000000000 +0000 +++ htop-1.0.1/Affinity.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,9 +2,12 @@ #ifndef HEADER_Affinity #define HEADER_Affinity - -#include "config.h" -#include +/* +htop - Affinity.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ typedef struct Affinity_ { diff -Nru htop-1.0/AffinityPanel.c htop-1.0.1/AffinityPanel.c --- htop-1.0/AffinityPanel.c 2011-11-05 04:42:04.000000000 +0000 +++ htop-1.0.1/AffinityPanel.c 2011-12-26 21:50:51.000000000 +0000 @@ -1,11 +1,23 @@ +/* +htop - AffinityPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ -#include "ProcessList.h" #include "AffinityPanel.h" -#include "Panel.h" + #include "CheckItem.h" -#include "debug.h" #include +#include + +/*{ +#include "Panel.h" +#include "Affinity.h" +#include "ProcessList.h" +#include "ListItem.h" +}*/ static HandlerResult AffinityPanel_eventHandler(Panel* this, int ch) { CheckItem* selected = (CheckItem*) Panel_getSelected(this); @@ -38,7 +50,7 @@ } else { mode = false; } - Panel_add(this, (Object*) CheckItem_new(String_copy(number), NULL, mode)); + Panel_add(this, (Object*) CheckItem_new(strdup(number), NULL, mode)); } return this; } diff -Nru htop-1.0/AffinityPanel.h htop-1.0.1/AffinityPanel.h --- htop-1.0/AffinityPanel.h 2011-11-05 04:42:07.000000000 +0000 +++ htop-1.0.1/AffinityPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,13 +2,17 @@ #ifndef HEADER_AffinityPanel #define HEADER_AffinityPanel +/* +htop - AffinityPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ -#include "ProcessList.h" #include "Panel.h" -#include "CheckItem.h" - -#include "debug.h" -#include +#include "Affinity.h" +#include "ProcessList.h" +#include "ListItem.h" Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity); diff -Nru htop-1.0/AvailableColumnsPanel.c htop-1.0.1/AvailableColumnsPanel.c --- htop-1.0/AvailableColumnsPanel.c 2011-11-17 23:48:24.000000000 +0000 +++ htop-1.0.1/AvailableColumnsPanel.c 2011-12-26 21:51:00.000000000 +0000 @@ -1,16 +1,23 @@ +/* +htop - AvailableColumnsPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "AvailableColumnsPanel.h" -#include "Settings.h" + #include "Header.h" -#include "ScreenManager.h" #include "ColumnsPanel.h" -#include "Panel.h" - -#include "debug.h" #include +#include +#include /*{ +#include "Panel.h" +#include "Settings.h" +#include "ScreenManager.h" typedef struct AvailableColumnsPanel_ { Panel super; @@ -48,7 +55,8 @@ } default: { - result = Panel_selectByTyping(super, ch); + if (isalpha(ch)) + result = Panel_selectByTyping(super, ch); break; } } diff -Nru htop-1.0/AvailableColumnsPanel.h htop-1.0.1/AvailableColumnsPanel.h --- htop-1.0/AvailableColumnsPanel.h 2011-11-17 23:48:26.000000000 +0000 +++ htop-1.0.1/AvailableColumnsPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,17 +2,16 @@ #ifndef HEADER_AvailableColumnsPanel #define HEADER_AvailableColumnsPanel +/* +htop - AvailableColumnsPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ +#include "Panel.h" #include "Settings.h" -#include "Header.h" #include "ScreenManager.h" -#include "ColumnsPanel.h" - -#include "Panel.h" - -#include "debug.h" -#include - typedef struct AvailableColumnsPanel_ { Panel super; diff -Nru htop-1.0/AvailableMetersPanel.c htop-1.0.1/AvailableMetersPanel.c --- htop-1.0/AvailableMetersPanel.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/AvailableMetersPanel.c 2011-12-26 21:51:06.000000000 +0000 @@ -1,16 +1,23 @@ +/* +htop - AvailableMetersPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "AvailableMetersPanel.h" -#include "Settings.h" -#include "Header.h" -#include "ScreenManager.h" -#include "CPUMeter.h" -#include "Panel.h" +#include "CPUMeter.h" +#include "Header.h" +#include "ListItem.h" -#include "debug.h" #include +#include /*{ +#include "Settings.h" +#include "Panel.h" +#include "ScreenManager.h" typedef struct AvailableMetersPanel_ { Panel super; diff -Nru htop-1.0/AvailableMetersPanel.h htop-1.0.1/AvailableMetersPanel.h --- htop-1.0/AvailableMetersPanel.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/AvailableMetersPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,17 +2,16 @@ #ifndef HEADER_AvailableMetersPanel #define HEADER_AvailableMetersPanel +/* +htop - AvailableMetersPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "Settings.h" -#include "Header.h" -#include "ScreenManager.h" -#include "CPUMeter.h" - #include "Panel.h" - -#include "debug.h" -#include - +#include "ScreenManager.h" typedef struct AvailableMetersPanel_ { Panel super; diff -Nru htop-1.0/BatteryMeter.c htop-1.0.1/BatteryMeter.c --- htop-1.0/BatteryMeter.c 2011-10-24 23:53:54.000000000 +0000 +++ htop-1.0.1/BatteryMeter.c 2012-02-02 21:49:13.000000000 +0000 @@ -1,20 +1,25 @@ /* - htop - (C) 2004-2011 Hisham H. Muhammad - Released under the GNU GPL, see the COPYING file - in the source distribution for its full text. +htop - BatteryMeter.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. - This "Meter" written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). +This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). */ #include "BatteryMeter.h" -#include "Meter.h" + #include "ProcessList.h" #include "CRT.h" #include "String.h" -#include "debug.h" + +#include +#include +#include +#include /*{ +#include "Meter.h" typedef enum ACPresence_ { AC_ABSENT, @@ -45,17 +50,11 @@ } static unsigned long int parseBatInfo(const char *fileName, const unsigned short int lineNum, const unsigned short int wordNum) { - DIR* batteryDir; - const struct dirent *dirEntries; - const char batteryPath[] = PROCDIR "/acpi/battery/"; - batteryDir = opendir(batteryPath); - - if (batteryDir == NULL) { + DIR* batteryDir = opendir(batteryPath); + if (!batteryDir) return 0; - } - char *entryName; typedef struct listLbl { char *content; struct listLbl *next; @@ -68,8 +67,8 @@ Some of this is based off of code found in kismet (they claim it came from gkrellm). Written for multi battery use... */ - for (dirEntries = readdir((DIR *) batteryDir); dirEntries; dirEntries = readdir((DIR *) batteryDir)) { - entryName = (char *) dirEntries->d_name; + for (const struct dirent* dirEntries = readdir((DIR *) batteryDir); dirEntries; dirEntries = readdir((DIR *) batteryDir)) { + char* entryName = (char *) dirEntries->d_name; if (strncmp(entryName, "BAT", 3)) continue; @@ -117,22 +116,16 @@ ACPresence isOn = AC_ERROR; if (access(PROCDIR "/acpi/ac_adapter", F_OK) == 0) { - const struct dirent *dirEntries; const char *power_supplyPath = PROCDIR "/acpi/ac_adapter"; DIR *power_supplyDir = opendir(power_supplyPath); - char *entryName; - - if (!power_supplyDir) { + if (!power_supplyDir) return AC_ERROR; - } - for (dirEntries = readdir((DIR *) power_supplyDir); dirEntries; dirEntries = readdir((DIR *) power_supplyDir)) { - entryName = (char *) dirEntries->d_name; + for (const struct dirent *dirEntries = readdir((DIR *) power_supplyDir); dirEntries; dirEntries = readdir((DIR *) power_supplyDir)) { + char* entryName = (char *) dirEntries->d_name; - if (strncmp(entryName, "A", 1)) { + if (entryName[0] != 'A') continue; - } - char statePath[50]; snprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName); @@ -242,11 +235,8 @@ const struct dirent *dirEntries; const char *power_supplyPath = "/sys/class/power_supply/"; DIR *power_supplyDir = opendir(power_supplyPath); - - - if (!power_supplyDir) { + if (!power_supplyDir) return 0; - } char *entryName; diff -Nru htop-1.0/BatteryMeter.h htop-1.0.1/BatteryMeter.h --- htop-1.0/BatteryMeter.h 2011-10-24 23:58:26.000000000 +0000 +++ htop-1.0.1/BatteryMeter.h 2012-02-02 21:49:23.000000000 +0000 @@ -3,20 +3,15 @@ #ifndef HEADER_BatteryMeter #define HEADER_BatteryMeter /* - htop - (C) 2004-2011 Hisham H. Muhammad - Released under the GNU GPL, see the COPYING file - in the source distribution for its full text. +htop - BatteryMeter.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. - This "Meter" written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). +This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). */ #include "Meter.h" -#include "ProcessList.h" -#include "CRT.h" -#include "String.h" -#include "debug.h" - typedef enum ACPresence_ { AC_ABSENT, diff -Nru htop-1.0/CategoriesPanel.c htop-1.0.1/CategoriesPanel.c --- htop-1.0/CategoriesPanel.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/CategoriesPanel.c 2011-12-26 21:52:00.000000000 +0000 @@ -1,5 +1,12 @@ +/* +htop - CategoriesPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "CategoriesPanel.h" + #include "AvailableMetersPanel.h" #include "MetersPanel.h" #include "DisplayOptionsPanel.h" @@ -7,12 +14,13 @@ #include "ColorsPanel.h" #include "AvailableColumnsPanel.h" -#include "Panel.h" - -#include "debug.h" #include +#include /*{ +#include "Panel.h" +#include "Settings.h" +#include "ScreenManager.h" typedef struct CategoriesPanel_ { Panel super; diff -Nru htop-1.0/CategoriesPanel.h htop-1.0.1/CategoriesPanel.h --- htop-1.0/CategoriesPanel.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/CategoriesPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,19 +2,16 @@ #ifndef HEADER_CategoriesPanel #define HEADER_CategoriesPanel - -#include "AvailableMetersPanel.h" -#include "MetersPanel.h" -#include "DisplayOptionsPanel.h" -#include "ColumnsPanel.h" -#include "ColorsPanel.h" -#include "AvailableColumnsPanel.h" +/* +htop - CategoriesPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "Panel.h" - -#include "debug.h" -#include - +#include "Settings.h" +#include "ScreenManager.h" typedef struct CategoriesPanel_ { Panel super; diff -Nru htop-1.0/ChangeLog htop-1.0.1/ChangeLog --- htop-1.0/ChangeLog 2011-11-18 06:07:31.000000000 +0000 +++ htop-1.0.1/ChangeLog 2012-02-02 23:47:44.000000000 +0000 @@ -1,4 +1,17 @@ +What's new in version 1.0.1 + +* Move .htoprc to XDG-compliant path ~/.config/htop/htoprc, + respecting $XDG_CONFIG_HOME + (thanks to Hadzhimurad Ustarkhan for the suggestion.) +* Safer behavior on the kill screen, to make it harder to kill the wrong process. +* Fix for building in FreeBSD 8.2 + (thanks to Trond Endrestol) +* BUGFIX: behavior of 'F' (follow) key was broken, also affecting the + persistence of mouse selections. +* BUGFIX: keep main panel up-to-date when running the screen manager, + to fix crash when processes die while on the F9/Kill screen. + What's new in version 1.0 * Performance improvements diff -Nru htop-1.0/CheckItem.c htop-1.0.1/CheckItem.c --- htop-1.0/CheckItem.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/CheckItem.c 2011-12-26 21:52:06.000000000 +0000 @@ -1,17 +1,19 @@ /* -htop +htop - CheckItem.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "CheckItem.h" -#include "Object.h" + #include "CRT.h" -#include "debug.h" +#include +#include /*{ +#include "Object.h" typedef struct CheckItem_ { Object super; diff -Nru htop-1.0/CheckItem.h htop-1.0.1/CheckItem.h --- htop-1.0/CheckItem.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/CheckItem.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,17 +3,13 @@ #ifndef HEADER_CheckItem #define HEADER_CheckItem /* -htop +htop - CheckItem.h (C) 2004-2011 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 "debug.h" - typedef struct CheckItem_ { Object super; diff -Nru htop-1.0/ClockMeter.c htop-1.0.1/ClockMeter.c --- htop-1.0/ClockMeter.c 2011-08-26 19:57:34.000000000 +0000 +++ htop-1.0.1/ClockMeter.c 2011-12-26 21:52:21.000000000 +0000 @@ -1,16 +1,19 @@ /* -htop +htop - ClockMeter.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "ClockMeter.h" -#include "Meter.h" + +#include "CRT.h" #include -#include "debug.h" +/*{ +#include "Meter.h" +}*/ int ClockMeter_attributes[] = { CLOCK diff -Nru htop-1.0/ClockMeter.h htop-1.0.1/ClockMeter.h --- htop-1.0/ClockMeter.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/ClockMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,7 +3,7 @@ #ifndef HEADER_ClockMeter #define HEADER_ClockMeter /* -htop +htop - ClockMeter.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -11,10 +11,6 @@ #include "Meter.h" -#include - -#include "debug.h" - extern int ClockMeter_attributes[]; extern MeterType ClockMeter; diff -Nru htop-1.0/ColorsPanel.c htop-1.0.1/ColorsPanel.c --- htop-1.0/ColorsPanel.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/ColorsPanel.c 2011-12-26 21:53:04.000000000 +0000 @@ -1,14 +1,18 @@ +/* +htop - ColorsPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ -#include "CRT.h" #include "ColorsPanel.h" -#include "Panel.h" +#include "CRT.h" #include "CheckItem.h" -#include "Settings.h" -#include "ScreenManager.h" -#include "debug.h" #include +#include +#include // TO ADD A NEW SCHEME: // * Increment the size of bool check in ColorsPanel.h @@ -17,6 +21,9 @@ // * Add the colors in CRT_setColors /*{ +#include "Panel.h" +#include "Settings.h" +#include "ScreenManager.h" typedef struct ColorsPanel_ { Panel super; @@ -67,7 +74,7 @@ this->settings->changed = true; Header* header = this->settings->header; CRT_setColors(mark); - Panel* menu = (Panel*) Vector_get(this->scr->items, 0); + Panel* menu = (Panel*) Vector_get(this->scr->panels, 0); Header_draw(header); RichString_setAttr(&(super->header), CRT_colors[PANEL_HEADER_FOCUS]); RichString_setAttr(&(menu->header), CRT_colors[PANEL_HEADER_UNFOCUS]); @@ -88,7 +95,7 @@ Panel_setHeader(super, "Colors"); for (int i = 0; ColorSchemes[i] != NULL; i++) { - Panel_add(super, (Object*) CheckItem_new(String_copy(ColorSchemes[i]), NULL, false)); + Panel_add(super, (Object*) CheckItem_new(strdup(ColorSchemes[i]), NULL, false)); } CheckItem_set((CheckItem*)Panel_get(super, settings->colorScheme), true); return this; diff -Nru htop-1.0/ColorsPanel.h htop-1.0.1/ColorsPanel.h --- htop-1.0/ColorsPanel.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/ColorsPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,16 +2,12 @@ #ifndef HEADER_ColorsPanel #define HEADER_ColorsPanel - -#include "CRT.h" - -#include "Panel.h" -#include "CheckItem.h" -#include "Settings.h" -#include "ScreenManager.h" - -#include "debug.h" -#include +/* +htop - ColorsPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ // TO ADD A NEW SCHEME: // * Increment the size of bool check in ColorsPanel.h @@ -19,6 +15,9 @@ // * Add a define in CRT.h that matches the order of the array // * Add the colors in CRT_setColors +#include "Panel.h" +#include "Settings.h" +#include "ScreenManager.h" typedef struct ColorsPanel_ { Panel super; diff -Nru htop-1.0/ColumnsPanel.c htop-1.0.1/ColumnsPanel.c --- htop-1.0/ColumnsPanel.c 2011-11-18 00:31:56.000000000 +0000 +++ htop-1.0.1/ColumnsPanel.c 2011-12-26 21:53:10.000000000 +0000 @@ -1,14 +1,22 @@ +/* +htop - ColumnsPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "ColumnsPanel.h" -#include "Panel.h" -#include "Settings.h" -#include "ScreenManager.h" +#include "String.h" -#include "debug.h" #include +#include +#include /*{ +#include "Panel.h" +#include "Settings.h" +#include "ScreenManager.h" typedef struct ColumnsPanel_ { Panel super; @@ -62,7 +70,8 @@ } default: { - result = Panel_selectByTyping(super, ch); + if (isalpha(ch)) + result = Panel_selectByTyping(super, ch); if (result == BREAK_LOOP) result = IGNORED; break; diff -Nru htop-1.0/ColumnsPanel.h htop-1.0.1/ColumnsPanel.h --- htop-1.0/ColumnsPanel.h 2011-11-18 00:34:44.000000000 +0000 +++ htop-1.0.1/ColumnsPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,16 +2,17 @@ #ifndef HEADER_ColumnsPanel #define HEADER_ColumnsPanel - +/* +htop - ColumnsPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "Panel.h" #include "Settings.h" #include "ScreenManager.h" -#include "debug.h" -#include - - typedef struct ColumnsPanel_ { Panel super; diff -Nru htop-1.0/config.h htop-1.0.1/config.h --- htop-1.0/config.h 2011-11-21 02:54:18.000000000 +0000 +++ htop-1.0.1/config.h 2011-12-26 21:47:30.000000000 +0000 @@ -146,7 +146,7 @@ #define PACKAGE_NAME "htop" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "htop 1.0" +#define PACKAGE_STRING "htop 1.0.1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "htop" @@ -155,7 +155,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0" +#define PACKAGE_VERSION "1.0.1" /* Path of proc filesystem */ #define PROCDIR "/proc" @@ -189,7 +189,7 @@ /* Version number of package */ -#define VERSION "1.0" +#define VERSION "1.0.1" /* Define to 1 if on MINIX. */ /* #undef _MINIX */ diff -Nru htop-1.0/configure htop-1.0.1/configure --- htop-1.0/configure 2011-11-21 02:58:19.000000000 +0000 +++ htop-1.0.1/configure 2011-12-26 21:47:26.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for htop 1.0. +# Generated by GNU Autoconf 2.65 for htop 1.0.1. # # Report bugs to . # @@ -562,8 +562,8 @@ # Identity of this package. PACKAGE_NAME='htop' PACKAGE_TARNAME='htop' -PACKAGE_VERSION='1.0' -PACKAGE_STRING='htop 1.0' +PACKAGE_VERSION='1.0.1' +PACKAGE_STRING='htop 1.0.1' PACKAGE_BUGREPORT='loderunner@users.sourceforge.net' PACKAGE_URL='' @@ -1286,7 +1286,7 @@ # 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 to adapt to many kinds of systems. +\`configure' configures htop 1.0.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1357,7 +1357,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of htop 1.0:";; + short | recursive ) echo "Configuration of htop 1.0.1:";; esac cat <<\_ACEOF @@ -1471,7 +1471,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -htop configure 1.0 +htop configure 1.0.1 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -1896,7 +1896,7 @@ 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, which was +It was created by htop $as_me 1.0.1, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -4130,7 +4130,7 @@ # Define the identity of the package. PACKAGE='htop' - VERSION='1.0' + VERSION='1.0.1' cat >>confdefs.h <<_ACEOF @@ -12452,7 +12452,7 @@ as_fn_error "missing headers: $missing_headers" "$LINENO" 5 fi -if test "$cross_compiling" = "no"; then +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; } @@ -12510,7 +12510,7 @@ enable_native_affinity="yes" fi -if test "x$enable_native_affinity" = xyes; then +if test "x$enable_native_affinity" = xyes -a "x$cross_compiling" = xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable sched_setaffinity" >&5 $as_echo_n "checking for usable sched_setaffinity... " >&6; } if test "$cross_compiling" = yes; then : @@ -12540,13 +12540,11 @@ } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - -$as_echo "#define HAVE_NATIVE_AFFINITY 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + enable_native_affinity=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -12554,6 +12552,11 @@ fi fi +if test "x$enable_native_affinity" = xyes; then + +$as_echo "#define HAVE_NATIVE_AFFINITY 1" >>confdefs.h + +fi # Check whether --enable-hwloc was given. if test "${enable_hwloc+set}" = set; then : @@ -13150,7 +13153,7 @@ # 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, which was +This file was extended by htop $as_me 1.0.1, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13216,7 +13219,7 @@ 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 +htop config.status 1.0.1 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" diff -Nru htop-1.0/configure.ac htop-1.0.1/configure.ac --- htop-1.0/configure.ac 2011-11-21 02:46:48.000000000 +0000 +++ htop-1.0.1/configure.ac 2011-12-26 21:46:57.000000000 +0000 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.65) -AC_INIT([htop],[1.0],[loderunner@users.sourceforge.net]) +AC_INIT([htop],[1.0.1],[loderunner@users.sourceforge.net]) # The following two lines are required by hwloc scripts AC_USE_SYSTEM_EXTENSIONS @@ -108,13 +108,13 @@ AC_MSG_ERROR([missing headers: $missing_headers]) fi -if test "$cross_compiling" = "no"; then +if test "x$cross_compiling" = xno; then AC_CHECK_FILE($PROCDIR/stat,,AC_MSG_ERROR(Cannot find /proc/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.)) AC_CHECK_FILE($PROCDIR/meminfo,,AC_MSG_ERROR(Cannot find /proc/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.)) fi AC_ARG_ENABLE(native_affinity, [AC_HELP_STRING([--enable-native-affinity], [enable native sched_setaffinity and sched_getaffinity for affinity support, disables hwloc])], ,enable_native_affinity="yes") -if test "x$enable_native_affinity" = xyes; then +if test "x$enable_native_affinity" = xyes -a "x$cross_compiling" = xno; then AC_MSG_CHECKING([for usable sched_setaffinity]) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ @@ -126,9 +126,12 @@ sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); if (errno == ENOSYS) return 1; ]])], - [AC_DEFINE(HAVE_NATIVE_AFFINITY, 1, [Define if native sched_setaffinity and sched_getaffinity are to be used.]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) + [AC_MSG_RESULT([yes])], + [enable_native_affinity=no + AC_MSG_RESULT([no])]) +fi +if test "x$enable_native_affinity" = xyes; then + AC_DEFINE(HAVE_NATIVE_AFFINITY, 1, [Define if native sched_setaffinity and sched_getaffinity are to be used.]) fi AC_ARG_ENABLE(hwloc, [AC_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity])],, enable_hwloc="no") diff -Nru htop-1.0/CPUMeter.c htop-1.0.1/CPUMeter.c --- htop-1.0/CPUMeter.c 2011-11-16 18:53:19.000000000 +0000 +++ htop-1.0.1/CPUMeter.c 2011-12-26 21:52:43.000000000 +0000 @@ -6,17 +6,19 @@ */ #include "CPUMeter.h" -#include "Meter.h" +#include "CRT.h" #include "ProcessList.h" +#include #include #include #include #include -#include "debug.h" -#include +/*{ +#include "Meter.h" +}*/ int CPUMeter_attributes[] = { CPU_NICE, CPU_NORMAL, CPU_KERNEL, CPU_IRQ, CPU_SOFTIRQ, CPU_IOWAIT, CPU_STEAL, CPU_GUEST diff -Nru htop-1.0/CPUMeter.h htop-1.0.1/CPUMeter.h --- htop-1.0/CPUMeter.h 2011-11-16 18:53:20.000000000 +0000 +++ htop-1.0.1/CPUMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -11,16 +11,6 @@ #include "Meter.h" -#include "ProcessList.h" - -#include -#include -#include -#include - -#include "debug.h" -#include - extern int CPUMeter_attributes[]; #ifndef MIN diff -Nru htop-1.0/CRT.c htop-1.0.1/CRT.c --- htop-1.0/CRT.c 2011-09-20 18:06:16.000000000 +0000 +++ htop-1.0.1/CRT.c 2011-12-26 21:52:55.000000000 +0000 @@ -7,19 +7,16 @@ #include "CRT.h" +#include "config.h" +#include "String.h" + #include #include #include -#include #ifdef HAVE_EXECINFO_H #include #endif -#include "String.h" - -#include "config.h" -#include "debug.h" - #define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) #define COLORSCHEME_DEFAULT 0 @@ -40,9 +37,8 @@ //#link curses -bool CRT_hasColors; - /*{ +#include typedef enum ColorElements_ { RESET_COLOR, @@ -112,6 +108,8 @@ // TODO: centralize these in Settings. +static bool CRT_hasColors; + int CRT_delay = 0; int CRT_colorScheme = 0; diff -Nru htop-1.0/CRT.h htop-1.0.1/CRT.h --- htop-1.0/CRT.h 2011-09-20 18:06:16.000000000 +0000 +++ htop-1.0.1/CRT.h 2011-12-26 21:55:08.000000000 +0000 @@ -9,20 +9,9 @@ in the source distribution for its full text. */ - -#include -#include -#include -#include #ifdef HAVE_EXECINFO_H -#include #endif -#include "String.h" - -#include "config.h" -#include "debug.h" - #define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) #define COLORSCHEME_DEFAULT 0 @@ -43,8 +32,7 @@ //#link curses -bool CRT_hasColors; - +#include typedef enum ColorElements_ { RESET_COLOR, diff -Nru htop-1.0/debian/changelog htop-1.0.1/debian/changelog --- htop-1.0/debian/changelog 2012-03-28 03:24:24.000000000 +0000 +++ htop-1.0.1/debian/changelog 2012-03-28 03:24:25.000000000 +0000 @@ -1,3 +1,11 @@ +htop (1.0.1-1) unstable; urgency=low + + * New upstream release. + - Don't crash when trying to kill already finished process. + (Closes: #652563, 657675) + + -- Eugene V. Lyubimkin Sun, 19 Feb 2012 10:24:46 +0200 + htop (1.0-1) unstable; urgency=low * New upstream release. diff -Nru htop-1.0/debug.h htop-1.0.1/debug.h --- htop-1.0/debug.h 2011-11-16 16:56:10.000000000 +0000 +++ htop-1.0.1/debug.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - -#if defined(DEBUG) - - /* Full debug */ - #include "DebugMemory.h" - #define calloc(a, b) DebugMemory_calloc(a, b, __FILE__, __LINE__) - #define malloc(x) DebugMemory_malloc(x, __FILE__, __LINE__, #x) - #define realloc(x,s) DebugMemory_realloc(x, s, __FILE__, __LINE__, #x) - #define strdup(x) DebugMemory_strdup(x, __FILE__, __LINE__) - #define free(x) DebugMemory_free(x, __FILE__, __LINE__) - #define debug_done() DebugMemory_report(); _nc_freeall() - -#elif defined(DEBUGLITE) - - /* Assertions and core only */ - #ifdef NDEBUG - #undef NDEBUG - #endif - #define debug_done() - -#else - - /* No debugging */ - #define NDEBUG - #define debug_done() - -#endif - diff -Nru htop-1.0/DebugMemory.c htop-1.0.1/DebugMemory.c --- htop-1.0/DebugMemory.c 2011-09-21 12:53:54.000000000 +0000 +++ htop-1.0.1/DebugMemory.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,230 +0,0 @@ - -#include -#include -#include -#include -#include - -#undef strdup -#undef malloc -#undef realloc -#undef calloc -#undef free - -#include "DebugMemory.h" - -/*{ - -typedef struct DebugMemoryItem_ DebugMemoryItem; - -struct DebugMemoryItem_ { - int magic; - void* data; - char* file; - int line; - DebugMemoryItem* next; -}; - -typedef struct DebugMemory_ { - DebugMemoryItem* first; - int allocations; - int deallocations; - int size; - bool totals; - FILE* file; -} DebugMemory; - -}*/ - -#if defined(DEBUG) - -static DebugMemory* singleton = NULL; - -void DebugMemory_new() { - if (singleton) - return; - singleton = malloc(sizeof(DebugMemory)); - singleton->first = NULL; - singleton->allocations = 0; - singleton->deallocations = 0; - singleton->size = 0; - #ifdef DEBUG_ALLOC - singleton->file = fopen("/tmp/htop-debug-alloc.txt", "w"); - #else - singleton->file = NULL; - #endif - singleton->totals = true; - //singleton->file = NULL; -} - -void* DebugMemory_malloc(int size, char* file, int line, char* str) { - void* data = malloc(size); - DebugMemory_registerAllocation(data, file, line); - if (singleton->file) { - if (singleton->totals) fprintf(singleton->file, "%d\t", singleton->size); - fprintf(singleton->file, "%d\t%s:%d (%s)\n", size, file, line, str); - } - return data; -} - -void* DebugMemory_calloc(int a, int b, char* file, int line) { - void* data = calloc(a, b); - DebugMemory_registerAllocation(data, file, line); - if (singleton->file) { - if (singleton->totals) fprintf(singleton->file, "%d\t", singleton->size); - fprintf(singleton->file, "%d\t%s:%d\n", a*b, file, line); - } - return data; -} - -void* DebugMemory_realloc(void* ptr, int size, char* file, int line, char* str) { - if (ptr != NULL) - DebugMemory_registerDeallocation(ptr, file, line); - void* data = realloc(ptr, size); - DebugMemory_registerAllocation(data, file, line); - if (singleton->file) { - if (singleton->totals) fprintf(singleton->file, "%d\t", singleton->size); - fprintf(singleton->file, "%d\t%s:%d (%s)\n", size, file, line, str); - } - return data; -} - -void* DebugMemory_strdup(const char* str, char* file, int line) { - assert(str); - char* data = strdup(str); - DebugMemory_registerAllocation(data, file, line); - if (singleton->file) { - if (singleton->totals) fprintf(singleton->file, "%d\t", singleton->size); - fprintf(singleton->file, "%d\t%s:%d\n", (int) strlen(str), file, line); - } - return data; -} - -void DebugMemory_free(void* data, char* file, int line) { - if (!data) return; - DebugMemory_registerDeallocation(data, file, line); - if (singleton->file) { - if (singleton->totals) fprintf(singleton->file, "%d\t", singleton->size); - fprintf(singleton->file, "free\t%s:%d\n", file, line); - } - free(data); -} - -void DebugMemory_assertSize() { - if (!singleton->first) { - assert (singleton->size == 0); - } - DebugMemoryItem* walk = singleton->first; - int i = 0; - while (walk != NULL) { - assert(walk->magic == 11061980); - i++; - walk = walk->next; - } - assert (i == singleton->size); -} - -int DebugMemory_getBlockCount() { - if (!singleton->first) { - return 0; - } - DebugMemoryItem* walk = singleton->first; - int i = 0; - while (walk != NULL) { - assert(walk->magic == 11061980); - i++; - walk = walk->next; - } - return i; -} - -void DebugMemory_registerAllocation(void* data, char* file, int line) { - if (!singleton) - DebugMemory_new(); - DebugMemory_assertSize(); - DebugMemoryItem* item = (DebugMemoryItem*) malloc(sizeof(DebugMemoryItem)); - item->magic = 11061980; - item->data = data; - item->file = file; - item->line = line; - item->next = NULL; - int val = DebugMemory_getBlockCount(); - if (singleton->first == NULL) { - assert (val == 0); - singleton->first = item; - } else { - DebugMemoryItem* walk = singleton->first; - while (true) { - if (walk->next == NULL) { - walk->next = item; - break; - } - assert(walk->magic == 11061980); - walk = walk->next; - } - } - int nval = DebugMemory_getBlockCount(); - assert(nval == val + 1); - singleton->allocations++; - singleton->size++; - DebugMemory_assertSize(); -} - -void DebugMemory_registerDeallocation(void* data, char* file, int line) { - assert(singleton); - assert(singleton->first); - DebugMemoryItem* walk = singleton->first; - DebugMemoryItem* prev = NULL; - int val = DebugMemory_getBlockCount(); - while (walk != NULL) { - assert(walk->magic == 11061980); - if (walk->data == data) { - if (prev == NULL) { - singleton->first = walk->next; - } else { - prev->next = walk->next; - } - free(walk); - assert(DebugMemory_getBlockCount() == val - 1); - singleton->deallocations++; - singleton->size--; - DebugMemory_assertSize(); - return; - } - DebugMemoryItem* tmp = walk; - walk = walk->next; - prev = tmp; - } - DebugMemory_report(); - fprintf(stderr, "Couldn't find allocation for memory freed at %s:%d\n", file, line); - assert(false); -} - -void DebugMemory_report() { - assert(singleton); - DebugMemoryItem* walk = singleton->first; - int i = 0; - while (walk != NULL) { - assert(walk->magic == 11061980); - i++; - fprintf(stderr, "%p %s:%d\n", walk->data, walk->file, walk->line); - DebugMemoryItem* old = walk; - walk = walk->next; - free(old->file); - free(old); - } - fprintf(stderr, "Total:\n"); - fprintf(stderr, "%d allocations\n", singleton->allocations); - fprintf(stderr, "%d deallocations\n", singleton->deallocations); - fprintf(stderr, "%d size\n", singleton->size); - fprintf(stderr, "%d non-freed blocks\n", i); - if (singleton->file) - fclose(singleton->file); - free(singleton); -} - -#elif defined(DEBUGLITE) - -//#include "efence.h" - -#endif diff -Nru htop-1.0/DebugMemory.h htop-1.0.1/DebugMemory.h --- htop-1.0/DebugMemory.h 2011-09-21 12:54:42.000000000 +0000 +++ htop-1.0.1/DebugMemory.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* Do not edit this file. It was automatically generated. */ - -#ifndef HEADER_DebugMemory -#define HEADER_DebugMemory - -#include -#include -#include -#include -#include - -#undef strdup -#undef malloc -#undef realloc -#undef calloc -#undef free - - - -typedef struct DebugMemoryItem_ DebugMemoryItem; - -struct DebugMemoryItem_ { - int magic; - void* data; - char* file; - int line; - DebugMemoryItem* next; -}; - -typedef struct DebugMemory_ { - DebugMemoryItem* first; - int allocations; - int deallocations; - int size; - bool totals; - FILE* file; -} DebugMemory; - - -#if defined(DEBUG) - -void DebugMemory_new(); - -void* DebugMemory_malloc(int size, char* file, int line, char* str); - -void* DebugMemory_calloc(int a, int b, char* file, int line); - -void* DebugMemory_realloc(void* ptr, int size, char* file, int line, char* str); - -void* DebugMemory_strdup(const char* str, char* file, int line); - -void DebugMemory_free(void* data, char* file, int line); - -void DebugMemory_assertSize(); - -int DebugMemory_getBlockCount(); - -void DebugMemory_registerAllocation(void* data, char* file, int line); - -void DebugMemory_registerDeallocation(void* data, char* file, int line); - -void DebugMemory_report(); - -#elif defined(DEBUGLITE) - -//#include "efence.h" - -#endif - -#endif diff -Nru htop-1.0/DisplayOptionsPanel.c htop-1.0.1/DisplayOptionsPanel.c --- htop-1.0/DisplayOptionsPanel.c 2011-09-20 18:06:16.000000000 +0000 +++ htop-1.0.1/DisplayOptionsPanel.c 2011-12-26 21:53:58.000000000 +0000 @@ -1,15 +1,22 @@ +/* +htop - DisplayOptionsPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "DisplayOptionsPanel.h" -#include "Panel.h" #include "CheckItem.h" -#include "Settings.h" -#include "ScreenManager.h" -#include "debug.h" #include +#include +#include /*{ +#include "Panel.h" +#include "Settings.h" +#include "ScreenManager.h" typedef struct DisplayOptionsPanel_ { Panel super; @@ -65,16 +72,16 @@ super->eventHandler = DisplayOptionsPanel_eventHandler; Panel_setHeader(super, "Display options"); - Panel_add(super, (Object*) CheckItem_new(String_copy("Tree view"), &(settings->pl->treeView), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Shadow other users' processes"), &(settings->pl->shadowOtherUsers), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Hide kernel threads"), &(settings->pl->hideKernelThreads), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Hide userland threads"), &(settings->pl->hideUserlandThreads), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Display threads in a different color"), &(settings->pl->highlightThreads), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Show custom thread names"), &(settings->pl->showThreadNames), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Highlight program \"basename\""), &(settings->pl->highlightBaseName), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Highlight large numbers in memory counters"), &(settings->pl->highlightMegabytes), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Leave a margin around header"), &(settings->header->margin), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest)"), &(settings->pl->detailedCPUTime), false)); - Panel_add(super, (Object*) CheckItem_new(String_copy("Count CPUs from 0 instead of 1"), &(settings->pl->countCPUsFromZero), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Tree view"), &(settings->pl->treeView), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Shadow other users' processes"), &(settings->pl->shadowOtherUsers), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Hide kernel threads"), &(settings->pl->hideKernelThreads), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Hide userland threads"), &(settings->pl->hideUserlandThreads), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Display threads in a different color"), &(settings->pl->highlightThreads), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Show custom thread names"), &(settings->pl->showThreadNames), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Highlight program \"basename\""), &(settings->pl->highlightBaseName), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Highlight large numbers in memory counters"), &(settings->pl->highlightMegabytes), false)); + Panel_add(super, (Object*) CheckItem_new(strdup("Leave a margin around header"), &(settings->header->margin), false)); + 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)); return this; } diff -Nru htop-1.0/DisplayOptionsPanel.h htop-1.0.1/DisplayOptionsPanel.h --- htop-1.0/DisplayOptionsPanel.h 2011-09-20 21:38:57.000000000 +0000 +++ htop-1.0.1/DisplayOptionsPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,17 +2,17 @@ #ifndef HEADER_DisplayOptionsPanel #define HEADER_DisplayOptionsPanel - +/* +htop - DisplayOptionsPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "Panel.h" -#include "CheckItem.h" #include "Settings.h" #include "ScreenManager.h" -#include "debug.h" -#include - - typedef struct DisplayOptionsPanel_ { Panel super; diff -Nru htop-1.0/FunctionBar.c htop-1.0.1/FunctionBar.c --- htop-1.0/FunctionBar.c 2011-09-08 00:24:26.000000000 +0000 +++ htop-1.0.1/FunctionBar.c 2011-12-26 21:54:03.000000000 +0000 @@ -5,19 +5,18 @@ in the source distribution for its full text. */ -#include "Object.h" #include "FunctionBar.h" + #include "CRT.h" -#include "debug.h" #include - #include #include #include #include /*{ +#include "Object.h" typedef struct FunctionBar_ { Object super; @@ -54,8 +53,8 @@ this->events = malloc(sizeof(int) * 15); int i = 0; while (i < 15 && functions[i]) { - this->functions[i] = String_copy(functions[i]); - this->keys[i] = String_copy(keys[i]); + this->functions[i] = strdup(functions[i]); + this->keys[i] = strdup(keys[i]); this->events[i] = events[i]; i++; } @@ -89,7 +88,7 @@ for (int i = 0; i < this->size; i++) { if (this->events[i] == event) { free(this->functions[i]); - this->functions[i] = String_copy(text); + this->functions[i] = strdup(text); break; } } diff -Nru htop-1.0/FunctionBar.h htop-1.0.1/FunctionBar.h --- htop-1.0/FunctionBar.h 2011-09-08 00:25:56.000000000 +0000 +++ htop-1.0.1/FunctionBar.h 2011-12-26 21:55:08.000000000 +0000 @@ -10,16 +10,6 @@ */ #include "Object.h" -#include "CRT.h" - -#include "debug.h" -#include - -#include -#include -#include -#include - typedef struct FunctionBar_ { Object super; diff -Nru htop-1.0/Hashtable.c htop-1.0.1/Hashtable.c --- htop-1.0/Hashtable.c 2011-11-18 05:30:30.000000000 +0000 +++ htop-1.0.1/Hashtable.c 2011-12-26 21:52:11.000000000 +0000 @@ -1,5 +1,5 @@ /* -htop +htop - Hashtable.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -8,12 +8,11 @@ #include "Hashtable.h" #include -#include #include -#include "debug.h" - /*{ +#include + typedef struct Hashtable_ Hashtable; typedef void(*Hashtable_PairFunction)(int, void*, void*); diff -Nru htop-1.0/Hashtable.h htop-1.0.1/Hashtable.h --- htop-1.0/Hashtable.h 2011-11-18 05:31:43.000000000 +0000 +++ htop-1.0.1/Hashtable.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,18 +3,13 @@ #ifndef HEADER_Hashtable #define HEADER_Hashtable /* -htop +htop - Hashtable.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ - -#include #include -#include - -#include "debug.h" typedef struct Hashtable_ Hashtable; diff -Nru htop-1.0/Header.c htop-1.0.1/Header.c --- htop-1.0/Header.c 2011-11-18 00:55:20.000000000 +0000 +++ htop-1.0.1/Header.c 2011-12-26 21:52:26.000000000 +0000 @@ -6,13 +6,27 @@ */ #include "Header.h" -#include "Meter.h" -#include "debug.h" +#include "CRT.h" +#include "CPUMeter.h" +#include "MemoryMeter.h" +#include "SwapMeter.h" +#include "TasksMeter.h" +#include "LoadAverageMeter.h" +#include "UptimeMeter.h" +#include "BatteryMeter.h" +#include "ClockMeter.h" +#include "HostnameMeter.h" +#include "String.h" + #include #include +#include +#include /*{ +#include "ProcessList.h" +#include "Meter.h" typedef enum HeaderSide_ { LEFT_HEADER, diff -Nru htop-1.0/Header.h htop-1.0.1/Header.h --- htop-1.0/Header.h 2011-11-18 00:57:52.000000000 +0000 +++ htop-1.0.1/Header.h 2011-12-26 21:55:08.000000000 +0000 @@ -9,13 +9,9 @@ in the source distribution for its full text. */ +#include "ProcessList.h" #include "Meter.h" -#include "debug.h" -#include -#include - - typedef enum HeaderSide_ { LEFT_HEADER, RIGHT_HEADER diff -Nru htop-1.0/HostnameMeter.c htop-1.0.1/HostnameMeter.c --- htop-1.0/HostnameMeter.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/HostnameMeter.c 2011-12-26 21:54:43.000000000 +0000 @@ -1,16 +1,19 @@ /* -htop +htop - HostnameMeter.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "HostnameMeter.h" -#include "Meter.h" + +#include "CRT.h" #include -#include "debug.h" +/*{ +#include "Meter.h" +}*/ int HostnameMeter_attributes[] = { HOSTNAME diff -Nru htop-1.0/HostnameMeter.h htop-1.0.1/HostnameMeter.h --- htop-1.0/HostnameMeter.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/HostnameMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,7 +3,7 @@ #ifndef HEADER_HostnameMeter #define HEADER_HostnameMeter /* -htop +htop - HostnameMeter.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -11,10 +11,6 @@ #include "Meter.h" -#include - -#include "debug.h" - extern int HostnameMeter_attributes[]; extern MeterType HostnameMeter; diff -Nru htop-1.0/htop.1 htop-1.0.1/htop.1 --- htop-1.0/htop.1 2011-11-21 02:58:23.000000000 +0000 +++ htop-1.0.1/htop.1 2011-12-26 21:47:30.000000000 +0000 @@ -1,4 +1,4 @@ -.TH "HTOP" "1" "2011" "htop 1.0" "Utils" +.TH "HTOP" "1" "2011" "htop 1.0.1" "Utils" .SH "NAME" htop \- interactive process viewer .SH "SYNOPSIS" diff -Nru htop-1.0/htop.c htop-1.0.1/htop.c --- htop-1.0/htop.c 2011-11-21 02:48:11.000000000 +0000 +++ htop-1.0.1/htop.c 2012-02-02 23:46:25.000000000 +0000 @@ -5,16 +5,8 @@ in the source distribution for its full text. */ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include - #include "ProcessList.h" + #include "CRT.h" #include "Panel.h" #include "UsersTable.h" @@ -23,14 +15,25 @@ #include "ScreenManager.h" #include "FunctionBar.h" #include "ListItem.h" +#include "String.h" +#include "ColumnsPanel.h" #include "CategoriesPanel.h" #include "SignalsPanel.h" #include "TraceScreen.h" #include "OpenFilesScreen.h" #include "AffinityPanel.h" -#include "config.h" -#include "debug.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //#link m @@ -199,6 +202,7 @@ 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); ScreenManager_add(scr, panel, NULL, -1); Panel* panelFocus; @@ -331,7 +335,6 @@ exit(1); } - Panel* panel; int quit = 0; int refreshTimeout = 0; int resetRefreshTimeout = 5; @@ -384,10 +387,11 @@ break; } - CRT_init(settings->delay, settings->colorScheme); + + Panel* panel = Panel_new(0, headerHeight, COLS, LINES - headerHeight - 2, PROCESS_CLASS, false, NULL); + ProcessList_setPanel(pl, panel); - panel = Panel_new(0, headerHeight, COLS, LINES - headerHeight - 2, PROCESS_CLASS, false, NULL); if (sortKey > 0) { pl->sortKey = sortKey; pl->treeView = false; @@ -436,15 +440,10 @@ gettimeofday(&tv, NULL); newTime = ((double)tv.tv_sec * 10) + ((double)tv.tv_usec / 100000); recalculate = (newTime - oldTime > CRT_delay); + int following = follow ? ((Process*)Panel_getSelected(panel))->pid : -1; if (recalculate) oldTime = newTime; if (doRefresh) { - - int currPos = Panel_getSelectedIndex(panel); - pid_t currPid = 0; - int currScrollV = panel->scrollV; - if (follow) - currPid = ProcessList_get(pl, currPos)->pid; if (recalculate || doRecalculate) { ProcessList_scan(pl); doRecalculate = false; @@ -453,27 +452,7 @@ ProcessList_sort(pl); refreshTimeout = 1; } - Panel_prune(panel); - int size = ProcessList_size(pl); - int idx = 0; - for (int i = 0; i < size; i++) { - bool hidden = false; - Process* p = ProcessList_get(pl, i); - - if ( (!p->show) - || (userOnly && (p->st_uid != userId)) - || (filtering && !(String_contains_i(p->comm, incFilter.buffer))) ) - hidden = true; - - if (!hidden) { - Panel_set(panel, idx, (Object*)p); - if ((!follow && idx == currPos) || (follow && p->pid == currPid)) { - Panel_setSelected(panel, idx); - panel->scrollV = currScrollV; - } - idx++; - } - } + ProcessList_rebuildPanel(pl, true, following, userOnly, userId, filtering, incFilter.buffer); } doRefresh = true; @@ -746,6 +725,19 @@ if (!killPanel) { killPanel = (Panel*) SignalsPanel_new(0, 0, 0, 0); } + bool anyTagged = false; + pid_t selectedPid; + for (int i = 0; i < Panel_size(panel); i++) { + Process* p = (Process*) Panel_get(panel, i); + if (p->tag) { + anyTagged = true; + break; + } + } + if (!anyTagged) { + Process* p = (Process*) Panel_getSelected(panel); + selectedPid = p->pid; + } SignalsPanel_reset((SignalsPanel*) killPanel); const char* fuFunctions[] = {"Send ", "Cancel ", NULL}; ListItem* sgn = (ListItem*) pickFromVector(panel, killPanel, 15, headerHeight, fuFunctions, defaultBar, header); @@ -754,17 +746,18 @@ Panel_setHeader(panel, "Sending..."); Panel_draw(panel, true); refresh(); - bool anyTagged = false; - for (int i = 0; i < Panel_size(panel); i++) { - Process* p = (Process*) Panel_get(panel, i); - if (p->tag) { - Process_sendSignal(p, sgn->key); - anyTagged = true; + if (anyTagged) { + for (int i = 0; i < Panel_size(panel); i++) { + Process* p = (Process*) Panel_get(panel, i); + if (p->tag) { + Process_sendSignal(p, sgn->key); + anyTagged = true; + } } - } - if (!anyTagged) { + } else { Process* p = (Process*) Panel_getSelected(panel); - Process_sendSignal(p, sgn->key); + if (p->pid == selectedPid) + Process_sendSignal(p, sgn->key); } napms(500); } @@ -780,6 +773,7 @@ break; Affinity* affinity = Process_getAffinity((Process*) Panel_getSelected(panel)); + if (!affinity) break; Panel* affinityPanel = AffinityPanel_new(pl, affinity); Affinity_delete(affinity); @@ -921,6 +915,5 @@ ((Object*)killPanel)->delete((Object*)killPanel); UsersTable_delete(ut); Settings_delete(settings); - debug_done(); return 0; } diff -Nru htop-1.0/htop.h htop-1.0.1/htop.h --- htop-1.0/htop.h 2011-11-21 02:49:01.000000000 +0000 +++ htop-1.0.1/htop.h 2012-02-02 23:49:19.000000000 +0000 @@ -9,33 +9,6 @@ in the source distribution for its full text. */ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include - -#include "ProcessList.h" -#include "CRT.h" -#include "Panel.h" -#include "UsersTable.h" -#include "RichString.h" -#include "Settings.h" -#include "ScreenManager.h" -#include "FunctionBar.h" -#include "ListItem.h" -#include "CategoriesPanel.h" -#include "SignalsPanel.h" -#include "TraceScreen.h" -#include "OpenFilesScreen.h" -#include "AffinityPanel.h" - -#include "config.h" -#include "debug.h" - //#link m #define INCSEARCH_MAX 40 diff -Nru htop-1.0/ListItem.c htop-1.0.1/ListItem.c --- htop-1.0/ListItem.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/ListItem.c 2011-12-26 21:52:34.000000000 +0000 @@ -6,14 +6,17 @@ */ #include "ListItem.h" + +#include "CRT.h" #include "String.h" -#include "Object.h" #include "RichString.h" -#include -#include "debug.h" +#include +#include +#include /*{ +#include "Object.h" typedef struct ListItem_ { Object super; @@ -49,7 +52,7 @@ Object_setClass(this, LISTITEM_CLASS); ((Object*)this)->display = ListItem_display; ((Object*)this)->delete = ListItem_delete; - this->value = String_copy(value); + this->value = strdup(value); this->key = key; return this; } diff -Nru htop-1.0/ListItem.h htop-1.0.1/ListItem.h --- htop-1.0/ListItem.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/ListItem.h 2011-12-26 21:55:08.000000000 +0000 @@ -9,13 +9,7 @@ in the source distribution for its full text. */ -#include "String.h" #include "Object.h" -#include "RichString.h" -#include - -#include "debug.h" - typedef struct ListItem_ { Object super; diff -Nru htop-1.0/LoadAverageMeter.c htop-1.0.1/LoadAverageMeter.c --- htop-1.0/LoadAverageMeter.c 2011-10-24 23:50:39.000000000 +0000 +++ htop-1.0.1/LoadAverageMeter.c 2011-12-26 21:54:39.000000000 +0000 @@ -1,16 +1,20 @@ /* -htop +htop - LoadAverageMeter.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "LoadAverageMeter.h" -#include "Meter.h" + +#include "CRT.h" #include +#include -#include "debug.h" +/*{ +#include "Meter.h" +}*/ int LoadAverageMeter_attributes[] = { LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_ONE diff -Nru htop-1.0/LoadAverageMeter.h htop-1.0.1/LoadAverageMeter.h --- htop-1.0/LoadAverageMeter.h 2011-10-24 23:50:42.000000000 +0000 +++ htop-1.0.1/LoadAverageMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,7 +3,7 @@ #ifndef HEADER_LoadAverageMeter #define HEADER_LoadAverageMeter /* -htop +htop - LoadAverageMeter.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -11,10 +11,6 @@ #include "Meter.h" -#include - -#include "debug.h" - extern int LoadAverageMeter_attributes[]; extern int LoadMeter_attributes[]; diff -Nru htop-1.0/Makefile.am htop-1.0.1/Makefile.am --- htop-1.0/Makefile.am 2011-11-21 02:47:11.000000000 +0000 +++ htop-1.0.1/Makefile.am 2011-12-26 22:11:41.000000000 +0000 @@ -10,12 +10,11 @@ pixmapdir = $(datadir)/pixmaps pixmap_DATA = htop.png -htop_CFLAGS = -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -AM_CFLAGS = -AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" +htop_CFLAGS = -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"$(sysconfdir)\" +AM_CPPFLAGS = -DNDEBUG myhtopsources = AvailableMetersPanel.c CategoriesPanel.c CheckItem.c \ -ClockMeter.c ColorsPanel.c ColumnsPanel.c CPUMeter.c CRT.c DebugMemory.c \ +ClockMeter.c ColorsPanel.c ColumnsPanel.c CPUMeter.c CRT.c \ DisplayOptionsPanel.c FunctionBar.c Hashtable.c Header.c htop.c ListItem.c \ LoadAverageMeter.c MemoryMeter.c Meter.c MetersPanel.c Object.c Panel.c \ BatteryMeter.c Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \ @@ -25,7 +24,7 @@ myhtopheaders = AvailableColumnsPanel.h AvailableMetersPanel.h \ CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h \ -CPUMeter.h CRT.h DebugMemory.h DisplayOptionsPanel.h FunctionBar.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 \ @@ -35,22 +34,16 @@ SUFFIXES = .h BUILT_SOURCES = $(myhtopheaders) -htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h debug.h +htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h profile: - $(MAKE) all CFLAGS="-pg -O2" + $(MAKE) all CFLAGS="" AM_CPPFLAGS="-pg -O2" debug: - $(MAKE) all CFLAGS="-ggdb -DDEBUG" - -hardened-debug: - $(MAKE) all CFLAGS="-ggdb -DDEBUG" LDFLAGS="-nopie" - -debuglite: - $(MAKE) all CFLAGS="-ggdb -DDEBUGLITE" + $(MAKE) all CFLAGS="" AM_CPPFLAGS="-ggdb -DDEBUG" .c.h: scripts/MakeHeader.py $< cppcheck: - cppcheck -q -v . --enable=all -ihwloc-1.2.1 -DHAVE_CGROUP -DHAVE_OPENVZ -DHAVE_TASKSTATS + cppcheck -q -v . --enable=all -DHAVE_CGROUP -DHAVE_OPENVZ -DHAVE_TASKSTATS diff -Nru htop-1.0/Makefile.in htop-1.0.1/Makefile.in --- htop-1.0/Makefile.in 2011-11-21 02:58:19.000000000 +0000 +++ htop-1.0.1/Makefile.in 2012-02-02 21:45:14.000000000 +0000 @@ -65,21 +65,20 @@ htop-CategoriesPanel.$(OBJEXT) htop-CheckItem.$(OBJEXT) \ htop-ClockMeter.$(OBJEXT) htop-ColorsPanel.$(OBJEXT) \ htop-ColumnsPanel.$(OBJEXT) htop-CPUMeter.$(OBJEXT) \ - htop-CRT.$(OBJEXT) htop-DebugMemory.$(OBJEXT) \ - htop-DisplayOptionsPanel.$(OBJEXT) htop-FunctionBar.$(OBJEXT) \ - htop-Hashtable.$(OBJEXT) htop-Header.$(OBJEXT) \ - htop-htop.$(OBJEXT) htop-ListItem.$(OBJEXT) \ - htop-LoadAverageMeter.$(OBJEXT) htop-MemoryMeter.$(OBJEXT) \ - htop-Meter.$(OBJEXT) htop-MetersPanel.$(OBJEXT) \ - htop-Object.$(OBJEXT) htop-Panel.$(OBJEXT) \ - htop-BatteryMeter.$(OBJEXT) htop-Process.$(OBJEXT) \ - htop-ProcessList.$(OBJEXT) htop-RichString.$(OBJEXT) \ - htop-ScreenManager.$(OBJEXT) htop-Settings.$(OBJEXT) \ - htop-SignalsPanel.$(OBJEXT) htop-String.$(OBJEXT) \ - htop-SwapMeter.$(OBJEXT) htop-TasksMeter.$(OBJEXT) \ - htop-TraceScreen.$(OBJEXT) htop-UptimeMeter.$(OBJEXT) \ - htop-UsersTable.$(OBJEXT) htop-Vector.$(OBJEXT) \ - htop-AvailableColumnsPanel.$(OBJEXT) \ + htop-CRT.$(OBJEXT) htop-DisplayOptionsPanel.$(OBJEXT) \ + htop-FunctionBar.$(OBJEXT) htop-Hashtable.$(OBJEXT) \ + htop-Header.$(OBJEXT) htop-htop.$(OBJEXT) \ + htop-ListItem.$(OBJEXT) htop-LoadAverageMeter.$(OBJEXT) \ + htop-MemoryMeter.$(OBJEXT) htop-Meter.$(OBJEXT) \ + htop-MetersPanel.$(OBJEXT) htop-Object.$(OBJEXT) \ + htop-Panel.$(OBJEXT) htop-BatteryMeter.$(OBJEXT) \ + htop-Process.$(OBJEXT) htop-ProcessList.$(OBJEXT) \ + htop-RichString.$(OBJEXT) htop-ScreenManager.$(OBJEXT) \ + htop-Settings.$(OBJEXT) htop-SignalsPanel.$(OBJEXT) \ + htop-String.$(OBJEXT) htop-SwapMeter.$(OBJEXT) \ + htop-TasksMeter.$(OBJEXT) htop-TraceScreen.$(OBJEXT) \ + htop-UptimeMeter.$(OBJEXT) htop-UsersTable.$(OBJEXT) \ + htop-Vector.$(OBJEXT) htop-AvailableColumnsPanel.$(OBJEXT) \ htop-AffinityPanel.$(OBJEXT) htop-HostnameMeter.$(OBJEXT) \ htop-OpenFilesScreen.$(OBJEXT) htop-Affinity.$(OBJEXT) am_htop_OBJECTS = $(am__objects_1) $(am__objects_2) @@ -264,11 +263,10 @@ applications_DATA = htop.desktop pixmapdir = $(datadir)/pixmaps pixmap_DATA = htop.png -htop_CFLAGS = -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -AM_CFLAGS = -AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" +htop_CFLAGS = -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"$(sysconfdir)\" +AM_CPPFLAGS = -DNDEBUG myhtopsources = AvailableMetersPanel.c CategoriesPanel.c CheckItem.c \ -ClockMeter.c ColorsPanel.c ColumnsPanel.c CPUMeter.c CRT.c DebugMemory.c \ +ClockMeter.c ColorsPanel.c ColumnsPanel.c CPUMeter.c CRT.c \ DisplayOptionsPanel.c FunctionBar.c Hashtable.c Header.c htop.c ListItem.c \ LoadAverageMeter.c MemoryMeter.c Meter.c MetersPanel.c Object.c Panel.c \ BatteryMeter.c Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \ @@ -278,7 +276,7 @@ myhtopheaders = AvailableColumnsPanel.h AvailableMetersPanel.h \ CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h \ -CPUMeter.h CRT.h DebugMemory.h DisplayOptionsPanel.h FunctionBar.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 \ @@ -287,7 +285,7 @@ SUFFIXES = .h BUILT_SOURCES = $(myhtopheaders) -htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h debug.h +htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -411,7 +409,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-ClockMeter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-ColorsPanel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-ColumnsPanel.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-DebugMemory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-DisplayOptionsPanel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-FunctionBar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop-Hashtable.Po@am__quote@ @@ -573,20 +570,6 @@ @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-CRT.obj `if test -f 'CRT.c'; then $(CYGPATH_W) 'CRT.c'; else $(CYGPATH_W) '$(srcdir)/CRT.c'; fi` -htop-DebugMemory.o: DebugMemory.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -MT htop-DebugMemory.o -MD -MP -MF $(DEPDIR)/htop-DebugMemory.Tpo -c -o htop-DebugMemory.o `test -f 'DebugMemory.c' || echo '$(srcdir)/'`DebugMemory.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/htop-DebugMemory.Tpo $(DEPDIR)/htop-DebugMemory.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='DebugMemory.c' object='htop-DebugMemory.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-DebugMemory.o `test -f 'DebugMemory.c' || echo '$(srcdir)/'`DebugMemory.c - -htop-DebugMemory.obj: DebugMemory.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -MT htop-DebugMemory.obj -MD -MP -MF $(DEPDIR)/htop-DebugMemory.Tpo -c -o htop-DebugMemory.obj `if test -f 'DebugMemory.c'; then $(CYGPATH_W) 'DebugMemory.c'; else $(CYGPATH_W) '$(srcdir)/DebugMemory.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/htop-DebugMemory.Tpo $(DEPDIR)/htop-DebugMemory.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='DebugMemory.c' object='htop-DebugMemory.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-DebugMemory.obj `if test -f 'DebugMemory.c'; then $(CYGPATH_W) 'DebugMemory.c'; else $(CYGPATH_W) '$(srcdir)/DebugMemory.c'; fi` - htop-DisplayOptionsPanel.o: DisplayOptionsPanel.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(htop_CFLAGS) $(CFLAGS) -MT htop-DisplayOptionsPanel.o -MD -MP -MF $(DEPDIR)/htop-DisplayOptionsPanel.Tpo -c -o htop-DisplayOptionsPanel.o `test -f 'DisplayOptionsPanel.c' || echo '$(srcdir)/'`DisplayOptionsPanel.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/htop-DisplayOptionsPanel.Tpo $(DEPDIR)/htop-DisplayOptionsPanel.Po @@ -1455,22 +1438,16 @@ profile: - $(MAKE) all CFLAGS="-pg -O2" + $(MAKE) all CFLAGS="" AM_CPPFLAGS="-pg -O2" debug: - $(MAKE) all CFLAGS="-ggdb -DDEBUG" - -hardened-debug: - $(MAKE) all CFLAGS="-ggdb -DDEBUG" LDFLAGS="-nopie" - -debuglite: - $(MAKE) all CFLAGS="-ggdb -DDEBUGLITE" + $(MAKE) all CFLAGS="" AM_CPPFLAGS="-ggdb -DDEBUG" .c.h: scripts/MakeHeader.py $< cppcheck: - cppcheck -q -v . --enable=all -ihwloc-1.2.1 -DHAVE_CGROUP -DHAVE_OPENVZ -DHAVE_TASKSTATS + cppcheck -q -v . --enable=all -DHAVE_CGROUP -DHAVE_OPENVZ -DHAVE_TASKSTATS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru htop-1.0/MemoryMeter.c htop-1.0.1/MemoryMeter.c --- htop-1.0/MemoryMeter.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/MemoryMeter.c 2011-12-26 21:54:34.000000000 +0000 @@ -1,13 +1,13 @@ /* -htop +htop - MemoryMeter.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "MemoryMeter.h" -#include "Meter.h" +#include "CRT.h" #include "ProcessList.h" #include @@ -15,10 +15,12 @@ #include #include #include - -#include "debug.h" #include +/*{ +#include "Meter.h" +}*/ + int MemoryMeter_attributes[] = { MEMORY_USED, MEMORY_BUFFERS, MEMORY_CACHE }; diff -Nru htop-1.0/MemoryMeter.h htop-1.0.1/MemoryMeter.h --- htop-1.0/MemoryMeter.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/MemoryMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,7 +3,7 @@ #ifndef HEADER_MemoryMeter #define HEADER_MemoryMeter /* -htop +htop - MemoryMeter.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -11,17 +11,6 @@ #include "Meter.h" -#include "ProcessList.h" - -#include -#include -#include -#include -#include - -#include "debug.h" -#include - extern int MemoryMeter_attributes[]; extern MeterType MemoryMeter; diff -Nru htop-1.0/Meter.c htop-1.0.1/Meter.c --- htop-1.0/Meter.c 2011-11-16 18:52:15.000000000 +0000 +++ htop-1.0.1/Meter.c 2012-02-02 23:06:38.000000000 +0000 @@ -5,30 +5,39 @@ in the source distribution for its full text. */ -#include "RichString.h" #include "Meter.h" + +#include "CPUMeter.h" +#include "MemoryMeter.h" +#include "SwapMeter.h" +#include "TasksMeter.h" +#include "LoadAverageMeter.h" +#include "UptimeMeter.h" +#include "BatteryMeter.h" +#include "ClockMeter.h" +#include "HostnameMeter.h" +#include "RichString.h" #include "Object.h" #include "CRT.h" -#include "ListItem.h" #include "String.h" -#include "ProcessList.h" +#include "ListItem.h" #include #include #include #include - -#include "debug.h" #include +#include #ifndef USE_FUNKY_MODES -#include #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; @@ -96,17 +105,6 @@ }*/ -#include "CPUMeter.h" -#include "MemoryMeter.h" -#include "SwapMeter.h" -#include "TasksMeter.h" -#include "LoadAverageMeter.h" -#include "UptimeMeter.h" -#include "BatteryMeter.h" -#include "ClockMeter.h" -#include "HostnameMeter.h" - - #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif diff -Nru htop-1.0/Meter.h htop-1.0.1/Meter.h --- htop-1.0/Meter.h 2011-11-16 18:52:16.000000000 +0000 +++ htop-1.0.1/Meter.h 2012-02-02 23:06:38.000000000 +0000 @@ -9,28 +9,14 @@ in the source distribution for its full text. */ -#include "RichString.h" -#include "Object.h" -#include "CRT.h" -#include "ListItem.h" -#include "String.h" -#include "ProcessList.h" - -#include -#include -#include -#include - -#include "debug.h" -#include - #ifndef USE_FUNKY_MODES -#include #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; @@ -97,17 +83,6 @@ } MeterModeId; -#include "CPUMeter.h" -#include "MemoryMeter.h" -#include "SwapMeter.h" -#include "TasksMeter.h" -#include "LoadAverageMeter.h" -#include "UptimeMeter.h" -#include "BatteryMeter.h" -#include "ClockMeter.h" -#include "HostnameMeter.h" - - #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif diff -Nru htop-1.0/MetersPanel.c htop-1.0.1/MetersPanel.c --- htop-1.0/MetersPanel.c 2011-11-18 00:56:38.000000000 +0000 +++ htop-1.0.1/MetersPanel.c 2011-12-26 21:54:27.000000000 +0000 @@ -1,14 +1,19 @@ +/* +htop - MetersPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "MetersPanel.h" -#include "Panel.h" -#include "Settings.h" -#include "ScreenManager.h" - -#include "debug.h" +#include #include /*{ +#include "Panel.h" +#include "Settings.h" +#include "ScreenManager.h" typedef struct MetersPanel_ { Panel super; diff -Nru htop-1.0/MetersPanel.h htop-1.0.1/MetersPanel.h --- htop-1.0/MetersPanel.h 2011-11-18 00:57:52.000000000 +0000 +++ htop-1.0.1/MetersPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,16 +2,17 @@ #ifndef HEADER_MetersPanel #define HEADER_MetersPanel - +/* +htop - MetersPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "Panel.h" #include "Settings.h" #include "ScreenManager.h" -#include "debug.h" -#include - - typedef struct MetersPanel_ { Panel super; diff -Nru htop-1.0/Object.c htop-1.0.1/Object.c --- htop-1.0/Object.c 2011-10-24 23:56:54.000000000 +0000 +++ htop-1.0.1/Object.c 2011-12-26 21:52:30.000000000 +0000 @@ -1,20 +1,20 @@ /* -htop +htop - Object.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "Object.h" -#include "RichString.h" + #include "CRT.h" + #include #include #include -#include "debug.h" - /*{ +#include "RichString.h" #ifndef DEBUG #define Object_setClass(obj, class) diff -Nru htop-1.0/Object.h htop-1.0.1/Object.h --- htop-1.0/Object.h 2011-10-24 23:58:26.000000000 +0000 +++ htop-1.0.1/Object.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,20 +3,13 @@ #ifndef HEADER_Object #define HEADER_Object /* -htop +htop - Object.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "RichString.h" -#include "CRT.h" -#include -#include -#include - -#include "debug.h" - #ifndef DEBUG #define Object_setClass(obj, class) diff -Nru htop-1.0/OpenFilesScreen.c htop-1.0.1/OpenFilesScreen.c --- htop-1.0/OpenFilesScreen.c 2011-11-17 22:35:41.000000000 +0000 +++ htop-1.0.1/OpenFilesScreen.c 2011-12-26 21:06:59.000000000 +0000 @@ -5,24 +5,27 @@ in the source distribution for its full text. */ -#define _GNU_SOURCE +#include "OpenFilesScreen.h" + +#include "CRT.h" +#include "ProcessList.h" +#include "ListItem.h" + +#include #include #include #include #include +#include #include #include #include -#include "OpenFilesScreen.h" -#include "ProcessList.h" +/*{ #include "Process.h" -#include "ListItem.h" #include "Panel.h" #include "FunctionBar.h" -/*{ - typedef struct OpenFiles_ProcessData_ { char* data[256]; struct OpenFiles_FileData_* files; diff -Nru htop-1.0/OpenFilesScreen.h htop-1.0.1/OpenFilesScreen.h --- htop-1.0/OpenFilesScreen.h 2011-11-17 22:35:42.000000000 +0000 +++ htop-1.0.1/OpenFilesScreen.h 2011-12-26 21:55:08.000000000 +0000 @@ -9,22 +9,10 @@ in the source distribution for its full text. */ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include - -#include "ProcessList.h" #include "Process.h" -#include "ListItem.h" #include "Panel.h" #include "FunctionBar.h" - typedef struct OpenFiles_ProcessData_ { char* data[256]; struct OpenFiles_FileData_* files; diff -Nru htop-1.0/Panel.c htop-1.0.1/Panel.c --- htop-1.0/Panel.c 2011-11-17 23:47:15.000000000 +0000 +++ htop-1.0.1/Panel.c 2012-02-02 23:45:01.000000000 +0000 @@ -5,23 +5,26 @@ in the source distribution for its full text. */ -#include "Object.h" #include "Panel.h" -#include "Vector.h" + #include "CRT.h" #include "RichString.h" #include "ListItem.h" +#include "String.h" #include #include - -#include "debug.h" +#include +#include +#include #include - #include + //#link curses /*{ +#include "Object.h" +#include "Vector.h" typedef struct Panel_ Panel; diff -Nru htop-1.0/Panel.h htop-1.0.1/Panel.h --- htop-1.0/Panel.h 2011-11-17 23:47:41.000000000 +0000 +++ htop-1.0.1/Panel.h 2012-02-02 23:49:19.000000000 +0000 @@ -9,21 +9,10 @@ in the source distribution for its full text. */ -#include "Object.h" -#include "Vector.h" -#include "CRT.h" -#include "RichString.h" -#include "ListItem.h" - -#include -#include - -#include "debug.h" -#include - -#include //#link curses +#include "Object.h" +#include "Vector.h" typedef struct Panel_ Panel; @@ -117,7 +106,6 @@ bool Panel_onKey(Panel* this, int key); - HandlerResult Panel_selectByTyping(Panel* this, int ch); #endif diff -Nru htop-1.0/Process.c htop-1.0.1/Process.c --- htop-1.0/Process.c 2011-11-21 02:47:49.000000000 +0000 +++ htop-1.0.1/Process.c 2011-12-26 21:54:07.000000000 +0000 @@ -5,29 +5,27 @@ in the source distribution for its full text. */ +#include "Process.h" + #include "ProcessList.h" -#include "Object.h" #include "CRT.h" #include "String.h" -#include "Process.h" #include "RichString.h" -#include "Affinity.h" - -#include "debug.h" #include #include #include #include -#include #include #include +#include #include #include #include #include #include #include +#include #ifdef HAVE_LIBHWLOC #include @@ -41,6 +39,9 @@ #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) /*{ +#include "Object.h" +#include "Affinity.h" +#include #ifndef Process_isKernelThread #define Process_isKernelThread(_process) (_process->pgrp == 0) @@ -312,19 +313,24 @@ double realTime = t * jiffytime; int iRealTime = (int) realTime; - int hours = iRealTime / 3600; + unsigned long long hours = iRealTime / 3600; int minutes = (iRealTime / 60) % 60; int seconds = iRealTime % 60; int hundredths = (realTime - iRealTime) * 100; char buffer[11]; - if (hours) { - snprintf(buffer, 10, "%2dh", hours); + if (hours >= 100) { + snprintf(buffer, 10, "%7lluh ", hours); RichString_append(str, CRT_colors[LARGE_NUMBER], buffer); - snprintf(buffer, 10, "%02d:%02d ", minutes, seconds); } else { - snprintf(buffer, 10, "%2d:%02d.%02d ", minutes, seconds, hundredths); + if (hours) { + snprintf(buffer, 10, "%2lluh", hours); + RichString_append(str, CRT_colors[LARGE_NUMBER], buffer); + snprintf(buffer, 10, "%02d:%02d ", minutes, seconds); + } else { + snprintf(buffer, 10, "%2d:%02d.%02d ", minutes, seconds, hundredths); + } + RichString_append(str, CRT_colors[DEFAULT_COLOR], buffer); } - RichString_append(str, CRT_colors[DEFAULT_COLOR], buffer); } static inline void Process_writeCommand(Process* this, int attr, int baseattr, RichString* str) { diff -Nru htop-1.0/Process.h htop-1.0.1/Process.h --- htop-1.0/Process.h 2011-11-21 02:49:01.000000000 +0000 +++ htop-1.0.1/Process.h 2011-12-26 21:55:08.000000000 +0000 @@ -9,31 +9,7 @@ in the source distribution for its full text. */ -#include "ProcessList.h" -#include "Object.h" -#include "CRT.h" -#include "String.h" -#include "RichString.h" -#include "Affinity.h" - -#include "debug.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #ifdef HAVE_LIBHWLOC -#include #endif // This works only with glibc 2.1+. On earlier versions @@ -43,6 +19,9 @@ #endif #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) +#include "Object.h" +#include "Affinity.h" +#include #ifndef Process_isKernelThread #define Process_isKernelThread(_process) (_process->pgrp == 0) diff -Nru htop-1.0/ProcessList.c htop-1.0.1/ProcessList.c --- htop-1.0/ProcessList.c 2011-11-21 02:47:37.000000000 +0000 +++ htop-1.0.1/ProcessList.c 2012-02-02 23:45:11.000000000 +0000 @@ -5,19 +5,13 @@ in the source distribution for its full text. */ -#ifndef CONFIG_H -#define CONFIG_H -#include "config.h" -#endif - #include "ProcessList.h" -#include "Process.h" -#include "Vector.h" -#include "UsersTable.h" -#include "Hashtable.h" + +#include "CRT.h" #include "String.h" -#include +#include +#include #include #include #include @@ -25,14 +19,19 @@ #include #include #include -#include #include #include - -#include "debug.h" +#include +#include #include /*{ +#include "Vector.h" +#include "Hashtable.h" +#include "UsersTable.h" +#include "Panel.h" +#include "Process.h" +#include #ifndef PROCDIR #define PROCDIR "/proc" @@ -109,6 +108,13 @@ Hashtable* processTable; UsersTable* usersTable; + Panel* panel; + int following; + bool userOnly; + uid_t userId; + bool filtering; + const char* incFilter; + int cpuCount; int totalTasks; int userlandThreads; @@ -243,6 +249,10 @@ free(this); } +void ProcessList_setPanel(ProcessList* this, Panel* panel) { + this->panel = panel; +} + void ProcessList_invertSortOrder(ProcessList* this) { if (this->direction == 1) this->direction = -1; @@ -605,7 +615,7 @@ command[amtRead] = '\0'; fclose(file); free(process->comm); - process->comm = String_copy(command); + process->comm = strdup(command); return true; } @@ -698,11 +708,11 @@ if (process->state == 'Z') { free(process->comm); - process->comm = String_copy(command); + process->comm = strdup(command); } else if (Process_isThread(process)) { if (this->showThreadNames || Process_isKernelThread(process) || process->state == 'Z') { free(process->comm); - process->comm = String_copy(command); + process->comm = strdup(command); } else if (this->showingThreadNames) { if (! ProcessList_readCmdlineFile(process, dirname, name)) goto errorReadingProcess; @@ -888,3 +898,45 @@ process->showChildren = true; } } + +void ProcessList_rebuildPanel(ProcessList* this, bool flags, int following, bool userOnly, uid_t userId, bool filtering, 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; + } + + int currPos = Panel_getSelectedIndex(this->panel); + pid_t currPid = following ? following : 0; + int currScrollV = this->panel->scrollV; + + Panel_prune(this->panel); + int size = ProcessList_size(this); + int idx = 0; + for (int i = 0; i < size; i++) { + bool hidden = false; + Process* p = ProcessList_get(this, i); + + if ( (!p->show) + || (userOnly && (p->st_uid != userId)) + || (filtering && !(String_contains_i(p->comm, incFilter))) ) + hidden = true; + + if (!hidden) { + Panel_set(this->panel, idx, (Object*)p); + if ((following == -1 && idx == currPos) || (following != -1 && p->pid == currPid)) { + Panel_setSelected(this->panel, idx); + this->panel->scrollV = currScrollV; + } + idx++; + } + } +} diff -Nru htop-1.0/ProcessList.h htop-1.0.1/ProcessList.h --- htop-1.0/ProcessList.h 2011-11-21 02:49:01.000000000 +0000 +++ htop-1.0.1/ProcessList.h 2012-02-02 23:49:19.000000000 +0000 @@ -9,32 +9,12 @@ in the source distribution for its full text. */ -#ifndef CONFIG_H -#define CONFIG_H -#include "config.h" -#endif - -#include "Process.h" #include "Vector.h" -#include "UsersTable.h" #include "Hashtable.h" -#include "String.h" - +#include "UsersTable.h" +#include "Panel.h" +#include "Process.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#include - #ifndef PROCDIR #define PROCDIR "/proc" @@ -111,6 +91,13 @@ Hashtable* processTable; UsersTable* usersTable; + Panel* panel; + int following; + bool userOnly; + uid_t userId; + bool filtering; + const char* incFilter; + int cpuCount; int totalTasks; int userlandThreads; @@ -161,6 +148,8 @@ void ProcessList_delete(ProcessList* this); +void ProcessList_setPanel(ProcessList* this, Panel* panel); + void ProcessList_invertSortOrder(ProcessList* this); void ProcessList_printHeader(ProcessList* this, RichString* header); @@ -194,4 +183,6 @@ void ProcessList_expandTree(ProcessList* this); +void ProcessList_rebuildPanel(ProcessList* this, bool flags, int following, bool userOnly, uid_t userId, bool filtering, const char* incFilter); + #endif diff -Nru htop-1.0/RichString.c htop-1.0.1/RichString.c --- htop-1.0/RichString.c 2011-11-18 05:56:13.000000000 +0000 +++ htop-1.0.1/RichString.c 2011-12-26 21:53:45.000000000 +0000 @@ -1,16 +1,21 @@ +/* +htop - RichString.c +(C) 2004,2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "RichString.h" -#ifndef CONFIG_H -#define CONFIG_H -#include "config.h" -#endif - #include #include + +#define RICHSTRING_MAXLEN 300 + +/*{ +#include "config.h" #include -#include "debug.h" #include #ifdef HAVE_NCURSESW_CURSES_H #include @@ -22,10 +27,6 @@ #include #endif -#define RICHSTRING_MAXLEN 300 - -/*{ - #define RichString_size(this) ((this)->chlen) #define RichString_sizeVal(this) ((this).chlen) diff -Nru htop-1.0/RichString.h htop-1.0.1/RichString.h --- htop-1.0/RichString.h 2011-11-18 05:56:14.000000000 +0000 +++ htop-1.0.1/RichString.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,18 +2,18 @@ #ifndef HEADER_RichString #define HEADER_RichString +/* +htop - RichString.h +(C) 2004,2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ +#define RICHSTRING_MAXLEN 300 -#ifndef CONFIG_H -#define CONFIG_H #include "config.h" -#endif - -#include -#include #include -#include "debug.h" #include #ifdef HAVE_NCURSESW_CURSES_H #include @@ -25,9 +25,6 @@ #include #endif -#define RICHSTRING_MAXLEN 300 - - #define RichString_size(this) ((this)->chlen) #define RichString_sizeVal(this) ((this).chlen) diff -Nru htop-1.0/ScreenManager.c htop-1.0.1/ScreenManager.c --- htop-1.0/ScreenManager.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/ScreenManager.c 2011-12-26 21:53:40.000000000 +0000 @@ -1,24 +1,24 @@ /* -htop +htop - ScreenManager.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "ScreenManager.h" + #include "Panel.h" #include "Object.h" -#include "Vector.h" -#include "Header.h" -#include "FunctionBar.h" -#include "debug.h" #include #include - +#include #include /*{ +#include "FunctionBar.h" +#include "Vector.h" +#include "Header.h" typedef enum Orientation_ { VERTICAL, @@ -31,13 +31,14 @@ int x2; int y2; Orientation orientation; - Vector* items; + Vector* panels; Vector* fuBars; - int itemCount; + int panelCount; const FunctionBar* fuBar; const Header* header; time_t lastScan; bool owner; + bool allowFocusChange; } ScreenManager; }*/ @@ -51,29 +52,30 @@ this->y2 = y2; this->fuBar = NULL; this->orientation = orientation; - this->items = Vector_new(PANEL_CLASS, owner, DEFAULT_SIZE, NULL); + this->panels = Vector_new(PANEL_CLASS, owner, DEFAULT_SIZE, NULL); this->fuBars = Vector_new(FUNCTIONBAR_CLASS, true, DEFAULT_SIZE, NULL); - this->itemCount = 0; + this->panelCount = 0; this->header = header; this->owner = owner; + this->allowFocusChange = true; return this; } void ScreenManager_delete(ScreenManager* this) { - Vector_delete(this->items); + Vector_delete(this->panels); Vector_delete(this->fuBars); free(this); } inline int ScreenManager_size(ScreenManager* this) { - return this->itemCount; + return this->panelCount; } void ScreenManager_add(ScreenManager* this, Panel* item, FunctionBar* fuBar, int size) { if (this->orientation == HORIZONTAL) { int lastX = 0; - if (this->itemCount > 0) { - Panel* last = (Panel*) Vector_get(this->items, this->itemCount - 1); + if (this->panelCount > 0) { + Panel* last = (Panel*) Vector_get(this->panels, this->panelCount - 1); lastX = last->x + last->w + 1; } if (size > 0) { @@ -84,22 +86,22 @@ Panel_move(item, lastX, this->y1); } // TODO: VERTICAL - Vector_add(this->items, item); + Vector_add(this->panels, item); if (fuBar) Vector_add(this->fuBars, fuBar); else Vector_add(this->fuBars, FunctionBar_new(NULL, NULL, NULL)); if (!this->fuBar && fuBar) this->fuBar = fuBar; item->needsRedraw = true; - this->itemCount++; + this->panelCount++; } Panel* ScreenManager_remove(ScreenManager* this, int idx) { - assert(this->itemCount > idx); - Panel* panel = (Panel*) Vector_remove(this->items, idx); + assert(this->panelCount > idx); + Panel* panel = (Panel*) Vector_remove(this->panels, idx); Vector_remove(this->fuBars, idx); this->fuBar = NULL; - this->itemCount--; + this->panelCount--; return panel; } @@ -108,15 +110,15 @@ this->y1 = y1; this->x2 = x2; this->y2 = y2; - int items = this->itemCount; + int panels = this->panelCount; int lastX = 0; - for (int i = 0; i < items - 1; i++) { - Panel* panel = (Panel*) Vector_get(this->items, i); + for (int i = 0; i < panels - 1; i++) { + Panel* panel = (Panel*) Vector_get(this->panels, i); Panel_resize(panel, panel->w, LINES-y1+y2); Panel_move(panel, lastX, y1); lastX = panel->x + panel->w + 1; } - Panel* panel = (Panel*) Vector_get(this->items, items-1); + Panel* panel = (Panel*) Vector_get(this->panels, panels-1); Panel_resize(panel, COLS-x1+x2-lastX, LINES-y1+y2); Panel_move(panel, lastX, y1); } @@ -125,7 +127,7 @@ bool quit = false; int focus = 0; - Panel* panelFocus = (Panel*) Vector_get(this->items, focus); + Panel* panelFocus = (Panel*) Vector_get(this->panels, focus); if (this->fuBar) FunctionBar_draw(this->fuBar, NULL); @@ -133,19 +135,21 @@ int ch = 0; while (!quit) { - int items = this->itemCount; + int panels = this->panelCount; if (this->header) { time_t now = time(NULL); if (now > this->lastScan) { ProcessList_scan(this->header->pl); + ProcessList_sort(this->header->pl); this->lastScan = now; } Header_draw(this->header); + ProcessList_rebuildPanel(this->header->pl, false, false, false, false, false, NULL); } - for (int i = 0; i < items; i++) { - Panel* panel = (Panel*) Vector_get(this->items, i); + for (int i = 0; i < panels; i++) { + Panel* panel = (Panel*) Vector_get(this->panels, i); Panel_draw(panel, i == focus); - if (i < items) { + if (i < panels) { if (this->orientation == HORIZONTAL) { mvvline(panel->y, panel->x+panel->w, ' ', panel->h+1); } @@ -166,8 +170,8 @@ if (mevent.y == LINES - 1) { ch = FunctionBar_synthesizeEvent(this->fuBar, mevent.x); } else { - for (int i = 0; i < this->itemCount; i++) { - Panel* panel = (Panel*) Vector_get(this->items, i); + 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) { focus = i; @@ -200,21 +204,25 @@ } case KEY_LEFT: case KEY_CTRLB: + if (!this->allowFocusChange) + break; tryLeft: if (focus > 0) focus--; - panelFocus = (Panel*) Vector_get(this->items, focus); + panelFocus = (Panel*) Vector_get(this->panels, focus); if (Panel_size(panelFocus) == 0 && focus > 0) goto tryLeft; break; case KEY_RIGHT: case KEY_CTRLF: case 9: + if (!this->allowFocusChange) + break; tryRight: - if (focus < this->itemCount - 1) + if (focus < this->panelCount - 1) focus++; - panelFocus = (Panel*) Vector_get(this->items, focus); - if (Panel_size(panelFocus) == 0 && focus < this->itemCount - 1) + panelFocus = (Panel*) Vector_get(this->panels, focus); + if (Panel_size(panelFocus) == 0 && focus < this->panelCount - 1) goto tryRight; break; case KEY_F(10): diff -Nru htop-1.0/ScreenManager.h htop-1.0.1/ScreenManager.h --- htop-1.0/ScreenManager.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/ScreenManager.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,24 +3,15 @@ #ifndef HEADER_ScreenManager #define HEADER_ScreenManager /* -htop +htop - ScreenManager.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ -#include "Panel.h" -#include "Object.h" +#include "FunctionBar.h" #include "Vector.h" #include "Header.h" -#include "FunctionBar.h" - -#include "debug.h" -#include -#include - -#include - typedef enum Orientation_ { VERTICAL, @@ -33,13 +24,14 @@ int x2; int y2; Orientation orientation; - Vector* items; + Vector* panels; Vector* fuBars; - int itemCount; + int panelCount; const FunctionBar* fuBar; const Header* header; time_t lastScan; bool owner; + bool allowFocusChange; } ScreenManager; diff -Nru htop-1.0/scripts/MakeHeader.py htop-1.0.1/scripts/MakeHeader.py --- htop-1.0/scripts/MakeHeader.py 2011-08-26 19:57:37.000000000 +0000 +++ htop-1.0.1/scripts/MakeHeader.py 2011-12-26 21:26:17.000000000 +0000 @@ -30,6 +30,7 @@ out.write( "#ifndef HEADER_" + name ) out.write( "#define HEADER_" + name ) +is_blank = False for line in file.readlines(): line = line[:-1] if state == ANY: @@ -37,6 +38,8 @@ state = COPY elif line == selfheader: pass + elif line.find("#include") == 0: + pass elif line.find("htop - ") == 0 and line[-2:] == ".c": out.write(line[:-2] + ".h") elif line.find("static ") != -1: @@ -58,14 +61,22 @@ state = SKIP else: out.write( line ) + is_blank = False + elif line == "": + if not is_blank: + out.write( line ) + is_blank = True else: out.write( line ) + is_blank = False elif state == COPY: + is_blank = False if line == "}*/": state = ANY else: out.write( line ) elif state == SKIP: + is_blank = False if len(line) >= 1 and line[0] == "}": if static == 1: state = SKIPONE @@ -73,6 +84,7 @@ state = ANY static = 0 elif state == SKIPONE: + is_blank = False state = ANY out.write( "" ) diff -Nru htop-1.0/Settings.c htop-1.0.1/Settings.c --- htop-1.0/Settings.c 2011-11-17 21:09:57.000000000 +0000 +++ htop-1.0.1/Settings.c 2011-12-26 21:53:26.000000000 +0000 @@ -6,15 +6,21 @@ */ #include "Settings.h" + #include "String.h" -#include "ProcessList.h" -#include "Header.h" +#include "Vector.h" -#include "debug.h" +#include +#include +#include +#include #define DEFAULT_DELAY 15 /*{ +#include "ProcessList.h" +#include "Header.h" +#include typedef struct Settings_ { char* userSettings; @@ -56,13 +62,10 @@ } static bool Settings_read(Settings* this, char* fileName, int cpuCount) { - // TODO: implement File object and make - // file I/O object-oriented. - FILE* fd; - fd = fopen(fileName, "r"); - if (fd == NULL) { + FILE* fd = fopen(fileName, "r"); + if (!fd) return false; - } + const int maxLine = 2048; char buffer[maxLine]; bool readMeters = false; @@ -212,21 +215,47 @@ Settings* this = malloc(sizeof(Settings)); this->pl = pl; this->header = header; - const char* home; - char* rcfile; - home = getenv("HOME_ETC"); - if (!home) home = getenv("HOME"); - if (!home) home = ""; - rcfile = getenv("HOMERC"); - if (!rcfile) - this->userSettings = String_cat(home, "/.htoprc"); - else - this->userSettings = String_copy(rcfile); + char* legacyDotfile = NULL; + char* rcfile = getenv("HTOPRC"); + if (rcfile) { + this->userSettings = strdup(rcfile); + } else { + const char* home = getenv("HOME"); + if (!home) home = ""; + const char* xdgConfigHome = getenv("XDG_CONFIG_HOME"); + char* configDir = NULL; + char* htopDir = NULL; + if (xdgConfigHome) { + this->userSettings = String_cat(xdgConfigHome, "/htop/htoprc"); + configDir = strdup(xdgConfigHome); + htopDir = String_cat(xdgConfigHome, "/htop"); + } else { + this->userSettings = String_cat(home, "/.config/htop/htoprc"); + configDir = String_cat(home, "/.config"); + htopDir = String_cat(home, "/.config/htop"); + } + legacyDotfile = String_cat(home, "/.htoprc"); + mkdir(configDir, 0700); + mkdir(htopDir, 0700); + free(htopDir); + free(configDir); + if (access(legacyDotfile, R_OK) != 0) { + free(legacyDotfile); + legacyDotfile = NULL; + } + } this->colorScheme = 0; this->changed = false; this->delay = DEFAULT_DELAY; - bool ok = Settings_read(this, this->userSettings, cpuCount); - if (!ok) { + bool ok = Settings_read(this, legacyDotfile ? legacyDotfile : this->userSettings, cpuCount); + if (ok) { + if (legacyDotfile) { + // Transition to new location and delete old configuration file + if (Settings_write(this)) + unlink(legacyDotfile); + free(legacyDotfile); + } + } else { this->changed = true; // TODO: how to get SYSCONFDIR correctly through Autoconf? char* systemSettings = String_cat(SYSCONFDIR, "/htoprc"); diff -Nru htop-1.0/Settings.h htop-1.0.1/Settings.h --- htop-1.0/Settings.h 2011-11-17 21:09:58.000000000 +0000 +++ htop-1.0.1/Settings.h 2011-12-26 21:55:08.000000000 +0000 @@ -9,14 +9,11 @@ in the source distribution for its full text. */ -#include "String.h" -#include "ProcessList.h" -#include "Header.h" - -#include "debug.h" - #define DEFAULT_DELAY 15 +#include "ProcessList.h" +#include "Header.h" +#include typedef struct Settings_ { char* userSettings; diff -Nru htop-1.0/SignalsPanel.c htop-1.0.1/SignalsPanel.c --- htop-1.0/SignalsPanel.c 2011-11-05 04:54:13.000000000 +0000 +++ htop-1.0.1/SignalsPanel.c 2011-12-26 21:53:34.000000000 +0000 @@ -1,15 +1,22 @@ +/* +htop - SignalsPanel.c +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "SignalsPanel.h" -#include "Panel.h" + #include "ListItem.h" #include "RichString.h" -#include "debug.h" +#include #include #include /*{ +#include "Panel.h" typedef struct SignalItem_ { const char* name; diff -Nru htop-1.0/SignalsPanel.h htop-1.0.1/SignalsPanel.h --- htop-1.0/SignalsPanel.h 2011-11-05 04:54:14.000000000 +0000 +++ htop-1.0.1/SignalsPanel.h 2011-12-26 21:55:08.000000000 +0000 @@ -2,16 +2,14 @@ #ifndef HEADER_SignalsPanel #define HEADER_SignalsPanel +/* +htop - SignalsPanel.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ #include "Panel.h" -#include "ListItem.h" -#include "RichString.h" - -#include "debug.h" -#include - -#include - typedef struct SignalItem_ { const char* name; diff -Nru htop-1.0/String.c htop-1.0.1/String.c --- htop-1.0/String.c 2011-08-29 19:07:54.000000000 +0000 +++ htop-1.0.1/String.c 2011-12-26 21:53:20.000000000 +0000 @@ -1,27 +1,23 @@ /* -htop +htop - String.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ -#define _GNU_SOURCE #include "String.h" + +#include "config.h" + #include #include #include #include -#include "debug.h" - /*{ #define String_startsWith(s, match) (strstr((s), (match)) == (s)) }*/ -inline char* String_copy(const char* orig) { - return strdup(orig); -} - char* String_cat(const char* s1, const char* s2) { int l1 = strlen(s1); int l2 = strlen(s2); diff -Nru htop-1.0/String.h htop-1.0.1/String.h --- htop-1.0/String.h 2011-09-20 21:39:14.000000000 +0000 +++ htop-1.0.1/String.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,23 +3,14 @@ #ifndef HEADER_String #define HEADER_String /* -htop +htop - String.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ -#include -#include -#include -#include - -#include "debug.h" - #define String_startsWith(s, match) (strstr((s), (match)) == (s)) -extern char* String_copy(const char* orig); - char* String_cat(const char* s1, const char* s2); char* String_trim(const char* in); diff -Nru htop-1.0/SwapMeter.c htop-1.0.1/SwapMeter.c --- htop-1.0/SwapMeter.c 2011-09-08 04:40:02.000000000 +0000 +++ htop-1.0.1/SwapMeter.c 2011-12-26 21:51:32.000000000 +0000 @@ -1,13 +1,13 @@ /* -htop +htop - SwapMeter.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "SwapMeter.h" -#include "Meter.h" +#include "CRT.h" #include "ProcessList.h" #include @@ -15,10 +15,12 @@ #include #include #include - -#include "debug.h" #include +/*{ +#include "Meter.h" +}*/ + #define KILOBYTE 1 #define MEGABYTE 1024 #define GIGABYTE 1048576 diff -Nru htop-1.0/SwapMeter.h htop-1.0.1/SwapMeter.h --- htop-1.0/SwapMeter.h 2011-09-08 04:46:57.000000000 +0000 +++ htop-1.0.1/SwapMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,7 +3,7 @@ #ifndef HEADER_SwapMeter #define HEADER_SwapMeter /* -htop +htop - SwapMeter.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -11,17 +11,6 @@ #include "Meter.h" -#include "ProcessList.h" - -#include -#include -#include -#include -#include - -#include "debug.h" -#include - #define KILOBYTE 1 #define MEGABYTE 1024 #define GIGABYTE 1048576 diff -Nru htop-1.0/TasksMeter.c htop-1.0.1/TasksMeter.c --- htop-1.0/TasksMeter.c 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/TasksMeter.c 2011-12-26 21:51:28.000000000 +0000 @@ -1,18 +1,18 @@ /* -htop +htop - TasksMeter.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "TasksMeter.h" -#include "Meter.h" #include "ProcessList.h" - #include "CRT.h" -#include "debug.h" +/*{ +#include "Meter.h" +}*/ int TasksMeter_attributes[] = { TASKS_RUNNING diff -Nru htop-1.0/TasksMeter.h htop-1.0.1/TasksMeter.h --- htop-1.0/TasksMeter.h 2011-08-26 19:57:35.000000000 +0000 +++ htop-1.0.1/TasksMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,7 +3,7 @@ #ifndef HEADER_TasksMeter #define HEADER_TasksMeter /* -htop +htop - TasksMeter.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -11,12 +11,6 @@ #include "Meter.h" -#include "ProcessList.h" - -#include "CRT.h" - -#include "debug.h" - extern int TasksMeter_attributes[]; extern MeterType TasksMeter; diff -Nru htop-1.0/TraceScreen.c htop-1.0.1/TraceScreen.c --- htop-1.0/TraceScreen.c 2011-09-21 11:55:43.000000000 +0000 +++ htop-1.0.1/TraceScreen.c 2012-01-03 18:19:53.000000000 +0000 @@ -5,24 +5,28 @@ in the source distribution for its full text. */ -#include "config.h" +#include "TraceScreen.h" + +#include "CRT.h" +#include "ProcessList.h" +#include "ListItem.h" + #include #include +#include +#include #include #include #include #include #include +#include -#include "TraceScreen.h" -#include "ProcessList.h" +/*{ #include "Process.h" -#include "ListItem.h" #include "Panel.h" #include "FunctionBar.h" -/*{ - typedef struct TraceScreen_ { Process* process; Panel* display; diff -Nru htop-1.0/TraceScreen.h htop-1.0.1/TraceScreen.h --- htop-1.0/TraceScreen.h 2011-09-21 11:55:45.000000000 +0000 +++ htop-1.0.1/TraceScreen.h 2012-02-02 21:45:14.000000000 +0000 @@ -9,22 +9,10 @@ in the source distribution for its full text. */ -#include "config.h" -#include -#include -#include -#include -#include -#include -#include - -#include "ProcessList.h" #include "Process.h" -#include "ListItem.h" #include "Panel.h" #include "FunctionBar.h" - typedef struct TraceScreen_ { Process* process; Panel* display; diff -Nru htop-1.0/UptimeMeter.c htop-1.0.1/UptimeMeter.c --- htop-1.0/UptimeMeter.c 2011-10-24 23:55:58.000000000 +0000 +++ htop-1.0.1/UptimeMeter.c 2011-12-26 21:51:22.000000000 +0000 @@ -1,18 +1,20 @@ /* -htop +htop - UptimeMeter.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "UptimeMeter.h" -#include "Meter.h" #include "ProcessList.h" - #include "CRT.h" -#include "debug.h" +#include + +/*{ +#include "Meter.h" +}*/ int UptimeMeter_attributes[] = { UPTIME diff -Nru htop-1.0/UptimeMeter.h htop-1.0.1/UptimeMeter.h --- htop-1.0/UptimeMeter.h 2011-10-24 23:58:26.000000000 +0000 +++ htop-1.0.1/UptimeMeter.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,7 +3,7 @@ #ifndef HEADER_UptimeMeter #define HEADER_UptimeMeter /* -htop +htop - UptimeMeter.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. @@ -11,12 +11,6 @@ #include "Meter.h" -#include "ProcessList.h" - -#include "CRT.h" - -#include "debug.h" - extern int UptimeMeter_attributes[]; extern MeterType UptimeMeter; diff -Nru htop-1.0/UsersTable.c htop-1.0.1/UsersTable.c --- htop-1.0/UsersTable.c 2011-11-18 05:31:41.000000000 +0000 +++ htop-1.0.1/UsersTable.c 2011-12-26 21:33:24.000000000 +0000 @@ -6,18 +6,20 @@ */ #include "UsersTable.h" -#include "Hashtable.h" -#include "String.h" + +#include "config.h" #include +#include #include #include #include - -#include "debug.h" +#include #include /*{ +#include "Hashtable.h" + typedef struct UsersTable_ { Hashtable* users; } UsersTable; @@ -40,7 +42,7 @@ if (name == NULL) { struct passwd* userData = getpwuid(uid); if (userData != NULL) { - name = String_copy(userData->pw_name); + name = strdup(userData->pw_name); Hashtable_put(this->users, uid, name); } } diff -Nru htop-1.0/UsersTable.h htop-1.0.1/UsersTable.h --- htop-1.0/UsersTable.h 2011-11-18 05:31:43.000000000 +0000 +++ htop-1.0.1/UsersTable.h 2011-12-26 21:55:08.000000000 +0000 @@ -10,15 +10,6 @@ */ #include "Hashtable.h" -#include "String.h" - -#include -#include -#include -#include - -#include "debug.h" -#include typedef struct UsersTable_ { Hashtable* users; diff -Nru htop-1.0/Vector.c htop-1.0.1/Vector.c --- htop-1.0/Vector.c 2011-11-18 03:11:18.000000000 +0000 +++ htop-1.0.1/Vector.c 2011-12-26 21:51:16.000000000 +0000 @@ -1,20 +1,19 @@ /* -htop +htop - Vector.c (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "Vector.h" -#include "Object.h" + +#include #include #include #include -#include "debug.h" -#include - /*{ +#include "Object.h" #define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0) diff -Nru htop-1.0/Vector.h htop-1.0.1/Vector.h --- htop-1.0/Vector.h 2011-11-18 03:11:51.000000000 +0000 +++ htop-1.0.1/Vector.h 2011-12-26 21:55:08.000000000 +0000 @@ -3,20 +3,13 @@ #ifndef HEADER_Vector #define HEADER_Vector /* -htop +htop - Vector.h (C) 2004-2011 Hisham H. Muhammad Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ #include "Object.h" -#include -#include -#include - -#include "debug.h" -#include - #define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0)