From d3c9975943df58e293359b87905d19ff1fd52061 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:00:15 +0200 Subject: Imported Upstream version 0.5 --- AUTHORS | 1 + AvailableMetersListBox.c | 102 + AvailableMetersListBox.h | 33 + COPYING | 339 +++ CPUMeter.c | 80 + CPUMeter.h | 41 + CRT.c | 270 ++ CRT.h | 111 + CategoriesListBox.c | 103 + CategoriesListBox.h | 36 + ChangeLog | 144 + CheckItem.c | 56 + CheckItem.h | 33 + ClockMeter.c | 54 + ClockMeter.h | 37 + DebugMemory.c | 187 ++ DebugMemory.h | 62 + DisplayOptionsListBox.c | 73 + DisplayOptionsListBox.h | 31 + FunctionBar.c | 91 + FunctionBar.h | 43 + Hashtable.c | 140 + Hashtable.h | 55 + Header.c | 171 ++ Header.h | 62 + INSTALL | 229 ++ ListBox.c | 332 +++ ListBox.h | 95 + ListItem.c | 48 + ListItem.h | 32 + LoadAverageMeter.c | 69 + LoadAverageMeter.h | 37 + LoadMeter.c | 62 + LoadMeter.h | 34 + Makefile.am | 20 + Makefile.in | 667 +++++ MemoryMeter.c | 98 + MemoryMeter.h | 42 + Meter.c | 349 +++ Meter.h | 94 + MetersListBox.c | 103 + MetersListBox.h | 30 + NEWS | 4 + Object.c | 60 + Object.h | 44 + Process.c | 425 +++ Process.h | 149 ++ ProcessList.c | 567 ++++ ProcessList.h | 123 + README | 64 + RichString.c | 80 + RichString.h | 43 + ScreenManager.c | 218 ++ ScreenManager.h | 57 + Settings.c | 193 ++ Settings.h | 36 + Signal.c | 99 + Signal.h | 41 + SignalsListBox.c | 76 + SignalsListBox.h | 32 + String.c | 160 ++ String.h | 52 + SwapMeter.c | 65 + SwapMeter.h | 40 + TODO | 13 + TasksMeter.c | 56 + TasksMeter.h | 35 + TypedVector.c | 268 ++ TypedVector.h | 77 + UptimeMeter.c | 77 + UptimeMeter.h | 39 + UsersTable.c | 58 + UsersTable.h | 39 + aclocal.m4 | 908 +++++++ config.h | 141 + config.h.in | 140 + configure | 6590 ++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 37 + debug.h | 22 + depcomp | 479 ++++ htop.1 | 114 + htop.c | 763 ++++++ htop.h | 53 + install-sh | 294 +++ missing | 336 +++ mkinstalldirs | 111 + 86 files changed, 17974 insertions(+) create mode 100644 AUTHORS create mode 100644 AvailableMetersListBox.c create mode 100644 AvailableMetersListBox.h create mode 100644 COPYING create mode 100644 CPUMeter.c create mode 100644 CPUMeter.h create mode 100644 CRT.c create mode 100644 CRT.h create mode 100644 CategoriesListBox.c create mode 100644 CategoriesListBox.h create mode 100644 ChangeLog create mode 100644 CheckItem.c create mode 100644 CheckItem.h create mode 100644 ClockMeter.c create mode 100644 ClockMeter.h create mode 100644 DebugMemory.c create mode 100644 DebugMemory.h create mode 100644 DisplayOptionsListBox.c create mode 100644 DisplayOptionsListBox.h create mode 100644 FunctionBar.c create mode 100644 FunctionBar.h create mode 100644 Hashtable.c create mode 100644 Hashtable.h create mode 100644 Header.c create mode 100644 Header.h create mode 100644 INSTALL create mode 100644 ListBox.c create mode 100644 ListBox.h create mode 100644 ListItem.c create mode 100644 ListItem.h create mode 100644 LoadAverageMeter.c create mode 100644 LoadAverageMeter.h create mode 100644 LoadMeter.c create mode 100644 LoadMeter.h create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 MemoryMeter.c create mode 100644 MemoryMeter.h create mode 100644 Meter.c create mode 100644 Meter.h create mode 100644 MetersListBox.c create mode 100644 MetersListBox.h create mode 100644 NEWS create mode 100644 Object.c create mode 100644 Object.h create mode 100644 Process.c create mode 100644 Process.h create mode 100644 ProcessList.c create mode 100644 ProcessList.h create mode 100644 README create mode 100644 RichString.c create mode 100644 RichString.h create mode 100644 ScreenManager.c create mode 100644 ScreenManager.h create mode 100644 Settings.c create mode 100644 Settings.h create mode 100644 Signal.c create mode 100644 Signal.h create mode 100644 SignalsListBox.c create mode 100644 SignalsListBox.h create mode 100644 String.c create mode 100644 String.h create mode 100644 SwapMeter.c create mode 100644 SwapMeter.h create mode 100644 TODO create mode 100644 TasksMeter.c create mode 100644 TasksMeter.h create mode 100644 TypedVector.c create mode 100644 TypedVector.h create mode 100644 UptimeMeter.c create mode 100644 UptimeMeter.h create mode 100644 UsersTable.c create mode 100644 UsersTable.h create mode 100644 aclocal.m4 create mode 100644 config.h create mode 100644 config.h.in create mode 100755 configure create mode 100644 configure.ac create mode 100644 debug.h create mode 100755 depcomp create mode 100644 htop.1 create mode 100644 htop.c create mode 100644 htop.h create mode 100755 install-sh create mode 100755 missing create mode 100755 mkinstalldirs diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..f4f0816 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Hisham H. Muhammad \ No newline at end of file diff --git a/AvailableMetersListBox.c b/AvailableMetersListBox.c new file mode 100644 index 0000000..3fce899 --- /dev/null +++ b/AvailableMetersListBox.c @@ -0,0 +1,102 @@ + +#include "AvailableMetersListBox.h" +#include "Settings.h" +#include "Header.h" +#include "ScreenManager.h" + +#include "ListBox.h" + +#include "debug.h" +#include + +/*{ + +typedef struct AvailableMetersListBox_ { + ListBox super; + + Settings* settings; + ListBox* leftBox; + ListBox* rightBox; + ScreenManager* scr; +} AvailableMetersListBox; + +}*/ + +AvailableMetersListBox* AvailableMetersListBox_new(Settings* settings, ListBox* leftMeters, ListBox* rightMeters, ScreenManager* scr) { + AvailableMetersListBox* this = (AvailableMetersListBox*) malloc(sizeof(AvailableMetersListBox)); + ListBox* super = (ListBox*) this; + ListBox_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); + ((Object*)this)->delete = AvailableMetersListBox_delete; + + this->settings = settings; + this->leftBox = leftMeters; + this->rightBox = rightMeters; + this->scr = scr; + super->eventHandler = AvailableMetersListBox_eventHandler; + + ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Available meters")); + ListBox_add(super, (Object*) ListItem_new(String_copy("Swap"))); + ListBox_add(super, (Object*) ListItem_new(String_copy("Memory"))); + ListBox_add(super, (Object*) ListItem_new(String_copy("Clock"))); + ListBox_add(super, (Object*) ListItem_new(String_copy("Load"))); + ListBox_add(super, (Object*) ListItem_new(String_copy("LoadAverage"))); + ListBox_add(super, (Object*) ListItem_new(String_copy("Uptime"))); + ListBox_add(super, (Object*) ListItem_new(String_copy("Tasks"))); + if (settings->pl->processorCount > 1) + ListBox_add(super, (Object*) ListItem_new(String_copy("CPUAverage"))); + for (int i = 1; i <= settings->pl->processorCount; i++) { + char buffer[50]; + sprintf(buffer, "CPU(%d)", i); + ListBox_add(super, (Object*) ListItem_new(String_copy(buffer))); + } + return this; +} + +void AvailableMetersListBox_delete(Object* object) { + ListBox* super = (ListBox*) object; + AvailableMetersListBox* this = (AvailableMetersListBox*) object; + ListBox_done(super); + free(this); +} + +/* private */ +inline void AvailableMetersListBox_addHeader(Header* header, ListBox* lb, char* name, HeaderSide side) { + Header_createMeter(header, name, side); + int i = Header_size(header, side) - 1; + Meter* meter = (Meter*) Header_getMeter(header, i, side); + ListBox_add(lb, (Object*) Meter_toListItem(meter)); +} + +HandlerResult AvailableMetersListBox_eventHandler(ListBox* super, int ch) { + AvailableMetersListBox* this = (AvailableMetersListBox*) super; + Header* header = this->settings->header; + + ListItem* selected = (ListItem*) ListBox_getSelected(super); + char* name = selected->text; + HandlerResult result = IGNORED; + + switch(ch) { + case KEY_F(5): + case 'l': + case 'L': + { + AvailableMetersListBox_addHeader(header, this->leftBox, name, LEFT_HEADER); + result = HANDLED; + break; + } + case KEY_F(6): + case 'r': + case 'R': + { + AvailableMetersListBox_addHeader(header, this->rightBox, name, RIGHT_HEADER); + result = HANDLED; + break; + } + } + if (result == HANDLED) { + Header_calculateHeight(header); + Header_draw(header); + ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2); + } + return result; +} diff --git a/AvailableMetersListBox.h b/AvailableMetersListBox.h new file mode 100644 index 0000000..000a795 --- /dev/null +++ b/AvailableMetersListBox.h @@ -0,0 +1,33 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_AvailableMetersListBox +#define HEADER_AvailableMetersListBox + +#include "Settings.h" +#include "Header.h" +#include "ScreenManager.h" + +#include "ListBox.h" + +#include "debug.h" +#include + + +typedef struct AvailableMetersListBox_ { + ListBox super; + + Settings* settings; + ListBox* leftBox; + ListBox* rightBox; + ScreenManager* scr; +} AvailableMetersListBox; + + +AvailableMetersListBox* AvailableMetersListBox_new(Settings* settings, ListBox* leftMeters, ListBox* rightMeters, ScreenManager* scr); + +void AvailableMetersListBox_delete(Object* object); + + +HandlerResult AvailableMetersListBox_eventHandler(ListBox* super, int ch); + +#endif diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/CPUMeter.c b/CPUMeter.c new file mode 100644 index 0000000..8e598d0 --- /dev/null +++ b/CPUMeter.c @@ -0,0 +1,80 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "CPUMeter.h" +#include "Meter.h" + +#include "ProcessList.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + +/*{ + +typedef struct CPUMeter_ CPUMeter; + +struct CPUMeter_ { + Meter super; + ProcessList* pl; + int processor; +}; + +}*/ + +CPUMeter* CPUMeter_new(ProcessList* pl, int processor) { + CPUMeter* this = malloc(sizeof(CPUMeter)); + char* caption; + if (pl->processorCount == 1 || processor == 0) { + caption = String_copy("CPU"); + } else { + caption = (char*) malloc(4); + sprintf(caption, "%-3d", processor); + } + Meter_init((Meter*)this, NULL, caption, 3); + ((Meter*)this)->name = malloc(20); + sprintf(((Meter*)this)->name, "CPU(%d)", processor); + ((Meter*)this)->attributes[0] = CRT_colors[CPU_NICE]; + ((Meter*)this)->attributes[1] = CRT_colors[CPU_NORMAL]; + ((Meter*)this)->attributes[2] = CRT_colors[CPU_KERNEL]; + ((Meter*)this)->setValues = CPUMeter_setValues; + ((Object*)this)->display = CPUMeter_display; + ((Meter*)this)->total = 1.0; + Meter_setMode((Meter*)this, BAR); + this->processor = processor; + this->pl = pl; + return this; +} + +void CPUMeter_setValues(Meter* cast) { + CPUMeter* this = (CPUMeter*)cast; + cast->values[0] = this->pl->nicePeriod[this->processor] / (double)this->pl->totalPeriod[this->processor]; + cast->values[1] = this->pl->userPeriod[this->processor] / (double)this->pl->totalPeriod[this->processor]; + cast->values[2] = this->pl->systemPeriod[this->processor] / (double)this->pl->totalPeriod[this->processor]; + double cpu = MIN(100.0, MAX(0.0, (cast->values[0]+cast->values[1]+cast->values[2])*100.0 )); + snprintf(cast->displayBuffer.c, 7, "%5.1f%%", cpu ); +} + +void CPUMeter_display(Object* cast, RichString* out) { + char buffer[50]; + Meter* this = (Meter*)cast; + RichString_prune(out); + sprintf(buffer, "%5.1f%% ", this->values[1] * 100.0); + RichString_append(out, CRT_colors[METER_TEXT], ":"); + RichString_append(out, this->attributes[1], buffer); + sprintf(buffer, "%5.1f%% ", this->values[2] * 100.0); + RichString_append(out, CRT_colors[METER_TEXT], "sys:"); + RichString_append(out, this->attributes[2], buffer); + sprintf(buffer, "%5.1f%% ", this->values[0] * 100.0); + RichString_append(out, CRT_colors[METER_TEXT], "low:"); + RichString_append(out, this->attributes[0], buffer); +} diff --git a/CPUMeter.h b/CPUMeter.h new file mode 100644 index 0000000..87994db --- /dev/null +++ b/CPUMeter.h @@ -0,0 +1,41 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_CPUMeter +#define HEADER_CPUMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + + +typedef struct CPUMeter_ CPUMeter; + +struct CPUMeter_ { + Meter super; + ProcessList* pl; + int processor; +}; + + +CPUMeter* CPUMeter_new(ProcessList* pl, int processor); + +void CPUMeter_setValues(Meter* cast); + +void CPUMeter_display(Object* cast, RichString* out); + +#endif diff --git a/CRT.c b/CRT.c new file mode 100644 index 0000000..6c2149c --- /dev/null +++ b/CRT.c @@ -0,0 +1,270 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "CRT.h" + +#include +#include +#include +#include + +#include "String.h" + +#include "debug.h" + +#define WHITE_PAIR 0 +#define BLUE_PAIR 1 +#define GREEN_PAIR 2 +#define RED_PAIR 3 +#define BROWN_PAIR 4 +#define CYAN_PAIR 5 +#define BLACK_PAIR 6 +#define BLACK_CYAN_PAIR 7 +#define RED_CYAN_PAIR 8 +#define BLACK_GREEN_PAIR 9 +#define BLACK_WHITE_PAIR 10 + +#define MIN_UPDATE_SLICE 15 + +//#link curses + +bool CRT_hasColors; + +/*{ + +typedef enum ColorElements_ { + RESET_COLOR, + DEFAULT_COLOR, + FUNCTION_BAR, + FUNCTION_KEY, + FAILED_SEARCH, + PANEL_HEADER_FOCUS, + PANEL_HEADER_UNFOCUS, + PANEL_HIGHLIGHT_FOCUS, + PANEL_HIGHLIGHT_UNFOCUS, + LARGE_NUMBER, + METER_TEXT, + METER_VALUE, + LED_COLOR, + UPTIME, + TASKS_TOTAL, + TASKS_RUNNING, + SWAP, + PROCESS, + PROCESS_SHADOW, + PROCESS_TAG, + PROCESS_MEGABYTES, + PROCESS_TREE, + PROCESS_R_STATE, + PROCESS_BASENAME, + PROCESS_HIGH_PRIORITY, + PROCESS_LOW_PRIORITY, + BAR_BORDER, + BAR_SHADOW, + GRAPH_1, + GRAPH_2, + GRAPH_3, + GRAPH_4, + GRAPH_5, + GRAPH_6, + GRAPH_7, + GRAPH_8, + GRAPH_9, + MEMORY_USED, + MEMORY_BUFFERS, + MEMORY_CACHE, + LOAD, + LOAD_AVERAGE_FIFTEEN, + LOAD_AVERAGE_FIVE, + LOAD_AVERAGE_ONE, + CHECK_BOX, + CHECK_MARK, + CHECK_TEXT, + CLOCK, + CPU_NICE, + CPU_NORMAL, + CPU_KERNEL, + HELP_BOLD, + LAST_COLORELEMENT +} ColorElements; + +extern int CRT_colors[LAST_COLORELEMENT]; + +}*/ + +/* private property */ +int CRT_colors[LAST_COLORELEMENT]; + +void CRT_init() { + initscr(); + noecho(); + halfdelay(MIN_UPDATE_SLICE); + nonl(); + intrflush(stdscr, false); + keypad(stdscr, true); + curs_set(0); + if (has_colors()) { + start_color(); + CRT_hasColors = true; + } else { + CRT_hasColors = false; + } + char* termType = getenv("TERM"); + if (String_eq(termType, "xterm") || String_eq(termType, "xterm-color") || String_eq(termType, "vt220")) { + define_key("\033OP", KEY_F(1)); + define_key("\033OQ", KEY_F(2)); + define_key("\033OR", KEY_F(3)); + define_key("\033OS", KEY_F(4)); + } +#ifndef DEBUG + signal(11, CRT_handleSIGSEGV); +#endif + signal(SIGTERM, CRT_handleSIGTERM); + use_default_colors(); + init_pair(BLUE_PAIR, COLOR_BLUE, -1); + init_pair(GREEN_PAIR, COLOR_GREEN, -1); + init_pair(RED_PAIR, COLOR_RED, -1); + init_pair(BROWN_PAIR, COLOR_YELLOW, -1); + init_pair(CYAN_PAIR, COLOR_CYAN, -1); + init_pair(BLACK_PAIR, COLOR_BLACK, -1); + init_pair(BLACK_PAIR, COLOR_BLACK, -1); + init_pair(BLACK_CYAN_PAIR, COLOR_BLACK, COLOR_CYAN); + init_pair(RED_CYAN_PAIR, COLOR_RED, COLOR_CYAN); + init_pair(BLACK_GREEN_PAIR, COLOR_BLACK, COLOR_GREEN); + init_pair(BLACK_WHITE_PAIR, COLOR_BLACK, COLOR_WHITE); + if (has_colors()) { + CRT_colors[RESET_COLOR] = A_NORMAL; + CRT_colors[DEFAULT_COLOR] = A_NORMAL; + CRT_colors[FUNCTION_BAR] = COLOR_PAIR(BLACK_CYAN_PAIR); + CRT_colors[FUNCTION_KEY] = A_NORMAL; + CRT_colors[PANEL_HEADER_FOCUS] = COLOR_PAIR(BLACK_GREEN_PAIR); + CRT_colors[PANEL_HEADER_UNFOCUS] = COLOR_PAIR(BLACK_GREEN_PAIR); + CRT_colors[PANEL_HIGHLIGHT_FOCUS] = COLOR_PAIR(BLACK_CYAN_PAIR); + CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = COLOR_PAIR(BLACK_WHITE_PAIR); + CRT_colors[FAILED_SEARCH] = COLOR_PAIR(RED_CYAN_PAIR); + CRT_colors[UPTIME] = A_BOLD | COLOR_PAIR(CYAN_PAIR); + CRT_colors[LARGE_NUMBER] = A_BOLD | COLOR_PAIR(RED_PAIR); + CRT_colors[METER_TEXT] = COLOR_PAIR(CYAN_PAIR); + CRT_colors[METER_VALUE] = A_BOLD | COLOR_PAIR(CYAN_PAIR); + CRT_colors[LED_COLOR] = COLOR_PAIR(GREEN_PAIR); + CRT_colors[TASKS_RUNNING] = A_BOLD | COLOR_PAIR(GREEN_PAIR); + CRT_colors[PROCESS] = A_NORMAL; + CRT_colors[PROCESS_SHADOW] = A_BOLD | COLOR_PAIR(BLACK_PAIR); + CRT_colors[PROCESS_TAG] = A_BOLD | COLOR_PAIR(BROWN_PAIR); + CRT_colors[PROCESS_MEGABYTES] = COLOR_PAIR(CYAN_PAIR); + CRT_colors[PROCESS_BASENAME] = A_BOLD | COLOR_PAIR(CYAN_PAIR); + CRT_colors[PROCESS_TREE] = COLOR_PAIR(CYAN_PAIR); + CRT_colors[PROCESS_R_STATE] = COLOR_PAIR(GREEN_PAIR); + CRT_colors[PROCESS_HIGH_PRIORITY] = COLOR_PAIR(RED_PAIR); + CRT_colors[PROCESS_LOW_PRIORITY] = COLOR_PAIR(RED_PAIR); + CRT_colors[BAR_BORDER] = A_BOLD; + CRT_colors[BAR_SHADOW] = A_BOLD | COLOR_PAIR(BLACK_PAIR); + CRT_colors[SWAP] = COLOR_PAIR(RED_PAIR); + CRT_colors[GRAPH_1] = A_BOLD | COLOR_PAIR(RED_PAIR); + CRT_colors[GRAPH_2] = COLOR_PAIR(RED_PAIR); + CRT_colors[GRAPH_3] = A_BOLD | COLOR_PAIR(BROWN_PAIR); + CRT_colors[GRAPH_4] = A_BOLD | COLOR_PAIR(GREEN_PAIR); + CRT_colors[GRAPH_5] = COLOR_PAIR(GREEN_PAIR); + CRT_colors[GRAPH_6] = COLOR_PAIR(CYAN_PAIR); + CRT_colors[GRAPH_7] = A_BOLD | COLOR_PAIR(BLUE_PAIR); + CRT_colors[GRAPH_8] = COLOR_PAIR(BLUE_PAIR); + CRT_colors[GRAPH_9] = A_BOLD | COLOR_PAIR(BLACK_PAIR); + CRT_colors[MEMORY_USED] = COLOR_PAIR(GREEN_PAIR); + CRT_colors[MEMORY_BUFFERS] = COLOR_PAIR(BLUE_PAIR); + CRT_colors[MEMORY_CACHE] = COLOR_PAIR(BROWN_PAIR); + CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_BOLD | COLOR_PAIR(BLACK_PAIR); + CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL; + CRT_colors[LOAD_AVERAGE_ONE] = A_BOLD; + CRT_colors[LOAD] = A_BOLD; + CRT_colors[HELP_BOLD] = A_BOLD | COLOR_PAIR(CYAN_PAIR); + CRT_colors[CPU_NICE] = COLOR_PAIR(BLUE_PAIR); + CRT_colors[CPU_NORMAL] = COLOR_PAIR(GREEN_PAIR); + CRT_colors[CPU_KERNEL] = COLOR_PAIR(RED_PAIR); + CRT_colors[CLOCK] = A_BOLD; + CRT_colors[CHECK_BOX] = COLOR_PAIR(CYAN_PAIR); + CRT_colors[CHECK_MARK] = A_BOLD; + CRT_colors[CHECK_TEXT] = A_NORMAL; + } else { + CRT_colors[RESET_COLOR] = A_NORMAL; + CRT_colors[DEFAULT_COLOR] = A_NORMAL; + CRT_colors[FUNCTION_BAR] = A_REVERSE; + CRT_colors[FUNCTION_KEY] = A_NORMAL; + CRT_colors[PANEL_HEADER_FOCUS] = A_REVERSE; + CRT_colors[PANEL_HEADER_UNFOCUS] = A_REVERSE; + CRT_colors[PANEL_HIGHLIGHT_FOCUS] = A_REVERSE | A_BOLD; + CRT_colors[PANEL_HIGHLIGHT_UNFOCUS] = A_REVERSE; + CRT_colors[FAILED_SEARCH] = A_REVERSE | A_BOLD; + CRT_colors[UPTIME] = A_BOLD; + CRT_colors[LARGE_NUMBER] = A_BOLD; + CRT_colors[METER_TEXT] = A_NORMAL; + CRT_colors[METER_VALUE] = A_BOLD; + CRT_colors[LED_COLOR] = A_NORMAL; + CRT_colors[TASKS_RUNNING] = A_BOLD; + CRT_colors[PROCESS] = A_NORMAL; + CRT_colors[PROCESS_SHADOW] = A_DIM; + CRT_colors[PROCESS_TAG] = A_BOLD; + CRT_colors[PROCESS_MEGABYTES] = A_BOLD; + CRT_colors[PROCESS_BASENAME] = A_BOLD; + CRT_colors[PROCESS_TREE] = A_BOLD; + CRT_colors[PROCESS_R_STATE] = A_BOLD; + CRT_colors[PROCESS_HIGH_PRIORITY] = A_BOLD; + CRT_colors[PROCESS_LOW_PRIORITY] = A_DIM; + CRT_colors[BAR_BORDER] = A_BOLD; + CRT_colors[BAR_SHADOW] = A_DIM; + CRT_colors[SWAP] = A_BOLD; + CRT_colors[GRAPH_1] = A_BOLD; + CRT_colors[GRAPH_2] = A_BOLD; + CRT_colors[GRAPH_3] = A_BOLD; + CRT_colors[GRAPH_4] = A_NORMAL; + CRT_colors[GRAPH_5] = A_NORMAL; + CRT_colors[GRAPH_6] = A_NORMAL; + CRT_colors[GRAPH_7] = A_DIM; + CRT_colors[GRAPH_8] = A_DIM; + CRT_colors[GRAPH_9] = A_DIM; + CRT_colors[MEMORY_USED] = A_BOLD; + CRT_colors[MEMORY_BUFFERS] = A_NORMAL; + CRT_colors[MEMORY_CACHE] = A_NORMAL; + CRT_colors[LOAD_AVERAGE_FIFTEEN] = A_DIM; + CRT_colors[LOAD_AVERAGE_FIVE] = A_NORMAL; + CRT_colors[LOAD_AVERAGE_ONE] = A_BOLD; + CRT_colors[LOAD] = A_BOLD; + CRT_colors[HELP_BOLD] = A_BOLD; + CRT_colors[CPU_NICE] = A_NORMAL; + CRT_colors[CPU_NORMAL] = A_BOLD; + CRT_colors[CPU_KERNEL] = A_BOLD; + CRT_colors[CLOCK] = A_BOLD; + CRT_colors[CHECK_BOX] = A_BOLD; + CRT_colors[CHECK_MARK] = A_NORMAL; + CRT_colors[CHECK_TEXT] = A_NORMAL; + } + + mousemask(BUTTON1_PRESSED, NULL); +} + +void CRT_done() { + curs_set(1); + endwin(); +} + +int CRT_readKey() { + nocbreak(); + cbreak(); + int ret = getch(); + halfdelay(MIN_UPDATE_SLICE); + return ret; +} + +void CRT_handleSIGSEGV(int signal) { + CRT_done(); + fprintf(stderr, "Aborted. Please report bug at http://htop.sf.net"); + exit(1); +} + +void CRT_handleSIGTERM(int signal) { + CRT_done(); + exit(0); +} diff --git a/CRT.h b/CRT.h new file mode 100644 index 0000000..55a4282 --- /dev/null +++ b/CRT.h @@ -0,0 +1,111 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_CRT +#define HEADER_CRT +/* +htop +(C) 2004 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 "String.h" + +#include "debug.h" + +#define WHITE_PAIR 0 +#define BLUE_PAIR 1 +#define GREEN_PAIR 2 +#define RED_PAIR 3 +#define BROWN_PAIR 4 +#define CYAN_PAIR 5 +#define BLACK_PAIR 6 +#define BLACK_CYAN_PAIR 7 +#define RED_CYAN_PAIR 8 +#define BLACK_GREEN_PAIR 9 +#define BLACK_WHITE_PAIR 10 + +#define MIN_UPDATE_SLICE 15 + +//#link curses + +bool CRT_hasColors; + + +typedef enum ColorElements_ { + RESET_COLOR, + DEFAULT_COLOR, + FUNCTION_BAR, + FUNCTION_KEY, + FAILED_SEARCH, + PANEL_HEADER_FOCUS, + PANEL_HEADER_UNFOCUS, + PANEL_HIGHLIGHT_FOCUS, + PANEL_HIGHLIGHT_UNFOCUS, + LARGE_NUMBER, + METER_TEXT, + METER_VALUE, + LED_COLOR, + UPTIME, + TASKS_TOTAL, + TASKS_RUNNING, + SWAP, + PROCESS, + PROCESS_SHADOW, + PROCESS_TAG, + PROCESS_MEGABYTES, + PROCESS_TREE, + PROCESS_R_STATE, + PROCESS_BASENAME, + PROCESS_HIGH_PRIORITY, + PROCESS_LOW_PRIORITY, + BAR_BORDER, + BAR_SHADOW, + GRAPH_1, + GRAPH_2, + GRAPH_3, + GRAPH_4, + GRAPH_5, + GRAPH_6, + GRAPH_7, + GRAPH_8, + GRAPH_9, + MEMORY_USED, + MEMORY_BUFFERS, + MEMORY_CACHE, + LOAD, + LOAD_AVERAGE_FIFTEEN, + LOAD_AVERAGE_FIVE, + LOAD_AVERAGE_ONE, + CHECK_BOX, + CHECK_MARK, + CHECK_TEXT, + CLOCK, + CPU_NICE, + CPU_NORMAL, + CPU_KERNEL, + HELP_BOLD, + LAST_COLORELEMENT +} ColorElements; + +extern int CRT_colors[LAST_COLORELEMENT]; + + + +void CRT_init(); + +void CRT_done(); + +int CRT_readKey(); + +void CRT_handleSIGSEGV(int signal); + +void CRT_handleSIGTERM(int signal); + +#endif diff --git a/CategoriesListBox.c b/CategoriesListBox.c new file mode 100644 index 0000000..c2b6c67 --- /dev/null +++ b/CategoriesListBox.c @@ -0,0 +1,103 @@ + +#include "CategoriesListBox.h" +#include "AvailableMetersListBox.h" +#include "MetersListBox.h" +#include "DisplayOptionsListBox.h" + +#include "ListBox.h" + +#include "debug.h" +#include + +/*{ + +typedef struct CategoriesListBox_ { + ListBox super; + + Settings* settings; + ScreenManager* scr; +} CategoriesListBox; + +}*/ + +/* private property */ +char* MetersFunctions[10] = {" ", " ", " ", "Type ", "Add L ", "Add R ", "MoveUp", "MoveDn", "Remove", "Done "}; + +/* private property */ +char* DisplayOptionsFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "}; + +CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr) { + CategoriesListBox* this = (CategoriesListBox*) malloc(sizeof(CategoriesListBox)); + ListBox* super = (ListBox*) this; + ListBox_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); + ((Object*)this)->delete = CategoriesListBox_delete; + + this->settings = settings; + this->scr = scr; + super->eventHandler = CategoriesListBox_eventHandler; + ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Setup")); + ListBox_add(super, (Object*) ListItem_new(String_copy("Meters"))); + ListBox_add(super, (Object*) ListItem_new(String_copy("Display options"))); + return this; +} + +void CategoriesListBox_delete(Object* object) { + ListBox* super = (ListBox*) object; + CategoriesListBox* this = (CategoriesListBox*) object; + ListBox_done(super); + free(this); +} + +HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) { + CategoriesListBox* this = (CategoriesListBox*) super; + + HandlerResult result = IGNORED; + + int previous = ListBox_getSelectedIndex(super); + + switch (ch) { + case KEY_UP: + case KEY_DOWN: + case KEY_NPAGE: + case KEY_PPAGE: + case KEY_HOME: + case KEY_END: { + ListBox_onKey(super, ch); + int selected = ListBox_getSelectedIndex(super); + if (previous != selected) { + int size = ScreenManager_size(this->scr); + for (int i = 1; i < size; i++) + ScreenManager_remove(this->scr, 1); + switch (selected) { + case 0: + CategoriesListBox_makeMetersPage(this); + break; + case 1: + CategoriesListBox_makeProcessListPage(this); + break; + } + } + result = HANDLED; + } + } + + return result; +} + +void CategoriesListBox_makeMetersPage(CategoriesListBox* this) { + FunctionBar* fuBar = FunctionBar_new(10, MetersFunctions, NULL, NULL); + ListBox* lbLeftMeters = (ListBox*) MetersListBox_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr); + ListBox* lbRightMeters = (ListBox*) MetersListBox_new(this->settings, "Right column", this->settings->header->rightMeters, this->scr); + ListBox* lbAvailableMeters = (ListBox*) AvailableMetersListBox_new(this->settings, lbLeftMeters, lbRightMeters, this->scr); + ScreenManager_add(this->scr, lbLeftMeters, 20); + ScreenManager_add(this->scr, lbRightMeters, 20); + ScreenManager_add(this->scr, lbAvailableMeters, -1); + ScreenManager_setFunctionBar(this->scr, fuBar); +} + +void CategoriesListBox_makeProcessListPage(CategoriesListBox* this) { + FunctionBar* fuBar = FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL); + ListBox* lbDisplayOptions = (ListBox*) DisplayOptionsListBox_new(this->settings, this->scr); + ScreenManager_add(this->scr, lbDisplayOptions, -1); + ScreenManager_setFunctionBar(this->scr, fuBar); +} diff --git a/CategoriesListBox.h b/CategoriesListBox.h new file mode 100644 index 0000000..df1a387 --- /dev/null +++ b/CategoriesListBox.h @@ -0,0 +1,36 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_CategoriesListBox +#define HEADER_CategoriesListBox + +#include "AvailableMetersListBox.h" +#include "MetersListBox.h" +#include "DisplayOptionsListBox.h" + +#include "ListBox.h" + +#include "debug.h" +#include + + +typedef struct CategoriesListBox_ { + ListBox super; + + Settings* settings; + ScreenManager* scr; +} CategoriesListBox; + + + + +CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr); + +void CategoriesListBox_delete(Object* object); + +HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch); + +void CategoriesListBox_makeMetersPage(CategoriesListBox* this); + +void CategoriesListBox_makeProcessListPage(CategoriesListBox* this); + +#endif diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..b80c4ee --- /dev/null +++ b/ChangeLog @@ -0,0 +1,144 @@ + +What's new in version 0.5 + +* Tree view +* New column, TIME (user + system time, + like in top, 'T' switches to "sort by time") +* Major reorganization of the underlying code of the + setup screen, to manage setup pages +* New setup page: Display options +* Hide kernel threads ('K' key) +* Colorized memory numbers +* Vastly improved support for monochromatic terminals +* Shadow processes that do not belong to user ('U' key) +* Header margin configuration accessible via setup screen +* Visual feedback on failing incremental search +* BUGFIX: fixed keyboard input issues on 64-bit machines +* BUGFIX: hopefully fixed the incorrect values + that show on status bars in some systems +* BUGFIX: doesn't mess with fields list anymore when + canceling after changing the number of items +* Uptime meter no longer says "1 days" ;) + +What's new in version 0.4.1 + +* BUGFIX: compiles on 64-bit architectures again + (thanks to Bartosz Fenski for the report) +* BUGFIX: multi-processor support fixed on kernels 2.6 + (thanks to Wolfram Schlich for the report) + +What's new in version 0.4 + +* Support for multiple processors! +* Basic mouse support +* Modular header based on configurable meters; + supports 4 view modes: bar, text, LED, graph +* Uptime, load average meters + (thanks to Marc Calahan) +* Meters setup screen; should eventually evolve into a + general setup screen, with column setup, keybindings, etc. +* Thread hiding toggleable + (press 'T' to hide the nonstandard dotfiles in /proc) +* BUGFIX: Do not flicker screen on column configuration screen +* Clock and load average meters + (thanks to Marc Calahan) +* BUGFIX: numeric swap indicator was printing bogus value +* BUGFIX: internal fixes on ListBox widget +* Clear the bottom line when exiting +* Press "F3" during search to walk through the results +* Improved navigation on column configuration screen +* BUGFIX: fix segfault on kernels with restricted /proc + enabled +* BUGFIX: a few last-minute bugfixes in the setup UI + (thanks to Gaspare Bruno for the reports) + + +What's new in version 0.3.3 + +* Saves column and sorting configuration in ~/.htoprc +* Displays "hidden" threads on RedHat 9 + (Thanks to Leonardo Godinho) +* BUGFIX: supports process names with spaces + (Thanks to Marc Calahan) +* BUGFIX: ...and parentheses :) +* BUGFIX: long process names overflowed RichString + (Thanks to Marc Calahan) + +What's new in version 0.3.2 + +* Performance and memory usage improvements, aided by gprof +* BUGFIX: quite a few fixes, aided by Valgrind +* Header preview on column configuration screen + (Thanks to Marc Calahan) + +What's new in version 0.3.1 + +* BUGFIX: crash fixes related to process list handling + (thanks to Marc Calahan) +* Man page + (thanks to Bartosz Fenski) +* Tag processes with the space bar +* Kill multiple process based on tag +* BUGFIX: corrected processing order of updates in list +* Screen refresh function on Ctrl-L +* Large numbers are shown in MB/GB notation in order to fit screen + (thanks to Marc Calahan) +* Realtime priority is correctly displayed + (thanks to Marc Calahan) +* Preliminary support for configurable columns, with 'C' + (thanks to Marc Calahan) + -- not all columns display properly yet + +What's new in version 0.3 + +* BUGFIX: no dirt left on screen on horizontal scrolling +* Signal selection on "kill" command +* Color-coding for users, nice and process status +* "Follow" function +* Fully selectable sort order +* Function bar on last line +* Build system now uses autotools + +What's new in version 0.2.1 + +* Sorting by process or memory usage ('P' and 'M', like top) +* Quicker default update (1.5 second, not yet configurable) +* Now the order of the elements in the process list stay + 'locked' for a while after you move the cursor to ease + selecting a process +* Corrected the installation instructions in README + (Thanks to Jeremy Eglen) +* Should now compile cleanly on Conectiva 9 and similar systems + (Thanks to Adriano Frare for the report) +* Friendlier Makefile +* Help screen ('h') + +What's new in version 0.2 + +* Memory indicators in header now show used and total, in MB +* Preliminary support for sorting (CPU% only) +* Memory percentage field (resident memory / used memory) +* BUGFIX: identified source of spurious crashes +* Can search names containing numbers + (Thanks to Rafael Jeffman) +* Correctly calculates memory page size + (Thanks to Rafael Jeffman) + +What's new in version 0.13 + +* Handles terminal resize +* Display all user names (not only those in /etc/passwd) + (Thanks to Julio Biason) + +What's new in version 0.12 + +* Support for 2.6 kernels +* Uses terminal default colors as a background + +What's new in version 0.11 + +* BUGFIX: does not crash when UID is not in /etc/passwd + +What's new in version 0.1 + +* Everything! diff --git a/CheckItem.c b/CheckItem.c new file mode 100644 index 0000000..0c42867 --- /dev/null +++ b/CheckItem.c @@ -0,0 +1,56 @@ +/* +htop +(C) 2004 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" + +/*{ + +typedef struct CheckItem_ { + Object super; + char* text; + bool* value; +} CheckItem; + +extern char* CHECKITEM_CLASS; +}*/ + +/* private property */ +char* CHECKITEM_CLASS = "CheckItem"; + +CheckItem* CheckItem_new(char* text, bool* value) { + CheckItem* this = malloc(sizeof(CheckItem)); + ((Object*)this)->class = CHECKITEM_CLASS; + ((Object*)this)->display = CheckItem_display; + ((Object*)this)->delete = CheckItem_delete; + this->text = text; + this->value = value; + return this; +} + +void CheckItem_delete(Object* cast) { + CheckItem* this = (CheckItem*)cast; + assert (this != NULL); + + free(this->text); + free(this); +} + +void CheckItem_display(Object* cast, RichString* out) { + CheckItem* this = (CheckItem*)cast; + assert (this != NULL); + RichString_write(out, CRT_colors[CHECK_BOX], "["); + if (*(this->value)) + RichString_append(out, CRT_colors[CHECK_MARK], "x"); + else + RichString_append(out, CRT_colors[CHECK_MARK], " "); + RichString_append(out, CRT_colors[CHECK_BOX], "] "); + RichString_append(out, CRT_colors[CHECK_TEXT], this->text); +} diff --git a/CheckItem.h b/CheckItem.h new file mode 100644 index 0000000..d3bffcc --- /dev/null +++ b/CheckItem.h @@ -0,0 +1,33 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_CheckItem +#define HEADER_CheckItem +/* +htop +(C) 2004 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; + char* text; + bool* value; +} CheckItem; + +extern char* CHECKITEM_CLASS; + + +CheckItem* CheckItem_new(char* text, bool* value); + +void CheckItem_delete(Object* cast); + +void CheckItem_display(Object* cast, RichString* out); + +#endif diff --git a/ClockMeter.c b/ClockMeter.c new file mode 100644 index 0000000..645910c --- /dev/null +++ b/ClockMeter.c @@ -0,0 +1,54 @@ +/* +htop +(C) 2004 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 "ProcessList.h" + +#include +#include + +#include "debug.h" + +/*{ + +typedef struct ClockMeter_ ClockMeter; + +struct ClockMeter_ { + Meter super; + ProcessList* pl; + char clock[10]; +}; + +}*/ + +ClockMeter* ClockMeter_new() { + ClockMeter* this = malloc(sizeof(ClockMeter)); + Meter_init((Meter*)this, String_copy("Clock"), String_copy("Time: "), 1); + ((Meter*)this)->attributes[0] = CRT_colors[CLOCK]; + ((Meter*)this)->setValues = ClockMeter_setValues; + ((Object*)this)->display = ClockMeter_display; + ((Meter*)this)->total = 24 * 60; + Meter_setMode((Meter*)this, TEXT); + return this; +} + +void ClockMeter_setValues(Meter* cast) { + ClockMeter* this = (ClockMeter*) cast; + time_t t = time(NULL); + struct tm *lt = localtime(&t); + cast->values[0] = lt->tm_hour * 60 + lt->tm_min; + strftime(this->clock, 9, "%H:%M:%S", lt); + snprintf(cast->displayBuffer.c, 9, "%s", this->clock); +} + +void ClockMeter_display(Object* cast, RichString* out) { + Meter* super = (Meter*) cast; + ClockMeter* this = (ClockMeter*) cast; + RichString_write(out, super->attributes[0], this->clock); +} diff --git a/ClockMeter.h b/ClockMeter.h new file mode 100644 index 0000000..2e8fc86 --- /dev/null +++ b/ClockMeter.h @@ -0,0 +1,37 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_ClockMeter +#define HEADER_ClockMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include +#include + +#include "debug.h" + + +typedef struct ClockMeter_ ClockMeter; + +struct ClockMeter_ { + Meter super; + ProcessList* pl; + char clock[10]; +}; + + +ClockMeter* ClockMeter_new(); + +void ClockMeter_setValues(Meter* cast); + +void ClockMeter_display(Object* cast, RichString* out); + +#endif diff --git a/DebugMemory.c b/DebugMemory.c new file mode 100644 index 0000000..26db5c7 --- /dev/null +++ b/DebugMemory.c @@ -0,0 +1,187 @@ + +#define _GNU_SOURCE + +#include +#include +#include +#include + +#include + +#include "DebugMemory.h" + +#undef strdup +#undef malloc +#undef realloc +#undef calloc +#undef free + +/*{ +typedef struct DebugMemoryItem_ DebugMemoryItem; + +struct DebugMemoryItem_ { + void* data; + char* file; + int line; + DebugMemoryItem* next; +}; + +typedef struct DebugMemory_ { + DebugMemoryItem* first; + int allocations; + int deallocations; + int size; + FILE* file; +} DebugMemory; +}*/ + +/* private property */ +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; + singleton->file = fopen("alloc.txt", "w"); +} + +void* DebugMemory_malloc(int size, char* file, int line) { + void* data = malloc(size); + DebugMemory_registerAllocation(data, file, line); + fprintf(singleton->file, "%d\t%s:%d\n", size, file, line); + return data; +} + +void* DebugMemory_calloc(int a, int b, char* file, int line) { + void* data = calloc(a, b); + DebugMemory_registerAllocation(data, file, line); + 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) { + if (ptr != NULL) + DebugMemory_registerDeallocation(ptr, file, line); + void* data = realloc(ptr, size); + DebugMemory_registerAllocation(data, file, line); + fprintf(singleton->file, "%d\t%s:%d\n", size, file, line); + return data; +} + +void* DebugMemory_strdup(char* str, char* file, int line) { + char* data = strdup(str); + DebugMemory_registerAllocation(data, file, line); + fprintf(singleton->file, "%d\t%s:%d\n", (int) strlen(str), file, line); + return data; +} + +void DebugMemory_free(void* data, char* file, int line) { + DebugMemory_registerDeallocation(data, file, line); + free(data); +} + +void DebugMemory_assertSize() { + if (!singleton->first) { + assert (singleton->size == 0); + } + DebugMemoryItem* walk = singleton->first; + int i = 0; + while (walk != NULL) { + 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) { + 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->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; + } + 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) { + 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) { + i++; + fprintf(stderr, "%p %s:%d\n", walk->data, walk->file, walk->line); + walk = walk->next; + } + 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); + fclose(singleton->file); +} diff --git a/DebugMemory.h b/DebugMemory.h new file mode 100644 index 0000000..8261fee --- /dev/null +++ b/DebugMemory.h @@ -0,0 +1,62 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_DebugMemory +#define HEADER_DebugMemory + +#define _GNU_SOURCE + +#include +#include +#include +#include + +#include + + +#undef strdup +#undef malloc +#undef realloc +#undef calloc +#undef free + +typedef struct DebugMemoryItem_ DebugMemoryItem; + +struct DebugMemoryItem_ { + void* data; + char* file; + int line; + DebugMemoryItem* next; +}; + +typedef struct DebugMemory_ { + DebugMemoryItem* first; + int allocations; + int deallocations; + int size; + FILE* file; +} DebugMemory; + + +void DebugMemory_new(); + +void* DebugMemory_malloc(int size, char* file, int line); + +void* DebugMemory_calloc(int a, int b, char* file, int line); + +void* DebugMemory_realloc(void* ptr, int size, char* file, int line); + +void* DebugMemory_strdup(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(); + +#endif diff --git a/DisplayOptionsListBox.c b/DisplayOptionsListBox.c new file mode 100644 index 0000000..e0dff29 --- /dev/null +++ b/DisplayOptionsListBox.c @@ -0,0 +1,73 @@ + +#include "DisplayOptionsListBox.h" + +#include "ListBox.h" +#include "CheckItem.h" +#include "Settings.h" +#include "ScreenManager.h" + +#include "debug.h" +#include + +/*{ + +typedef struct DisplayOptionsListBox_ { + ListBox super; + + Settings* settings; + ScreenManager* scr; +} DisplayOptionsListBox; + +}*/ + +DisplayOptionsListBox* DisplayOptionsListBox_new(Settings* settings, ScreenManager* scr) { + DisplayOptionsListBox* this = (DisplayOptionsListBox*) malloc(sizeof(DisplayOptionsListBox)); + ListBox* super = (ListBox*) this; + ListBox_init(super, 1, 1, 1, 1, CHECKITEM_CLASS, true); + ((Object*)this)->delete = DisplayOptionsListBox_delete; + + this->settings = settings; + this->scr = scr; + super->eventHandler = DisplayOptionsListBox_eventHandler; + + ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Display options")); + ListBox_add(super, (Object*) CheckItem_new(String_copy("Tree view"), &(settings->pl->treeView))); + ListBox_add(super, (Object*) CheckItem_new(String_copy("Shadow other users' processes"), &(settings->pl->shadowOtherUsers))); + ListBox_add(super, (Object*) CheckItem_new(String_copy("Hide kernel threads"), &(settings->pl->hideKernelThreads))); + ListBox_add(super, (Object*) CheckItem_new(String_copy("Highlight program \"basename\""), &(settings->pl->highlightBaseName))); + ListBox_add(super, (Object*) CheckItem_new(String_copy("Highlight megabytes in memory counters"), &(settings->pl->highlightMegabytes))); + ListBox_add(super, (Object*) CheckItem_new(String_copy("Leave a margin around header"), &(settings->header->margin))); + return this; +} + +void DisplayOptionsListBox_delete(Object* object) { + ListBox* super = (ListBox*) object; + DisplayOptionsListBox* this = (DisplayOptionsListBox*) object; + ListBox_done(super); + free(this); +} + +HandlerResult DisplayOptionsListBox_eventHandler(ListBox* super, int ch) { + DisplayOptionsListBox* this = (DisplayOptionsListBox*) super; + + HandlerResult result = IGNORED; + CheckItem* selected = (CheckItem*) ListBox_getSelected(super); + + switch(ch) { + case 0x0a: + case 0x0d: + case KEY_ENTER: + case ' ': + *(selected->value) = ! *(selected->value); + result = HANDLED; + } + + if (result == HANDLED) { + Header* header = this->settings->header; + Header_calculateHeight(header); + Header_draw(header); + ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2); + } + return result; +} + diff --git a/DisplayOptionsListBox.h b/DisplayOptionsListBox.h new file mode 100644 index 0000000..f78e996 --- /dev/null +++ b/DisplayOptionsListBox.h @@ -0,0 +1,31 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_DisplayOptionsListBox +#define HEADER_DisplayOptionsListBox + + +#include "ListBox.h" +#include "CheckItem.h" +#include "Settings.h" +#include "ScreenManager.h" + +#include "debug.h" +#include + + +typedef struct DisplayOptionsListBox_ { + ListBox super; + + Settings* settings; + ScreenManager* scr; +} DisplayOptionsListBox; + + +DisplayOptionsListBox* DisplayOptionsListBox_new(Settings* settings, ScreenManager* scr); + +void DisplayOptionsListBox_delete(Object* object); + +HandlerResult DisplayOptionsListBox_eventHandler(ListBox* super, int ch); + + +#endif diff --git a/FunctionBar.c b/FunctionBar.c new file mode 100644 index 0000000..49597bd --- /dev/null +++ b/FunctionBar.c @@ -0,0 +1,91 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "FunctionBar.h" +#include "CRT.h" + +#include "debug.h" +#include + +#include +#include +#include +#include + +/*{ + +typedef struct FunctionBar_ { + int size; + char** functions; + char** keys; + int* events; +} FunctionBar; + +}*/ + +/* private property */ +char* FunctionBar_FKeys[10] = {" 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", "10"}; + +/* private property */ +int FunctionBar_FEvents[10] = {KEY_F(1), KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), KEY_F(10)}; + +FunctionBar* FunctionBar_new(int size, char** functions, char** keys, int* events) { + FunctionBar* this = malloc(sizeof(FunctionBar)); + this->functions = functions; + this->size = size; + if (keys && events) { + this->keys = keys; + this->events = events; + } else { + this->keys = FunctionBar_FKeys; + this->events = FunctionBar_FEvents; + assert(this->size == 10); + } + return this; +} + +void FunctionBar_delete(FunctionBar* this) { + // These are always static data, RIGHT? >;) + // free(this->functions); + // free(this->keys); + free(this); +} + +void FunctionBar_draw(FunctionBar* this, char* buffer) { + FunctionBar_drawAttr(this, buffer, CRT_colors[FUNCTION_BAR]); +} + +void FunctionBar_drawAttr(FunctionBar* this, char* buffer, int attr) { + attrset(CRT_colors[FUNCTION_BAR]); + mvhline(LINES-1, 0, ' ', COLS); + int x = 0; + for (int i = 0; i < this->size; i++) { + attrset(CRT_colors[FUNCTION_KEY]); + mvaddstr(LINES-1, x, this->keys[i]); + x += strlen(this->keys[i]); + attrset(CRT_colors[FUNCTION_BAR]); + mvaddstr(LINES-1, x, this->functions[i]); + x += strlen(this->functions[i]); + } + if (buffer != NULL) { + attrset(attr); + mvaddstr(LINES-1, x, buffer); + } + attrset(CRT_colors[RESET_COLOR]); +} + +int FunctionBar_synthesizeEvent(FunctionBar* this, int pos) { + int x = 0; + for (int i = 0; i < this->size; i++) { + x += strlen(this->keys[i]); + x += strlen(this->functions[i]); + if (pos < x) { + return this->events[i]; + } + } + return ERR; +} diff --git a/FunctionBar.h b/FunctionBar.h new file mode 100644 index 0000000..3e08f8e --- /dev/null +++ b/FunctionBar.h @@ -0,0 +1,43 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_FunctionBar +#define HEADER_FunctionBar +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "CRT.h" + +#include "debug.h" +#include + +#include +#include +#include +#include + + +typedef struct FunctionBar_ { + int size; + char** functions; + char** keys; + int* events; +} FunctionBar; + + + + +FunctionBar* FunctionBar_new(int size, char** functions, char** keys, int* events); + +void FunctionBar_delete(FunctionBar* this); + +void FunctionBar_draw(FunctionBar* this, char* buffer); + +void FunctionBar_drawAttr(FunctionBar* this, char* buffer, int attr); + +int FunctionBar_synthesizeEvent(FunctionBar* this, int pos); + +#endif diff --git a/Hashtable.c b/Hashtable.c new file mode 100644 index 0000000..3ecc0f2 --- /dev/null +++ b/Hashtable.c @@ -0,0 +1,140 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Hashtable.h" + +#include +#include + +#include "debug.h" + +/*{ +typedef struct Hashtable_ Hashtable; + +typedef void(*HashtablePairFunction)(int, void*); +typedef int(*HashtableHashAlgorithm)(Hashtable*, int); + +typedef struct HashtableItem { + int key; + void* value; + struct HashtableItem* next; +} HashtableItem; + +struct Hashtable_ { + int size; + HashtableItem** buckets; + int items; + HashtableHashAlgorithm hashAlgorithm; + bool owner; +}; +}*/ + +HashtableItem* HashtableItem_new(int key, void* value) { + HashtableItem* this; + + this = (HashtableItem*) malloc(sizeof(HashtableItem)); + this->key = key; + this->value = value; + this->next = NULL; + return this; +} + +Hashtable* Hashtable_new(int size, bool owner) { + Hashtable* this; + + this = (Hashtable*) malloc(sizeof(Hashtable)); + this->size = size; + this->buckets = (HashtableItem**) calloc(sizeof(HashtableItem*), size); + this->hashAlgorithm = Hashtable_hashAlgorithm; + this->owner = owner; + return this; +} + +int Hashtable_hashAlgorithm(Hashtable* this, int key) { + return (key % this->size); +} + +void Hashtable_delete(Hashtable* this) { + for (int i = 0; i < this->size; i++) { + HashtableItem* walk = this->buckets[i]; + while (walk != NULL) { + if (this->owner) + free(walk->value); + HashtableItem* savedWalk = walk; + walk = savedWalk->next; + free(savedWalk); + } + } + free(this->buckets); + free(this); +} + +inline int Hashtable_size(Hashtable* this) { + return this->items; +} + +void Hashtable_put(Hashtable* this, int key, void* value) { + int index = this->hashAlgorithm(this, key); + HashtableItem** bucketPtr = &(this->buckets[index]); + while (true) + if (*bucketPtr == NULL) { + *bucketPtr = HashtableItem_new(key, value); + this->items++; + break; + } else if ((*bucketPtr)->key == key) { + if (this->owner) + free((*bucketPtr)->value); + (*bucketPtr)->value = value; + break; + } else + bucketPtr = &((*bucketPtr)->next); +} + +void* Hashtable_remove(Hashtable* this, int key) { + int index = this->hashAlgorithm(this, key); + HashtableItem** bucketPtr = &(this->buckets[index]); + while (true) + if (*bucketPtr == NULL) { + return NULL; + break; + } else if ((*bucketPtr)->key == key) { + void* savedValue = (*bucketPtr)->value; + HashtableItem* savedNext = (*bucketPtr)->next; + free(*bucketPtr); + (*bucketPtr) = savedNext; + this->items--; + if (this->owner) { + free(savedValue); + return NULL; + } else { + return savedValue; + } + } else + bucketPtr = &((*bucketPtr)->next); +} + +inline void* Hashtable_get(Hashtable* this, int key) { + int index = this->hashAlgorithm(this, key); + HashtableItem* bucketPtr = this->buckets[index]; + while (true) + if (bucketPtr == NULL) { + return NULL; + } else if (bucketPtr->key == key) { + return bucketPtr->value; + } else + bucketPtr = bucketPtr->next; +} + +void Hashtable_foreach(Hashtable* this, HashtablePairFunction f) { + for (int i = 0; i < this->size; i++) { + HashtableItem* walk = this->buckets[i]; + while (walk != NULL) { + f(walk->key, walk->value); + walk = walk->next; + } + } +} diff --git a/Hashtable.h b/Hashtable.h new file mode 100644 index 0000000..e031cbe --- /dev/null +++ b/Hashtable.h @@ -0,0 +1,55 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Hashtable +#define HEADER_Hashtable +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + + +#include +#include + +#include "debug.h" + +typedef struct Hashtable_ Hashtable; + +typedef void(*HashtablePairFunction)(int, void*); +typedef int(*HashtableHashAlgorithm)(Hashtable*, int); + +typedef struct HashtableItem { + int key; + void* value; + struct HashtableItem* next; +} HashtableItem; + +struct Hashtable_ { + int size; + HashtableItem** buckets; + int items; + HashtableHashAlgorithm hashAlgorithm; + bool owner; +}; + +HashtableItem* HashtableItem_new(int key, void* value); + +Hashtable* Hashtable_new(int size, bool owner); + +int Hashtable_hashAlgorithm(Hashtable* this, int key); + +void Hashtable_delete(Hashtable* this); + +inline int Hashtable_size(Hashtable* this); + +void Hashtable_put(Hashtable* this, int key, void* value); + +void* Hashtable_remove(Hashtable* this, int key); + +inline void* Hashtable_get(Hashtable* this, int key); + +void Hashtable_foreach(Hashtable* this, HashtablePairFunction f); + +#endif diff --git a/Header.c b/Header.c new file mode 100644 index 0000000..a044bd1 --- /dev/null +++ b/Header.c @@ -0,0 +1,171 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Header.h" +#include "CPUMeter.h" +#include "MemoryMeter.h" +#include "SwapMeter.h" +#include "LoadMeter.h" +#include "LoadAverageMeter.h" +#include "UptimeMeter.h" +#include "ClockMeter.h" +#include "TasksMeter.h" + +#include "debug.h" +#include + +/*{ + +typedef enum HeaderSide_ { + LEFT_HEADER, + RIGHT_HEADER +} HeaderSide; + +typedef struct Header_ { + TypedVector* leftMeters; + TypedVector* rightMeters; + ProcessList* pl; + bool margin; + int height; + int pad; +} Header; + +}*/ + +Header* Header_new(ProcessList* pl) { + Header* this = malloc(sizeof(Header)); + this->leftMeters = TypedVector_new(METER_CLASS, true, DEFAULT_SIZE); + this->rightMeters = TypedVector_new(METER_CLASS, true, DEFAULT_SIZE); + this->margin = true; + this->pl = pl; + return this; +} + +void Header_delete(Header* this) { + TypedVector_delete(this->leftMeters); + TypedVector_delete(this->rightMeters); + free(this); +} + +void Header_createMeter(Header* this, char* name, HeaderSide side) { + TypedVector* meters = side == LEFT_HEADER + ? this->leftMeters + : this->rightMeters; + + if (String_eq(name, "Swap")) { + TypedVector_add(meters, SwapMeter_new(this->pl)); + } else if (String_eq(name, "Memory")) { + TypedVector_add(meters, MemoryMeter_new(this->pl)); + } else if (String_eq(name, "Clock")) { + TypedVector_add(meters, ClockMeter_new(this->pl)); + } else if (String_eq(name, "Load")) { + TypedVector_add(meters, LoadMeter_new(this->pl)); + } else if (String_eq(name, "LoadAverage")) { + TypedVector_add(meters, LoadAverageMeter_new(this->pl)); + } else if (String_eq(name, "Uptime")) { + TypedVector_add(meters, UptimeMeter_new(this->pl)); + } else if (String_eq(name, "Tasks")) { + TypedVector_add(meters, TasksMeter_new(this->pl)); + } else if (String_startsWith(name, "CPUAverage")) { + TypedVector_add(meters, CPUMeter_new(this->pl, 0)); + } else if (String_startsWith(name, "CPU")) { + int num; + sscanf(name, "CPU(%d)", &num); + TypedVector_add(meters, CPUMeter_new(this->pl, num)); + } +} + +void Header_setMode(Header* this, int i, MeterMode mode, HeaderSide side) { + TypedVector* meters = side == LEFT_HEADER + ? this->leftMeters + : this->rightMeters; + + Meter* meter = (Meter*) TypedVector_get(meters, i); + Meter_setMode(meter, mode); +} + +Meter* Header_getMeter(Header* this, int i, HeaderSide side) { + TypedVector* meters = side == LEFT_HEADER + ? this->leftMeters + : this->rightMeters; + + return (Meter*) TypedVector_get(meters, i); +} + +int Header_size(Header* this, HeaderSide side) { + TypedVector* meters = side == LEFT_HEADER + ? this->leftMeters + : this->rightMeters; + + return TypedVector_size(meters); +} + +char* Header_readMeterName(Header* this, int i, HeaderSide side) { + TypedVector* meters = side == LEFT_HEADER + ? this->leftMeters + : this->rightMeters; + + Meter* meter = (Meter*) TypedVector_get(meters, i); + return meter->name; +} + +MeterMode Header_readMeterMode(Header* this, int i, HeaderSide side) { + TypedVector* meters = side == LEFT_HEADER + ? this->leftMeters + : this->rightMeters; + + Meter* meter = (Meter*) TypedVector_get(meters, i); + return meter->mode; +} + +void Header_defaultMeters(Header* this) { + for (int i = 1; i <= this->pl->processorCount; i++) { + TypedVector_add(this->leftMeters, CPUMeter_new(this->pl, i)); + } + TypedVector_add(this->leftMeters, MemoryMeter_new(this->pl)); + TypedVector_add(this->leftMeters, SwapMeter_new(this->pl)); + TypedVector_add(this->rightMeters, TasksMeter_new(this->pl)); + TypedVector_add(this->rightMeters, LoadAverageMeter_new(this->pl)); + TypedVector_add(this->rightMeters, UptimeMeter_new(this->pl)); +} + +void Header_draw(Header* this) { + int height = this->height; + int pad = this->pad; + + for (int y = 0; y < height; y++) { + mvhline(y, 0, ' ', COLS); + } + for (int y = (pad / 2), i = 0; i < TypedVector_size(this->leftMeters); i++) { + Meter* meter = (Meter*) TypedVector_get(this->leftMeters, i); + meter->draw(meter, pad, y, COLS / 2 - (pad * 2 - 1) - 1); + y += meter->h; + } + for (int y = (pad / 2), i = 0; i < TypedVector_size(this->rightMeters); i++) { + Meter* meter = (Meter*) TypedVector_get(this->rightMeters, i); + meter->draw(meter, COLS / 2 + pad, y, COLS / 2 - (pad * 2 - 1) - 1); + y += meter->h; + } +} + +int Header_calculateHeight(Header* this) { + int pad = this->margin ? 2 : 0; + int leftHeight = pad; + int rightHeight = pad; + + for (int i = 0; i < TypedVector_size(this->leftMeters); i++) { + Meter* meter = (Meter*) TypedVector_get(this->leftMeters, i); + leftHeight += meter->h; + } + for (int i = 0; i < TypedVector_size(this->rightMeters); i++) { + Meter* meter = (Meter*) TypedVector_get(this->rightMeters, i); + rightHeight += meter->h; + } + this->pad = pad; + this->height = MAX(leftHeight, rightHeight); + return this->height; +} diff --git a/Header.h b/Header.h new file mode 100644 index 0000000..59ac9af --- /dev/null +++ b/Header.h @@ -0,0 +1,62 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Header +#define HEADER_Header +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "CPUMeter.h" +#include "MemoryMeter.h" +#include "SwapMeter.h" +#include "LoadMeter.h" +#include "LoadAverageMeter.h" +#include "UptimeMeter.h" +#include "ClockMeter.h" +#include "TasksMeter.h" + +#include "debug.h" +#include + + +typedef enum HeaderSide_ { + LEFT_HEADER, + RIGHT_HEADER +} HeaderSide; + +typedef struct Header_ { + TypedVector* leftMeters; + TypedVector* rightMeters; + ProcessList* pl; + bool margin; + int height; + int pad; +} Header; + + +Header* Header_new(ProcessList* pl); + +void Header_delete(Header* this); + +void Header_createMeter(Header* this, char* name, HeaderSide side); + +void Header_setMode(Header* this, int i, MeterMode mode, HeaderSide side); + +Meter* Header_getMeter(Header* this, int i, HeaderSide side); + +int Header_size(Header* this, HeaderSide side); + +char* Header_readMeterName(Header* this, int i, HeaderSide side); + +MeterMode Header_readMeterMode(Header* this, int i, HeaderSide side); + +void Header_defaultMeters(Header* this); + +void Header_draw(Header* this); + +int Header_calculateHeight(Header* this); + +#endif diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..54caf7c --- /dev/null +++ b/INSTALL @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/ListBox.c b/ListBox.c new file mode 100644 index 0000000..e2df377 --- /dev/null +++ b/ListBox.c @@ -0,0 +1,332 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Object.h" +#include "ListBox.h" +#include "TypedVector.h" +#include "CRT.h" +#include "RichString.h" + +#include +#include +#include + +#include "debug.h" +#include + +#include +//#link curses + +/*{ + +typedef struct ListBox_ ListBox; + +typedef enum HandlerResult_ { + HANDLED, + IGNORED, + BREAK_LOOP +} HandlerResult; + +typedef HandlerResult(*ListBox_eventHandler)(ListBox*, int); + +struct ListBox_ { + Object super; + int x, y, w, h; + WINDOW* window; + TypedVector* items; + int selected; + int scrollV, scrollH; + int oldSelected; + bool needsRedraw; + RichString header; + ListBox_eventHandler eventHandler; +}; + +extern char* LISTBOX_CLASS; + +}*/ + +/* private property */ +char* LISTBOX_CLASS = "ListBox"; + +ListBox* ListBox_new(int x, int y, int w, int h, char* type, bool owner) { + ListBox* this; + this = malloc(sizeof(ListBox)); + ListBox_init(this, x, y, w, h, type, owner); + return this; +} + +void ListBox_delete(Object* cast) { + ListBox* this = (ListBox*)cast; + ListBox_done(this); + free(this); +} + +void ListBox_init(ListBox* this, int x, int y, int w, int h, char* type, bool owner) { + Object* super = (Object*) this; + super->class = LISTBOX_CLASS; + super->delete = ListBox_delete; + this->x = x; + this->y = y; + this->w = w; + this->h = h; + this->eventHandler = NULL; + this->items = TypedVector_new(type, owner, DEFAULT_SIZE); + this->scrollV = 0; + this->scrollH = 0; + this->selected = 0; + this->oldSelected = 0; + this->needsRedraw = true; + this->header.len = 0; +} + +void ListBox_done(ListBox* this) { + assert (this != NULL); + RichString_delete(this->header); + TypedVector_delete(this->items); +} + +void ListBox_setHeader(ListBox* this, RichString header) { + assert (this != NULL); + + if (this->header.len > 0) { + RichString_delete(this->header); + } + this->header = header; + this->needsRedraw = true; +} + +void ListBox_move(ListBox* this, int x, int y) { + assert (this != NULL); + + this->x = x; + this->y = y; + this->needsRedraw = true; +} + +void ListBox_resize(ListBox* this, int w, int h) { + assert (this != NULL); + + if (this->header.len > 0) + h--; + this->w = w; + this->h = h; + this->needsRedraw = true; +} + +void ListBox_prune(ListBox* this) { + assert (this != NULL); + + TypedVector_prune(this->items); + this->scrollV = 0; + this->selected = 0; + this->oldSelected = 0; + this->needsRedraw = true; +} + +void ListBox_add(ListBox* this, Object* o) { + assert (this != NULL); + + TypedVector_add(this->items, o); + this->needsRedraw = true; +} + +void ListBox_set(ListBox* this, int i, Object* o) { + assert (this != NULL); + + TypedVector_set(this->items, i, o); +} + +Object* ListBox_get(ListBox* this, int i) { + assert (this != NULL); + + return TypedVector_get(this->items, i); +} + +Object* ListBox_remove(ListBox* this, int i) { + assert (this != NULL); + + this->needsRedraw = true; + Object* removed = TypedVector_remove(this->items, i); + if (this->selected > 0 && this->selected >= TypedVector_size(this->items)) + this->selected--; + return removed; +} + +Object* ListBox_getSelected(ListBox* this) { + assert (this != NULL); + + return TypedVector_get(this->items, this->selected); +} + +void ListBox_moveSelectedUp(ListBox* this) { + assert (this != NULL); + + TypedVector_moveUp(this->items, this->selected); + if (this->selected > 0) + this->selected--; +} + +void ListBox_moveSelectedDown(ListBox* this) { + assert (this != NULL); + + TypedVector_moveDown(this->items, this->selected); + if (this->selected + 1 < TypedVector_size(this->items)) + this->selected++; +} + +int ListBox_getSelectedIndex(ListBox* this) { + assert (this != NULL); + + return this->selected; +} + +int ListBox_getSize(ListBox* this) { + assert (this != NULL); + + return TypedVector_size(this->items); +} + +void ListBox_setSelected(ListBox* this, int selected) { + assert (this != NULL); + + selected = MAX(0, MIN(TypedVector_size(this->items) - 1, selected)); + this->selected = selected; +} + +void ListBox_draw(ListBox* this, bool focus) { + assert (this != NULL); + + int first, last; + int itemCount = TypedVector_size(this->items); + int scrollH = this->scrollH; + int y = this->y; int x = this->x; + first = this->scrollV; + + if (this->h > itemCount) { + last = this->scrollV + itemCount; + move(y + last, x + 0); + } else { + last = MIN(itemCount, this->scrollV + this->h); + } + if (this->selected < first) { + first = this->selected; + this->scrollV = first; + this->needsRedraw = true; + } + if (this->selected >= last) { + last = MIN(itemCount, this->selected + 1); + first = MAX(0, last - this->h); + this->scrollV = first; + this->needsRedraw = true; + } + assert(first >= 0); + assert(last <= itemCount); + + if (this->header.len > 0) { + int attr = focus + ? CRT_colors[PANEL_HEADER_FOCUS] + : CRT_colors[PANEL_HEADER_UNFOCUS]; + attrset(attr); + mvhline(y, x, ' ', this->w); + if (scrollH < this->header.len) { + mvaddchnstr(y, x, this->header.chstr + scrollH, + MIN(this->header.len - scrollH, this->w)); + } + attrset(CRT_colors[RESET_COLOR]); + y++; + } + + int highlight = focus + ? CRT_colors[PANEL_HIGHLIGHT_FOCUS] + : CRT_colors[PANEL_HIGHLIGHT_UNFOCUS]; + + if (this->needsRedraw) { + + for(int i = first, j = 0; j < this->h && i < last; i++, j++) { + Object* itemObj = TypedVector_get(this->items, i); + RichString itemRef = RichString_new(); + itemObj->display(itemObj, &itemRef); + int amt = MIN(itemRef.len - scrollH, this->w); + if (i == this->selected) { + attrset(highlight); + RichString_setAttr(&itemRef, highlight); + mvhline(y + j, x+0, ' ', this->w); + if (amt > 0) + mvaddchnstr(y+j, x+0, itemRef.chstr + scrollH, amt); + attrset(CRT_colors[RESET_COLOR]); + } else { + mvhline(y+j, x+0, ' ', this->w); + if (amt > 0) + mvaddchnstr(y+j, x+0, itemRef.chstr + scrollH, amt); + } + } + for (int i = y + (last - first); i < y + this->h; i++) + mvhline(i, x+0, ' ', this->w); + this->needsRedraw = false; + + } else { + Object* oldObj = TypedVector_get(this->items, this->oldSelected); + RichString oldRef = RichString_new(); + oldObj->display(oldObj, &oldRef); + Object* newObj = TypedVector_get(this->items, this->selected); + RichString newRef = RichString_new(); + newObj->display(newObj, &newRef); + mvhline(y+ this->oldSelected - this->scrollV, x+0, ' ', this->w); + if (scrollH < oldRef.len) + mvaddchnstr(y+ this->oldSelected - this->scrollV, x+0, oldRef.chstr + this->scrollH, MIN(oldRef.len - scrollH, this->w)); + attrset(highlight); + mvhline(y+this->selected - this->scrollV, x+0, ' ', this->w); + RichString_setAttr(&newRef, highlight); + if (scrollH < newRef.len) + mvaddchnstr(y+this->selected - this->scrollV, x+0, newRef.chstr + this->scrollH, MIN(newRef.len - scrollH, this->w)); + attrset(CRT_colors[RESET_COLOR]); + } + this->oldSelected = this->selected; + move(0, 0); +} + +void ListBox_onKey(ListBox* this, int key) { + assert (this != NULL); + switch (key) { + case KEY_DOWN: + if (this->selected + 1 < TypedVector_size(this->items)) + this->selected++; + break; + case KEY_UP: + if (this->selected > 0) + this->selected--; + break; + case KEY_LEFT: + if (this->scrollH > 0) { + this->scrollH -= 5; + this->needsRedraw = true; + } + break; + case KEY_RIGHT: + this->scrollH += 5; + this->needsRedraw = true; + break; + case KEY_PPAGE: + this->selected -= this->h; + if (this->selected < 0) + this->selected = 0; + break; + case KEY_NPAGE: + this->selected += this->h; + int size = TypedVector_size(this->items); + if (this->selected >= size) + this->selected = size - 1; + break; + case KEY_HOME: + this->selected = 0; + break; + case KEY_END: + this->selected = TypedVector_size(this->items) - 1; + break; + } +} diff --git a/ListBox.h b/ListBox.h new file mode 100644 index 0000000..3843abe --- /dev/null +++ b/ListBox.h @@ -0,0 +1,95 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_ListBox +#define HEADER_ListBox +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Object.h" +#include "TypedVector.h" +#include "CRT.h" +#include "RichString.h" + +#include +#include +#include + +#include "debug.h" +#include + +#include +//#link curses + + +typedef struct ListBox_ ListBox; + +typedef enum HandlerResult_ { + HANDLED, + IGNORED, + BREAK_LOOP +} HandlerResult; + +typedef HandlerResult(*ListBox_eventHandler)(ListBox*, int); + +struct ListBox_ { + Object super; + int x, y, w, h; + WINDOW* window; + TypedVector* items; + int selected; + int scrollV, scrollH; + int oldSelected; + bool needsRedraw; + RichString header; + ListBox_eventHandler eventHandler; +}; + +extern char* LISTBOX_CLASS; + + + +ListBox* ListBox_new(int x, int y, int w, int h, char* type, bool owner); + +void ListBox_delete(Object* cast); + +void ListBox_init(ListBox* this, int x, int y, int w, int h, char* type, bool owner); + +void ListBox_done(ListBox* this); + +void ListBox_setHeader(ListBox* this, RichString header); + +void ListBox_move(ListBox* this, int x, int y); + +void ListBox_resize(ListBox* this, int w, int h); + +void ListBox_prune(ListBox* this); + +void ListBox_add(ListBox* this, Object* o); + +void ListBox_set(ListBox* this, int i, Object* o); + +Object* ListBox_get(ListBox* this, int i); + +Object* ListBox_remove(ListBox* this, int i); + +Object* ListBox_getSelected(ListBox* this); + +void ListBox_moveSelectedUp(ListBox* this); + +void ListBox_moveSelectedDown(ListBox* this); + +int ListBox_getSelectedIndex(ListBox* this); + +int ListBox_getSize(ListBox* this); + +void ListBox_setSelected(ListBox* this, int selected); + +void ListBox_draw(ListBox* this, bool focus); + +void ListBox_onKey(ListBox* this, int key); + +#endif diff --git a/ListItem.c b/ListItem.c new file mode 100644 index 0000000..840ca98 --- /dev/null +++ b/ListItem.c @@ -0,0 +1,48 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ListItem.h" +#include "Object.h" +#include "CRT.h" + +#include "debug.h" + +/*{ + +typedef struct ListItem_ { + Object super; + char* text; +} ListItem; + +extern char* LISTITEM_CLASS; +}*/ + +/* private property */ +char* LISTITEM_CLASS = "ListItem"; + +ListItem* ListItem_new(char* text) { + ListItem* this = malloc(sizeof(ListItem)); + ((Object*)this)->class = LISTITEM_CLASS; + ((Object*)this)->display = ListItem_display; + ((Object*)this)->delete = ListItem_delete; + this->text = text; + return this; +} + +void ListItem_delete(Object* cast) { + ListItem* this = (ListItem*)cast; + assert (this != NULL); + + free(this->text); + free(this); +} + +void ListItem_display(Object* cast, RichString* out) { + ListItem* this = (ListItem*)cast; + assert (this != NULL); + RichString_write(out, CRT_colors[DEFAULT_COLOR], this->text); +} diff --git a/ListItem.h b/ListItem.h new file mode 100644 index 0000000..9f1584b --- /dev/null +++ b/ListItem.h @@ -0,0 +1,32 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_ListItem +#define HEADER_ListItem +/* +htop +(C) 2004 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 ListItem_ { + Object super; + char* text; +} ListItem; + +extern char* LISTITEM_CLASS; + + +ListItem* ListItem_new(char* text); + +void ListItem_delete(Object* cast); + +void ListItem_display(Object* cast, RichString* out); + +#endif diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c new file mode 100644 index 0000000..7add62d --- /dev/null +++ b/LoadAverageMeter.c @@ -0,0 +1,69 @@ +/* +htop +(C) 2004 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 "ProcessList.h" + +#include + +#include "debug.h" + +/*{ + +typedef struct LoadAverageMeter_ LoadAverageMeter; + +struct LoadAverageMeter_ { + Meter super; + ProcessList* pl; +}; + +}*/ + +/* private property */ +void LoadAverageMeter_scan(double* one, double* five, double* fifteen); + +LoadAverageMeter* LoadAverageMeter_new() { + LoadAverageMeter* this = malloc(sizeof(LoadAverageMeter)); + Meter_init((Meter*)this, String_copy("LoadAverage"), String_copy("Load average: "), 3); + ((Meter*)this)->attributes[0] = CRT_colors[LOAD_AVERAGE_FIFTEEN]; + ((Meter*)this)->attributes[1] = CRT_colors[LOAD_AVERAGE_FIVE]; + ((Meter*)this)->attributes[2] = CRT_colors[LOAD_AVERAGE_ONE]; + ((Object*)this)->display = LoadAverageMeter_display; + ((Meter*)this)->setValues = LoadAverageMeter_setValues; + Meter_setMode((Meter*)this, TEXT); + LoadAverageMeter_scan(&((Meter*)this)->values[0], &((Meter*)this)->values[1], &((Meter*)this)->values[2]); + ((Meter*)this)->total = 100.0; + return this; +} + +/* private */ +void LoadAverageMeter_scan(double* one, double* five, double* fifteen) { + int activeProcs, totalProcs, lastProc; + FILE *fd = fopen(PROCDIR "/loadavg", "r"); + fscanf(fd, "%lf %lf %lf %d/%d %d", one, five, fifteen, + &activeProcs, &totalProcs, &lastProc); + fclose(fd); +} + +void LoadAverageMeter_setValues(Meter* cast) { + LoadAverageMeter_scan(&cast->values[2], &cast->values[1], &cast->values[0]); + snprintf(cast->displayBuffer.c, 25, "%.2f/%.2f/%.2f", cast->values[2], cast->values[1], cast->values[0]); +} + +void LoadAverageMeter_display(Object* cast, RichString* out) { + Meter* this = (Meter*)cast; + char buffer[20]; + RichString_prune(out); + sprintf(buffer, "%.2f ", this->values[2]); + RichString_append(out, CRT_colors[LOAD_AVERAGE_ONE], buffer); + sprintf(buffer, "%.2f ", this->values[1]); + RichString_append(out, CRT_colors[LOAD_AVERAGE_FIVE], buffer); + sprintf(buffer, "%.2f ", this->values[0]); + RichString_append(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer); +} diff --git a/LoadAverageMeter.h b/LoadAverageMeter.h new file mode 100644 index 0000000..8528fd4 --- /dev/null +++ b/LoadAverageMeter.h @@ -0,0 +1,37 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_LoadAverageMeter +#define HEADER_LoadAverageMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include + +#include "debug.h" + + +typedef struct LoadAverageMeter_ LoadAverageMeter; + +struct LoadAverageMeter_ { + Meter super; + ProcessList* pl; +}; + + + +LoadAverageMeter* LoadAverageMeter_new(); + + +void LoadAverageMeter_setValues(Meter* cast); + +void LoadAverageMeter_display(Object* cast, RichString* out); + +#endif diff --git a/LoadMeter.c b/LoadMeter.c new file mode 100644 index 0000000..ce6b098 --- /dev/null +++ b/LoadMeter.c @@ -0,0 +1,62 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "LoadMeter.h" +#include "Meter.h" + +#include "ProcessList.h" + +#include "debug.h" + +/*{ + +typedef struct LoadMeter_ LoadMeter; + +struct LoadMeter_ { + Meter super; + ProcessList* pl; +}; + +}*/ + +LoadMeter* LoadMeter_new() { + LoadMeter* this = malloc(sizeof(LoadMeter)); + Meter_init((Meter*)this, String_copy("Load"), String_copy("Load: "), 1); + ((Meter*)this)->attributes[0] = CRT_colors[LOAD]; + ((Meter*)this)->setValues = LoadMeter_setValues; + ((Object*)this)->display = LoadMeter_display; + Meter_setMode((Meter*)this, GRAPH); + ((Meter*)this)->total = 1.0; + return this; +} + +/* private */ +void LoadMeter_scan(double* one, double* five, double* fifteen) { + int activeProcs, totalProcs, lastProc; + FILE *fd = fopen(PROCDIR "/loadavg", "r"); + fscanf(fd, "%lf %lf %lf %d/%d %d", one, five, fifteen, + &activeProcs, &totalProcs, &lastProc); + fclose(fd); +} + +void LoadMeter_setValues(Meter* cast) { + double five, fifteen; + LoadMeter_scan(&cast->values[0], &five, &fifteen); + if (cast->values[0] > cast->total) { + cast->total = cast->values[0]; + } + snprintf(cast->displayBuffer.c, 7, "%.2f", cast->values[0]); +} + +void LoadMeter_display(Object* cast, RichString* out) { + Meter* super = (Meter*)cast; + LoadMeter* this = (LoadMeter*)cast; + char buffer[20]; + RichString_prune(out); + sprintf(buffer, "%.2f ", ((Meter*)this)->values[0]); + RichString_append(out, super->attributes[0], buffer); +} diff --git a/LoadMeter.h b/LoadMeter.h new file mode 100644 index 0000000..f880bbe --- /dev/null +++ b/LoadMeter.h @@ -0,0 +1,34 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_LoadMeter +#define HEADER_LoadMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include "debug.h" + + +typedef struct LoadMeter_ LoadMeter; + +struct LoadMeter_ { + Meter super; + ProcessList* pl; +}; + + +LoadMeter* LoadMeter_new(); + + +void LoadMeter_setValues(Meter* cast); + +void LoadMeter_display(Object* cast, RichString* out); + +#endif diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d4a42a5 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,20 @@ + +bin_PROGRAMS = htop +dist_man_MANS = htop.1 +EXTRA_DIST = $(dist_man_MANS) + +AM_CFLAGS = -pedantic -Wall -std=c99 + +htop_SOURCES = AvailableMetersListBox.c CategoriesListBox.c ClockMeter.c \ +CPUMeter.c CRT.c DebugMemory.c DisplayOptionsListBox.c FunctionBar.c \ +Hashtable.c Header.c htop.c ListBox.c ListItem.c LoadAverageMeter.c \ +LoadMeter.c MemoryMeter.c Meter.c MetersListBox.c Object.c Process.c \ +ProcessList.c RichString.c ScreenManager.c Settings.c Signal.c \ +SignalsListBox.c String.c SwapMeter.c TasksMeter.c TypedVector.c \ +UptimeMeter.c UsersTable.c AvailableMetersListBox.h CategoriesListBox.h \ +ClockMeter.h config.h CPUMeter.h CRT.h debug.h DebugMemory.h \ +DisplayOptionsListBox.h FunctionBar.h Hashtable.h Header.h htop.h ListBox.h \ +ListItem.h LoadAverageMeter.h LoadMeter.h MemoryMeter.h Meter.h \ +MetersListBox.h Object.h Process.h ProcessList.h RichString.h ScreenManager.h \ +Settings.h Signal.h SignalsListBox.h String.h SwapMeter.h TasksMeter.h \ +TypedVector.h UptimeMeter.h UsersTable.h CheckItem.c CheckItem.h diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..c6a6c57 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,667 @@ +# Makefile.in generated by automake 1.8.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(htop_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +bin_PROGRAMS = htop$(EXEEXT) +subdir = . +DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \ + ChangeLog INSTALL NEWS TODO depcomp install-sh missing \ + mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_htop_OBJECTS = AvailableMetersListBox.$(OBJEXT) \ + CategoriesListBox.$(OBJEXT) ClockMeter.$(OBJEXT) \ + CPUMeter.$(OBJEXT) CRT.$(OBJEXT) DebugMemory.$(OBJEXT) \ + DisplayOptionsListBox.$(OBJEXT) FunctionBar.$(OBJEXT) \ + Hashtable.$(OBJEXT) Header.$(OBJEXT) htop.$(OBJEXT) \ + ListBox.$(OBJEXT) ListItem.$(OBJEXT) \ + LoadAverageMeter.$(OBJEXT) LoadMeter.$(OBJEXT) \ + MemoryMeter.$(OBJEXT) Meter.$(OBJEXT) MetersListBox.$(OBJEXT) \ + Object.$(OBJEXT) Process.$(OBJEXT) ProcessList.$(OBJEXT) \ + RichString.$(OBJEXT) ScreenManager.$(OBJEXT) \ + Settings.$(OBJEXT) Signal.$(OBJEXT) SignalsListBox.$(OBJEXT) \ + String.$(OBJEXT) SwapMeter.$(OBJEXT) TasksMeter.$(OBJEXT) \ + TypedVector.$(OBJEXT) UptimeMeter.$(OBJEXT) \ + UsersTable.$(OBJEXT) CheckItem.$(OBJEXT) +htop_OBJECTS = $(am_htop_OBJECTS) +htop_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/AvailableMetersListBox.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/CPUMeter.Po ./$(DEPDIR)/CRT.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/CategoriesListBox.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/CheckItem.Po ./$(DEPDIR)/ClockMeter.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/DebugMemory.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/DisplayOptionsListBox.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/FunctionBar.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Hashtable.Po ./$(DEPDIR)/Header.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ListBox.Po ./$(DEPDIR)/ListItem.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/LoadAverageMeter.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/LoadMeter.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/MemoryMeter.Po ./$(DEPDIR)/Meter.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/MetersListBox.Po ./$(DEPDIR)/Object.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Process.Po ./$(DEPDIR)/ProcessList.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/RichString.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ScreenManager.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/Settings.Po ./$(DEPDIR)/Signal.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/SignalsListBox.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/String.Po ./$(DEPDIR)/SwapMeter.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/TasksMeter.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/TypedVector.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/UptimeMeter.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/UsersTable.Po ./$(DEPDIR)/htop.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(htop_SOURCES) +DIST_SOURCES = $(htop_SOURCES) +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(dist_man_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build_alias = @build_alias@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +dist_man_MANS = htop.1 +EXTRA_DIST = $(dist_man_MANS) +AM_CFLAGS = -pedantic -Wall -std=c99 +htop_SOURCES = AvailableMetersListBox.c CategoriesListBox.c ClockMeter.c \ +CPUMeter.c CRT.c DebugMemory.c DisplayOptionsListBox.c FunctionBar.c \ +Hashtable.c Header.c htop.c ListBox.c ListItem.c LoadAverageMeter.c \ +LoadMeter.c MemoryMeter.c Meter.c MetersListBox.c Object.c Process.c \ +ProcessList.c RichString.c ScreenManager.c Settings.c Signal.c \ +SignalsListBox.c String.c SwapMeter.c TasksMeter.c TypedVector.c \ +UptimeMeter.c UsersTable.c AvailableMetersListBox.h CategoriesListBox.h \ +ClockMeter.h config.h CPUMeter.h CRT.h debug.h DebugMemory.h \ +DisplayOptionsListBox.h FunctionBar.h Hashtable.h Header.h htop.h ListBox.h \ +ListItem.h LoadAverageMeter.h LoadMeter.h MemoryMeter.h Meter.h \ +MetersListBox.h Object.h Process.h ProcessList.h RichString.h ScreenManager.h \ +Settings.h Signal.h SignalsListBox.h String.h SwapMeter.h TasksMeter.h \ +TypedVector.h UptimeMeter.h UsersTable.h CheckItem.c CheckItem.h + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +htop$(EXEEXT): $(htop_OBJECTS) $(htop_DEPENDENCIES) + @rm -f htop$(EXEEXT) + $(LINK) $(htop_LDFLAGS) $(htop_OBJECTS) $(htop_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AvailableMetersListBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CPUMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CRT.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CategoriesListBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CheckItem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClockMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DebugMemory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DisplayOptionsListBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FunctionBar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Hashtable.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Header.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ListBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ListItem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LoadAverageMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LoadMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MemoryMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Meter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetersListBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Object.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Process.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProcessList.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RichString.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScreenManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Settings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Signal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SignalsListBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/String.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SwapMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TasksMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TypedVector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UptimeMeter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UsersTable.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htop.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -z "$$unique" && unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) config.h +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ + clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ + dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-man1 install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am uninstall-man uninstall-man1 + +# 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. +.NOEXPORT: diff --git a/MemoryMeter.c b/MemoryMeter.c new file mode 100644 index 0000000..01a9ac1 --- /dev/null +++ b/MemoryMeter.c @@ -0,0 +1,98 @@ +/* +htop +(C) 2004 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 "ProcessList.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + +/*{ + +typedef struct MemoryMeter_ MemoryMeter; + +struct MemoryMeter_ { + Meter super; + ProcessList* pl; + char* wideFormat; + int wideLimit; +}; + +}*/ + +MemoryMeter* MemoryMeter_new(ProcessList* pl) { + MemoryMeter* this = malloc(sizeof(MemoryMeter)); + Meter_init((Meter*)this, String_copy("Memory"), String_copy("Mem"), 3); + ((Meter*)this)->attributes[0] = CRT_colors[MEMORY_USED]; + ((Meter*)this)->attributes[1] = CRT_colors[MEMORY_BUFFERS]; + ((Meter*)this)->attributes[2] = CRT_colors[MEMORY_CACHE]; + ((Meter*)this)->setValues = MemoryMeter_setValues; + ((Object*)this)->display = MemoryMeter_display; + this->pl = pl; + Meter_setMode((Meter*)this, BAR); + if (this->pl->totalMem > 1000000) { + this->wideFormat = "%7ldk "; + this->wideLimit = 22 + 9 * 4; + } else if (this->pl->totalMem > 100000) { + this->wideFormat = "%6ldk "; + this->wideLimit = 22 + 8 * 4; + } else { + this->wideFormat = "%5ldk "; + this->wideLimit = 22 + 7 * 4; + } + return this; +} + +void MemoryMeter_setValues(Meter* cast) { + MemoryMeter* this = (MemoryMeter*)cast; + + double totalMem = (double)this->pl->totalMem; + long int usedMem = this->pl->usedMem; + long int buffersMem = this->pl->buffersMem; + long int cachedMem = this->pl->cachedMem; + usedMem -= buffersMem + cachedMem; + cast->total = totalMem; + cast->values[0] = usedMem; + cast->values[1] = buffersMem; + cast->values[2] = cachedMem; + snprintf(cast->displayBuffer.c, 14, "%ld/%ldMB", usedMem / 1024, this->pl->totalMem / 1024); +} + +void MemoryMeter_display(Object* cast, RichString* out) { + char buffer[50]; + MemoryMeter* this = (MemoryMeter*)cast; + Meter* meter = (Meter*)cast; + int div = 1024; char* format = "%ldM "; + if (meter->w > this->wideLimit) { + div = 1; format = this->wideFormat; + } + long int totalMem = meter->total / div; + long int usedMem = meter->values[0] / div; + long int buffersMem = meter->values[1] / div; + long int cachedMem = meter->values[2] / div; + RichString_prune(out); + RichString_append(out, CRT_colors[METER_TEXT], ":"); + sprintf(buffer, format, totalMem); + RichString_append(out, CRT_colors[METER_VALUE], buffer); + sprintf(buffer, format, usedMem); + RichString_append(out, CRT_colors[METER_TEXT], "used:"); + RichString_append(out, meter->attributes[0], buffer); + sprintf(buffer, format, buffersMem); + RichString_append(out, CRT_colors[METER_TEXT], "buffers:"); + RichString_append(out, meter->attributes[1], buffer); + sprintf(buffer, format, cachedMem); + RichString_append(out, CRT_colors[METER_TEXT], "cache:"); + RichString_append(out, meter->attributes[2], buffer); +} diff --git a/MemoryMeter.h b/MemoryMeter.h new file mode 100644 index 0000000..7bab321 --- /dev/null +++ b/MemoryMeter.h @@ -0,0 +1,42 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_MemoryMeter +#define HEADER_MemoryMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + + +typedef struct MemoryMeter_ MemoryMeter; + +struct MemoryMeter_ { + Meter super; + ProcessList* pl; + char* wideFormat; + int wideLimit; +}; + + +MemoryMeter* MemoryMeter_new(ProcessList* pl); + +void MemoryMeter_setValues(Meter* cast); + +void MemoryMeter_display(Object* cast, RichString* out); + +#endif diff --git a/Meter.c b/Meter.c new file mode 100644 index 0000000..bba5078 --- /dev/null +++ b/Meter.c @@ -0,0 +1,349 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" +#include "Object.h" +#include "CRT.h" +#include "ListItem.h" +#include "String.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + +#define METER_BARBUFFER_LEN 128 +#define METER_GRAPHBUFFER_LEN 128 + +/*{ + +typedef struct Meter_ Meter; + +typedef void(*Method_Meter_setValues)(Meter*); +typedef void(*Method_Meter_draw)(Meter*, int, int, int); + +typedef enum MeterMode_ { + UNSET, + BAR, + TEXT, + GRAPH, + LED, + LAST_METERMODE +} MeterMode; + +struct Meter_ { + Object super; + + int h; + int w; + Method_Meter_draw draw; + Method_Meter_setValues setValues; + int items; + int* attributes; + double* values; + double total; + char* caption; + char* name; + union { + RichString* rs; + char* c; + double* graph; + } displayBuffer; + MeterMode mode; +}; + +extern char* METER_CLASS; + +}*/ + +/* private property */ +char* METER_CLASS = "Meter"; + +/* private */ +char* Meter_ledDigits[3][10] = { + { " __ "," "," __ "," __ "," "," __ "," __ "," __ "," __ "," __ "}, + { "| |"," |"," __|"," __|","|__|","|__ ","|__ "," |","|__|","|__|"}, + { "|__|"," |","|__ "," __|"," |"," __|","|__|"," |","|__|"," __|"}, +}; + +/* private property */ +char Meter_barCharacters[] = "|#*@$%&"; + +Meter* Meter_new(char* name, char* caption, int items) { + Meter* this = malloc(sizeof(Meter)); + Meter_init(this, name, caption, items); + return this; +} + +void Meter_init(Meter* this, char* name, char* caption, int items) { + ((Object*)this)->delete = Meter_delete; + ((Object*)this)->class = METER_CLASS; + this->items = items; + this->name = name; + this->caption = caption; + this->attributes = malloc(sizeof(int) * items); + this->values = malloc(sizeof(double) * items); + this->displayBuffer.c = NULL; + this->mode = UNSET; + this->h = 0; +} + +void Meter_delete(Object* cast) { + Meter* this = (Meter*) cast; + assert (this != NULL); + Meter_done(this); + free(this); +} + +/* private */ +void Meter_freeBuffer(Meter* this) { + switch (this->mode) { + case BAR: { + free(this->displayBuffer.c); + break; + } + case LED: + case TEXT: { + free(this->displayBuffer.rs); + break; + } + case GRAPH: { + free(this->displayBuffer.graph); + break; + } + default: { + } + } + this->h = 0; +} + +void Meter_done(Meter* this) { + free(this->caption); + free(this->attributes); + free(this->values); + free(this->name); + Meter_freeBuffer(this); +} + +/* private */ +void Meter_drawBar(Meter* this, int x, int y, int w) { + + w -= 2; + attrset(CRT_colors[METER_TEXT]); + mvaddstr(y, x, this->caption); + int captionLen = strlen(this->caption); + x += captionLen; + w -= captionLen; + attrset(CRT_colors[BAR_BORDER]); + mvaddch(y, x, '['); + mvaddch(y, x + w, ']'); + + w--; + x++; + char bar[w]; + + this->setValues(this); + + int blockSizes[10]; + for (int i = 0; i < w; i++) + bar[i] = ' '; + + sprintf(bar + (w-strlen(this->displayBuffer.c)), "%s", this->displayBuffer.c); + + // First draw in the bar[] buffer... + double total = 0.0; + int offset = 0; + for (int i = 0; i < this->items; i++) { + this->values[i] = MAX(this->values[i], 0); + this->values[i] = MIN(this->values[i], this->total); + double value = this->values[i]; + if (value > 0) { + blockSizes[i] = ceil((value/this->total) * w); + } else { + blockSizes[i] = 0; + } + int nextOffset = offset + blockSizes[i]; + // (Control against invalid values) + nextOffset = MAX(nextOffset, 0); + nextOffset = MIN(nextOffset, w); + for (int j = offset; j < nextOffset; j++) + if (bar[j] == ' ') { + if (CRT_hasColors) { + bar[j] = '|'; + } else { + bar[j] = Meter_barCharacters[i]; + } + } + offset = nextOffset; + total += this->values[i]; + } + + // ...then print the buffer. + offset = 0; + for (int i = 0; i < this->items; i++) { + attrset(this->attributes[i]); + mvaddnstr(y, x + offset, bar + offset, blockSizes[i]); + offset += blockSizes[i]; + offset = MAX(offset, 0); + offset = MIN(offset, w); + } + if (offset < w) { + attrset(CRT_colors[BAR_SHADOW]); + mvaddnstr(y, x + offset, bar + offset, w - offset); + } + + move(y, x + w + 1); + attrset(CRT_colors[RESET_COLOR]); +} + +/* private */ +void Meter_drawText(Meter* this, int x, int y, int w) { + this->setValues(this); + this->w = w; + attrset(CRT_colors[METER_TEXT]); + mvaddstr(y, x, this->caption); + int captionLen = strlen(this->caption); + w -= captionLen; + x += captionLen; + ((Object*)this)->display((Object*)this, this->displayBuffer.rs); + mvhline(y, x, ' ', CRT_colors[DEFAULT_COLOR]); + attrset(CRT_colors[RESET_COLOR]); + mvaddchstr(y, x, this->displayBuffer.rs->chstr); +} + +/* private */ +void Meter_drawDigit(int x, int y, int n) { + for (int i = 0; i < 3; i++) { + mvaddstr(y+i, x, Meter_ledDigits[i][n]); + } +} + +/* private */ +void Meter_drawLed(Meter* this, int x, int y, int w) { + this->setValues(this); + ((Object*)this)->display((Object*)this, this->displayBuffer.rs); + attrset(CRT_colors[LED_COLOR]); + mvaddstr(y+2, x, this->caption); + int xx = x + strlen(this->caption); + for (int i = 0; i < this->displayBuffer.rs->len; i++) { + char c = this->displayBuffer.rs->chstr[i]; + if (c >= '0' && c <= '9') { + Meter_drawDigit(xx, y, c-48); + xx += 4; + } else { + mvaddch(y+2, xx, c); + xx += 1; + } + } + attrset(CRT_colors[RESET_COLOR]); +} + +#define DrawDot(a,y,c) do { \ + attrset(a); \ + mvaddstr(y, x+k, c); \ +} while(0) + +/* private */ +void Meter_drawGraph(Meter* this, int x, int y, int w) { + + for (int i = 0; i < METER_GRAPHBUFFER_LEN - 1; i++) { + this->displayBuffer.graph[i] = this->displayBuffer.graph[i+1]; + } + + this->setValues(this); + + double value = 0.0; + for (int i = 0; i < this->items; i++) + value += this->values[i] / this->total; + this->displayBuffer.graph[METER_GRAPHBUFFER_LEN - 1] = value; + + for (int i = METER_GRAPHBUFFER_LEN - w, k = 0; i < METER_GRAPHBUFFER_LEN; i++, k++) { + double value = this->displayBuffer.graph[i]; + DrawDot( CRT_colors[DEFAULT_COLOR], y, " " ); + DrawDot( CRT_colors[DEFAULT_COLOR], y+1, " " ); + DrawDot( CRT_colors[DEFAULT_COLOR], y+2, " " ); + if (value >= 1.00) DrawDot( CRT_colors[GRAPH_1], y, "^" ); + else if (value >= 0.95) DrawDot( CRT_colors[GRAPH_1], y, "`" ); + else if (value >= 0.90) DrawDot( CRT_colors[GRAPH_1], y, "'" ); + else if (value >= 0.85) DrawDot( CRT_colors[GRAPH_2], y, "-" ); + else if (value >= 0.80) DrawDot( CRT_colors[GRAPH_2], y, "." ); + else if (value >= 0.75) DrawDot( CRT_colors[GRAPH_2], y, "," ); + else if (value >= 0.70) DrawDot( CRT_colors[GRAPH_3], y, "_" ); + else if (value >= 0.65) DrawDot( CRT_colors[GRAPH_3], y+1, "~" ); + else if (value >= 0.60) DrawDot( CRT_colors[GRAPH_3], y+1, "`" ); + else if (value >= 0.55) DrawDot( CRT_colors[GRAPH_4], y+1, "'" ); + else if (value >= 0.50) DrawDot( CRT_colors[GRAPH_4], y+1, "-" ); + else if (value >= 0.45) DrawDot( CRT_colors[GRAPH_4], y+1, "." ); + else if (value >= 0.40) DrawDot( CRT_colors[GRAPH_5], y+1, "," ); + else if (value >= 0.35) DrawDot( CRT_colors[GRAPH_5], y+1, "_" ); + else if (value >= 0.30) DrawDot( CRT_colors[GRAPH_6], y+2, "~" ); + else if (value >= 0.25) DrawDot( CRT_colors[GRAPH_7], y+2, "`" ); + else if (value >= 0.20) DrawDot( CRT_colors[GRAPH_7], y+2, "'" ); + else if (value >= 0.15) DrawDot( CRT_colors[GRAPH_7], y+2, "-" ); + else if (value >= 0.10) DrawDot( CRT_colors[GRAPH_8], y+2, "." ); + else if (value >= 0.05) DrawDot( CRT_colors[GRAPH_8], y+2, "," ); + else DrawDot( CRT_colors[GRAPH_9], y+2, "_" ); + } + attrset(CRT_colors[RESET_COLOR]); +} + +void Meter_setMode(Meter* this, MeterMode mode) { + Meter_freeBuffer(this); + switch (mode) { + case UNSET: { + // fallthrough to a sane default. + mode = TEXT; + } + case TEXT: { + this->draw = Meter_drawText; + this->displayBuffer.rs = malloc(sizeof(RichString)); + this->h = 1; + break; + } + case LED: { + this->draw = Meter_drawLed; + this->displayBuffer.rs = malloc(sizeof(RichString)); + this->h = 3; + break; + } + case BAR: { + this->draw = Meter_drawBar; + this->displayBuffer.c = malloc(METER_BARBUFFER_LEN); + this->h = 1; + break; + } + case GRAPH: { + this->draw = Meter_drawGraph; + this->displayBuffer.c = calloc(METER_GRAPHBUFFER_LEN, sizeof(double)); + this->h = 3; + break; + } + default: { + assert(false); + } + } + this->mode = mode; +} + +ListItem* Meter_toListItem(Meter* this) { + char buffer[50]; char* mode = NULL; + switch (this->mode) { + case BAR: mode = "Bar"; break; + case LED: mode = "LED"; break; + case TEXT: mode = "Text"; break; + case GRAPH: mode = "Graph"; break; + default: { + assert(false); + } + } + sprintf(buffer, "%s [%s]", this->name, mode); + return ListItem_new(String_copy(buffer)); +} diff --git a/Meter.h b/Meter.h new file mode 100644 index 0000000..eec820a --- /dev/null +++ b/Meter.h @@ -0,0 +1,94 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Meter +#define HEADER_Meter +/* +htop +(C) 2004 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 "ListItem.h" +#include "String.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + +#define METER_BARBUFFER_LEN 128 +#define METER_GRAPHBUFFER_LEN 128 + + +typedef struct Meter_ Meter; + +typedef void(*Method_Meter_setValues)(Meter*); +typedef void(*Method_Meter_draw)(Meter*, int, int, int); + +typedef enum MeterMode_ { + UNSET, + BAR, + TEXT, + GRAPH, + LED, + LAST_METERMODE +} MeterMode; + +struct Meter_ { + Object super; + + int h; + int w; + Method_Meter_draw draw; + Method_Meter_setValues setValues; + int items; + int* attributes; + double* values; + double total; + char* caption; + char* name; + union { + RichString* rs; + char* c; + double* graph; + } displayBuffer; + MeterMode mode; +}; + +extern char* METER_CLASS; + + + + + +Meter* Meter_new(char* name, char* caption, int items); + +void Meter_init(Meter* this, char* name, char* caption, int items); + +void Meter_delete(Object* cast); + + +void Meter_done(Meter* this); + + + + + +#define DrawDot(a,y,c) do { \ + attrset(a); \ + mvaddstr(y, x+k, c); \ +} while(0) + + +void Meter_setMode(Meter* this, MeterMode mode); + +ListItem* Meter_toListItem(Meter* this); + +#endif diff --git a/MetersListBox.c b/MetersListBox.c new file mode 100644 index 0000000..2eb67aa --- /dev/null +++ b/MetersListBox.c @@ -0,0 +1,103 @@ + +#include "MetersListBox.h" + +#include "ListBox.h" +#include "Settings.h" +#include "ScreenManager.h" + +#include "debug.h" +#include + +/*{ + +typedef struct MetersListBox_ { + ListBox super; + + Settings* settings; + TypedVector* meters; + ScreenManager* scr; +} MetersListBox; + +}*/ + +MetersListBox* MetersListBox_new(Settings* settings, char* header, TypedVector* meters, ScreenManager* scr) { + MetersListBox* this = (MetersListBox*) malloc(sizeof(MetersListBox)); + ListBox* super = (ListBox*) this; + ListBox_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); + ((Object*)this)->delete = MetersListBox_delete; + + this->settings = settings; + this->meters = meters; + this->scr = scr; + super->eventHandler = MetersListBox_eventHandler; + ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], header)); + for (int i = 0; i < TypedVector_size(meters); i++) { + Meter* meter = (Meter*) TypedVector_get(meters, i); + ListBox_add(super, (Object*) Meter_toListItem(meter)); + } + return this; +} + +void MetersListBox_delete(Object* object) { + ListBox* super = (ListBox*) object; + MetersListBox* this = (MetersListBox*) object; + ListBox_done(super); + free(this); +} + +HandlerResult MetersListBox_eventHandler(ListBox* super, int ch) { + MetersListBox* this = (MetersListBox*) super; + + int selected = ListBox_getSelectedIndex(super); + HandlerResult result = IGNORED; + + switch(ch) { + case KEY_F(4): + case 't': + { + Meter* meter = (Meter*) TypedVector_get(this->meters, selected); + MeterMode mode = ++(meter->mode); + if (mode == LAST_METERMODE) + mode = 1; // skip mode 0, "unset" + Meter_setMode(meter, mode); + ListBox_set(super, selected, (Object*) Meter_toListItem(meter)); + result = HANDLED; + break; + } + case KEY_F(7): + case '[': + case '-': + { + TypedVector_moveUp(this->meters, selected); + ListBox_moveSelectedUp(super); + result = HANDLED; + break; + } + case KEY_F(8): + case ']': + case '+': + { + TypedVector_moveDown(this->meters, selected); + ListBox_moveSelectedDown(super); + result = HANDLED; + break; + } + case KEY_F(9): + case KEY_DC: + { + if (selected < TypedVector_size(this->meters)) { + TypedVector_remove(this->meters, selected); + ListBox_remove(super, selected); + } + result = HANDLED; + break; + } + } + if (result == HANDLED) { + Header* header = this->settings->header; + Header_calculateHeight(header); + Header_draw(header); + ScreenManager_resize(this->scr, this->scr->x1, header->height, this->scr->x2, this->scr->y2); + } + return result; +} diff --git a/MetersListBox.h b/MetersListBox.h new file mode 100644 index 0000000..c4653f3 --- /dev/null +++ b/MetersListBox.h @@ -0,0 +1,30 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_MetersListBox +#define HEADER_MetersListBox + + +#include "ListBox.h" +#include "Settings.h" +#include "ScreenManager.h" + +#include "debug.h" +#include + + +typedef struct MetersListBox_ { + ListBox super; + + Settings* settings; + TypedVector* meters; + ScreenManager* scr; +} MetersListBox; + + +MetersListBox* MetersListBox_new(Settings* settings, char* header, TypedVector* meters, ScreenManager* scr); + +void MetersListBox_delete(Object* object); + +HandlerResult MetersListBox_eventHandler(ListBox* super, int ch); + +#endif diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..af87e86 --- /dev/null +++ b/NEWS @@ -0,0 +1,4 @@ + +See the ChangeLog for news of the past. +See the TODO list for news of the future. +Run the program for news of the present. diff --git a/Object.c b/Object.c new file mode 100644 index 0000000..3a8c628 --- /dev/null +++ b/Object.c @@ -0,0 +1,60 @@ +/* +htop +(C) 2004 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" + +/*{ +typedef struct Object_ Object; + +typedef void(*Method_Object_display)(Object*, RichString*); +typedef bool(*Method_Object_equals)(const Object*, const Object*); +typedef void(*Method_Object_delete)(Object*); + +struct Object_ { + char* class; + Method_Object_display display; + Method_Object_equals equals; + Method_Object_delete delete; +}; +}*/ + +/* private property */ +char* OBJECT_CLASS = "Object"; + +void Object_new() { + Object* this; + this = malloc(sizeof(Object)); + this->class = OBJECT_CLASS; + this->display = Object_display; + this->equals = Object_equals; + this->delete = Object_delete; +} + +bool Object_instanceOf(Object* this, char* class) { + return this->class == class; +} + +void Object_delete(Object* this) { + free(this); +} + +void Object_display(Object* this, RichString* out) { + char objAddress[50]; + sprintf(objAddress, "%s @ %p", this->class, (void*) this); + RichString_write(out, CRT_colors[DEFAULT_COLOR], objAddress); +} + +bool Object_equals(const Object* this, const Object* o) { + return (this == o); +} diff --git a/Object.h b/Object.h new file mode 100644 index 0000000..b7497ea --- /dev/null +++ b/Object.h @@ -0,0 +1,44 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Object +#define HEADER_Object +/* +htop +(C) 2004 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" + +typedef struct Object_ Object; + +typedef void(*Method_Object_display)(Object*, RichString*); +typedef bool(*Method_Object_equals)(const Object*, const Object*); +typedef void(*Method_Object_delete)(Object*); + +struct Object_ { + char* class; + Method_Object_display display; + Method_Object_equals equals; + Method_Object_delete delete; +}; + + +void Object_new(); + +bool Object_instanceOf(Object* this, char* class); + +void Object_delete(Object* this); + +void Object_display(Object* this, RichString* out); + +bool Object_equals(const Object* this, const Object* o); + +#endif diff --git a/Process.c b/Process.c new file mode 100644 index 0000000..4483325 --- /dev/null +++ b/Process.c @@ -0,0 +1,425 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ProcessList.h" +#include "Object.h" +#include "CRT.h" +#include "String.h" +#include "Process.h" + +#include "debug.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// TODO: wtf!? +int kill(pid_t pid, int signal); + +// This works only with glibc 2.1+. On earlier versions +// the behavior is similar to have a hardcoded page size. +#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 ) + +#define PROCESS_COMM_LEN 300 +#define PROCESS_USER_LEN 10 + +/*{ + +typedef enum ProcessField_ { + PID, COMM, STATE, PPID, PGRP, SESSION, TTY_NR, TPGID, FLAGS, MINFLT, CMINFLT, MAJFLT, CMAJFLT, UTIME, + STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE, + STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL, + PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM, + USER, TIME, LAST_PROCESSFIELD +} ProcessField; + +struct ProcessList_; + +typedef struct Process_ { + Object super; + + struct ProcessList_ *pl; + bool updated; + + int pid; + char comm[PROCESS_COMM_LEN + 2]; + int indent; + char state; + bool tag; + int ppid; + int pgrp; + int session; + int tty_nr; + int tpgid; + unsigned long int flags; + unsigned long int minflt; + unsigned long int cminflt; + unsigned long int majflt; + unsigned long int cmajflt; + unsigned long int utime; + unsigned long int stime; + long int cutime; + long int cstime; + long int priority; + long int nice; + long int itrealvalue; + unsigned long int starttime; + unsigned long int vsize; + long int rss; + unsigned long int rlim; + unsigned long int startcode; + unsigned long int endcode; + unsigned long int startstack; + unsigned long int kstkesp; + unsigned long int kstkeip; + unsigned long int signal; + unsigned long int blocked; + unsigned long int sigignore; + unsigned long int sigcatch; + unsigned long int wchan; + unsigned long int nswap; + unsigned long int cnswap; + int exit_signal; + int processor; + int m_size; + int m_resident; + int m_share; + int m_trs; + int m_drs; + int m_lrs; + int m_dt; + uid_t st_uid; + float percent_cpu; + float percent_mem; + char user[PROCESS_USER_LEN + 1]; +} Process; + +extern char* PROCESS_CLASS; + +extern char* Process_fieldNames[]; + +}*/ + +/* private property */ +char* PROCESS_CLASS = "Process"; + +/* private property */ +char *Process_fieldNames[] = { "PID", "COMM", "STATE", "PPID", "PGRP", "SESSION", "TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT", "UTIME", "STIME", "CUTIME", "CSTIME", "PRIORITY", "NICE", "ITREALVALUE", "STARTTIME", "VSIZE", "RSS", "RLIM", "STARTCODE", "ENDCODE", "STARTSTACK", "KSTKESP", "KSTKEIP", "SIGNAL", "BLOCKED", "SIGIGNORE", "SIGCATCH", "WCHAN", "NSWAP", "CNSWAP", "EXIT_SIGNAL", "PROCESSOR", "M_SIZE", "M_RESIDENT", "M_SHARE", "M_TRS", "M_DRS", "M_LRS", "M_DT", "ST_UID", "PERCENT_CPU", "PERCENT_MEM", "USER", "TIME", "LAST_PROCESSFIELD"}; + +Process* Process_new(struct ProcessList_ *pl) { + Process* this = malloc(sizeof(Process)); + ((Object*)this)->class = PROCESS_CLASS; + ((Object*)this)->display = Process_display; + ((Object*)this)->equals = Process_equals; + ((Object*)this)->delete = Process_delete; + this->pl = pl; + this->tag = false; + this->updated = false; + this->utime = 0; + this->stime = 0; + return this; +} + +Process* Process_clone(Process* this) { + Process* clone = malloc(sizeof(Process)); + memcpy(clone, this, sizeof(Process)); + return clone; +} + +void Process_delete(Object* cast) { + Process* this = (Process*) cast; + assert (this != NULL); + free(this); +} + +void Process_display(Object* cast, RichString* out) { + Process* this = (Process*) cast; + ProcessField* fields = this->pl->fields; + RichString_prune(out); + for (int i = 0; fields[i] != LAST_PROCESSFIELD; i++) + Process_writeField(this, out, fields[i]); + if (this->pl->shadowOtherUsers && this->st_uid != getuid()) + RichString_setAttr(out, CRT_colors[PROCESS_SHADOW]); + if (this->tag == true) + RichString_setAttr(out, CRT_colors[PROCESS_TAG]); + assert(out->len > 0); +} + +void Process_toggleTag(Process* this) { + this->tag = this->tag == true ? false : true; +} + +bool Process_equals(const Object* o1, const Object* o2) { + Process* p1 = (Process*) o1; + Process* p2 = (Process*) o2; + if (p1 == NULL || p2 == NULL) + return false; + return (p1->pid == p2->pid); +} + +void Process_setPriority(Process* this, int priority) { + int err = setpriority(PRIO_PROCESS, this->pid, priority); + if (err == 0) { + this->nice = priority; + } +} + +void Process_sendSignal(Process* this, int signal) { + kill(this->pid, signal); +} + +#define ONE_K 1024 +#define ONE_M (ONE_K * ONE_K) +#define ONE_G (ONE_M * ONE_K) + +/* private */ +void Process_printLargeNumber(Process* this, RichString *str, unsigned int number) { + char buffer[10]; + if(number >= (1000 * ONE_M)) { + snprintf(buffer, 10, "%4.2fG ", (float)number / ONE_M); + RichString_append(str, CRT_colors[LARGE_NUMBER], buffer); + } else if(number >= (100000)) { + snprintf(buffer, 10, "%4dM ", number / ONE_K); + int attr = this->pl->highlightMegabytes + ? CRT_colors[PROCESS_MEGABYTES] + : CRT_colors[PROCESS]; + RichString_append(str, attr, buffer); + } else if (this->pl->highlightMegabytes && number >= 1000) { + snprintf(buffer, 10, "%2d", number/1000); + RichString_append(str, CRT_colors[PROCESS_MEGABYTES], buffer); + number %= 1000; + snprintf(buffer, 10, "%03d ", number); + RichString_append(str, CRT_colors[PROCESS], buffer); + } else { + snprintf(buffer, 10, "%5d ", number); + RichString_append(str, CRT_colors[PROCESS], buffer); + } +} + +/* private property */ +double jiffy = 0.0; + +/* private */ +void Process_printTime(RichString* str, unsigned long t) { + if(jiffy == 0.0) jiffy = sysconf(_SC_CLK_TCK); + double jiffytime = 1.0 / jiffy; + + double realTime = t * jiffytime; + int iRealTime = (int) realTime; + + int hours = iRealTime / 3600; + int minutes = (iRealTime / 60) % 60; + int seconds = iRealTime % 60; + int hundredths = (realTime - iRealTime) * 100; + char buffer[10]; + if (hours) { + snprintf(buffer, 10, "%2dh", 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); +} + +inline void Process_writeCommand(Process* this, int attr, RichString* str) { + if (this->pl->highlightBaseName) { + char* firstSpace = strchr(this->comm, ' '); + if (firstSpace) { + char* slash = firstSpace; + while (slash > this->comm && *slash != '/') + slash--; + if (slash > this->comm) { + slash++; + RichString_appendn(str, attr, this->comm, slash - this->comm); + } + RichString_appendn(str, CRT_colors[PROCESS_BASENAME], slash, firstSpace - slash); + RichString_append(str, attr, firstSpace); + } else { + RichString_append(str, CRT_colors[PROCESS_BASENAME], this->comm); + } + } else { + RichString_append(str, attr, this->comm); + } +} + +void Process_writeField(Process* this, RichString* str, ProcessField field) { + char buffer[PROCESS_COMM_LEN]; + int attr = CRT_colors[DEFAULT_COLOR]; + int n = PROCESS_COMM_LEN; + + switch (field) { + case PID: snprintf(buffer, n, "%5d ", this->pid); break; + case PPID: snprintf(buffer, n, "%5d ", this->ppid); break; + case PGRP: snprintf(buffer, n, "%5d ", this->pgrp); break; + case SESSION: snprintf(buffer, n, "%5d ", this->session); break; + case TTY_NR: snprintf(buffer, n, "%5d ", this->tty_nr); break; + case TPGID: snprintf(buffer, n, "%5d ", this->tpgid); break; + case COMM: { + if (!this->pl->treeView || this->indent == 0) { + Process_writeCommand(this, attr, str); + return; + } else { + char* buf = buffer; + int maxIndent = 0; + for (int i = 0; i < 32; i++) + if (this->indent & (1 << i)) + maxIndent = i+1; + for (int i = 0; i < maxIndent - 1; i++) { + if (this->indent & (1 << i)) + snprintf(buf, n, " | "); + else + snprintf(buf, n, " "); + buf += 4; + n -= 4; + } + if (this->pl->direction == 1) + snprintf(buf, n, " `- "); + else + snprintf(buf, n, " ,- "); + RichString_append(str, CRT_colors[PROCESS_TREE], buffer); + Process_writeCommand(this, attr, str); + return; + } + } + case STATE: { + snprintf(buffer, n, "%c ", this->state); + attr = this->state == 'R' + ? CRT_colors[PROCESS_R_STATE] + : attr; + break; + } + case PRIORITY: { + if(this->priority == -100) + snprintf(buffer, n, " RT "); + else + snprintf(buffer, n, "%3ld ", this->priority); + break; + } + case NICE: { + snprintf(buffer, n, "%3ld ", this->nice); + attr = this->nice < 0 ? CRT_colors[PROCESS_HIGH_PRIORITY] + : this->nice > 0 ? CRT_colors[PROCESS_LOW_PRIORITY] + : attr; + break; + } + case M_SIZE: Process_printLargeNumber(this, str, this->m_size * PAGE_SIZE); return; + case M_RESIDENT: Process_printLargeNumber(this, str, this->m_resident * PAGE_SIZE); return; + case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE); return; + case ST_UID: snprintf(buffer, n, "%4d ", this->st_uid); break; + case USER: { + if (getuid() != this->st_uid) + attr = CRT_colors[PROCESS_SHADOW]; + snprintf(buffer, n, "%-8s ", this->user); + if (buffer[8] != '\0') { + buffer[8] = ' '; + buffer[9] = '\0'; + } + break; + } + case UTIME: Process_printTime(str, this->utime); return; + case STIME: Process_printTime(str, this->stime); return; + case CUTIME: Process_printTime(str, this->cutime); return; + case CSTIME: Process_printTime(str, this->cstime); return; + case TIME: Process_printTime(str, this->utime + this->stime); return; + case PERCENT_CPU: { + if (this->percent_cpu > 99.9) { + snprintf(buffer, n, "100. "); + } else { + snprintf(buffer, n, "%4.1f ", this->percent_cpu); + } + break; + } + case PERCENT_MEM: { + if (this->percent_mem > 99.9) { + snprintf(buffer, n, "100. "); + } else { + snprintf(buffer, n, "%4.1f ", this->percent_mem); + } + break; + } + default: + snprintf(buffer, n, "- "); + } + RichString_append(str, attr, buffer); + return; +} + +int Process_compare(const Object* v1, const Object* v2) { + Process* p1 = (Process*)v1; + Process* p2 = (Process*)v2; + int direction = p1->pl->direction; + switch (p1->pl->sortKey) { + case PID: + return (p2->pid - p1->pid) * direction; + case PPID: + return (p2->ppid - p1->ppid) * direction; + case USER: + return strcmp(p2->user, p1->user) * direction; + case PRIORITY: + return (p2->priority - p1->priority) * direction; + case STATE: + return (p2->state - p1->state) * direction; + case NICE: + return (p2->nice - p1->nice) * direction; + case M_SIZE: + return (p1->m_size - p2->m_size) * direction; + case M_RESIDENT: + return (p1->m_resident - p2->m_resident) * direction; + case M_SHARE: + return (p1->m_share - p2->m_share) * direction; + case PERCENT_CPU: + return (p1->percent_cpu < p2->percent_cpu ? -1 : 1) * direction; + case PERCENT_MEM: + return (p1->percent_mem < p2->percent_mem ? -1 : 1) * direction; + case UTIME: + return (p1->utime - p2->utime) * direction; + case STIME: + return (p1->stime - p2->stime) * direction; + case TIME: + return ((p1->utime+p1->stime) - (p2->utime+p2->stime)) * direction; + case COMM: + return strcmp(p2->comm, p1->comm) * direction; + default: + return (p2->pid - p1->pid) * direction; + } +} + +char* Process_printField(ProcessField field) { + switch (field) { + case PID: return " PID "; + case PPID: return " PPID "; + case PGRP: return " PGRP "; + case SESSION: return " SESN "; + case TTY_NR: return " TTY "; + case TPGID: return " TGID "; + case COMM: return "Command "; + case STATE: return "S "; + case PRIORITY: return "PRI "; + case NICE: return " NI "; + case M_SIZE: return " VIRT "; + case M_RESIDENT: return " RES "; + case M_SHARE: return " SHR "; + case ST_UID: return " UID "; + case USER: return "USER "; + case UTIME: return " UTIME+ "; + case STIME: return " STIME+ "; + case TIME: return " TIME+ "; + case PERCENT_CPU: return "CPU% "; + case PERCENT_MEM: return "MEM% "; + case PROCESSOR: return "CPU "; + default: return "- "; + } +} diff --git a/Process.h b/Process.h new file mode 100644 index 0000000..556a093 --- /dev/null +++ b/Process.h @@ -0,0 +1,149 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Process +#define HEADER_Process +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ProcessList.h" +#include "Object.h" +#include "CRT.h" +#include "String.h" + +#include "debug.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// TODO: wtf!? +int kill(pid_t pid, int signal); + +// This works only with glibc 2.1+. On earlier versions +// the behavior is similar to have a hardcoded page size. +#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 ) + +#define PROCESS_COMM_LEN 300 +#define PROCESS_USER_LEN 10 + + +typedef enum ProcessField_ { + PID, COMM, STATE, PPID, PGRP, SESSION, TTY_NR, TPGID, FLAGS, MINFLT, CMINFLT, MAJFLT, CMAJFLT, UTIME, + STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE, + STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL, + PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM, + USER, TIME, LAST_PROCESSFIELD +} ProcessField; + +struct ProcessList_; + +typedef struct Process_ { + Object super; + + struct ProcessList_ *pl; + bool updated; + + int pid; + char comm[PROCESS_COMM_LEN + 2]; + int indent; + char state; + bool tag; + int ppid; + int pgrp; + int session; + int tty_nr; + int tpgid; + unsigned long int flags; + unsigned long int minflt; + unsigned long int cminflt; + unsigned long int majflt; + unsigned long int cmajflt; + unsigned long int utime; + unsigned long int stime; + long int cutime; + long int cstime; + long int priority; + long int nice; + long int itrealvalue; + unsigned long int starttime; + unsigned long int vsize; + long int rss; + unsigned long int rlim; + unsigned long int startcode; + unsigned long int endcode; + unsigned long int startstack; + unsigned long int kstkesp; + unsigned long int kstkeip; + unsigned long int signal; + unsigned long int blocked; + unsigned long int sigignore; + unsigned long int sigcatch; + unsigned long int wchan; + unsigned long int nswap; + unsigned long int cnswap; + int exit_signal; + int processor; + int m_size; + int m_resident; + int m_share; + int m_trs; + int m_drs; + int m_lrs; + int m_dt; + uid_t st_uid; + float percent_cpu; + float percent_mem; + char user[PROCESS_USER_LEN + 1]; +} Process; + +extern char* PROCESS_CLASS; + +extern char* Process_fieldNames[]; + + + + +Process* Process_new(struct ProcessList_ *pl); + +Process* Process_clone(Process* this); + +void Process_delete(Object* cast); + +void Process_display(Object* cast, RichString* out); + +void Process_toggleTag(Process* this); + +bool Process_equals(const Object* o1, const Object* o2); + +void Process_setPriority(Process* this, int priority); + +void Process_sendSignal(Process* this, int signal); + +#define ONE_K 1024 +#define ONE_M (ONE_K * ONE_K) +#define ONE_G (ONE_M * ONE_K) + + + + +inline void Process_writeCommand(Process* this, int attr, RichString* str); + +void Process_writeField(Process* this, RichString* str, ProcessField field); + +int Process_compare(const Object* v1, const Object* v2); + +char* Process_printField(ProcessField field); + +#endif diff --git a/ProcessList.c b/ProcessList.c new file mode 100644 index 0000000..9f09f48 --- /dev/null +++ b/ProcessList.c @@ -0,0 +1,567 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ProcessList.h" +#include "Process.h" +#include "TypedVector.h" +#include "UsersTable.h" +#include "Hashtable.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "debug.h" +#include + +/*{ +#ifndef PROCDIR +#define PROCDIR "/proc" +#endif + +#ifndef PROCSTATFILE +#define PROCSTATFILE "/proc/stat" +#endif + +#ifndef PROCMEMINFOFILE +#define PROCMEMINFOFILE "/proc/meminfo" +#endif +}*/ + +/*{ + +typedef struct ProcessList_ { + TypedVector* processes; + TypedVector* processes2; + Hashtable* processTable; + Process* prototype; + UsersTable* usersTable; + + int processorCount; + int totalTasks; + int runningTasks; + + long int* totalTime; + long int* userTime; + long int* systemTime; + long int* idleTime; + long int* niceTime; + long int* totalPeriod; + long int* userPeriod; + long int* systemPeriod; + long int* idlePeriod; + long int* nicePeriod; + + long int totalMem; + long int usedMem; + long int freeMem; + long int sharedMem; + long int buffersMem; + long int cachedMem; + long int totalSwap; + long int usedSwap; + long int freeSwap; + + int kernelMajor; + int kernelMiddle; + int kernelMinor; + int kernelTiny; + + ProcessField* fields; + ProcessField sortKey; + int direction; + bool hideThreads; + bool shadowOtherUsers; + bool hideKernelThreads; + bool treeView; + bool highlightBaseName; + bool highlightMegabytes; + +} ProcessList; +}*/ + +/* private */ +void ProcessList_getKernelVersion(ProcessList* this) { + struct utsname uts; + (void) uname(&uts); + char** items = String_split(uts.release, '.'); + this->kernelMajor = atoi(items[0]); + this->kernelMiddle = atoi(items[1]); + this->kernelMinor = atoi(items[2]); + this->kernelTiny = items[3] ? atoi(items[3]) : 0; + for (int i = 0; items[i] != NULL; i++) free(items[i]); + free(items); +} + +/* private property */ +ProcessField defaultHeaders[LAST_PROCESSFIELD] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, LAST_PROCESSFIELD }; + +ProcessList* ProcessList_new(UsersTable* usersTable) { + ProcessList* this; + this = malloc(sizeof(ProcessList)); + this->processes = TypedVector_new(PROCESS_CLASS, true, DEFAULT_SIZE); + this->processTable = Hashtable_new(20, false); + TypedVector_setCompareFunction(this->processes, Process_compare); + this->prototype = Process_new(this); + this->usersTable = usersTable; + + /* tree-view auxiliary buffers */ + this->processes2 = TypedVector_new(PROCESS_CLASS, true, DEFAULT_SIZE); + TypedVector_setCompareFunction(this->processes2, Process_compare); + + ProcessList_getKernelVersion(this); + + FILE* status = fopen(PROCSTATFILE, "r"); + assert(status != NULL); + char buffer[256]; + int procs = -1; + do { + procs++; + fgets(buffer, 255, status); + } while (String_startsWith(buffer, "cpu")); + fclose(status); + this->processorCount = procs - 1; + this->totalTime = calloc(procs, sizeof(long int)); + this->userTime = calloc(procs, sizeof(long int)); + this->systemTime = calloc(procs, sizeof(long int)); + this->niceTime = calloc(procs, sizeof(long int)); + this->idleTime = calloc(procs, sizeof(long int)); + this->totalPeriod = calloc(procs, sizeof(long int)); + this->userPeriod = calloc(procs, sizeof(long int)); + this->systemPeriod = calloc(procs, sizeof(long int)); + this->nicePeriod = calloc(procs, sizeof(long int)); + this->idlePeriod = calloc(procs, sizeof(long int)); + for (int i = 0; i < procs; i++) { + this->totalTime[i] = 1; + this->totalPeriod[i] = 1; + } + + this->fields = malloc(sizeof(ProcessField) * LAST_PROCESSFIELD); + // TODO: turn 'fields' into a TypedVector, + // (and ProcessFields into proper objects). + for (int i = 0; i < LAST_PROCESSFIELD; i++) { + this->fields[i] = defaultHeaders[i]; + } + this->sortKey = PERCENT_CPU; + this->direction = 1; + this->hideThreads = false; + this->shadowOtherUsers = false; + this->hideKernelThreads = false; + this->treeView = false; + this->highlightBaseName = false; + this->highlightMegabytes = false; + + return this; +} + +void ProcessList_delete(ProcessList* this) { + Hashtable_delete(this->processTable); + TypedVector_delete(this->processes); + TypedVector_delete(this->processes2); + Process_delete((Object*)this->prototype); + + free(this->totalTime); + free(this->userTime); + free(this->systemTime); + free(this->niceTime); + free(this->idleTime); + free(this->totalPeriod); + free(this->userPeriod); + free(this->systemPeriod); + free(this->nicePeriod); + free(this->idlePeriod); + + free(this->fields); + free(this); +} + +void ProcessList_invertSortOrder(ProcessList* this) { + if (this->direction == 1) + this->direction = -1; + else + this->direction = 1; +} + +void ProcessList_sortKey(ProcessList* this, int delta) { + assert(delta == 1 || delta == -1); + int i = 0; + while (this->fields[i] != this->sortKey) + i++; + i += delta; + if (i < 0) { + i = 0; + while (this->fields[i] != LAST_PROCESSFIELD) + i++; + i--; + } else if (this->fields[i] == LAST_PROCESSFIELD) + i = 0; + this->sortKey = this->fields[i]; + this->direction = 1; + // Weird code... +} + +RichString ProcessList_printHeader(ProcessList* this) { + RichString out = RichString_new(); + ProcessField* fields = this->fields; + for (int i = 0; fields[i] != LAST_PROCESSFIELD; i++) { + char* field = Process_printField(fields[i]); + if (this->sortKey == fields[i]) + RichString_append(&out, CRT_colors[PANEL_HIGHLIGHT_FOCUS], field); + else + RichString_append(&out, CRT_colors[PANEL_HEADER_FOCUS], field); + } + return out; +} + + +void ProcessList_prune(ProcessList* this) { + TypedVector_prune(this->processes); +} + +void ProcessList_add(ProcessList* this, Process* p) { + TypedVector_add(this->processes, p); + Hashtable_put(this->processTable, p->pid, p); +} + +void ProcessList_remove(ProcessList* this, Process* p) { + Hashtable_remove(this->processTable, p->pid); + int index = TypedVector_indexOf(this->processes, p); + TypedVector_remove(this->processes, index); +} + +Process* ProcessList_get(ProcessList* this, int index) { + return (Process*) (TypedVector_get(this->processes, index)); +} + +int ProcessList_size(ProcessList* this) { + return (TypedVector_size(this->processes)); +} + +/* private */ +void ProcessList_buildTree(ProcessList* this, int pid, int level, int indent, int direction) { + TypedVector* children = TypedVector_new(PROCESS_CLASS, false, DEFAULT_SIZE); + + for (int i = 0; i < TypedVector_size(this->processes); i++) { + Process* process = (Process*) (TypedVector_get(this->processes, i)); + if (process->ppid == pid) { + Process* process = (Process*) (TypedVector_take(this->processes, i)); + TypedVector_add(children, process); + i--; + } + } + int size = TypedVector_size(children); + for (int i = 0; i < size; i++) { + Process* process = (Process*) (TypedVector_get(children, i)); + if (direction == 1) + TypedVector_add(this->processes2, process); + else + TypedVector_insert(this->processes2, 0, process); + int nextIndent = indent; + if (i < size - 1) + nextIndent = indent | (1 << level); + ProcessList_buildTree(this, process->pid, level+1, nextIndent, direction); + process->indent = indent | (1 << level); + } + TypedVector_delete(children); +} + +void ProcessList_sort(ProcessList* this) { + if (!this->treeView) { + TypedVector_sort(this->processes); + } else { + int direction = this->direction; + int sortKey = this->sortKey; + this->sortKey = PID; + this->direction = 1; + TypedVector_sort(this->processes); + this->sortKey = sortKey; + this->direction = direction; + Process* init = (Process*) (TypedVector_take(this->processes, 0)); + assert(init->pid == 1); + init->indent = 0; + TypedVector_add(this->processes2, init); + ProcessList_buildTree(this, init->pid, 0, 0, direction); + TypedVector* t = this->processes; + this->processes = this->processes2; + this->processes2 = t; + } +} + +/* private */ +int ProcessList_readStatFile(Process *proc, FILE *f, char *command) { + #define MAX_READ 8192 + static char buf[MAX_READ]; + long int zero; + + int size = fread(buf, 1, MAX_READ, f); + if(!size) return 0; + + proc->pid = atoi(buf); + char *location = strchr(buf, ' '); + if(!location) return 0; + + location += 2; + char *end = strrchr(location, ')'); + if(!end) return 0; + + int commsize = end - location; + memcpy(command, location, commsize); + command[commsize] = '\0'; + location = end + 2; + + int num = sscanf(location, + "%c %d %d %d %d %d %lu %lu %lu %lu " + "%lu %lu %lu %ld %ld %ld %ld %ld %ld " + "%lu %lu %ld %lu %lu %lu %lu %lu " + "%lu %lu %lu %lu %lu %lu %lu %lu " + "%d %d", + &proc->state, &proc->ppid, &proc->pgrp, &proc->session, &proc->tty_nr, + &proc->tpgid, &proc->flags, &proc->minflt, &proc->cminflt, &proc->majflt, + &proc->cmajflt, &proc->utime, &proc->stime, &proc->cutime, &proc->cstime, + &proc->priority, &proc->nice, &zero, &proc->itrealvalue, + &proc->starttime, &proc->vsize, &proc->rss, &proc->rlim, + &proc->startcode, &proc->endcode, &proc->startstack, &proc->kstkesp, + &proc->kstkeip, &proc->signal, &proc->blocked, &proc->sigignore, + &proc->sigcatch, &proc->wchan, &proc->nswap, &proc->cnswap, + &proc->exit_signal, &proc->processor); + + // This assert is always valid on 2.4, but reportedly not always valid on 2.6. + // TODO: Check if the semantics of this field has changed. + // assert(zero == 0); + + if(num != 37) return 0; + return 1; +} + +void ProcessList_scan(ProcessList* this) { + DIR* proc; + struct dirent* entry; + Process* prototype = this->prototype; + long int usertime, nicetime, systemtime, idletime, totaltime; + + FILE* status; + char buffer[128]; + status = fopen(PROCMEMINFOFILE, "r"); + assert(status != NULL); + while (!feof(status)) { + fgets(buffer, 128, status); + if (String_startsWith(buffer, "MemTotal:")) { + sscanf(buffer, "MemTotal: %ld kB", &this->totalMem); + } else if (String_startsWith(buffer, "MemFree:")) { + sscanf(buffer, "MemFree: %ld kB", &this->freeMem); + this->usedMem = this->totalMem - this->freeMem; + } else if (String_startsWith(buffer, "MemShared:")) { + sscanf(buffer, "MemShared: %ld kB", &this->sharedMem); + } else if (String_startsWith(buffer, "Buffers:")) { + sscanf(buffer, "Buffers: %ld kB", &this->buffersMem); + } else if (String_startsWith(buffer, "Cached:")) { + sscanf(buffer, "Cached: %ld kB", &this->cachedMem); + } else if (String_startsWith(buffer, "SwapTotal:")) { + sscanf(buffer, "SwapTotal: %ld kB", &this->totalSwap); + } else if (String_startsWith(buffer, "SwapFree:")) { + long int swapFree; + sscanf(buffer, "SwapFree: %ld kB", &swapFree); + this->usedSwap = this->totalSwap - swapFree; + } + } + fclose(status); + + status = fopen(PROCSTATFILE, "r"); + assert(status != NULL); + for (int i = 0; i <= this->processorCount; i++) { + int cpuid; + if (this->kernelMajor == 2 && this->kernelMiddle <= 4) { + if (i == 0) { + fscanf(status, "cpu %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime); + } else { + fscanf(status, "cpu%d %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime); + assert(cpuid == i - 1); + } + totaltime = usertime + nicetime + systemtime + idletime; + } else { + long int ioWait, irq, softIrq; + if (i == 0) + fscanf(status, "cpu %ld %ld %ld %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq); + else { + fscanf(status, "cpu%d %ld %ld %ld %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq); + assert(cpuid == i - 1); + } + systemtime += ioWait + irq + softIrq; + totaltime = usertime + nicetime + systemtime + idletime; + } + assert (usertime >= this->userTime[i]); + assert (nicetime >= this->niceTime[i]); + assert (systemtime >= this->systemTime[i]); + assert (idletime >= this->idleTime[i]); + assert (totaltime >= this->totalTime[i]); + this->userPeriod[i] = usertime - this->userTime[i]; + this->nicePeriod[i] = nicetime - this->niceTime[i]; + this->systemPeriod[i] = systemtime - this->systemTime[i]; + this->idlePeriod[i] = idletime - this->idleTime[i]; + this->totalPeriod[i] = totaltime - this->totalTime[i]; + this->userTime[i] = usertime; + this->niceTime[i] = nicetime; + this->systemTime[i] = systemtime; + this->idleTime[i] = idletime; + this->totalTime[i] = totaltime; + } + float period = (float)this->totalPeriod[0] / this->processorCount; + fclose(status); + + // mark all process as "dirty" + for (int i = 0; i < TypedVector_size(this->processes); i++) { + Process* p = (Process*) TypedVector_get(this->processes, i); + p->updated = false; + } + + this->totalTasks = 0; + this->runningTasks = 0; + + proc = opendir(PROCDIR); + assert(proc != NULL); + signal(11, ProcessList_dontCrash); + while ((entry = readdir(proc)) != NULL) { + char* name = entry->d_name; + int pid; + // filename is a number: process directory + pid = atoi(name); + + // The RedHat kernel hides threads with a dot. + // I believe this is non-standard. + bool isThread = false; + if ((!this->hideThreads) && pid == 0 && name[0] == '.') { + char* tname = name + 1; + pid = atoi(tname); + if (pid > 0) + isThread = true; + } + + if (pid > 0) { + FILE* status; + const int MAX_NAME = 128; + char statusfilename[MAX_NAME+1]; + char command[PROCESS_COMM_LEN + 1]; + + Process* process; + Process* existingProcess = (Process*) Hashtable_get(this->processTable, pid); + if (!existingProcess) { + process = Process_clone(prototype); + process->pid = pid; + ProcessList_add(this, process); + } else { + process = existingProcess; + } + process->updated = true; + + struct stat sstat; + snprintf(statusfilename, MAX_NAME, "%s/%s/stat", PROCDIR, name); + int statok = stat(statusfilename, &sstat); + if (statok == -1) + goto errorReadingProcess; + + char* username = UsersTable_getRef(this->usersTable, sstat.st_uid); + if (username) { + strncpy(process->user, username, PROCESS_USER_LEN); + } else { + snprintf(process->user, PROCESS_USER_LEN, "%d", sstat.st_uid); + } + process->st_uid = sstat.st_uid; + + int lasttimes = (process->utime + process->stime); + + status = fopen(statusfilename, "r"); + if (status == NULL) + goto errorReadingProcess; + + int success = ProcessList_readStatFile(process, status, command); + fclose(status); + if(!success) { + goto errorReadingProcess; + } + + process->percent_cpu = (process->utime + process->stime - lasttimes) / + period * 100.0; + + if(!existingProcess) { + snprintf(statusfilename, MAX_NAME, "%s/%s/cmdline", PROCDIR, name); + status = fopen(statusfilename, "r"); + if (!status) { + goto errorReadingProcess; + } + + char* cmdline = process->comm; + int amtRead = fread(cmdline, 1, PROCESS_COMM_LEN - 1, status); + if (amtRead > 0) { + for (int i = 0; i < amtRead; i++) + if (cmdline[i] == '\0' || cmdline[i] == '\n') + cmdline[i] = ' '; + cmdline[amtRead] = '\0'; + } + else { + strncpy(process->comm, command, PROCESS_COMM_LEN); + cmdline[PROCESS_COMM_LEN] = '\0'; + } + fclose(status); + } + + snprintf(statusfilename, MAX_NAME, "%s/%s/statm", PROCDIR, name); + status = fopen(statusfilename, "r"); + if(!status) { + goto errorReadingProcess; + } + int num = fscanf(status, "%d %d %d %d %d %d %d", + &process->m_size, &process->m_resident, &process->m_share, + &process->m_trs, &process->m_drs, &process->m_lrs, + &process->m_dt); + fclose(status); + if(num != 7) + goto errorReadingProcess; + + process->percent_mem = process->m_resident / + (float)(this->usedMem - this->cachedMem - this->buffersMem) * + 100.0; + + this->totalTasks++; + if (process->state == 'R') { + this->runningTasks++; + } + + if (this->hideKernelThreads && process->m_size == 0) + ProcessList_remove(this, process); + + continue; + + // Exception handler. + errorReadingProcess: { + ProcessList_remove(this, process); + } + } + } + signal(11, SIG_DFL); + closedir(proc); + + for (int i = TypedVector_size(this->processes) - 1; i >= 0; i--) { + Process* p = (Process*) TypedVector_get(this->processes, i); + if (p->updated == false) + ProcessList_remove(this, p); + else + p->updated = false; + } + +} + +void ProcessList_dontCrash(int signal) { + // This ugly hack was added because I suspect some + // crashes were caused by contents of /proc vanishing + // away while we read them. +} diff --git a/ProcessList.h b/ProcessList.h new file mode 100644 index 0000000..45639d3 --- /dev/null +++ b/ProcessList.h @@ -0,0 +1,123 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_ProcessList +#define HEADER_ProcessList +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Process.h" +#include "TypedVector.h" +#include "UsersTable.h" +#include "Hashtable.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "debug.h" +#include + +#ifndef PROCDIR +#define PROCDIR "/proc" +#endif + +#ifndef PROCSTATFILE +#define PROCSTATFILE "/proc/stat" +#endif + +#ifndef PROCMEMINFOFILE +#define PROCMEMINFOFILE "/proc/meminfo" +#endif + + +typedef struct ProcessList_ { + TypedVector* processes; + TypedVector* processes2; + Hashtable* processTable; + Process* prototype; + UsersTable* usersTable; + + int processorCount; + int totalTasks; + int runningTasks; + + long int* totalTime; + long int* userTime; + long int* systemTime; + long int* idleTime; + long int* niceTime; + long int* totalPeriod; + long int* userPeriod; + long int* systemPeriod; + long int* idlePeriod; + long int* nicePeriod; + + long int totalMem; + long int usedMem; + long int freeMem; + long int sharedMem; + long int buffersMem; + long int cachedMem; + long int totalSwap; + long int usedSwap; + long int freeSwap; + + int kernelMajor; + int kernelMiddle; + int kernelMinor; + int kernelTiny; + + ProcessField* fields; + ProcessField sortKey; + int direction; + bool hideThreads; + bool shadowOtherUsers; + bool hideKernelThreads; + bool treeView; + bool highlightBaseName; + bool highlightMegabytes; + +} ProcessList; + + + +ProcessList* ProcessList_new(UsersTable* usersTable); + +void ProcessList_delete(ProcessList* this); + +void ProcessList_invertSortOrder(ProcessList* this); + +void ProcessList_sortKey(ProcessList* this, int delta); + +RichString ProcessList_printHeader(ProcessList* this); + + +void ProcessList_prune(ProcessList* this); + +void ProcessList_add(ProcessList* this, Process* p); + +void ProcessList_remove(ProcessList* this, Process* p); + +Process* ProcessList_get(ProcessList* this, int index); + +int ProcessList_size(ProcessList* this); + + +void ProcessList_sort(ProcessList* this); + + +void ProcessList_scan(ProcessList* this); + +void ProcessList_dontCrash(int signal); + +#endif diff --git a/README b/README new file mode 100644 index 0000000..d0fbe48 --- /dev/null +++ b/README @@ -0,0 +1,64 @@ + +htop +by Hisham Muhammad + +May-Aug, 2004. + +Introduction +~~~~~~~~~~~~ + +This is htop, an interactive process viewer for Linux. +It requires ncurses. Tested with Linux 2.4 and 2.6. + +This software has evolved considerably during the last months, +and is reasonably complete, but there is still room for +improvement. Read the TODO file to see what's known to be missing. + +Comparison between 'htop' and 'top' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + * In 'htop' you can scroll the list vertically and horizontally + to see all processes and full command lines. + * In 'top' you are subject to a delay for each unassigned + key you press (especially annoying when multi-key escape + sequences are triggered by accident). + * 'htop' starts faster ('top' seems to collect data for a while + before displaying anything). + * In 'htop' you don't need to type the process number to + kill a process, in 'top' you do. + * In 'htop' you don't need to type the process number or + the priority value to renice a process, in 'top' you do. + * In 'htop' you can kill multiple processes at once. + * 'top' is older, hence, more tested. + +Compilation instructions +~~~~~~~~~~~~~~~~~~~~~~~~ + +This program is distributed as a standard autotools-based package. +See the INSTALL file for detailed instructions, but you are +probably used to the common "configure/make/make install" routine. + +Keys +~~~~ + +Arrows, +[PgUp], [PgDn], +[Home], [End] - scroll process list +[F1], [h] - help screen +[F2], [S] - setup: configure header meters +[F3], [/] - incremental process search: type process name +[F4], [I] - invert sort order +[F5], [<] - select sorting by previous field +[F6], [>] - select sorting by next field +[F7], []] - increase process priority (superuser only) +[F8], [[] - decrease process priority +[F9], [k] - kill process (all tagged ones, or the current, if none is tagged) +[F10],[q] - quit +[F] - highlight follows process +[M] - sort by memory usage +[P] - sort by processor usage +[C] - select columns +[space] +[Ctrl+L] - refresh screen + +if not all keys work check your curses configuration. diff --git a/RichString.c b/RichString.c new file mode 100644 index 0000000..63db850 --- /dev/null +++ b/RichString.c @@ -0,0 +1,80 @@ + +#include "RichString.h" + +#include +#include +#include +#include + +#include "debug.h" +#include + +#define RICHSTRING_MAXLEN 300 + +/*{ + +typedef struct RichString_ { + int len; + chtype chstr[RICHSTRING_MAXLEN+1]; +} RichString; + +}*/ + +/* private property */ +WINDOW* workArea = NULL; + +RichString RichString_new() { + RichString this; + this.len = 0; + return this; +} + +void RichString_delete(RichString this) { +} + +void RichString_prune(RichString* this) { + this->len = 0; +} + +void RichString_write(RichString* this, int attrs, char* data) { + this->len = 0; + RichString_append(this, attrs, data); +} + +inline void RichString_append(RichString* this, int attrs, char* data) { + RichString_appendn(this, attrs, data, strlen(data)); +} + +inline void RichString_appendn(RichString* this, int attrs, char* data, int len) { + if (!workArea) { + workArea = newpad(1, RICHSTRING_MAXLEN); + } + assert(workArea); + wattrset(workArea, attrs); + int maxToWrite = (RICHSTRING_MAXLEN - 1) - this->len; + int wrote = MIN(maxToWrite, len); + mvwaddnstr(workArea, 0, 0, data, maxToWrite); + int oldstrlen = this->len; + this->len += wrote; + mvwinchnstr(workArea, 0, 0, this->chstr + oldstrlen, wrote); + wattroff(workArea, attrs); +} + +void RichString_setAttr(RichString *this, int attrs) { + for (int i = 0; i < this->len; i++) { + char c = this->chstr[i]; + this->chstr[i] = c | attrs; + } +} + +void RichString_applyAttr(RichString *this, int attrs) { + for (int i = 0; i < this->len - 1; i++) { + this->chstr[i] |= attrs; + } +} + +RichString RichString_quickString(int attrs, char* data) { + RichString str = RichString_new(); + RichString_write(&str, attrs, data); + return str; +} diff --git a/RichString.h b/RichString.h new file mode 100644 index 0000000..f59c576 --- /dev/null +++ b/RichString.h @@ -0,0 +1,43 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_RichString +#define HEADER_RichString + + +#include +#include +#include +#include + +#include "debug.h" +#include + +#define RICHSTRING_MAXLEN 300 + + +typedef struct RichString_ { + int len; + chtype chstr[RICHSTRING_MAXLEN+1]; +} RichString; + + + +RichString RichString_new(); + +void RichString_delete(RichString this); + +void RichString_prune(RichString* this); + +void RichString_write(RichString* this, int attrs, char* data); + +inline void RichString_append(RichString* this, int attrs, char* data); + +inline void RichString_appendn(RichString* this, int attrs, char* data, int len); + +void RichString_setAttr(RichString *this, int attrs); + +void RichString_applyAttr(RichString *this, int attrs); + +RichString RichString_quickString(int attrs, char* data); + +#endif diff --git a/ScreenManager.c b/ScreenManager.c new file mode 100644 index 0000000..72d77db --- /dev/null +++ b/ScreenManager.c @@ -0,0 +1,218 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ScreenManager.h" +#include "ListBox.h" +#include "Object.h" +#include "TypedVector.h" +#include "FunctionBar.h" + +#include "debug.h" +#include + +#include + +/*{ + +typedef enum Orientation_ { + VERTICAL, + HORIZONTAL +} Orientation; + +typedef struct ScreenManager_ { + int x1; + int y1; + int x2; + int y2; + Orientation orientation; + TypedVector* items; + int itemCount; + FunctionBar* fuBar; + bool owner; +} ScreenManager; + +}*/ + +ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, bool owner) { + ScreenManager* this; + this = malloc(sizeof(ScreenManager)); + this->x1 = x1; + this->y1 = y1; + this->x2 = x2; + this->y2 = y2; + this->fuBar = NULL; + this->orientation = orientation; + this->items = TypedVector_new(LISTBOX_CLASS, owner, DEFAULT_SIZE); + this->itemCount = 0; + this->owner = owner; + return this; +} + +void ScreenManager_delete(ScreenManager* this) { + TypedVector_delete(this->items); + if (this->owner) + FunctionBar_delete(this->fuBar); + free(this); +} + +inline int ScreenManager_size(ScreenManager* this) { + return this->itemCount; +} + +void ScreenManager_add(ScreenManager* this, ListBox* item, int size) { + if (this->orientation == HORIZONTAL) { + int lastX = 0; + if (this->itemCount > 0) { + ListBox* last = (ListBox*) TypedVector_get(this->items, this->itemCount - 1); + lastX = last->x + last->w + 1; + } + if (size > 0) { + ListBox_resize(item, size, LINES-this->y1+this->y2); + } else { + ListBox_resize(item, COLS-this->x1+this->x2-lastX, LINES-this->y1+this->y2); + } + ListBox_move(item, lastX, this->y1); + } + // TODO: VERTICAL + TypedVector_add(this->items, item); + item->needsRedraw = true; + this->itemCount++; +} + +ListBox* ScreenManager_remove(ScreenManager* this, int index) { + assert(this->itemCount > index); + ListBox* lb = (ListBox*) TypedVector_remove(this->items, index); + this->itemCount--; + return lb; +} + +void ScreenManager_setFunctionBar(ScreenManager* this, FunctionBar* fuBar) { + if (this->owner && this->fuBar) + FunctionBar_delete(this->fuBar); + this->fuBar = fuBar; +} + +void ScreenManager_resize(ScreenManager* this, int x1, int y1, int x2, int y2) { + this->x1 = x1; + this->y1 = y1; + this->x2 = x2; + this->y2 = y2; + int items = this->itemCount; + int lastX = 0; + for (int i = 0; i < items - 1; i++) { + ListBox* lb = (ListBox*) TypedVector_get(this->items, i); + ListBox_resize(lb, lb->w, LINES-y1+y2); + ListBox_move(lb, lastX, y1); + lastX = lb->x + lb->w + 1; + } + ListBox* lb = (ListBox*) TypedVector_get(this->items, items-1); + ListBox_resize(lb, COLS-x1+x2-lastX, LINES-y1+y2); + ListBox_move(lb, lastX, y1); +} + +void ScreenManager_run(ScreenManager* this, ListBox** lastFocus, int* lastKey) { + bool quit = false; + int focus = 0; + + ListBox* lbFocus = (ListBox*) TypedVector_get(this->items, focus); + if (this->fuBar) + FunctionBar_draw(this->fuBar, NULL); + + int ch; + while (!quit) { + int items = this->itemCount; + for (int i = 0; i < items; i++) { + ListBox* lb = (ListBox*) TypedVector_get(this->items, i); + ListBox_draw(lb, i == focus); + if (i < items) { + if (this->orientation == HORIZONTAL) { + mvvline(lb->y, lb->x+lb->w, ' ', lb->h+1); + } + } + } + if (this->fuBar) + FunctionBar_draw(this->fuBar, NULL); + + ch = getch(); + + bool loop = false; + if (ch == KEY_MOUSE) { + MEVENT mevent; + int ok = getmouse(&mevent); + if (ok == OK) { + if (mevent.y == LINES - 1) { + ch = FunctionBar_synthesizeEvent(this->fuBar, mevent.x); + } else { + for (int i = 0; i < this->itemCount; i++) { + ListBox* lb = (ListBox*) TypedVector_get(this->items, i); + if (mevent.x > lb->x && mevent.x <= lb->x+lb->w && + mevent.y > lb->y && mevent.y <= lb->y+lb->h) { + focus = i; + lbFocus = lb; + ListBox_setSelected(lb, mevent.y - lb->y + lb->scrollV - 1); + loop = true; + break; + } + } + } + } + } + if (loop) continue; + + if (lbFocus->eventHandler) { + HandlerResult result = lbFocus->eventHandler(lbFocus, ch); + if (result == HANDLED) { + continue; + } else if (result == BREAK_LOOP) { + quit = true; + continue; + } + } + + switch (ch) { + case ERR: + continue; + case KEY_RESIZE: + { + ScreenManager_resize(this, this->x1, this->y1, this->x2, this->y2); + continue; + } + case KEY_LEFT: + tryLeft: + focus--; + if (focus == -1) { + focus = this->itemCount - 1; + } + lbFocus = (ListBox*) TypedVector_get(this->items, focus); + if (ListBox_getSize(lbFocus) == 0 && focus > 0) + goto tryLeft; + break; + case KEY_RIGHT: + case 9: + tryRight: + focus++; + if (focus == this->itemCount) { + focus = 0; + } + lbFocus = (ListBox*) TypedVector_get(this->items, focus); + if (ListBox_getSize(lbFocus) == 0 && focus < this->itemCount - 1) + goto tryRight; + break; + case KEY_F(10): + case 'q': + case 27: + quit = true; + continue; + default: + ListBox_onKey(lbFocus, ch); + break; + } + } + + *lastFocus = lbFocus; + *lastKey = ch; +} diff --git a/ScreenManager.h b/ScreenManager.h new file mode 100644 index 0000000..20e8000 --- /dev/null +++ b/ScreenManager.h @@ -0,0 +1,57 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_ScreenManager +#define HEADER_ScreenManager +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ListBox.h" +#include "Object.h" +#include "TypedVector.h" +#include "FunctionBar.h" + +#include "debug.h" +#include + +#include + + +typedef enum Orientation_ { + VERTICAL, + HORIZONTAL +} Orientation; + +typedef struct ScreenManager_ { + int x1; + int y1; + int x2; + int y2; + Orientation orientation; + TypedVector* items; + int itemCount; + FunctionBar* fuBar; + bool owner; +} ScreenManager; + + +ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, bool owner); + +void ScreenManager_delete(ScreenManager* this); + +inline int ScreenManager_size(ScreenManager* this); + +void ScreenManager_add(ScreenManager* this, ListBox* item, int size); + +ListBox* ScreenManager_remove(ScreenManager* this, int index); + +void ScreenManager_setFunctionBar(ScreenManager* this, FunctionBar* fuBar); + +void ScreenManager_resize(ScreenManager* this, int x1, int y1, int x2, int y2); + +void ScreenManager_run(ScreenManager* this, ListBox** lastFocus, int* lastKey); + +#endif diff --git a/Settings.c b/Settings.c new file mode 100644 index 0000000..a32bde2 --- /dev/null +++ b/Settings.c @@ -0,0 +1,193 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Settings.h" +#include "String.h" +#include "ProcessList.h" +#include "Header.h" + +#include "debug.h" + +/*{ + +typedef struct Settings_ { + char* userSettings; + ProcessList* pl; + Header* header; +} Settings; + +}*/ + +Settings* Settings_new(ProcessList* pl, Header* header) { + Settings* this = malloc(sizeof(Settings)); + this->pl = pl; + this->header = header; + // TODO: how to get SYSCONFDIR correctly through Autoconf? + // char* systemSettings = String_cat(SYSCONFDIR, "/htoprc"); + // Settings_read(this, systemSettings); + char* home = getenv("HOME"); + this->userSettings = String_cat(home, "/.htoprc"); + Settings_read(this, this->userSettings); + // free(systemSettings); + return this; +} + +void Settings_delete(Settings* this) { + free(this->userSettings); + free(this); +} + +/* private */ +void Settings_readMeters(Settings* this, char* line, HeaderSide side) { + char* trim = String_trim(line); + char** ids = String_split(trim, ' '); + free(trim); + int i; + for (i = 0; ids[i] != NULL; i++) { + Header_createMeter(this->header, ids[i], side); + } + String_freeArray(ids); +} + +/* private */ +void Settings_readMeterModes(Settings* this, char* line, HeaderSide side) { + char* trim = String_trim(line); + char** ids = String_split(trim, ' '); + free(trim); + int i; + for (i = 0; ids[i] != NULL; i++) { + int mode = atoi(ids[i]); + Header_setMode(this->header, i, mode, side); + } + String_freeArray(ids); +} + +bool Settings_read(Settings* this, char* fileName) { + // TODO: implement File object and make + // file I/O object-oriented. + FILE* fd; + fd = fopen(fileName, "r"); + if (fd == NULL) { + Header_defaultMeters(this->header); + return false; + } + const int maxLine = 512; + char buffer[maxLine]; + bool readMeters = false; + while (!feof(fd)) { + buffer[0] = '\0'; + fgets(buffer, maxLine, fd); + char** option = String_split(buffer, '='); + // fields + if (String_eq(option[0], "fields")) { + char* trim = String_trim(option[1]); + char** ids = String_split(trim, ' '); + free(trim); + int i; + for (i = 0; ids[i] != NULL; i++) { + this->pl->fields[i] = atoi(ids[i]); + } + this->pl->fields[i] = LAST_PROCESSFIELD; + String_freeArray(ids); + // sort_key + } else if (String_eq(option[0], "sort_key")) { + this->pl->sortKey = atoi(option[1]); + // sort_direction + } else if (String_eq(option[0], "sort_direction")) { + this->pl->direction = atoi(option[1]); + // tree_view + } else if (String_eq(option[0], "tree_view")) { + this->pl->treeView = atoi(option[1]); + // hide_threads + } else if (String_eq(option[0], "hide_threads")) { + this->pl->hideThreads = atoi(option[1]); + // hide_kernel_threads + } else if (String_eq(option[0], "hide_kernel_threads")) { + this->pl->hideKernelThreads = atoi(option[1]); + // shadow_other_users + } else if (String_eq(option[0], "shadow_other_users")) { + this->pl->shadowOtherUsers = atoi(option[1]); + // highlight_base_name + } else if (String_eq(option[0], "highlight_base_name")) { + this->pl->highlightBaseName = atoi(option[1]); + // highlight_megabytes + } else if (String_eq(option[0], "highlight_megabytes")) { + this->pl->highlightMegabytes = atoi(option[1]); + // header_margin + } else if (String_eq(option[0], "header_margin")) { + this->header->margin = atoi(option[1]); + // left_meters + } else if (String_eq(option[0], "left_meters")) { + Settings_readMeters(this, option[1], LEFT_HEADER); + readMeters = true; + // right_meters + } else if (String_eq(option[0], "right_meters")) { + Settings_readMeters(this, option[1], RIGHT_HEADER); + readMeters = true; + // left_meter_modes + } else if (String_eq(option[0], "left_meter_modes")) { + Settings_readMeterModes(this, option[1], LEFT_HEADER); + readMeters = true; + // right_meter_modes + } else if (String_eq(option[0], "right_meter_modes")) { + Settings_readMeterModes(this, option[1], RIGHT_HEADER); + readMeters = true; + } + String_freeArray(option); + } + fclose(fd); + if (!readMeters) { + Header_defaultMeters(this->header); + } + return true; +} + +bool Settings_write(Settings* this) { + // TODO: implement File object and make + // file I/O object-oriented. + FILE* fd; + fd = fopen(this->userSettings, "w"); + if (fd == NULL) { + return false; + } + fprintf(fd, "# Beware! This file is rewritten every time htop exits.\n"); + fprintf(fd, "# The parser is also very primitive, and not human-friendly.\n"); + fprintf(fd, "# (I know, it's in the todo list).\n"); + fprintf(fd, "fields="); + for (int i = 0; this->pl->fields[i] != LAST_PROCESSFIELD; i++) { + fprintf(fd, "%d ", (int) this->pl->fields[i]); + } + fprintf(fd, "\n"); + fprintf(fd, "sort_key=%d\n", (int) this->pl->sortKey); + fprintf(fd, "sort_direction=%d\n", (int) this->pl->direction); + fprintf(fd, "hide_threads=%d\n", (int) this->pl->hideThreads); + fprintf(fd, "hide_kernel_threads=%d\n", (int) this->pl->hideKernelThreads); + fprintf(fd, "shadow_other_users=%d\n", (int) this->pl->shadowOtherUsers); + fprintf(fd, "highlight_base_name=%d\n", (int) this->pl->highlightBaseName); + fprintf(fd, "highlight_megabytes=%d\n", (int) this->pl->highlightMegabytes); + fprintf(fd, "tree_view=%d\n", (int) this->pl->treeView); + fprintf(fd, "header_margin=%d\n", (int) this->header->margin); + fprintf(fd, "left_meters="); + for (int i = 0; i < Header_size(this->header, LEFT_HEADER); i++) + fprintf(fd, "%s ", Header_readMeterName(this->header, i, LEFT_HEADER)); + fprintf(fd, "\n"); + fprintf(fd, "left_meter_modes="); + for (int i = 0; i < Header_size(this->header, LEFT_HEADER); i++) + fprintf(fd, "%d ", Header_readMeterMode(this->header, i, LEFT_HEADER)); + fprintf(fd, "\n"); + fprintf(fd, "right_meters="); + for (int i = 0; i < Header_size(this->header, RIGHT_HEADER); i++) + fprintf(fd, "%s ", Header_readMeterName(this->header, i, RIGHT_HEADER)); + fprintf(fd, "\n"); + fprintf(fd, "right_meter_modes="); + for (int i = 0; i < Header_size(this->header, RIGHT_HEADER); i++) + fprintf(fd, "%d ", Header_readMeterMode(this->header, i, RIGHT_HEADER)); + fprintf(fd, "\n"); + + fclose(fd); + return true; +} diff --git a/Settings.h b/Settings.h new file mode 100644 index 0000000..db35b2e --- /dev/null +++ b/Settings.h @@ -0,0 +1,36 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Settings +#define HEADER_Settings +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "String.h" +#include "ProcessList.h" +#include "Header.h" + +#include "debug.h" + + +typedef struct Settings_ { + char* userSettings; + ProcessList* pl; + Header* header; +} Settings; + + +Settings* Settings_new(ProcessList* pl, Header* header); + +void Settings_delete(Settings* this); + + + +bool Settings_read(Settings* this, char* fileName); + +bool Settings_write(Settings* this); + +#endif diff --git a/Signal.c b/Signal.c new file mode 100644 index 0000000..3653a66 --- /dev/null +++ b/Signal.c @@ -0,0 +1,99 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Signal.h" +#include "String.h" +#include "Object.h" +#include "RichString.h" +#include + +#include "debug.h" + +#define SIGNAL_COUNT 34 + +/*{ + +typedef struct Signal_ { + Object super; + char* name; + int number; +} Signal; + +extern char* SIGNAL_CLASS; +}*/ + +/* private property */ +char* SIGNAL_CLASS = "Signal"; + +Signal* Signal_new(char* name, int number) { + Signal* this = malloc(sizeof(Signal)); + ((Object*)this)->class = SIGNAL_CLASS; + ((Object*)this)->display = Signal_display; + ((Object*)this)->delete = Signal_delete; + this->name = name; + this->number = number; + return this; +} + +void Signal_delete(Object* cast) { + Signal* this = (Signal*)cast; + assert (this != NULL); + // names are string constants, so we're not deleting them. + free(this); +} + +void Signal_display(Object* cast, RichString* out) { + Signal* this = (Signal*)cast; + assert (this != NULL); + + char buffer[31]; + snprintf(buffer, 30, "%2d %s", this->number, this->name); + RichString_write(out, CRT_colors[DEFAULT_COLOR], buffer); +} + +int Signal_getSignalCount() { + return SIGNAL_COUNT; +} + +Signal** Signal_getSignalTable() { + Signal** signals = malloc(sizeof(Signal*) * SIGNAL_COUNT); + signals[0] = Signal_new("Cancel", 0); + signals[1] = Signal_new("SIGHUP", 1); + signals[2] = Signal_new("SIGINT", 2); + signals[3] = Signal_new("SIGQUIT", 3); + signals[4] = Signal_new("SIGILL", 4); + signals[5] = Signal_new("SIGTRAP", 5); + signals[6] = Signal_new("SIGABRT", 6); + signals[7] = Signal_new("SIGIOT", 6); + signals[8] = Signal_new("SIGBUS", 7); + signals[9] = Signal_new("SIGFPE", 8); + signals[10] = Signal_new("SIGKILL", 9); + signals[11] = Signal_new("SIGUSR1", 10); + signals[12] = Signal_new("SIGSEGV", 11); + signals[13] = Signal_new("SIGUSR2", 12); + signals[14] = Signal_new("SIGPIPE", 13); + signals[15] = Signal_new("SIGALRM", 14); + signals[16] = Signal_new("SIGTERM", 15); + signals[17] = Signal_new("SIGSTKFLT", 16); + signals[18] = Signal_new("SIGCHLD", 17); + signals[19] = Signal_new("SIGCONT", 18); + signals[20] = Signal_new("SIGSTOP", 19); + signals[21] = Signal_new("SIGTSTP", 20); + signals[22] = Signal_new("SIGTTIN", 21); + signals[23] = Signal_new("SIGTTOU", 22); + signals[24] = Signal_new("SIGURG", 23); + signals[25] = Signal_new("SIGXCPU", 24); + signals[26] = Signal_new("SIGXFSZ", 25); + signals[27] = Signal_new("SIGVTALRM", 26); + signals[28] = Signal_new("SIGPROF", 27); + signals[29] = Signal_new("SIGWINCH", 28); + signals[30] = Signal_new("SIGIO", 29); + signals[31] = Signal_new("SIGPOLL", 29); + signals[32] = Signal_new("SIGPWR", 30); + signals[33] = Signal_new("SIGSYS", 31); + return signals; +} diff --git a/Signal.h b/Signal.h new file mode 100644 index 0000000..7dcfa72 --- /dev/null +++ b/Signal.h @@ -0,0 +1,41 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_Signal +#define HEADER_Signal +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "String.h" +#include "Object.h" +#include "RichString.h" +#include + +#include "debug.h" + +#define SIGNAL_COUNT 34 + + +typedef struct Signal_ { + Object super; + char* name; + int number; +} Signal; + +extern char* SIGNAL_CLASS; + + +Signal* Signal_new(char* name, int number); + +void Signal_delete(Object* cast); + +void Signal_display(Object* cast, RichString* out); + +int Signal_getSignalCount(); + +Signal** Signal_getSignalTable(); + +#endif diff --git a/SignalsListBox.c b/SignalsListBox.c new file mode 100644 index 0000000..591483b --- /dev/null +++ b/SignalsListBox.c @@ -0,0 +1,76 @@ + +#include "SignalsListBox.h" +#include "ListBox.h" +#include "Signal.h" +#include "RichString.h" + +#include "debug.h" +#include + +#include + +/*{ + +typedef struct SignalsListBox_ { + ListBox super; + + int state; + Signal** signals; +} SignalsListBox; + +}*/ + +SignalsListBox* SignalsListBox_new(int x, int y, int w, int h) { + SignalsListBox* this = (SignalsListBox*) malloc(sizeof(SignalsListBox)); + ListBox* super = (ListBox*) this; + ListBox_init(super, x, y, w, h, SIGNAL_CLASS, true); + ((Object*)this)->delete = SignalsListBox_delete; + + this->signals = Signal_getSignalTable(); + super->eventHandler = SignalsListBox_eventHandler; + int sigCount = Signal_getSignalCount(); + for(int i = 0; i < sigCount; i++) + ListBox_set(super, i, (Object*) this->signals[i]); + SignalsListBox_reset(this); + return this; +} + +void SignalsListBox_delete(Object* object) { + ListBox* super = (ListBox*) object; + SignalsListBox* this = (SignalsListBox*) object; + ListBox_done(super); + free(this->signals); + free(this); +} + +void SignalsListBox_reset(SignalsListBox* this) { + ListBox* super = (ListBox*) this; + + ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Send signal:")); + ListBox_setSelected(super, 16); // 16th item is SIGTERM + this->state = 0; +} + +HandlerResult SignalsListBox_eventHandler(ListBox* super, int ch) { + SignalsListBox* this = (SignalsListBox*) super; + + int size = ListBox_getSize(super); + if (isdigit(ch)) { + int signal = ch-48 + this->state; + for (int i = 0; i < size; i++) + if (((Signal*) ListBox_get(super, i))->number == signal) { + ListBox_setSelected(super, i); + break; + } + this->state = signal * 10; + if (this->state > 100) + this->state = 0; + return HANDLED; + } else { + this->state = 0; + } + if (ch == 13) { + return BREAK_LOOP; + } + return IGNORED; +} diff --git a/SignalsListBox.h b/SignalsListBox.h new file mode 100644 index 0000000..6bcb3cd --- /dev/null +++ b/SignalsListBox.h @@ -0,0 +1,32 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_SignalsListBox +#define HEADER_SignalsListBox + +#include "ListBox.h" +#include "Signal.h" +#include "RichString.h" + +#include "debug.h" +#include + +#include + + +typedef struct SignalsListBox_ { + ListBox super; + + int state; + Signal** signals; +} SignalsListBox; + + +SignalsListBox* SignalsListBox_new(int x, int y, int w, int h); + +void SignalsListBox_delete(Object* object); + +void SignalsListBox_reset(SignalsListBox* this); + +HandlerResult SignalsListBox_eventHandler(ListBox* super, int ch); + +#endif diff --git a/String.c b/String.c new file mode 100644 index 0000000..8290351 --- /dev/null +++ b/String.c @@ -0,0 +1,160 @@ +/* +htop +(C) 2004 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 +#include +#include +#include + +#include "debug.h" + +inline void String_delete(char* s) { + free(s); +} + +inline char* String_copy(char* orig) { + return strdup(orig); +} + +char* String_cat(char* s1, char* s2) { + int l1 = strlen(s1); + int l2 = strlen(s2); + char* out = malloc(l1 + l2 + 1); + strncpy(out, s1, l1); + strncpy(out+l1, s2, l2+1); + return out; +} + +char* String_trim(char* in) { + while (in[0] == ' ' || in[0] == '\t' || in[0] == '\n') { + in++; + } + int len = strlen(in); + while (len > 0 && (in[len-1] == ' ' || in[len-1] == '\t' || in[len-1] == '\n')) { + len--; + } + char* out = malloc(len+1); + strncpy(out, in, len); + out[len] = '\0'; + return out; +} + +char* String_copyUpTo(char* orig, char upTo) { + int len; + + int origLen = strlen(orig); + char* at = strchr(orig, upTo); + if (at != NULL) + len = at - orig; + else + len = origLen; + char* copy = (char*) malloc(len+1); + strncpy(copy, orig, len); + copy[len] = '\0'; + return copy; +} + +char* String_sub(char* orig, int from, int to) { + char* copy; + int len; + + len = strlen(orig); + if (to > len) + to = len; + if (from > len) + to = len; + len = to-from+1; + copy = (char*) malloc(len+1); + strncpy(copy, orig+from, len); + copy[len] = '\0'; + return copy; +} + +void String_println(char* s) { + printf("%s\n", s); +} + +void String_print(char* s) { + printf("%s", s); +} + +void String_printInt(int i) { + printf("%i", i); +} + +void String_printPointer(void* p) { + printf("%p", p); +} + +inline int String_eq(char* s1, char* s2) { + if (s1 == NULL || s2 == NULL) { + if (s1 == NULL && s2 == NULL) + return 1; + else + return 0; + } + return (strcmp(s1, s2) == 0); +} + +inline int String_startsWith(char* s, char* match) { + return (strstr(s, match) == s); +} + +char** String_split(char* s, char sep) { + const int rate = 10; + char** out = (char**) malloc(sizeof(char*) * rate); + int ctr = 0; + int blocks = rate; + char* where; + while ((where = strchr(s, sep)) != NULL) { + int size = where - s; + char* token = (char*) malloc(size + 1); + strncpy(token, s, size); + token[size] = '\0'; + out[ctr] = token; + ctr++; + if (ctr == blocks) { + blocks += rate; + out = (char**) realloc(out, sizeof(char*) * blocks); + } + s += size + 1; + } + if (s[0] != '\0') { + int size = strlen(s); + char* token = (char*) malloc(size + 1); + strncpy(token, s, size + 1); + out[ctr] = token; + ctr++; + } + out = realloc(out, sizeof(char*) * ctr + 1); + out[ctr] = NULL; + return out; +} + +void String_freeArray(char** s) { + for (int i = 0; s[i] != NULL; i++) { + free(s[i]); + } + free(s); +} + +int String_startsWith_i(char* s, char* match) { + return (strncasecmp(s, match, strlen(match)) == 0); +} + +int String_contains_i(char* s, char* match) { + int lens = strlen(s); + int lenmatch = strlen(match); + for (int i = 0; i < lens-lenmatch; i++) { + if (strncasecmp(s, match, strlen(match)) == 0) + return 1; + s++; + } + return 0; +} diff --git a/String.h b/String.h new file mode 100644 index 0000000..636c1e1 --- /dev/null +++ b/String.h @@ -0,0 +1,52 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_String +#define HEADER_String +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#define _GNU_SOURCE +#include +#include +#include +#include + +#include "debug.h" + +inline void String_delete(char* s); + +inline char* String_copy(char* orig); + +char* String_cat(char* s1, char* s2); + +char* String_trim(char* in); + +char* String_copyUpTo(char* orig, char upTo); + +char* String_sub(char* orig, int from, int to); + +void String_println(char* s); + +void String_print(char* s); + +void String_printInt(int i); + +void String_printPointer(void* p); + +inline int String_eq(char* s1, char* s2); + +inline int String_startsWith(char* s, char* match); + +char** String_split(char* s, char sep); + +void String_freeArray(char** s); + +int String_startsWith_i(char* s, char* match); + +int String_contains_i(char* s, char* match); + +#endif diff --git a/SwapMeter.c b/SwapMeter.c new file mode 100644 index 0000000..5fa8b31 --- /dev/null +++ b/SwapMeter.c @@ -0,0 +1,65 @@ +/* +htop +(C) 2004 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 "ProcessList.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + +/*{ + +typedef struct SwapMeter_ SwapMeter; + +struct SwapMeter_ { + Meter super; + ProcessList* pl; +}; + +}*/ + +SwapMeter* SwapMeter_new(ProcessList* pl) { + SwapMeter* this = malloc(sizeof(SwapMeter)); + Meter_init((Meter*)this, String_copy("Swap"), String_copy("Swp"), 1); + ((Meter*)this)->attributes[0] = CRT_colors[SWAP]; + ((Meter*)this)->setValues = SwapMeter_setValues; + ((Object*)this)->display = SwapMeter_display; + this->pl = pl; + Meter_setMode((Meter*)this, BAR); + return this; +} + +void SwapMeter_setValues(Meter* cast) { + SwapMeter* this = (SwapMeter*)cast; + + double totalSwap = (double)this->pl->totalSwap; + long int usedSwap = this->pl->usedSwap; + cast->total = totalSwap; + cast->values[0] = usedSwap; + snprintf(cast->displayBuffer.c, 14, "%ld/%ldMB", usedSwap / 1024, this->pl->totalSwap / 1024); +} + +void SwapMeter_display(Object* cast, RichString* out) { + char buffer[50]; + Meter* meter = (Meter*)cast; + long int swap = (long int) meter->values[0]; + RichString_prune(out); + RichString_append(out, CRT_colors[METER_TEXT], ":"); + sprintf(buffer, "%ldM ", (long int) meter->total / 1024); + RichString_append(out, CRT_colors[METER_VALUE], buffer); + sprintf(buffer, "%ldk", swap); + RichString_append(out, CRT_colors[METER_TEXT], "used:"); + RichString_append(out, CRT_colors[METER_VALUE], buffer); +} diff --git a/SwapMeter.h b/SwapMeter.h new file mode 100644 index 0000000..5071ef6 --- /dev/null +++ b/SwapMeter.h @@ -0,0 +1,40 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_SwapMeter +#define HEADER_SwapMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include + + +typedef struct SwapMeter_ SwapMeter; + +struct SwapMeter_ { + Meter super; + ProcessList* pl; +}; + + +SwapMeter* SwapMeter_new(ProcessList* pl); + +void SwapMeter_setValues(Meter* cast); + +void SwapMeter_display(Object* cast, RichString* out); + +#endif diff --git a/TODO b/TODO new file mode 100644 index 0000000..575f648 --- /dev/null +++ b/TODO @@ -0,0 +1,13 @@ + +FEATURES: + + * read SYSCONFDIR/htoprc (help, autoconf gurus!) + * integrate columns configuration in the setup screen + * handle saving of .htoprc more elegantly + * option to display only processes of a single user + * make bars display refresh independent from list refresh + * auto-calibrate delay + * add some more 'top' features + * add command-line parameters + * show 'process view' + * make colors and keybindings configurable, blah blah blah... diff --git a/TasksMeter.c b/TasksMeter.c new file mode 100644 index 0000000..b822172 --- /dev/null +++ b/TasksMeter.c @@ -0,0 +1,56 @@ +/* +htop +(C) 2004 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" + +/*{ + +typedef struct TasksMeter_ TasksMeter; + +struct TasksMeter_ { + Meter super; + ProcessList* pl; +}; + +}*/ + +TasksMeter* TasksMeter_new(ProcessList* pl) { + TasksMeter* this = malloc(sizeof(TasksMeter)); + Meter_init((Meter*)this, String_copy("Tasks"), String_copy("Tasks: "), 1); + ((Meter*)this)->attributes[0] = CRT_colors[TASKS_RUNNING]; + ((Object*)this)->display = TasksMeter_display; + ((Meter*)this)->setValues = TasksMeter_setValues; + this->pl = pl; + Meter_setMode((Meter*)this, TEXT); + return this; +} + +void TasksMeter_setValues(Meter* cast) { + TasksMeter* this = (TasksMeter*)cast; + cast->total = this->pl->totalTasks; + cast->values[0] = this->pl->runningTasks; + snprintf(cast->displayBuffer.c, 20, "%d/%d", (int) cast->values[0], (int) cast->total); +} + +void TasksMeter_display(Object* cast, RichString* out) { + Meter* this = (Meter*)cast; + RichString_prune(out); + char buffer[20]; + sprintf(buffer, "%d", (int)this->total); + RichString_append(out, CRT_colors[METER_VALUE], buffer); + RichString_append(out, CRT_colors[METER_TEXT], " total, "); + sprintf(buffer, "%d", (int)this->values[0]); + RichString_append(out, CRT_colors[TASKS_RUNNING], buffer); + RichString_append(out, CRT_colors[METER_TEXT], " running"); +} diff --git a/TasksMeter.h b/TasksMeter.h new file mode 100644 index 0000000..68fb882 --- /dev/null +++ b/TasksMeter.h @@ -0,0 +1,35 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_TasksMeter +#define HEADER_TasksMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include "CRT.h" + +#include "debug.h" + + +typedef struct TasksMeter_ TasksMeter; + +struct TasksMeter_ { + Meter super; + ProcessList* pl; +}; + + +TasksMeter* TasksMeter_new(ProcessList* pl); + +void TasksMeter_setValues(Meter* cast); + +void TasksMeter_display(Object* cast, RichString* out); + +#endif diff --git a/TypedVector.c b/TypedVector.c new file mode 100644 index 0000000..fe62c86 --- /dev/null +++ b/TypedVector.c @@ -0,0 +1,268 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "TypedVector.h" +#include "Object.h" +#include +#include +#include + +#include "debug.h" +#include + +/*{ + +#ifndef DEFAULT_SIZE +#define DEFAULT_SIZE -1 +#endif + +typedef void(*TypedVector_procedure)(void*); +typedef int(*TypedVector_booleanFunction)(const Object*,const Object*); + +typedef struct TypedVector_ { + Object **array; + int arraySize; + int growthRate; + int items; + TypedVector_booleanFunction compareFunction; + char* vectorType; + bool owner; +} TypedVector; + +}*/ + +TypedVector* TypedVector_new(char* vectorType_, bool owner, int size) { + TypedVector* this; + + if (size == DEFAULT_SIZE) + size = 10; + this = (TypedVector*) malloc(sizeof(TypedVector)); + this->growthRate = size; + this->array = (Object**) calloc(size, sizeof(Object*)); + this->arraySize = size; + this->compareFunction = TypedVector_compareFunction; + this->items = 0; + this->vectorType = vectorType_; + this->owner = owner; + return this; +} + +void TypedVector_delete(TypedVector* this) { + if (this->owner) { + for (int i = 0; i < this->items; i++) + if (this->array[i]) + (this->array[i])->delete(this->array[i]); + } + free(this->array); + free(this); +} + +/* private */ +bool TypedVector_isConsistent(TypedVector* this) { + if (this->owner) { + for (int i = 0; i < this->items; i++) + if (this->array[i]->class != this->vectorType) + return false; + return true; + } else { + return true; + } +} + +void TypedVector_prune(TypedVector* this) { + assert(TypedVector_isConsistent(this)); + int i; + + for (i = 0; i < this->items; i++) + if (this->array[i]) { + if (this->owner) + (this->array[i])->delete(this->array[i]); + this->array[i] = NULL; + } + this->items = 0; +} + +int TypedVector_compareFunction(const Object* v1, const Object* v2) { + return !(v1->equals(v1, v2)); +} + +void TypedVector_setCompareFunction(TypedVector* this, TypedVector_booleanFunction f) { + this->compareFunction = f; +} + +void TypedVector_sort(TypedVector* this) { + assert(TypedVector_isConsistent(this)); + int i, j; + for (i = 1; i < this->items; i++) { + void* t = this->array[i]; + for (j = i-1; j >= 0 && this->compareFunction(this->array[j], t) < 0; j--) + this->array[j+1] = this->array[j]; + this->array[j+1] = t; + } + assert(TypedVector_isConsistent(this)); + + /* + for (int i = 0; i < this->items; i++) { + for (int j = i+1; j < this->items; j++) { + if (this->compareFunction(this->array[i], this->array[j]) < 0) { + void* tmp = this->array[i]; + this->array[i] = this->array[j]; + this->array[j] = tmp; + } + } + } + */ +} + +/* private */ +void TypedVector_checkArraySize(TypedVector* this) { + assert(TypedVector_isConsistent(this)); + if (this->items >= this->arraySize) { + int i; + i = this->arraySize; + this->arraySize = this->items + this->growthRate; + this->array = (Object**) realloc(this->array, sizeof(Object*) * this->arraySize); + for (; i < this->arraySize; i++) + this->array[i] = NULL; + } + assert(TypedVector_isConsistent(this)); +} + +void TypedVector_insert(TypedVector* this, int index, void* data_) { + assert(index >= 0); + assert(((Object*)data_)->class == this->vectorType); + Object* data = data_; + assert(TypedVector_isConsistent(this)); + + TypedVector_checkArraySize(this); + assert(this->array[this->items] == NULL); + for (int i = this->items; i >= index; i--) { + this->array[i+1] = this->array[i]; + } + this->array[index] = data; + this->items++; + assert(TypedVector_isConsistent(this)); +} + +Object* TypedVector_take(TypedVector* this, int index) { + assert(index >= 0 && index < this->items); + assert(TypedVector_isConsistent(this)); + Object* removed = this->array[index]; + assert (removed != NULL); + this->items--; + for (int i = index; i < this->items; i++) + this->array[i] = this->array[i+1]; + this->array[this->items] = NULL; + assert(TypedVector_isConsistent(this)); + return removed; +} + +Object* TypedVector_remove(TypedVector* this, int index) { + Object* removed = TypedVector_take(this, index); + if (this->owner) { + removed->delete(removed); + return NULL; + } else + return removed; +} + +void TypedVector_moveUp(TypedVector* this, int index) { + assert(index >= 0 && index < this->items); + assert(TypedVector_isConsistent(this)); + if (index == 0) + return; + Object* temp = this->array[index]; + this->array[index] = this->array[index - 1]; + this->array[index - 1] = temp; +} + +void TypedVector_moveDown(TypedVector* this, int index) { + assert(index >= 0 && index < this->items); + assert(TypedVector_isConsistent(this)); + if (index == this->items - 1) + return; + Object* temp = this->array[index]; + this->array[index] = this->array[index + 1]; + this->array[index + 1] = temp; +} + +void TypedVector_set(TypedVector* this, int index, void* data_) { + assert(index >= 0); + assert(((Object*)data_)->class == this->vectorType); + Object* data = data_; + assert(TypedVector_isConsistent(this)); + + TypedVector_checkArraySize(this); + if (index >= this->items) { + this->items = index+1; + } else { + if (this->owner) { + Object* removed = this->array[index]; + assert (removed != NULL); + if (this->owner) { + removed->delete(removed); + } + } + } + this->array[index] = data; + assert(TypedVector_isConsistent(this)); +} + +inline Object* TypedVector_get(TypedVector* this, int index) { + assert(index < this->items); + assert(TypedVector_isConsistent(this)); + return this->array[index]; +} + +inline int TypedVector_size(TypedVector* this) { + assert(TypedVector_isConsistent(this)); + return this->items; +} + +void TypedVector_merge(TypedVector* this, TypedVector* v2) { + int i; + assert(TypedVector_isConsistent(this)); + + for (i = 0; i < v2->items; i++) + TypedVector_add(this, v2->array[i]); + v2->items = 0; + TypedVector_delete(v2); + assert(TypedVector_isConsistent(this)); +} + +void TypedVector_add(TypedVector* this, void* data_) { + assert(((Object*)data_)->class == this->vectorType); + Object* data = data_; + assert(TypedVector_isConsistent(this)); + + TypedVector_set(this, this->items, data); + assert(TypedVector_isConsistent(this)); +} + +inline int TypedVector_indexOf(TypedVector* this, void* search_) { + assert(((Object*)search_)->class == this->vectorType); + Object* search = search_; + assert(TypedVector_isConsistent(this)); + + int i; + + for (i = 0; i < this->items; i++) { + Object* o = (Object*)this->array[i]; + if (o->equals(o, search)) + return i; + } + return -1; +} + +void TypedVector_foreach(TypedVector* this, TypedVector_procedure f) { + int i; + assert(TypedVector_isConsistent(this)); + + for (i = 0; i < this->items; i++) + f(this->array[i]); + assert(TypedVector_isConsistent(this)); +} diff --git a/TypedVector.h b/TypedVector.h new file mode 100644 index 0000000..42c16b5 --- /dev/null +++ b/TypedVector.h @@ -0,0 +1,77 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_TypedVector +#define HEADER_TypedVector +/* +htop +(C) 2004 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 + + +#ifndef DEFAULT_SIZE +#define DEFAULT_SIZE -1 +#endif + +typedef void(*TypedVector_procedure)(void*); +typedef int(*TypedVector_booleanFunction)(const Object*,const Object*); + +typedef struct TypedVector_ { + Object **array; + int arraySize; + int growthRate; + int items; + TypedVector_booleanFunction compareFunction; + char* vectorType; + bool owner; +} TypedVector; + + +TypedVector* TypedVector_new(char* vectorType_, bool owner, int size); + +void TypedVector_delete(TypedVector* this); + + +void TypedVector_prune(TypedVector* this); + +int TypedVector_compareFunction(const Object* v1, const Object* v2); + +void TypedVector_setCompareFunction(TypedVector* this, TypedVector_booleanFunction f); + +void TypedVector_sort(TypedVector* this); + + +void TypedVector_insert(TypedVector* this, int index, void* data_); + +Object* TypedVector_take(TypedVector* this, int index); + +Object* TypedVector_remove(TypedVector* this, int index); + +void TypedVector_moveUp(TypedVector* this, int index); + +void TypedVector_moveDown(TypedVector* this, int index); + +void TypedVector_set(TypedVector* this, int index, void* data_); + +inline Object* TypedVector_get(TypedVector* this, int index); + +inline int TypedVector_size(TypedVector* this); + +void TypedVector_merge(TypedVector* this, TypedVector* v2); + +void TypedVector_add(TypedVector* this, void* data_); + +inline int TypedVector_indexOf(TypedVector* this, void* search_); + +void TypedVector_foreach(TypedVector* this, TypedVector_procedure f); + +#endif diff --git a/UptimeMeter.c b/UptimeMeter.c new file mode 100644 index 0000000..66a0d91 --- /dev/null +++ b/UptimeMeter.c @@ -0,0 +1,77 @@ +/* +htop +(C) 2004 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" + +/*{ + +typedef struct UptimeMeter_ UptimeMeter; + +struct UptimeMeter_ { + Meter super; + ProcessList* pl; + int seconds; + int minutes; + int hours; + int days; +}; + +}*/ + +UptimeMeter* UptimeMeter_new() { + UptimeMeter* this = malloc(sizeof(UptimeMeter)); + Meter_init((Meter*)this, String_copy("Uptime"), String_copy("Uptime: "), 1); + ((Meter*)this)->attributes[0] = CRT_colors[UPTIME]; + ((Object*)this)->display = UptimeMeter_display; + ((Meter*)this)->setValues = UptimeMeter_setValues; + Meter_setMode((Meter*)this, TEXT); + ((Meter*)this)->total = 100.0; + return this; +} + +void UptimeMeter_setValues(Meter* cast) { + UptimeMeter* this = (UptimeMeter*)cast; + double uptime; + FILE* fd = fopen(PROCDIR "/uptime", "r"); + fscanf(fd, "%lf", &uptime); + fclose(fd); + int totalseconds = (int) ceil(uptime); + this->seconds = totalseconds % 60; + this->minutes = (totalseconds-this->seconds) % 3600 / 60; + this->hours = (totalseconds-this->seconds-(this->minutes*60)) % 86400 / 3600; + this->days = (totalseconds-this->seconds-(this->minutes*60)-(this->hours*3600)) / 86400; + cast->values[0] = this->days; + if (this->days > cast->total) { + cast->total = this->days; + } + snprintf(cast->displayBuffer.c, 14, "%d", this->days); +} + +void UptimeMeter_display(Object* cast, RichString* out) { + UptimeMeter* this = (UptimeMeter*)cast; + char buffer[20]; + RichString_prune(out); + if (this->days > 100) { + sprintf(buffer, "%d days, ", this->days); + RichString_write(out, CRT_colors[LARGE_NUMBER], buffer); + } else if (this->days > 1) { + sprintf(buffer, "%d days, ", this->days); + RichString_write(out, CRT_colors[UPTIME], buffer); + } else if (this->days == 1) { + sprintf(buffer, "%d day, ", this->days); + RichString_write(out, CRT_colors[UPTIME], buffer); + } + sprintf(buffer, "%02d:%02d:%02d ", this->hours, this->minutes, this->seconds); + RichString_append(out, CRT_colors[UPTIME], buffer); +} diff --git a/UptimeMeter.h b/UptimeMeter.h new file mode 100644 index 0000000..6254f54 --- /dev/null +++ b/UptimeMeter.h @@ -0,0 +1,39 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_UptimeMeter +#define HEADER_UptimeMeter +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +#include "ProcessList.h" + +#include "CRT.h" + +#include "debug.h" + + +typedef struct UptimeMeter_ UptimeMeter; + +struct UptimeMeter_ { + Meter super; + ProcessList* pl; + int seconds; + int minutes; + int hours; + int days; +}; + + +UptimeMeter* UptimeMeter_new(); + +void UptimeMeter_setValues(Meter* cast); + +void UptimeMeter_display(Object* cast, RichString* out); + +#endif diff --git a/UsersTable.c b/UsersTable.c new file mode 100644 index 0000000..381a741 --- /dev/null +++ b/UsersTable.c @@ -0,0 +1,58 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "UsersTable.h" +#include "Hashtable.h" +#include "String.h" + +#include +#include +#include +#include + +#include "debug.h" +#include + +/*{ +#ifndef SYSCONFDIR +#define SYSCONFDIR "/etc" +#endif +}*/ + +/*{ +typedef struct UsersTable_ { + Hashtable* users; +} UsersTable; +}*/ + +UsersTable* UsersTable_new() { + UsersTable* this; + this = malloc(sizeof(UsersTable)); + this->users = Hashtable_new(20, true); + return this; +} + +void UsersTable_delete(UsersTable* this) { + Hashtable_delete(this->users); + free(this); +} + +char* UsersTable_getRef(UsersTable* this, int uid) { + char* name = (char*) (Hashtable_get(this->users, uid)); + if (name == NULL) { + struct passwd* userData = getpwuid(uid); + if (userData != NULL) { + name = String_copy(userData->pw_name); + Hashtable_put(this->users, uid, name); + } + } + return name; +} + +int UsersTable_size(UsersTable* this) { + return (Hashtable_size(this->users)); +} diff --git a/UsersTable.h b/UsersTable.h new file mode 100644 index 0000000..3007ce7 --- /dev/null +++ b/UsersTable.h @@ -0,0 +1,39 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_UsersTable +#define HEADER_UsersTable +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Hashtable.h" +#include "String.h" + +#include +#include +#include +#include + +#include "debug.h" +#include + +#ifndef SYSCONFDIR +#define SYSCONFDIR "/etc" +#endif + +typedef struct UsersTable_ { + Hashtable* users; +} UsersTable; + +UsersTable* UsersTable_new(); + +void UsersTable_delete(UsersTable* this); + +char* UsersTable_getRef(UsersTable* this, int uid); + +int UsersTable_size(UsersTable* this); + +#endif diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..1b5a5f1 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,908 @@ +# generated automatically by aclocal 1.8.4 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.8.4])]) + +# AM_AUX_DIR_EXPAND + +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 6 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# serial 7 -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 11 + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 1 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# -*- Autoconf -*- + + +# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. + +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + diff --git a/config.h b/config.h new file mode 100644 index 0000000..b077bf9 --- /dev/null +++ b/config.h @@ -0,0 +1,141 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +/* #undef CLOSEDIR_VOID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CURSES_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the `ncurses' library (-lncurses). */ +#define HAVE_LIBNCURSES 1 + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 + +/* Name of package */ +#define PACKAGE "htop" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "loderunner@users.sourceforge.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "htop" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "htop 0.5" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "htop" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.5" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.5" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ + +/* Define to rpl_realloc if the replacement function should be used. */ +/* #undef realloc */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..4776bae --- /dev/null +++ b/config.h.in @@ -0,0 +1,140 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +#undef CLOSEDIR_VOID + +/* Define to 1 if you have the header file. */ +#undef HAVE_CURSES_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `ncurses' library (-lncurses). */ +#undef HAVE_LIBNCURSES + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#undef HAVE_REALLOC + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_STAT_EMPTY_STRING_BUG + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to `int' if doesn't define. */ +#undef uid_t diff --git a/configure b/configure new file mode 100755 index 0000000..3c90aeb --- /dev/null +++ b/configure @@ -0,0 +1,6590 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 for htop 0.5. +# +# Report bugs to . +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='htop' +PACKAGE_TARNAME='htop' +PACKAGE_VERSION='0.5' +PACKAGE_STRING='htop 0.5' +PACKAGE_BUGREPORT='loderunner@users.sourceforge.net' + +ac_unique_file="htop.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures htop 0.5 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of htop 0.5:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +htop configure 0.5 +generated by GNU Autoconf 2.59 + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by htop $as_me 0.5, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + +am__api_version="1.8" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='htop' + VERSION='0.5' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + + ac_config_headers="$ac_config_headers config.h" + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +# Checks for libraries. + + +echo "$as_me:$LINENO: checking for refresh in -lncurses" >&5 +echo $ECHO_N "checking for refresh in -lncurses... $ECHO_C" >&6 +if test "${ac_cv_lib_ncurses_refresh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char refresh (); +int +main () +{ +refresh (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ncurses_refresh=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ncurses_refresh=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_refresh" >&5 +echo "${ECHO_T}$ac_cv_lib_ncurses_refresh" >&6 +if test $ac_cv_lib_ncurses_refresh = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBNCURSES 1 +_ACEOF + + LIBS="-lncurses $LIBS" + +fi + + +echo "$as_me:$LINENO: checking for ceil in -lm" >&5 +echo $ECHO_N "checking for ceil in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_ceil+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ceil (); +int +main () +{ +ceil (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_m_ceil=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_m_ceil=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_ceil" >&5 +echo "${ECHO_T}$ac_cv_lib_m_ceil" >&6 +if test $ac_cv_lib_m_ceil = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + + +# Checks for header files. + + + + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_opendir=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_opendir" = no; then + for ac_lib in dir; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" + +fi + +else + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_opendir=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_opendir" = no; then + for ac_lib in x; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" + +fi + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + +for ac_header in stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------------------- ## +## Report this to loderunner@users.sourceforge.net ## +## ----------------------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. +echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 +echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6 +if test "${ac_cv_header_stdbool_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifndef bool +# error bool is not defined +#endif +#ifndef false +# error false is not defined +#endif +#if false +# error false is not 0 +#endif +#ifndef true +# error true is not defined +#endif +#if true != 1 +# error true is not 1 +#endif +#ifndef __bool_true_false_are_defined +# error __bool_true_false_are_defined is not defined +#endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) -0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) -0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + +int +main () +{ + return !a + !b + !c + !d + !e + !f + !g + !h + !i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdbool_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdbool_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 +echo "$as_me:$LINENO: checking for _Bool" >&5 +echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 +if test "${ac_cv_type__Bool+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((_Bool *) 0) + return 0; +if (sizeof (_Bool)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type__Bool=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type__Bool=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 +echo "${ECHO_T}$ac_cv_type__Bool" >&6 +if test $ac_cv_type__Bool = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF + + +fi + +if test $ac_cv_header_stdbool_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STDBOOL_H 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_pid_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 +echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 +if test "${ac_cv_type_uid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1; then + ac_cv_type_uid_t=yes +else + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 +echo "${ECHO_T}$ac_cv_type_uid_t" >&6 +if test $ac_cv_type_uid_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uid_t int +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define gid_t int +_ACEOF + +fi + + +# Checks for library functions. +echo "$as_me:$LINENO: checking whether closedir returns void" >&5 +echo $ECHO_N "checking whether closedir returns void... $ECHO_C" >&6 +if test "${ac_cv_func_closedir_void+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_closedir_void=yes +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header_dirent> +#ifndef __cplusplus +int closedir (); +#endif + +int +main () +{ +exit (closedir (opendir (".")) != 0); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_closedir_void=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_closedir_void=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5 +echo "${ECHO_T}$ac_cv_func_closedir_void" >&6 +if test $ac_cv_func_closedir_void = yes; then + +cat >>confdefs.h <<\_ACEOF +#define CLOSEDIR_VOID 1 +_ACEOF + +fi + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------------------- ## +## Report this to loderunner@users.sourceforge.net ## +## ----------------------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +exit (malloc (0) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_malloc_0_nonnull=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + case $LIBOBJS in + "malloc.$ac_objext" | \ + *" malloc.$ac_objext" | \ + "malloc.$ac_objext "* | \ + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------------------- ## +## Report this to loderunner@users.sourceforge.net ## +## ----------------------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5 +echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6 +if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_realloc_0_nonnull=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *realloc (); +#endif + +int +main () +{ +exit (realloc (0, 0) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_realloc_0_nonnull=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_realloc_0_nonnull=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6 +if test $ac_cv_func_realloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 0 +_ACEOF + + case $LIBOBJS in + "realloc.$ac_objext" | \ + *" realloc.$ac_objext" | \ + "realloc.$ac_objext "* | \ + *" realloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define realloc rpl_realloc +_ACEOF + +fi + + + +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signal=void +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 +echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6 +if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f conftest.sym conftest.file +echo >conftest.file +if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then + if test "$cross_compiling" = yes; then + ac_cv_func_lstat_dereferences_slashed_symlink=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + /* Linux will dereference the symlink and fail. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_lstat_dereferences_slashed_symlink=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f conftest.sym conftest.file + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 +echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6 + +test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && + +cat >>confdefs.h <<_ACEOF +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +_ACEOF + + +if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then + case $LIBOBJS in + "lstat.$ac_objext" | \ + *" lstat.$ac_objext" | \ + "lstat.$ac_objext "* | \ + *" lstat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; +esac + +fi + +echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 +echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6 +if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_stat_empty_string_bug=yes +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + exit (stat ("", &sbuf) ? 1 : 0); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_stat_empty_string_bug=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_stat_empty_string_bug=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 +echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6 +if test $ac_cv_func_stat_empty_string_bug = yes; then + case $LIBOBJS in + "stat.$ac_objext" | \ + *" stat.$ac_objext" | \ + "stat.$ac_objext "* | \ + *" stat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define HAVE_STAT_EMPTY_STRING_BUG 1 +_ACEOF + +fi + + + + + +for ac_func in memmove strncasecmp strstr strdup +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by htop $as_me 0.5, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +htop config.status 0.5 +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..5f33459 --- /dev/null +++ b/configure.ac @@ -0,0 +1,37 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.57) +AC_INIT([htop],[0.5],[loderunner@users.sourceforge.net]) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([htop.c]) +AC_CONFIG_HEADER([config.h]) + +# Checks for programs. +AC_PROG_CC + +# Checks for libraries. +AC_CHECK_LIB([ncurses], [refresh]) +AC_CHECK_LIB([m], [ceil]) + +# Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_UID_T + +# Checks for library functions. +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_TYPE_SIGNAL +AC_FUNC_STAT +AC_CHECK_FUNCS([memmove strncasecmp strstr strdup]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/debug.h b/debug.h new file mode 100644 index 0000000..8ef971d --- /dev/null +++ b/debug.h @@ -0,0 +1,22 @@ + +#ifdef DEBUG + +#include "DebugMemory.h" + +#define calloc(a, b) DebugMemory_calloc(a, b, __FILE__, __LINE__); +#define malloc(x) DebugMemory_malloc(x, __FILE__, __LINE__); +#define realloc(x,s) DebugMemory_realloc(x, s, __FILE__, __LINE__); +#define strdup(x) DebugMemory_strdup(x, __FILE__, __LINE__); +#define free(x) DebugMemory_free(x, __FILE__, __LINE__); + +#define debug_done() DebugMemory_report(); + +#endif + +#ifndef DEBUG + +#define NDEBUG + +#define debug_done() sleep(0) + +#endif diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..edb5d38 --- /dev/null +++ b/depcomp @@ -0,0 +1,479 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000, 2003 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/htop.1 b/htop.1 new file mode 100644 index 0000000..dcb5689 --- /dev/null +++ b/htop.1 @@ -0,0 +1,114 @@ +.TH "htop" "1" "0.5" "Bartosz Fenski " "Utils" +.SH "NAME" +htop \- interactive process viewer +.SH "SYNTAX" +.LP +.B htop +.SH "DESCRIPTION" +.LP +This program is a free (GPL) ncurses-based process viewer. +.LP +It is similar to top, but allows to scroll the list vertically and +horizontally to see all processes and their full command lines. +.LP +Tasks related to processes (killing, renicing) can be done without +entering their PIDs. +.br +.SH "INTERACTIVE COMMANDS" +.LP +The following commands are supported: +.LP +.TP 5 +.B Arrows, PgUP, PgDn, Home, End +Scroll process list. +.TP +.B Space +"Tag": mark a process. Commands that can operate on multiple processes, +like "kill", will then apply over the list of tagged processes, instead +of the currently highlighted one. +.TP +.B F1, h +Help screen +.TP +.B F2, S +Setup screen. There you can configure meters displayed on the top side +of the screen, as well as setting various display options. +.TP +.B F3, / +Incremental process search: type in part of a process command line and +the selection highlight will be moved to it. While in search mode, +pressing this key will cycle through matching occurrences. +.TP +.B F4, I +Invert sort order: if sort order is increasing, switch to decreasing, +and vice-versa. +.TP +.B F5, t +Tree view: organize processes by parenthood, and layout the relations +between them as a tree. Toggling the key will switch between tree and +your previously selected sort view. Selecting a sort view will exit +tree view. +.TP +.B Shift-F6 (F18), < +Select sorting by previous field. The sort field is indicated by a +highlight in the header. +.TP +.B F6, > +Select sorting by next field. The sort field is indicated by a +highlight in the header. +.TP +.B F7, ], - +Increase selected process priority (subtract from 'nice' value). +This can be done by the superuser only. +.TP +.B F8, [, + +Decrease selected process priority (add to 'nice' value) +.TP +.B F9, k +"Kill" process: sends a signal which is selected in a menu, to one or a group +of processes. If processes were tagged, sends the signal to all tagged processes. +If none is tagged, sends to the currently selected process. +.TP +.B F10, q +Quit +.TP +.B M +Sort by memory usage (top compatibility key). +.TP +.B P +Sort by processor usage (top compatibility key). +.TP +.B T +Sort by time (top compatibility key). +.TP +.B C +Select displayed columns. +.TP +.B F +"Follow" process: if the sort order causes the currently selected process +to move in the list, make the selection bar follow it. This is useful for +monitoring a process: this way, you can keep a process always visible on +screen. When a movement key is used, "follow" loses effect. +.TP +.B U +Shadow other users: processes belonging to other users are displayed in +dim color (requires a capable terminal). +.TP +.B K +Hide kernel threads: prevent the threads belonging the kernel to be +displayed in the process list. +.TP +.B Ctrl-L +Refresh: redraw screen and recalculate values. +.TP +.B Numbers +PID search: type in process ID and the selection highlight will be moved to it. +.PD + +.SH "AUTHORS" +.LP +htop is developed by Hisham Muhammad . +.br +This man page was written by Bartosz Fenski for the +Debian GNU/Linux distribution (but it may be used by others), and +updated by Hisham Muhammad. diff --git a/htop.c b/htop.c new file mode 100644 index 0000000..be162f0 --- /dev/null +++ b/htop.c @@ -0,0 +1,763 @@ +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ProcessList.h" +#include "CRT.h" +#include "ListBox.h" +#include "UsersTable.h" +#include "Signal.h" +#include "RichString.h" +#include "Settings.h" +#include "ScreenManager.h" +#include "FunctionBar.h" +#include "ListItem.h" +#include "CategoriesListBox.h" +#include "SignalsListBox.h" + +#include "config.h" +#include "debug.h" + +#include +#include +#include +#include +#include + +int usleep(int usec); + +//#link m + +#define INCSEARCH_MAX 40 + +/* private property */ +char htop_barCharacters[] = "|#*@$%&"; + +void printVersionFlag() { + clear(); + printf("htop " VERSION " - (C) 2004 Hisham Muhammad.\n"); + printf("Released under the GNU GPL.\n\n"); + exit(0); +} + +void printHelpFlag() { + clear(); + printf("htop " VERSION " - (C) 2004 Hisham Muhammad.\n"); + printf("Released under the GNU GPL.\n\n"); + printf("Press F1 inside htop for online help.\n"); + printf("See the man page for full info.\n\n"); + exit(0); +} + +void showHelp() { + clear(); + attrset(CRT_colors[HELP_BOLD]); + mvaddstr(0, 0, "htop " VERSION " - (C) 2004 Hisham Muhammad."); + mvaddstr(1, 0, "Released under the GNU GPL. See man page for more info."); + attrset(CRT_colors[DEFAULT_COLOR]); + mvaddstr(3, 0, "CPU usage bar: "); + #define addattrstr(a,s) attrset(a);addstr(s) + addattrstr(CRT_colors[BAR_BORDER], "["); + addattrstr(CRT_colors[CPU_NICE], "low-priority"); addstr("/"); + addattrstr(CRT_colors[CPU_NORMAL], "normal"); addstr("/"); + addattrstr(CRT_colors[CPU_KERNEL], "kernel"); + addattrstr(CRT_colors[BAR_SHADOW], " used%"); + addattrstr(CRT_colors[BAR_BORDER], "]"); + attrset(CRT_colors[DEFAULT_COLOR]); + mvaddstr(4, 0, "Memory bar: "); + addattrstr(CRT_colors[BAR_BORDER], "["); + addattrstr(CRT_colors[MEMORY_USED], "used"); addstr("/"); + addattrstr(CRT_colors[MEMORY_BUFFERS], "buffers"); addstr("/"); + addattrstr(CRT_colors[MEMORY_CACHE], "cache"); + addattrstr(CRT_colors[BAR_SHADOW], " used/total"); + addattrstr(CRT_colors[BAR_BORDER], "]"); + attrset(CRT_colors[DEFAULT_COLOR]); + mvaddstr(5, 0, "Swap bar: "); + addattrstr(CRT_colors[BAR_BORDER], "["); + addattrstr(CRT_colors[SWAP], "used"); + addattrstr(CRT_colors[BAR_SHADOW], " used/total"); + addattrstr(CRT_colors[BAR_BORDER], "]"); + attrset(CRT_colors[DEFAULT_COLOR]); + + attrset(CRT_colors[HELP_BOLD]); + mvaddstr(7, 0, "Keyboard shortcuts"); + attrset(CRT_colors[DEFAULT_COLOR]); + mvaddstr(8, 0, " Arrows - scroll process list Digits - incremental PID search"); + mvaddstr(9, 0, " Space - tag process / - incremental name search"); + mvaddstr(10, 0, " k - kill process/tagged processes U - shadow other users"); + mvaddstr(11, 0, " I - invert sort order t - tree view"); + mvaddstr(12, 0, " P - sort by CPU% K - hide kernel threads"); + mvaddstr(13, 0, " M - sort by MEM% F - cursor follows process"); + mvaddstr(14, 0, " T - sort by TIME Ctrl-L - refresh"); + mvaddstr(15, 0, " [ - decrease priority ] - increase priority (superuser)"); + mvaddstr(16, 0, " C - configure columns S - setup"); + mvaddstr(17, 0, " h - shows this help screen q - quit"); + attrset(CRT_colors[HELP_BOLD]); + mvaddstr(19,0, "Press any key to return."); + attrset(CRT_colors[DEFAULT_COLOR]); + refresh(); + CRT_readKey(); + clear(); +} + +void showColumnConfig(ProcessList* pl) { + + int i; + int startSelected = 0; + int startAvailable = 0; + int currRow = 0; + int currCol = 0; + bool configure = true; + bool save = false; + + ProcessField avail[LAST_PROCESSFIELD + 1] = { 0 }; + ProcessField select[LAST_PROCESSFIELD + 1] = { 0 }; + ProcessField original[LAST_PROCESSFIELD + 1] = { 0 }; + int countAvail = 0; + int countSelect = 0; + int countOriginal = 0; + + for(i = 0; i < LAST_PROCESSFIELD && pl->fields[i] != LAST_PROCESSFIELD; i++) { + select[i] = pl->fields[i]; + original[i] = pl->fields[i]; + countSelect++; + } + countOriginal = countSelect; + select[countSelect] = LAST_PROCESSFIELD; + original[i] = pl->fields[i]; + for(i = 0; i < LAST_PROCESSFIELD; i++) { + bool found = false; + for(int j = 0; j < LAST_PROCESSFIELD && pl->fields[j] != LAST_PROCESSFIELD; j++) + if(i == pl->fields[j]) found = true; + if(!found) { + avail[countAvail] = i; + countAvail++; + } + } + avail[countAvail] = LAST_PROCESSFIELD; + + clear(); + mvaddstr(0, 0, "Column configuration"); + attron(CRT_colors[HELP_BOLD]); + mvaddstr(4, 1, "Selected Columns"); + attroff(CRT_colors[HELP_BOLD]); + attron(CRT_colors[HELP_BOLD]); + mvaddstr(4, (COLS / 2) + 1, "Available Columns"); + attroff(CRT_colors[HELP_BOLD]); + char* functions[5] = { "Move Up", "Move Down", "Move <->", "Apply ", "Cancel" }; + char* keys[5] = { "- ", "+ ", "Enter", "w ", "Esc" }; + int events[5] = { '-', '+', 13, 'w', 27 }; + FunctionBar* fuBar = FunctionBar_new(5, functions, keys, events); + FunctionBar_draw(fuBar, NULL); + + while(configure) { + + for(i = 0; i < LAST_PROCESSFIELD; i++) + pl->fields[i] = select[i]; + + for(i = 0; i < LAST_PROCESSFIELD; i++) { + int field = select[i + startSelected]; + if(field == LAST_PROCESSFIELD) break; + if(i == (LINES - 8)) break; + mvhline(5 + i, 1, ' ', COLS / 2); + mvaddstr(5 + i, 1, Process_fieldNames[field]); + } + for (; i < LINES - 8; i++) + mvhline(5 + i, 1, ' ', COLS / 2); + + RichString str = ProcessList_printHeader(pl); + if (str.len > 0) { + int attr = CRT_colors[PANEL_HEADER_FOCUS]; + attron(attr); + RichString_applyAttr(&str, attr); + move(2, 0); + hline(' ', 512); + mvaddchstr(2, 0, str.chstr); + attroff(attr); + } + + for(i = 0; i < LAST_PROCESSFIELD; i++) { + int field = avail[i + startAvailable]; + if(field == LAST_PROCESSFIELD) break; + if(i == (LINES - 8)) break; + mvhline(5 + i, (COLS / 2) + 1, ' ', COLS / 2); + mvaddstr(5 + i, (COLS / 2) + 1, Process_fieldNames[field]); + } + for (; i < LINES - 8; i++) + mvhline(5 + i, (COLS / 2) + 1, ' ', COLS / 2); + mvchgat(5 + currRow, (currCol) ? (COLS / 2) + 1 : 1, (COLS / 2) - 2, + A_REVERSE, BLACK_CYAN_PAIR, NULL); + + refresh(); + + int *numEntries = (currCol) ? &countAvail : &countSelect; + int *notEntries = (currCol) ? &countSelect : &countAvail; + int *start = (currCol) ? &startAvailable : &startSelected; + int pos = currRow + *start; + + int c = getch(); + + mvchgat(5 + currRow, (currCol) ? (COLS / 2) + 1 : 1, (COLS / 2) - 2, + A_NORMAL, 0, NULL); + + switch(c) { + case KEY_DOWN: + if(currRow + *start == *numEntries - 1) break; + if(currRow < LINES - 9) currRow++; + else { + if((*numEntries - *start) > (LINES - 8)) + (*start)++; + } + break; + + case KEY_NPAGE: + // TODO: quick and dirty hack. Better improve. + for (int i = 0; i < LINES - 9; i++) { + if(currRow + *start == *numEntries - 1) break; + if(currRow < LINES - 9) currRow++; + else { + if((*numEntries - *start) > (LINES - 8)) + (*start)++; + } + } + break; + + case KEY_PPAGE: + // TODO: quick and dirty hack. Better improve. + for (int i = 0; i < LINES - 9; i++) { + if(currRow > 0) currRow--; + else { + if(*start > 0) + (*start)--; + } + } + break; + + case KEY_UP: + if(currRow > 0) currRow--; + else { + if(*start > 0) + (*start)--; + } + break; + + case KEY_LEFT: + currCol = 0; + if(currRow > *notEntries - 1) currRow = *notEntries - 1; + break; + + case KEY_RIGHT: + if(countAvail == 0) break; + currCol = 1; + if(currRow > *notEntries - 1) currRow = *notEntries - 1; + break; + + case '}': + case ']': + case '+': + case '.': + case '=': { + if(currRow + *start == *numEntries - 1) break; + ProcessField *array = (currCol) ? avail : select; + ProcessField inv = array[pos]; + array[pos] = array[pos + 1]; + array[pos + 1] = inv; + if(currRow < LINES - 9) currRow++; //From Key Down + else { + if((*numEntries - *start) > (LINES - 8)) + (*start)++; + } + break; + } + + case '{': + case '[': + case '_': + case ',': + case '-': { + if(currRow + *start == 0) break; + ProcessField *array = (currCol) ? avail : select; + ProcessField inv = array[pos]; + array[pos] = array[pos - 1]; + array[pos - 1] = inv; + if(currRow > 0) currRow--; //From Key up + else { + if(*start > 0) + (*start)--; + } + break; + } + + case 0x0a: + case 0x0d: + case KEY_ENTER: + if(*numEntries == 0) break; + if(!currCol && *numEntries == 1) break; + ProcessField *array = (currCol) ? avail : select; + ProcessField *notarray = (currCol) ? select : avail; + for(i = *notEntries + 2; i >=1; i--) { + notarray[i] = notarray[i-1]; + } + notarray[0] = array[pos]; + (*notEntries)++; + + for(i = pos; pos < LAST_PROCESSFIELD; i++) { + if(array[i] == LAST_PROCESSFIELD) break; + array[i] = array[i + 1]; + } + (*numEntries)--; + array[*numEntries] = LAST_PROCESSFIELD; + if(*start > 0) (*start)--; + else + if(pos > *numEntries - 1) currRow--; + + currCol = currCol == 0 ? 1 : 0; + currRow = 0; + + if(*numEntries == 0) { + currCol = 0; + currRow = 0; + } + break; + + case 27: + case 'q': + configure = false; + break; + + case 'w': + save = true; + configure = false; + break; + + default: + break; + } + } + + if(save) { + for(i = 0; i < LAST_PROCESSFIELD && select[i] != LAST_PROCESSFIELD; i++) + pl->fields[i] = select[i]; + pl->fields[countSelect] = LAST_PROCESSFIELD; + } + else { + for(i = 0; i < LAST_PROCESSFIELD && original[i] != LAST_PROCESSFIELD; i++) + pl->fields[i] = original[i]; + pl->fields[countOriginal] = LAST_PROCESSFIELD; + } + FunctionBar_delete(fuBar); + + clear(); + +} + +void Setup_run(Settings* settings, int headerHeight) { + ScreenManager* scr = ScreenManager_new(0, headerHeight, 0, -1, HORIZONTAL, true); + CategoriesListBox* lbCategories = CategoriesListBox_new(settings, scr); + ScreenManager_add(scr, (ListBox*) lbCategories, 16); + CategoriesListBox_makeMetersPage(lbCategories); + ListBox* lbFocus; + int ch; + ScreenManager_run(scr, &lbFocus, &ch); + ScreenManager_delete(scr); +} + +int main(int argc, char** argv) { + + if (argc > 0) { + if (String_eq(argv[1], "--help")) { + printHelpFlag(); + } else if (String_eq(argv[1], "--version")) { + printVersionFlag(); + } + } + + ListBox* lb; + int quit = 0; + int refreshTimeout = 0; + int resetRefreshTimeout = 5; + bool doRefresh = true; + Settings* settings; + + ListBox* lbk = NULL; + + char incSearchBuffer[INCSEARCH_MAX]; + int incSearchIndex = 0; + incSearchBuffer[0] = 0; + bool incSearchMode = false; + + ProcessList* pl = NULL; + UsersTable* ut = UsersTable_new(); + + CRT_init(); + pl = ProcessList_new(ut); + ProcessList_scan(pl); + + Header* header = Header_new(pl); + settings = Settings_new(pl, header); + int headerHeight = Header_calculateHeight(header); + + lb = ListBox_new(0, headerHeight, COLS, LINES - headerHeight - 2, PROCESS_CLASS, false); + ListBox_setHeader(lb, ProcessList_printHeader(pl)); + + char* searchFunctions[3] = {"Next ", "Exit ", " Search: "}; + char* searchKeys[3] = {"F3", "Esc", " "}; + int searchEvents[3] = {KEY_F(3), 27, ERR}; + FunctionBar* searchBar = FunctionBar_new(3, searchFunctions, searchKeys, searchEvents); + + char* defaultFunctions[10] = {"Help ", "Setup ", "Search", "Invert", "Tree ", + "SortBy", "Nice -", "Nice +", "Kill ", "Quit "}; + FunctionBar* defaultBar = FunctionBar_new(10, defaultFunctions, NULL, NULL); + + FunctionBar_draw(defaultBar, NULL); + + int acc = 0; + bool follow = false; + while (!quit) { + if (doRefresh) { + incSearchIndex = 0; + incSearchBuffer[0] = 0; + int currPos = ListBox_getSelectedIndex(lb); + int currPid = 0; + int currScrollV = lb->scrollV; + if (follow) + currPid = ProcessList_get(pl, currPos)->pid; + ProcessList_scan(pl); + if (refreshTimeout == 0) { + ProcessList_sort(pl); + refreshTimeout = 1; + } + ListBox_prune(lb); + int size = ProcessList_size(pl); + for (int i = 0; i < size; i++) { + Process* p = ProcessList_get(pl, i); + ListBox_set(lb, i, (Object*)p); + if ((!follow && i == currPos) || (follow && p->pid == currPid)) { + ListBox_setSelected(lb, i); + lb->scrollV = currScrollV; + } + } + } + doRefresh = true; + + Header_draw(header); + + ListBox_draw(lb, true); + int ch = getch(); + if (incSearchMode) { + doRefresh = false; + if (ch == ERR) { + continue; + } else if (ch == KEY_F(3)) { + int here = ListBox_getSelectedIndex(lb); + int size = ProcessList_size(pl); + int i = here+1; + while (i != here) { + if (i == size) + i = 0; + Process* p = ProcessList_get(pl, i); + if (String_contains_i(p->comm, incSearchBuffer)) { + ListBox_setSelected(lb, i); + break; + } + i++; + } + continue; + } else if (isprint((char)ch) && (incSearchIndex < INCSEARCH_MAX)) { + incSearchBuffer[incSearchIndex] = ch; + incSearchIndex++; + incSearchBuffer[incSearchIndex] = 0; + } else if ((ch == KEY_BACKSPACE || ch == 127) && (incSearchIndex > 0)) { + incSearchIndex--; + incSearchBuffer[incSearchIndex] = 0; + } else { + incSearchMode = false; + incSearchIndex = 0; + incSearchBuffer[0] = 0; + FunctionBar_draw(defaultBar, NULL); + continue; + } + + bool found = false; + for (int i = 0; i < ProcessList_size(pl); i++) { + Process* p = ProcessList_get(pl, i); + if (String_contains_i(p->comm, incSearchBuffer)) { + ListBox_setSelected(lb, i); + found = true; + break; + } + } + if (found) + FunctionBar_draw(searchBar, incSearchBuffer); + else + FunctionBar_drawAttr(searchBar, incSearchBuffer, CRT_colors[FAILED_SEARCH]); + + continue; + } + if (isdigit((char)ch)) { + int pid = ch-48 + acc; + for (int i = 0; i < ProcessList_size(pl) && ((Process*) ListBox_getSelected(lb))->pid != pid; i++) + ListBox_setSelected(lb, i); + acc = pid * 10; + if (acc > 100000) + acc = 0; + continue; + } else { + acc = 0; + } + + if (ch == KEY_MOUSE) { + MEVENT mevent; + int ok = getmouse(&mevent); + if (ok == OK) { + if (mevent.y >= lb->y + 1 && mevent.y < LINES - 1) { + ListBox_setSelected(lb, mevent.y - lb->y + lb->scrollV - 1); + doRefresh = false; + refreshTimeout = resetRefreshTimeout; + follow = true; + continue; + } if (mevent.y == LINES - 1) { + FunctionBar* bar; + if (incSearchMode) bar = searchBar; + else bar = defaultBar; + ch = FunctionBar_synthesizeEvent(bar, mevent.x); + } + + } + } + + switch (ch) { + case ERR: + refreshTimeout--; + continue; + case KEY_RESIZE: + ListBox_resize(lb, COLS, LINES-headerHeight-1); + if (incSearchMode) + FunctionBar_draw(searchBar, incSearchBuffer); + else + FunctionBar_draw(defaultBar, NULL); + break; + case 'M': + { + refreshTimeout = 0; + pl->sortKey = PERCENT_MEM; + pl->treeView = false; + ListBox_setHeader(lb, ProcessList_printHeader(pl)); + break; + } + case 'T': + { + refreshTimeout = 0; + pl->sortKey = TIME; + pl->treeView = false; + ListBox_setHeader(lb, ProcessList_printHeader(pl)); + break; + } + case 'P': + { + refreshTimeout = 0; + pl->sortKey = PERCENT_CPU; + pl->treeView = false; + ListBox_setHeader(lb, ProcessList_printHeader(pl)); + break; + } + case KEY_F(1): + case 'h': + { + showHelp(); + FunctionBar_draw(defaultBar, NULL); + refreshTimeout = 0; + break; + } + case '\014': // Ctrl+L + { + clear(); + FunctionBar_draw(defaultBar, NULL); + refreshTimeout = 0; + break; + } + case ' ': + { + Process* p = (Process*) ListBox_getSelected(lb); + Process_toggleTag(p); + ListBox_onKey(lb, KEY_DOWN); + break; + } + case 'S': + case KEY_F(2): + { + Setup_run(settings, headerHeight); + headerHeight = Header_calculateHeight(header); + ListBox_move(lb, 0, headerHeight); + ListBox_resize(lb, COLS, LINES-headerHeight-1); + FunctionBar_draw(defaultBar, NULL); + refreshTimeout = 0; + break; + } + case 'F': + { + follow = true; + continue; + } + case KEY_F(9): + case 'k': + { + const int lbkWidth = 15; + if (!lbk) { + lbk = (ListBox*) SignalsListBox_new(0, headerHeight, lbkWidth-1, LINES - headerHeight - 2); + } + SignalsListBox_reset((SignalsListBox*) lbk); + + char* fuFunctions[2] = {"Send ", "Cancel "}; + char* fuKeys[2] = {"Enter", "Esc"}; + int fuEvents[2] = {13, 27}; + FunctionBar* fuBar = FunctionBar_new(2, fuFunctions, fuKeys, fuEvents); + + ScreenManager* scr = ScreenManager_new(0, headerHeight, 0, -1, HORIZONTAL, false); + ScreenManager_add(scr, lbk, lbkWidth - 1); + ScreenManager_add(scr, lb, -1); + ScreenManager_setFunctionBar(scr, fuBar); + ListBox* lbFocus; + int ch; + ScreenManager_run(scr, &lbFocus, &ch); + + if (lbFocus == lbk && ch == 13) { + Signal* signal = (Signal*) ListBox_getSelected(lbk); + if (signal->number != 0) { + ListBox_setHeader(lbk, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Sending...")); + ListBox_draw(lbk, true); + refresh(); + bool anyTagged = false; + for (int i = 0; i < ListBox_getSize(lb); i++) { + Process* p = (Process*) ListBox_get(lb, i); + if (p->tag) { + Process_sendSignal(p, signal->number); + Process_toggleTag(p); + anyTagged = true; + } + } + if (!anyTagged) { + Process* p = (Process*) ListBox_getSelected(lb); + Process_sendSignal(p, signal->number); + } + napms(500); + } + } + + FunctionBar_delete(fuBar); + ScreenManager_delete(scr); + + ListBox_move(lb, 0, headerHeight); + ListBox_resize(lb, COLS, LINES-headerHeight-1); + FunctionBar_draw(defaultBar, NULL); + + break; + } + case KEY_F(10): + case 'q': + quit = 1; + break; + case '<': + case ',': + case KEY_F(18): + { + refreshTimeout = 0; + pl->treeView = false; + ProcessList_sortKey(pl, -1); + ListBox_setHeader(lb, ProcessList_printHeader(pl)); + break; + } + case '>': + case '.': + case KEY_F(6): + { + refreshTimeout = 0; + pl->treeView = false; + ProcessList_sortKey(pl, 1); + ListBox_setHeader(lb, ProcessList_printHeader(pl)); + break; + } + case 'I': + case KEY_F(4): + { + refreshTimeout = 0; + ProcessList_invertSortOrder(pl); + break; + } + case KEY_F(8): + case '[': + case '=': + case '+': + { + Process* p = (Process*) ListBox_getSelected(lb);; + Process_setPriority(p, p->nice + 1); + doRefresh = false; + break; + } + case KEY_F(7): + case ']': + case '-': + { + Process* p = (Process*) ListBox_getSelected(lb);; + Process_setPriority(p, p->nice - 1); + doRefresh = false; + break; + } + case KEY_F(3): + case '/': + FunctionBar_draw(searchBar, incSearchBuffer); + incSearchMode = true; + break; + case 'C': + showColumnConfig(pl); + FunctionBar_draw(defaultBar, NULL); + ListBox_setHeader(lb, ProcessList_printHeader(pl)); + refreshTimeout = 0; + break; + case 't': + case KEY_F(5): + refreshTimeout = 0; + pl->treeView = !pl->treeView; + break; + case 'H': + refreshTimeout = 0; + pl->hideThreads = !pl->hideThreads; + break; + case 'U': + refreshTimeout = 0; + pl->shadowOtherUsers = !pl->shadowOtherUsers; + break; + case 'K': + refreshTimeout = 0; + pl->hideKernelThreads = !pl->hideKernelThreads; + break; + default: + doRefresh = false; + refreshTimeout = resetRefreshTimeout; + ListBox_onKey(lb, ch); + break; + } + follow = false; + } + attron(CRT_colors[RESET_COLOR]); + mvhline(LINES-1, 0, ' ', COLS); + attroff(CRT_colors[RESET_COLOR]); + refresh(); + + CRT_done(); + Settings_write(settings); + Header_delete(header); + ProcessList_delete(pl); + FunctionBar_delete(searchBar); + FunctionBar_delete(defaultBar); + ((Object*)lb)->delete((Object*)lb); + if (lbk) + ((Object*)lbk)->delete((Object*)lbk); + UsersTable_delete(ut); + Settings_delete(settings); + debug_done(); + return 0; +} diff --git a/htop.h b/htop.h new file mode 100644 index 0000000..cfa2f2d --- /dev/null +++ b/htop.h @@ -0,0 +1,53 @@ +/* Do not edit this file. It was automatically genarated. */ + +#ifndef HEADER_htop +#define HEADER_htop +/* +htop +(C) 2004 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "ProcessList.h" +#include "CRT.h" +#include "ListBox.h" +#include "UsersTable.h" +#include "Signal.h" +#include "RichString.h" +#include "Settings.h" +#include "ScreenManager.h" +#include "FunctionBar.h" +#include "ListItem.h" +#include "CategoriesListBox.h" +#include "SignalsListBox.h" + +#include "config.h" +#include "debug.h" + +#include +#include +#include +#include +#include + +int usleep(int usec); + +//#link m + +#define INCSEARCH_MAX 40 + + +void printVersionFlag(); + +void printHelpFlag(); + +void showHelp(); + +void showColumnConfig(ProcessList* pl); + +void Setup_run(Settings* settings, int headerHeight); + +int main(int argc, char** argv); + +#endif diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..6ce63b9 --- /dev/null +++ b/install-sh @@ -0,0 +1,294 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} diff --git a/missing b/missing new file mode 100755 index 0000000..fc54c64 --- /dev/null +++ b/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..d2d5f21 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,111 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" 1>&2 + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +case $dirmode in + '') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi + ;; + *) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# End: +# mkinstalldirs ends here -- cgit v1.2.3