summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:45 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:45 +0200
commit9dcec1feba68dc5ba38cdc634f5bf113c0f77348 (patch)
tree1d3b0191f4377b0b93ebc67b989e4b8a4f9c3671
parentd34015c5ba231b95de20e9fcd7a33c5b2b9a1006 (diff)
tagging yhttpd-0.7.2yhttpd-0.7.2
-rwxr-xr-x[-rw-r--r--]COPYING1
-rwxr-xr-xMakefile74
-rwxr-xr-xREADME423
-rw-r--r--SHORTDESC2
-rwxr-xr-xconfigure76
-rw-r--r--etc/yhttpd.conf538
-rwxr-xr-xhtml/index.html23
-rwxr-xr-xhtml/notfound.html4
-rwxr-xr-x[-rw-r--r--]html/style.css45
-rw-r--r--scripts/README2
-rwxr-xr-xscripts/astyle.sh3
-rwxr-xr-xscripts/buildnr.pl4
-rwxr-xr-xscripts/checkperl.sh2
-rwxr-xr-xscripts/config.pl6
-rwxr-xr-xscripts/makedist.sh2
-rwxr-xr-xscripts/screen.sh2
-rwxr-xr-xscripts/setglobvals.pl2
-rwxr-xr-xscripts/stats.pl2
-rwxr-xr-xscripts/version.sh6
-rwxr-xr-xsrc/Makefile.in34
-rwxr-xr-xsrc/cli/cli.cpp46
-rwxr-xr-xsrc/cli/cli.h16
-rwxr-xr-xsrc/conf/conf.cpp36
-rwxr-xr-xsrc/conf/conf.h6
-rwxr-xr-xsrc/configure1873
-rw-r--r--src/contrib/README4
-rw-r--r--src/contrib/xml/README2
-rwxr-xr-xsrc/glob.h199
-rwxr-xr-xsrc/html.cpp124
-rwxr-xr-xsrc/html.h34
-rwxr-xr-xsrc/incl.h19
-rwxr-xr-x[-rw-r--r--]src/logd.cpp163
-rwxr-xr-x[-rw-r--r--]src/logd.h30
-rwxr-xr-xsrc/main.cpp128
-rw-r--r--src/maps/hashmap.h14
-rw-r--r--src/maps/nhashmap.h8
-rw-r--r--src/maps/shashmap.h12
-rw-r--r--src/maps/shashmap.tmpl8
-rw-r--r--src/monitor/dump.cpp38
-rw-r--r--src/monitor/dump.h31
-rw-r--r--src/monitor/stats.cpp48
-rw-r--r--src/monitor/stats.h13
-rwxr-xr-xsrc/msgs.h155
-rwxr-xr-xsrc/name.cpp34
-rwxr-xr-xsrc/name.h20
-rwxr-xr-xsrc/ncur/ncur.cpp45
-rwxr-xr-xsrc/reqp.cpp389
-rwxr-xr-xsrc/reqp.h46
-rw-r--r--src/sign.cpp21
-rw-r--r--src/sign.h4
-rwxr-xr-xsrc/sock/sock.cpp75
-rwxr-xr-xsrc/sock/sock.h15
-rwxr-xr-xsrc/time/timr.cpp21
-rw-r--r--src/tool/tool.cpp4
-rw-r--r--src/tool/tool.h2
-rwxr-xr-xsrc/wrap.cpp36
-rwxr-xr-xsrc/wrap.h43
57 files changed, 1760 insertions, 3253 deletions
diff --git a/COPYING b/COPYING
index a43ea21..27058a5 100644..100755
--- a/COPYING
+++ b/COPYING
@@ -106,7 +106,6 @@ above, provided that you also meet all of these conditions:
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
diff --git a/Makefile b/Makefile
index 3bed77d..9e0e9e0 100755
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,83 @@
-MAKE=gmake
-all: base
- @echo "Now edit the ./conf.txt file and run ./ychat!"
+MAKE=`tail -n 1 make.version`
+PREFIX=`grep "define PREFIX" src/glob.h | cut -d'"' -f2`
+all: version base modules
+ @echo "Now edit the yhttpd.conf and run yhttpd!"
+ @echo "The config file is searched in the following order:"
+ @echo " ./yhttpd.conf "
+ @echo " ~/.yhttpd/yhttpd.conf "
+ @echo " ./etc/yhttpd.conf "
+ @echo " /etc/yhttpd.conf "
+ @echo " $(PREFIX)/etc/yhttpd.conf "
+ @echo If you want to help the yhttpd project please run gmake mail
+ @echo so that the developers receive an email about the platform
+ @echo being used.
@echo WARNING! This software is EXPERIMENTAL!
+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 yhttpd" successfullbuild@yChat.org
+ @rm -f mail.tmp
install: deinstall
uninstall: deinstall
deinstall:
@echo Install/deinstall is not supported!
- @echo Start yChat with ./ychat instead!
+ @echo Start yhttpd with ./bin/yhttpd 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/yhttpd; then echo "Backing up old binary";if test -f bin/yhttpd.old; then rm -f bin/yhttpd.old; fi; mv bin/yhttpd bin/yhttpd.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/yhttpd
+base_start: base
+ ./bin/yhttpd
gpl:
@more COPYING
-clean: clean_base
+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 -f bin/yhttpd; then find bin/ -name "*yhttpd*" | xargs rm -f; 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/yhttpd yhttpd.core
+confdebug:
+ ./configure -g3 -ggdb
+dist:
+ @./scripts/makedist.sh
diff --git a/README b/README
index f3d4051..f21fdeb 100755
--- a/README
+++ b/README
@@ -1,8 +1,9 @@
-yChat; Homepage: www.yChat.org; Version 0.5.3-RELEASE
+yhttpd; Homepage: www.yChat.org; Version 0.7.2-RELEASE
+
Copyright (C) 2003 Paul C. Buetow, Volker Richter
-Copyright (C) 2005 Paul C. Buetow
+Copyright (C) 2004 Paul C. Buetow
+Copyright (C) 2005 EXA Digital Solutions GbR
-----------------------------------------------------------------
-
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
@@ -16,224 +17,335 @@ 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 LEGACY YCHAT 0.5 TABLE OF CONTENTS
-1.0.0 REQUIREMENTS
-1.1.0 TESTED PLATFORMS
-1.2.0 IMPORTANT NOTES
-1.3.0 HOW TO OBTAIN YCHAT
-1.3.1 INSTALLATION
-1.5.0 CUSTOMIZATION
-1.6.0 FILES
-1.7.0 WRITING BUG REPORTS
-1.8.0 CONTACT
+YHTTPD TABLE OF CONTENTS:
+
+0.0 ABOUT DEVELS
+1.0 REQUIREMENTS
+1.1 TESTED PLATFORMS
+1.2 IMPORTANT NOTICES
+1.3 HOW TO OBTAIN YHTTPD
+1.3 INSTALLATION
+1.3 INSTALLATION QUICK-START
+1.4 HOW TO USE SCREEN WITH YHTTPD
+1.4 HOW TO USE SIGNALS WITH YHTTPD
+1.5 CUSTOMIZATION
+1.6 FILES
+1.7 WRITING BUG REPORTS
+1.8 CONTACT
+2.0 CREDITS
+
+0.0 ABOUT DEVELS
+
+There are several projects involved:
+
+- The chat -
+Its a HTTP based chat server written in C++. Clients are normal web browsers
+such as MSIE or Gecko based browsers using only CSS, HTML and JavaScript.
+
+- The httpd -
+Its a small http server based on the chat's socket and threading engine.
+yhttpd does not have as much features but is easy to use and faster than
+apache. yhttpd is a subset of the chat. It can be generated using the
+srcipts/yhttpdbase.pl script in the chat's source tree.
+
+- The ycurses -
+ycurses is a easy to use and small C++ wrapper of the C ncurses API.
+
+There are different branches:
+
+- CURRENT -
+The CURRENT branch is unstable, this is the bleeding developing edge with
+all the new experimental features.
+
+A DEVEL of CURRENT can be referred as CURRENTDEVEL.
+
+- STABLE -
+The STABLE branch is more stable than CURRENT. This branch may get new
+features as well. But those will be more conservative compared to
+CURRENT.
+
+A DEVEL of STABLE can be referred as STABLEDEVEL.
+
+- LEGACY -
+The LEGACY branch has no real support. This branch may get bugfixes and
+updates and might get minor improvements. But there is no garuantee to
+be bug free and stable at all. LEGACY versions are of historic meaning.
+
+- DEVEL -
+DEVEL is only a meta name. If a version is labeled with DEVEL, then its
+currently undefined if this is a CURRENT, STABLE or LEGACY branch. It
+can be everything. Commonly DEVEL versions are CURRENT.
+
+There are also releases made:
+
+- DEVEL -
+There can be DEVELs made out of each branch. While a branch can get
+new features, a DEVEL can not. A DEVEL of a branch is just like
+a snapshot. DEVELs are complete versions to test and use. But keep
+in mind, that a DEVEL of the STABLE branch is recommended over a
+DEVEL of a CURRENT or a LEGACY branch in a production environment.
+DEVELs of CURRENT are still the bleeding edge and DEVELs of LEGACY
+may be out of date.
+
+
+1.0 REQUIREMENTS:
-1.0.0 REQUIREMENTS:
+- GNU GCC G++
+ The GNU C++ compiler version 3.1 or up.
-- gcc 3.x
- The GNU C++ compiler.
+- 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.
+ yhttpd Makefiles only have been tested with GNU make and may not work with
+ other make versions.
-1.1.0 TESTED PLATFORMS:
+- 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.
-The following platforms have been tested with success:
+- ncurses 5.x
+ Includes libncurses and the ncurses.h header files.
-- Linux with GCC 3.2.0, GNU make 3.79.1
-- FreeBSD 5.1-RELEASE-p2, GCC 3.2.2, GNU make 3.80
-- FreeBSD 5.3-RELEASE, GCC 3.4, GNU make 3.80
+- Screen
+ Only needed if yhttpd should run in background with
+ ncurses or CLI enabled.
-1.2.0 IMPORTANT NOTES:
+- Perl 5.x
+ Is needed for some scripts. Is not needed if you use precompiled binaries.
+
+1.1 TESTED PLATFORMS:
+
+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-DEVEL (i386) 3.4 3.80
+
+ Tested longer time before:
+- FreeBSD 5.2-DEVEL (i386) 3.3 3.80
+- FreeBSD 4.10-DEVEL (i386) 3.4 3.80
+- FreeBSD 4.9-DEVEL (i386) 3.3 3.80
+- Gentoo Linux 2004 (i386) 3.3 3.80
+- OpenBSD 3.6 SMP (i386) 3.3 3.80
+- Red Hat Linux 8.0 SMP (i386) 3.2-7 3.79
+- Slackware Linux 10.0 (i386) 3.4 3.80
+- SUSE Linux 9.0 (i386) 3.3 3.80
+- SUSE Linux 8.1 (i386) 3.2 3.79
+
+Other platforms like Linux based systems, other BSD-Systems or UNICES
+are very likely to work too.
+
+1.2 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 yhttpd, please write us an email and tell what
+you can/like/would help ;-]. Please also take a look at the yhttpd
homepage which is located at http://www.yChat.org.
-1.3.0 HOW TO OBTAIN YCHAT:
+1.3 HOW TO OBTAIN YHTTPD:
-yChat can be downloaded as a source package or through CVS.
+yhttpd 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/yhttpd/yhttpd .
-For CVS download type also look at the homepage please.
+For CVS download type:
-1.3.1 INSTALLATION:
+cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot login
+( You will be asked for a password. Use "just enter" ).
-Invoke "./configure" and afterwards "make", edit the conf.txt.
+vs -z3 -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot co BRANCH
+( The sources will be copied into your local folder )
-Now we want to compile all the dynamic loadable modules of ychat.
-Invoke "cd cmnd && ./compile.sh && cd -". All command modules should get
-compiled.
+cvs -d:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot logout
+( Logs your CVS session out ).
-Now its time to run the server with ./ychat.
-Then point your webbrowser to http://yourip:port !
+Now you may continue with the installation.
-... have fun :-).
+here are different branches in the CVS:
-1.5.0 CUSTOMIZATION:
+yhttpd: This is the latest CURRENT branch of yhttpd.
+yhttpd-stable: This is the latest STABLE branch of yhttpd.
+yhttpd-X.Y: This is the branch with the specified version prefix.
+yhttpd: This is the latest CURRENT snapshot of yhttpd.
-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.
-Dynamic loadable modules can be found in the cmnd/ subdirectory.
+The CURRENT branch of yhttpd is mostly untested and unstable, so don't
+cry if you get errors.
-1.6.0 FILES: ( This list is not complete )
+1.3 INSTALLATION:
-conf.txt - The yChat configuration file. ( read by conf.cpp ).
+Invoke "./configure". Afterwards you will get prompted with the before-compile
+options of yhttpd. After choosing those options you are ready to type "gmake"
+afterwards. See below what gmake is doing.
-Files in ./src:
-base.cpp - Encapsulates vector fields of room's or user ( may be later
- hash_maps ) and provides methods for manipulating data
- objects.
+You may also invoke gmake with the following options (the PREFIX can be set
+in the yhttpd configurator which will be launched by the top configure script
+or gmake config):
-hmap.cpp - The hash map implementation which is a very fast data
- structure. is needed for saving users, rooms and so on.
+ 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 confdebug (runs ./configure with enabling debugging)
+ gmake config (runs yhttpd configurator)
+ gmake debug (runs gdb on ./yhttpd.core)
+ gmake dist (creates a .tar.bz2 ball)
+ gmake gpl (shows the GNU General Public License)
+ gmake help (shows all available yhttpd gmake targets)
+ gmake mail (sends a mail to the yhttpd 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 stats (generates yhttpd statistics)
+ gmake version (shows the current version of yhttpd)
-main.cpp - This includes the required manager headers for starting
- the server and finally regulates the correct starting.
+Example: "gmake all install clean" compiles everything, installs it to PREFIX
+and cleans the source directories.
-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.
+Now its time to run the server with ./bin/yhttpd.
-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.
+Aferwards point your webbrowser to http://yourip:port !
-reqp.cpp - This class implements the http request parser. If a client
- starts a request to the server the reqp class will be
- invoked.
+... have fun :-).
-room.cpp - Specifies a chat room. For each chat room an instance of
- this class exists.
+1.3 INSTALLATION QUICK START:
-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.
+If you in hury, then you may just type gmake setup. In the yhttpd configurator
+you may just choose all the default values. If done, yhttpd will get compiled
+and is ready to run with ./bin/yhttpd!
-user.cpp - Specifies a chat user. For each chat user an instance of
- this class exists.
-Abstract classes:
-cont.cpp - All classes which need to store "key - value" data sets
- inherit from this class. ( cont for content ).
+1.4 HOW TO USE SCREEN WITH YHTTPD:
-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.
+If you are running yhttpd in ncurses mode you might want to install
+the tool which is called "screen". This will enable you putting the
+ncurses interface into the background, closing the terminal session
+and reusing the interface later through another terminal.
+
+Just do:
+
+ screen -S yhttpd ./bin/yhttpd ( creates a new session and starts yhttpd in it )
+ ctrl+d+a ( will detach the yhttpd session )
+ ( closing the terminal )
+ ( opening a new terminal )
+ screen -r yhttpd ( will return you to the yhttpd process )
-As described ( main.cpp ), there are so called managers. Managers are
-accessible through their assigned wrapper classes and may be
-instanciated only once.
+Screen will terminate automaticaly if all processes in its sessions are
+terminated.
-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.
+For a closer look read the screen manual page ( man screen ).
-conf.cpp - The config manager. Parses the config file specified in
- glob.h and stores all the values of it in a map.
+1.4 HOW TO USE SIGNALS WITH YHTTPD:
-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.
+You can send UNIX signals to yhttpd. This becomes very interesting if you
+don't use the command line interface or the ncurses interface and you
+don't have access to the options below.
-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'.
+Run one of the following commands to send the signal you want:
+($PID is here the process id of the current yhttpd process)
-sock.cpp - The socket manager. Manages the socket connections. There
- are multiplexed sockets. For each requests a new POSIX thread
- will be created.
+kill -USR1 $PID # yhttpd clears the HTML template cache
+kill -HUP $PID # yhttpd will shutdown savely
-Files with a leading s_ contain static C++ classes
+1.5 CUSTOMIZATION:
-s_chat.cpp - Static wrapper for the dynamic chat class. holds one global
- reachable instance of chat until the program shuts down.
+If you like to customize the design/layout/language of yhttpd, you will have
+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/yhttpd.conf).
-s_conf.cpp - Static wrapper for the dynamic conf class. holds one global
- reachable instance of conf until the program shuts down.
+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.
-s_html.cpp - Static wrapper for the dynamic html class. holds one global
- reachable instance of conf until the program shuts down.
+You can edit the etc/yhttpd.conf to fit your needs. If you dont want to change
+the config file, then you also can use yhttpd start parameters.
-s_mutx.cpp - Static wrapper for the dynamic mutx class. holds one global
- reachable instance of conf until the program shuts down.
+Exmpl: ./bin/yhttpd -o chat.database.password secretpassword
-s_sock.cpp - Static wrapper for the dynamic sock class. holds one global
- reachable instance of conf until the program shuts down.
+You can also use multiple words for a specific option.
-s_tool.cpp - Static class which includes some usefull global reachable
- methods which are not integraded in independent classes.
+Exmpl: ./bin/yhttpd -o yhttpd.version "word1 word2 word3"
-Special header files ( all other header files which are not listed here
-belong to their respective .cpp files ):
+will overwrite the default database password value of the yhttpd.conf. You can
+do this with every configuration element by adding several -o option value
+arguments to the start command.
-glob.h - Defines global variables which are known by compilation
- time.
+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.
-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.
+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 ).
-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.
+1.6 FILES:
-The basic class structure:
+etc/yhttpd.conf - The yhttpd configuration file
+html/* - The html template files
+src/* - The yhttpd base sources
+src/mods/* - The dynamic loadable modules sources
+scripts/* - Some nice scripts needed for building & co.
- base<room> base<user>
- | | name
- | | / \
- | | / \
- chat room user
+The following is created by building yhttpd:
+obj/* - The object files of the compiled yhttpd base
+mods/* - The compiled dynamic loadable modules
+bin/yhttpd - The yhttpd binary (linked by the object files)
+
+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
- cont
- / \
- / \
-conf html
1.7 WRITING BUG REPORTS
How to submit a good bug report?
-Send them to Bug@yChat.org.
+Send them to mail at yhttpd dot org.
First you should give the following information:
-- yChat version, if CVS (or devel. tarball) then which day?
+- yhttpd 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?
-Getting backtrace of the crash also helps a lot, especially if yChat crashes randomly. If after crash you see text:
+Getting backtrace of the crash also helps a lot, especially if yhttpd crashes
+randomly. If after crash you see text:
"segmentation fault (core dumped)"
-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:
+It writes a file named "core" or "yhttpd.core" depending on your OS to directory
+where you started yhttpd. 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 yhttpd. To do this, say:
ulimit -c unlimited
-So, if you have the core file and GNU debugger (gdb), you can get the backtrace with:
+So, if you have the core file and GNU debugger (gdb), you can get the
+backtrace with:
- gdb ychat core
+ gdb ./bin/yhttpd yhttpd.core
bt
Paste all the lines starting from line having #0 at the beginning.
Here's an example session:
- 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> > >&) ()
+ 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> > >&) ()
+ #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*) ()
@@ -241,20 +353,43 @@ Here's an example session:
#5 0x281d44ae in _thread_start () from /usr/lib/libc_r.so.5
(gdb)
+If you dont get such a gdb output, you need to recompile the yhttpd using
+debuggig symbols. You can do it this way:
+
+cd yhttpd
+gmake clean confdebug all run
+
1.8 CONTACT:
You may contact us through the following addresses:
- Homepage
- The yChat homepage is located at http://www.yChat.org
+ The yhttpd homepage is located at http://www.yChat.org
+ The EXA Digital Solutions homepage is located at http://www.exa-ds.com
- 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: Buetow at yhttpd point org ( core developer )
+ Mail at yhttpd dot org ( reaches everybody of yhttpd )
- ICQ
Paul C. Buetow: 11655527
- IRC
- #ychat at irc.german-elite.net
+ #Ychat and #Coding at irc.german-elite.net
+
+- EXA Digital Solutions GbR
+ Laubenstr. 16b
+ D-44866 Bochum
+ Germany
+
+
+2.0 CREDITS
+
+Thanks to the following persons. Without them yhttpd would not be like today:
+
+- Volker Richter <volker at exa-ds dot de> of EXA Digital Solutions GbR
+ (http://www.exa-ds.com) for adding initial MySQL support and lots of more
+ code.
+
+- Joshia Teitelbaum <joshuat at cryptomail.org> of CryptpMail.org for adding
+ lots of security patches in the HTTP header handling.
diff --git a/SHORTDESC b/SHORTDESC
index 080814b..9c45c31 100644
--- a/SHORTDESC
+++ b/SHORTDESC
@@ -1,2 +1,2 @@
-The yChat 0.7 branch is marked as STABLE and will only get bugfixes and minor
+The yhttpd 0.7 branch is marked as STABLE and will only get bugfixes and minor
improvements. Most of the new stuff will go into the CURRENT branch instead.
diff --git a/configure b/configure
index 333efb0..9aab971 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,77 @@
#!/bin/sh
-cd ./src
-./configure
+if ! ./scripts/checkperl.sh
+then
+ 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);
+ }
+
+ system("perl \"scripts/config.pl\"");
+ chdir("src");
+ system("./configure ".join(" ", @ARGV));
+ chdir("..");
+
+ exit(0);
+' `echo "$*" | sed "s/-//g"`
+
+if test -f err
+then
+ rm -f err
+else
+ echo You are ready to type gmake now!
+fi
diff --git a/etc/yhttpd.conf b/etc/yhttpd.conf
index e93bc32..d46ab2d 100644
--- a/etc/yhttpd.conf
+++ b/etc/yhttpd.conf
@@ -1,515 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
-<category name="chat">
- <option name="defaultop">
- <value>Snoop</value>
- <descr>The default user which has operator status</descr>
- </option>
- <option name="defaultrang">
- <value>3</value>
- <descr>The default user rang/status</descr>
- </option>
- <option name="defaultroom">
- <value>Lounge</value>
- <descr>The default chat room</descr>
- </option>
- <option name="printalwaystime">
- <value>true</value>
- <descr>If true, for each message in the chat window will be printed out the current time</descr>
- </option>
- <option name="timeoffset">
- <value>0</value>
- <descr>The time offset. Negative values are not allowed. If you have an offset of X please enter 24+X+12 here. Example: Offset = -6, 24-6+12 = 30 :)</descr>
- </option>
- <category name="permissions">
- <option name="uptime">
- <value>1</value>
- </option>
- <option name="ko">
- <value>1</value>
- </option>
- <option name="topic">
- <value>2</value>
- </option>
- <option name="ren">
- <value>1</value>
- </option>
- <option name="version">
- <value>3</value>
- </option>
- <option name="s">
- <value>3</value>
- </option>
- <option name="msg">
- <value>3</value>
- </option>
- <option name="me">
- <value>3</value>
- </option>
- <option name="m">
- <value>3</value>
- </option>
- <option name="j">
- <value>3</value>
- </option>
- <option name="getroom">
- <value>3</value>
- </option>
- <option name="away">
- <value>3</value>
- </option>
- <option name="q">
- <value>3</value>
- </option>
- <option name="time">
- <value>3</value>
- </option>
- <option name="col">
- <value>3</value>
- </option>
- <option name="help">
- <value>3</value>
- </option>
- </category>
- <category name="database">
- <option name="mincon">
- <value>9</value>
- <descr>The amount of database connections which will be created at yhttpd startup</descr>
- </option>
- <option name="maxcon">
- <value>10</value>
- <descr>The maximum amount of concurrent connections to the database</descr>
- </option>
- <option name="contimeout">
- <value>600</value>
- <descr>Seconds of idling after a database connection will be closed. Will be checked once each minute</descr>
- </option>
- <option name="serverhost">
- <value>fibonacci.exa-ds.com</value>
- <descr>Specifies hostname oder ip address of the MySQL database server</descr>
- </option>
- <option name="user">
- <value>yhttpd</value>
- <descr>Specifies the MySQL username</descr>
- </option>
- <option name="password">
- <value>yctest</value>
- <descr>Specifies the MySQL password</descr>
- </option>
- <option name="dbname">
- <value>yhttpd_advanced</value>
- <descr>Specifies the MySQL database name</descr>
- </option>
- <option name="port">
- <value>3306</value>
- <descr>Specifies the MySQL server port</descr>
- </option>
- <category name="mysql">
- <option name="registernick">
- <value>user nick password color1 color2 email registerdate</value>
- </option>
- <option name="savechangednick">
- <value>user password color1 color2 status email</value>
- </option>
- <option name="selectlogin">
- <value>user nick password color1 color2 status email</value>
- <descr>Specifies the fields which will be selected from the database if a registered user loggs in</descr>
- </option>
- <option name="selectnick">
- <value>user nick</value>
- <descr>Specifies the fields which will be selected from the database a user tries to logg in. Here only the nick will be fetched to check if the username is registered or not</descr>
- </option>
- </category>
- </category>
- <category name="maxlength">
- <option name="message">
- <value>500</value>
- <descr>Maximum length of a chat message</descr>
- </option>
- <option name="username">
- <value>15</value>
- <descr>Maximum length of a user name</descr>
- </option>
- <option name="roomname">
- <value>20</value>
- <descr>Maximum length of a room name</descr>
- </option>
- <option name="emailaddress">
- <value>20</value>
- <descr>Maximum length of an email address</descr>
- </option>
- <option name="password">
- <value>20</value>
- <descr>Maximum length of the user password</descr>
- </option>
- <option name="topic">
- <value>20</value>
- <descr>Maximum length of a room&apos;s topic</descr>
- </option>
- </category>
- <category name="system">
- <option name="mysqlclient">
- <value>/usr/local/bin/mysql</value>
- <descr>Full path to the mysql client program</descr>
- </option>
- </category>
- <category name="msgs">
- <option name="servertime">
- <value>The server system time:</value>
- </option>
- <option name="guest">
- <value>This person is a guest chatter!</value>
- </option>
- <option name="lastactivity">
- <value>Last activity:</value>
- </option>
- <option name="userrenamesroom">
- <value> renames the room into </value>
- </option>
- <option name="optionschanged">
- <value>Your options have been changed!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="rang0">
- <value>Operator</value>
- </option>
- <option name="rang1">
- <value>Half-Operator</value>
- </option>
- <option name="rang2">
- <value>Voiced user</value>
- </option>
- <option name="registernick">
- <value>Your nick has been registered successfully. You may log in now!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="reloadonlineframe">
- <value>Reloaded online frame</value>
- </option>
- <option name="scream">
- <value> screams:</value>
- </option>
- <option name="servertime">
- <value>The server system time::</value>
- </option>
- <option name="setcommandstatus">
- <value> sets command status</value>
- </option>
- <option name="setmodeaway">
- <value> sets mode away:</value>
- </option>
- <option name="setmodefake">
- <value>Fake modus acticated!</value>
- </option>
- <option name="setmodeinvisible">
- <value>Invisible modus deactivated!</value>
- </option>
- <option name="topic">
- <value> changes the topic to:</value>
- </option>
- <option name="topiccut">
- <value>The topic you|ve choosen was too long and has been cut!</value>
- </option>
- <option name="topicdelete">
- <value> deletes the topic of the room.</value>
- </option>
- <option name="unsetmodeaway">
- <value> is back</value>
- </option>
- <option name="unsetmodefake">
- <value>Fake modus deactivated!</value>
- </option>
- <option name="unsetmodeinvisible">
- <value>Invisible modus deactivated!</value>
- </option>
- <option name="uptime">
- <value>yhttpd uptime:</value>
- </option>
- <option name="userautoawaytimeout">
- <value> has been set to away (auto away)</value>
- </option>
- <option name="userenterschat">
- <value> enters the chat.</value>
- </option>
- <option name="userentersroom">
- <value> enters the room </value>
- </option>
- <option name="userhasstatus">
- <value> has status </value>
- </option>
- <option name="userinroom">
- <value> is in room </value>
- </option>
- <option name="userkicksout1">
- <value> kicks </value>
- </option>
- <option name="userkicksout2">
- <value> out of the chat at room </value>
- </option>
- <option name="userleaveschat">
- <value> leaves the chat.</value>
- </option>
- <option name="userleavesroom">
- <value> leaves this room and switches to </value>
- </option>
- <option name="whisper">
- <value> whispers to you</value>
- </option>
- <option name="whisperto">
- <value>Whispered to </value>
- </option>
- <category name="help">
- <option name="away">
- <value>Sets mode away. Usage: /away AWAYTEST</value>
- </option>
- <option name="col">
- <value>Changes the color. Usage: /col NICKCOLOR TEXTCOLOR</value>
- </option>
- <option name="exec">
- <value>Executes a command in the system shell. Usage: /exec SHELLCOMMAND</value>
- </option>
- <option name="fake">
- <value>Hides status logo. Usage: /fake</value>
- </option>
- <option name="getrusage">
- <value>Shows informations describing the resources utilized by the yhttpd process. Usage: /getrusage</value>
- </option>
- <option name="help">
- <value>Shows help text for a specific command. Usage: /help chatcommand</value>
- </option>
- <option name="invisible">
- <value>Activates or deactivates the invisible mode</value>
- </option>
- <option name="j">
- <value>Changes the room. Usage: /j ROOMNAME</value>
- </option>
- <option name="ko">
- <value>Kicks a user out of the chat. Usage: /ko NICKNAME</value>
- </option>
- <option name="m">
- <value>Writes the text italic (two colors). Usage: /m ACTION</value>
- </option>
- <option name="md5">
- <value>MD5 hashes SOME STRINGS with SALT. Usage: /md5 SOME STRINGS SALT</value>
- </option>
- <option name="me">
- <value>Writes the text italic (one color). Usage: /m ACTION</value>
- </option>
- <option name="msg">
- <value>Whispers TEXT to NICKNAME. Usage: /msg NICKNAME TEXT</value>
- </option>
- <option name="version">
- <value>Shows the version of the running yhttpd server. Usage: /version</value>
- </option>
- <option name="q">
- <value>Leaving the chat. Usage: /q</value>
- </option>
- <option name="ren">
- <value>Renames the current room into NEWROOMNAME. Usage: /ren NEWROOMNAME</value>
- </option>
- <option name="reload">
- <value>Reloads the online frame of the current room. Usage: /reload</value>
- </option>
- <option name="set">
- <value>Changes command permissions. P.e.: &quot;/set q status 3&quot; allows the command from status 3 or &quot;/set q disable 1&quot; deactivates the command. Disable 0 reactivates the command again. Usage: /set COMMAND MODE VAL</value>
- </option>
- <option name="getroom">
- <value>Shows the room of the specific user. Useage: /getroom NICKNAME</value>
- </option>
- <option name="time">
- <value>Shows the server system time. Usage: /time</value>
- </option>
- <option name="uptime">
- <value>Shows the yhttpd uptime. Usage: /uptime</value>
- </option>
- <option name="s">
- <value>Screams the TEXT. Usage: /s TEXT</value>
- </option>
- <option name="topic">
- <value>Changes the topic of the current room into TOPIC. Usage: /topic TOPIC</value>
- </option>
- </category>
- <category name="err">
- <option name="alpnum">
- <value>The nick you have specifued is not alphanumeric, please change that.&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="alreadyinroom">
- <value>You are already in the room</value>
- </option>
- <option name="changepassword">
- <value>The old password you have entered is wrong. In order to change your password you need to enter a correct old password!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="changepassword2">
- <value>The two password fiels oth the new password are not identical. Please check that again otherwise the password will not be changed!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="emaillength">
- <value>Your email address is too long!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="execcommand">
- <value>Could not execute command!</value>
- </option>
- <option name="findingcommand">
- <value>No such command!&lt;br&gt;</value>
- </option>
- <option name="messagelength">
- <value>Your message was too long and has been shortened!</value>
- </option>
- <option name="nicklength">
- <value>Your nick is too long!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="nonick">
- <value>You need to specify a nickname!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="noroom">
- <value>You have to enter a valid room name!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="notavailable">
- <value>is not available!</value>
- </option>
- <option name="notonline">
- <value>An error occured. Your nick is not online!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="online">
- <value>The nick you have specified is already online. Please try another nick!!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="passlength">
- <value>Your password is too long!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="registerexists">
- <value>The nickname you want to register already exists. Please choose another one!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="registerpassword">
- <value>The password selections differ. Please re-enter your password fields!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="roomexists">
- <value>The new name of the room you have choosen is already taken by another room!</value>
- </option>
- <option name="roomnamelength">
- <value>Your room name too long!&lt;br&gt;&lt;br&gt;</value>
- </option>
- <option name="wrongcommandusage">
- <value>Wrong command usage. Please read the help site!</value>
- </option>
- <option name="wrongpassword">
- <value>The nickname you have selected already exists in the user database and you have entered a wrong password!&lt;br&gt;&lt;br&gt;</value>
- </option>
- </category>
- </category>
- <category name="idle">
- <option name="awaytimeout">
- <value>1800</value>
- <descr>Seconds of inanctivity after a user will get logged out if the user is away</descr>
- </option>
- <option name="autoawaytimeout">
- <value>500</value>
- <descr>Seconds until a user will be set to away automatically</descr>
- </option>
- <option name="timeout">
- <value>900</value>
- <descr>Seconds of inactivity after a user will get logged out automatically</descr>
- </option>
- </category>
- <category name="session">
- <option name="md5hash">
- <value>true</value>
- <descr>If set to true, then the session id will be hashed by MD5 to make the id even more random</descr>
- </option>
- <option name="md5salt">
- <value>tASDlkjadSD</value>
- </option>
- <option name="length">
- <value>64</value>
- <descr>Length of the generated session id. The length will be shorter if md5hash is activated</descr>
- </option>
- <option name="validchars">
- <value>.abcdefghijklmnopqrstuvwxyz0123456789-_</value>
- <descr>Valid chars which can be in a session id. The generated session will use other chars if md5hash is activated</descr>
- </option>
- <option name="kloakkey">
- <value>123987</value>
- <descr>Some numner which will affect the session id. Change this to another random number!</descr>
- </option>
- </category>
- <category name="html">
- <option name="tagsallow">
- <value>false</value>
- <descr>If set to false, yhttpd strips all html tags from incoming messages</descr>
- </option>
- <option name="errorcolor">
- <value>FF0000</value>
- <descr>Specifies the standard error message color</descr>
- </option>
- <option name="onlinebefore">
- <value>&lt;tr&gt;&lt;td&gt;</value>
- <descr>HTML-Tags which will be placed before each nickname in the user online frame</descr>
- </option>
- <option name="onlinebehind">
- <value>&lt;/td&gt;&lt;/tr&gt;</value>
- <descr>HTML-Tags which will be placed behind each nickname in the user online frame</descr>
- </option>
- <category name="rangimages">
- <option name="location">
- <value>images/</value>
- <descr>Specifies the location of the status (status) symbols of the users. This path has to be reachable through the web, e.g.: &quot;http://www.webreachable.com/images/&quot;. If no http:// is specified then the images are inside the conf:httpd.templatedir directory</descr>
- </option>
- <option name="options">
- <value> width=&quot;16&quot; height=&quot;16&quot;</value>
- <descr>Options to add to the &lt;img&gt; tag (leave first char blank)</descr>
- </option>
- </category>
- <category name="user">
- <option name="color1">
- <value>AAAAAA</value>
- <descr>User&apos;s standard nick color in hexadecimal</descr>
- </option>
- <option name="color2">
- <value>FFFFFF</value>
- <descr>User&apos;s standard text color in hexadecimal</descr>
- </option>
- </category>
- <category name="replace">
- <option name="activate">
- <value>true</value>
- <descr>If set to true, then this replace option will be used</descr>
- </option>
- <category name="from">
- <option name="red">
- <value>red</value>
- </option>
- <option name="green">
- <value>green</value>
- </option>
- <option name="orange">
- <value>orange</value>
- </option>
- <option name="yellow">
- <value>yellow</value>
- </option>
- </category>
- <category name="into">
- <option name="red">
- <value>&lt;font color=&quot;red&quot;&gt;red&lt;/font&gt;</value>
- </option>
- <option name="green">
- <value>&lt;font color=&quot;green&quot;&gt;green&lt;/font&gt;</value>
- </option>
- <option name="orange">
- <value>&lt;font color=&quot;orange&quot;&gt;orange&lt;/font&gt;</value>
- </option>
- <option name="yellow">
- <value>&lt;font color=&quot;yellow&quot;&gt;yellow&lt;/font&gt;</value>
- </option>
- </category>
- </category>
- </category>
- <category name="logging">
- <option name="roomlogdir">
- <value>log/rooms/</value>
- <descr>Specifies the relative or absolute path to the directory of the room log files</descr>
- </option>
- <option name="roomloglines">
- <value>10</value>
- <descr>Number of room log lines which will be buffered in the main memory until they will be written into the file</descr>
- </option>
- </category>
-</category>
+<config>
<category name="httpd">
<option name="serverport">
<value>2000</value>
@@ -527,6 +17,10 @@
<value>html/</value>
<descr>If set to false, yhttpd 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>
@@ -534,13 +28,13 @@
</option>
</category>
<category name="thread">
- <option name="poolsize">
- <value>50</value>
- <descr>Number of threads running at the same time</descr>
- </option>
- <option name="queuesize">
+ <option name="initpoolsize">
<value>10</value>
- <descr>Max. number of jobs which can wait for a free thread of the thread pool</descr>
+ <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>
+ </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>
</option>
</category>
<category name="stats">
@@ -569,7 +63,7 @@
<descr>If set to true, all command modules will be preloaded at server startup</descr>
</option>
<option name="preloadhtml">
- <value>false</value>
+ <value>true</value>
<descr>If set to true, all html modules will be preloaded at server startup</descr>
</option>
</category>
@@ -583,11 +77,11 @@
<descr>Specifies the relative or absolute path to the system messsage log file</descr>
</option>
<option name="accesslines">
- <value>10</value>
+ <value>0</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>10</value>
+ <value>0</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>
@@ -613,8 +107,12 @@
<option name="png">
<value>image/png</value>
</option>
+ <option name="txt">
+ <value>text/plain</value>
+ </option>
<option name="default">
<value>text/html</value>
</option>
</category>
</category>
+</config>
diff --git a/html/index.html b/html/index.html
index 7bc01b0..66dca39 100755
--- a/html/index.html
+++ b/html/index.html
@@ -1,32 +1,27 @@
+<!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%%
+ %%yhttpd.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 align=center class=header>%%yhttpd.version%%<br><br>%%INFO%%</td>
</tr>
<tr>
- <td colspan=2>&nbsp;</td>
+<td colspan=2>&nbsp;</td>
</tr>
<tr>
- <td align=center colspan=2>
-Enter your nick:
-<form action="frameset.html" method="GET">
- <input type="hidden" name="event" value="login">
- <input type="hidden" name="room" value="%%STRDROOM%%">
- <input type="text" name="nick">
- <input type="submit" value="login">
-</form>
+<td align=center colspan=2>
+This is the demo website provided by yhttpd :-)
</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">yhttpd 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/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/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/README b/scripts/README
index 189b169..4a94391 100644
--- a/scripts/README
+++ b/scripts/README
@@ -1,4 +1,4 @@
-All scripts should be run from the yChat main directory, example:
+All scripts should be run from the yhttpd main directory, example:
./scripts/makeyhttpd.pl
diff --git a/scripts/astyle.sh b/scripts/astyle.sh
index 757364e..8f67195 100755
--- a/scripts/astyle.sh
+++ b/scripts/astyle.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# The yChat Project (2004, 2005)
+# The yhttpd Project (2004)
#
# This uses "astyle" to format C++ code into a specific code style!
diff --git a/scripts/buildnr.pl b/scripts/buildnr.pl
index ee3d3e2..edfffd6 100755
--- a/scripts/buildnr.pl
+++ b/scripts/buildnr.pl
@@ -1,8 +1,8 @@
#!/usr/bin/perl
-# The yChat Project (2003)
+# The yhttpd Project (2003)
#
-# This script increases the BUILNR of msgs,h each time the yChat
+# This script increases the BUILNR of msgs,h each time the yhttpd
# gets recompiled!
use strict;
diff --git a/scripts/checkperl.sh b/scripts/checkperl.sh
index fa5e98f..642938b 100755
--- a/scripts/checkperl.sh
+++ b/scripts/checkperl.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# The yChat Project (2005)
+# The yhttpd Project (2005)
#
# This scripts checks for a perl installation
diff --git a/scripts/config.pl b/scripts/config.pl
index 79b1c49..af58012 100755
--- a/scripts/config.pl
+++ b/scripts/config.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# The yChat Project (2004, 2005)
+# The yhttpd Project (2004, 2005)
#
# This script modifues the src/glob.h file.
@@ -8,11 +8,11 @@ use strict;
use scripts::modules::file;
print <<END;
-Welcome to the yChat configurator!
+Welcome to the yhttpd configurator!
You may also edit the src/glob.h file manually instead of using
this configurator option. Please also notice that this are only
before-compile options. All setups which can be made after com-
-iling are placed in the yChat configuration file.
+iling are placed in the yhttpd configuration file.
END
my $sep = "================================================================\n";
diff --git a/scripts/makedist.sh b/scripts/makedist.sh
index 6c51a07..0814611 100755
--- a/scripts/makedist.sh
+++ b/scripts/makedist.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# The yChat Project (2005)
+# The yhttpd Project (2005)
#
# This script creates a .tar.bz2 ball.
diff --git a/scripts/screen.sh b/scripts/screen.sh
index 6d5b7aa..5c227fc 100755
--- a/scripts/screen.sh
+++ b/scripts/screen.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-screen -S ychat ./bin/ychat
+screen -S yhttpd ./bin/yhttpd
diff --git a/scripts/setglobvals.pl b/scripts/setglobvals.pl
index 13288a5..1ee1de4 100755
--- a/scripts/setglobvals.pl
+++ b/scripts/setglobvals.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# The yChat Project (2003)
+# The yhttpd Project (2003)
#
# This script sets up some variables in src/glob.h
diff --git a/scripts/stats.pl b/scripts/stats.pl
index b55bc9e..96fbdf1 100755
--- a/scripts/stats.pl
+++ b/scripts/stats.pl
@@ -76,7 +76,7 @@ sub filestats
$stats{"Number of script files"}++;
$stats{"Lines of scripts"} += countlines($shift);
}
- elsif ( $shift =~ /(\.txt|README|INSTALL|COPYING|NEWS|SNAPSHOT|ChangeLog)$/ )
+ elsif ( $shift =~ /(\.txt|[A-Z]+)$/ )
{
$stats{"Number of text files"}++;
$stats{"Lines of text"} += countlines($shift);
diff --git a/scripts/version.sh b/scripts/version.sh
index 46b9fc5..50c189c 100755
--- a/scripts/version.sh
+++ b/scripts/version.sh
@@ -1,11 +1,11 @@
#!/bin/sh
-# The yChat Project (2005)
+# The yhttpd Project (2005)
#
-# This script shows yChat VERSION-BRANCH Build BUILDNUMBER
+# This script shows yhttpd VERSION-BRANCH Build BUILDNUMBER
version=`grep VERSION src/msgs.h | head -n 1 | cut -d'"' -f2`
branch=`grep BRANCH src/msgs.h | head -n 1 | cut -d'"' -f2`
build=`grep BUILD src/msgs.h | tail -n 1 | cut -d' ' -f3`
-echo "yChat $version-$branch Build $build"
+echo "yhttpd $version-$branch Build $build"
diff --git a/src/Makefile.in b/src/Makefile.in
index 779ce5b..262f3a6 100755
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,15 +1,21 @@
-SRCS=chat.cpp s_chat.cpp cmnd.cpp conf.cpp s_conf.cpp cont.cpp html.cpp s_html.cpp lang.cpp s_lang.cpp logd.cpp main.cpp modl.cpp s_modl.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
-OBJS=$(SRCS:.cpp=.o)
-CC=g++
-LDFLAGS=@LDFLAGS@ -lstdc++ -g
-LDADD=-pthread -D_THREAD_SAFE
-all: ychat
+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: yhttpd
$(SRCS):
- $(CC) $(CFLAGS) -c $*.cpp
-ychat: $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD)
- @mv -f ychat ..
-clean:
- @rm -f Makefile config.log config.cache config.status
- rm -f ../ychat
- rm *.o
+ $(CC) $(INCLUDES) $(CFLAGS) -c $*.cpp
+infotext:
+ @echo Compiling base
+yhttpd: infotext $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD)
+ @mv yhttpd ../bin
+ @echo -n "Size of linked executable: "
+ @du -hc ../bin/yhttpd | tail -n 1
+clean:
+ @echo Cleaning base obj
+ @if test -d ../obj; then rm -Rf ../obj; fi
diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp
index 0e7b531..0adddb1 100755
--- a/src/cli/cli.cpp
+++ b/src/cli/cli.cpp
@@ -31,7 +31,7 @@ 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;
+ << CLIPRMO << " !command - Uses system to run a command" << endl;
#ifdef DEBUG
cout << CLIPRMO << " (d)ebug - Starts debug routine (cli.cpp)" << endl;
@@ -47,22 +47,17 @@ cli::parse_input( string s_input )
#endif
cout << CLIPRMO << " (h)elp - Prints out this help!" << endl;
- //<<*
- cout << CLIPRMO << " (m)ysql - Runs MySQL client on yChat DB" << endl
- << CLIPRMO << " (rel)oad - Reloads all modules" << endl;
- //*>>
#ifdef EXPERIM
cout << CLIPRMO << " (re)conf - Reloads configuration (EXPERIMENTAL)" << endl;
#endif
cout << CLIPRMO << " (r)usage - Shows current resource usage" << endl
- << CLIPRMO << " (ru)sageh - Shows resource usage history (yChat needs to run > 1 day)" << endl
+ << CLIPRMO << " (ru)sageh - Shows resource usage history (yhttpd needs to run > 1 day)" << endl
<< CLIPRMO << " (set) VAR VAL - Sets configuration value VAR to VAL" << endl
<< CLIPRMO << " (sh)ell - Runs a system shell" << endl
<< CLIPRMO << " (s)hutdown - Shuts down the whole server" << endl
<< CLIPRMO << " (t)ime - Prints out time and uptime" << endl;
- cout << CLIPRMO << " (unl)oad - Unloads all loaded modules" << endl;//<<
cout << CLIPRMO << " (u)nset VAR - Deletes configuration value VAR" << endl
<< CLIPRMO << " (v)ersion - Prints out version" << endl;
cout << CLIPRMI;
@@ -115,19 +110,6 @@ cli::parse_input( string s_input )
cout << CLIPRMI;
}
- //<<*
- else if( s_input.compare("mysql") == 0 || s_input.compare("m") == 0 )
- {
- cout << CLIPRMO << CLIMSQL << endl;
-
- system((wrap::CONF->get_elem("chat.system.mysqlclient") + " -p -h " +
- wrap::CONF->get_elem("chat.database.serverhost") + " -u " +
- wrap::CONF->get_elem("chat.database.user") ).c_str());
-
- cout << CLIPRMO << CLIWELC << endl;
- cout << CLIPRMI;
- }
- //*>>
#ifdef NCURSES
else if( s_input.compare("exit") == 0 || s_input.compare("ex") == 0 )
@@ -136,20 +118,11 @@ cli::parse_input( string s_input )
}
#endif
- //<<*
- else if( s_input.compare("reload") == 0 || s_input.compare("rel") == 0 )
- {
- cout << CLIPRMO;
- wrap::MODL->reload_modules();
- cout << MODRELO << endl;
- cout << CLIPRMI;
- }
- //*>>
#ifdef EXPERIM
else if( s_input.compare("reconf") == 0 || s_input.compare("re") == 0 )
{
- wrap::CHAT->reconf();
+ wrap::HTTPD->reconf();
cout << CLIPRMI;
}
#endif
@@ -210,15 +183,6 @@ cli::parse_input( string s_input )
cout << CLIPRMI;
}
- //<<*
- else if( s_input.compare("unl") == 0 || s_input.compare("unload") == 0 )
- {
- cout << CLIPRMO;
- wrap::MODL->unload_modules();
- cout << MODUNLO << endl;
- cout << CLIPRMI;
- }
- //*>>
else if( s_input.compare("u") == 0 || s_input.compare("unset") == 0 )
{
@@ -239,7 +203,7 @@ cli::parse_input( string s_input )
}
else if( s_input.compare("v") == 0 || s_input.compare("version") == 0 )
{
- cout << CLIPRMO << tool::ychat_version() << " " << UNAME << endl;
+ cout << CLIPRMO << tool::yhttpd_version() << " " << UNAME << endl;
cout << CLIPRMI;
}
else
@@ -295,7 +259,7 @@ cli::print_rusage()
}
vector<string>
-cli::vectorize(string s_param)
+cli::vectorize(string s_param)
{
vector<string> vec_ret;
unsigned i_pos;
diff --git a/src/cli/cli.h b/src/cli/cli.h
index 8ec75cb..7d51e3f 100755
--- a/src/cli/cli.h
+++ b/src/cli/cli.h
@@ -30,30 +30,30 @@ using namespace std;
class cli : public thro
{
#else
-class cli
+class cli
{
#endif
private:
int parse_input(string s_input);
vector<string> vectorize(string s_param);
-
+
public:
- cli( );
- ~cli( );
+cli( );
+~cli( );
#ifdef DEBUG
- void debug_routine();
+void debug_routine();
#endif
- void print_rusage();
+void print_rusage();
#ifndef NCURSES
- void start(void* p_void);
+void start(void* p_void);
#else
- void start();
+void start();
#endif
};
diff --git a/src/conf/conf.cpp b/src/conf/conf.cpp
index a4a2679..5d5a535 100755
--- a/src/conf/conf.cpp
+++ b/src/conf/conf.cpp
@@ -6,11 +6,11 @@
using namespace std;
-conf::conf( string s_conf, map<string,string>* p_main_loop_params ) : name::name( s_conf )
+conf::conf( string s_conf, map<string,string>* p_start_params ) : name::name( s_conf )
{
string s_check[] = {
get_name(),
- string(getenv("HOME"))+string("/.ychat/") + get_name(),
+ string(getenv("HOME"))+string("/.yhttpd/") + get_name(),
string("./etc/") + get_name(),
string("/etc/") + get_name(),
string(PREFIX+string("etc/")+get_name()) };
@@ -54,11 +54,11 @@ conf::conf( string s_conf, map<string,string>* p_main_loop_params ) : name::name
vector<string> vec_string;
parse_xml(p_xml, &vec_string);
- shashmap<string>::add_elem_insecure(tool::ychat_version(), "ychat.version");
+ shashmap<string>::add_elem_insecure(tool::yhttpd_version(), "yhttpd.version");
- // Overrides ychat.conf values with command line options (ychat -o key1 value1 -o key2 value2 ...)
+ // Overrides yhttpd.conf values with command line options (yhttpd -o key1 value1 -o key2 value2 ...)
map<string,string>::iterator iter;
- for ( iter = p_main_loop_params->begin(); iter != p_main_loop_params->end(); iter++ )
+ for ( iter = p_start_params->begin(); iter != p_start_params->end(); iter++ )
{
shashmap<string>::del_elem_insecure(iter->first);
shashmap<string>::add_elem_insecure(iter->second, iter->first);
@@ -161,35 +161,11 @@ conf::exit_if_xml_error() const
}
}
-//<<*
-string
-conf::colored_error_msg(string s_key)
-{
- return "<font color=\"#"
- + shashmap<string>::get_elem("chat.html.errorcolor")
- + "\">" + shashmap<string>::get_elem(s_key) + "</font><br>\n";
-}
-//*>>
int
conf::get_int(string s_key)
{
- return tool::string2int(get_elem(s_key));
+ return tool::string2int(get_elem(s_key));
}
-vector<string>
-conf::get_vector(string s_key)
-{
- vector<string> vec_ret;
- string s_val = get_elem(s_key);
-
- for (unsigned i_pos = s_val.find(" "); i_pos != string::npos; i_pos = s_val.find(" "))
- {
- vec_ret.push_back(s_val.substr(0, i_pos));
- s_val = s_val.substr(i_pos+1);
- }
-
- vec_ret.push_back(s_val);
- return vec_ret;
-}
#endif
diff --git a/src/conf/conf.h b/src/conf/conf.h
index 7dc779c..b385059 100755
--- a/src/conf/conf.h
+++ b/src/conf/conf.h
@@ -19,12 +19,10 @@ private:
void parse_xml( TiXmlNode* p_node, vector<string>* p_vec);
public:
- conf(string s_conf, map<string,string>* p_main_loop_params);
+ conf(string s_conf, map<string,string>* p_start_params);
~conf();
- string colored_error_msg(string s_key); //<<
- int get_int(string s_key);
- vector<string> get_vector(string s_key);
+ int get_int(string s_key);
};
#endif
diff --git a/src/configure b/src/configure
index 8c5f0a7..5577c10 100755
--- a/src/configure
+++ b/src/configure
@@ -1,1555 +1,332 @@
-#! /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:
-
-# 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); }
+# The yhttpd Project (2003 - 2005)
+#
-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 ! ../scripts/checkperl.sh
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
-
+ 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",
+ "netinet/in.h",
+ "time.h",
+ "ncurses.h",
+ "::test::ext/hash_map"
+ );
+
+ my @libs = (
+ "libncurses.so"
+ );
+
+ 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"
+ );
+
+ 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);
+ }
+
+ if ( /\/\/#define NCURSES/ )
+ {
+ remove_from_array("ncurses.h",\@headers);
+ remove_from_array("libncurses.so",\@libs);
+ }
+ }
+ close FILE;
+
+ if ( defined $ENV{YHTTPDHEADERPATHS} )
+ {
+ map { print "Adding $_...\n";
+ unshift @headerpaths, $_ } split /:/, $ENV{YHTTPDHEADERPATHS};
+ }
+
+ if ( defined $ENV{YHTTPDLIBPATHS} )
+ {
+ map { print "Adding $_...\n";
+ unshift @libpaths, $_ } split /:/, $ENV{YHTTPDLIBPATHS};
+ }
+
+
+ print "Headers:\n";
+
+ my $testit = 0;
+ map { $incadd{&check($deepness, $_, @headerpaths)}++ }
+ @headers;
+
+ $testit = 0;
+ print "Libraries:\n";
+ map { $libadd{&check($deepness, $_, @libpaths)}++ }
+ @libs;
+
+ my $incadd = &make_add("-I", \%incadd);
+ my $libadd = &make_add("-L", \%libadd);
+
+ for ( @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";
+ unlink("../err") if -f "../err";
+ 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 "";
+
+ for 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";
+ my $class = $ofile;
+ $class =~ s/\.o//;
+
+ my $text;
+ if ( $class =~ /contrib\/.+/ )
+ {
+ my $dirname = `dirname $class`;
+ $text = "\t\@echo -n \"Contributed class $class \"\n";
+ }
+
+ else
+ {
+ $text = "\t\@echo -n \"Base class $class \"\n";
+ }
+
+ print Fout "\t\@\$(CC) \$(CFLAGS) \$(INCLUDES) $args -c -o ../obj/$ofile $cppfile\n";
+ print Fout $text."\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";
+
+ for (@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("..");
+ }
+
+ 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;
+ }
+ } # for
+ }
+
+ sub check {
+ my $deep = shift;
+
+ if ($deep == 0) {
+ print "Looking too deep! ($deepness)\n";
+ exit(1);
+ }
+
+ my $check = shift;
+ $testit = 1 if $check =~ s/::test:://;
+
+ my $print = 1;
+ if ( $_[-1] eq "subsearch" ) {
+ $print = 0;
+ pop(@_);
+ }
+
+ if ($print)
+ {
+ print "Checking for $check...";
+ print "\n" if $testit;
+ }
+
+ for (@_)
+ {
+ if ( -f "$_/$check" )
+ {
+ if ($testit)
+ {
+ return $_ if test_include($_, $check);
+ return "";
+ }
+
+ else
+ {
+ print "OK\n";
+ return "" if $_ eq "/usr/lib" or $_ eq "/usr/include";
+ return $_;
+ }
+ }
+ }
+
+ for (@_)
+ {
+ next unless -d $_;
+ opendir D, $_ or warn "$_: $!\n";
+ my @dir = readdir(D);
+ closedir D;
+
+ for 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 YHTTPDHEADERPATHS and YHTTPDLIBPATHS.\n";
+ print " Example: setenv YHTTPDHEADERPATHS \"/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 "";
+ }
+
+ sub make_add {
+ my $flag = shift;
+ my $add = shift;
+ my $ret = "";
+
+ for (reverse keys %$add) {
+ next unless /.+/;
+ $ret .= "$flag$_ ";
+ }
+ return $ret;
+ }
+
+ sub test_include
+ {
+ my $shift = shift;
+ my $check = shift;
+ my $return = 0;
+ print "Testing $shift/$check...";
+
+ `echo "\#include \\"maps/hashmap.h\\"" > __test.cpp`;
+ `echo "int main(void){return 0;}" >> __test.cpp`;
+ my $cmd = "`tail -n 1 ../g++.version` -I$shift __test.cpp -o /dev/null 2>/dev/null";
+ system $cmd;
+
+ unless ($?)
+ {
+ print "OK\n";
+ $return = 1;
+ }
+
+ else
+ {
+ print "Not OK\n";
+ }
+
+ unlink "__test.cpp" if -f "__test.cpp";
+ return $return;
+ }
+
+ exit(0);
+' `echo "$*" | sed "s/-//g"`
diff --git a/src/contrib/README b/src/contrib/README
index 873f114..105f25d 100644
--- a/src/contrib/README
+++ b/src/contrib/README
@@ -1,5 +1,5 @@
-This directory includes source code which has been included directly into yChat but is not
-programmed by the yChat project explicitly which means the source code here is from extern.
+This directory includes source code which has been included directly into yhttpd but is not
+programmed by the yhttpd project explicitly which means the source code here is from extern.
Used versions:
tinyxml 2.3.2
diff --git a/src/contrib/xml/README b/src/contrib/xml/README
index c03aaad..7da9dfd 100644
--- a/src/contrib/xml/README
+++ b/src/contrib/xml/README
@@ -1,7 +1,7 @@
ATTENTION:
This version of TinyXML has ben very little modified by
-Paul C. Buetow in 2004 to fit the yChat project.
+Paul C. Buetow in 2004 to fit the yhttpd project.
To get the original source go to
http://www.sourceforge.net/projects/tinyxml
diff --git a/src/glob.h b/src/glob.h
index 9287c38..f4b824f 100755
--- a/src/glob.h
+++ b/src/glob.h
@@ -1,35 +1,168 @@
-// 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 -
+ Should yhttpd get compiled with comand line interface support?
+*/
+#define CLI
+
+/* - CONFIG -
+ What should be the name of the config file?
+*/
+#define CONFILE "yhttpd.conf"
+
+/* - DISABLED -
+ Enable debugging options.
+*/
+//#define DEBUG
+
+/* - DISABLED -
+ 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 yhttpd!
+*/
+//#define EXPERIM
+
+/* - CONFIG -
+ Should yhttpd get compiled with logging support?
+*/
+#define LOGGING
+
+/* - CONFIG -
+ Please enter the highest networking port which is allowed to be
+ used. If yhttpd 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
+/* Specifies the max amount of lines to read from a HTTP request
+ header
+*/
+#define MAXLINES 30
+
+/* Specifies the max length of a lines to read from a HTTP request
+ header
+*/
+#define MAXLENGTH 1024
+
+/* - CONFIG -
+ Should yhttpd get compiled with ncurses support?
+*/
+#define NCURSES
+
+/* - CONFIG -
+ Please specify the maximum length of a HTTP post request.
+*/
+#define POSTBUF 512
+
+/* - 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 line read from a socket
+ or a file. ( config-file, html-template )
+*/
+#define READSOCK 2048
+
+/* - CONFIG -
+ In which prefix should yhttpd be installed if typing gmake inst-
+ all?
+*/
+#define PREFIX "/usr/local"
+
+/* - 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
+
+/* - CONFIG -
+ Set to true if you want yhttpd to catch the SIGSEGV signal. yhttpd
+ will print a warning message into the system messages and will
+ not core dump if an error occurs.
+*/
+//#define CTCSEGV
+
+/* - 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 yhttpd 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
+
+
+
+
+// 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 16
+#define NCUR_POOL_WAIT_X 22
+#define NCUR_POOL_WAIT_Y 16
+#define NCUR_POOL_RUNNING_X 23
+#define NCUR_POOL_RUNNING_Y 16
+
+#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_HTTPD_HEADER_X 21
+#define NCUR_HTTPD_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,26 +170,11 @@
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
@@ -65,4 +183,11 @@ struct dynmod
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..ace041a 100755
--- a/src/html.cpp
+++ b/src/html.cpp
@@ -1,94 +1,87 @@
-// 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( map<string,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 +95,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 +106,28 @@ 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;
}
+
+#ifdef NCURSES
void
-html::online_list( user *p_user, map_string &map_params )
+html::print_cached( int i_docs )
{
- // prepare user_list.
- string s_list ( "" );
- string s_seperator( "<br>" );
+ if ( !wrap::NCUR->is_ready() )
+ return;
- p_user->get_p_room()->get_user_list( s_list, s_seperator );
-
- // use the collected data as a message in html-templates.
- map_params["MESSAGE"] = s_list;
-
- // renew the timestamp.
- p_user->renew_stamp();
-
- // 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
+
diff --git a/src/html.h b/src/html.h
index 823d0d9..14a7161 100755
--- a/src/html.h
+++ b/src/html.h
@@ -1,42 +1,38 @@
// 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 "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( map<string,string> &map_params );
+
+#ifdef NCURSES
+
+ void print_cached( int i_docs );
+#endif
- virtual void online_list( user *p_user, map_string &map_params );
};
#endif
diff --git a/src/incl.h b/src/incl.h
index 539a1f1..31e220c 100755
--- a/src/incl.h
+++ b/src/incl.h
@@ -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 63c2a64..e120fd8 100644..100755
--- a/src/logd.cpp
+++ b/src/logd.cpp
@@ -1,66 +1,175 @@
-#ifndef LOGD_CXX
-#define LOGD_CXX
+
+#ifndef LOGD_CPP
+#define LOGD_CPP
#include "logd.h"
-logd::logd( string filename )
+#ifdef LOGGING
+
+#include <fstream>
+
+logd::logd( string s_filename, string s_log_lines )
+{
+ initialize( s_filename, tool::string2int(s_log_lines) );
+}
+
+logd::logd( string s_filename, int i_log_lines )
+{
+ initialize( s_filename, i_log_lines );
+}
+
+logd::~logd()
{
- if(filename.empty())
+ flush_logs();
+ pthread_mutex_destroy( &mut_s_logging );
+}
+
+void
+logd::initialize( string s_filename, int i_log_lines )
+{
+ pthread_mutex_init( &mut_s_logging, NULL );
+
+ if( s_filename.empty() )
{
- cerr << "ycLog: No filename specified" << endl;
+ wrap::system_message( LOGERR2 );
exit(1);
}
- s_logfile=filename;
+ //if (wrap::NCUR->is_ready())
+ // wrap::system_message(LOGGINI+s_filename);
- i_lines=s_tool::string2int( s_conf::get
- ().get_val("LOG_LINES"));
+ s_logfile = s_filename;
+ i_lines = i_log_lines;
+}
+
+string
+logd::get_time_string()
+{
+ struct tm *t_m;
+ time_t t_cur = time(NULL);
+ t_m = gmtime(&t_cur);
+ char c_buf[100];
+ c_buf[99] = '\0';
+ strftime(c_buf, 100, "[%d/%b/%Y:%H:%M:%S %z]", t_m);
+
+ return string(c_buf);
}
-void logd::flush()
+
+void
+logd::flush()
{
- s_output.open(s_logfile.c_str(), ios::app);
+ ofstream of_output;
+ of_output.open(s_logfile.c_str(), ios::app);
- if(s_output==NULL)
+ if( of_output == NULL )
{
- cerr << "ycLog: Could not open file: " << s_logfile << endl;
+ wrap::system_message( LOGERR1 + s_logfile );
exit(1);
}
-
- while(!s_queue.empty())
+ while( ! s_queue.empty() )
{
string s_l=s_queue.front();
s_queue.pop();
- s_output.write(s_l.c_str(), s_l.size());
-
+ of_output.write( s_l.c_str(), s_l.size() );
}
- s_output.close();
+
+ of_output.close();
}
-void logd::log( map_string request )
+
+void
+logd::log_access( map<string,string> &map_request )
{
- struct tm *t_m;
- time_t t_cur=time(NULL);
- t_m=gmtime(&t_cur);
+ //static int i_access_lines = wrap::CONF->get_elem("httpd.logging.accesslines");
- char buffer[100];
- strftime(buffer, 100, "[%d/%b/%Y:%H:%M:%S %z]", t_m);
- string s_time=buffer;
- string s_logstr = request["REMOTE_ADDR"] + " - - "+s_time+" \"" + request["QUERY_STRING"]+"\" 200 0 \""+request["request"]+"\" \""+request["User-Agent"]+"\"\n";
+ 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";
+ pthread_mutex_lock ( &mut_s_logging );
s_queue.push(s_logstr);
- if(s_queue.size()>=i_lines)
+ if ( s_queue.size() > i_lines )
flush();
+
+ pthread_mutex_unlock( &mut_s_logging );
}
-logd::~logd()
+void
+logd::log_simple_line( string s_line )
{
+ // Dont log empty lines!
+ if (s_line.empty())
+ return;
+
+ string s_time = get_time_string();
+ string s_logstr = s_time + " " + s_line;
+
+ pthread_mutex_lock ( &mut_s_logging );
+ s_queue.push(s_logstr);
+
+ if ( s_queue.size() > i_lines )
+ flush();
+
+ pthread_mutex_unlock( &mut_s_logging );
+}
+
+void
+logd::set_logfile( string s_path, string s_filename )
+{
+ // Remove "/" from filename!
+ unsigned i_pos = s_filename.find( "/" );
+ while ( i_pos != string::npos )
+ {
+ s_filename.replace( i_pos, 1, "SLASH" );
+ i_pos = s_filename.find( "/" );
+ }
+
+ // Remove "\" from filename (for non unix systems)!
+ i_pos = s_filename.find( "\\" );
+ while ( i_pos != string::npos )
+ {
+ s_filename.replace( i_pos, 1, "BACKSLASH" );
+ i_pos = s_filename.find( "\\" );
+ }
+
+ pthread_mutex_lock ( &mut_s_logging );
+ this->s_logfile = s_path + s_filename;
+ pthread_mutex_unlock( &mut_s_logging );
+}
+
+void
+logd::flush_logs()
+{
+ pthread_mutex_lock ( &mut_s_logging );
flush();
+ pthread_mutex_unlock( &mut_s_logging );
}
+string
+logd::remove_html_tags( string s_logs )
+{
+ unsigned pos[2];
+ while ( (pos[0] = s_logs.find("<")) != string::npos )
+ {
+ if ( (pos[1] = s_logs.find(">", pos[0])) != string::npos )
+ s_logs.replace( pos[0], pos[1]-pos[0]+1, "");
+ else
+ break;
+ }
+
+ if ( s_logs == "\n" )
+ return "";
+ return s_logs;
+}
+void
+logd::set_lines( const int i_lines )
+{
+ this->i_lines = i_lines;
+}
#endif
+#endif
diff --git a/src/logd.h b/src/logd.h
index 788015b..2d6270b 100644..100755
--- a/src/logd.h
+++ b/src/logd.h
@@ -1,25 +1,37 @@
+#include "incl.h"
+
+#ifdef LOGGING
#ifndef LOGD_H
#define LOGD_H
-#include "incl.h"
-#include "s_tool.h"
-#include "s_conf.h"
-#include <fstream>
#include <queue>
#include <time.h>
+
class logd
{
-
private:
string s_logfile;
queue<string> s_queue;
- ofstream s_output;
+ pthread_mutex_t mut_s_logging;
int i_lines;
+
+ void initialize( string s_filename, int i_log_lines );
+ void flush();
+ void set_lines( const int i_lines );
+ string get_time_string();
+
public:
- logd( string filename );
+ logd( string s_filename, string s_log_lines );
+ logd( string s_filename, int i_log_lines );
~logd();
- void flush();
- void log( map_string request );
+ void set_logfile( string s_path, string s_filename );
+ void log_access( map<string,string> &map_request );
+ void log_simple_line( string s_line );
+ void flush_logs();
+ static string remove_html_tags( string s_log );
};
+
+#endif
#endif
+
diff --git a/src/main.cpp b/src/main.cpp
index 2846503..87f1cab 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,7 +1,8 @@
/*
- * yChatContact: www.yChat.org; Mail@yChat.org
+ * yhttpd; Contact: www.yChat.org; Mail@yChat.org
* Copyright (C) 2003 Paul C. Buetow, Volker Richter
- * Copyright (C) 2005 Paul C. Buetow
+ * Copyright (C) 2004 Paul C. Buetow
+ * Copyright (C) 2005 EXA Digital Solutions GbR
* -----------------------------------------------------------------
*
* This program is free software; you can redistribute it and/or
@@ -20,82 +21,81 @@
*
*/
-// needed for ignoring SIGPIPE.
-#include <signal.h>
-
-// include header files which are included from every class too.
#include "incl.h"
+#include "sign.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 module loader manager for global synchronization.
-#include "s_modl.h"
-
-// include the socket manager.
-#include "s_sock.h"
-
-// include the language manager
-#include "s_lang.h"
-
-// 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
-
- cout << " ___ _ _ " << endl
- << " _ _ / __\\ |__ __ _| |_ " << endl
- << "| | | |/ / | '_ \\ / _` | __|" << endl
- << "| |_| / /___| | | | (_| | |_ " << endl
- << " \\__, \\____/|_| |_|\\__,_|\\__|" << endl
- << " |___/ " << endl << endl
+ map<string,string>* start_params = new map<string,string>;
+
+ string s_output = "";
+
+ // Set to 1 if a config option key has to be read
+ // ( ./yhttpd -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::yhttpd_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;
+}
+int
+main(int argc, char* argv[])
+{
+ cout << tool::yhttpd_version() << endl
<< DESCRIP << endl
- << VERSION << ", "
+ << DESCRI2 << endl
<< CONTACT << endl
- << SEPERAT << endl
- << STARTMS << endl ;
-#endif
-
- // 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
- // 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_modl::init(); // init the module-loader manager.
- s_sock::init(); // init the socket manager.
- s_chat::init(); // init the chat manager.
+ << SEPERAT << endl;
+
+ wrap::init_wrapper(parse_argc(argc, argv));
+
+
+ sign::init_signal_handlers();
// 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();
-
-#ifdef VERBOSE
+ wrap::SOCK->start();
cout << DOWNMSG << endl;
-#endif
-
return 0;
}
diff --git a/src/maps/hashmap.h b/src/maps/hashmap.h
index b3a3212..1bdc515 100644
--- a/src/maps/hashmap.h
+++ b/src/maps/hashmap.h
@@ -6,13 +6,13 @@
using namespace std;
template<class key_type_>
-struct compare_allocator
+struct compare_allocator
{
inline bool operator()(key_type_ t_key_1, key_type_ t_key_2) const;
};
template<class key_type_>
-struct equals_allocator
+struct equals_allocator
{
inline bool operator()(key_type_ t_key_1, key_type_ t_key_2) const;
};
@@ -31,10 +31,10 @@ struct self_hash
template
<
-class obj_type,
-class key_type_ = string,
-class hash_type = size_hash<string>,
-class alloc_type = compare_allocator<string>
+ 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>
{
@@ -42,7 +42,7 @@ struct hashmap : public __gnu_cxx::hash_map<key_type_, obj_type, hash_type, allo
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);
+ (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 run_func( void (*func)(obj_type) );
diff --git a/src/maps/nhashmap.h b/src/maps/nhashmap.h
index f440230..7f17a55 100644
--- a/src/maps/nhashmap.h
+++ b/src/maps/nhashmap.h
@@ -7,10 +7,10 @@ using namespace std;
template
<
-class obj_type,
-class key_type_ = string,
-class hash_type = size_hash<string>,
-class alloc_type = compare_allocator<string>
+ 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>
{
diff --git a/src/maps/shashmap.h b/src/maps/shashmap.h
index f692e32..99dd7c8 100644
--- a/src/maps/shashmap.h
+++ b/src/maps/shashmap.h
@@ -10,13 +10,13 @@ using namespace std;
template
<
-class obj_type,
-class key_type_ = string,
-class hash_type = size_hash<string>,
-class alloc_type = compare_allocator<string>
+ 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>,
- public dumpable
+ public dumpable
{
private:
pthread_mutex_t mut_shashmap;
@@ -30,7 +30,7 @@ public:
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);
+ (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);
diff --git a/src/maps/shashmap.tmpl b/src/maps/shashmap.tmpl
index 0bd5796..c864d28 100644
--- a/src/maps/shashmap.tmpl
+++ b/src/maps/shashmap.tmpl
@@ -43,7 +43,7 @@ shashmap<obj_type, key_type_, hash_type, alloc_type>::get_or_callback_set
{
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);
+ (func, p_void, t_key);
pthread_mutex_unlock( &mut_shashmap );
return t_ret;
}
@@ -144,14 +144,12 @@ template<class obj_type, class key_type_, class hash_type, class alloc_type>
void
shashmap<obj_type, key_type_, hash_type, alloc_type>::dumpit()
{
- dumpable::add
- ("[shashmap]");
+ dumpable::add("[shashmap]");
vector<key_type_>* p_vec = get_key_vector();
typename vector<key_type_>::iterator iter;
for (iter = p_vec->begin(); iter != p_vec->end(); ++iter)
- dumpable::add
- (*iter);
+ dumpable::add(*iter);
delete p_vec;
}
diff --git a/src/monitor/dump.cpp b/src/monitor/dump.cpp
index 71cc862..6b49bfe 100644
--- a/src/monitor/dump.cpp
+++ b/src/monitor/dump.cpp
@@ -8,13 +8,13 @@ using namespace std;
const string dumpable::s_sep = "->";
const int dumpable::i_max_level = 100;
-dumpable::dumpable()
+dumpable::dumpable()
{
initialize(0);
}
void
-dumpable::initialize(int i_level)
+dumpable::initialize(int i_level)
{
this->i_level = i_level;
this->i_lined = i_level;
@@ -24,13 +24,13 @@ dumpable::initialize(int i_level)
}
string
-dumpable::dump()
+dumpable::dump()
{
return dump(0);
}
string
-dumpable::dump(int i_level)
+dumpable::dump(int i_level)
{
initialize(i_level);
dumpit();
@@ -38,37 +38,34 @@ dumpable::dump(int i_level)
}
void
-dumpable::add
- (string s_line)
+dumpable::add(string s_line)
{
if ( i_lined > i_max_level )
i_lined = i_max_level;
- if (!b_lined)
+ if (!b_lined)
s_dump.append(s_sep);
- else
- for ( int i = 0; i < i_lined; ++i )
- s_dump.append(" ");
+ else for ( int i = 0; i < i_lined; ++i )
+ s_dump.append(" ");
s_dump.append(s_line);
- if (b_next_no_nl)
+ if (b_next_no_nl)
b_next_no_nl = false;
else
s_dump.append("\n");
- if (!b_lined)
- {
+ if (!b_lined) {
b_lined = true;
i_lined = i_level + s_sep.length();
}
}
int
-dumpable::get_level() const
-{
+dumpable::get_level() const
+{
return i_lined;
}
@@ -77,7 +74,6 @@ dump::dump(vector<string> vec_params)
if (vec_params.empty())
{
cout << CLIPRMO << "all conf sock";
- cout << " chat modl sman"; //<< Not for yhttpd
cout << endl;
return;
}
@@ -102,16 +98,6 @@ dump::run(vector<string> &vec_params)
if (!s_part.compare("sock") || !s_part.compare("all"))
s_ret.append(wrap::SOCK->dump());
- //<<*
- if (!s_part.compare("modl") || !s_part.compare("all"))
- s_ret.append(wrap::MODL->dump());
-
- if (!s_part.compare("sman") || !s_part.compare("all"))
- s_ret.append(wrap::SMAN->dump());
-
- if (!s_part.compare("chat") || !s_part.compare("all"))
- s_ret.append(wrap::CHAT->dump());
- //*>>
}
return s_ret;
diff --git a/src/monitor/dump.h b/src/monitor/dump.h
index ffb3529..8e84cb1 100644
--- a/src/monitor/dump.h
+++ b/src/monitor/dump.h
@@ -15,35 +15,24 @@ private:
string s_dump;
static const string s_sep;
- static const int i_max_level;
+ static const int i_max_level;
virtual void dumpit() = 0;
void initialize(int i_level);
void reset();
protected:
- void add
- (unsigned i_num)
- {
- add
- ("<unsigned>");
- }
-
- void add
- (int i_num)
- {
- add
- ("<int>");
- }
-
- void add
- (string s_line);
+ void add(unsigned i_num)
+ { add("<unsigned>"); }
+
+ void add(int i_num)
+ { add("<int>"); }
+
+ void add(string s_line);
dumpable();
- void next_no_newline()
- {
- b_next_no_nl = true;
- }
+ void next_no_newline()
+ { b_next_no_nl = true; }
public:
string dump();
diff --git a/src/monitor/stats.cpp b/src/monitor/stats.cpp
index 5d5cc39..e0aa146 100644
--- a/src/monitor/stats.cpp
+++ b/src/monitor/stats.cpp
@@ -10,17 +10,14 @@ stats::stats()
i_rusage_vec_size = tool::string2int(
wrap::CONF->get_elem("httpd.stats.rusagehistory"));
- i_num_rooms = 0; //<<
pthread_mutex_init( &mut_vec_rusage, NULL );
- pthread_mutex_init( &mut_num_rooms, NULL ); //<<
}
stats::~stats()
{
pthread_mutex_destroy( &mut_vec_rusage );
- pthread_mutex_destroy( &mut_num_rooms ); //<<
}
void
@@ -101,50 +98,5 @@ stats::get_rusage_history( string s_type, string s_seperator )
return s_ret;
}
-//<<*
-int
-stats::get_num_rooms()
-{
- pthread_mutex_lock ( &mut_num_rooms );
- int i_ret = i_num_rooms;
- pthread_mutex_unlock( &mut_num_rooms );
- return i_ret;
-}
-
-void
-stats::increment_num_rooms()
-{
- pthread_mutex_lock ( &mut_num_rooms );
- ++i_num_rooms;
- pthread_mutex_unlock( &mut_num_rooms );
-#ifdef NCURSES
-
- print_num_rooms();
-#endif
-}
-void
-stats::decrement_num_rooms()
-{
- pthread_mutex_lock ( &mut_num_rooms );
- --i_num_rooms;
- pthread_mutex_unlock( &mut_num_rooms );
-#ifdef NCURSES
-
- print_num_rooms();
-#endif
-}
-
-#ifdef NCURSES
-void
-stats::print_num_rooms()
-{
- if ( !wrap::NCUR->is_ready() )
- return;
-
- mvprintw( NCUR_NUM_ROOMS_X, NCUR_NUM_ROOMS_Y, "Rooms: %d", get_num_rooms());
- refresh();
-}
-#endif
-//*>>
#endif
diff --git a/src/monitor/stats.h b/src/monitor/stats.h
index 231d876..0478258 100644
--- a/src/monitor/stats.h
+++ b/src/monitor/stats.h
@@ -21,8 +21,6 @@ private:
vector< map<string,long> > vec_rusage_history;
pthread_mutex_t mut_vec_rusage;
- int i_num_rooms; //<<
- pthread_mutex_t mut_num_rooms; //<<
void set_rusage_vec_size( int i_rusage_vec_size );
@@ -30,20 +28,9 @@ public:
stats( );
~stats( );
- //<<*
- int get_num_rooms();
- void increment_num_rooms();
- void decrement_num_rooms();
- //*>>
void update_rusage_history();
string get_rusage_history( string s_type, string s_seperator );
long get_ru_maxrss();
- //<<*
-#ifdef NCURSES
-
- void print_num_rooms();
-#endif
- //*>>
};
#endif
diff --git a/src/msgs.h b/src/msgs.h
index 3a2bca1..b317366 100755
--- a/src/msgs.h
+++ b/src/msgs.h
@@ -1,39 +1,136 @@
#ifndef MSGS_H
#define MSGS_H
+// alphabetical ordered:
+#define ACCPERR "Sock: Accept error "
+#define BINDERR "Sock: Bind error "
+#define HTTPDREP "Chat: Using replacement strings"
+#define HTTPDDOP "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 LOGGINI "Logging: Init on "
+#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 LOGINE5 "Chat: Login failed (not enough threads), 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 "
+#ifdef CTCSEGV
+#define SIGNSEG "Signal: Received SIGSEGV"
+#endif
+
+#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 POOLER1 "Pool: Did not allocate all threads ("
#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.3-RELEASE"
+#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 SESSERR "Session: Could not find session "
+#define SESSEXI "Session: New TempID already exists, recalc."
+#define SHELLER "Shell: Could not execute command"
+#define SHELLEX "Shell: Executing the following command:"
+#define SIGSIGV "Signal: SIGV received!"
+#define STATUPR "Stats: Updated rusage history"
+#define STATRSS "Stats: Max resident set size "
+#define REUROOM "Garbage: Reusing room object "
+#define SOCKER1 "Sock: Can't create socket, aborting"
+#define SOCKUNS "Sock: Starting hypertext transport [HTTP]"
+#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 SOCKCAC "Sock: Caching IP "
+#define SOCKCA2 "Sock: Cleaning IP cache ("
+#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.2"
+#define BRANCH "RELEASE"
+#define BUILDNR 3807
+#define UNAME "FreeBSD 5.4-DEVEL i386"
+#define COMPOPT "Using built-in specs.; Configured with: FreeBSD/i386 system compiler; Thread model: posix; gcc version 3.4 [FreeBSD] 20040728; 3.4; g++"
+#define YCUSAGE "Usage: ./yhttpd {h|v}|{o confkey confvalue}\n"
+
+#define HEADER1 "HTTP/1.1 200 OK\r\n"
+#define HEADER2 "Server: yhttpd/" 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: ";
+#define HEADER8b "; charset=ISO-8859-1\r\n";
+#define HEADER9 "Allow: GET\r\n";
#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
diff --git a/src/name.h b/src/name.h
index 0293e2b..0a62c1f 100755
--- a/src/name.h
+++ b/src/name.h
@@ -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/ncur.cpp b/src/ncur/ncur.cpp
index 3200ee0..3518bbd 100755
--- a/src/ncur/ncur.cpp
+++ b/src/ncur/ncur.cpp
@@ -38,26 +38,16 @@ ncur::start( void *p_void )
ncur::init_ncurses();
char *choices[] = {
- "Unload all modules ", //<<
- "Reload all modules ", //<<
- //>>" ",
- //>>" ",
+ " ",
+ " ",
"Clear template cache ",
- "Run garbage collector ", //<<
- //>>" ",
+ " ",
"Show max res. set size ",
"Compile changed sources ",
"Recompile all sources ",
"Show source stats ",
"Command line interface ",
- //<<*
-#ifdef DATABASE
- "Close DB connections ",
-#else
- " ",
-#endif
- //*>>
- //>>" ",
+ " ",
"Shut down server"
};
@@ -68,23 +58,18 @@ ncur::start( void *p_void )
mvwprintw( p_serveroutput, 2, 2, NCURMSG );
wrefresh ( p_serveroutput );
- print( string("yChat ") + VERSION );
+ print( string("yhttpd ") + VERSION );
p_menu = new menu( 1, 1, 30, 19, NCURADM, choices, 11, COLOR_PAIR(1));
mvprintw(NCUR_SERVER_HEADER_X,NCUR_SERVER_HEADER_Y, NCURSE0);
mvprintw(NCUR_POOL_HEADER_X,NCUR_POOL_HEADER_Y, NCURSE1);
- mvprintw(NCUR_DATA_HEADER_X,NCUR_DATA_HEADER_Y, NCURSE2); //<<
- mvprintw(NCUR_CHAT_HEADER_X,NCUR_CHAT_HEADER_Y, NCURSE3); //<<
mvprintw(NCUR_CACHED_HEADER_X,NCUR_CACHED_HEADER_Y, NCURSE4);
wrap::HTML->print_cached(0);
is_ready(true);
- wrap::SMAN->print_init_ncurses(); //<<
- wrap::STAT->print_num_rooms(); //<<
- wrap::SOCK->print_server_port();
p_menu->start( &switch_main_menu_ );
@@ -165,29 +150,12 @@ ncur::switch_main_menu_( int i_choice )
if( i_choice != 0 )
switch ( i_choice )
{
- //<<*
- case 1:
- wrap::MODL->unload_modules();
- mvprintw( 20,2, "Unloaded all modules ");
- refresh();
- break;
- case 2:
- wrap::MODL->reload_modules();
- mvprintw( 20,2, "Reloaded all modules ");
- refresh();
- break;
- //*>>
case 3:
wrap::HTML->clear_cache();
mvprintw( 20,2, "Cleared the template cache ");
refresh();
break;
case 4:
- //<<*
- if ( ! wrap::GCOL->remove_garbage() )
- wrap::NCUR->print( GAROFFNE );
- mvprintw( 20,2, "Garbage collector activated ");
- //*>>
refresh();
break;
case 5:
@@ -229,7 +197,6 @@ ncur::switch_main_menu_( int i_choice )
case 10:
#ifdef DATABASE
- wrap::DATA->disconnect_all_connections(); //<<
#endif
break;
@@ -255,7 +222,7 @@ ncur::init_ncurses()
noecho();
cbreak(); // Line buffering disabled. pass on everything
init_pair(1, COLOR_BLACK, COLOR_CYAN);
- mvprintw( 0,2, (char*)(tool::ychat_version()).c_str());
+ mvprintw( 0,2, (char*)(tool::yhttpd_version()).c_str());
curs_set(0);
refresh();
}
diff --git a/src/reqp.cpp b/src/reqp.cpp
index 37f0ea2..df9de5d 100755
--- a/src/reqp.cpp
+++ b/src/reqp.cpp
@@ -1,119 +1,119 @@
-// 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 HEADER9
+#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;
+const string reqp::s_http_cotype_add = HEADER8b;
reqp::reqp( )
{}
-string
-reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params )
+void
+reqp::get_request_parameters( string s_parameters, map<string,string>& map_params )
{
- auto unsigned int pos;
- string s_ret ( "" );
- string s_vars( "" );
- auto int i_request;
+ string s_tmp;
+ unsigned i_pos, i_pos2;
- 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
+ while( (i_pos = s_parameters.find("&")) != string::npos )
{
- pos = s_ret.find( "../", 0 );
+ s_tmp = s_parameters.substr(0, i_pos );
- if ( pos == string::npos )
- break;
+ 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_ret.replace( pos, pos+2, "" );
+ s_parameters = s_parameters.substr( i_pos + 1 );
}
- 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 ) );
+ // 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 );
- else
- s_params = s_req.substr( pos+4, s_req.length() -pos-1 );
+ //map<string,string>::iterator iter;
+ //for ( iter = map_params.begin(); iter != map_params.end(); ++iter )
+ //cout << ">>>" << iter->first << "=" << iter->second << endl;
+}
- s_ret = s_ret.substr( 0, pos );
- }
+string
+reqp::get_url( string s_req, map<string, string> &map_params, int& i_postpayloadoffset )
+{
+ unsigned i_pos, i_pos2;
+ string s_vars( "" );
+ string s_ret;
+ int i_req;
- if ( i_request == RQ_POST && s_params.empty() )
+ // GET request
+ if ( s_req.find("GET") != string::npos)
{
- char c_req[READBUF];
+ // Be sure that the GET request has minimum length
+ if ( s_req.length() > 5 )
+ {
+ // Get rid of "GET /"
+ if ( (i_pos = s_req.find("\n")) == string::npos )
+ i_pos = s_req.length() - 1;
- if ( read ( p_thrd->get_sock() , c_req, READBUF ) <= 0 )
- return "NOBYTE";
+ s_req = s_req.substr(5, i_pos - 5);
- s_params = string( strstr( c_req, "event" ) );
+ // Get HTML site to be displayed
+ if ( (i_pos = s_req.find("?")) == string::npos )
+ {
+ if ( (i_pos2 = s_req.find(" HTTP")) != string::npos )
+ s_ret = url_decode( s_req.substr(0, i_pos2));
+ }
+ else
+ {
+ s_ret = url_decode( s_req.substr(0, i_pos) );
+
+ // Get request parameters:
+ if ( (i_pos2 = s_req.find(" HTTP")) != string::npos )
+ {
+ s_req = url_decode( s_req.substr(i_pos + 1, i_pos2 - i_pos - 1) );
+ get_request_parameters( s_req, map_params );
+ }
+ }
+
+ }
}
- auto unsigned int pos2;
- do
+ // POST request
+ else
{
- pos = s_params.find( "=", 0 );
- if ( pos == string::npos )
- break;
-
- pos2 = s_params.find( "&", 0 );
- if ( pos2 == string::npos )
+ if ( (i_pos2 = s_req.find("HTTP")) != 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;
+ if (i_pos2 > 13)
+ {
+ s_ret = url_decode( s_req.substr(6,i_pos2-7) );
+
+ //wrap::system_message(s_req);
+ //wrap::system_message(string("data offset=") + tool::int2string(i_postpayloadoffset));
+ i_pos = s_req.find("event=",i_postpayloadoffset );
+ if(i_pos != string::npos)
+ {
+ get_request_parameters( url_decode( s_req.substr(i_pos) ), map_params);
+ }
+ }
}
- 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 );
+ 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);
map_params["request"] = s_ret;
@@ -121,188 +121,165 @@ reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params )
}
string
-reqp::get_content_type( string s_file )
+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, map<string,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( socketcontainer *p_sock, string s_req, map<string,string> &map_params, int &i_postpayloadoffset )
{
// 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( s_req, map_params, i_postpayloadoffset );
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"] );
- if ( ! s_event.empty() )
- {
- // login procedure.
- if ( s_event == "login" )
- {
- s_chat::get
- ().login( map_params );
- }
+ string s_rep( "" );
- else
- {
- bool b_found;
- // 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)
- {
- string *s_nick=static_cast<string*>(sess_temp->getValue(string("nick")));
- p_user = s_chat::get
- ().get_user( *s_nick, b_found);
- }
- 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.
- }
- // if a message post.
- else if ( s_event == "post" )
- s_chat::get
- ().post( p_user, 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 ) );
+ }
+ // create the http header.
- // if a chat stream
- else if ( s_event == "stream" )
- {
- 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 );
- }
+ string s_resp(s_http);
+ if ( s_event.compare("stream") == 0 )
+ s_resp.append( s_http_stream );
- // 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 );
- }
- }
+ s_resp.append( s_http_colength + tool::int2string(s_rep.size()) + "\r\n" +
+ s_http_cotype + map_params["content-type"] +
+ s_http_cotype_add + "\r\n" );
+
+ s_resp.append(s_rep);
- // 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 ) );
// return the parsed html-template.
- return s_rep;
+ return s_resp;
+}
+
+
+string
+reqp::remove_dots( string s_ret )
+{
+ // remove ".." from the request.
+ unsigned i_pos;
+
+ if ( (i_pos = s_ret.find( ".." )) != string::npos )
+ return remove_dots(s_ret.substr(0, i_pos));
+
+ return s_ret;
}
#endif
diff --git a/src/reqp.h b/src/reqp.h
index c0d82ed..93e32e4 100755
--- a/src/reqp.h
+++ b/src/reqp.h
@@ -1,47 +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;
+ static const string s_http_cotype_add;
// 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( string s_req, map<string,string> &map_params, int& i_postpayloadoffset );
// 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 );
+ // Removes double dots ".."
+ string remove_dots( string s_req );
- virtual int htoi( string *s );
+ // Parses "event=bla?blu=bli&sadasda=asddds ..." string and stores them in the map
+ void get_request_parameters( string s_parameters, map<string,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( socketcontainer* p_sock, string s_req, map<string,string> &map_params, int &i_postpayloadoffset );
+ string url_decode ( string s_url );
+ string get_content_type( string& s_file );
+ void parse_headers( string s_req, map<string,string> &map_params );
};
#endif
diff --git a/src/sign.cpp b/src/sign.cpp
index 584b5f7..ad3e02a 100644
--- a/src/sign.cpp
+++ b/src/sign.cpp
@@ -9,13 +9,6 @@ sign::clean_template_cache(int i_param)
wrap::HTML->clear_cache();
}
-//<<*
-void
-sign::reload_dlopen_modules(int i_param)
-{
- wrap::MODL->reload_modules();
-}
-//*>>
#ifdef CTCSEGV
void
@@ -30,19 +23,10 @@ sign::terminate_received(int i_param)
{
#ifdef NCURSES
- //<<*
- if ( ! wrap::GCOL->remove_garbage() )
- wrap::NCUR->print( GAROFFNE );
- //*>>
mvprintw( 21,2, "Good bye !");
wrap::NCUR->close_ncurses();
- //<<*
-#else
-
- wrap::GCOL->remove_garbage();
- //*>>
#endif
exit(0);
@@ -56,12 +40,9 @@ sign::init_signal_handlers()
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, clean_template_cache);
- signal(SIGUSR2, reload_dlopen_modules); //<<
#ifdef CTCSEGV
-
- signal(SIGSEGV, sigsev_received);
+ signal(SIGSEGV, sigsev_received);
#endif
-
signal(SIGHUP, terminate_received);
signal(SIGINT, terminate_received);
signal(SIGTERM, terminate_received);
diff --git a/src/sign.h b/src/sign.h
index 0f909b3..b11bf75 100644
--- a/src/sign.h
+++ b/src/sign.h
@@ -7,10 +7,8 @@
class sign
{
private:
- static void clean_template_cache(int i_param);
- static void reload_dlopen_modules(int i_param); //<<
+ static void clean_template_cache(int i_param);
#ifdef CTCSEGV
-
static void sigsev_received(int i_param);
#endif
diff --git a/src/sock/sock.cpp b/src/sock/sock.cpp
index 9d673ef..b73b78f 100755
--- a/src/sock/sock.cpp
+++ b/src/sock/sock.cpp
@@ -45,64 +45,6 @@ sock::_close(socketcontainer *p_sock)
delete p_sock;
}
-//<<*
-void
-sock::chat_stream( socketcontainer *p_sock, user *p_user, map<string,string> &map_params )
-{
- string s_msg( "\n" );
-
- for ( int i = 0; i < PUSHSTR; i++ )
- _send(p_sock,s_msg.c_str(), s_msg.size());
-
- pthread_mutex_t mutex;
- pthread_mutex_init( &mutex, NULL );
- pthread_mutex_lock( &mutex );
-
- do
- {
- s_msg = p_user->get_mess( );
-
- if ( 0 > _send( p_sock, s_msg.c_str(), s_msg.size() ) )
- {
- p_user->set_online( false );
- break;
- }
-
- pthread_cond_wait( &(p_user->cond_message), &mutex );
- }
- while( p_user->get_online() );
-
- pthread_mutex_destroy( &mutex );
-
- // if there is still a message to send:
- s_msg = p_user->get_mess( );
-
- if ( ! s_msg.empty() )
- _send( p_sock, s_msg.c_str(), s_msg.size());
-
- // remove the user from its room.
- string s_user( p_user->get_name() );
- string s_user_lowercase( p_user->get_lowercase_name() );
-
- p_user->get_room()->del_elem( s_user_lowercase );
-
- // post the room that the user has left the chat.
- s_msg = wrap::TIMR->get_time() + " "
- + p_user->get_colored_bold_name()
- + wrap::CONF->get_elem( "chat.msgs.userleaveschat" )
- + "<br>\n";
-
- p_user->get_room()->msg_post( &s_msg );
- p_user->get_room()->reload_onlineframe();
-
-#ifdef VERBOSE
-
- cout << REMUSER << s_user << endl;
-#endif
-
- wrap::GCOL->add_user_to_garbage( p_user );
-}
-//*>>
int
sock::_make_server_socket( int i_port )
@@ -389,15 +331,6 @@ sock::_main_loop_init()
wrap::system_message(SOCKUNS);
}
-#ifdef OPENSSL
-// This method is virtual, and is overloaded by sslsock!
-bool
-sock::_main_loop_do_ssl_stuff(int &i_new_sock)
-{
- return 0;
-}
-#endif
-
socketcontainer*
sock::_create_container(int &i_sock)
{
@@ -439,6 +372,8 @@ sock::start()
FD_ZERO (&active_fd_set);
FD_SET (i_sock, &active_fd_set);
+ print_server_port();
+
while( b_run )
{
// block until input arrives on one or more active sockets.
@@ -468,12 +403,6 @@ sock::start()
size = sizeof(clientname);
i_new_sock = accept (i_sock, (struct sockaddr *) &clientname, &size);
-#ifdef OPENSSL
-
- if (_main_loop_do_ssl_stuff(i_new_sock))
- continue;
-#endif
-
#ifdef VERBOSE
wrap::system_message(NEWREQU
diff --git a/src/sock/sock.h b/src/sock/sock.h
index 264d9d1..65fe756 100755
--- a/src/sock/sock.h
+++ b/src/sock/sock.h
@@ -11,7 +11,6 @@
#include <netdb.h>
#include "../reqp.h"
-#include "../chat/user.h"
#include "../thrd/pool.h"
#include "../maps/shashmap.h"
@@ -71,17 +70,11 @@ public:
void clean_ipcache();
// the chat stream there all the chat messages will sent through.
- void chat_stream( socketcontainer* p_sock, user* p_user, map<string,string> &map_params ); //<<
- virtual int _send(socketcontainer *p_sock, const char *sz, int len);
- virtual int _read(socketcontainer *p_sock, char *sz, int len);
- virtual int _close(socketcontainer *p_sock);
+ virtual inline int _send(socketcontainer *p_sock, const char *sz, int len);
+ virtual inline int _read(socketcontainer *p_sock, char *sz, int len);
+ virtual inline int _close(socketcontainer *p_sock);
virtual void _main_loop_init();
-#ifdef OPENSSL
-
- virtual bool _main_loop_do_ssl_stuff(int& i_new_sock);
-#endif
-
- virtual socketcontainer* _create_container(int& i_sock);
+ virtual inline socketcontainer* _create_container(int& i_sock);
virtual int _make_server_socket(int i_port);
#ifdef NCURSES
diff --git a/src/time/timr.cpp b/src/time/timr.cpp
index 9e1522f..6a95984 100755
--- a/src/time/timr.cpp
+++ b/src/time/timr.cpp
@@ -71,7 +71,7 @@ timr::start( void *v_ptr )
time_now = *localtime( &clock_now );
- // set the current time && the current ychat uptime!
+ // set the current time && the current yhttpd uptime!
set_time( difftime( clock_now, clock_start ),
time_now.tm_sec, time_now.tm_min, time_now.tm_hour );
@@ -87,31 +87,14 @@ timr::start( void *v_ptr )
#ifdef SERVMSG
cout << TIMERUP << get_uptime() << endl;
#endif
- //<<*
- int* p_timeout_settings = new int[3];
- p_timeout_settings[0] = tool::string2int(wrap::CONF->get_elem("chat.idle.timeout"));
- p_timeout_settings[1] = tool::string2int(wrap::CONF->get_elem("chat.idle.awaytimeout"));
- p_timeout_settings[2] = tool::string2int(wrap::CONF->get_elem("chat.idle.autoawaytimeout"));
- wrap::CHAT->check_timeout( p_timeout_settings );
- delete p_timeout_settings;
-
- string s_ping = "<!-- PING! //-->\n";
- wrap::CHAT->msg_post( &s_ping );
-
-#ifdef DATABASE
- // Disconnecting idle database conenction
- wrap::DATA->check_data_con_timeout();
-#endif
- //*>>
// Run every ten minutes:
if ( time_now.tm_min % 10 == 0 )
{
- wrap::SOCK->clean_ipcache();
+ wrap::SOCK->clean_ipcache();
// Run every hour
if ( time_now.tm_min % 60 == 0 )
{
- wrap::GCOL->remove_garbage(); //<<
// Run every day
if (time_now.tm_min == 0 || time_now.tm_min == 60 )
diff --git a/src/tool/tool.cpp b/src/tool/tool.cpp
index 3b8e326..dbb1f22 100644
--- a/src/tool/tool.cpp
+++ b/src/tool/tool.cpp
@@ -93,9 +93,9 @@ tool::strip_html( string *p_str)
}
string
-tool::ychat_version()
+tool::yhttpd_version()
{
- return "yChat " + string(VERSION)
+ return "yhttpd " + string(VERSION)
+ "-" + string(BRANCH)
+ " Build " + int2string(BUILDNR);
}
diff --git a/src/tool/tool.h b/src/tool/tool.h
index e0dea50..7a1958d 100644
--- a/src/tool/tool.h
+++ b/src/tool/tool.h
@@ -23,7 +23,7 @@ public:
static string to_lower( string s_str );
static void strip_html( string *p_str );
static string shell_command( string s_command, method m_method );
- static string ychat_version();
+ static string yhttpd_version();
};
#endif
diff --git a/src/wrap.cpp b/src/wrap.cpp
index e071cc9..e6fb851 100755
--- a/src/wrap.cpp
+++ b/src/wrap.cpp
@@ -5,15 +5,6 @@
using namespace std;
-//<<*
-chat* wrap::CHAT = NULL;
-#ifdef DATABASE
-data* wrap::DATA = NULL;
-#endif
-gcol* wrap::GCOL = NULL;
-sman* wrap::SMAN = NULL;
-modl* wrap::MODL = NULL;
-//*>>
conf* wrap::CONF = NULL;
html* wrap::HTML = NULL;
@@ -76,20 +67,10 @@ wrap::init_wrapper(map<string,string>* p_main_loop_params)
CONF->get_elem("httpd.logging.systemlines") );
#endif
- //<<*
- // Init the session manager.
- WRAP->SMAN = SMAN = new sman;
- //*>>
// Init the socket manager.
int i_port = tool::string2int( wrap::CONF->get_elem( "httpd.serverport" ) );
-#ifndef OPENSSL
-
WRAP->SOCK = SOCK = new sock;
-#else
-
- WRAP->SOCK = SOCK = new sslsock;
-#endif
// create the server socket and set it up to accept connections.
if(SOCK->_make_server_socket ( i_port ) <= 0)
@@ -122,27 +103,10 @@ wrap::init_wrapper(map<string,string>* p_main_loop_params)
// Init the thread pool
WRAP->POOL = POOL = new pool;
- //<<*
- // 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;
-#endif
- //*>>
// Run threads
TIMR->run();
diff --git a/src/wrap.h b/src/wrap.h
index 4b0da6f..23d2aa3 100755
--- a/src/wrap.h
+++ b/src/wrap.h
@@ -7,25 +7,15 @@
struct socketcontainer
{
int i_sock;
-#ifdef OPENSSL
- void *p_ssl_context;
-#endif
-
};
#ifdef DATABASE
-#include "data/data.h"
#endif
-#include "chat/chat.h"
#include "conf/conf.h"
-#include "chat/gcol.h"
#include "html.h"
#ifdef LOGGING
#include "logd.h"
#endif
-//<<*
-#include "modl.h"
-//*>>
#ifdef NCURSES
#include "ncur/ncur.h"
@@ -35,14 +25,8 @@ struct socketcontainer
#endif
#endif
-#include "chat/sman.h"
-#ifndef OPENSSL
#include "sock/sock.h"
-#else
-#include "sock/sslsock.h"
-#endif
-
#include "monitor/stats.h"
#include "time/timr.h"
#include "thrd/pool.h"
@@ -54,17 +38,6 @@ using namespace std;
class dynamic_wrap
{
public:
- //<<*
- chat* CHAT;
-#ifdef DATABASE
-
- data* DATA;
-#endif
-
- gcol* GCOL;
- sman* SMAN;
- modl* MODL;
- //*>>
conf* CONF;
html* HTML;
@@ -100,22 +73,6 @@ public:
static void init_wrapper(map<string,string>* p_main_loop_params);
- //<<*
- static chat* CHAT;
-#ifdef DATABASE
-
- static data* DATA;
-#endif
-
- static gcol* GCOL;
- static sman* SMAN;
-#ifdef IRCBOT
-
- static ybot* YBOT;
-#endif
-
- static modl* MODL;
- //*>>
static conf* CONF;
static html* HTML;