diff options
97 files changed, 2372 insertions, 4812 deletions
@@ -1,15 +1,97 @@ -Changes from 0.5.3-LEGACYRELEASE to 0.5.4-STABLERELEASE -- Backported reqp::get_url from yChat 0.7.8-CURRENT. -- Tagged 0.5-STABLE +Changes from 0.7.6-RELEASE to 0.7.7-RELEASE +- Major code cleanup +- Bugfix in /col +- Bugfix in gcol #1 (destroy session also if no database is used) +- Bugfix in gcol #2 (now runs each hour not once a day) +- Renew the style.css and stream.html -Changes from 0.5.2-LEGACYRELEASE to 0.5.3-LEGACYRLEASE -- Code cleanup -- Added ./scripts/* -- Added gmake stats option +Changes from 0.7.5-RELEASE to 0.7.6-RELEASE +- Removed the old hash maps and included the SGI C++ STL extenstion + hash_map. -Changes from 0.5.1-RELEASE to 0.5.2-LEGACYRLEASE -- Changed this branch into a LEGACY branch. -- Rewrote the dynamic thread pool (backport from 0.7.8-CURRENT). -- Added scripts/* -- Code now uses ANSI C++ style with 2 space code indenting. +Changes from 0.7.4.1-RELEASE to 0.7.5-RELEASE +- Garbage collector will now run once a hour rather than each ten minutes. +- Dynamic thread pool improvements. +- Removed equiv-http-refresh meta tag from the online list. +- Minor bugfix in the /topic command. +- Implemented "User list" +Changes from 0.7.4-RELEASE to 0.7.4.1-RELEASE: +- Dynamic thread pool bugfix (dead lock) + +Changes from 0.7.3-RELEASE to 0.7.4-RELEASE: +- Code cleanup. +- Made the thread pool increasing dynamic. +- Added some thread pool optimazions. +- Added some more ${MAKE} vars to the Makefiles. +- Added Content-length to the HTTPD header. +- Added the !command to the command line interface. +- Added Content-type text/plain. +- Added scrolling checkbox to input.html +- Removed modl from yhttpd. Dynamic modules are not needed in yhttpd yet. +- Improved session engine. +- Fixed auto logout bug. +- Fixed newline bug (one \n too much for each html template) +- Logging can now be completely disabled. + +Changes from 0.7.2 to 0.7.3-RELEASE: +- Added FreeBSD 5.3-RELEASE support. +- Added chat.enableguest option. +- Added the /all command (Global system message) +- Renamed the /getstatus command into /about. +- Fixed the &-bug (& should be allowed in messages). \AND is now a + synonym for & too. +- Fixed the /msg bug (In /msg the string replacer should be activated). +- Fixed logging bug (do not log any timestamps if there are no messages). + +Changes from 0.7.1 to 0.7.2-RELEASE: +New features: +- /morph +- Added the new standard html template design. +Bugfixes: +- /away prints a . instead of a : if no away reason is given. +- /ko message was wrong. Displayed not room name of the user to be kicked out. +- /invisible command displayed wrong private messages. +- /getstatus had no help text. +- /msg and /s should now print the system time if printalwaystime == true. +- Added a blank to the /uptime message. +- /topic now prints the topic in the user's color. +- Fixed some typos. + +Changes from 0.7.0 to 0.7.1-RELEASE: +- Added ${MAKE} to the config file because some Linux distros dont use + the "gmake" command for GNU make but just "make"! Modified the + configure script to generate a make.version file. +- Removed some typos from the ychat.conf. +- Fixed the auto away message. This one will be posted in the room + as public rather than only private to the auto-away-user. +- Fixed some documentation stuff for yhttpd because yhttpd does not + need MySQL at all. +- Added the chat.maxlength.word option. + +Changes from 0.6 to 0.7.0-RELEASE: +- Better stability +- Better performance (using more hmaps) +- HTML color switcher menu +- New commands: /away /room /j /ren +- Simple garbage collector for old user and room objects +- Use of the database (MySQL) +- Nick registration and password protection +- Status images for Operator, Half-Operator, Voiced user and Guests +- New Makefiles +- Useful Perl scripts for sourcecode stats generation etc. +- Added system_log and room logging to access_log logging +- Added time-offset option +- Added to the admin interface new options +- Added Logout button +- Added string replacer there certain substr. of postings will be replaced by another string (such as smiley images) +- Added Superuser levels and the /ko and /set commands +- Added admin CLI (Command Line Interface) mode +- Added memory rusage history which tracks memory usage for the last 10 days +- Added HTTP POST request parsing +- Made yChat more modular so yhttpd can be extracted from it (scripts/makeyhttpd.pl) +- Added CGI support +- Rewrote big parts of the Makefiles and the configure scripts +- Made it compatible to GNU G++ 3.4, 3.3, 3.2 and 3.1 (3.0 and earlier does not work) +- XML based configuration file (ychat.conf) +- Added default operator option: chat.defaultop diff --git a/CVS/Entries b/CVS/Entries index 5c1d2f7..dc0de3d 100644 --- a/CVS/Entries +++ b/CVS/Entries @@ -1,10 +1,10 @@ -/CHANGES/1.37/Thu Mar 10 22:01:54 2005// +/CHANGES/1.21/Mon Feb 21 02:02:48 2005// /COPYING/1.6/Sun Jun 27 06:32:26 2004// /INSTALL/1.7/Fri Jul 9 22:33:20 2004// -/Makefile/1.36/Sun Mar 6 23:40:15 2005// -/NEWS/1.44/Thu Mar 10 22:01:54 2005// -/README/1.120/Thu Mar 10 22:01:54 2005// -/RELEASES/1.17/Mon Mar 7 22:41:12 2005// -/TODO/1.75/Sat Mar 5 00:15:23 2005// -/configure/1.34/Fri Mar 4 21:00:44 2005// +/Makefile/1.31/Sun Feb 13 07:56:58 2005// +/NEWS/1.35/Mon Feb 21 02:02:48 2005// +/README/1.104/Mon Feb 21 02:02:48 2005// +/RELEASES/1.2/Thu Feb 17 18:09:42 2005// +/TODO/1.69/Fri Feb 18 14:40:56 2005// +/configure/1.31/Wed Feb 9 22:42:58 2005// D @@ -1,23 +1,84 @@ -MAKE=gmake -all: base - @echo "Now edit the ./conf.txt file and run ./ychat!" - @echo WARNING! This software is EXPERIMENTAL! +MAKE=`tail -n 1 make.version` +PREFIX=`grep "define PREFIX" src/glob.h | cut -d'"' -f2` +all: version base modules version + @echo "Now edit the ychat.conf and run ychat!" + @echo "The config file is searched in the following order:" + @echo " ./ychat.conf " + @echo " ~/.ychat/ychat.conf " + @echo " ./etc/ychat.conf " + @echo " /etc/ychat.conf " + @echo " $(PREFIX)/etc/ychat.conf " + @echo If you want to help the yChat project please run gmake mail + @echo so that the developers receive an email about the platform + @echo being used. +mail: + @echo "VERSION:" > mail.tmp + @${MAKE} version >> mail.tmp + @echo >> mail.tmp + @echo "UNAME:" >> mail.tmp + @uname -a >> mail.tmp + @echo >> mail.tmp + @echo "DATE:" >> mail.tmp + @date >> mail.tmp + @echo >> mail.tmp + @echo "COMPILER AND MAKE:" >> mail.tmp + @cat g++.version make.version >> mail.tmp + @cat mail.tmp | mail -s "Successfull build of yChat" successfullbuild@yhttpd.org + @rm -f mail.tmp install: deinstall uninstall: deinstall deinstall: @echo Install/deinstall is not supported! - @echo Start yChat with ./ychat instead! + @echo Start yChat with ./bin/ychat instead! @exit 1 +modules: + @if test -d ./src/mods; then ${MAKE} -C ./src/mods; fi +clean_modules: + @if test -d ./src/mods; then ${MAKE} -C ./src/mods clean; fi base: + @if test -f bin/ychat; then echo "Backing up old binary";if test -f bin/ychat.old; then rm -f bin/ychat.old; fi; mv bin/ychat bin/ychat.old; fi + @perl ./scripts/buildnr.pl + @perl ./scripts/setglobvals.pl @${MAKE} -C ./src clean_base: @${MAKE} -C ./src clean stats: @perl scripts/stats.pl run: - ./ychat + ./bin/ychat +base_start: base + ./bin/ychat +start: base modules + ./bin/ychat gpl: @more COPYING -clean: clean_base +#//<<* +yhttpdbase: + @perl scripts/makeyhttpd.pl || echo "You need to have perl to do this!" + @echo yhttpd code base has been generated in ../yhttpd +#//*>> +clean: clean_base clean_modules +help: + @echo "You may run ${MAKE} with the following parameters:" + @grep "^ ${MAKE} " README + @echo "For more questions read the README file or contact mail@ychat.org!" +setup: + @./configure + @${MAKE} +config: + @sh -c "scripts/config.sh" + @echo If you run ${MAKE} config from the command line then you may need + @echo to rerun ./configure and recompile all now! + +mrproper: clean + @if test -f src/glob.h.org; then mv -f src/glob.h.org src/glob.h;fi + @if test -f g++.version; then rm -f g++.version; fi + @if test -f make.version; then rm -f make.version; fi + @if test -f src/Makefile; then rm -f src/Makefile; fi + @if test -d src/mods; then find src/mods/*/ -name Makefile | xargs rm -f; fi + @find . -name "*.add" | xargs rm -f + @ls | grep core | xargs rm -f +version: + @./scripts/version.sh debug: - @gdb ./ychat ychat.core + @gdb bin/ychat ychat.core @@ -1,10 +1,4 @@ -::(07.04.05)::Released yChat 0.7.9.1. This release only includes some minor bugfixes. The ychat.conf file is now valid XML. Also some typos have been fixed. -::(10.03.05)::Released yChat 0.7.9. The logging capability has been improved. All chat command requests will be logged. The ncurses interface has been improved. Some code has been cleaned up. -::(07.03.05)::Released yChat 0.5.4. This is a STABLERELEASE. The HTTP parsing methods have been backported from yChat 0.7.8. Also some minor bugfixes were made.This is the first STABLERELEASE of yChat ever. -::(05.03.05)::Released yChat 0.7.8. This release includes an IP cache for more speed. An UNIX signal catcher class has been added. SIGUSR1 and SIGUSR2 now clean the template cache or reload all dynamic modules. Added "Allow" to the HTTPD header. Also, lots of Bugfixes and minor improvements were made. Changed the 0.5 branch into STABLE. The 0.5.4-STABLERELEASE will follow next week. The ychat-stable CVS branch has been opened, which now points to ychat-0.5. -::(02.03.05)::Released yChat 0.5.3. This is a LEGACYRELEASE. It includes a stats generation script located in the scripts/ directory which can be called by gmake stats. Also all the sources have been moved to ./src. Some minor bugfixes are included also. -::(27.02.05)::Released yChat 0.5.2. This is a LEGACYRELEASE. That means, that this version is not official supported. The 0.5.2 version might be interesting by developers who want to have a clean base structure of an existing C++ based chat system. The 0.5.2 version does not have any features besides logging in and single room chatting. Multi rooms can be added easily. -::(24.02.05)::Released yChat 0.7.7.1. This release only includes a yChat startup bugfix. +::(21.02.05)::Released yChat 0.7.7. A major code cleanup has been made and the ANSI code formating is now being used. Bugfixes in the timer thread have been made and the standard demo HTML style has been renewed. ::(17.02.05)::Released yChat 0.7.6. This release now uses the hash_map class from the SGI STL extension which is more stable then the old Hash Map used by yChat. ::(14.02.05)::Released yChat 0.7.5. The garbage collector will now run once a hour. The dynamic thread pool has been improved. Removed thre equiv-http-refresh meta tag from the online list. Added a minor bugfix in the /topic command. Implemented an HTML based list of all logged in users and the /users command which does the same. ::(13.02.05)::Released yChat 0.7.4.1 This new version includes a major bugfix made in the new dynamic thread pool which has been introdouced in 0.7.4. The bug resulted in a thread pool dead lock.. Tagged yChat 0.7.5-CURRENT into CVS. @@ -1,7 +1,8 @@ -yChat++; Homepage: www.yChat.org; Version 0.6 +yChat; Homepage: www.yChat.org; Version 0.7.7-RELEASE + Copyright (C) 2003 Paul C. Buetow, Volker Richter +Copyright (C) 2004, 2005 Paul C. Buetow ----------------------------------------------------------------- - 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 @@ -15,94 +16,297 @@ 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. - ----------------------------------------------------------------- -0.0.0 YCHAT++ TABLE OF CONTENTS +YCHAT TABLE OF CONTENTS: + +0.0.0 YCHAT FEATURES //<< 1.0.0 REQUIREMENTS 1.1.0 TESTED PLATFORMS -1.2.0 IMPORTANT NOTES -1.3.0 HOW TO OBTAIN YCHAT++ +1.2.0 IMPORTANT NOTICES +1.3.0 HOW TO OBTAIN YCHAT 1.3.1 INSTALLATION -1.4.0 HOW TO USE SCREEN WITH YCHAT++ +1.3.2 INSTALLATION QUICK-START +1.3.3 MYSQL SETUP //<< +1.4.0 HOW TO USE SCREEN WITH YCHAT 1.5.0 CUSTOMIZATION 1.6.0 FILES +1.7.0 WRITING BUG REPORTS 1.8.0 CONTACT +1.9.0 YHTTPD CODE BASE GENERATION //<< + +//<<* +0.0.0 YCHAT FEATURES + +- Its free & portable - +yChat is developed under the GNU general public license and is based on GNU +tools (gcc, gmake), other open source library stuff (such as libncurses etc.) +and should run on any POSIX capable operating system (such as all Linux based +systems, FreeBSD, NetBSD, OpenBSD and other BSD-Systems and on UNICES like +IRIX, HP-UX, Solaris etc.). + +- There is no need for special chat clients - +yChat is web based, that means clients may only connect to the chat server +with an normal web browser such as Microsoft Internet Explorer or any Gecko- +Engine powerd browsers like Mozilla, Firefox, Camino etc. + +- It has features of a real HTTP webserver - +yChat runs completely stand alone and does not need another webserver to build +on like Apache and does not need to be run via any kind of CGI. yChat creates +its own socket on a customized port (standard port: 2000) and seems to be a full +featured HTTP web server to the clients (web browsers). + +The yChat code base can be converted to an yhttpd code base automaticaly. yhttpd +is the webserver subset of yChat which runs completely stand alone and provides +normal websites to the net. It also supports Common Gateway Interface (CGI) +scripting. + +- Its fast and secure - +yChat is written in C++ which is faster than any Java based Chat-Server or any +server written in a scripting language like PHP, Python or Perl. As the +internal data structures hash maps are used to garuantee searching certain +values in O(1) amount of time. If a hash maps gets full, it will be rehashed. +Currently, yChat has been measured providing over 1000 hits/requests per second +on a FreeBSD based server box while using less than 2% of CPU usage +on a Athlon XP 1900+. Performance seems to be limited by your bandwith only. +Also, each user gets its own session id (random string) with a standard length +of 50 chars to authenticate each logged in user. The length of the session id +can be redefined as well. Also, the session id will get md5-hashed optionally +so thats even harder to reverse engineering the session ids of other users. + +- Its HTML template based and easy to customize via XML based configuration - +All HTML sites are predefined as HTML-Template files and can be easily modified +to use with an customized web design. Also, a lot of yChat preferences can be +set in the main configuration file (ychat.conf). ychat.conf is completely written +in XML 1.0 which makes it easier to use the configuration options in programs of +3rd persons which may want to write some usefull tools for yChat. +yChat caches all HTML and web images to improve overall performance. If needed, the +cache can be cleared to recache new versions of the template files. + +- Its language template based - +The administrator can easily create a new language in which all system messages +appear to the Chat-User. The predefined languages is english but others can be +added easily. The language can be edited in the XML based configuration file. + +- MySQL based database - +Registered users are stored in a MySQL database. C++ Programmers may feel free +to replace the database wrapper class (data.h) with another database routines +to use other databases such as PostgreSQL, SQLite or a text based database etc. +If wished, you can disable database support in the pre-compile options. + +- It has an administration interface - +yChat includes an ncurses based administration interface which tracks some +interesting statistics and system messages and enables you to do certain +administrative tasks. In addition, you can switch to the CLI (command line +interface) mode of the administration interface in order to be provided with +more available functions (like keeping track of the current system usage etc.). +If you dont like ncurses and/or the CLI you can disable both options in the pre- +compile options. + +- It has logging capabilities - +The logging manager keeps track to all yChat system messages (such as users +wich log in and out, modules which are loaded, MySQL queries etc.). Also, an +Apache-Style combined log file format is created by yChat (you can parse this +logfile with any Apache logfile parser like awstats etc.). And last but not +least, all public messages of all available rooms will be logged to disk as +well . To improve performance, you can define the logging puffer (standardly +new logs will be written to disk after each 20 lines). If you want to log +everything immediately, you can reset this option to 1 in ychat.conf. + +- Its modular through own command and dynamic HTML engine - +All chat commands are realized through dynamic loadable module files which can +be recompiled and reloaded without restarting the whole yChat server. Also +HTML-Sites with certain tasks can be compiled as a module like +mods/html/yc_register.so, mods/html/yc_options.so and mods/html/yc_colors.so +etc. so you can also program your dynamic yChat websites in C++. + +- Its multi threaded (POSIX threads) - +There is only one main process which spawns several threads, each for its own +unique task. For example one thread is used to handle the socket manager which +waits for incoming TCP/IP requests, another thread schedules the system timer +which proves if clients are still active or frees not needed memory in certain +time intervals (see also "Garbage collector"). Also, each Chat-User gets it own +thread. There is no need of memory wastage by creating for each task a new +process. All User-Threads are managed by a thread pool to avoid CPU wastage +creating every time a new thread by reusing thread objects which have done its +jobs already and have been readded into the queue of the thread pool. The +standard sizes of the queue and the total pool size can be set in ychat.conf. + +- Its using a smart garbage collection engine - +All users and rooms which dont have to be kept in the main memory (because the +user has logged out or the room has been destroyed because it was empty) will +not be deleted immediately but be placed for about 10 minutes in the yChat +garbage collector. Each time a new room is created the systems checks the +garbage to reuse an inactive room object. If a certain user wants to log in, the +system checks if he is already present in the garbage collector. If yes, he will +be reactivated without wasting expensive database queries to fetch the user's +options. This improves overall performance on heavily loaded yChat servers if a +lot of user and room objects are created and destroyed frequently. +//*>> 1.0.0 REQUIREMENTS: -- gcc 3.2 - The GNU C++ compiler. +- GNU GCC G++ 3.4 or 3.3 or 3.2 or 3.1 + The GNU C++ compiler. G++ version 3.0 or 2.x does NOT work. + +- GNU make 3.80 (gmake) or higher + If you dont have a gmake executable but make is gnu make then you need + to add a symlink or alias from gmake to make. + yChat Makefiles only have been tested with GNU make and may not work with + other make versions. + +- SGI STL extension + Includes ext/hash_map which may be already default on every Linux distro. + On *BSD you have to install it first before compiling. On FreeBSD + /usr/ports/devel/stlport is your friend. -- mysql-client 4.x ( 3.x may do too ) +//<<* +- mysql-client 4.x (3.x may do too but is not supported) Includes libmysqlclient and the mysql.h header files. +//*>> - ncurses 5.x Includes libncurses and the ncurses.h header files. -- screen +- Screen Only needed if yChat should run in background with - ncurses enabled. + ncurses or CLI enabled. + +- Perl 5.x + Is needed for some scripts. Is not needed if you use precompiled binaries. 1.1.0 TESTED PLATFORMS: -The following platforms have been tested with success: +The following platforms have been tested with success. If you find out that +a listed platform did not work at all please contact me: + + Operating system (arch) GNU G++ GNU make +- FreeBSD 5.3-RELEASE (i386) 3.4.2 3.80 +- FreeBSD 5.2.1-RELEASE (i386) 3.3.3 3.80 +- FreeBSD 4.10-RELEASE (i386) 3.4.1 3.80 +- FreeBSD 4.9-RELEASE (i386) 3.3.4 3.80 +- Gentoo Linux 2004 (i386) 3.3.2 3.80 +- OpenBSD 3.6 SMP (i386) 3.3.2 3.80 +- Red Hat Linux 8.0 SMP (i386) 3.2-7 3.79 +- Slackware Linux 10.0 (i386) 3.4.0 3.80 +- SUSE Linux 9.0 (i386) 3.3.1 3.80 +- SUSE Linux 8.1 (i386) 3.2 3.79.1 -- Linux with GCC 3.2.0, GNU make 3.79.1 -- FreeBSD 5.1-RELEASE-p2, GCC 3.2.2, GNU make 3.80 ( standard make does not seem work on FreeBSD ). +Other platforms like Linux based systems, other BSD-Systems or UNICES +are very likely to work too. -1.2.0 IMPORTANT NOTES: +1.2.0 IMPORTANT NOTICES: Before you compile the source you have to be sure to use at least GCC -version 3.x with pthreads enabled. ( Type gcc -v to check it ). -GCC 2.95 did not work while testing on linux and WON'T BE SUPPORTED! -If you like to support yChat++, please write us an email and tell what -you can/like/would help ;-]. Please also take a look at the yChat++ +version 3.1 with pthreads enabled. ( Type gcc -v to check it ). +GCC 2.95 and 3.0 did not work while testing and WON'T BE SUPPORTED! +If you like to support yChat, please write us an email and tell what +you can/like/would help ;-]. Please also take a look at the yChat homepage which is located at http://www.yChat.org. -1.3.0 HOW TO OBTAIN YCHAT++: +1.3.0 HOW TO OBTAIN YCHAT: yChat can be downloaded as a source package or through CVS. The packages are located at http://www.yChat.org -> Sourcecode -> -Packages or go to http://programming.buetow.org/CPP-yChat . +Packages or go to http://pub.buetow.org/yChat/CPP-yChat . For CVS download type: -cvs -d:pserver:anonymous@cvs.ychat.berlios.de:/cvsroot/ychat login +cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot login ( You will be asked for a password. Use "just enter" ). -cvs -z3 -d:pserver:anonymous@cvs.ychat.berlios.de:/cvsroot/ychat co \ - ychat -( The sources will be copied into your local folder. However, if you - want to obtain the yChat++ Basic sources then replace "ychat" - "ychat-basic" ). +vs -z3 -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot co ychat +( The sources will be copied into your local folder ) -cvs -d:pserver:anonymous@cvs.ychat.berlios.de:/cvsroot/ychat logout +cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot logout ( Logs your CVS session out ). Now you may continue with the installation. 1.3.1 INSTALLATION: -If you dont want to use yChat's ncurses based administration interface -you may remove the #define NCURSES line in the glob.h and enable -#define SERVMSG and #define VERBOSE instead. +Invoke "./configure". Afterwards you will get prompted with the before-compile +options of yChat. After choosing those options you are ready to type "gmake" +afterwards. See below what gmake is doing. + +//<<* +If you have choosen MySQL database support, then take a look at section 1.3.2 +how to setup a valid database table. Be also sure to enter the valid MySQL +accessing data in the yChat configuration file which is normally located in +the etc/ychat.conf file if not changed by you with the yChat configurator. +//*>> + +You may also invoke gmake with the following options (the PREFIX can be set +in the yChat configurator which will be launched by the top configure script +or gmake config): + + gmake or gmake all (compiles everything, also modules and runs "gmake mail") + gmake base (only compiles the base) + gmake base_start (only compiles the base and starts the server) + gmake clean (cleans everything) + gmake clean_base (only cleans the base obj and rpo files) + gmake clean_modules (only cleans the modules .so files) + gmake config (runs yChat configurator) + gmake gpl (shows the GNU General Public License) + gmake help (shows all available ychat gmake targets) + gmake mail (sends a mail to the yChat developers containing build opts.) + gmake modules (only compiles modules) + gmake mrproper (same as gmake clean plus removing all temp files) + gmake setup (runs all configure scripts and afterwards gmake all) + gmake start (compiles everything and starts the server) + gmake stats (generates ychat statistics) + gmake version (shows the current version of yChat) +//<<* + gmake yhttpdbase (generates an yhttpd code base) +//*>> (See section 1.9 to read about this marks) + +Example: "gmake all install clean" compiles everything, installs it to PREFIX +and cleans the source directories. + +Now its time to run the server with ./bin/ychat. + +Aferwards point your webbrowser to http://yourip:port ! + +... have fun :-). -Now invoke "./configure" and afterwards "make", edit the conf.txt ( be -sure to enter a valid mysql account ) host. +1.3.2 INSTALLATION QUICK START: -Now we want to compile all the dynamic loadable modules of ychat. -Invoke "cd mods && ./compile.sh && cd -". All modules should get -compiled. +If you in hury, then you may just type gmake setup. In the yChat configurator +you may just choose all the default values. If done, yChat will get compiled +and is ready to run with ./bin/ychat! -Now its time to run the server with ./ychat. -Then point your webbrowser to http://yourip:port/index.html ( ignoring -the index.html on the end of the url will not work! ). -... have fun :-). +//<<* +1.3.3 MYSQL SETUP + +If you chose to use MySQL database support you have to create a valid database +to use with yChat. -1.4.0 HOW TO USE SCREEN WITH YCHAT++: +Create a new MySQL database called 'ychat' and type the following command into +a MySQL command line client of your choice: + +USE ychat +CREATE TABLE `user` ( + `uid` int(10) NOT NULL auto_increment, + `nick` varchar(30) NOT NULL default '', + `password` varchar(30) NOT NULL default '', + `color1` varchar(30), + `color2` varchar(30), + `email` varchar(50) default '-', + `registerdate` varchar(30) default '-', + `logincounter` varchar(10) default '0', + `status` char(1) default '3', + PRIMARY KEY (`uid`), + KEY `uid` (`uid`) +) TYPE=MyISAM; +GRANT ALL PRIVILEGES ON ychat.* to ychat@localhost IDENTIFIED BY "yctest"; + +This database uses the default MySQL access informations which are stored in the +ychat.conf file. +//*>> + +1.4.0 HOW TO USE SCREEN WITH YCHAT: If you are running yChat in ncurses mode you might want to install the tool which is called "screen". This will enable you putting the @@ -111,11 +315,11 @@ and reusing the interface later through another terminal. Just do: - screen -S ychat ./ychat ( creates a new session and starts ychat in it ) - strg+d+a ( will detach the ychat session ) + screen -S ychat ./bin/ychat ( creates a new session and starts yChat in it ) + ctrl+d+a ( will detach the yChat session ) ( closing the terminal ) ( opening a new terminal ) - screen -r ychat ( will return you to the ychat process ) + screen -r ychat ( will return you to the yChat process ) Screen will terminate automaticaly if all processes in its sessions are terminated. @@ -125,131 +329,107 @@ For a closer look read the screen manual page ( man screen ). 1.5.0 CUSTOMIZATION: If you like to customize the design/layout/language of yChat, you will have -to edit msgs.h and glob.h before you compile the sources. Afterwards you can -change the html-template files which are placed in the html/ subdirectory and -the language-template files which are placed in the lang/ subdirectory. -Dynamic loadable modules can be found in the mods/ subdirectory. ( chat -commands are realized through modules too ). - -1.6.0 FILES: ( This list is not complete ) - -conf.txt - The yChat configuration file. ( read by conf.cpp ). - -base.cpp - Encapsulates vector fields of room's or user ( may be later - hash_maps ) and provides methods for manipulating data - objects. +to edit src/msgs.h and src/glob.h before you compile the sources. Afterwards +you can change the html-template files which are placed in the html/ +subdirectory and the language-templates which are placed in the XML config +file (etc/ychat.conf). -hmap.cpp - The hash map implementation which is a very fast data - structure. is needed for saving users, rooms and so on. +Notice, that you dont have to edit the src/glob.h file by hand any more, its +already done by the top ./configure script for you. -main.cpp - This includes the required manager headers for starting - the server and finally regulates the correct starting. +You can edit the etc/ychat.conf to fit your needs. If you dont want to change +the config file, then you also can use ychat start parameters. -modl.cpp - The module loader. Stores pointers of all dynamic loaded - yChat modules in a hash map object and loads new modules - if desired or returns their pointers. +Exmpl: ./bin/ychat -o chat.database.password secretpassword -pool.cpp - The implementation of the thread pool. all threads are stored - in a queue. Each thread will be reused if the assigned job is - finished. +You can also use multiple words for a specific option. -reqp.cpp - This class implements the http request parser. If a client - starts a request to the server the reqp class will be - invoked. +Exmpl: ./bin/ychat -o ychat.version "word1 word2 word3" -room.cpp - Specifies a chat room. For each chat room an instance of - this class exists. +will overwrite the default database password value of the ychat.conf. You can +do this with every configuration element by adding several -o option value +arguments to the start command. -thrd.cpp - This class is needed by sock.cpp while creating a POSIX thread. - All data which a thread needs to do its tasks are stored in a - thrd object and then a pointer to it will be passed to the - POSIX thread function. +Dynamic loadable modules can be found in the mods/ subdirectory. (chat +commands are realized through modules too). Sources of modules can be found +in src/mods instead. If you want to create a new module just create a new +.cpp file and run in src/mods the ./configure script again. Next time +you run gmake your new module gets compiled. -user.cpp - Specifies a chat user. For each chat user an instance of - this class exists. +All messages defined in the msgs.h file contain server messages only ( a chat +user never wont read them, only the administrator will get to see them ). -Abstract classes: +1.6.0 FILES: -cont.cpp - All classes which need to store "key - value" data sets - inherit from this class. ( cont for content ). +etc/ychat.conf - The yChat configuration file +html/* - The html template files +src/* - The yChat base sources +src/mods/* - The dynamic loadable modules sources +scripts/* - Some nice scripts needed for building & co. -name.cpp - All classes which own a private member string name inherit - from this class. It also provides public get_name and - set_name methods. +The following is created by building yChat: +obj/* - The object files of the compiled yChat base +mods/* - The compiled dynamic loadable modules +bin/ychat - The yChat binary (linked by the object files) -As described ( main.cpp ), there are so called managers. Managers are -accessible through their assigned wrapper classes and may be -instanciated only once. +Customizable source files (if changed you need to run gmake clean all) +src/glob.h - Contains some global building options +src/msgs.h - Defines some server side messages -chat.cpp - The chat manager. Is responsible for managing the internal - data structure of the system and also covers a lot of - important methods of the system. -conf.cpp - The config manager. Parses the config file specified in - glob.h and stores all the values of it in a map. +1.7 WRITING BUG REPORTS -html.cpp - The html-template manager. Reads the requested html-template - files, stores them in an internal cache ( averts reading - template-files from hd twice or more ) and parses the - partivular template in order to substituate dynamic values - of it. +How to submit a good bug report? -mutx.cpp - The mutex manager. Contains all global mutex handlers for - synchronizing POSIX thread shared data. until now only the - stdout is synchronized by mutx.cpp because most of objects - use their own mutex'. +Send them to Bug@yChat.org. -sock.cpp - The socket manager. Manages the socket connections. There - are multiplexed sockets. For each requests a new POSIX thread - will be created. +First you should give the following information: +- yChat version, if CVS (or devel. tarball) then which day? +- operating system / distribution and it's version +- when did it crash? did you do something? can you reproduce the crash? -Files with a leading s_ contain static C++ classes +Getting backtrace of the crash also helps a lot, especially if yChat crashes +randomly. If after crash you see text: -s_chat.cpp - Static wrapper for the dynamic chat class. holds one global - reachable instance of chat until the program shuts down. + "segmentation fault (core dumped)" -s_conf.cpp - Static wrapper for the dynamic conf class. holds one global - reachable instance of conf until the program shuts down. +It writes a file named "core" or "ychat.core" depending on your OS to directory +where you started yChat. If it doesn't print the "(core dumped)" or you can't +find the core file, you'll have to raise the limit for max. core file size +before running yChat. To do this, say: -s_html.cpp - Static wrapper for the dynamic html class. holds one global - reachable instance of conf until the program shuts down. + ulimit -c unlimited -s_mutx.cpp - Static wrapper for the dynamic mutx class. holds one global - reachable instance of conf until the program shuts down. +So, if you have the core file and GNU debugger (gdb), you can get the +backtrace with: -s_sock.cpp - Static wrapper for the dynamic sock class. holds one global - reachable instance of conf until the program shuts down. + gdb ./bin/ychat ychat.core + bt -s_tool.cpp - Static class which includes some usefull global reachable - methods which are not integraded in independent classes. +Paste all the lines starting from line having #0 at the beginning. -Special header files ( all other header files which are not listed here -belong to their respective .cpp files ): +Here's an example session: -glob.h - Defines global variables which are known by compilation - time. + in reqp::parse(thrd*, std::string, std::map<std::string, std::string, + std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >&) () + (gdb) bt + #0 0x0805c287 in reqp::parse(thrd*, std::string, std::map<std::string, + std::string, std::less<std::string>, std::allocator<std::pair<std::string + const, std::string> > >&) () + #1 0x0806060f in sock::read_write(thrd*, int) () + #2 0x080612ba in thrd::run() () + #3 0x0805a3b8 in pool::run_func(void*) () + #4 0x0805a375 in pool::tpool_thread(void*) () + #5 0x281d44ae in _thread_start () from /usr/lib/libc_r.so.5 + (gdb) -incl.h - This file is included from every other header file and - includes a set of headers which every class should be able - to use. +If you dont get such a gdb output, you need to recompile the yChat using +debuggig symbols. You can do it this way: -msgs.h - Defines console output messages for verbosity level 0 ( see - glob.h for setting up verbosity levels ). and also defines - all the system messages. you may edit this file for translating - the system user language. - -The basic class structure: - - base<room> base<user> - | | name - | | / \ - | | / \ - chat room user - - cont - / \ - / \ -conf html +cd ychat +gmake mrproper +./configure -g3 -ggdb +gmake start 1.8 CONTACT: @@ -259,12 +439,18 @@ You may contact us through the following addresses: The yChat homepage is located at http://www.yChat.org - E-Mail - Paul C. Buetow: Snooper@yChat.org ( core developer ) - Volker Richter: Rover@yChat.org ( core developer ) - Mail@yChat.org ( reaches everybody of yChat ) + Paul C. Buetow: Snooper at yChat point org ( core developer ) + Volker Richter: Rover at yChat dot org ( core developer ) + Mail at yChat dot org ( reaches everybody of yChat ) - ICQ Paul C. Buetow: 11655527 - IRC - #ychat at irc.german-elite.net + #Ychat and #Coding at irc.german-elite.net + +//<<* +1.9 YHTTPD CODE BASE GENERATION + +See docs/yhttpd.txt +//*>> @@ -1,35 +1,27 @@ Release table -Release date Release name and version Release focus +Release date Branch Release focus -Planing: yhttpd 0.8-RELEASE_______ Features -Planing: yChat 0.8-RELEASE________ Features -Planing: ycurses 0.1-RELEASE______ Initial release +Planing: yChat 0.8-RELEASE Features +Planing: yhttpd 0.8-RELEASE Features +Planing: yxml 0.x-RELEASE Initial release -Apr 07th 05: yChat 0.7.9.1-RELEASE____ Minor bugfixes -Mar 11th 05: yChat 0.7.9-RELEASE______ -Mar 08th 05: yChat 0.5.4-STABLERELEASE -Mar 05th 05 yChat 0.7.8-RELEASE______ -Mar 02th 05 yChat 0.5.3-LEGACYRELEASE -Feb 27th 05 yChat 0.5.2-LEGACYRELEASE -Feb 24th 05 yChat 0.7.7.1-RELEASE____ Major bugfixes -Feb 21th 05 yChat 0.7.7-RELEASE______ -Feb 18th 05 yChat 0.7.6-RELEASE______ -Feb 15th 05 yChat 0.7.5-RELEASE______ -Feb 14th 05 yChat 0.7.4.1-RELEASE____ Major bugfixes -Feb 12th 05 yChat 0.7.4-RELEASE______ -Feb 10th 05 yChat 0.7.4-PRERELEASE___ -Dec 29th 04 yChat 0.7.3-RELEASE______ -Nov 09th 04 yChat 0.7.2-RELEASE______ -Nov 06th 04 yhttpd 0.7.1-RELEASE_____ -Nov 06th 04 yChat 0.7.1-RELEASE______ -Nov 01st 04 yhttpd 0.7-RELEASE_______ Initial release -Oct 31st 04 yChat 0.7-RELEASE________ -Jan 03rd 04 yChat 0.5.1-RELEASE______ -Sep 15th 03 yChat 0.6-RELEASE________ -Sep 15th 03 yChat 0.5.0-RELEASE______ -Apr 26th 03 yChat 0.4-RELEASE________ -Mar 30th 03 yChat 0.3-RELEASE________ -Mar 24th 03 yChat 0.2-RELEASE________ -Mar 20th 03 yChat 0.1-RELEASE________ Initial release +Feb 18th 05 yChat 0.7.6-RELEASE Improvements +Feb 15th 05 yChat 0.7.5-RELEASE Features, bugfixes +Feb 14th 05 yChat 0.7.4.1-RELEASE Bugfix +Feb 12th 05 yChat 0.7.4-RELEASE Bugfixes, improvements, features +Feb 10th 05 yChat 0.7.4-PRERELEASE Bugfixes, improvements, features +Dec 29th 04 yChat 0.7.3-RELEASE Bugfixes, features +Nov 09th 04 yChat 0.7.2-RELEASE Bugfixes, features +Nov 06th 04 yhttpd 0.7.1-RELEASE Bugfixes +Nov 06th 04 yChat 0.7.1-RELEASE Bugfixes +Nov 01st 04 yhttpd 0.7-RELEASE Initial release +Oct 31st 04 yChat 0.7-RELEASE Cleanup, features +Jan 03rd 04 yChat 0.5.1-RELEASE Cleanup, bugfixes +Sep 15th 03 yChat 0.6-RELEASE Cleanup, features +Sep 15th 03 yChat 0.5.0-RELEASE Features +Apr 26th 03 yChat 0.4-RELEASE Features +Mar 30th 03 yChat 0.3-RELEASE Features +Mar 24th 03 yChat 0.2-RELEASE Bugfixes +Mar 20th 03 yChat 0.1-RELEASE Initial release @@ -1 +1 @@ -Thu Mar 10 23:59:06 CET 2005 +Mon Feb 21 03:04:02 CET 2005 @@ -1,42 +1,40 @@ -- Must do's for next RELEASE - -$ None specific +Might do's for next RELEASE: +- Remove Chat stuff from yhttpd.conf +- dir : public vector<string> +- Disable /help command for commands wich are not accessible for the + specific user. +- Flood protection +- Add /nick, /beam, /su +- Add / to whisper to the last person to whom the user has been whispered the last time. +- Room maxuser limit. -- Might do's for next RELEASE - -$ Add thread pool decreasing -$ dir : public vector<string> -$ Disable /help command for commands wich are not accessible for the -$ specific user. -$ Flood protection -$ Add /nick, /beam, /su -$ Add / to whisper to the last person to whom the user has been whispered the last time. +To do in general for some later RELEASE: +- Not found sites should get a 404 error site! +- Implement dynamic timer +- Implement ncurse object browser +- Implement yXML subproject +- Implement ODBC support +- Implement login counter. +- Implement msg post counter. +- Implement online time counter. +- Implement hall of fame rankings of the counters above. Also add a msg/minute hall of fame. +- Implement traffic stats +- Implement more chat commands +- Implement new dynamic command permission method +- Implement SSL sockets with OpenSSL +- Implement user profiles +- Implement action form to input.html +- Implement IRC support +- Implement possibility sending Mails through external SMTP server (for password reminder etc) +- Implement chat moderator option +- Implement several HTML styles, each user can use his favourite style +- Implement compatibility to Opera, Links, Konqueror and Safari +- Implement browser side caching for gfx files support +- Implement a http:// url detection and make a link out of it! +- Remove user.cpp member variables as possible and replace them with hash maps + for (integer,mutex) and (string,mutex) pairs. Maybe use s.t. like this: + p_user->val("name"); to get the users name and p_user->val("name","val"); to + reset his name. Maybe use templates to get different types besides strings: + p_user->val<int>("hits"); +- Write changes of the configuration back into XML if wished. -- Known bugs - -$ The session manager sometimes does not free a session. The user object might hang. -$ Using yChat via proxy sometimes causes a white chat stream. - -- To do in general for some later RELEASE - -$ Use libevent -$ Not found sites should get a 404 error site! -$ Implement dynamic timer -$ Implement ncurse object browser -$ Implement yXML subproject -$ Implement ODBC support -$ Implement login counter. -$ Implement msg post counter. -$ Implement online time counter. -$ Implement hall of fame rankings of the counters above. Also add a msg/minute hall of fame. -$ Implement traffic stats -$ Implement more chat commands -$ Implement new dynamic command permission method -$ Implement SSL sockets with OpenSSL -$ Implement user profiles -$ Implement action form to input.html -$ Implement IRC support -$ Implement possibility sending Mails through external SMTP server (for password reminder etc) -$ Implement chat moderator option -$ Implement several HTML styles, each user can use his favourite style -$ Implement compatibility to Opera, Links, Konqueror and Safari -$ Implement browser side caching for gfx files support -$ Implement a http:// url detection and make a link out of it! -$ Remove user.cpp member variables as possible and replace them with hash maps -$ Write changes of the configuration back into XML if wished. @@ -1 +1 @@ -yChat 0.7.9-RELEASE Build 3624 +yChat 0.7.7-RELEASE Build 3384 @@ -1,1694 +1,78 @@ -#! /bin/sh +#!/bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-extra-libs=DIR comma separated list of additional lib directories " -ac_help="$ac_help - --with-extra-includes=DIR comma separated list of additional include directories " - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -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' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -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 - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # 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 ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$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" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) 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) - # 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 << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --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 -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$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) - 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 ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - 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 "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# 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 - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=Makefile.in - -# 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_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - 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 "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# 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 "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:530: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 545 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 562 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 579 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:585: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -for ac_prog in $CCC c++ g++ gcc CC cxx cc++ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:614: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:646: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 657 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:688: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:693: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:721: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi - - - - # Check whether --with-extra-libs or --without-extra-libs was given. -if test "${with_extra_libs+set}" = set; then - withval="$with_extra_libs" - - EXTRA=`echo $withval | sed -e ':a;s/,/ -L/;t a'` - LDFLAGS="$LDFLAGS -L$EXTRA" - - -fi - - # Check whether --with-extra-includes or --without-extra-includes was given. -if test "${with_extra_includes+set}" = set; then - withval="$with_extra_includes" - - EXTRA=`echo $withval | sed -e ':a;s/,/ -I/;t a'` - CPPFLAGS="$CPPFLAGS -I$EXTRA" - - -fi - - - -echo $ac_n "checking for library containing dlopen""... $ac_c" 1>&6 -echo "configure:777: checking for library containing dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_search_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_func_search_save_LIBS="$LIBS" -ac_cv_search_dlopen="no" -cat > conftest.$ac_ext <<EOF -#line 784 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_dlopen="none required" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -test "$ac_cv_search_dlopen" = "no" && for i in dl; do -LIBS="-l$i $ac_func_search_save_LIBS" -cat > conftest.$ac_ext <<EOF -#line 806 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_dlopen="-l$i" -break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -LIBS="$ac_func_search_save_LIBS" -fi - -echo "$ac_t""$ac_cv_search_dlopen" 1>&6 -if test "$ac_cv_search_dlopen" != "no"; then - test "$ac_cv_search_dlopen" = "none required" || LIBS="$ac_cv_search_dlopen $LIBS" - -else : - -fi -if test "$ac_cv_search_dlopen" = "-ldl"; then -LDFLAGS="$ac_cv_search_dlopen" -fi - - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:843: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 848 "configure" -#include "confdefs.h" -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 873 "configure" -#include "confdefs.h" -#include <string.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - 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 <<EOF -#line 891 "configure" -#include "confdefs.h" -#include <stdlib.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - 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 <<EOF -#line 912 "configure" -#include "confdefs.h" -#include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#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); } - -EOF -if { (eval echo configure:923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if ! which perl >/dev/null then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:950: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 955 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -for ac_hdr in string.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:990: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 995 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -for ac_hdr in pthread.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1030: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1035 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF + echo You need to have Perl in your PATH + exit 1 +fi + +perl -e ' + use strict; + $|=1; + sub check_gcc { + my $f = shift; + my $s = shift; + my $r = 0; + print "Checking for GNU G++ $f.$s\n"; + if ( `g++ -v 2> g++.version && tail -n 1 g++.version` =~ / $f\.$s/ ) { + `echo $f.$s >> g++.version`; + `echo g++ >> g++.version`; + $r = 1; + } else { + if (`g++$f$s -v 2> g++.version && tail -n 1 g++.version` =~ / $f\.$s/) { + `echo $f.$s >> g++.version`; + `echo g++$f$s >> g++.version`; + $r = 1; + } + } + print "No " if $r == 0; + print "GNU G++ $f.$s found!\n"; + return $r; + } + sub check_make { + print "Checking for GNU make\n"; + my $err = "No GNU make found.\nPlease install a version of GNU make!\n"; + my $make; + if (`which gmake`) { + $make = "gmake"; + } elsif ( `which make` ) { + $make = "make"; + } else { + print $err; + exit(1); + } + + `sh -c "$make -v > make.version 2>/dev/null"`; + if ( `cat make.version` =~ /GNU Make/ ) { + `echo $make >> make.version`; + } else { + print $err; + exit(1); + } + } + &check_make; + print "Checking compiler version\n"; + my $r = 0; + for (my $i = 4; $i > 0 && $r == 0; --$i ) { + $r = &check_gcc(3,$i); + } + if ($r == 0) { + print "No suitable g++ compiler found!\n"; + print "Please install a right version of GNU G++!\n"; + exit(1); + } -else - echo "$ac_t""no" 1>&6 -echo "-> Error: pthread.h could not be found. Try --with-extra-includes=<dirs>"; exit 1; -fi -done + system("sh -c \"scripts/config.sh\""); + chdir("src"); + system("./configure ".join(" ", @ARGV)); + chdir(".."); -for ac_hdr in mysql/mysql.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1071: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1076 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -echo "-> Error: mysql.h could not be found. Try --with-extra-includes=<dirs>"; exit 1; -fi -done - -echo $ac_n "checking for mysql_init in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:1109: checking for mysql_init in -lmysqlclient" >&5 -ac_lib_var=`echo mysqlclient'_'mysql_init | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lmysqlclient $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1117 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char mysql_init(); - -int main() { -mysql_init() -; return 0; } -EOF -if { (eval echo configure:1128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + exit(0); +' `echo "$*" | sed "s/-//g"` -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo mysqlclient | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - - LIBS="-lmysqlclient $LIBS" - -else - echo "$ac_t""no" 1>&6 -"-> Error: libmysqlclient could not be found. Try --with-extra-libs=<dirs>"; exit 1; -fi - -for ac_hdr in netinet/in.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1160: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1165 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1170: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -echo "-> Error: netinet/in.h could not be found. Try --with-extra-includes=<dirs>"; exit 1; -fi -done - -for ac_hdr in sys/time.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1201: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1206 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -echo "-> Error: sys/time.h could not be found. Try --with-extra-includes=<dirs>"; exit 1; -fi -done - -echo $ac_n "checking for newwin in -lncurses""... $ac_c" 1>&6 -echo "configure:1239: checking for newwin in -lncurses" >&5 -ac_lib_var=`echo ncurses'_'newwin | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lncurses $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1247 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char newwin(); - -int main() { -newwin() -; return 0; } -EOF -if { (eval echo configure:1258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo ncurses | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - - LIBS="-lncurses $LIBS" - -else - echo "$ac_t""no" 1>&6 -"-> Error: libncurses could not be found. Try --with-extra-libs=<dirs>";exit 1; -fi - -for ac_hdr in ncurses.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1290: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1295 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -echo "-> Error ncurses.h could not be found. Try --with-extra-includes=<dirs"; exit1; -fi -done - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1328: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1333 "configure" -#include "confdefs.h" - -int main() { - -/* 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; -} - -; return 0; } -EOF -if { (eval echo configure:1382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1403: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <<EOF -#line 1410 "configure" -#include "confdefs.h" - -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:1417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_inline=$ac_kw; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done - -fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in - inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <<EOF -#define inline $ac_cv_c_inline -EOF - ;; -esac - -trap '' 1 2 15 -cat > confcache <<\EOF -# 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. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# 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 \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : +if test -f err +then + rm -f err else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@CPP@%$CPP%g -s%@CXX@%$CXX%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# 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_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # 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" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat + echo You are ready to type gmake now! fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - -echo "You are now ready to compile. Type make" diff --git a/etc/CVS/Entries b/etc/CVS/Entries index 308e5dd..c30aed1 100644 --- a/etc/CVS/Entries +++ b/etc/CVS/Entries @@ -1,2 +1,2 @@ -/ychat.conf/1.47/Sat Mar 5 11:53:19 2005// +/ychat.conf/1.42/Thu Feb 17 18:09:42 2005// D diff --git a/etc/ychat.conf b/etc/ychat.conf index 786096b..1a48d79 100644 --- a/etc/ychat.conf +++ b/etc/ychat.conf @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> -<config> +<?xml version="5.0" encoding="ISO-8859-1" standalone="yes" ?> <category name="chat"> <option name="defaultop"> <value>Snoop</value> @@ -392,9 +391,6 @@ <option name="findingcommand"> <value>No such command!<br></value> </option> - <option name="maxuserlimit"> - <value>You cant log in because the maxuser limit has been reached. Please try again later.<br><br></value> - </option> <option name="messagelength"> <value>Your message was too long and has been shortened!</value> </option> @@ -589,10 +585,6 @@ <value>html/</value> <descr>If set to false, yChat strips all html tags from incoming messages</descr> </option> - <option name="ipcachesize"> - <value>50</value> - <descr>Specifies the IP cache size. If set to 0, the IP cache will be cleared every 10 minutes. Otherwise, the IP cache will be cleared every 10 minutes only if there are more IPs in the cache than the specified amount.</descr> - </option> <category name="html"> <option name="notfound"> <value>notfound.html</value> @@ -601,12 +593,16 @@ </category> <category name="thread"> <option name="initpoolsize"> - <value>10</value> - <descr>Initial number of threads running at the same time. If there are less than 5 threads in the pool waiting, the thread pool will resize to 10.</descr> + <value>20</value> + <descr>Initial number of threads running at the same time. If all threads are used, the pool will allocate a new thread. Lowest value is 1.</descr> </option> <option name="maxpoolsize"> <value>0</value> - <descr>Maximum amount of parallel running threads. Change this to 0 if you want to use unlimited threads. If you have set a number not equal to 0, then there have to be at least 2 waiting threads to allow a new user login. A maxpoolsize of 52 means a max user limit of 50 users.</descr> + <descr>Maximum amount of parallel running threads. Change this to 0 if you want to use unlimited threads.</descr> + </option> + <option name="queuesize"> + <value>50</value> + <descr>Max. number of jobs which can wait for a free thread of the thread pool</descr> </option> </category> <category name="stats"> @@ -649,11 +645,11 @@ <descr>Specifies the relative or absolute path to the system messsage log file</descr> </option> <option name="accesslines"> - <value>20</value> + <value>10</value> <descr>Number of access log lines which will be buffered in the main memory until they will be written into the file</descr> </option> <option name="systemlines"> - <value>20</value> + <value>10</value> <descr>Number of system log lines which will be buffered in the main memory until they will be written into the file</descr> </option> </category> @@ -687,4 +683,3 @@ </option> </category> </category> -</config> diff --git a/html/CVS/Entries b/html/CVS/Entries index 19aa725..b212293 100644 --- a/html/CVS/Entries +++ b/html/CVS/Entries @@ -9,7 +9,7 @@ /input.html/1.12/Mon Feb 14 18:01:22 2005// /loggedin.html/1.1/Mon Feb 14 18:01:22 2005// /notfound.html/1.2/Sat Mar 20 21:58:14 2004// -/online.html/1.7/Wed Feb 23 05:08:04 2005// +/online.html/1.6/Mon Feb 14 18:01:22 2005// /options.html/1.6/Sun Nov 7 02:24:57 2004// /register.html/1.10/Sun Nov 7 02:37:57 2004// /robots.txt/1.1.1.1/Fri Jan 2 03:15:10 2004// diff --git a/html/favicon.ico b/html/favicon.ico Binary files differindex 4deafd5..4deafd5 100644..100755 --- a/html/favicon.ico +++ b/html/favicon.ico diff --git a/html/frameset.html b/html/frameset.html index 84a95ef..672f8fa 100755 --- a/html/frameset.html +++ b/html/frameset.html @@ -1,10 +1,12 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> - %%PGETITLE%% + %%ychat.version%% </title> </head> - <frameset rows="*,70"> + <frameset boders="0" rows="*,70"> <noframes> Your browser does not support frames, </noframes> diff --git a/html/help.html b/html/help.html index 0a3b418..ad9a25f 100755 --- a/html/help.html +++ b/html/help.html @@ -1,23 +1,28 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> - Chat-help - %%PGETITLE%% + Chat-help - %%ychat.version%% </title> <link rel=stylesheet href="style.css" type=text/css> </head> -<body bgcolor=#000000 text=#ffff00> +<body> <table align=center width=500> <tr><td> - Hello %%nick%%, all chat commands available are summarized below: + Hello %%nick%%, all chat commands available are summarized below (Please notice that only currently + in memory loaded command modules are listed here which should be the case by yChat default configuration). You can also access help for a specific command with the /help command. Example: /help commandname: </td></tr> <tr><td> <br> -<table> %%content%% -</table> </td></tr> </table> <br><br> -<center><span class="signature">yChat is OpenSource - get it at <a target="_blank" href="http://www.yChat.org">http://www.yChat.org</a></span></center> + <center> + <span class="signature"> + yChat is OpenSource - get it at <a class="fancy" target="_blank" href="http://www.yChat.org">http://www.yChat.org</a> + </span> + </center> </body> </html> diff --git a/html/index.html b/html/index.html index 0549ac5..983e7ef 100755 --- a/html/index.html +++ b/html/index.html @@ -1,32 +1,54 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> - %%PGETITLE%% + %%ychat.version%% </title> <link rel=stylesheet href="style.css" type=text/css> </head> -<body bgcolor=#000000 text=#ffff00> +<body> <table align=center width=500> <tr> -<td align=center><img src="y_black.gif" alt="ychat"></td> -<td align=center class=header>%%PGETITLE%%<br>%%INFO%%</td> +<td> +<center> +%%ychat.version%%<br><br>%%INFO%% +</center> +</td> </tr> <tr> - <td colspan=2> </td> +<td colspan=2> </td> </tr> <tr> - <td align=center colspan=2> -Enter your nick: -<form action="frameset.html" method="GET"> +<td align=center colspan=2> +<form action="frameset.html" method="POST"> <input type="hidden" name="event" value="login"> - <input type="hidden" name="room" accesskey="r" value="%%STRDROOM%%"> - <input type="text" name="nick" accesskey="n"> +Enter your nick:<br> + <input class="text" type="text" name="nick" value="%%nick%%" maxlength="%%chat.maxlength.username%%" accesskey="n"> +<br> +<br> +Enter your password:<br> + <input class="text" type="password" name="password" value="%%pass%%" maxlength="%%chat.maxlength.password%%" accesskey="p"> +<br> +<br> +Enter your room:<br> + <input class="text" type="text" name="room" value="%%chat.defaultroom%%" maxlength="%%chat.maxlength.roomname%%" accesskey="r"> +<br> +<br> + <input type="hidden" name="end" value="end"> <input type="submit" value="login" accesskey="s"> </form> +<br> +<a class="fancy" href="register.html">Register</a> a new nick +<br> +<br> +If you don't want to register you may login +<br> +without a password using an unregistered nick. </td> </tr> </table> <br><br> -<center><span class="signature">yChat is OpenSource - get it at <a target="_blank" href="http://www.yChat.org">http://www.yChat.org</a></span></center> +<center><span class="signature">yChat is OpenSource - get it at <a class="fancy" target="_blank" href="http://www.yChat.org">http://www.yChat.org</a></span></center> </body> </html> diff --git a/html/input.html b/html/input.html index a49cb13..31ed9fe 100755 --- a/html/input.html +++ b/html/input.html @@ -1,16 +1,19 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> - <head> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> - %%PGETITLE%% + %%HTML_TITLE_TAG_CONTENT%% </title> -<link rel=stylesheet href="style.css" type=text/css> + <link rel=stylesheet href="style.css" type=text/css> <script language="JavaScript"> <!-- function delout() { - document.input.message.focus(); - document.input.message.select(); + document.input.message.value = document.input.message.value.replace(/&/g, '\\AND'); document.input.submit(); + document.input.message.value = ""; + document.input.message.focus(); return false; } function selectinput() @@ -23,23 +26,35 @@ var top = (screen.availHeight-height)/2; var win = window.open(site,"_blank","width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=yes"); } + function chgscroll(f) + { + if(f.checked) + parent.stream.autoscroll(); + else + parent.stream.stopscroll(); + } //--> </script> </head> - <body bgcolor=#000000 text=#ffffff> - <table> - <tr><td> - <form name="input" action="input.html" target="blank" onsubmit="return delout();"> - <input type="hidden" name="event" value="post"> + <body> + <form method="GET" name="input" action="input.html" target="blank" onsubmit="return delout();"> + <div style="position: absolute; top: 5px;"> + <input class="text" type="text" name="message" size="60" maxlength="%%chat.maxlength.message%%"> + <input type="submit" value="Send" accesskey='s'> + <input type="button" value="Select" accesskey='e' onclick="javascript:selectinput();"> + </div> + <div style="position: absolute; top: 29px;"> + <a href='#' class="fancy" onclick="javascript:popup('colors.html?event=colors&tmpid=%%tmpid%%', 600, 480)">Colors</a> + <a href='#' class="fancy" onclick="javascript:popup('options.html?event=options&tmpid=%%tmpid%%', 600, 480)">Options</a> + <a href='#' class="fancy" onclick="javascript:popup('help.html?event=help&tmpid=%%tmpid%%', 600, 480)">Help</a> + <a href='#' class="fancy" onclick="javascript:popup('loggedin.html?event=loggedin&tmpid=%%tmpid%%', 600, 480)">Users</a> + <a href='#' class="fancy" onclick="javascript:popup('admin.html?event=admin&tmpid=%%tmpid%%', 600, 480)">Admin</a> + <a href='input.html?event=input&tmpid=%%tmpid%%&message=%2Fq' class="fancy" target='blank'>Logout</a> + Scrolling: + <input type="checkbox" name="scroll" checked onClick="chgscroll(this);"> + </div> + <input type="hidden" name="event" value="input"> <input type="hidden" name="tmpid" value="%%tmpid%%"> - <input type="text" name="message" size="50"> - <input type="submit" value="send" accesskey='s'> - <input type="button" value="select" accesskey='e' onclick="javascript:selectinput();"> </form> - </td> - <td> - <a href='#' onclick="javascript:popup('help.html?event=help&tmpid=%%tmpid%%', 576, 480)">Help</a> - </td></tr> - </table> </body> </html> diff --git a/html/notfound.html b/html/notfound.html index 574e341..a14d44b 100755 --- a/html/notfound.html +++ b/html/notfound.html @@ -1,7 +1,9 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> - %%PGETITLE%% + %%HTML_TITLE_TAG_CONTENT%% </title> </head> <body> diff --git a/html/online.html b/html/online.html index aa14f8d..6a10fd9 100755 --- a/html/online.html +++ b/html/online.html @@ -1,7 +1,23 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> - <meta http-equiv="refresh" content="20"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel=stylesheet href="style.css" type=text/css> - <body bgcolor=#000000 text=#ffffff> - %%MESSAGE%% + <body> + <b>%%ROOMNAME%%</b> + <br> + <br> + <table> + <tr> + <td> + %%ROOMTOPIC%% + </td> + </tr> + %%USERLIST%% + </table> </body> </html> + + + + diff --git a/html/stream.html b/html/stream.html index 6678069..ed08a23 100755 --- a/html/stream.html +++ b/html/stream.html @@ -1,30 +1,38 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> - <head> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> - %%PGETITLE%% + %%HTML_TITLE_TAG_CONTENT%% </title> <link rel=stylesheet href="style.css" type=text/css> <script language="JavaScript"> - function autoScroll() + var scrolling; + var ison; + function autoscroll() { - window.scroll(1, 50000 ); - timer = setTimeout('autoScroll()',200); + if(!ison){ + scrolling = window.setInterval("window.scroll(1,1606682)",70); + ison = true; + } } - - autoScroll(); - - function stopScroll() + function stopscroll() { - clearTimeout(timer); - } - - function startScroll() - { - timer = setTimeout('autoScroll()', 200); + if(ison) + { + window.clearInterval(scrolling); + ison = false; + } } </script> </head> -<body bgcolor=#000000 text=#ffffff> - Welcome to yChat %%nick%%! +<body class="stream"> +<h1>Engine: %%ychat.version%%</h2> +<script language="JavaScript"> + autoscroll(); +</script> + + Welcome to the chat, %%nick%%! <br> <br> + diff --git a/html/style.css b/html/style.css index e31bd7e..4b6d9ca 100644..100755 --- a/html/style.css +++ b/html/style.css @@ -1,11 +1,48 @@ -BODY, TD { +body, div { font-family: Verdana, Helvetica, sans-serif; + background-color: #000000; + color: #FFFFEF; font-size: 11pt; } -A { - color: #dddddd; + +input { + color: #000000; + font-family: Verdana, Helvetica, sans-serif; + text-decoration: none; + font-size: 9pt; + padding: 2px; +} + +input.text { + background-color: #FFFFEF; +} + +.fancy { + font-family: Verdana, Helvetica, sans-serif; + font-size: 9pt; + color: #FFFFEF; + padding: 2px; +} + +a:hover.fancy { + text-decoration: none; + color: #FFFFEF; + background-color: #000000; +} + +h1 { + background-color: #ffa500; + border: solid #000000 1px; + font-size: 20pt; + padding: 13px; + font-width: bold; +} + +body.stream { + background-color: #323232; } + .signature { - color: #dddddd; + color: #AAAAAA; font-size: 9pt; } diff --git a/scripts/CVS/Entries b/scripts/CVS/Entries index ac6ad99..7467c06 100644 --- a/scripts/CVS/Entries +++ b/scripts/CVS/Entries @@ -1,11 +1,10 @@ /README/1.1/Tue Jun 29 23:38:15 2004// /astyle.sh/1.2/Mon Feb 21 01:55:49 2005// /buildnr.pl/1.4/Sun Feb 6 16:38:36 2005// -/checkperl.sh/1.1/Sat Feb 26 23:09:19 2005// -/config.pl/1.1/Sat Feb 26 21:14:55 2005// -/makeyhttpd.pl/1.15/Tue Mar 1 14:10:39 2005// +/config.sh/1.3/Sun Oct 31 18:04:18 2004// +/makeyhttpd.pl/1.11/Wed Feb 9 22:42:58 2005// /screen.sh/1.1/Fri Mar 5 05:53:12 2004// /setglobvals.pl/1.1.1.1/Fri Jan 2 03:15:10 2004// -/stats.pl/1.9/Mon Mar 7 22:32:34 2005// +/stats.pl/1.7/Fri Jan 14 17:33:02 2005// /version.sh/1.2/Wed Feb 9 22:49:14 2005// D diff --git a/scripts/astyle.sh b/scripts/astyle.sh index 757364e..b9dbc45 100755 --- a/scripts/astyle.sh +++ b/scripts/astyle.sh @@ -1,6 +1,5 @@ #!/bin/sh - -# The yChat Project (2004, 2005) +# The yChat Project (2004) # # This uses "astyle" to format C++ code into a specific code style! diff --git a/scripts/makeyhttpd.pl b/scripts/makeyhttpd.pl index 7dd0345..101343a 100644 --- a/scripts/makeyhttpd.pl +++ b/scripts/makeyhttpd.pl @@ -8,19 +8,20 @@ use strict; use scripts::modules::file; my @delete = ( - 'CHANGES', + 'ChangeLog', 'g++.version', 'TODO', 'NEWS', 'docs', 'src/chat', - 'src/memb', 'src/data', 'src/irc', 'src/contrib/crypt', 'src/modl.h', 'src/modl.cpp', 'src/mods', + 'src/mods/commands', + 'src/mods/irc', 'obj', 'mods', 'html', @@ -40,7 +41,6 @@ my %substituate = ( 'yChat' => 'yhttpd', 'YCHAT' => 'YHTTPD', 'CHAT' => 'HTTPD', - 'yhttpd.org' => 'yChat.org', '//>>' => '' ); @@ -93,106 +93,43 @@ print "Moving html templates\n"; system("mv demo.html html/index.html"); system("mv test.cgi notfound.html style.css html"); -print "Editing etc/yhttpd.conf\n"; -&edit_yhttpd_conf(); print "Removing marked lines of code\n->"; &remove_marked_lines('.'); -print "\nEdit version numbers\n->"; -&edit_version_numbers('yhttpd/src/msgs.h','yhttpd/README'); sub remove_marked_lines { my $dir = shift; chdir($dir); - - for (&dopen(".")) - { + foreach (&dopen(".")) { next if /^\.+$/; print " $_"; - - if ( -f $_ ) - { + if ( -f $_ ) { my @newfile; my $flag = 0; - - for my $line (fopen($_)) - { + foreach my $line (fopen($_)) { $flag = 1 if $line =~ /\/\/<<\*/; if ($flag == 0 && $line !~ /\/\/<</) { - for ( @deletelines ) - { - if ($line =~ /$_/) - { + foreach ( @deletelines ) { + if ($line =~ /$_/) { $flag = 3; last; } } - - if ($flag != 3 ) - { + if ($flag != 3 ) { map { $line =~ s/$_/$substituate{$_}/eg } keys %substituate; push @newfile, $line; - } - - else - { + } else { $flag = 0; } } $flag = 0 if $line =~ /\/\/\*>>/; } - &fwrite($_, @newfile); - } - - elsif ( -d $_ ) - { - # Recursive + } elsif ( -d $_ ) { &remove_marked_lines($_); } } - chdir('..'); } -sub edit_yhttpd_conf -{ - my @old = fopen("etc/yhttpd.conf"); - my @new = @old[0..1]; - - my $flag = 0; - for (@old) - { - if ($flag == 0) - { - if (/<category name="httpd">/) - { - $flag = 1; - push @new, $_; - } - } - - else - { - push @new, $_; - } - } - - fwrite("etc/yhttpd.conf", @new); -} - -sub edit_version_numbers -{ - for (@_) - { - print " $_"; - my @file = fopen $_; - for (@file) - { - s/([0-9]+\.[0-9]+)\.[0-9]+(-*)/$1$2/g for @file; - s/RELEASE/DEVEL/g; - } - fwrite($_,@file); - } -} - print "\n"; + diff --git a/scripts/stats.pl b/scripts/stats.pl index b55bc9e..e5cc2b3 100755 --- a/scripts/stats.pl +++ b/scripts/stats.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# The yhttpd Project (2003 - 2004) +# The yChat Project (2003 - 2004) # # This script generates source code and project statistics diff --git a/src/CVS/Entries b/src/CVS/Entries index 9f8fee6..f1ff71c 100644 --- a/src/CVS/Entries +++ b/src/CVS/Entries @@ -1,23 +1,21 @@ /Makefile.in/1.22/Tue Sep 7 17:14:39 2004// -/configure/1.39/Sun Mar 6 20:44:47 2005// -/glob.h/1.74/Wed Mar 9 21:09:31 2005// -/html.cpp/1.23/Wed Feb 23 20:23:31 2005// -/html.h/1.11/Wed Feb 23 03:12:05 2005// -/incl.h/1.7/Wed Feb 23 03:12:05 2005// -/logd.cpp/1.15/Sun Feb 27 06:28:53 2005// -/logd.h/1.11/Wed Feb 23 03:12:05 2005// -/main.cpp/1.38/Sun Mar 6 20:44:47 2005// -/modl.cpp/1.19/Sun Mar 6 20:44:47 2005// -/modl.h/1.11/Sun Mar 6 20:44:47 2005// -/msgs.h/1.207/Thu Mar 10 22:01:54 2005// +/configure/1.34/Thu Feb 17 00:25:26 2005// +/glob.h/1.60/Mon Feb 21 02:02:48 2005// +/html.cpp/1.20/Mon Feb 21 01:55:49 2005// +/html.h/1.10/Mon Feb 21 01:55:49 2005// +/incl.h/1.6/Sat Feb 19 11:08:50 2005// +/logd.cpp/1.12/Mon Feb 21 01:55:49 2005// +/logd.h/1.10/Mon Feb 21 01:55:49 2005// +/main.cpp/1.34/Mon Feb 21 01:55:49 2005// +/modl.cpp/1.18/Mon Feb 21 01:55:49 2005// +/modl.h/1.10/Mon Feb 21 01:55:49 2005// +/msgs.h/1.176/Mon Feb 21 02:02:48 2005// /name.cpp/1.8/Mon Feb 21 01:55:49 2005// /name.h/1.6/Mon Feb 21 01:55:49 2005// -/reqp.cpp/1.42/Sun Mar 6 20:44:47 2005// -/reqp.h/1.15/Wed Feb 23 03:12:05 2005// -/sign.cpp/1.3/Mon Mar 7 00:24:57 2005// -/sign.h/1.1/Fri Mar 4 02:41:30 2005// +/reqp.cpp/1.36/Mon Feb 21 01:55:49 2005// +/reqp.h/1.14/Mon Feb 21 01:55:49 2005// /stats.cpp/1.10/Mon Feb 21 01:55:49 2005// /stats.h/1.7/Mon Feb 21 01:55:49 2005// -/wrap.cpp/1.18/Sun Mar 6 20:44:47 2005// -/wrap.h/1.25/Sun Mar 6 20:44:47 2005// +/wrap.cpp/1.16/Mon Feb 21 01:55:49 2005// +/wrap.h/1.23/Mon Feb 21 01:55:49 2005// D diff --git a/src/Makefile.in b/src/Makefile.in index 6f43bf9..0382389 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,17 +1,21 @@ -SRCS=chat.cpp s_chat.cpp conf.cpp s_conf.cpp cont.cpp html.cpp s_html.cpp lang.cpp s_lang.cpp main.cpp mutx.cpp s_mutx.cpp name.cpp pool.cpp reqp.cpp room.cpp sock.cpp s_sock.cpp thrd.cpp s_tool.cpp user.cpp sess.cpp sman.cpp s_sman.cpp -#logd.cpp modl.cpp s_modl.cpp cmnd.cpp -OBJS=$(SRCS:.cpp=.o) -CC=g++ -LDFLAGS=@LDFLAGS@ -lstdc++ -g -LDADD=-pthread -D_THREAD_SAFE +SRCS=WILLBEADDEDBYCONFIGURE +OBJS=$(addprefix ../obj/,$(SRCS:.cpp=.o)) +CC=WILLBEADDEDBYCONFIGURE +LIBADD=`cat libs.add` +LDFLAGS=$(LIBADD) -lstdc++ +LDADD=-pthread -D_THREAD_SAFE -export-dynamic -ldl +INCLUDES=`cat includes.add` +CFLAGS=-fno-inline -fno-default-inline -frepo all: ychat $(SRCS): - $(CC) $(CFLAGS) -c $*.cpp -ychat: $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD) - @mv -f ychat .. -mrproper: clean - @rm -f Makefile config.log config.cache config.status - rm -f ../ychat -clean: - rm *.o + $(CC) $(INCLUDES) $(CFLAGS) -c $*.cpp +infotext: + @echo Compiling base +ychat: infotext $(OBJS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD) + @mv ychat ../bin + @echo -n "Size of linked executable: " + @du -hc ../bin/ychat | tail -n 1 +clean: + @echo Cleaning base obj + @if test -d ../obj; then rm -Rf ../obj; fi diff --git a/src/chat/CVS/Entries b/src/chat/CVS/Entries index 1eaa9f0..7eb1a75 100644 --- a/src/chat/CVS/Entries +++ b/src/chat/CVS/Entries @@ -1,17 +1,17 @@ /base.h/1.8/Mon Feb 21 01:55:49 2005// /base.tmpl/1.6/Mon Feb 21 01:55:49 2005// -/chat.cpp/1.20/Fri Feb 25 00:15:38 2005// -/chat.h/1.12/Wed Feb 23 03:12:05 2005// +/chat.cpp/1.18/Mon Feb 21 01:55:49 2005// +/chat.h/1.11/Mon Feb 21 01:55:49 2005// /gcol.cpp/1.7/Mon Feb 21 01:55:49 2005// /gcol.h/1.5/Mon Feb 21 01:55:49 2005// /perm.cpp/1.10/Mon Feb 21 01:55:49 2005// /perm.h/1.8/Mon Feb 21 01:55:49 2005// -/room.cpp/1.11/Fri Mar 4 00:34:29 2005// -/room.h/1.8/Fri Mar 4 00:34:29 2005// +/room.cpp/1.10/Mon Feb 21 01:55:49 2005// +/room.h/1.7/Mon Feb 21 01:55:49 2005// /sess.cpp/1.6/Mon Feb 21 01:55:49 2005// /sess.h/1.6/Mon Feb 21 01:55:49 2005// /sman.cpp/1.11/Mon Feb 21 01:55:49 2005// /sman.h/1.6/Mon Feb 21 01:55:49 2005// -/user.cpp/1.18/Sun Mar 6 20:44:47 2005// +/user.cpp/1.16/Mon Feb 21 01:55:49 2005// /user.h/1.11/Mon Feb 21 01:55:49 2005// D diff --git a/src/chat/chat.cpp b/src/chat/chat.cpp index 0839261..019f939 100755 --- a/src/chat/chat.cpp +++ b/src/chat/chat.cpp @@ -74,7 +74,7 @@ chat::get_user_( room *room_obj, void *v_arg ) } void -chat::login( map<string,string> &map_params ) +chat::login( hashmap<string> &map_params ) { string s_user = map_params["nick"]; @@ -123,15 +123,6 @@ chat::login( map<string,string> &map_params ) return; } - // prove if maxpoolsize (threads) allows this login - else if ( !wrap::POOL->allow_user_login() ) - { - map_params["INFO"] = wrap::CONF->get_elem( "chat.msgs.err.maxuserlimit" ); - map_params["request"] = wrap::CONF->get_elem( "httpd.startsite" ); // redirect to the startpage. - wrap::system_message( LOGINE5 + s_user); - return; - } - bool b_flag; // prove if nick is already online / logged in. @@ -279,7 +270,7 @@ chat::login( map<string,string> &map_params ) } void -chat::post( user* p_user, map<string,string> &map_params ) +chat::post( user* p_user, hashmap<string> &map_params ) { p_user->renew_timeout(); diff --git a/src/chat/chat.h b/src/chat/chat.h index 47645c3..8508508 100755 --- a/src/chat/chat.h +++ b/src/chat/chat.h @@ -46,10 +46,10 @@ public: static void get_user_( room* room_obj, void *v_arg ); // will be called every time a user tries to login. - void login( map<string,string> &map_params ); + void login( hashmap<string> &map_params ); // will be called if a user posts a message. - void post ( user* u_user, map<string,string> &map_params ); + void post ( user* u_user, hashmap<string> &map_params ); void del_elem( string s_name ) { diff --git a/src/chat/room.cpp b/src/chat/room.cpp index b927d40..00dc463 100755 --- a/src/chat/room.cpp +++ b/src/chat/room.cpp @@ -75,7 +75,8 @@ room::clean_room() void room::reload_onlineframe() { - javascript_post("parent.online.location.reload();"); + string s_msg = "<script language=\"JavaScript\"> parent.online.location.reload(); </script>\n"; + msg_post( &s_msg ); } void diff --git a/src/chat/room.h b/src/chat/room.h index 06b0a9a..572e68b 100755 --- a/src/chat/room.h +++ b/src/chat/room.h @@ -57,7 +57,6 @@ public: { msg_post( &s_msg ); } - void msg_post( string *p_msg ) { #ifdef LOGGING @@ -67,12 +66,6 @@ public: base<user>::msg_post( p_msg ); } - void javascript_post( string s_msg ) - { - string s_js = "<script language=\"JavaScript\">"+s_msg+"</script>\n"; - base<user>::msg_post( &s_js ); - } - string get_bold_name() { return "<b>" + get_name() + "</b>"; diff --git a/src/chat/user.cpp b/src/chat/user.cpp index d46f853..c5699e2 100755 --- a/src/chat/user.cpp +++ b/src/chat/user.cpp @@ -411,7 +411,7 @@ user::command( string &s_command ) string s_command2 = s_command.substr(0, pos2-1); s_mod.append( s_command2 ).append( ".so" ); - dynmod *mod = wrap::MODL->get_module( s_mod, get_name() ); + dynmod *mod = wrap::MODL->get_module( s_mod ); if ( mod == NULL || wrap::CHAT->get_command_disabled( s_command2 ) || @@ -454,7 +454,7 @@ user::command( string &s_command ) c->elem[2] = (void*) ¶ms; c->elem[3] = (void*) wrap::WRAP; - ( *(mod->the_func) ) ( static_cast<void*>(c) ); + ( *(mod->the_func) ) ( (void*) c ); delete c; } diff --git a/src/cli/CVS/Entries b/src/cli/CVS/Entries index 10c9656..a4cf157 100644 --- a/src/cli/CVS/Entries +++ b/src/cli/CVS/Entries @@ -1,3 +1,3 @@ -/cli.cpp/1.28/Mon Feb 28 18:03:02 2005// -/cli.h/1.13/Mon Feb 21 02:14:23 2005// +/cli.cpp/1.26/Mon Feb 21 01:55:49 2005// +/cli.h/1.12/Mon Feb 21 01:55:49 2005// D diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 96a0010..2956264 100755 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -30,15 +30,15 @@ cli::parse_input( string s_input ) if ( s_input.compare("help") == 0 || s_input.compare("h") == 0) { - cout << CLIPRMO << "COMMAND LINE INTERFACE HELP MENU" << endl - << CLIPRMO << " !command - Uses system to run a command" << endl; + cout << CLIPRMO << "COMMAND LINE INTERFACE HELP MENU" << endl; + cout << CLIPRMO << " !command - Uses system to run a command" << endl; #ifdef DEBUG cout << CLIPRMO << " (d)ebug - Starts debug routine (cli.cpp)" << endl; #endif - cout << CLIPRMO << " (e)cho VAR - Prints out configuration value of VAR" << endl; - cout << CLIPRMO << " Wildcards can be used too, example: echo http*" << endl; + cout << CLIPRMO << " (e)cho VAR - Prints out configuration value of VAR" << endl + << CLIPRMO << " Wildcards can be used too, example: echo http*" << endl; #ifdef NCURSES cout << CLIPRMO << " (ex)it - Quits CLI mode and respawns ncurses mode" << endl; @@ -70,9 +70,8 @@ cli::parse_input( string s_input ) system( s_input.substr(1).c_str() ); cout << CLIPRMI; } - #ifdef DEBUG - else if ( s_input.compare("d") == 0 || s_input.compare("debug") == 0 ) + else if( s_input.compare("d") == 0 || s_input.compare("debug") == 0 ) { debug_routine(); cout << CLIPRMI; diff --git a/src/cli/cli.h b/src/cli/cli.h index 23e1d1c..88b99ef 100755 --- a/src/cli/cli.h +++ b/src/cli/cli.h @@ -24,14 +24,13 @@ using namespace std; +class cli #ifndef NCURSES -class cli : public thro -{ -#else -class cli -{ + : public thro #endif -private: +{ + + private: int parse_input(string s_input); public: diff --git a/src/conf/CVS/Entries b/src/conf/CVS/Entries index cfb51ed..f88663f 100644 --- a/src/conf/CVS/Entries +++ b/src/conf/CVS/Entries @@ -1,3 +1,3 @@ -/conf.cpp/1.14/Sun Feb 27 06:28:53 2005// -/conf.h/1.11/Sun Feb 27 06:28:53 2005// +/conf.cpp/1.13/Mon Feb 21 01:55:49 2005// +/conf.h/1.10/Mon Feb 21 01:55:49 2005// D diff --git a/src/conf/conf.cpp b/src/conf/conf.cpp index 38c29c4..f053d85 100755 --- a/src/conf/conf.cpp +++ b/src/conf/conf.cpp @@ -36,7 +36,6 @@ conf::conf( string s_conf, map<string,string>* p_start_params ) : name::name( s_ cout << CFILEFA << endl; exit(1); } - else { cout << CFILEOK << "..." << endl; @@ -77,18 +76,12 @@ conf::parse_xml(TiXmlNode* p_node, vector<string>* p_vec) { //cout << p_vec->size() << ": (Value:" << p_child->Value() << ") (Type:" << p_child->Type() << ")" << endl; - if ( strcmp(p_child->Value(),"config") == 0 ) - { - parse_xml(p_child, p_vec); - } - - else if ( strcmp(p_child->Value(),"category") == 0 ) + if ( strcmp(p_child->Value(),"category") == 0 ) { p_vec->push_back(p_child->ToElement()->Attribute("name")); parse_xml(p_child, p_vec); p_vec->pop_back(); } - else if ( strcmp(p_child->Value(),"option") == 0 ) { string s_option_name = ""; @@ -171,10 +164,4 @@ conf::colored_error_msg(string s_key) } //*>> -int -conf::get_int(string s_key) -{ - return tool::string2int(get_elem(s_key)); -} - #endif diff --git a/src/conf/conf.h b/src/conf/conf.h index 5be2740..20aa91c 100755 --- a/src/conf/conf.h +++ b/src/conf/conf.h @@ -22,8 +22,7 @@ public: conf(string s_conf, map<string,string>* p_start_params); ~conf(); - string colored_error_msg(string s_key); //<< - int get_int(string s_key); + string colored_error_msg( string s_key ); //<< }; #endif diff --git a/src/configure b/src/configure index 8c5f0a7..7bb48df 100755 --- a/src/configure +++ b/src/configure @@ -1,1555 +1,262 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +#!/bin/sh +# +# The yChat Project (2003 - 2004) # -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -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' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -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 - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # 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 ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$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" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) 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) - # 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 << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --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 -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$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) - 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 ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - 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 "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# 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 - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=s_chat.h - -# 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_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - 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 "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# 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 "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -#AC_INIT_AUTOMAKE(yChat, 0.2) - -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:528: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 533 "configure" -#include "confdefs.h" - -int main() { - -#ifndef __CYGWIN__ -#define __CYGWIN__ __CYGWIN32__ -#endif -return __CYGWIN__; -; return 0; } -EOF -if { (eval echo configure:544: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:561: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 566 "configure" -#include "confdefs.h" - -int main() { -return __MINGW32__; -; return 0; } -EOF -if { (eval echo configure:573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:590: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 605 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 622 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 639 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -for ac_prog in $CCC c++ g++ gcc CC cxx cc++ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:674: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:706: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 717 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:748: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:753: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:781: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi - - - -echo $ac_n "checking for library containing dlopen""... $ac_c" 1>&6 -echo "configure:815: checking for library containing dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_search_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_func_search_save_LIBS="$LIBS" -ac_cv_search_dlopen="no" -cat > conftest.$ac_ext <<EOF -#line 822 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_dlopen="none required" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -test "$ac_cv_search_dlopen" = "no" && for i in dl; do -LIBS="-l$i $ac_func_search_save_LIBS" -cat > conftest.$ac_ext <<EOF -#line 844 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_dlopen="-l$i" -break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -LIBS="$ac_func_search_save_LIBS" -fi - -echo "$ac_t""$ac_cv_search_dlopen" 1>&6 -if test "$ac_cv_search_dlopen" != "no"; then - test "$ac_cv_search_dlopen" = "none required" || LIBS="$ac_cv_search_dlopen $LIBS" - -else : - -fi -if test "$ac_cv_search_dlopen" = "-ldl"; then -LDFLAGS="$ac_cv_search_dlopen" -fi -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:883: checking for $ac_hdr that defines DIR" >&5 -if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 888 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <$ac_hdr> -int main() { -DIR *dirp = 0; -; return 0; } -EOF -if { (eval echo configure:896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - ac_header_dirent=$ac_hdr; break -else - echo "$ac_t""no" 1>&6 -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 $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:921: checking for opendir in -ldir" >&5 -ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldir $LIBS" -cat > conftest.$ac_ext <<EOF -#line 929 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* 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; } -EOF -if { (eval echo configure:940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -ldir" -else - echo "$ac_t""no" 1>&6 -fi - -else -echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:962: checking for opendir in -lx" >&5 -ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lx $LIBS" -cat > conftest.$ac_ext <<EOF -#line 970 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* 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; } -EOF -if { (eval echo configure:981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lx" -else - echo "$ac_t""no" 1>&6 -fi - -fi - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1004: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1009 "configure" -#include "confdefs.h" -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1034 "configure" -#include "confdefs.h" -#include <string.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - 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 <<EOF -#line 1052 "configure" -#include "confdefs.h" -#include <stdlib.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - 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 <<EOF -#line 1073 "configure" -#include "confdefs.h" -#include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#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); } -EOF -if { (eval echo configure:1084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if ! which perl >/dev/null then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - + echo You need to have Perl in your PATH + exit 1 fi -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1111: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1116 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -for ac_hdr in string.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1151: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1156 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF +if ! test -f ../g++.version +then + echo You need to run ./configure of the top level source dir first + exit 1 +fi + +perl -e ' + use strict; + $|=1; + + my %libadd; + my %incadd; + my $deepness = 500; + + my @headers = ( + "dlfcn.h", + "pthread.h", + "mysql/mysql.h", #//<< Not needed for yhttpd + "netinet/in.h", + "time.h", + "ncurses.h", + "ext/hash_map" + ); + + my @libs = ( + "libmysqlclient.so", #//<< Not needed for yhttpd + "libncurses.so" + ); + + sub remove_from_array + { + my $elem = shift; + my $array = shift; + + for ( my $i = 0; $i <= $#$array; ++$i ) + { + if ( $$array[$i] eq $elem ) + { + splice(@$array,$i,1); + last; + } + } + } + + open FILE, "glob.h" or die "glob.h: $!\n"; + while(<FILE>) + { + if ( /\/\/#define DATABASE/ ) + { + remove_from_array("mysql/mysql.h",\@headers); + remove_from_array("libmysqlclient.so",\@libs); + } + + elsif ( /\/\/#define NCURSES/ ) + { + remove_from_array("ncurses.h",\@headers); + remove_from_array("libncurses.so",\@libs); + } + } + close FILE; + + my @headerpaths = ( + $ENV{HOME}."/include", + $ENV{HOME}."/usr/include", + "/include", + "/usr/include", + "/usr/local/include", + "/usr/lib/", + "/usr/pkg/include", + "/opt/include", + "/opt/local/include" + ); + + my @libpaths = ( + $ENV{HOME}."/lib", + $ENV{HOME}."/usr/lib", + "/lib", + "/usr/lib", + "/usr/local/lib", + "/usr/pkg/lib", + "/opt/lib", + "/opt/local/lib" + ); + + if ( defined $ENV{YCHATHEADERPATHS} ) { + map { print "Adding $_...\n"; + unshift @headerpaths, $_ } split /:/, $ENV{YCHATHEADERPATHS}; + } + + if ( defined $ENV{YCHATLIBPATHS} ) { + map { print "Adding $_...\n"; + unshift @libpaths, $_ } split /:/, $ENV{YCHATLIBPATHS}; + } + + sub check { + my $deep = shift; + + if ($deep == 0) { + print "Looking too deep! ($deepness)\n"; + exit(1); + } + + my $check = shift; + my $print = 1; + if ( $_[-1] eq "subsearch" ) { + $print = 0; + pop(@_); + } + + print "Checking for $check... " if $print; + foreach (@_) { + if ( -f "$_/$check" ) { + print "OK\n"; + return "" if $_ eq "/usr/lib" or $_ eq "/usr/include"; + return $_; + } + } + + foreach (@_) { + next unless -d $_; + opendir D, $_ or warn "$_: $!\n"; my @dir = readdir(D); + closedir D; + foreach my $dir ( @dir ) { + next if $dir =~ /^\.+$/ or !-d "$_/$dir"; + my $path = &check($deep-1, $check, "$_/$dir", "subsearch"); + return $path if $path ne ""; + } + } + + if ($print) { + print "NOT OK\n"; + print "Please make sure that you have the needed software installed!\n"; + print "If you have a special path for your includes then edit src/configure!\n"; + print "Or set the environment variables YCHATHEADERPATHS and YCHATLIBPATHS.\n"; + print " Example: setenv YCHATHEADERPATHS \"/your/header/includes:/a/includes\"\n"; + print "(The environment variables have to be seperated by an :)\n"; + print "PS: You may use the locate and/or find command to search for files.\n"; + exit(1); + } + `touch ../err`; + return ""; + } + + print "Headers:\n"; + + map { $incadd{&check($deepness, $_, @headerpaths)}++ } + @headers; + + print "Libraries:\n"; + map { $libadd{&check($deepness, $_, @libpaths)}++ } + @libs; + + sub makeadd { + my $flag = shift; + my $add = shift; + my $ret = ""; + + foreach (keys %$add) { + next unless /.+/; + $ret .= "$flag$_ "; + } + return $ret; + } + + my $incadd = &makeadd("-I", \%incadd); + my $libadd = &makeadd("-L", \%libadd); + + foreach ( @libs ) + { + $libadd .= "-l$_ " + if s/^lib// and s/\.so$//; + } + + print "Incadd: $incadd\n"; + print "Libadd: $libadd\n"; + + `echo $incadd > includes.add`; + `echo $libadd > libs.add`; + + print "Creating new base Makefile...\n"; + unlink("Makefile") if -f "Makefile"; + open Fin, "Makefile.in" or die "Makefile.in: $!\n"; + open Fout, ">Makefile" or die "Makefile: $!\n"; + + my $cpp = `echo *.cpp */*.cpp contrib/*/*.cpp | sort`; + my $compiler = `tail -n 1 ../g++.version`; + my $version = `tail -n 2 ../g++.version | head -n 1`; + my $uname = `uname -srm`; + my $compopt = join "; ", split /\n/, `cat ../g++.version`; + chomp $uname; + chomp $compopt; + print "Configuring for $uname...\n"; + chomp $cpp; + chomp $version; + while (<Fin>) { + s/^(CC=).*\n/$1$compiler/; + s/^(SRCS=).*/$1$cpp/; + s/ -frepo//; # unless $version =~ /3\.4/; + if ( $uname !~ /Linux/i ) { + print "Disabling -ldl flag...\n" if s/ -ldl//; + } + print Fout; + } + close Fin; -else - echo "$ac_t""no" 1>&6 -fi -done - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1188: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1193 "configure" -#include "confdefs.h" - -int main() { - -/* 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; -} - -; return 0; } -EOF -if { (eval echo configure:1242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1263: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <<EOF -#line 1270 "configure" -#include "confdefs.h" - -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:1277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_inline=$ac_kw; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done - -fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in - inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <<EOF -#define inline $ac_cv_c_inline -EOF - ;; -esac - - - -trap '' 1 2 15 -cat > confcache <<\EOF -# 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. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# 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 \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@CPP@%$CPP%g -s%@CXX@%$CXX%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# 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_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # 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" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - + my $args = join(" -",@ARGV); + $args = "-".$args unless $args eq ""; + + foreach my $cppfile (split / /, $cpp) { + my $ofile = $cppfile; + $ofile =~ s/\.cpp/\.o/; + print Fout "../obj/$ofile: $cppfile\n"; + print Fout "\t\@if ! test -d `dirname ../obj/$ofile`; then mkdir -p `dirname ../obj/$ofile`; fi\n"; + if ( $ofile =~ /contrib\/.+/ ) { + my $dirname = `dirname $ofile`; + print Fout "\t\@echo -n \"Compiling contributed class $ofile \"\n"; + } else { + print Fout "\t\@echo -n \"Compiling base class $ofile \"\n"; + } + print Fout "\t\@\$(CC) \$(CFLAGS) \$(INCLUDES) $args -c -o ../obj/$ofile $cppfile\n"; + print Fout "\t\@du -hc ../obj/$ofile | tail -n 1 | sed s/total// | sed \"s/ //g\"\n"; + } + + close Fout; + + open F, "msgs.h" or die "msgs.h: $!\n"; + my @msgs = <F>; + close F; + unlink("msgs.h"); + open F, ">msgs.h" or die "msgs.h: $!\n"; + foreach (@msgs) { + s/(UNAME)(.+)$/UNAME "$uname"/; + s/(COMPOPT)(.+)$/COMPOPT "$compopt"/; + print F; + } + close F; + + if ( -d "mods" ) { + chdir("mods"); + my $cflags = "-fno-inline -fno-default-inline"; + $cflags .= " -nostdlib" + if $uname =~ /FreeBSD/i + && `uname -r` =~ /^4\./; + system("echo $cflags > cflags.add"); + system("./configure"); + chdir(".."); + } + + exit(0); + +' `echo "$*" | sed "s/-//g"` diff --git a/src/data/CVS/Entries b/src/data/CVS/Entries index 1c04c12..f4f473a 100644 --- a/src/data/CVS/Entries +++ b/src/data/CVS/Entries @@ -3,8 +3,8 @@ /con.h/1.7/Mon Feb 21 01:55:49 2005// /con_base.cpp/1.7/Fri Jan 7 21:17:53 2005// /con_base.h/1.8/Mon Feb 21 01:55:49 2005// -/data.cpp/1.13/Fri Feb 25 00:52:24 2005// -/data.h/1.10/Fri Feb 25 00:52:24 2005// -/data_base.cpp/1.15/Sun Mar 6 20:44:47 2005// -/data_base.h/1.12/Sun Mar 6 20:44:47 2005// +/data.cpp/1.12/Mon Feb 21 01:55:49 2005// +/data.h/1.9/Mon Feb 21 01:55:49 2005// +/data_base.cpp/1.14/Mon Feb 21 01:55:49 2005// +/data_base.h/1.11/Mon Feb 21 01:55:49 2005// D diff --git a/src/data/data.cpp b/src/data/data.cpp index fa509dd..fe994ea 100644 --- a/src/data/data.cpp +++ b/src/data/data.cpp @@ -80,13 +80,13 @@ data::parse_result( MYSQL_RES* p_result, vector<string>& vec_elements ) } void -data::insert_user_data( string s_user, string s_query, map<string,string> insert_map ) +data::insert_user_data( string s_user, string s_query, hashmap<string> insert_map ) { insert_query( s_query, insert_map ); } void -data::insert_query( string s_query, map<string,string> map_insert ) +data::insert_query( string s_query, hashmap<string> map_insert ) { vector<string> vec_elements = map_queries[s_query]; vector<string>::iterator iter = vec_elements.begin(); diff --git a/src/data/data.h b/src/data/data.h index a6ca90f..a9a75f2 100644 --- a/src/data/data.h +++ b/src/data/data.h @@ -14,14 +14,14 @@ class data : public data_base // data implementation used in data.h private: MYSQL_RES* select_query( string s_query, string s_where_rule, vector<string>& vec_elements ); hashmap<string> parse_result( MYSQL_RES* p_result, vector<string>& vec_elements ); - void insert_query( string s_query, map<string,string> map_insert ); + void insert_query( string s_query, hashmap<string> map_insert ); string secure_query( string s_mysql_query ); public: data( ); ~data( ); hashmap<string> select_user_data( string s_user, string s_query ); - void insert_user_data( string s_user, string s_query, map<string,string> insert_map ); + void insert_user_data( string s_user, string s_query, hashmap<string> insert_map ); void update_user_data( string s_user, string s_query, hashmap<string> update_map ); }; diff --git a/src/data/data_base.cpp b/src/data/data_base.cpp index 8150608..05f4e0a 100644 --- a/src/data/data_base.cpp +++ b/src/data/data_base.cpp @@ -47,7 +47,7 @@ data_base::data_base( ) } } -void data_base::init_connections() +void data_base::initialize_connections() { int i_min_con = tool::string2int( wrap::CONF->get_elem("chat.database.mincon") ), i_max_con = tool::string2int( wrap::CONF->get_elem("chat.database.maxcon") ); diff --git a/src/data/data_base.h b/src/data/data_base.h index 79f5630..1da5ce7 100644 --- a/src/data/data_base.h +++ b/src/data/data_base.h @@ -36,7 +36,7 @@ public: data_base(); ~data_base(); - void init_connections(); + void initialize_connections(); virtual hashmap<string> select_user_data( string s_user, string s_query ); virtual void insert_user_data( string s_user, string s_query, hashmap<string> insert_map ); virtual void update_user_data( string s_user, string s_query, hashmap<string> update_map ); @@ -1,35 +1,181 @@ -// global variables. +/* + Notice: + + All #defines which start with an CONFIG can be edited through + gmake config in the main directory! +*/ +#include "maps/hashmap.h" + +// global variables. #ifndef GLOB_H #define GLOB_H -#include <map> -#include <pthread.h> - -// definition of boolean values. +// Definition of boolean values. #define true 1 #define false 0 -// config filename. -#define CONFILE "conf.txt" - -// the highest port which is allowed to use. if ychat is unable to create the server -// socket it will increment the port number and tries to create another socket. -// this procedure will go on until MAXPORT is reached. +/* - CONFIG - + What should be the name of the config file? +*/ +#define CONFILE "ychat.conf" + +/* - CONFIG - + In which prefix should yChat be installed if typing gmake inst- + all? +*/ +#define PREFIX "/usr/local" + +//<<* +/* - CONFIG - + Should yChat get compiled with database support? Currently MyS- + QL only is a supported database. +*/ +//#define DATABASE + +#ifdef DATABASE +/* - CONFIG - + Should all database queries printed out at the admin interface? + (This option wont take action if database support has not been + chosen) +*/ +#define DATA_PRINT_QUERIES + +#define USE_MYSQL +#endif +//*>> + +/* - CONFIG - + Please enter the highest networking port which is allowed to be + used. If yChat is unable to create the server socket on a cert- + ain port, it will increment the port number and retries to cre- + ate another socket on the incremented port number. This proced- + ure will continue until MAXPORT has been reached. +*/ #define MAXPORT 65535 -// max length of a line read from a socket or a file ( config-file, html-template ). -#define READBUF 1024 - -// definition for verbosity level 0 ( normal outputs ). see vmsg.h for custumizing all -// the messages. this messages will only printed out by the master thread. -#define VERBOSE - -// Defines the amount of newlines which have to send to the client's -// chat stream the first log-in. ( prevents white screen because of buffers -// or proxies ). -#define PUSHSTR 1000 +/* - CONFIG - + Please specify the maximum length of a line read from a socket + or a file. ( config-file, html-template ) +*/ +#define READSOCK 2048 + +/* - CONFIG - + Please specify the size of a temporary buffer. (Will be used f- + or different tasks) +*/ +#define READBUF 2048 + +/* - CONFIG - + Please specify the maximum length of a HTTP post request. +*/ +#define POSTBUF 512 + +/* - CONFIG - + Please specify the maximum occupancy of the internal hash-map + data structures given in percentage. 0.9 means 90% iccupancy. +*/ +#define HMAPOCC .9 + +/* - CONFIG - + Please chose if you want to use verbose server outputs or not. + The verbose messages will appear in the ncurses menu if ncurses + is enabled or in the server-window if yChat has been compiled + without ncurses support. This option shows you all incoming + requests with the client IP and port numbers. You probably want + this to be turned off if you have heavy server load. +*/ +//#define VERBOSE + +/* - CONFIG - + If you want to enable EXPERIMENTAL features, then set this val- + ue to true. Else use false which is recommended! All experimen- + al features are marked inside of the running yChat! +*/ +//#define EXPERIM + +/* - CONFIG - + Should yChat get compiled with logging support? +*/ +#define LOGGING + +/* - CONFIG - + Should yChat get compiled with ncurses support? +*/ +#define NCURSES + +/* - CONFIG - + Should yChat get compiled with comand line interface support? +*/ +#define CLI + + +/* - CONFIG - + DO NOT USE TOGETHER WITH NCURSES! Displays important server mes- + ages. This one will print all messages to stdout if no NCURSES + is defined. Don't use this until NCURSES is defined! all messag- + es will appear in the ncurses interface anyways. +*/ +//#define SERVMSG + +// Enables debugging options +//#define DEBUG + +//<<* +/* - CONFIG - + Defines the amount of newlines which have to be sent to the clie- + nt's chat stream after the first log-in. It prevents a white scr- + een because of browser buffers or proxies. +*/ +#define PUSHSTR 500 +//*>> + + +// The following values define the positions of the data stats in the NCURSES interface. +#ifdef NCURSES +#define NCUR_SERVER_HEADER_X 21 +#define NCUR_SERVER_HEADER_Y 2 +#define NCUR_PORT_X 22 +#define NCUR_PORT_Y 2 +#define NCUR_HITS_X 23 +#define NCUR_HITS_Y 2 + +#define NCUR_POOL_HEADER_X 21 +#define NCUR_POOL_HEADER_Y 18 +#define NCUR_POOL_SIZE_X 22 +#define NCUR_POOL_SIZE_Y 18 +#define NCUR_POOL_RUNNING_X 23 +#define NCUR_POOL_RUNNING_Y 18 + +#define NCUR_DATA_HEADER_X 21 +#define NCUR_DATA_HEADER_Y 35 +#define NCUR_GARBAGE_X 22 +#define NCUR_GARBAGE_Y 35 +#define NCUR_CON_QUEUE_X 23 +#define NCUR_CON_QUEUE_Y 35 + +#define NCUR_CHAT_HEADER_X 21 +#define NCUR_CHAT_HEADER_Y 52 +#define NCUR_NUM_ROOMS_X 22 +#define NCUR_NUM_ROOMS_Y 52 +#define NCUR_SESSION_X 23 +#define NCUR_SESSION_Y 52 + +#define NCUR_CACHED_HEADER_X 21 +#define NCUR_CACHED_HEADER_Y 68 +#define NCUR_CACHED_DOCS_X 22 +#define NCUR_CACHED_DOCS_Y 68 +#define NCUR_CACHED_MODS_X 23 +#define NCUR_CACHED_MODS_Y 68 + +#define NCUR_MENU_CHAR_X 0 +#define NCUR_MENU_CHAR_Y 33 +#define NCUR_UPTIME_X 0 +#define NCUR_UPTIME_Y 44 +#define NCUR_TIME_X 0 +#define NCUR_TIME_Y 64 +#endif ////////////////////////////////////////////////////////////////////////////////////////// // DO NOT CHANGE ANYTHING BEHIND THIS LINE! @@ -37,32 +183,24 @@ using namespace std; -// internal rang descriptors ( their external names may be specified different ) -enum rang -{ - CODER , // programmer. - ADMIN , // administrator. - MAGIC , // super user with special privileges. - SUPER , // temporary super user. - BASIC , // normal user without special privileges. - GUEST , // guest user, has almost no privileges. - RESTR , // a very restrivted user. - OUTBN // banned out of the system. -}; - -// some custom typedefs for datatypes which are needed often. -typedef map<string, string> map_string; typedef int function( void *v_arg ); struct container { - void* elem[3]; + void* elem[4]; }; struct dynmod { - function *the_func ; - void *the_module; + function *the_func ; + void *the_module; }; +typedef enum method_ { + METH_NCURSES, + METH_RETSTRING +} method; + +// Define external executables: +#define GMAKE "/usr/local/bin/gmake \0" #endif diff --git a/src/html.cpp b/src/html.cpp index 50cf1e6..e9b4bf7 100755 --- a/src/html.cpp +++ b/src/html.cpp @@ -1,94 +1,88 @@ -// class html implementation. - -#ifndef s_html_CXX -#define s_html_CXX +#ifndef HTML_CPP +#define HTML_CPP #include <fstream> #include "html.h" -#include "s_chat.h" -#include "s_mutx.h" using namespace std; html::html( ) { - set_name( s_conf::get - ().get_val( "HTMLTEMP" ) ); - pthread_mutex_init( &mut_map_vals, NULL ); + set_name( wrap::CONF->get_elem( "httpd.templatedir" ) ); } html::~html( ) -{ - pthread_mutex_destroy( &mut_map_vals ); -} +{} void html::clear_cache( ) { - pthread_mutex_lock ( &mut_map_vals ); - clear_vals(); - pthread_mutex_unlock( &mut_map_vals ); + clear(); + wrap::system_message( CLRHTML ); + +#ifdef NCURSES + + print_cached( 0 ); +#endif } string -html::parse( map_string &map_params ) +html::parse( hashmap<string> &map_params ) { string s_file = map_params["request"]; // check if s_file is in the container. - pthread_mutex_lock ( &mut_map_vals ); - string s_templ = get_val( s_file ); - pthread_mutex_unlock( &mut_map_vals ); + string s_templ; // if not, read file. - if ( s_templ.empty() ) + if ( ! shashmap<string>::exists( s_file ) ) { - auto string s_path = get_name(); - auto ifstream fs_templ( s_path.append( s_file ).c_str(), ios::binary ); + string s_path = get_name(); + ifstream if_templ( s_path.append( s_file ).c_str(), ios::binary ); - if ( ! fs_templ ) + if ( ! if_templ ) { + wrap::system_message( OFFFOUND + s_path ); + if(map_params["request"]== wrap::CONF->get_elem( "httpd.html.notfound" )) + return ""; - cerr << "File not found: " << s_file << endl; - if(map_params["request"]==s_conf::get - ().get_val( "NOTFOUND" )) - return ""; - - map_params["request"] = s_conf::get - ().get_val( "NOTFOUND" ); + map_params["request"] = wrap::CONF->get_elem( "httpd.html.notfound" ); return parse( map_params ); } - auto char c_buf; - while( !fs_templ.eof() ) + char c_buf; + while( !if_templ.eof() ) { - fs_templ.get( c_buf ); - s_templ+=c_buf; + if_templ.get( c_buf ); + s_templ += c_buf; } - fs_templ.close(); + if ( map_params["content-type"].compare(0,5,"text/") == 0 ) + s_templ.erase(s_templ.end()-1); -#ifdef VERBOSE + if_templ.close(); - pthread_mutex_lock ( &s_mutx::get - ().mut_stdout ); - cout << TECACHE << s_path << endl; - pthread_mutex_unlock( &s_mutx::get - ().mut_stdout ); -#endif + wrap::system_message( TECACHE + s_path ); // cache file. - pthread_mutex_lock ( &mut_map_vals ); - map_vals[ s_file ] = s_templ; - pthread_mutex_unlock( &mut_map_vals ); + shashmap<string>::add_elem(s_templ, s_file); +#ifdef NCURSES + + print_cached( shashmap<string>::size() ); +#endif + + } + else + { + s_templ = shashmap<string>::get_elem( s_file ); } // find %%KEY%% token and substituate those. - auto unsigned int pos[2]; + unsigned pos[2]; pos[0] = pos[1] = 0; - do + for(;;) { pos[0] = s_templ.find( "%%", pos[1] ); @@ -102,9 +96,8 @@ html::parse( map_string &map_params ) break; // get key and val. - auto string s_key = s_templ.substr( pos[0], pos[1]-pos[0] ); - auto string s_val = s_conf::get - ().get_val( s_key ); + string s_key = s_templ.substr( pos[0], pos[1]-pos[0] ); + string s_val = wrap::CONF->get_elem( s_key ); // if s_val is empty use map_params. if ( s_val.empty() ) @@ -114,34 +107,44 @@ html::parse( map_string &map_params ) s_templ.replace( pos[0]-2, pos[1]-pos[0]+4, s_val ); // calculate the string displacement. - auto int i_dif = s_val.length() - ( pos[1] - pos[0] + 4); + int i_diff = s_val.length() - ( pos[1] - pos[0] + 4); - pos[1] += 2 + i_dif; + pos[1] += 2 + i_diff; - } - while( true ); + }; return s_templ; } +//<<* void -html::online_list( user *p_user, map_string &map_params ) +html::online_list( user *p_user, hashmap<string> &map_params ) { // prepare user_list. - string s_list ( "" ); - string s_seperator( "<br>" ); + string s_list; + + room* p_room = p_user->get_room(); - p_user->get_p_room()->get_user_list( s_list, s_seperator ); + p_room->get_user_list( s_list ); - // use the collected data as a message in html-templates. - map_params["MESSAGE"] = s_list; + map_params["ROOMNAME"] = p_room->get_name(); + map_params["ROOMTOPIC"] = p_room->get_topic(); + map_params["USERLIST"] = s_list; +} +//*>> - // renew the timestamp. - p_user->renew_stamp(); +#ifdef NCURSES +void +html::print_cached( int i_docs ) +{ + if ( !wrap::NCUR->is_ready() ) + return; - // send a ping to the client chat stream. - p_user->msg_post( new string("\n") ); + mvprintw( NCUR_CACHED_DOCS_X, NCUR_CACHED_DOCS_Y, "Docs: %d ", i_docs); + refresh(); } #endif +#endif + @@ -1,42 +1,40 @@ // class html declaration. this class manages the html-template files. +#include "incl.h" -#ifndef s_html_H -#define s_html_H +#ifndef HTML_H +#define HTML_H -#include "incl.h" -#include "cont.h" -#include "s_conf.h" -#include "user.h" +#include "maps/shashmap.h" +#include "chat/user.h" #include "name.h" - using namespace std; -class html : public cont, name +class html : public shashmap<string>, name { -private: - // needed for synchronizing the map_vals. - pthread_mutex_t mut_map_vals; - public: - // public methods. - explicit html( ); // simple constructor. + html( ); ~html( ); - // clears the template cache so that new html templates will be read - // from hard disk. this method is needed after changeing s.t. on + // Clears the template cache so that new html templates will be read + // from hard disk. This method is needed after changeing s.t. on // the html-template files. void clear_cache( ); - // returns a parsed html-template. this method will check first if the + // Returns a parsed html-template. this method will check first if the // required html-template exists inside the classes template cache. if not // then the file will be read from file and added to the cache. // afterwards the html-template will be parsed and returned. // map_params contains the client request parameters which also will be // used for string substituation. - virtual string parse( map_string &map_params ); + string parse( hashmap<string> &map_params ); + + void online_list( user *p_user, hashmap<string> &map_params ); //<< +#ifdef NCURSES + + void print_cached( int i_docs ); +#endif - virtual void online_list( user *p_user, map_string &map_params ); }; #endif @@ -1,16 +1,13 @@ -// contains header files which are included by all classes. - -// include some std headers. -#include <iostream> - -// since thread synchronization is a big issue this header needs -// to be included by every other file too. #include <pthread.h> - -// std::string. +#include <iostream> #include <string> +//#include <map> -// include all the custom global variables. #include "glob.h" -// include all the custom messages. + +#ifdef NCURSES +#include <ncurses.h> +#endif + #include "msgs.h" +#include "wrap.h" diff --git a/src/logd.cpp b/src/logd.cpp index e120fd8..b572a42 100755 --- a/src/logd.cpp +++ b/src/logd.cpp @@ -35,9 +35,6 @@ logd::initialize( string s_filename, int i_log_lines ) exit(1); } - //if (wrap::NCUR->is_ready()) - // wrap::system_message(LOGGINI+s_filename); - s_logfile = s_filename; i_lines = i_log_lines; } @@ -60,6 +57,7 @@ void logd::flush() { ofstream of_output; + of_output.open(s_logfile.c_str(), ios::app); if( of_output == NULL ) @@ -79,10 +77,8 @@ logd::flush() } void -logd::log_access( map<string,string> &map_request ) +logd::log_access( hashmap<string> &map_request ) { - //static int i_access_lines = wrap::CONF->get_elem("httpd.logging.accesslines"); - string s_time = get_time_string(); string s_logstr = map_request["REMOTE_ADDR"] + " - - "+s_time+" \"" + map_request["QUERY_STRING"]+"\" 200 0 \""+map_request["request"]+"\" \""+map_request["User-Agent"]+"\"\n"; @@ -7,6 +7,8 @@ #include <queue> #include <time.h> +#include "maps/hashmap.h" + class logd { private: @@ -26,7 +28,7 @@ public: ~logd(); void set_logfile( string s_path, string s_filename ); - void log_access( map<string,string> &map_request ); + void log_access( hashmap<string> &map_request ); void log_simple_line( string s_line ); void flush_logs(); static string remove_html_tags( string s_log ); diff --git a/src/main.cpp b/src/main.cpp index 6a96c38..3470148 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ /* - * yChatContact: www.yChat.org; Mail@yChat.org + * yChat; Contact: www.yChat.org; Mail@yChat.org * Copyright (C) 2003 Paul C. Buetow, Volker Richter - * Copyright (C) 2005 Paul C. Buetow + * Copyright (C) 2004, 2005 Paul C. Buetow * ----------------------------------------------------------------- * * This program is free software; you can redistribute it and/or @@ -20,78 +20,171 @@ * */ -// needed for ignoring SIGPIPE. +#include <unistd.h> #include <signal.h> - -// include header files which are included from every class too. #include "incl.h" -// include the chat manager. -#include "s_chat.h" - -// include the config manager. -#include "s_conf.h" - -// include the html-template manager. -#include "s_html.h" - -// include the mutex manager for global synchronization. -#include "s_mutx.h" - -// include the socket manager. -#include "s_sock.h" - -// include the language manager -#include "s_lang.h" +#ifndef NCURSES +#ifdef CLI +#include "cli/cli.h" +#endif +#endif -// include the session manager -#include "s_sman.h" +#include "maps/hashmap.h" using namespace std; -int main() +map<string,string>* +parse_argc( int argc, char* argv[] ) { -#ifdef VERBOSE + map<string,string>* start_params = new map<string,string>; + + string s_output = ""; + + // Set to 1 if a config option key has to be read + // ( ./ychat -o key1 value1 -o key2 value2 ... ); + bool b_conf = 0; + + // Will store the key of an additional option value (see also b_conf) + string s_key; + + for (int i=1; argv[i] != 0; i++) + { + if ( !s_key.empty() ) + { + (*start_params)[s_key] = string(argv[i]); + s_key.clear(); + } + else if ( b_conf ) + { + s_key = string(argv[i]); + b_conf = 0; + } + else + { + if ( string(argv[i]).find("v") != string::npos ) + s_output.append(tool::ychat_version()+"\n"); + + if ( string(argv[i]).find("h") != string::npos ) + s_output.append( YCUSAGE ); + + if ( string(argv[i]).find("o") != string::npos ) + b_conf = 1; + } + } + + if ( !s_output.empty() ) + { + cout << s_output; + delete start_params; + exit(1); + } + + return start_params; +} - cout << " ___ _ _ " << endl - << " _ _ / __\\ |__ __ _| |_ " << endl - << "| | | |/ / | '_ \\ / _` | __|" << endl - << "| |_| / /___| | | | (_| | |_ " << endl - << " \\__, \\____/|_| |_|\\__,_|\\__|" << endl - << " |___/ " << endl << endl +int +main(int argc, char* argv[]) +{ + map<string,string>* p_start_params = parse_argc( argc, argv ); + cout << tool::ychat_version() << endl << DESCRIP << endl - << VERSION << ", " + << DESCRI2 << endl << CONTACT << endl - << SEPERAT << endl - << STARTMS << endl ; -#endif + << SEPERAT << endl; - // ignore SIGPIPE. otherwise the server will shut down with "Broken pipe" if + // Ignore SIGPIPE. otherwise the server will shut down with "Broken pipe" if // a client unexpected disconnects himself from a SOCK_STREAM. signal( SIGPIPE, SIG_IGN ); - // all the static data classes have to be initialized once. otherwise they will + // All the static data classes have to be initialized once. otherwise they will // contain only empty pointers and the chat server won't work correctly. // the order of the initializations is very importand. for example the s_html::init() - // invokations assumes an initialized s_conf class. - s_mutx::init(); // init the mutex manager. - s_conf::init(); // init the config manager. - s_html::init(); // init the html-template manager. - s_lang::init(); // init the language manager - s_sman::init(); // init the session manager. - s_sock::init(); // init the socket manager. - s_chat::init(); // init the chat manager. + // invokations assumes an initialized conf class. - // start the socket manager. this one will listen for incoming http requests and will - // forward them to the specified routines which will generate a http response. - s_sock::get - ().start(); + // Init the dynamic wrapper (is needed to pass all wrapped objects through a single pointer). + wrap::WRAP = new dynamic_wrap; -#ifdef VERBOSE + // Init the config manager. + wrap::WRAP->CONF = wrap::CONF = new conf( CONFILE, p_start_params ); + delete p_start_params, - cout << DOWNMSG << endl; + // Init the statistic manager. + wrap::WRAP->STAT = wrap::STAT = new stats; + + // Init the html-template manager. + wrap::WRAP->HTML = wrap::HTML = new html; + +#ifdef LOGGING + // Init the system message logd + wrap::WRAP->LOGD = wrap::LOGD = new logd( wrap::CONF->get_elem("httpd.logging.systemfile"), + wrap::CONF->get_elem("httpd.logging.systemlines") ); #endif + //<<* + // Init the session manager. + wrap::WRAP->SMAN = wrap::SMAN = new sman; + //*>> + + + // Init the socket manager. + wrap::WRAP->SOCK = wrap::SOCK = new sock; + +#ifdef NCURSES + + wrap::WRAP->NCUR = wrap::NCUR = new ncur; // init the ncurses admin interface. + wrap::NCUR->run(); // run the thread + + // Wait until ncurses interface has been initialized. + while ( ! wrap::NCUR->is_ready() ) + usleep(1000); + wrap::HTML->print_cached(0); +#endif + + //<<* + // Init the chat manager. + wrap::WRAP->CHAT = wrap::CHAT = new chat; + //*>> + + // Init the system timer. + wrap::WRAP->TIMR = wrap::TIMR = new timr; + wrap::TIMR->run(); // run the thread + + //<<* + // Init the module-loader manager. + wrap::WRAP->MODL = wrap::MODL = new modl; + + // Init the garbage collector + wrap::WRAP->GCOL = wrap::GCOL = new gcol; + + // Init the data manager. +#ifdef DATABASE + + wrap::WRAP->DATA = wrap::DATA = new data; +#endif + //*>> + +#ifndef NCURSES +#ifdef CLI + + cli* p_cli = new cli; + p_cli->run(); +#endif +#endif + + //<<* + // Initialize database connection queue +#ifdef DATABASE + + wrap::DATA->initialize_connections(); +#endif + //*>> + + // start the socket manager. this one will listen for incoming http requests and will + // forward them to the specified routines which will generate a http response. + wrap::SOCK->start(); + + cout << DOWNMSG << endl; return 0; } diff --git a/src/maps/CVS/Entries b/src/maps/CVS/Entries index 991bf8b..6033e5b 100644 --- a/src/maps/CVS/Entries +++ b/src/maps/CVS/Entries @@ -1,9 +1,11 @@ -/hashmap.h/1.12/Fri Mar 4 21:00:44 2005// -/hashmap.tmpl/1.6/Fri Mar 4 21:00:44 2005// +/hash.cpp/1.2/Mon Feb 21 01:55:49 2005// +/hash.h/1.2/Mon Feb 21 01:55:49 2005// +/hashmap.h/1.8/Mon Feb 21 01:55:49 2005// +/hashmap.tmpl/1.4/Mon Feb 21 01:55:49 2005// /mtools.h/1.7/Mon Feb 21 01:55:49 2005// /mtools.tmpl/1.6/Mon Feb 21 01:55:49 2005// -/nhashmap.h/1.5/Fri Mar 4 21:00:44 2005// -/nhashmap.tmpl/1.4/Fri Mar 4 21:00:44 2005// -/shashmap.h/1.8/Fri Mar 4 21:00:44 2005// -/shashmap.tmpl/1.6/Fri Mar 4 21:00:45 2005// +/nhashmap.h/1.2/Mon Feb 21 01:55:49 2005// +/nhashmap.tmpl/1.2/Mon Feb 21 01:55:49 2005// +/shashmap.h/1.5/Mon Feb 21 01:55:49 2005// +/shashmap.tmpl/1.4/Mon Feb 21 01:55:49 2005// D diff --git a/src/maps/hash.cpp b/src/maps/hash.cpp new file mode 100644 index 0000000..b3d80d1 --- /dev/null +++ b/src/maps/hash.cpp @@ -0,0 +1,26 @@ +#ifndef HASH_CPP +#define HASH_CPP + +#include "hash.h" + +int +hash::operator()(string s_key) const +{ + int i_hash = 0; + // cout << key << "%"; + + int i_size = s_key.size(); + + for( size_t i = 0; i < i_size; ++i ) + i_hash = ( i_hash << 5 ) ^ s_key.at(i) ^ i_hash; + + return i_hash; +} + +bool +hashmap_allocator::operator()(string s_key_1, string s_key_2) const +{ + return s_key_1.compare(s_key_2) == 0; +} + +#endif diff --git a/src/maps/hash.h b/src/maps/hash.h new file mode 100644 index 0000000..15ce3fe --- /dev/null +++ b/src/maps/hash.h @@ -0,0 +1,18 @@ +#ifndef HASH_H +#define HASH_H + +#include <string> + +using namespace std; + +struct hash +{ + int operator()(string s_key) const; +}; + +struct hashmap_allocator +{ + bool operator()(string s_key_1, string s_key_2) const; +}; + +#endif diff --git a/src/maps/hashmap.h b/src/maps/hashmap.h index 1bdc515..3cc2f79 100644 --- a/src/maps/hashmap.h +++ b/src/maps/hashmap.h @@ -2,49 +2,20 @@ #define HASHMAP_H #include <ext/hash_map> +#include "hash.h" using namespace std; -template<class key_type_> -struct compare_allocator -{ - inline bool operator()(key_type_ t_key_1, key_type_ t_key_2) const; -}; - -template<class key_type_> -struct equals_allocator -{ - inline bool operator()(key_type_ t_key_1, key_type_ t_key_2) const; -}; - -template<class key_type_> -struct size_hash -{ - inline int operator()(key_type_ t_key) const; -}; - -template<class key_type_> -struct self_hash -{ - inline int operator()(key_type_ t_key) const; -}; +using __gnu_cxx::hash_map; -template -< - class obj_type, - class key_type_ = string, - class hash_type = size_hash<string>, - class alloc_type = compare_allocator<string> -> -struct hashmap : public __gnu_cxx::hash_map<key_type_, obj_type, hash_type, alloc_type> +template<class obj_type> +struct hashmap : public hash_map< string, obj_type, hash, hashmap_allocator> { - virtual inline void set_elem(obj_type t_obj, key_type_ t_key); - virtual inline obj_type get_elem(key_type_ t_key); - virtual inline obj_type get_set_elem(obj_type t_obj, key_type_ t_key); - virtual inline obj_type get_or_callback_set - (obj_type (*func)(void*), void* p_void, key_type_ t_key); - virtual inline vector<key_type_>* get_key_vector(); - virtual inline bool exists(key_type_ t_key); + virtual inline void set_elem(obj_type t_obj, string s_key); + virtual inline obj_type get_elem(string s_key); + virtual inline obj_type get_set_elem(obj_type t_obj, string s_key); + virtual inline vector<string>* get_key_vector(); + virtual inline bool exists(string s_key); virtual inline void run_func( void (*func)(obj_type) ); virtual inline void run_func( void (*func)(obj_type, void*), void* v_arg ); }; diff --git a/src/maps/hashmap.tmpl b/src/maps/hashmap.tmpl index 9ee2f36..682c395 100644 --- a/src/maps/hashmap.tmpl +++ b/src/maps/hashmap.tmpl @@ -1,47 +1,12 @@ -template<class key_type_> -bool -compare_allocator<key_type_>::operator()(key_type_ t_key_1, key_type_ t_key_2) const -{ - return t_key_1.compare(t_key_2) == 0; -} - -template<class key_type_> -bool -equals_allocator<key_type_>::operator()(key_type_ t_key_1, key_type_ t_key_2) const -{ - return t_key_1 == t_key_2; -} - -template<class key_type_> -int -size_hash<key_type_>::operator()(key_type_ t_key) const -{ - int i_hash = 0; - int i_size = t_key.size(); - - for( size_t i = 0; i < i_size; ++i ) - i_hash = ( i_hash << 5 ) ^ t_key.at(i) ^ i_hash; - - return i_hash; -} - -template<class key_type_> -int -self_hash<key_type_>::operator()(key_type_ t_key) const -{ - return t_key; -} - - -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> obj_type -hashmap<obj_type, key_type_, hash_type, alloc_type>::get_set_elem(obj_type t_obj, key_type_ t_key) +hashmap<obj_type>::get_set_elem(obj_type t_obj, string s_key) { - typename hashmap<obj_type, key_type_, hash_type, alloc_type>::iterator iter = this->find(t_key); + typename hashmap<obj_type>::iterator iter = this->find(s_key); if ( iter == this->end() ) { - set_elem(t_obj, t_key); + set_elem(t_obj, s_key); return obj_type(); } @@ -51,35 +16,18 @@ hashmap<obj_type, key_type_, hash_type, alloc_type>::get_set_elem(obj_type t_obj return t_ret; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> -obj_type -hashmap<obj_type, key_type_, hash_type, alloc_type>::get_or_callback_set -(obj_type (*func)(void*), void* p_void, key_type_ t_key) -{ - typename hashmap<obj_type, key_type_, hash_type, alloc_type>::iterator iter = this->find(t_key); - - if ( iter == this->end() ) - { - obj_type t_obj = (*func) (p_void); - set_elem(t_obj, t_key); - return t_obj; - } - - return iter->second; -} - -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -hashmap<obj_type, key_type_, hash_type, alloc_type>::set_elem(obj_type t_obj, key_type_ t_key) +hashmap<obj_type>::set_elem(obj_type t_obj, string s_key) { - (*this)[t_key] = t_obj; + (*this)[s_key] = t_obj; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> obj_type -hashmap<obj_type, key_type_, hash_type, alloc_type>::get_elem(key_type_ t_key) +hashmap<obj_type>::get_elem(string s_key) { - typename hashmap<obj_type, key_type_, hash_type, alloc_type>::iterator iter = this->find(t_key); + typename hashmap<obj_type>::iterator iter = this->find(s_key); if ( iter != this->end() ) return iter->second; @@ -87,12 +35,12 @@ hashmap<obj_type, key_type_, hash_type, alloc_type>::get_elem(key_type_ t_key) return obj_type(); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> -vector<key_type_>* -hashmap<obj_type, key_type_, hash_type, alloc_type>::get_key_vector() +template<class obj_type> +vector<string>* +hashmap<obj_type>::get_key_vector() { - vector<key_type_>* p_vec = new vector<key_type_>; - typename hashmap<obj_type, key_type_, hash_type, alloc_type>::iterator iter; + vector<string>* p_vec = new vector<string>; + typename hashmap<obj_type>::iterator iter; for ( iter = this->begin(); iter != this->end(); ++iter ) p_vec->push_back(iter->first); @@ -100,27 +48,27 @@ hashmap<obj_type, key_type_, hash_type, alloc_type>::get_key_vector() return p_vec; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> bool -hashmap<obj_type, key_type_, hash_type, alloc_type>::exists(key_type_ t_key) +hashmap<obj_type>::exists(string s_key) { - return this->find(t_key) != this->end(); + return this->find(s_key) != this->end(); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -hashmap<obj_type, key_type_, hash_type, alloc_type>::run_func( void (*func)(obj_type) ) +hashmap<obj_type>::run_func( void (*func)(obj_type) ) { - typename hashmap<obj_type, key_type_, hash_type, alloc_type>::iterator iter; + typename hashmap<obj_type>::iterator iter; for ( iter = this->begin(); iter != this->end(); ++iter ) ( *func ) ( iter->second ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -hashmap<obj_type, key_type_, hash_type, alloc_type>::run_func( void (*func)(obj_type, void*), void* v_arg ) +hashmap<obj_type>::run_func( void (*func)(obj_type, void*), void* v_arg ) { - typename hashmap<obj_type, key_type_, hash_type, alloc_type>::iterator iter; + typename hashmap<obj_type>::iterator iter; for ( iter = this->begin(); iter != this->end(); ++iter ) ( *func ) ( iter->second, v_arg ); } diff --git a/src/maps/nhashmap.h b/src/maps/nhashmap.h index 7f17a55..4cfb50e 100644 --- a/src/maps/nhashmap.h +++ b/src/maps/nhashmap.h @@ -5,16 +5,10 @@ using namespace std; -template -< - class obj_type, - class key_type_ = string, - class hash_type = size_hash<string>, - class alloc_type = compare_allocator<string> -> -struct nhashmap : public shashmap<obj_type, key_type_, hash_type, alloc_type> +template<class obj_type> +struct nhashmap : public shashmap<obj_type> { - inline obj_type get_elem(key_type_ t_key); + inline obj_type get_elem(string s_key); }; #include "nhashmap.tmpl" diff --git a/src/maps/nhashmap.tmpl b/src/maps/nhashmap.tmpl index 3ea1934..422ea2f 100644 --- a/src/maps/nhashmap.tmpl +++ b/src/maps/nhashmap.tmpl @@ -1,8 +1,8 @@ -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> obj_type -nhashmap<obj_type, key_type_, hash_type, alloc_type>::get_elem(key_type_ t_key) +nhashmap<obj_type>::get_elem(string s_key) { - typename hashmap<obj_type, key_type_, hash_type, alloc_type>::iterator iter = this->find(t_key); + typename hashmap<obj_type>::iterator iter = this->find(s_key); if ( iter != this->end() ) return iter->second; diff --git a/src/maps/shashmap.h b/src/maps/shashmap.h index 6152ba2..e31b55f 100644 --- a/src/maps/shashmap.h +++ b/src/maps/shashmap.h @@ -6,34 +6,25 @@ using namespace std; -template -< - class obj_type, - class key_type_ = string, - class hash_type = size_hash<string>, - class alloc_type = compare_allocator<string> -> -class shashmap : protected hashmap<obj_type, key_type_, hash_type, alloc_type> +template<class obj_type> +class shashmap : public hashmap<obj_type> { private: pthread_mutex_t mut_shashmap; - public: explicit shashmap(); ~shashmap(); - virtual inline void set_elem(obj_type t_obj, key_type_ t_key); - virtual inline obj_type get_set_elem(obj_type t_obj, key_type_ t_key); - virtual inline obj_type get_or_callback_set - (obj_type (*func)(void*), void* p_void, key_type_ t_key); - virtual inline void add_elem(obj_type t_obj, key_type_ t_key); - virtual inline void add_elem_insecure(obj_type t_obj, key_type_ t_key); - virtual inline obj_type get_elem(key_type_ t_key); - virtual inline void del_elem(key_type_ t_key); - virtual inline void del_elem_insecure(key_type_ t_key); + virtual inline void set_elem(obj_type t_obj, string s_key); + virtual inline obj_type get_set_elem(obj_type t_obj, string s_key); + virtual inline void add_elem(obj_type t_obj, string s_key); + virtual inline void add_elem_insecure(obj_type t_obj, string s_key); + virtual inline obj_type get_elem(string s_key); + virtual inline void del_elem(string s_key); + virtual inline void del_elem_insecure(string s_key); virtual inline void clear(); virtual inline int size(); - virtual inline bool exists(key_type_ t_key); - virtual inline vector<key_type_>* get_key_vector(); + virtual inline bool exists(string s_key); + virtual inline vector<string>* get_key_vector(); virtual inline void run_func( void (*func)(obj_type) ); virtual inline void run_func( void (*func)(obj_type, void*), void* v_arg ); }; diff --git a/src/maps/shashmap.tmpl b/src/maps/shashmap.tmpl index 4559284..7cf4b6b 100644 --- a/src/maps/shashmap.tmpl +++ b/src/maps/shashmap.tmpl @@ -1,141 +1,129 @@ -template<class obj_type, class key_type_, class hash_type, class alloc_type> -shashmap<obj_type, key_type_, hash_type, alloc_type>::shashmap() +template<class obj_type> +shashmap<obj_type>::shashmap() { pthread_mutex_init( &mut_shashmap, NULL ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> -shashmap<obj_type, key_type_, hash_type, alloc_type>::~shashmap() +template<class obj_type> +shashmap<obj_type>::~shashmap() { pthread_mutex_destroy( &mut_shashmap ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::add_elem(obj_type t_obj, key_type_ t_key) +shashmap<obj_type>::add_elem(obj_type t_obj, string s_key) { pthread_mutex_lock( &mut_shashmap ); - (*this)[t_key] = t_obj; + (*this)[s_key] = t_obj; pthread_mutex_unlock( &mut_shashmap ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::add_elem_insecure(obj_type t_obj, key_type_ t_key) +shashmap<obj_type>::add_elem_insecure(obj_type t_obj, string s_key) { - (*this)[t_key] = t_obj; + (*this)[s_key] = t_obj; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> obj_type -shashmap<obj_type, key_type_, hash_type, alloc_type>::get_set_elem(obj_type t_obj, key_type_ t_key) +shashmap<obj_type>::get_set_elem(obj_type t_obj, string s_key) { pthread_mutex_lock( &mut_shashmap ); - obj_type t_ret = hashmap<obj_type, key_type_, hash_type, alloc_type>::get_set_elem(t_obj, t_key); + obj_type t_ret = hashmap<obj_type>::get_set_elem(t_obj, s_key); pthread_mutex_unlock( &mut_shashmap ); return t_ret; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> -obj_type -shashmap<obj_type, key_type_, hash_type, alloc_type>::get_or_callback_set -(obj_type (*func)(void*), void* p_void, key_type_ t_key) -{ - pthread_mutex_lock( &mut_shashmap ); - obj_type t_ret = hashmap<obj_type, key_type_, hash_type, alloc_type>::get_or_callback_set - (func, p_void, t_key); - pthread_mutex_unlock( &mut_shashmap ); - return t_ret; -} - -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::set_elem(obj_type t_obj, key_type_ t_key) +shashmap<obj_type>::set_elem(obj_type t_obj, string s_key) { pthread_mutex_lock( &mut_shashmap ); - (*this)[t_key] = t_obj; + (*this)[s_key] = t_obj; pthread_mutex_unlock( &mut_shashmap ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> obj_type -shashmap<obj_type, key_type_, hash_type, alloc_type>::get_elem(key_type_ t_key) +shashmap<obj_type>::get_elem(string s_key) { pthread_mutex_lock( &mut_shashmap ); - obj_type t_ret = hashmap<obj_type, key_type_, hash_type, alloc_type>::get_elem(t_key); + obj_type t_ret = hashmap<obj_type>::get_elem(s_key); pthread_mutex_unlock( &mut_shashmap ); return t_ret; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::del_elem(key_type_ t_key) +shashmap<obj_type>::del_elem(string s_key) { pthread_mutex_lock( &mut_shashmap ); - hashmap<obj_type, key_type_, hash_type, alloc_type>::erase(t_key); + hashmap<obj_type>::erase(s_key); pthread_mutex_unlock( &mut_shashmap ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::del_elem_insecure(key_type_ t_key) +shashmap<obj_type>::del_elem_insecure(string s_key) { - hashmap<obj_type, key_type_, hash_type, alloc_type>::erase(t_key); + hashmap<obj_type>::erase(s_key); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> -vector<key_type_>* -shashmap<obj_type, key_type_, hash_type, alloc_type>::get_key_vector() +template<class obj_type> +vector<string>* +shashmap<obj_type>::get_key_vector() { pthread_mutex_lock( &mut_shashmap ); - vector<key_type_>* p_vec = hashmap<obj_type, key_type_, hash_type, alloc_type>::get_key_vector(); + vector<string>* p_vec = hashmap<obj_type>::get_key_vector(); pthread_mutex_unlock( &mut_shashmap ); return p_vec; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::clear() +shashmap<obj_type>::clear() { pthread_mutex_lock( &mut_shashmap ); - hashmap<obj_type, key_type_, hash_type, alloc_type>::clear(); + hashmap<obj_type>::clear(); pthread_mutex_unlock( &mut_shashmap ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> int -shashmap<obj_type, key_type_, hash_type, alloc_type>::size() +shashmap<obj_type>::size() { pthread_mutex_lock( &mut_shashmap ); - int i_size = hashmap<obj_type, key_type_, hash_type, alloc_type>::size(); + int i_size = hashmap<obj_type>::size(); pthread_mutex_unlock( &mut_shashmap ); return i_size; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> bool -shashmap<obj_type, key_type_, hash_type, alloc_type>::exists(key_type_ t_key) +shashmap<obj_type>::exists(string s_key) { pthread_mutex_lock( &mut_shashmap ); - bool b_ret = hashmap<obj_type, key_type_, hash_type, alloc_type>::exists(t_key); + bool b_ret = hashmap<obj_type>::exists(s_key); pthread_mutex_unlock( &mut_shashmap ); return b_ret; } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::run_func( void (*func)(obj_type) ) +shashmap<obj_type>::run_func( void (*func)(obj_type) ) { pthread_mutex_lock( &mut_shashmap ); - hashmap<obj_type, key_type_, hash_type, alloc_type>::run_func(func); + hashmap<obj_type>::run_func(func); pthread_mutex_unlock( &mut_shashmap ); } -template<class obj_type, class key_type_, class hash_type, class alloc_type> +template<class obj_type> void -shashmap<obj_type, key_type_, hash_type, alloc_type>::run_func( void (*func)(obj_type, void*), void* v_arg ) +shashmap<obj_type>::run_func( void (*func)(obj_type, void*), void* v_arg ) { pthread_mutex_lock( &mut_shashmap ); - hashmap<obj_type, key_type_, hash_type, alloc_type>::run_func(func, v_arg); + hashmap<obj_type>::run_func(func, v_arg); pthread_mutex_unlock( &mut_shashmap ); } diff --git a/src/modl.cpp b/src/modl.cpp index 32fe33a..6668109 100755 --- a/src/modl.cpp +++ b/src/modl.cpp @@ -113,14 +113,6 @@ modl::cache_module( string s_name, bool b_print_sys_msg ) } dynmod* -modl::get_module( string s_name, string s_user ) -{ - wrap::system_message( MODULER + s_name.substr( s_name.find_last_of("/")+1 ) + " (" + s_user + ")"); - dynmod* mod = get_elem( s_name ); - return ! mod ? cache_module( s_name, true ) : mod; -} - -dynmod* modl::get_module( string s_name ) { wrap::system_message( MODULER + s_name.substr( s_name.find_last_of("/")+1 ) ); @@ -24,7 +24,6 @@ public: ~modl(); dynmod* get_module( string s_name ); - dynmod* get_module( string s_name, string s_user ); vector<string>* get_mod_vector() { diff --git a/src/mods/commands/CVS/Entries b/src/mods/commands/CVS/Entries index 0e0d041..85ac1cd 100644 --- a/src/mods/commands/CVS/Entries +++ b/src/mods/commands/CVS/Entries @@ -1,5 +1,5 @@ -/Makefile/1.31/Sun Mar 6 20:44:47 2005// -/Makefile.in/1.8/Sun Mar 6 20:44:47 2005// +/Makefile/1.28/Fri Feb 18 19:48:12 2005// +/Makefile.in/1.7/Thu Jul 8 14:39:03 2004// /yc_about.cpp/1.2/Mon Feb 21 01:55:49 2005// /yc_all.cpp/1.2/Mon Feb 21 01:55:49 2005// /yc_away.cpp/1.9/Mon Feb 21 01:55:49 2005// diff --git a/src/mods/commands/Makefile b/src/mods/commands/Makefile index 977b548..6aec38d 100644 --- a/src/mods/commands/Makefile +++ b/src/mods/commands/Makefile @@ -5,7 +5,7 @@ INCLUDES=`cat ../../includes.add` CFLAGS=`cat ../cflags.add` all: mods $(MODS): - @echo -n "Compiling command module `basename $@ | sed s/\.so// | sed s/yc_//` " + @echo -n "Compiling command module `basename $@` " @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" diff --git a/src/mods/commands/Makefile.in b/src/mods/commands/Makefile.in index 7ca8455..ce8c00f 100755 --- a/src/mods/commands/Makefile.in +++ b/src/mods/commands/Makefile.in @@ -4,7 +4,7 @@ INCLUDES=`cat ../../includes.add` CFLAGS=`cat ../cflags.add` all: mods $(MODS): - @echo -n "Compiling command module `basename $@ | sed s/\.so// | sed s/yc_//` " + @echo -n "Compiling command module `basename $@` " @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" diff --git a/src/mods/html/CVS/Entries b/src/mods/html/CVS/Entries index c3b5155..a8f2422 100644 --- a/src/mods/html/CVS/Entries +++ b/src/mods/html/CVS/Entries @@ -1,9 +1,9 @@ -/Makefile/1.27/Sun Mar 6 20:44:47 2005// -/Makefile.in/1.9/Sun Mar 6 20:44:47 2005// -/yc_admin.cpp/1.8/Fri Feb 25 00:52:24 2005// -/yc_colors.cpp/1.10/Fri Feb 25 00:52:24 2005// -/yc_help.cpp/1.13/Fri Feb 25 00:52:24 2005// -/yc_loggedin.cpp/1.4/Fri Feb 25 00:52:24 2005// -/yc_options.cpp/1.10/Fri Feb 25 00:52:24 2005// -/yc_register.cpp/1.13/Fri Feb 25 00:52:24 2005// +/Makefile/1.24/Fri Feb 18 19:48:12 2005// +/Makefile.in/1.8/Thu Jul 8 14:39:03 2004// +/yc_admin.cpp/1.7/Mon Feb 21 01:55:50 2005// +/yc_colors.cpp/1.9/Mon Feb 21 01:55:50 2005// +/yc_help.cpp/1.12/Mon Feb 21 01:55:50 2005// +/yc_loggedin.cpp/1.3/Mon Feb 21 01:55:50 2005// +/yc_options.cpp/1.9/Mon Feb 21 01:55:50 2005// +/yc_register.cpp/1.12/Mon Feb 21 01:55:50 2005// D diff --git a/src/mods/html/Makefile b/src/mods/html/Makefile index 7c3b970..98deaf7 100644 --- a/src/mods/html/Makefile +++ b/src/mods/html/Makefile @@ -5,7 +5,7 @@ INCLUDES=`cat ../../includes.add` CFLAGS=`cat ../cflags.add` all: mods $(MODS): - @echo -n "Compiling html module `basename $@ | sed s/\.so// | sed s/yc_//` " + @echo -n "Compiling html module `basename $@` " @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" diff --git a/src/mods/html/Makefile.in b/src/mods/html/Makefile.in index b65c9e6..30f1782 100755 --- a/src/mods/html/Makefile.in +++ b/src/mods/html/Makefile.in @@ -4,7 +4,7 @@ INCLUDES=`cat ../../includes.add` CFLAGS=`cat ../cflags.add` all: mods $(MODS): - @echo -n "Compiling html module `basename $@ | sed s/\.so// | sed s/yc_//` " + @echo -n "Compiling html module `basename $@` " @if ! test -d `dirname $@`; then mkdir -p `dirname $@`; fi @$(CC) $(CFLAGS) $(INCLUDES) -shared -s -o $@ `echo $(notdir $@) | sed s/.so/.cpp/` @du -hc $@ | tail -n 1 | sed s/total// | sed "s/ //g" diff --git a/src/mods/html/yc_admin.cpp b/src/mods/html/yc_admin.cpp index cbee80a..f3811f9 100644 --- a/src/mods/html/yc_admin.cpp +++ b/src/mods/html/yc_admin.cpp @@ -23,7 +23,7 @@ extern "C" dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0]; user* p_user = (user*) c->elem[2]; conf* p_conf = (conf*) p_wrap->CONF; - string* p_content = &(*((map<string,string>*) c->elem[1]))["content"]; + string* p_content = &(*((hashmap<string>*) c->elem[1]))["content"]; vector<string>* p_vec_keys = p_conf->get_key_vector(); sort(p_vec_keys->begin(), p_vec_keys->end()); diff --git a/src/mods/html/yc_colors.cpp b/src/mods/html/yc_colors.cpp index 1f12f60..9d9f2ec 100755 --- a/src/mods/html/yc_colors.cpp +++ b/src/mods/html/yc_colors.cpp @@ -13,9 +13,9 @@ extern "C" container* c = (container*) v_arg; dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0]; conf* p_conf = (conf*) p_wrap->CONF; - string* p_col1 = &(*((map<string,string>*) c->elem[1]))["col1"]; - string* p_col2 = &(*((map<string,string>*) c->elem[1]))["col2"]; - string* p_flag = &(*((map<string,string>*) c->elem[1]))["flag"]; + string* p_col1 = &(*((hashmap<string>*) c->elem[1]))["col1"]; + string* p_col2 = &(*((hashmap<string>*) c->elem[1]))["col2"]; + string* p_flag = &(*((hashmap<string>*) c->elem[1]))["flag"]; user* p_user = (user*) c->elem[2]; p_col1->erase(0); @@ -26,7 +26,7 @@ extern "C" if ( *p_flag == "submit" ) { - string* p_msgs = &(*((map<string,string>*) c->elem[1]) + string* p_msgs = &(*((hashmap<string>*) c->elem[1]) )["msgs"]; p_msgs->append( p_conf->get_elem( "chat.msgs.optionschanged" ) ); } diff --git a/src/mods/html/yc_help.cpp b/src/mods/html/yc_help.cpp index da58be8..ec8e863 100755 --- a/src/mods/html/yc_help.cpp +++ b/src/mods/html/yc_help.cpp @@ -13,11 +13,10 @@ extern "C" container* c = (container*) v_arg; dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0]; user* p_user = (user*) c->elem[2]; - modl* p_modl = (modl*) p_wrap->MODL; conf* p_conf = (conf*) p_wrap->CONF; chat* p_chat = (chat*) p_wrap->CHAT; - string* s_content = &(*((map<string,string>*) c->elem[1]))["content"]; + string* s_content = &(*((hashmap<string>*) c->elem[1]))["content"]; vector<string>* p_vec_keys = p_modl->get_mod_vector(); @@ -44,6 +43,7 @@ extern "C" } p_vec_keys_iter++; } + return 0; } } diff --git a/src/mods/html/yc_loggedin.cpp b/src/mods/html/yc_loggedin.cpp index 2dcc9dc..d3e81c1 100755 --- a/src/mods/html/yc_loggedin.cpp +++ b/src/mods/html/yc_loggedin.cpp @@ -13,7 +13,7 @@ extern "C" container* c = (container*) v_arg; dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0]; chat* p_chat = (chat*) p_wrap->CHAT; - map<string,string>* p_map = (map<string,string>*) c->elem[1]; + hashmap<string>* p_map = (hashmap<string>*) c->elem[1]; /* string s_list; diff --git a/src/mods/html/yc_options.cpp b/src/mods/html/yc_options.cpp index ec9ab5e..42c995c 100755 --- a/src/mods/html/yc_options.cpp +++ b/src/mods/html/yc_options.cpp @@ -13,16 +13,16 @@ extern "C" container* c = (container*) v_arg; dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0]; conf* p_conf = (conf*) p_wrap->CONF; - string* p_flag = &(*((map<string,string>*) c->elem[1]))["flag"]; - string* p_email = &(*((map<string,string>*) c->elem[1]))["email"]; - string* p_pass = &(*((map<string,string>*) c->elem[1]))["pass"]; - string* p_newpass = &(*((map<string,string>*) c->elem[1]))["newpass"]; - string* p_newpass2 = &(*((map<string,string>*) c->elem[1]))["newpass2"]; + string* p_flag = &(*((hashmap<string>*) c->elem[1]))["flag"]; + string* p_email = &(*((hashmap<string>*) c->elem[1]))["email"]; + string* p_pass = &(*((hashmap<string>*) c->elem[1]))["pass"]; + string* p_newpass = &(*((hashmap<string>*) c->elem[1]))["newpass"]; + string* p_newpass2 = &(*((hashmap<string>*) c->elem[1]))["newpass2"]; user* p_user = (user*) c->elem[2]; if ( *p_flag == "submit" ) { - string* p_msgs = &(*((map<string,string>*) c->elem[1]) + string* p_msgs = &(*((hashmap<string>*) c->elem[1]) )["msgs"]; // If the password has to be changed: diff --git a/src/mods/html/yc_register.cpp b/src/mods/html/yc_register.cpp index d0bcc8f..1acbd73 100755 --- a/src/mods/html/yc_register.cpp +++ b/src/mods/html/yc_register.cpp @@ -15,12 +15,12 @@ extern "C" dynamic_wrap* p_wrap = (dynamic_wrap*) c->elem[0]; conf* p_conf = (conf*) p_wrap->CONF; data* p_data = (data*) p_wrap->DATA; - string* p_msgs = &(*((map<string,string>*) c->elem[1]))["INFO"]; - string* p_nick = &(*((map<string,string>*) c->elem[1]))["nick"]; - string* p_email = &(*((map<string,string>*) c->elem[1]))["email"]; - string* p_pass = &(*((map<string,string>*) c->elem[1]))["pass"]; - string* p_pass2 = &(*((map<string,string>*) c->elem[1]))["pass2"]; - string* p_request = &(*((map<string,string>*) c->elem[1]))["request"]; + string* p_msgs = &(*((hashmap<string>*) c->elem[1]))["INFO"]; + string* p_nick = &(*((hashmap<string>*) c->elem[1]))["nick"]; + string* p_email = &(*((hashmap<string>*) c->elem[1]))["email"]; + string* p_pass = &(*((hashmap<string>*) c->elem[1]))["pass"]; + string* p_pass2 = &(*((hashmap<string>*) c->elem[1]))["pass2"]; + string* p_request = &(*((hashmap<string>*) c->elem[1]))["request"]; user* p_user = (user*) c->elem[2]; string s_nick = *p_nick; @@ -71,7 +71,7 @@ extern "C" p_msgs->append( p_conf->get_elem( "chat.msgs.registernick" ) ); p_request->replace( 0, p_request->length(), p_conf->get_elem("httpd.startsite") ); - map<string,string> map_insert = *((map<string,string>*) c->elem[1]); + hashmap<string> map_insert = *((hashmap<string>*) c->elem[1]); map_insert["password"] = *p_pass; map_insert["color1"] = p_conf->get_elem("chat.html.user.color1"); map_insert["color2"] = p_conf->get_elem("chat.html.user.color2"); @@ -1,39 +1,122 @@ #ifndef MSGS_H #define MSGS_H +// alphabetical ordered: +#define ACCPERR "Sock: Accept error " +#define BINDERR "Sock: Bind error " +#define CHATREP "Chat: Using replacement strings" +#define CHATDOP "Chat: Default operator login " +#define CFILEOK "Parsing config file" +#define CFILEFA "Failed opening config file!" +#define CONTACT "Contact: http://www.yChat.org, Mail@yChat.org, ICQ: 11655527" +#define CLRHTML "HTML: Cleared the document cache " +#define CLIWELC "Command Line Interface (type help for a list of all commands)" +#define CLIPRMO ">> " +#define CLIPRMI "<< " +#define CLIHELP "Unknown command (use help)" +#define CLIMSQL "Spawing system mysql client (enter exit to return)" +#define CLISHEL "Spawing system shell (enter exit to return)" +#define DATAADD "Data: Adding used connection into the queue" +#define DATADIS "Data: Closing all connections" +#define DATADI2 "Data: Closing idle connection (" +#define DATAQUE "Data: " +#define DATAGET "Data: Using database connection queue " +#define DATAIN0 "Data: Initializing maxcon to " +#define DATAIN1 "Data: Initializing mincon to " +#define DATAMAX "Data: Max database connections reached " +#define DATAMA0 "Data: Max database connections " +#define DATANEW "Data: Creating new database connection " +#define DESCRIP "Copyright (C) 2003 Paul C. Buetow, Volker Richter" +#define DESCRI2 "Copyright (C) 2004, 2005 Paul C. Buetow" +#define DONEMSG "done" +#define DOWNMSG "Shutting down " +#define GARBAGE "Garbage: Initializing collector " +#define GARBACT "Garbage collector activated " +#define GAROFFNE "Garbage: No garbage to remove available " +#define GARROOM "Garbage: Added room " +#define GARUSER "Garbage: Added user " +#define GARUSE2 "Garbage: Recycle user " +#define LISTERR "Sock: Listen error " +#define LOGERR1 "Logging: Could not open logfile " +#define LOGERR2 "Logging: No filename specified " +#define LOGINER "Chat: Login failed (password), nick: " +#define LOGINE0 "Chat: Login failed (empty nick)" +#define LOGINE1 "Chat: Login failed (alpha nick), nick: " +#define LOGINE2 "Chat: Login failed (nick length), nick: " +#define LOGINE3 "Chat: Login failed (room length), nick/room: " +#define LOGINE4 "Chat: Login failed (guests disabled), nick: " +#define MODULEC "Modl: Caching " +#define MODULER "Modl: Requesting " +#define MODUNLO "Modl: Unloading all modules " +#define MODRELO "Modl: Reloading all modules " -// several error messages which will apear by the clients. -#define E_ALPNUM "The nick you have specified is not alphanumeric, please change that.<br><br>" -#define E_NONICK "You need to specify a nick name.<br><br>" -#define E_NOTONL "An error occured. Your nick is not online.<br><br>" -#define E_ONLINE "The nick you have specified is already online. Try another nick.<br><br>" +#ifdef DATABASE +#define MYSQLQU "MySQL: " +#define MYSQLQ2 "MySQL: Adding query " +#define MYSQLE1 "MySQL: Error running mysql_init " +#endif -// all the custom messages for verbosity outputs. this messages may not -// be used for html-template value substituation except the CONTACT and -// DESCRIP variables. the verbosity output will appear in the standard -// output of the server. -// alphabetical ordered. -#define CFILEOK "Parsing config file " -#define CFILENO "Failed opening config file " -#define CONNECT "Receiving connection " -#define CONTACT "Contact: www.yChat.org, Mail@yChat.org " -#define DESCRIP "yChat; Copyright (C) 2003 Paul C. Buetow, Volker Richer\n(C) 2005 Paul C. Buetow" -#define DOWNMSG "Shutting down " -#define LOGINPR "Login procedure succeeded for nick " -#define MODULEC "Caching module " -#define NEWROOM "Adding room " -#define POOLER1 "Pool: Did not allocate all threads (" +#define NCURADM "ADMINISTRATOR's MAIN MENU" +#define NCURMSG "SERVER SYSTEM MESSAGES" +#define NCURSE0 "HTTP server: " +#define NCURSE1 "Thread pool: " +#define NCURSE2 "Data stats: " +#define NCURSE3 "Chat stats: " +#define NCURSE4 "Caching: " +#define NEWREQU "Sock: New request " +#define NEWROOM "Chat: New room " +#define NEWUSER "Chat: New user " +#define OFFFOUND "HTML: File not found " +#define PERMSTD "Reading standard command exec permissions" +#define POOLERR "Pool: Malloc error " #define POOLER2 "Pool: Max pool size reached (" -#define POOLFLL "Pool: Allocating new threads (" -#define REQUEST "Request string " -#define SEPERAT "----------------------------------------- " -#define SOCKCRT "Creating server socket " -#define SOCKERR "Could not create socket. Trying next port " -#define SOCKRDY "Server socket is ready. See port above " -#define STARTMS "Starting up " -#define TECACHE "Caching template " -#define THREADS "Starting thread job " -#define THREADE "Exiting thread job " -#define VERSION "Version: yChat 0.5.4-RELEASE" +#define POOLFLL "Pool: Allocating new thread (" +#define READERR "Sock: Read error " +#define REMROOM "Garbage: Removing room " +#define REMUSER "Garbage: Removing user " +#define REQUEST "Reqp: Request string " +#define SELCERR "Sock: Select error " +#define SEPERAT "-----------------------" +#define SESSION "Session: Count " +#define SESSDMP "Session: Dump of session" +#define SHELLER "Shell: Could not execute command" +#define SHELLEX "Shell: Executing the following command:" +#define STATUPR "Stats: Updated rusage history" +#define STATRSS "Stats: Max resident set size " +#define REUROOM "Garbage: Reusing room object " +#define SOCKCLN "Sock: Initializing a client socket at " +#define SOCKCON "Sock: Connecting to " +#define SOCKCRT "Sock: Created socket on " +#define SOCKSRV "Sock: Initializing server socket " +#define SOCKERR "Sock: Can't create socket, trying next port " +#define SOCKER2 "Sock: Unknown hostname " +#define SOCKRDY "Sock: Server socket is ready " +#define SSLINIT "SSL: Initializing OpenSSL" +#define TECACHE "HTML: Caching document " +#define THRDSTR "Thread: Running" +#define TIMERAT "Timer: User autoaway timeout " +#define TIMERIN "Timer: Initializing " +#define TIMEROF "Timer: Setting offset to " +#define TIMERTH "Timer: Starting timer thread " +#define TIMERTO "Timer: User logout timeout " +#define TIMERUP "Timer: System uptime " +#define XMLREAD "XML: Reading " +#define XMLERR "XML Error: " +#define XMLER1 "XML Error: Unable to load file " +#define VERSION "0.7.7" +#define BRANCH "RELEASE" +#define BUILDNR 3384 +#define UNAME "FreeBSD 5.3-RELEASE-p5 i386" +#define COMPOPT "Using built-in specs.; Configured with: FreeBSD/i386 system compiler; Thread model: posix; gcc version 3.4.2 [FreeBSD] 20040728; 3.4; g++" +#define YCUSAGE "Usage: ./ychat {h|v}|{o confkey confvalue}\n" + +#define HEADER1 "HTTP/1.0 200 OK\r\n" +#define HEADER2 "Server: yChat/" VERSION "-" BRANCH "\r\n" +#define HEADER3 "Cache-control: no-cache\r\n" +#define HEADER4 "Pragma: no-cache\r\n" +#define HEADER5 "Transfer-Encoding: chunked\r\n" +#define HEADER6 "Connection: keep-alive\r\n" +#define HEADER7 "Content-Length: "; +#define HEADER8 "Content-Type: "; #endif diff --git a/src/name.cpp b/src/name.cpp index a573edf..79167f5 100755 --- a/src/name.cpp +++ b/src/name.cpp @@ -1,31 +1,49 @@ -// class name implementation. - -#ifndef NAME_CXX -#define NAME_CXX +#ifndef NAME_CPP +#define NAME_CPP #include "name.h" +#include "tool/tool.h" using namespace std; +name::name() +{ + pthread_mutex_init( &mut_s_name, NULL); +} + name::name( string s_name ) { + pthread_mutex_init( &mut_s_name, NULL); set_name( s_name ); } name::~name() -{} +{ + pthread_mutex_destroy( &mut_s_name ); +} string -name::get_name() const +name::get_name() { - return s_name; + string s_ret; + pthread_mutex_lock ( &mut_s_name ); + s_ret = s_name; + pthread_mutex_unlock( &mut_s_name ); + return s_ret; +} + +string +name::get_lowercase_name() +{ + return tool::to_lower( get_name() ); } void name::set_name( string s_name ) { + pthread_mutex_lock ( &mut_s_name ); this->s_name = s_name; + pthread_mutex_unlock( &mut_s_name ); } - #endif @@ -1,30 +1,24 @@ -// class name declaration. +#include "incl.h" #ifndef NAME_H #define NAME_H -#include "incl.h" - using namespace std; class name { protected: - // private members: string s_name; // object's name. + pthread_mutex_t mut_s_name; public: - virtual string get_name ( ) const; + virtual string get_name ( ); + virtual string get_lowercase_name ( ); virtual void set_name ( string s_name ); - - // public methods: - explicit name( ) - { } - ; // a standard constructor. - explicit name( string s_name ); // a standard constructor. - ~name( ); - + name(); + name( string s_name ); // a standard constructor. + ~name(); }; #endif diff --git a/src/ncur/CVS/Entries b/src/ncur/CVS/Entries index b757331..580d793 100644 --- a/src/ncur/CVS/Entries +++ b/src/ncur/CVS/Entries @@ -1,5 +1,5 @@ /menu.cpp/1.8/Mon Feb 21 01:55:50 2005// /menu.h/1.6/Mon Feb 21 01:55:50 2005// -/ncur.cpp/1.26/Wed Mar 9 21:09:32 2005// -/ncur.h/1.11/Sun Mar 6 20:44:47 2005// +/ncur.cpp/1.22/Mon Feb 21 01:55:50 2005// +/ncur.h/1.9/Mon Feb 21 01:55:50 2005// D diff --git a/src/ncur/ncur.cpp b/src/ncur/ncur.cpp index 9b0996c..4f63f01 100755 --- a/src/ncur/ncur.cpp +++ b/src/ncur/ncur.cpp @@ -6,7 +6,6 @@ #ifdef CLI #include "../cli/cli.h" #endif -#include "../sign.h" using namespace std; @@ -212,7 +211,7 @@ ncur::switch_main_menu_( int i_choice ) def_prog_mode(); /* Save the tty modes */ endwin(); /* End curses mode temporarily */ - delete new cli(); /* Start CLI mode */ + new cli(); /* Start CLI mode */ reset_prog_mode(); /* Return to the previous tty mode*/ /* stored by def_prog_mode() */ refresh(); /* Do refresh() to restore the */ @@ -234,7 +233,11 @@ ncur::switch_main_menu_( int i_choice ) break; case 11: // Shut down server - sign::terminate_received(0); + if ( ! wrap::GCOL->remove_garbage() ) //<< + wrap::NCUR->print( GAROFFNE ); //<< + mvprintw( 21,2, "Good bye !"); + close_ncurses(); + exit(0); break; default: @@ -253,9 +256,8 @@ ncur::init_ncurses() clear(); noecho(); cbreak(); // Line buffering disabled. pass on everything - init_pair(1, COLOR_BLACK, COLOR_CYAN); + init_pair(1, COLOR_WHITE, COLOR_BLUE); mvprintw( 0,2, (char*)(tool::ychat_version()).c_str()); - curs_set(0); refresh(); } diff --git a/src/ncur/ncur.h b/src/ncur/ncur.h index 1830cdf..74ed60e 100755 --- a/src/ncur/ncur.h +++ b/src/ncur/ncur.h @@ -16,7 +16,6 @@ using namespace std; class ncur : public thro { private: - friend class sign; menu* p_menu; WINDOW* p_serveroutput; list<char*>* p_messagelist; // contains the messages for p_serveroutput! @@ -29,8 +28,8 @@ private: pthread_mutex_t mut_is_ready; public: - ncur(); - ~ncur(); + ncur( ); // a standard constructor. + ~ncur( ); void start( void *p_void ); void print( char* c_print ); diff --git a/src/reqp.cpp b/src/reqp.cpp index 617d4ec..ce75a12 100755 --- a/src/reqp.cpp +++ b/src/reqp.cpp @@ -1,31 +1,50 @@ -// class reqp implementation. - -#ifndef REQP_CXX -#define REQP_CXX +#ifndef REQP_CPP +#define REQP_CPP #include "reqp.h" -#include "s_chat.h" -#include "s_html.h" -#include "s_mutx.h" -#include "s_sock.h" -#include "s_tool.h" +#include "tool/tool.h" + using namespace std; -// inititialization of static members. -string reqp::HTTP_CODEOK = "HTTP/1.1 200 OK\n"; -string reqp::HTTP_SERVER = "Server: yChat (Unix)\n"; -string reqp::HTTP_CONTAC = "Contact: www.yChat.org\n"; -string reqp::HTTP_CACHEC = "Expires: 0\nCache-control: no-cache\nPragma: no-cache\n"; -string reqp::HTTP_CONNEC = "Connection: keep-alive\n"; -string reqp::HTTP_COTYPE = "Content-Type: "; +#define HEADER HEADER1 HEADER2 HEADER3 HEADER4 +#define STREAM HEADER5 HEADER6 + +const string reqp::s_http = HEADER; +const string reqp::s_http_stream = STREAM; +const string reqp::s_http_colength = HEADER7; +const string reqp::s_http_cotype = HEADER8; reqp::reqp( ) {} +void +reqp::get_request_parameters( string s_parameters, hashmap<string>& map_params ) +{ + string s_tmp; + unsigned i_pos, i_pos2; + + while( (i_pos = s_parameters.find("&")) != string::npos ) + { + s_tmp = s_parameters.substr(0, i_pos ); + + if ( (i_pos2 = s_tmp.find("=")) != string::npos ) + map_params[ s_tmp.substr(0, i_pos2) ] = tool::replace( s_tmp.substr( i_pos2+1 ), "\\AND", "&"); + + s_parameters = s_parameters.substr( i_pos + 1 ); + } + + // Get the last request parameter, which does not have a "&" on the end! + if( (i_pos = s_parameters.find("=")) != string::npos ) + map_params[ s_parameters.substr(0, i_pos) ] = s_parameters.substr( i_pos+1 ); + + //map<string,string>::iterator iter; + //for ( iter = map_params.begin(); iter != map_params.end(); ++iter ) + //cout << ">>>" << iter->first << "=" << iter->second << endl; +} + string -reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params ) +reqp::get_url( int &i_sock, string s_req, hashmap<string> &map_params ) { - int i_sock = p_thrd->get_sock(); unsigned i_pos, i_pos2; string s_vars( "" ); string s_ret; @@ -80,8 +99,8 @@ reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params ) if ( (i_pos = s_req.find("event=")) == string::npos) { - char c_req[1024]; - i_len = read(i_sock, c_req, 1024); + char c_req[POSTBUF]; + i_len = read(i_sock, c_req, POSTBUF); s_req = c_req; s_req = s_req.substr(0, i_len); @@ -97,17 +116,11 @@ reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params ) } #ifdef VERBOSE - - pthread_mutex_lock ( &s_mutx::get - ().mut_stdout ); - cout << REQUEST << s_ret << endl; - pthread_mutex_unlock( &s_mutx::get - ().mut_stdout ); + wrap::system_message( REQUEST + s_ret ); #endif if ( s_ret.empty() ) - s_ret = s_conf::get - ().get_val( "STARTMPL" ); + s_ret = wrap::CONF->get_elem( "httpd.startsite" ); else s_ret = remove_dots(s_ret); @@ -117,327 +130,254 @@ reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params ) return s_ret; } -/* -string -reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params ) -{ - auto unsigned int pos; - string s_ret ( "" ); - string s_vars( "" ); - auto int i_request; - - i_request= ( s_req.find("GET",0) != string::npos ) ? RQ_GET : RQ_POST; - - pos = s_req.find( "HTTP", 0 ); - - if( i_request == RQ_GET ) - s_ret.append( s_req.substr( 5, pos-6 ) ); - else - s_ret.append( s_req.substr( 6, pos-7 ) ); - - // remove ".." from the request. - do - { - pos = s_ret.find( "../", 0 ); - - if ( pos == string::npos ) - break; - - s_ret.replace( pos, pos+2, "" ); - } - while( true ); - - // do not add the string behind "?" tp s_ret and add all params behind "?" to map_params. - if( i_request == RQ_GET ) - pos = s_ret.find( "?", 0 ); - else - pos = s_req.find("\r\n\r\n", 0); - - auto string s_params( "" ); - if ( pos != string::npos ) - { - if( i_request == RQ_GET ) - s_params.append( s_ret.substr( pos+1, s_ret.length() -pos-1 ) ); - - else - s_params = s_req.substr( pos+4, s_req.length() -pos-1 ); - - s_ret = s_ret.substr( 0, pos ); - } - - if ( i_request == RQ_POST && s_params.empty() ) - { - char c_req[READBUF]; - - if ( read ( p_thrd->get_sock() , c_req, READBUF ) <= 0 ) - return "NOBYTE"; - - s_params = string( strstr( c_req, "event" ) ); - } - - auto unsigned int pos2; - do - { - pos = s_params.find( "=", 0 ); - if ( pos == string::npos ) - break; - - pos2 = s_params.find( "&", 0 ); - if ( pos2 == string::npos ) - { - auto string sValue( s_params.substr(pos+1, s_params.length()-pos-1) ); - auto string tmpstr( url_decode(sValue) ); - map_params[ s_params.substr( 0, pos ) ] = tmpstr; - break; - } - - auto string s_temp= s_params.substr( pos+1, pos2-pos-1 ); - map_params[ s_params.substr( 0, pos ) ] = url_decode(s_temp); - - s_params = s_params.substr( pos2+1, s_params.length()-pos2-1 ); - } - while( true ); - -#ifdef VERBOSE - - pthread_mutex_lock ( &s_mutx::get - ().mut_stdout ); - cout << REQUEST << s_ret << endl; - pthread_mutex_unlock( &s_mutx::get - ().mut_stdout ); -#endif - - if ( s_ret.empty() ) - s_ret = s_conf::get - ().get_val( "STARTMPL" ); - - map_params["request"] = s_ret; - - return s_ret; -} -*/ - string reqp::get_content_type( string s_file ) { - string s_ext=s_tool::getExtension( s_file ); + string s_ext(tool::get_extension( s_file )); - if(s_ext=="") - s_ext="DEFAULT"; + if( s_ext == "" ) + s_ext = "default"; - return s_conf::get - ().get_val( "CT_"+s_ext ); + return wrap::CONF->get_elem( "httpd.contenttypes." + s_ext ); } + void -reqp::parse_headers( string s_req, map_string &map_params ) +reqp::parse_headers( string s_req, hashmap<string> &map_params ) { int pos = s_req.find("\n"); - if(pos!=string::npos) - map_params["QUERY_STRING"]=s_tool::trim(s_req.substr(0,pos-1)); - while(pos!=string::npos) + if (pos != string::npos) { - auto string s_line=s_req.substr(0,pos); - auto int pos2=s_line.find(":"); - if(pos2!=string::npos) - { - auto string key=s_tool::trim(s_line.substr(0, pos2)); - auto string value=s_tool::trim(s_line.substr(pos2+1)); + map_params["QUERY_STRING"] = tool::trim(s_req.substr(0,pos-1)); - map_params[key]=value; + int pos2; + do + { + string s_line( s_req.substr(0, pos) ); + pos2 = s_line.find(":"); + if (pos2 != string::npos && s_line.length() > pos2+1) + map_params[ tool::trim(s_line.substr(0, pos2)) ] = tool::trim(s_line.substr(pos2+1)); + s_req = s_req.substr( s_line.size() + 1 ); + pos = s_req.find("\n"); } - s_req=s_req.substr(s_line.size()+1); - pos=s_req.find("\n"); - } - + while( pos != string::npos); + } // if } - int -reqp::htoi(string *s) +reqp::htoi(string *p_str) { - int value; - int c; + int value, c; + c = p_str->at(0); - c=s->c_str()[0]; - if(isupper(c)) - c=tolower(c); + if( isupper(c) ) + c = tolower(c); - value=(c>='0' && c<='9'?c-'0':c-'a'+10)*16; + value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16; - c=s->c_str()[1]; - if(isupper(c)) - c=tolower(c); + c = p_str->at(1); + + if( isupper(c) ) + c = tolower(c); + + value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10; - value+=c>='0' && c<='9'?c-'0':c-'a'+10; return value; } string -reqp::url_decode( string s_str ) +reqp::url_decode( string s_url ) { - auto string sDest=""; - int len = s_str.size(); + string s_dest = ""; + int i_len = s_url.size(); + int i_prv = i_len - 2; - for(int i=0;i<len;i++) + char c; + for( int i = 0; i < i_len; ++i) { - char ch = s_str.at(i); - if(ch=='+') + c = s_url.at(i); + if( c == '+' ) { - sDest+=" "; + s_dest += " "; } - else if(ch=='%') + else if (c == '%' && i < i_prv) { - auto string sTmp=s_str.substr(i+1,2); - ch=(char)htoi(&sTmp); - sDest+=ch; - i+=2; - + string s_tmp = s_url.substr(i+1, 2); + c = (char) htoi(&s_tmp); + s_dest += c; + i += 2; } else - - sDest+=ch; + { + s_dest += c; + } } - return sDest; + + return s_dest; } string reqp::get_from_header( string s_req, string s_hdr ) { - auto unsigned int pos[2]; - pos[0] = s_req.find( s_hdr, 0 ); - pos[1] = s_req.find( "\n", pos[0] ); + unsigned i_pos[2]; + if ( (i_pos[0] = s_req.find( s_hdr, 0 )) == string::npos ) + return ""; + + if ( (i_pos[1] = s_req.find( "\n", i_pos[0]) ) == string::npos ) + return ""; - auto int i_length = s_hdr.length(); - return s_req.substr( pos[0]+i_length, pos[1]-pos[0]-i_length-1 ); + unsigned i_len = s_hdr.length(); + return s_req.substr( i_pos[0] + i_len, i_pos[1] - i_pos[0] - i_len - 1 ); } string -reqp::parse( thrd* p_thrd, string s_req, map_string &map_params ) +reqp::parse( int &i_sock, string s_req, hashmap<string> &map_params ) { - // store all request informations in map_params. store the url in // map_params["request"]. - - if ( get_url( p_thrd, s_req, map_params ).compare("NOBYTE") == 0 ) - map_params["request"] = s_conf::get - ().get_val("NOTFOUND"); + get_url( i_sock, s_req, map_params ); parse_headers( s_req, map_params ); - // create the http header. - string s_rep( HTTP_CODEOK ); - s_rep.append( HTTP_SERVER ); - s_rep.append( HTTP_CONTAC ); - s_rep.append( HTTP_CACHEC ); - s_rep.append( HTTP_CONNEC ); - s_rep.append( HTTP_COTYPE ); - s_rep.append( get_content_type( map_params["request"] ) ); - s_rep.append("\r\n\r\n"); + string s_event( map_params["event"] ); - // check the event variable. + map_params["content-type"] = get_content_type( map_params["request"] ); - string s_event( map_params["event"] ); + string s_rep( "" ); + + //<<* + // check the event variable. if ( ! s_event.empty() ) { // login procedure. if ( s_event == "login" ) { - s_chat::get - ().login( map_params ); + wrap::CHAT->login( map_params ); + } + else if ( s_event == "register" ) + { + user* p_user = new user; + map_params["INFO"] = ""; + run_html_mod( s_event, map_params, p_user ); + wrap::GCOL->add_user_to_garbage( p_user ); } - else { - bool b_found; + sess *p_sess = wrap::SMAN->get_session( map_params["tmpid"] ); + user *p_user = NULL; - // user* p_user = s_chat::get().get_user( map_params["nick"], b_found ); - sess *sess_temp=s_sman::get - ().getSession( map_params["tmpid"] ); - user *p_user; - if(sess_temp!=NULL) + if( p_sess != NULL ) { - string *s_nick=static_cast<string*>(sess_temp->getValue(string("nick"))); - p_user = s_chat::get - ().get_user( *s_nick, b_found); + p_user = p_sess->get_user(); } else - return s_rep; - if ( ! b_found ) { - map_params["INFO"] = E_NOTONL; - map_params["request"] = s_conf::get - ().get_val( "STARTMPL" ); // redirect to the startpage. + return s_rep; } - // if a message post. - else if ( s_event == "post" ) - s_chat::get - ().post( p_user, map_params ); - - // if a chat stream - else if ( s_event == "stream" ) + if ( ! p_user ) { - string s_msg(s_html::get - ().parse( map_params ) ); - p_user->msg_post( &s_msg); - s_sock::get - ().chat_stream( p_thrd->get_sock(), p_user, map_params ); + map_params["INFO"] = wrap::CONF->get_elem( "chat.msgs.err.notonline" ); + map_params["request"] = wrap::CONF->get_elem( "httpd.startsite" ); // redirect to the startpage. } + else + { + map_params["nick"] = p_user->get_name().c_str(); + + // if a message input. + if ( s_event == "input" ) + { + if ( p_user ) + { + p_user->check_restore_away(); + wrap::CHAT->post( p_user, map_params ); + } + } + + // if a chat stream + else if ( s_event == "stream" ) + { + string s_msg ( wrap::HTML->parse( map_params ) ); + p_user->msg_post( &s_msg); + wrap::SOCK->chat_stream( i_sock, p_user, map_params ); + } - // if a request for the online list of the active room. - else if ( s_event == "online" ) - s_html::get - ().online_list( p_user, map_params ); + // if a request for the online list of the active room. + else if ( s_event == "online" ) + { + wrap::HTML->online_list( p_user, map_params ); + } + else if ( s_event != "input" ) + { + run_html_mod( s_event, map_params, p_user ); + } + } } } + //*>> - // parse and get the requested html-template and also use - // the values stored in map_params for %%KEY%% substituations. - s_rep.append( s_html::get - ().parse( map_params ) ); + if ( wrap::CONF->get_elem("httpd.enablecgi").compare("true") == 0 && + string::npos != map_params["request"].find(".cgi") ) + { + s_rep.append( tool::shell_command( + wrap::CONF->get_elem("httpd.templatedir") + map_params["request"], + METH_RETSTRING ) ); + } + else + { + // parse and get the requested html-template and also use + // the values stored in map_params for %%KEY%% substituations. + s_rep.append( wrap::HTML->parse( map_params ) ); + } - // return the parsed html-template. - return s_rep; -} + // create the http header. -string -reqp::remove_dots( string s_ret ) -{ - // remove ".." from the request. - unsigned pos; + string s_resp(s_http); + if ( s_event.compare("stream") == 0 ) + s_resp.append( s_http_stream ); - if( (pos = s_ret.find( ".." )) != string::npos) - return s_ret.substr(0, pos); + s_resp.append( s_http_colength + tool::int2string(s_rep.size()) + "\n" + + map_params["content-type"] + "\r\n\r\n" ); - return s_ret; + s_resp.append(s_rep); + + + // return the parsed html-template. + return s_resp; } +//<<* void -reqp::get_request_parameters( string s_parameters, map<string,string>& map_params ) +reqp::run_html_mod( string s_event, hashmap<string> &map_params, user* p_user ) { - string s_tmp; - unsigned i_pos, i_pos2; + container *c = new container; - while( (i_pos = s_parameters.find("&")) != string::npos ) - { - s_tmp = s_parameters.substr(0, i_pos ); + c->elem[0] = (void*) wrap::WRAP; + c->elem[1] = (void*) &map_params; + c->elem[2] = (void*) p_user; - if ( (i_pos2 = s_tmp.find("=")) != string::npos ) - map_params[ s_tmp.substr(0, i_pos2) ] = s_tool::replace( s_tmp.substr( i_pos2+1 ), "\\AND", "&"); + string s_mod = wrap::CONF->get_elem("httpd.modules.htmldir") + "yc_" + s_event + ".so"; - s_parameters = s_parameters.substr( i_pos + 1 ); - } + dynmod* p_module = wrap::MODL->get_module( s_mod ); - // Get the last request parameter, which does not have a "&" on the end! - if( (i_pos = s_parameters.find("=")) != string::npos ) - map_params[ s_parameters.substr(0, i_pos) ] = s_parameters.substr( i_pos+1 ); + if ( p_module != NULL ) + ( *( p_module->the_func ) ) ( (void*) c ); - //map<string,string>::iterator iter; - //for ( iter = map_params.begin(); iter != map_params.end(); ++iter ) - //cout << ">>>" << iter->first << "=" << iter->second << endl; + delete c; } +//*>> +string +reqp::remove_dots( string s_ret ) +{ + // remove ".." from the request. + unsigned pos; + + if( (pos = s_ret.find( ".." )) != string::npos) + return s_ret.substr(0, pos); + + return s_ret; +} #endif @@ -1,49 +1,41 @@ -// class reqp declaration. this class parses the client requests. - +#include "incl.h" #ifndef REQP_H #define REQP_H -#define RQ_GET 1 -#define RQ_POST 2 - -#include <map> -#include "incl.h" -#include "thrd.h" +#include "maps/hashmap.h" using namespace std; -typedef map<string, string, less<string> > map_string; - class reqp { private: - static string HTTP_CODEOK, - HTTP_CODENF, - HTTP_SERVER, - HTTP_CONTAC, - HTTP_CACHEC, - HTTP_CONNEC, - HTTP_COTYPE; + static const string s_http; + static const string s_http_stream; + static const string s_http_colength; + static const string s_http_cotype; // returns the request url from thr client's http request header // until the first "?" and stores all request parameter values // ( behind "?" ) into map_params. - virtual string get_url( thrd* p_thrd, string s_req, map_string &map_params ); + string get_url( int &i_sock, string s_req, hashmap<string> &map_params ); // returns a specific value of the client's http request header. // ( s.t. like the User-Agent, Referer etc... ). - virtual string get_from_header( string s_req, string s_hdr ); + string get_from_header( string s_req, string s_hdr ); + + int htoi( string *p_str ); + void run_html_mod( string s_event, hashmap<string> &map_params, user* p_user ); //<< + // Removes double dots ".." + string remove_dots( string s_req ); - virtual int htoi( string *s ); - string remove_dots( string s_ret ); -void get_request_parameters( string s_parameters, map<string,string>& map_params ); + // Parses "event=bla?blu=bli&sadasda=asddds ..." string and stores them in the map + void get_request_parameters( string s_parameters, hashmap<string>& map_params ); public: - // public methods. - explicit reqp( ); // simple constructor. - virtual string parse( thrd* p_thrd, string s_req, map_string &map_params ); - virtual string url_decode ( string ); - virtual string get_content_type( string ); - virtual void parse_headers( string s_req, map_string &map_params ); + reqp( ); + string parse( int &i_sock, string s_req, hashmap<string> &map_params ); + string url_decode ( string s_url ); + string get_content_type( string s_file ); + void parse_headers( string s_req, hashmap<string> &map_params ); }; #endif diff --git a/src/sock/CVS/Entries b/src/sock/CVS/Entries index 8431283..05cb6fc 100644 --- a/src/sock/CVS/Entries +++ b/src/sock/CVS/Entries @@ -1,3 +1,3 @@ -/sock.cpp/1.29/Sat Mar 5 12:43:37 2005// -/sock.h/1.14/Sun Feb 27 06:28:53 2005// +/sock.cpp/1.22/Mon Feb 21 01:55:50 2005// +/sock.h/1.10/Mon Feb 21 01:55:50 2005// D diff --git a/src/sock/sock.cpp b/src/sock/sock.cpp index 42daf24..802a980 100755 --- a/src/sock/sock.cpp +++ b/src/sock/sock.cpp @@ -15,7 +15,9 @@ sock::sock() { this->b_run = true; this->i_req = 0; + this->i_threads = 0; this->req_parser = new reqp(); + this->thrd_pool = new pool(); #ifdef LOGGING this->log_daemon = new logd( wrap::CONF->get_elem( "httpd.logging.accessfile" ), @@ -29,7 +31,7 @@ sock::~sock() //<<* void -sock::chat_stream( int i_sock, user *p_user, map<string,string> &map_params ) +sock::chat_stream( int i_sock, user *p_user, hashmap<string> &map_params ) { string s_msg( "\n" ); @@ -150,11 +152,10 @@ sock::read_write( int* p_sock ) { wrap::system_message( READERR ); } - else { // stores the request params. - map<string,string> map_params; + hashmap<string> map_params; // get the s_rep ( s_html response which will be send imediatly to the client struct sockaddr_in client; @@ -164,21 +165,14 @@ sock::read_write( int* p_sock ) getpeername( i_sock, (struct sockaddr *)&client, (int*)&size); #else + getpeername( i_sock, (struct sockaddr *)&client, &size); #endif - - uint32_t &s_addr = client.sin_addr.s_addr; - if ( (map_params["REMOTE_ADDR"] = get_elem(s_addr)) == "" ) - { - map_params["REMOTE_ADDR"] = string(inet_ntoa(client.sin_addr)); - set_elem(map_params["REMOTE_ADDR"], s_addr); - wrap::system_message(SOCKCAC+map_params["REMOTE_ADDR"]); - } - //map_params["REMOTE_ADDR"] = inet_ntoa_callback(&client.sin_addr); + map_params["REMOTE_ADDR"] = inet_ntoa(client.sin_addr); //map_params["REMOTE_PORT"] = ntohs(client.sin_port); - string s_rep = req_parser->parse(i_sock, string(c_req), map_params); + string s_rep = req_parser->parse( i_sock, string( c_req ), map_params ); #ifdef LOGGING @@ -207,11 +201,11 @@ int sock::start() { wrap::system_message( SOCKSRV ); - pool* p_pool = wrap::POOL; #ifdef NCURSES + print_hits(); - p_pool->print_pool_size(); + thrd_pool->print_pool_size(); #endif int i_port = tool::string2int( wrap::CONF->get_elem( "httpd.serverport" ) ); @@ -293,27 +287,13 @@ sock::start() { int *p_sock = new int; *p_sock = i; - p_pool->run( (void*) p_sock ); + thrd_pool->run( (void*) p_sock ); FD_CLR( i, &active_fd_set ); } } } } -void -sock::clean_ipcache() -{ - int i_ipcachesize = wrap::CONF->get_int("httpd.ipcachesize"); - int i_currentsize = size(); - - if ( i_currentsize > 0 && (i_ipcachesize == 0 || i_ipcachesize <= i_currentsize) ) - { - wrap::system_message( - SOCKCA2+tool::int2string(i_currentsize)+","+tool::int2string(i_ipcachesize)+")"); - clear(); - } -} - #ifdef NCURSES void sock::print_hits() diff --git a/src/sock/sock.h b/src/sock/sock.h index 62f32ae..0d93543 100755 --- a/src/sock/sock.h +++ b/src/sock/sock.h @@ -10,34 +10,36 @@ #include <netinet/in.h> #include <netdb.h> +#include "../thrd/pool.h" #include "../reqp.h" #include "../chat/user.h" -#include "../thrd/pool.h" -#include "../maps/shashmap.h" #ifdef LOGGING #include "../logd.h" #endif +#include "../maps/hashmap.h" + using namespace std; -class sock : protected shashmap -< string, uint32_t, self_hash<uint32_t>, equals_allocator<uint32_t> > +class sock { private: -#ifdef LOGGING - logd *log_daemon; // the log daemon -#endif - // total number of server requests. unsigned long long i_req; + bool b_run; // true while socket manager is running. reqp *req_parser; // parses the http requests from clients. + pool *thrd_pool; // the thread pool. +#ifdef LOGGING + + logd *log_daemon; // the log daemon +#endif char *c_buffer; // char buffer! - pthread_mutex_t mut_hits; + int i_threads; // total amount of threads inside the thread pool. - static string inet_ntoa_callback(void* p_void); + pthread_mutex_t mut_hits; public: // creates a server socket. @@ -59,10 +61,9 @@ public: int read_write( int* p_sock ); int start(); - void clean_ipcache(); // the chat stream there all the chat messages will sent through. - static void chat_stream( int i_sock, user* p_user, map<string,string> &map_params ); //<< + static void chat_stream( int i_sock, user* p_user, hashmap<string> &map_params ); //<< #ifdef NCURSES diff --git a/src/thrd/CVS/Entries b/src/thrd/CVS/Entries index bb6bf86..cca2803 100644 --- a/src/thrd/CVS/Entries +++ b/src/thrd/CVS/Entries @@ -1,5 +1,5 @@ -/pool.cpp/1.17/Fri Feb 25 01:22:35 2005// -/pool.h/1.12/Sun Mar 6 20:44:47 2005// -/thro.cpp/1.7/Sun Mar 6 20:44:47 2005// -/thro.h/1.6/Sun Mar 6 20:44:47 2005// +/pool.cpp/1.13/Mon Feb 21 01:55:50 2005// +/pool.h/1.10/Mon Feb 21 01:55:50 2005// +/thro.cpp/1.6/Mon Feb 21 01:55:50 2005// +/thro.h/1.5/Mon Feb 21 01:55:50 2005// D diff --git a/src/thrd/pool.cpp b/src/thrd/pool.cpp index 1f4ace6..d25a873 100755 --- a/src/thrd/pool.cpp +++ b/src/thrd/pool.cpp @@ -5,154 +5,217 @@ using namespace std; +int pool::i_thrd_used = 0; + pool::pool() { - pthread_mutex_init(&mut_threads, 0); - pthread_mutex_init(&mut_queue_tasks, 0); - pthread_mutex_init(&mut_num_avail_threads, 0); - pthread_cond_init(&cond_new_task, 0); - - i_num_total_threads = 0; - i_num_avail_threads = tool::string2int( wrap::CONF->get_elem( "httpd.thread.initpoolsize" ) ); - increase_pool(i_num_avail_threads); + i_thrd_pool_size = tool::string2int( wrap::CONF->get_elem( "httpd.thread.initpoolsize" ) ); + i_thrd_pool_queue = tool::string2int( wrap::CONF->get_elem( "httpd.thread.queuesize" ) ); + tpool_init( &thread_pool, i_thrd_pool_size, i_thrd_pool_queue); } -pool::~pool() +void +pool::tpool_init( tpool_t *tpoolp, int num_worker_threads, int max_queue_size) { - pthread_mutex_lock(&mut_queue_tasks); - while (!queue_tasks.empty()) + int i, rtn; + tpool_t tpool; + + // allocate a pool data structure + if (( tpool = (tpool_t) malloc( sizeof( struct tpool ) ) ) == 0 ) { - delete queue_tasks.front(); - queue_tasks.pop(); + wrap::system_message( POOLERR ); + exit(-1); } - pthread_mutex_unlock(&mut_queue_tasks); - pthread_mutex_destroy(&mut_threads); - pthread_mutex_destroy(&mut_queue_tasks); - pthread_mutex_destroy(&mut_num_avail_threads); - pthread_cond_destroy(&cond_new_task); -} + // initialize th fields + tpool->num_threads = num_worker_threads; + tpool->max_queue_size = max_queue_size; -int -pool::increase_pool(int i_num) -{ - wrap::system_message(POOLFLL + tool::int2string(i_num) +","+tool::int2string(i_num_total_threads)+")"); - int i_max_pool_size = tool::string2int( wrap::CONF->get_elem( "httpd.thread.maxpoolsize" ) ); + if ( ( tpool->threads = (pthread_t*) malloc( sizeof(pthread_t)*num_worker_threads ) ) == 0 ) + { + wrap::system_message( POOLERR ); + exit(-1); + } + + tpool->cur_queue_size = 0; + tpool->queue_head = 0; + tpool->queue_tail = 0; - for ( int i = 0; i < i_num; ++i ) + if ( ( rtn = pthread_mutex_init( &(tpool->queue_lock), 0 ) ) != 0 ) { - if ( i_max_pool_size != 0 && i_num_total_threads >= i_max_pool_size ) - { - wrap::system_message(POOLER2+tool::int2string(i_max_pool_size)+")"); - wrap::system_message(POOLER1+tool::int2string(i)+")"); - return i; - } + string s_err( "pthread_mutex_init " ); + s_err.append( strerror( rtn ) ); + + wrap::system_message( s_err ); - ++i_num_total_threads; - pthread_t p_pthread; - pthread_create(&p_pthread, 0, wait_for_task, (void*) this ); + exit(-1); } + else if ( ( rtn = pthread_cond_init( &(tpool->queue_not_empty), 0 ) ) != 0 ) + { + string s_err( "pthread_cond_init (1): " ); + s_err.append( strerror( rtn ) ); - return i_num; -} + wrap::system_message( s_err ); -void -pool::add_task( void(*p_func)(void*), void* p_void ) -{ - pthread_mutex_lock(&mut_queue_tasks); - queue_tasks.push(new task(p_func, p_void)); - pthread_mutex_unlock(&mut_queue_tasks); + exit(1); + } + else if ( ( rtn = pthread_cond_init( &(tpool->queue_not_full), 0 ) ) != 0 ) + { + string s_err( "pthread_cond_init (2): " ); + s_err.append( strerror( rtn ) ); - pthread_cond_signal(&cond_new_task); + wrap::system_message( s_err ); + exit(1); + } + else if ( ( rtn = pthread_cond_init( &(tpool->queue_empty), 0 ) ) != 0 ) + { + string s_err( "pthread_mutex_init " ); + s_err.append( strerror( rtn ) ); + + wrap::system_message( s_err ); + + exit(1); + } + + // create threads + for ( i = 0; i < num_worker_threads; ++i ) + pthread_create( &(tpool->threads[i]) , 0, tpool_thread, (void*)tpool ); + + *tpoolp = tpool; } void* -pool::wait_for_task( void* p_void ) +pool::tpool_thread( void* p_void ) { - pool* p_pool = static_cast<pool*>(p_void); + tpool_t tpool = (tpool_t) p_void; + tpool_work_t *my_workp; - for (;;) + for( pthread_mutex_lock( &(tpool->queue_lock) );; + pthread_mutex_lock( &(tpool->queue_lock) ), --i_thrd_used ) { #ifdef NCURSES - p_pool->print_pool_size(); + print_threads(i_thrd_used); #endif - pthread_mutex_lock(&p_pool->mut_threads); - pthread_cond_wait(&p_pool->cond_new_task, &p_pool->mut_threads); + while (tpool->cur_queue_size == 0) + pthread_cond_wait( &(tpool->queue_not_empty), &(tpool->queue_lock) ); - pthread_mutex_lock(&p_pool->mut_num_avail_threads); - if ( --p_pool->i_num_avail_threads < 5 ) - { - int i_size = 9 - p_pool->i_num_avail_threads; - i_size = p_pool->increase_pool(i_size); - p_pool->i_num_avail_threads += i_size; - } - pthread_mutex_unlock(&p_pool->mut_num_avail_threads); + my_workp = tpool->queue_head; + tpool->cur_queue_size--; - pthread_mutex_lock(&p_pool->mut_queue_tasks); - task* p_task = p_pool->queue_tasks.front(); - p_pool->queue_tasks.pop(); - pthread_mutex_unlock(&p_pool->mut_queue_tasks); + if ( tpool->cur_queue_size == 0) + tpool->queue_head = tpool->queue_tail = 0; - pthread_mutex_unlock(&p_pool->mut_threads); + else + tpool->queue_head = my_workp->next; - (*(p_task->p_func))(p_task->p_void); - delete p_task; + if ( tpool->cur_queue_size == ( tpool->max_queue_size - 1 ) ) + pthread_cond_signal( &(tpool->queue_not_full) ); - pthread_mutex_lock(&p_pool->mut_num_avail_threads); - p_pool->i_num_avail_threads++; - pthread_mutex_unlock(&p_pool->mut_num_avail_threads); - } + if ( tpool->cur_queue_size == 0 ) + pthread_cond_signal( &(tpool->queue_empty) ); - return 0; -} + pthread_mutex_unlock( &(tpool->queue_lock) ); -void -pool::run(void* p_void) -{ - add_task(run_func, p_void); + (*(my_workp->routine))(my_workp->p_void); + + free(my_workp); + } } -void -pool::run_func(void *p_void) +void pool::run_func( void *p_void ) { - int* p_sock = static_cast<int*>(p_void); - wrap::SOCK->read_write(p_sock); + int* p_sock = (int*)p_void; + wrap::SOCK->read_write( p_sock ); delete p_sock; } -bool -pool::allow_user_login() +int +pool::tpool_add_work( tpool_t tpool, void(*routine)(void*), void* p_void ) /// { - pthread_mutex_lock(&mut_num_avail_threads); - if ( i_num_avail_threads < 2 ) + tpool_work_t *workp; + pthread_mutex_lock( &(tpool->queue_lock) ); + + if ( ++i_thrd_used == tpool->num_threads ) { int i_max_pool_size = tool::string2int( wrap::CONF->get_elem( "httpd.thread.maxpoolsize" ) ); - if ( i_max_pool_size != 0 && i_max_pool_size == i_num_total_threads ) + if ( i_max_pool_size != 0 && i_thrd_used > i_max_pool_size ) { - pthread_mutex_unlock(&mut_num_avail_threads); - return false; + wrap::system_message(POOLER2+tool::int2string(i_thrd_used)+")"); } + else + { + int i_size = tpool->num_threads + 1; + + wrap::system_message(POOLFLL+tool::int2string(i_size)+")"); + + tpool->threads = (pthread_t*)realloc((void*)tpool->threads, sizeof(pthread_t)*tpool->num_threads); + + for ( int i = tpool->num_threads; i < i_size; ++i ) + pthread_create( &(tpool->threads[i]) , 0, tpool_thread, (void*)tpool ); + + i_thrd_pool_size = tpool->num_threads = i_size; +#ifdef NCURSES + + print_pool_size(); +#endif + + } + } + +#ifdef NCURSES + print_threads(i_thrd_used); +#endif + + while (tpool->cur_queue_size == tpool->max_queue_size) + pthread_cond_wait( &(tpool->queue_not_full), &(tpool->queue_lock) ); + + // allocate work structure: + workp = (tpool_work_t*) malloc( sizeof( tpool_work_t ) ); + + workp->routine = routine; + workp->p_void = p_void; + workp->next = 0; + + if (tpool->cur_queue_size == 0 ) + { + tpool->queue_tail = tpool->queue_head = workp; } - pthread_mutex_unlock(&mut_num_avail_threads); + else + { + (tpool->queue_tail)->next = workp; + tpool->queue_tail = workp; + } + + tpool->cur_queue_size++; + pthread_cond_signal( &tpool->queue_not_empty ); + pthread_mutex_unlock( &(tpool->queue_lock) ); - return true; + return 0; } #ifdef NCURSES void +pool::print_threads(int i_thrd_used) +{ + if ( wrap::NCUR->is_ready() ) + { + mvprintw( NCUR_POOL_RUNNING_X,NCUR_POOL_RUNNING_Y, "In use: %d ", i_thrd_used); + refresh(); + } +} + +void pool::print_pool_size() { if ( wrap::NCUR->is_ready() ) { - pthread_mutex_lock(&mut_num_avail_threads); - mvprintw( NCUR_POOL_WAIT_X,NCUR_POOL_WAIT_Y, "Wait/Tot: %d/%d ", i_num_avail_threads, i_num_total_threads); - mvprintw( NCUR_POOL_RUNNING_X,NCUR_POOL_RUNNING_Y, "Running: %d ", i_num_total_threads-i_num_avail_threads); - pthread_mutex_unlock(&mut_num_avail_threads); + mvprintw( NCUR_POOL_SIZE_X,NCUR_POOL_SIZE_Y, "Size: %d %d", i_thrd_pool_size, i_thrd_pool_queue ); refresh(); } } #endif + #endif diff --git a/src/thrd/pool.h b/src/thrd/pool.h index ab03b57..71ecaa9 100755 --- a/src/thrd/pool.h +++ b/src/thrd/pool.h @@ -3,52 +3,65 @@ #ifndef POOL_H #define POOL_H -#include <queue> - using namespace std; -class pool +class pool { private: - friend class thro; + static int i_thrd_used; - struct task + typedef struct tpool_work { - void(*p_func)(void*); + void (*routine)(void*); /// void *p_void; + struct tpool_work *next; + } + tpool_work_t; + + typedef struct tpool + { + // pool characteristics: + int num_threads; + int max_queue_size; - task(void(*p_func)(void*), void *p_void) - { - this->p_func = p_func; - this->p_void = p_void; - } - }; + // pool state + pthread_t *threads; + int cur_queue_size; - pthread_mutex_t mut_threads; - pthread_mutex_t mut_queue_tasks; - pthread_mutex_t mut_num_avail_threads; - pthread_cond_t cond_new_task; + tpool_work_t *queue_head; + tpool_work_t *queue_tail; - int i_num_avail_threads; - int i_num_total_threads; + pthread_mutex_t queue_lock; + pthread_cond_t queue_not_empty; + pthread_cond_t queue_not_full; + pthread_cond_t queue_empty; + } + *tpool_t; - queue<task*> queue_tasks; + int i_thrd_pool_size; + int i_thrd_pool_queue; - int increase_pool(int i_num); - void add_task( void(*p_func)(void*), void* p_void ); - static void* wait_for_task(void *p_void); - static void run_func(void *p_void); + tpool_t thread_pool; + + void tpool_init( tpool_t *tpoolp, int num_worker_threads, int max_queue_size); + int tpool_add_work( tpool_t tpool, void(*routine)(void*), void* p_void ); + static void* tpool_thread( void *p_void); + static void run_func( void *p_void ); public: pool(); - ~pool(); - void run(void* p_void); - bool allow_user_login(); + // inline (speed)! + void run( void *p_void ) + { + tpool_add_work( thread_pool, run_func, p_void ); + } #ifdef NCURSES void print_pool_size(); + static void print_threads(int i_thrd_used); #endif + }; #endif diff --git a/src/thrd/thro.cpp b/src/thrd/thro.cpp index 8b3f1ba..e35520c 100644 --- a/src/thrd/thro.cpp +++ b/src/thrd/thro.cpp @@ -23,7 +23,6 @@ thro::run( void *p_void ) { elem.p_thro = this; elem.p_void = p_void; - //wrap::POOL->add_task(start_, &elem); pthread_create( &pthread, NULL, start_, &elem ); } diff --git a/src/thrd/thro.h b/src/thrd/thro.h index 8e7e0cf..783cd0d 100644 --- a/src/thrd/thro.h +++ b/src/thrd/thro.h @@ -17,7 +17,7 @@ private: } elem; - static void *start_( void *p_void ); + static void* start_( void *p_void ); public: thro( ); diff --git a/src/time/CVS/Entries b/src/time/CVS/Entries index 6a8c339..bcedcb0 100644 --- a/src/time/CVS/Entries +++ b/src/time/CVS/Entries @@ -1,5 +1,5 @@ /timo.cpp/1.5/Mon Feb 21 01:55:50 2005// /timo.h/1.4/Mon Feb 21 01:55:50 2005// -/timr.cpp/1.16/Sat Mar 5 11:53:19 2005// +/timr.cpp/1.13/Mon Feb 21 01:55:50 2005// /timr.h/1.5/Mon Feb 21 01:55:50 2005// D diff --git a/src/time/timr.cpp b/src/time/timr.cpp index 1473a16..d2251d0 100755 --- a/src/time/timr.cpp +++ b/src/time/timr.cpp @@ -103,11 +103,10 @@ timr::start( void *v_ptr ) wrap::DATA->check_data_con_timeout(); #endif //*>> + // Run every ten minutes: if ( time_now.tm_min % 10 == 0 ) { - - wrap::SOCK->clean_ipcache(); // Run every hour if ( time_now.tm_min % 60 == 0 ) { diff --git a/src/wrap.cpp b/src/wrap.cpp index d737038..715ce56 100755 --- a/src/wrap.cpp +++ b/src/wrap.cpp @@ -26,100 +26,21 @@ ncur* wrap::NCUR; sock* wrap::SOCK; stats* wrap::STAT; timr* wrap::TIMR; -pool* wrap::POOL; dynamic_wrap* wrap::WRAP; void wrap::system_message( string s_message ) { #ifdef NCURSES - NCUR->print( s_message ); + wrap::NCUR->print( s_message ); #endif - #ifdef SERVMSG - cout << s_message << endl; -#endif -#ifdef LOGGING - LOGD->log_simple_line( s_message + "\n" ); + cout << s_message << endl; #endif -} - -void -wrap::init_wrapper(map<string,string>* p_start_params) -{ - // Init the dynamic wrapper (is needed to pass all wrapped objects through a single pointer). - WRAP = new dynamic_wrap; - - // Init the config manager. - WRAP->CONF = CONF = new conf( CONFILE, p_start_params ); - delete p_start_params, - - // Init the statistic manager. - WRAP->STAT = STAT = new stats; - - // Init the html-template manager. - WRAP->HTML = HTML = new html; - #ifdef LOGGING - // Init the system message logd - WRAP->LOGD = LOGD = new logd( CONF->get_elem("httpd.logging.systemfile"), - CONF->get_elem("httpd.logging.systemlines") ); -#endif - - //<<* - // Init the session manager. - WRAP->SMAN = SMAN = new sman; - //*>> - -#ifdef NCURSES - - WRAP->NCUR = NCUR = new ncur; // init the ncurses admin interface. - NCUR->run(); // run the thread - - // Wait until ncurses interface has been initialized. - do { - usleep(1000); - } while ( ! NCUR->is_ready() ); - - HTML->print_cached(0); -#else -#ifdef CLI - cli* p_cli = new cli; - p_cli->run(); -#endif -#endif - - // Init the thread pool - WRAP->POOL = POOL = new pool; - - // Init the socket manager. - WRAP->SOCK = SOCK = new sock; - - //<<* - // Init the chat manager. - WRAP->CHAT = CHAT = new chat; - //*>> - - // Init the system timer. - WRAP->TIMR = TIMR = new timr; - - //<<* - // Init the module-loader manager. - WRAP->MODL = MODL = new modl; - - // Init the garbage collector - WRAP->GCOL = GCOL = new gcol; - - // Init the data manager. -#ifdef DATABASE - WRAP->DATA = DATA = new data; + wrap::LOGD->log_simple_line( s_message + "\n" ); #endif - //*>> - - // Run threads - TIMR->run(); - } #endif @@ -15,21 +15,13 @@ //<<* #include "modl.h" //*>> - #ifdef NCURSES #include "ncur/ncur.h" -#else -#ifdef CLI -#include "cli/cli.h" -#endif #endif - #include "chat/sman.h" #include "sock/sock.h" #include "stats.h" #include "time/timr.h" -#include "thrd/pool.h" - using namespace std; @@ -62,7 +54,6 @@ public: sock* SOCK; stats* STAT; timr* TIMR; - pool* POOL; }; class wrap @@ -80,8 +71,6 @@ public: static void system_message( string s_message ); - static void init_wrapper(map<string,string>* p_start_params); - //<<* static chat* CHAT; #ifdef DATABASE @@ -113,7 +102,6 @@ public: static sock* SOCK; static stats* STAT; static timr* TIMR; - static pool* POOL; static dynamic_wrap* WRAP; }; |
