diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:45 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:45 +0200 |
| commit | d34015c5ba231b95de20e9fcd7a33c5b2b9a1006 (patch) | |
| tree | ceac33bd27e3b1158a0ac4e17f7fd7e5e6473fea | |
| parent | c507ce3198ea4d822832cc8740f0128df8873c02 (diff) | |
tagging ychat-0.5.3ychat-0.5.3
| -rw-r--r-- | CHANGES | 157 | ||||
| -rwxr-xr-x[-rw-r--r--] | Makefile | 36 | ||||
| -rwxr-xr-x | README | 139 | ||||
| -rwxr-xr-x | conf.txt | 33 | ||||
| -rwxr-xr-x | configure | 1556 | ||||
| -rw-r--r--[-rwxr-xr-x] | html/favicon.ico | bin | 2238 -> 2238 bytes | |||
| -rwxr-xr-x | scripts/astyle.sh | 3 | ||||
| -rwxr-xr-x | scripts/stats.pl | 2 | ||||
| -rwxr-xr-x | src/Makefile.in | 32 | ||||
| -rwxr-xr-x | src/base.cpp | 2 | ||||
| -rwxr-xr-x | src/chat.cpp | 2 | ||||
| -rwxr-xr-x | src/cmnd.cpp | 17 | ||||
| -rwxr-xr-x | src/cmnd.h | 18 | ||||
| -rwxr-xr-x | src/configure | 1884 | ||||
| -rwxr-xr-x | src/glob.h | 232 | ||||
| -rwxr-xr-x | src/html.cpp | 132 | ||||
| -rwxr-xr-x | src/html.h | 36 | ||||
| -rwxr-xr-x | src/incl.h | 19 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/logd.cpp | 163 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/logd.h | 30 | ||||
| -rwxr-xr-x | src/main.cpp | 130 | ||||
| -rwxr-xr-x | src/modl.cpp | 149 | ||||
| -rwxr-xr-x | src/modl.h | 30 | ||||
| -rwxr-xr-x | src/msgs.h | 163 | ||||
| -rwxr-xr-x | src/name.cpp | 34 | ||||
| -rwxr-xr-x | src/name.h | 20 | ||||
| -rwxr-xr-x | src/reqp.cpp | 452 | ||||
| -rwxr-xr-x | src/reqp.h | 47 | ||||
| -rw-r--r-- | src/s_modl.cpp | 10 | ||||
| -rw-r--r-- | src/s_modl.h | 27 | ||||
| -rw-r--r-- | src/s_tool.cpp | 17 | ||||
| -rw-r--r-- | src/s_tool.h | 1 | ||||
| -rw-r--r-- | src/sman.cpp | 8 | ||||
| -rwxr-xr-x | src/sock.cpp | 7 | ||||
| -rwxr-xr-x | src/sock.h | 2 | ||||
| -rwxr-xr-x | src/user.cpp | 29 | ||||
| -rwxr-xr-x | src/user.h | 3 |
37 files changed, 2394 insertions, 3228 deletions
@@ -1,150 +1,11 @@ --Changes from 0.7.9.2-RELEASE to 0.8-RELEASE -$ Modified the Makefiles, so that they produce valid output while using -$ the -j flag of gmake. -$ OpenSSL support has been integrated. Thanks to CryptoMail.org for patching! -$ The next release will also have a credits section in the README! -$ The HTTP parsing stuff has been reviewed and improved by CryptoMail as well. -$ Also a mini bug of the configure script has been fixed. +Changes from 0.5.2-LEGACYRELEASE to 0.5.3-LEGACYRLEASE +- Code cleanup +- Added ./scripts/* +- Added gmake stats option --Changes from 0.7.9.1-RELEASE to 0.7.9.2-RELEASE - -$ Added monitor/dump, and the dump command to the CLI. -$ Fixed a bug in the session manager. -$ Added gmake dist do the README. -$ Added the charset to the HTTP-header. +Changes from 0.5.1-RELEASE to 0.5.2-LEGACYRLEASE +- Changed this branch into a LEGACY branch. +- Rewrote the dynamic thread pool (backport from 0.7.8-CURRENT). +- Added scripts/* +- Code now uses ANSI C++ style with 2 space code indenting. --Changes from 0.7.9-RELEASE to 0.7.9.1-RELEASE - -$ Fixed etc/ychat.conf (Its now valid XML) -$ Fixed some typos. -$ Added the scripts/makedist.sh script, which can be invoked by gmake dist. -$ yhttpd.org has been renamed to yChat.org. The yhttpd.org SLD will be -$ canceled! The yhttpd.org Homepage will remain on yChat.org! - --Changes from 0.7.8-RELEASE to 0.7.9-RELEASE - -$ In the system messages will be the user printed which has requested the - specified module. -$ Removed the cursor from the ncurses interface. -$ Added wrap::init_wrappers -> The main.cpp is now shorter. -$ Added some Makefile modifications -$ Bugfix: cleanipcache shouldn run every minute but every 10! -$ Bugfix: scripts/stats.pl now counts all text-files properly. - --Changes from 0.7.7.1-RELEASE to 0.7.8-RELEASE - -$ Updated the yhttpd generation script due new sources in src/memb. -$ Changd some hashmaps back into simple std::map objects, this might -$ has resulted in some bugs due slow hashmap initialization time. -$ Hashmaps now only should being used on permanent objects. -$ Rewrote the dynamic thread pool. -$ makeyhttpd now also removes the yChat specific form etc/yhttpd.conf -$ automatically. -$ Implemnted an IP Cache (makes yChat faster). -$ Implemented signal catcher: -$ SIGUSR1 will clear the html template cache. -$ SIGUSR2 will reload the dynamic modules. -$ SIGSEGV can be catched if defined in src/glob.h. -$ SIGHUP, SIGINT and SIGTERM will shutdown yChat cleanly. -$ Added Allow: GET to the HTTP header. -$ Bugfix: The httpd.logging.accesslines now will be read correctly. -$ Bugfix: JavaScript messages now wont be logged. - --Changes from 0.7.7-RELEASE to 0.7.7.1-RELEASE - -$ Bugfix in main.cpp which resulted in a core dump on yChat startup. - --Changes from 0.7.6-RELEASE to 0.7.7-RELEASE - -$ Major code cleanup. -$ Bugfix in /col. -$ Bugfix in gcol #1 (destroy session also if no database is used). -$ Bugfix in gcol #2 (now runs each hour not once a day). -$ Renew the style.css and stream.html. - --Changes from 0.7.5-RELEASE to 0.7.6-RELEASE - -$ Removed the old hash maps and included the SGI C++ STL extenstion -$ hash_map. - --Changes from 0.7.4.1-RELEASE to 0.7.5-RELEASE - -$ Garbage collector will now run once a hour rather than each ten minutes. -$ Dynamic thread pool improvements. -$ Removed equiv-http-refresh meta tag from the online list. -$ Minor bugfix in the /topic command. -$ Implemented "User list". - --Changes from 0.7.4-RELEASE to 0.7.4.1-RELEASE - -$ Dynamic thread pool bugfix (dead lock). - --Changes from 0.7.3-RELEASE to 0.7.4-RELEASE - -$ Code cleanup. -$ Made the thread pool increasing dynamic. -$ Added some thread pool optimazions. -$ Added some more ${MAKE} vars to the Makefiles. -$ Added Content-length to the HTTPD header. -$ Added the !command to the command line interface. -$ Added Content-type text/plain. -$ Added scrolling checkbox to input.html. -$ Removed modl from yhttpd. Dynamic modules are not needed in yhttpd yet. -$ Improved session engine. -$ Fixed auto logout bug. -$ Fixed newline bug (one \n too much for each html template). -$ Logging can now be completely disabled. - --Changes from 0.7.2 to 0.7.3-RELEASE - -$ Added FreeBSD 5.3-RELEASE support. -$ Added chat.enableguest option. -$ Added the /all command (Global system message). -$ Renamed the /getstatus command into /about. -$ Fixed the &-bug (& should be allowed in messages). \AND is now a -$ synonym for & too. -$ Fixed the /msg bug (In /msg the string replacer should be activated). -$ Fixed logging bug (do not log any timestamps if there are no messages). - --Changes from 0.7.1 to 0.7.2-RELEASE - -$ New features: -$ /morph. -$ Added the new standard html template design. -$ Bugfixes: -$ /away prints a . instead of a : if no away reason is given. -$ /ko message was wrong. Displayed not room name of the user to be kicked out. -$ /invisible command displayed wrong private messages. -$ /getstatus had no help text. -$ /msg and /s should now print the system time if printalwaystime == true. -$ Added a blank to the /uptime message. -$ /topic now prints the topic in the user's color. -$ Fixed some typos. - --Changes from 0.7.0 to 0.7.1-RELEASE - -$ Added ${MAKE} to the config file because some Linux distros dont use -$ the "gmake" command for GNU make but just "make"! Modified the -$ configure script to generate a make.version file. -$ Removed some typos from the ychat.conf. -$ Fixed the auto away message. This one will be posted in the room -$ as public rather than only private to the auto-away-user. -$ Fixed some documentation stuff for yhttpd because yhttpd does not -$ need MySQL at all. -$ Added the chat.maxlength.word option. - --Changes from 0.6 to 0.7.0-RELEASE - -$ Better stability . -$ Better performance (using more hmaps). -$ HTML color switcher menu. -$ New commands: /away /room /j /ren. -$ Simple garbage collector for old user and room objects. -$ Use of the database (MySQL). -$ Nick registration and password protection. -$ Status images for Operator, Half-Operator, Voiced user and Guests. -$ New Makefiles. -$ Useful Perl scripts for sourcecode stats generation etc. -$ Added system_log and room logging to access_log logging. -$ Added time-offset option. -$ Added to the admin interface new options. -$ Added Logout button. -$ Added string replacer there certain substr. of postings will be replaced by another string (such as smiley images). -$ Added Superuser levels and the /ko and /set commands. -$ Added admin CLI (Command Line Interface) mode. -$ Added memory rusage history which tracks memory usage for the last 10 days. -$ Added HTTP POST request parsing. -$ Made yChat more modular so yhttpd can be extracted from it -$ (scripts/makeyhttpd.pl). -$ Added CGI support. -$ Rewrote big parts of the Makefiles and the configure scripts. -$ Made it compatible to GNU G++ 3.4, 3.3, 3.2 and 3.1 (3.0 and earlier do not -$ work). -$ XML based configuration file (ychat.conf). -$ Added default operator option: chat.defaultop. @@ -1,13 +1,23 @@ -# Generated automatically from Makefile.in by configure. -SRCS=base.cpp chat.cpp s_chat.cpp cmnd.cpp conf.cpp s_conf.cpp cont.cpp html.cpp s_html.cpp main.cpp mutx.cpp s_mutx.cpp name.cpp pool.cpp reqp.cpp room.cpp sock.cpp s_sock.cpp thrd.cpp s_tool.cpp user.cpp -OBJS=$(SRCS:.cpp=.o) -CC=g++ -LDFLAGS=-ldl -lstdc++ -g -LDADD=-pthread -D_THREAD_SAFE -all: ychat -$(SRCS): - $(CC) $(CFLAGS) -c $*.cpp -ychat: $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD) -clean: - rm *.o +MAKE=gmake +all: base + @echo "Now edit the ./conf.txt file and run ./ychat!" + @echo WARNING! This software is EXPERIMENTAL! +install: deinstall +uninstall: deinstall +deinstall: + @echo Install/deinstall is not supported! + @echo Start yChat with ./ychat instead! + @exit 1 +base: + @${MAKE} -C ./src +clean_base: + @${MAKE} -C ./src clean +stats: + @perl scripts/stats.pl +run: + ./ychat +gpl: + @more COPYING +clean: clean_base +debug: + @gdb ./ychat ychat.core @@ -1,5 +1,6 @@ -yChat++; Homepage: www.yChat.org; Version CVS +yChat; Homepage: www.yChat.org; Version 0.5.3-RELEASE Copyright (C) 2003 Paul C. Buetow, Volker Richter +Copyright (C) 2005 Paul C. Buetow ----------------------------------------------------------------- This program is free software; you can redistribute it and/or @@ -18,40 +19,74 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ----------------------------------------------------------------- -Notes: I programmed this on FreeBSD but should also compile without -big problems on Linux or other UNIX-like systems. -If you have tested one of those then pleace write me the name of the OS, -kernel version, make version and compiler & version. I will list it -right here: +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 + +1.0.0 REQUIREMENTS: + +- gcc 3.x + The GNU C++ compiler. + +1.1.0 TESTED PLATFORMS: The following platforms have been tested with success: -- FreeBSD 5.0-RELEASE, GCC 3.2.1, FreeBSD 5.0 make and GNU make 3.80 +- 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 -- Linux Kernel 2.4.19, GCC 3.2.0, GNU make 3.79.1 +1.2.0 IMPORTANT NOTES: 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! +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 +homepage which is located at http://www.yChat.org. + +1.3.0 HOW TO OBTAIN YCHAT: + +yChat can be downloaded as a source package or through CVS. + +The packages are located at http://www.yChat.org -> Sourcecode -> +Packages or go to http://programming.buetow.org/CPP-yChat . + +For CVS download type also look at the homepage please. + +1.3.1 INSTALLATION: -If you like to support yChat++, please write me an email and tell me -what you can/like/would help ;-]. Please also take a look at the -yChat++ homepage ( www.yChat.org ). +Invoke "./configure" and afterwards "make", edit the conf.txt. + +Now we want to compile all the dynamic loadable modules of ychat. +Invoke "cd cmnd && ./compile.sh && cd -". All command modules should get +compiled. + +Now its time to run the server with ./ychat. +Then point your webbrowser to http://yourip:port ! -Installation: Just invoke "./configure" and afterwards "make", edit the -conf.txt and run the server with ./ychat. Then point your webbrowser -to http://yourip:port/index.html -( ignoring the index.html on the end of the url will not work! ). ... have fun :-). -If you like customizing the design/layout/language of yChat, you will have +1.5.0 CUSTOMIZATION: + +If you like to customize the design/layout/language of yChat, you will have to edit msgs.h and glob.h before you compile the sources. Afterwards you can change the html-template files which are placed in the html/ subdirectory. +Dynamic loadable modules can be found in the cmnd/ subdirectory. -Files: +1.6.0 FILES: ( This list is not complete ) conf.txt - The yChat configuration file. ( read by conf.cpp ). +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. @@ -62,6 +97,10 @@ hmap.cpp - The hash map implementation which is a very fast data main.cpp - This includes the required manager headers for starting the server and finally regulates the correct starting. +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. + 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. @@ -116,7 +155,7 @@ sock.cpp - The socket manager. Manages the socket connections. There are multiplexed sockets. For each requests a new POSIX thread will be created. -Files written in capital letters contain static C++ classes +Files with a leading s_ contain static C++ classes s_chat.cpp - Static wrapper for the dynamic chat class. holds one global reachable instance of chat until the program shuts down. @@ -151,7 +190,6 @@ msgs.h - Defines console output messages for verbosity level 0 ( see all the system messages. you may edit this file for translating the system user language. - The basic class structure: base<room> base<user> @@ -165,11 +203,58 @@ The basic class structure: / \ conf html -Version Lines of code - 0.1 2402 - 0.2 2377 +1.7 WRITING BUG REPORTS + +How to submit a good bug report? + +Send them to Bug@yChat.org. + +First you should give the following information: +- yChat version, if CVS (or devel. tarball) then which day? +- operating system / distribution and it's version +- when did it crash? did you do something? can you reproduce the crash? + +Getting backtrace of the crash also helps a lot, especially if yChat 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: + + ulimit -c unlimited + +So, if you have the core file and GNU debugger (gdb), you can get the backtrace with: + + gdb ychat 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> > >&) () + (gdb) bt + #0 0x0805c287 in reqp::parse(thrd*, std::string, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >&) () + #1 0x0806060f in sock::read_write(thrd*, int) () + #2 0x080612ba in thrd::run() () + #3 0x0805a3b8 in pool::run_func(void*) () + #4 0x0805a375 in pool::tpool_thread(void*) () + #5 0x281d44ae in _thread_start () from /usr/lib/libc_r.so.5 + (gdb) + +1.8 CONTACT: + +You may contact us through the following addresses: + +- Homepage + The yChat homepage is located at http://www.yChat.org + +- E-Mail + Paul C. Buetow: Snooper@yChat.org ( core developer ) + Volker Richter: Rover@yChat.org ( core developer ) + Mail@yChat.org ( reaches everybody of yChat ) + +- ICQ + Paul C. Buetow: 11655527 -New in 0.2: - - POST request now work. - - Thread pool ( pool.cpp ). - - Bugfixes +- IRC + #ychat at irc.german-elite.net @@ -11,16 +11,17 @@ # all lines which do not contain a semicolon and at least two quotes # or start with a # will be ignored. # -# greets, paul c. buetow ( snooper@ychat.org ); +# greets, paul c. buetow ( snooper at ychat dot org ); # # server specific configurations ( not allowed to be removed ): HTMLTEMP="html/"; # directory of the html-template files. -THRDPOOL="5"; # thread pool size. -THRDQUEU="5"; # length of the thread pool queue. -SRVRPORT="2000"; # local port on which the server listens. +THRDPOOL="1"; # Initial pool size. +THRDPMAX="52"; # Max thread pool size +SRVRPORT="3000"; # local port on which the server listens. STRDROOM="Lounge"; # the name of the standard room. +LANGUAGE="en"; # language of the chat outputs ( CONSOLE OUTPUT IS NOT AFFECTED ) # the html template file which will be send if the requested file does not exists. NOTFOUND="notfound.html"; @@ -29,21 +30,25 @@ STARTMPL="index.html"; # user's standard nick color. USERCOL1="#FFFFFF"; -# superuser level names. level 0 has the most provileges. -SULEVEL0="Coder"; # programmer. -SULEVEL1="Admin"; # administrator. -SULEVEL2="Magic"; # super user with special privileges. -SULEVEL3="Super"; # temporary super user. -SULEVEL4="Basic"; # normal user without special privileges. -SULEVEL5="Guest"; # guest user, has almost no privileges. -SULEVEL6="Restr"; # a very restricted user. -SULEVEL7="Outbn"; # banned out of the system. +# length of the generated session id +SESSION_LENGTH="32"; # html = "OFF" strips all html tags from incoming messages HTML="OFF"; + +# Logging + +# relative or absolute path to logfile +ACCESS_LOG="log/access_log"; + +# we're using buffered logging for performance +# LOG_LINES specifies after how many lines the log is flushed into a file +# if you don't want buffered logging set LOG_LINES to 1 +LOG_LINES="10"; + # values which are used by the html-templates and are not sticked within the yC++ core source! GRAPHICS="http://paul.buetow.info/yChat"; # url for graphic files etc. -PGETITLE="yChat++ Basic - Fast Simple Extensible"; +PGETITLE="yChat 0.5.2-LEGACY - Fast Simple Extensible"; # do not edit beyond this line @@ -1,1555 +1,5 @@ -#! /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); } - -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 -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure: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 - -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 +cd ./src +./configure diff --git a/html/favicon.ico b/html/favicon.ico Binary files differindex 4deafd5..4deafd5 100755..100644 --- a/html/favicon.ico +++ b/html/favicon.ico diff --git a/scripts/astyle.sh b/scripts/astyle.sh index b9dbc45..757364e 100755 --- a/scripts/astyle.sh +++ b/scripts/astyle.sh @@ -1,5 +1,6 @@ #!/bin/sh -# The yChat Project (2004) + +# The yChat Project (2004, 2005) # # This uses "astyle" to format C++ code into a specific code style! diff --git a/scripts/stats.pl b/scripts/stats.pl index 96fbdf1..b55bc9e 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|[A-Z]+)$/ ) + elsif ( $shift =~ /(\.txt|README|INSTALL|COPYING|NEWS|SNAPSHOT|ChangeLog)$/ ) { $stats{"Number of text files"}++; $stats{"Lines of text"} += countlines($shift); diff --git a/src/Makefile.in b/src/Makefile.in index 0382389..779ce5b 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,21 +1,15 @@ -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 +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): - $(CC) $(INCLUDES) $(CFLAGS) -c $*.cpp -infotext: - @echo Compiling base -ychat: infotext $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD) - @mv ychat ../bin - @echo -n "Size of linked executable: " - @du -hc ../bin/ychat | tail -n 1 -clean: - @echo Cleaning base obj - @if test -d ../obj; then rm -Rf ../obj; fi + $(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 diff --git a/src/base.cpp b/src/base.cpp index 06c0c2d..0d67564 100755 --- a/src/base.cpp +++ b/src/base.cpp @@ -4,7 +4,7 @@ $Author: buetow $ $Date: 2005/03/02 12:57:41 $ - $Header: /usr/home/cvs/cvsroot/ychat-stable/src/base.cpp,v 1.1 2005/03/02 12:57:41 buetow Exp $ + $Header: /usr/home/cvs/cvsroot/ychat-0.5/src/base.cpp,v 1.1 2005/03/02 12:57:41 buetow Exp $ */ // template class data implementation; diff --git a/src/chat.cpp b/src/chat.cpp index 38d7a6a..da574c7 100755 --- a/src/chat.cpp +++ b/src/chat.cpp @@ -137,6 +137,8 @@ chat::post( user* p_user, map_string &map_params ) string s_msg( map_params["message"] ); auto unsigned i_pos = s_msg.find( "/" ); + if ( i_pos == 0 ) + return p_user->command( s_msg ); if ( b_strip_html ) s_tool::strip_html( &s_msg ); diff --git a/src/cmnd.cpp b/src/cmnd.cpp new file mode 100755 index 0000000..f305f35 --- /dev/null +++ b/src/cmnd.cpp @@ -0,0 +1,17 @@ +// class cmnd implementation. + +#ifndef CMND_CXX +#define CMND_CXX + +#include "cmnd.h" +#include "s_mutx.h" + +using namespace std; + +cmnd::cmnd( ) +{} + +cmnd::~cmnd() +{} + +#endif diff --git a/src/cmnd.h b/src/cmnd.h new file mode 100755 index 0000000..b5a1d4d --- /dev/null +++ b/src/cmnd.h @@ -0,0 +1,18 @@ +// class cmnd declaration. + +#ifndef CMND_H +#define CMND_H + +#include "incl.h" + +using namespace std; + +class cmnd +{ +public: + // public methods: + explicit cmnd( ); // a standard constructor. + ~cmnd( ); +}; + +#endif diff --git a/src/configure b/src/configure index 55df52b..8c5f0a7 100755 --- a/src/configure +++ b/src/configure @@ -1,343 +1,1555 @@ -#!/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. # -# The yChat Project (2003 - 2005) -# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. -if ! ../scripts/checkperl.sh -then - exit 1 +# 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 -if ! test -f ../g++.version +fi + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1004: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1009 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1034 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1052 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext <<EOF +#line 1073 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then - echo You need to run ./configure of the top level source dir first - exit 1 -fi - -perl -e ' - use strict; - $|=1; - - my %libadd; - my %incadd; - my $deepness = 500; - - my @headers = ( - "dlfcn.h", - "pthread.h", - "mysql/mysql.h", #//<< Not needed for yhttpd - "netinet/in.h", - "time.h", - "ncurses.h", - "openssl/ssl.h", - "::test::ext/hash_map" - ); - - my @libs = ( - "libmysqlclient.so", #//<< Not needed for yhttpd - "libncurses.so", - "libssl.so", - "libcrypto.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); - } - - if ( /\/\/#define OPENSSL/ ) - { - remove_from_array("openssl/ssl.h",\@headers); - remove_from_array("lib$_.so",\@libs) for ("ssl", "crypto"); - } - } - close FILE; - - if ( defined $ENV{YCHATHEADERPATHS} ) - { - map { print "Adding $_...\n"; - unshift @headerpaths, $_ } split /:/, $ENV{YCHATHEADERPATHS}; - } - - if ( defined $ENV{YCHATLIBPATHS} ) - { - map { print "Adding $_...\n"; - unshift @libpaths, $_ } split /:/, $ENV{YCHATLIBPATHS}; - } - - - 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 "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure: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 - 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 YCHATHEADERPATHS and YCHATLIBPATHS.\n"; - print " Example: setenv YCHATHEADERPATHS \"/your/header/includes:/a/includes\"\n"; - print "(The environment variables have to be seperated by an :)\n"; - print "PS: You may use the locate and/or find command to search for files.\n"; - exit(1); - } - - `touch ../err`; - return ""; - } - - 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"` +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 + +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 + @@ -1,201 +1,35 @@ -/* - 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 -// Definition of boolean values. +#include <map> +#include <pthread.h> + +// definition of boolean values. #define true 1 #define false 0 -//<<* -/* FIRST THE YCHAT ONLY OPTIONS */ - -/* - CONFIG - - Should yChat get compiled with database support? Currently MyS- - QL only is a supported database. -*/ -//#define DATABASE - -#ifdef DATABASE -#define USE_MYSQL -/* - CONFIG - - Should all database queries printed out at the admin interface? - (This option wont take action if database support has not been - chosen) -*/ -#define DATA_PRINT_QUERIES -#endif +// config filename. +#define CONFILE "conf.txt" -/* - CONFIG - - Defines the amount of newlines which have to be sent to the clie- - nt's chat stream after the first log-in. It prevents a white scr- - een because of browser buffers or proxies. -*/ -#define PUSHSTR 500 - -/* AFTERWARDS THE YCHAT AND YHTTPD OPTIONS */ -//*>> - -/* - CONFIG - - Should yChat get compiled with OpenSSL support? -*/ -//#define OPENSSL - -/* - CONFIG - - Should yChat get compiled with comand line interface support? -*/ -#define CLI - -/* - CONFIG - - What should be the name of the config file? -*/ -#define CONFILE "ychat.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 yChat! -*/ -//#define EXPERIM - -/* - CONFIG - - Should yChat get compiled with logging support? -*/ -#define LOGGING - -/* - CONFIG - - Please enter the highest networking port which is allowed to be - used. If yChat is unable to create the server socket on a cert- - ain port, it will increment the port number and retries to cre- - ate another socket on the incremented port number. This proced- - ure will continue until MAXPORT has been reached. -*/ +// 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. #define MAXPORT 65535 -/* 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 yChat 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 yChat 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 yChat to catch the SIGSEGV signal. yChat - 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 yChat has been compiled - without ncurses support. This option shows you all incoming - requests with the client IP and port numbers. You probably want - this to be turned off if you have heavy server load. -*/ -//#define VERBOSE - - - - -// 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_CHAT_HEADER_X 21 -#define NCUR_CHAT_HEADER_Y 52 -#define NCUR_NUM_ROOMS_X 22 -#define NCUR_NUM_ROOMS_Y 52 -#define NCUR_SESSION_X 23 -#define NCUR_SESSION_Y 52 - -#define NCUR_CACHED_HEADER_X 21 -#define NCUR_CACHED_HEADER_Y 68 -#define NCUR_CACHED_DOCS_X 22 -#define NCUR_CACHED_DOCS_Y 68 -#define NCUR_CACHED_MODS_X 23 -#define NCUR_CACHED_MODS_Y 68 - -#define NCUR_MENU_CHAR_X 0 -#define NCUR_MENU_CHAR_Y 33 -#define NCUR_UPTIME_X 0 -#define NCUR_UPTIME_Y 44 -#define NCUR_TIME_X 0 -#define NCUR_TIME_Y 64 +// 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 -#endif ////////////////////////////////////////////////////////////////////////////////////////// // DO NOT CHANGE ANYTHING BEHIND THIS LINE! @@ -203,11 +37,26 @@ 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[4]; + void* elem[3]; }; struct dynmod @@ -216,11 +65,4 @@ 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 3f47867..50cf1e6 100755 --- a/src/html.cpp +++ b/src/html.cpp @@ -1,87 +1,94 @@ -#ifndef HTML_CPP -#define HTML_CPP +// class html implementation. + +#ifndef s_html_CXX +#define s_html_CXX #include <fstream> #include "html.h" +#include "s_chat.h" +#include "s_mutx.h" using namespace std; html::html( ) { - set_name( wrap::CONF->get_elem( "httpd.templatedir" ) ); + set_name( s_conf::get + ().get_val( "HTMLTEMP" ) ); + pthread_mutex_init( &mut_map_vals, NULL ); } html::~html( ) -{} +{ + pthread_mutex_destroy( &mut_map_vals ); +} void html::clear_cache( ) { - clear(); - wrap::system_message( CLRHTML ); - -#ifdef NCURSES - - print_cached( 0 ); -#endif + pthread_mutex_lock ( &mut_map_vals ); + clear_vals(); + pthread_mutex_unlock( &mut_map_vals ); } string -html::parse( map<string,string> &map_params ) +html::parse( map_string &map_params ) { string s_file = map_params["request"]; // check if s_file is in the container. - string s_templ; + pthread_mutex_lock ( &mut_map_vals ); + string s_templ = get_val( s_file ); + pthread_mutex_unlock( &mut_map_vals ); // if not, read file. - if ( ! shashmap<string>::exists( s_file ) ) + if ( s_templ.empty() ) { - string s_path = get_name(); - ifstream if_templ( s_path.append( s_file ).c_str(), ios::binary ); + auto string s_path = get_name(); + auto ifstream fs_templ( s_path.append( s_file ).c_str(), ios::binary ); - if ( ! if_templ ) + if ( ! fs_templ ) { - wrap::system_message( OFFFOUND + s_path ); - if(map_params["request"] == wrap::CONF->get_elem( "httpd.html.notfound" )) - return ""; - map_params["request"] = wrap::CONF->get_elem( "httpd.html.notfound" ); + 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" ); return parse( map_params ); + } - char c_buf; - while( !if_templ.eof() ) + auto char c_buf; + while( !fs_templ.eof() ) { - if_templ.get( c_buf ); - s_templ += c_buf; + fs_templ.get( c_buf ); + s_templ+=c_buf; } - if ( map_params["content-type"].compare(0,5,"text/") == 0 ) - s_templ.erase(s_templ.end()-1); - - if_templ.close(); + fs_templ.close(); - wrap::system_message( TECACHE + s_path ); - - // cache file. - shashmap<string>::add_elem(s_templ, s_file); -#ifdef NCURSES +#ifdef VERBOSE - print_cached( shashmap<string>::size() ); + pthread_mutex_lock ( &s_mutx::get + ().mut_stdout ); + cout << TECACHE << s_path << endl; + pthread_mutex_unlock( &s_mutx::get + ().mut_stdout ); #endif - } - else - { - s_templ = shashmap<string>::get_elem( s_file ); + // cache file. + pthread_mutex_lock ( &mut_map_vals ); + map_vals[ s_file ] = s_templ; + pthread_mutex_unlock( &mut_map_vals ); } // find %%KEY%% token and substituate those. - unsigned pos[2]; + auto unsigned int pos[2]; pos[0] = pos[1] = 0; - for(;;) + do { pos[0] = s_templ.find( "%%", pos[1] ); @@ -95,8 +102,9 @@ html::parse( map<string,string> &map_params ) break; // get key and val. - string s_key = s_templ.substr( pos[0], pos[1]-pos[0] ); - string s_val = wrap::CONF->get_elem( s_key ); + auto string s_key = s_templ.substr( pos[0], pos[1]-pos[0] ); + auto string s_val = s_conf::get + ().get_val( s_key ); // if s_val is empty use map_params. if ( s_val.empty() ) @@ -106,44 +114,34 @@ html::parse( map<string,string> &map_params ) s_templ.replace( pos[0]-2, pos[1]-pos[0]+4, s_val ); // calculate the string displacement. - int i_diff = s_val.length() - ( pos[1] - pos[0] + 4); + auto int i_dif = s_val.length() - ( pos[1] - pos[0] + 4); - pos[1] += 2 + i_diff; + pos[1] += 2 + i_dif; - }; + } + while( true ); return s_templ; } -//<<* void -html::online_list( user *p_user, map<string,string> &map_params ) +html::online_list( user *p_user, map_string &map_params ) { // prepare user_list. - string s_list; - - room* p_room = p_user->get_room(); + string s_list ( "" ); + string s_seperator( "<br>" ); - p_room->get_user_list( s_list ); + p_user->get_p_room()->get_user_list( s_list, s_seperator ); - map_params["room"] = p_room->get_name(); - map_params["topic"] = p_room->get_topic(); - map_params["userlist"] = s_list; -} -//*>> + // use the collected data as a message in html-templates. + map_params["MESSAGE"] = s_list; -#ifdef NCURSES -void -html::print_cached( int i_docs ) -{ - if ( !wrap::NCUR->is_ready() ) - return; + // renew the timestamp. + p_user->renew_stamp(); - mvprintw( NCUR_CACHED_DOCS_X, NCUR_CACHED_DOCS_Y, "Docs: %d ", i_docs); - refresh(); + // send a ping to the client chat stream. + p_user->msg_post( new string("\n") ); } #endif -#endif - @@ -1,40 +1,42 @@ // class html declaration. this class manages the html-template files. -#include "incl.h" -#ifndef HTML_H -#define HTML_H +#ifndef s_html_H +#define s_html_H -#include "maps/shashmap.h" -#include "chat/user.h" +#include "incl.h" +#include "cont.h" +#include "s_conf.h" +#include "user.h" #include "name.h" + using namespace std; -class html : public shashmap<string>, name +class html : public cont, name { +private: + // needed for synchronizing the map_vals. + pthread_mutex_t mut_map_vals; + public: - html( ); + // public methods. + explicit html( ); // simple constructor. ~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. - string parse( map<string,string> &map_params ); - - void online_list( user *p_user, map<string,string> &map_params ); //<< -#ifdef NCURSES - - void print_cached( int i_docs ); -#endif + virtual string parse( map_string &map_params ); + virtual void online_list( user *p_user, map_string &map_params ); }; #endif @@ -1,13 +1,16 @@ -#include <pthread.h> +// contains header files which are included by all classes. + +// include some std headers. #include <iostream> -#include <string> -#include <map> -#include "glob.h" +// since thread synchronization is a big issue this header needs +// to be included by every other file too. +#include <pthread.h> -#ifdef NCURSES -#include <ncurses.h> -#endif +// std::string. +#include <string> +// include all the custom global variables. +#include "glob.h" +// include all the custom messages. #include "msgs.h" -#include "wrap.h" diff --git a/src/logd.cpp b/src/logd.cpp index 664cd14..63c2a64 100755..100644 --- a/src/logd.cpp +++ b/src/logd.cpp @@ -1,175 +1,66 @@ - -#ifndef LOGD_CPP -#define LOGD_CPP +#ifndef LOGD_CXX +#define LOGD_CXX #include "logd.h" -#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() +logd::logd( string filename ) { - 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() ) + if(filename.empty()) { - wrap::system_message( LOGERR2 ); + cerr << "ycLog: No filename specified" << endl; exit(1); } - //if (wrap::NCUR->is_ready()) - // wrap::system_message(LOGGINI+s_filename); + s_logfile=filename; - 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); + i_lines=s_tool::string2int( s_conf::get + ().get_val("LOG_LINES")); - 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() { - ofstream of_output; - of_output.open(s_logfile.c_str(), ios::app); + s_output.open(s_logfile.c_str(), ios::app); - if( of_output == NULL ) + if(s_output==NULL) { - wrap::system_message( LOGERR1 + s_logfile ); + cerr << "ycLog: Could not open file: " << s_logfile << endl; exit(1); } - while( ! s_queue.empty() ) + + while(!s_queue.empty()) { string s_l=s_queue.front(); s_queue.pop(); - of_output.write( s_l.c_str(), s_l.size() ); - } - - of_output.close(); -} - -void -logd::log_access( map<string,string> &map_request ) -{ - //static int i_access_lines = wrap::CONF->get_elem("httpd.logging.access_lines"); - - 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"; + s_output.write(s_l.c_str(), s_l.size()); - pthread_mutex_lock ( &mut_s_logging ); - s_queue.push(s_logstr); - - if ( s_queue.size() > i_lines ) - flush(); - - pthread_mutex_unlock( &mut_s_logging ); + } + s_output.close(); } - -void -logd::log_simple_line( string s_line ) +void logd::log( map_string request ) { - // Dont log empty lines! - if (s_line.empty()) - return; + struct tm *t_m; + time_t t_cur=time(NULL); + t_m=gmtime(&t_cur); - string s_time = get_time_string(); - string s_logstr = s_time + " " + s_line; + 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"; - 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 ); -} - -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() +logd::~logd() { - 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 2d6270b..788015b 100755..100644 --- a/src/logd.h +++ b/src/logd.h @@ -1,37 +1,25 @@ -#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; - pthread_mutex_t mut_s_logging; + ofstream s_output; 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 s_filename, string s_log_lines ); - logd( string s_filename, int i_log_lines ); + logd( string filename ); ~logd(); - 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 ); + void flush(); + void log( map_string request ); }; - -#endif #endif - diff --git a/src/main.cpp b/src/main.cpp index 970f26e..2846503 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ /* - * yChat; Contact: www.yChat.org; Mail@yChat.org + * yChatContact: www.yChat.org; Mail@yChat.org * Copyright (C) 2003 Paul C. Buetow, Volker Richter - * Copyright (C) 2004, 2005 Paul C. Buetow + * Copyright (C) 2005 Paul C. Buetow * ----------------------------------------------------------------- * * This program is free software; you can redistribute it and/or @@ -20,88 +20,82 @@ * */ +// 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 "maps/hashmap.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" using namespace std; -map<string,string>* -parse_argc( int argc, char* argv[] ) +int main() { - map<string,string>* start_params = new map<string,string>; - - string s_output = ""; - - // Set to 1 if a config option key has to be read - // ( ./ychat -o key1 value1 -o key2 value2 ... ); - bool b_conf = 0; - - // Will store the key of an additional option value (see also b_conf) - string s_key; - - for (int i=1; argv[i] != 0; i++) - { - if ( !s_key.empty() ) - { - (*start_params)[s_key] = string(argv[i]); - s_key.clear(); - } - else if ( b_conf ) - { - s_key = string(argv[i]); - b_conf = 0; - } - else - { - if ( string(argv[i]).find("v") != string::npos ) - s_output.append(tool::ychat_version()+"\n"); - - if ( string(argv[i]).find("h") != string::npos ) - s_output.append( YCUSAGE ); - - if ( string(argv[i]).find("o") != string::npos ) - b_conf = 1; - } - } - - if ( !s_output.empty() ) - { - cout << s_output; - delete start_params; - exit(1); - } - - return start_params; -} +#ifdef VERBOSE + + cout << " ___ _ _ " << endl + << " _ _ / __\\ |__ __ _| |_ " << endl + << "| | | |/ / | '_ \\ / _` | __|" << endl + << "| |_| / /___| | | | (_| | |_ " << endl + << " \\__, \\____/|_| |_|\\__,_|\\__|" << endl + << " |___/ " << endl << endl -int -main(int argc, char* argv[]) -{ - cout << tool::ychat_version() << endl << DESCRIP << endl - << DESCRI2 << endl + << VERSION << ", " << CONTACT << endl - << SEPERAT << endl; - - wrap::init_wrapper(parse_argc(argc, argv)); - - //<<* - // Initialize database connection queue -#ifdef DATABASE - - wrap::DATA->init_connections(); + << SEPERAT << endl + << STARTMS << endl ; #endif - //*>> - sign::init_signal_handlers(); + // 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. // start the socket manager. this one will listen for incoming http requests and will // forward them to the specified routines which will generate a http response. - wrap::SOCK->start(); + s_sock::get + ().start(); + +#ifdef VERBOSE cout << DOWNMSG << endl; +#endif + return 0; } diff --git a/src/modl.cpp b/src/modl.cpp index 32fe33a..dc6770b 100755 --- a/src/modl.cpp +++ b/src/modl.cpp @@ -1,85 +1,59 @@ -#ifndef MODL_CPP -#define MODL_CPP +// class modl implementation. + +#ifndef MODL_CXX +#define MODL_CXX #include <limits.h> #include <stdlib.h> #include <dlfcn.h> #include <stdio.h> +#include "s_mutx.h" #include "modl.h" -#include "tool/dir.h" using namespace std; -modl::modl() +modl::modl( ) { -#ifdef NCURSES - print_cached( 0 ); -#endif - - if ( wrap::CONF->get_elem( "httpd.modules.preloadcommands" ).compare( "true" ) == 0 ) - preload_modules( wrap::CONF->get_elem("httpd.modules.commandsdir") ); - - if ( wrap::CONF->get_elem( "httpd.modules.preloadhtml" ).compare( "true" ) == 0 ) - preload_modules( wrap::CONF->get_elem("httpd.modules.htmldir") ); + map_mods = new hmap<dynmod*,string>(80); + pthread_mutex_init( &mut_map_mods, NULL ); } modl::~modl() { + pthread_mutex_lock ( &mut_map_mods ); + // dlclose all the_module's first! - run_func( &modl::dlclose_ ); + map_mods->run_func ( &modl::dlclose_ ); // then clean the hash map. - unload_modules(); -} + map_mods->make_empty ( ); -void -modl::preload_modules( string s_path ) -{ - dir* p_dir = new dir(); - p_dir->open_dir( s_path ); - - p_dir->read_dir(); - - vector<string> dir_vec = p_dir->get_dir_vec(); - - if ( ! dir_vec.empty() ) - { - vector<string>::iterator iter = dir_vec.begin(); - - do - { - if ( iter->length() >= 3 && iter->compare( iter->length()-3, 3, ".so" ) == 0 ) - cache_module( s_path + *iter, false ); - } - while ( ++iter != dir_vec.end() ); - } - - dir_vec.clear(); - - // This also closes the dir. - delete p_dir; + pthread_mutex_unlock ( &mut_map_mods ); + pthread_mutex_destroy( &mut_map_mods ); } void modl::dlclose_( dynmod* mod ) { dlclose( mod->the_module ); - free ( mod ); } dynmod* -modl::cache_module( string s_name, bool b_print_sys_msg ) +modl::cache_module( string s_name ) { void *the_module = NULL; function *the_func = NULL; - the_module = dlopen( s_name.c_str(), RTLD_LAZY ); - //the_module = dlopen( s_name.c_str(), RTLD_NOW ); + the_module = dlopen( s_name.c_str(), RTLD_NOW ); if ( the_module == NULL ) { - wrap::system_message( dlerror() ); + pthread_mutex_lock ( &s_mutx::get + ().mut_stdout ); + cerr << "dlerror: " << dlerror() << endl; + pthread_mutex_unlock( &s_mutx::get + ().mut_stdout ); return NULL; } @@ -87,85 +61,44 @@ modl::cache_module( string s_name, bool b_print_sys_msg ) if ( the_func == NULL ) { - wrap::system_message( dlerror() ); + pthread_mutex_lock ( &s_mutx::get + ().mut_stdout ); + cerr << "dlerror: " << dlerror() << endl; + pthread_mutex_unlock( &s_mutx::get + ().mut_stdout ); return NULL; } - if ( b_print_sys_msg ) - wrap::system_message( MODULEC + s_name.substr( s_name.find_last_of("/")+1 ) ); +#ifdef VERBOSE + pthread_mutex_lock ( &s_mutx::get + ().mut_stdout ); + cout << MODULEC << s_name << endl; + pthread_mutex_unlock( &s_mutx::get + ().mut_stdout ); +#endif dynmod *mod = new dynmod; // encapsulates the function and module handler. mod->the_func = the_func ; // the function to execute mod->the_module = the_module; // the module handler to close if function - // is not needed anymore. - add_elem( mod, s_name ); + pthread_mutex_lock ( &mut_map_mods ); + map_mods->add_elem ( mod, s_name ); + pthread_mutex_unlock( &mut_map_mods ); // DO NOT CLOSE AS LONG THERE EXIST A POINTER TO THE FUNCTION - // dlclose( module ); will be called in modl::~modl()! - -#ifdef NCURSES - - print_cached( size() ); -#endif + // dlclose( module ); return mod; } dynmod* -modl::get_module( string s_name, string s_user ) -{ - wrap::system_message( MODULER + s_name.substr( s_name.find_last_of("/")+1 ) + " (" + s_user + ")"); - dynmod* mod = get_elem( s_name ); - return ! mod ? cache_module( s_name, true ) : mod; -} - -dynmod* modl::get_module( string s_name ) { - wrap::system_message( MODULER + s_name.substr( s_name.find_last_of("/")+1 ) ); - dynmod* mod = get_elem( s_name ); - return ! mod ? cache_module( s_name, true ) : mod; -} - -void -modl::unload_modules() -{ - wrap::system_message( MODUNLO ); - - // dlclose all the_module's first! - run_func( &modl::dlclose_ ); - - // then clean the hash map. - shashmap<dynmod*>::clear(); - -#ifdef NCURSES - - print_cached( size() ); -#endif + pthread_mutex_lock ( &mut_map_mods ); + dynmod* mod = map_mods->get_elem( s_name ); + pthread_mutex_unlock( &mut_map_mods ); + return ! mod ? cache_module( s_name ) : mod; } -void -modl::reload_modules() -{ - unload_modules(); - - wrap::system_message( MODRELO ); - preload_modules( wrap::CONF->get_elem("httpd.modules.commandsdir") ); - preload_modules( wrap::CONF->get_elem("httpd.modules.htmldir") ); -} - -#ifdef NCURSES -void -modl::print_cached( int i_mods ) -{ - if ( !wrap::NCUR->is_ready() ) - return; - - mvprintw( NCUR_CACHED_MODS_X, NCUR_CACHED_MODS_Y, "Mods: %d ", i_mods); - refresh(); -} -#endif - #endif @@ -1,39 +1,29 @@ -#include "incl.h" +// class modl declaration. #ifndef MODL_H #define MODL_H -#include "maps/shashmap.h" +#include "incl.h" +#include "hmap.h" using namespace std; -class modl : public shashmap<dynmod*> + +class modl { private: - static void dlclose_( dynmod* mod ); - dynmod* cache_module ( string s_name, bool b_print_sys_msg ); - void preload_modules( string s_path ); + hmap<dynmod*,string>* map_mods; + pthread_mutex_t mut_map_mods; -#ifdef NCURSES - - void print_cached( int i_mods ); -#endif + static void dlclose_( dynmod* mod ); + dynmod* cache_module ( string s_name ); public: modl(); ~modl(); - dynmod* get_module( string s_name ); - dynmod* get_module( string s_name, string s_user ); - - vector<string>* get_mod_vector() - { - vector<string>* p_ret = get_key_vector(); - return p_ret; - } + dynmod* get_module ( string s_name ); - void unload_modules(); - void reload_modules(); }; #endif @@ -1,144 +1,39 @@ #ifndef MSGS_H #define MSGS_H -// alphabetical ordered: -#define ACCPERR "Sock: Accept error " -#define BINDERR "Sock: Bind error " -#define CHATREP "Chat: Using replacement strings" -#define CHATDOP "Chat: Default operator login " -#define CFILEOK "Parsing config file" -#define CFILEFA "Failed opening config file!" -#define CONTACT "Contact: http://www.yChat.org, Mail@yChat.org, ICQ: 11655527" -#define CLRHTML "HTML: Cleared the document cache " -#define CLIWELC "Command Line Interface (type help for a list of all commands)" -#define CLIPRMO ">> " -#define CLIPRMI "<< " -#define CLIHELP "Unknown command (use help)" -#define CLIMSQL "Spawing system mysql client (enter exit to return)" -#define CLISHEL "Spawing system shell (enter exit to return)" -#define DATAADD "Data: Adding used connection into the queue" -#define DATADIS "Data: Closing all connections" -#define DATADI2 "Data: Closing idle connection (" -#define DATAQUE "Data: " -#define DATAGET "Data: Using database connection queue " -#define DATAIN0 "Data: Initializing maxcon to " -#define DATAIN1 "Data: Initializing mincon to " -#define DATAMAX "Data: Max database connections reached " -#define DATAMA0 "Data: Max database connections " -#define DATANEW "Data: Creating new database connection " -#define DESCRIP "Copyright (C) 2003 Paul C. Buetow, Volker Richter" -#define DESCRI2 "Copyright (C) 2004, 2005 Paul C. Buetow" -#define DONEMSG "done" -#define DOWNMSG "Shutting down " -#define GARBAGE "Garbage: Initializing collector " -#define GARBACT "Garbage collector activated " -#define GAROFFNE "Garbage: No garbage to remove available " -#define GARROOM "Garbage: Added room " -#define GARUSER "Garbage: Added user " -#define GARUSE2 "Garbage: Recycle user " -#define LISTERR "Sock: Listen error " -#define 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 " - -#ifdef DATABASE -#define MYSQLQU "MySQL: " -#define MYSQLQ2 "MySQL: Adding query " -#define MYSQLE1 "MySQL: Error running mysql_init " -#endif -#ifdef CTCSEGV -#define SIGNSEG "Signal: Received SIGSEGV" -#endif +// 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>" -#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" +// all the custom messages for verbosity outputs. this messages may not +// be used for html-template value substituation except the CONTACT and +// DESCRIP variables. the verbosity output will appear in the standard +// output of the server. +// alphabetical ordered. +#define CFILEOK "Parsing config file " +#define CFILENO "Failed opening config file " +#define CONNECT "Receiving connection " +#define CONTACT "Contact: www.yChat.org, Mail@yChat.org " +#define DESCRIP "yChat; Copyright (C) 2003 Paul C. Buetow, Volker Richer\n(C) 2005 Paul C. Buetow" +#define DOWNMSG "Shutting down " +#define LOGINPR "Login procedure succeeded for nick " +#define MODULEC "Caching module " +#define NEWROOM "Adding room " #define POOLER1 "Pool: Did not allocate all threads (" #define POOLER2 "Pool: Max pool size reached (" #define POOLFLL "Pool: Allocating new threads (" -#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 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 SOCKER1 "Sock: Can't create socket, aborting" -#define SOCKER2 "Sock: Unknown hostname " -#define SOCKRDY "Sock: Server socket is ready " -#define SOCKCAC "Sock: Caching IP " -#define SOCKCA2 "Sock: Cleaning IP cache (" -#define SOCKUNS "Sock: Starting unsecure transport [HTTP]" -#ifdef OPENSSL -#define SSLERR1 "SSL: Can't create socket" -#define SSLERR2 "SSL: Private key does not match cert. file" -#define SSLERR3 "SSL: Can't create new SSL context" -#define SSLERR4 "SSL: Can't create new SSL socket via accept" -#define SOCKSEC "SSL: Starting secure transport [HTTPS]" -#endif -#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.8.0" -#define BRANCH "RELEASE" -#define BUILDNR 3913 -#define UNAME "FreeBSD 5.4-RELEASE i386" -#define COMPOPT "Using built-in specs.; Configured with: FreeBSD/i386 system compiler; Thread model: posix; gcc version 3.4.2 [FreeBSD] 20040728; 3.4; g++" -#define YCUSAGE "Usage: ./ychat {h|v}|{o confkey confvalue}\n" - -#define HEADER1 "HTTP/1.1 200 OK\r\n" -#define HEADER2 "Server: yChat/" VERSION "-" BRANCH "\r\n" -#define HEADER3 "Cache-Control: no-cache\r\n" -#define HEADER4 "Pragma: no-cache\r\n" -#define HEADER5 "Transfer-Encoding: chunked\r\n" -#define HEADER6 "Connection: keep-alive\r\n" -#define HEADER7 "Content-Length: "; -#define HEADER8 "Content-Type: "; -#define HEADER8b "; charset=ISO-8859-1\r\n"; -#define HEADER9 "Allow: GET\r\n"; -//#define MEMBERE "Memb: No such member " +#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" #endif diff --git a/src/name.cpp b/src/name.cpp index 79167f5..a573edf 100755 --- a/src/name.cpp +++ b/src/name.cpp @@ -1,49 +1,31 @@ -#ifndef NAME_CPP -#define NAME_CPP +// class name implementation. + +#ifndef NAME_CXX +#define NAME_CXX #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() +name::get_name() const { - 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() ); + return s_name; } void name::set_name( string s_name ) { - pthread_mutex_lock ( &mut_s_name ); this->s_name = s_name; - pthread_mutex_unlock( &mut_s_name ); } + #endif @@ -1,24 +1,30 @@ -#include "incl.h" +// class name declaration. #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 ( ); - virtual string get_lowercase_name ( ); + virtual string get_name ( ) const; virtual void set_name ( string s_name ); - name(); - name( string s_name ); // a standard constructor. - ~name(); + + // public methods: + explicit name( ) + { } + ; // a standard constructor. + explicit name( string s_name ); // a standard constructor. + ~name( ); + }; #endif diff --git a/src/reqp.cpp b/src/reqp.cpp index 9b5da0b..37f0ea2 100755 --- a/src/reqp.cpp +++ b/src/reqp.cpp @@ -1,119 +1,119 @@ -#ifndef REQP_CPP -#define REQP_CPP +// class reqp implementation. -#include "reqp.h" -#include "tool/tool.h" +#ifndef REQP_CXX +#define REQP_CXX +#include "reqp.h" +#include "s_chat.h" +#include "s_html.h" +#include "s_mutx.h" +#include "s_sock.h" +#include "s_tool.h" using namespace std; -#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; +// 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: "; reqp::reqp( ) {} -void -reqp::get_request_parameters( string s_parameters, map<string,string>& map_params ) +string +reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params ) { - string s_tmp; - unsigned i_pos, i_pos2; + auto unsigned int pos; + string s_ret ( "" ); + string s_vars( "" ); + auto int i_request; - while( (i_pos = s_parameters.find("&")) != string::npos ) + 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 { - s_tmp = s_parameters.substr(0, i_pos ); + pos = s_ret.find( "../", 0 ); - 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", "&"); + if ( pos == string::npos ) + break; - s_parameters = s_parameters.substr( i_pos + 1 ); + s_ret.replace( pos, pos+2, "" ); } + while( true ); + + // do not add the string behind "?" tp s_ret and add all params behind "?" to map_params. + if( i_request == RQ_GET ) + pos = s_ret.find( "?", 0 ); + else + pos = s_req.find("\r\n\r\n", 0); - // 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 ); + 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 ) ); - //map<string,string>::iterator iter; - //for ( iter = map_params.begin(); iter != map_params.end(); ++iter ) - //cout << ">>>" << iter->first << "=" << iter->second << endl; -} + else + s_params = s_req.substr( pos+4, s_req.length() -pos-1 ); -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; + s_ret = s_ret.substr( 0, pos ); + } - // GET request - if ( s_req.find("GET") != string::npos) + if ( i_request == RQ_POST && s_params.empty() ) { - // 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; + char c_req[READBUF]; - s_req = s_req.substr(5, i_pos - 5); - - // 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 ); - } - } + if ( read ( p_thrd->get_sock() , c_req, READBUF ) <= 0 ) + return "NOBYTE"; - } + s_params = string( strstr( c_req, "event" ) ); } - // POST request - else + auto unsigned int pos2; + do { - if ( (i_pos2 = s_req.find("HTTP")) != string::npos ) + pos = s_params.find( "=", 0 ); + if ( pos == string::npos ) + break; + + pos2 = s_params.find( "&", 0 ); + if ( pos2 == string::npos ) { - 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 sValue( s_params.substr(pos+1, s_params.length()-pos-1) ); + auto string tmpstr( url_decode(sValue) ); + map_params[ s_params.substr( 0, pos ) ] = tmpstr; + break; } + auto string s_temp= s_params.substr( pos+1, pos2-pos-1 ); + map_params[ s_params.substr( 0, pos ) ] = url_decode(s_temp); + + s_params = s_params.substr( pos2+1, s_params.length()-pos2-1 ); } + while( true ); #ifdef VERBOSE - wrap::system_message( REQUEST + s_ret ); + + pthread_mutex_lock ( &s_mutx::get + ().mut_stdout ); + cout << REQUEST << s_ret << endl; + pthread_mutex_unlock( &s_mutx::get + ().mut_stdout ); #endif if ( s_ret.empty() ) - s_ret = wrap::CONF->get_elem( "httpd.startsite" ); - - else - s_ret = remove_dots(s_ret); + s_ret = s_conf::get + ().get_val( "STARTMPL" ); map_params["request"] = s_ret; @@ -121,256 +121,188 @@ reqp::get_url( string s_req, map<string, string> &map_params, int& i_postpayload } string -reqp::get_content_type(string &s_file) +reqp::get_content_type( string s_file ) { - string s_ext(tool::get_extension( s_file )); + string s_ext=s_tool::getExtension( s_file ); - if( s_ext == "" ) - s_ext = "default"; + if(s_ext=="") + s_ext="DEFAULT"; - return wrap::CONF->get_elem( "httpd.contenttypes." + s_ext ); + return s_conf::get + ().get_val( "CT_"+s_ext ); } - void -reqp::parse_headers( string s_req, map<string,string> &map_params ) +reqp::parse_headers( string s_req, map_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)); - if (pos != string::npos) + while(pos!=string::npos) { - map_params["QUERY_STRING"] = tool::trim(s_req.substr(0,pos-1)); - - int pos2; - do + auto string s_line=s_req.substr(0,pos); + auto int pos2=s_line.find(":"); + if(pos2!=string::npos) { - string s_line( s_req.substr(0, pos) ); - pos2 = s_line.find(":"); + auto string key=s_tool::trim(s_line.substr(0, pos2)); + auto string value=s_tool::trim(s_line.substr(pos2+1)); + + map_params[key]=value; - 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"); } - while( pos != string::npos); - } // if + s_req=s_req.substr(s_line.size()+1); + pos=s_req.find("\n"); + } + } + int -reqp::htoi(string *p_str) +reqp::htoi(string *s) { - int value, c; - c = p_str->at(0); + int value; + int c; - if( isupper(c) ) - c = tolower(c); + c=s->c_str()[0]; + 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 = p_str->at(1); - - if( isupper(c) ) - c = tolower(c); - - value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10; + c=s->c_str()[1]; + if(isupper(c)) + c=tolower(c); + value+=c>='0' && c<='9'?c-'0':c-'a'+10; return value; } string -reqp::url_decode( string s_url ) +reqp::url_decode( string s_str ) { - string s_dest = ""; - int i_len = s_url.size(); - int i_prv = i_len - 2; + auto string sDest=""; + int len = s_str.size(); - char c; - for( int i = 0; i < i_len; ++i) + for(int i=0;i<len;i++) { - c = s_url.at(i); - if( c == '+' ) + char ch = s_str.at(i); + if(ch=='+') { - s_dest += " "; + sDest+=" "; } - else if (c == '%' && i < i_prv) + else if(ch=='%') { - string s_tmp = s_url.substr(i+1, 2); - c = (char) htoi(&s_tmp); - s_dest += c; - i += 2; + auto string sTmp=s_str.substr(i+1,2); + ch=(char)htoi(&sTmp); + sDest+=ch; + i+=2; + } else - { - s_dest += c; - } - } - return s_dest; + sDest+=ch; + } + return sDest; } string reqp::get_from_header( string s_req, string s_hdr ) { - 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 unsigned int pos[2]; + pos[0] = s_req.find( s_hdr, 0 ); + pos[1] = s_req.find( "\n", pos[0] ); - unsigned i_len = s_hdr.length(); - return s_req.substr( i_pos[0] + i_len, i_pos[1] - i_pos[0] - i_len - 1 ); + auto int i_length = s_hdr.length(); + return s_req.substr( pos[0]+i_length, pos[1]-pos[0]-i_length-1 ); } string -reqp::parse( socketcontainer *p_sock, string s_req, map<string,string> &map_params, int &i_postpayloadoffset ) +reqp::parse( thrd* p_thrd, string s_req, map_string &map_params ) { // store all request informations in map_params. store the url in // map_params["request"]. - get_url( s_req, map_params, i_postpayloadoffset ); - - parse_headers( s_req, map_params ); - string s_event( map_params["event"] ); - map_params["content-type"] = get_content_type( map_params["request"] ); + if ( get_url( p_thrd, s_req, map_params ).compare("NOBYTE") == 0 ) + map_params["request"] = s_conf::get + ().get_val("NOTFOUND"); - string s_rep( "" ); + 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"); - //<<* // check the event variable. + + string s_event( map_params["event"] ); if ( ! s_event.empty() ) { // login procedure. if ( s_event == "login" ) { - wrap::CHAT->login( map_params ); - } - else if ( s_event == "register" ) - { - user* p_user = new user; - map_params["INFO"] = ""; - run_html_mod( s_event, map_params, p_user ); - wrap::GCOL->add_user_to_garbage( p_user ); + s_chat::get + ().login( map_params ); } + else { - sess *p_sess = wrap::SMAN->get_session( map_params["tmpid"] ); - user *p_user = NULL; + bool b_found; - if( p_sess != NULL ) + // user* p_user = s_chat::get().get_user( map_params["nick"], b_found ); + sess *sess_temp=s_sman::get + ().getSession( map_params["tmpid"] ); + user *p_user; + if(sess_temp!=NULL) { - p_user = p_sess->get_user(); + string *s_nick=static_cast<string*>(sess_temp->getValue(string("nick"))); + p_user = s_chat::get + ().get_user( *s_nick, b_found); } else - { - wrap::system_message(SESSERR); return s_rep; - } - - if ( ! p_user ) + if ( ! b_found ) { - map_params["INFO"] = wrap::CONF->get_elem( "chat.msgs.err.notonline" ); - map_params["request"] = wrap::CONF->get_elem( "httpd.startsite" ); // redirect to the startpage. + map_params["INFO"] = E_NOTONL; + map_params["request"] = s_conf::get + ().get_val( "STARTMPL" ); // redirect to the startpage. } - else + // if a message post. + else if ( s_event == "post" ) + s_chat::get + ().post( p_user, map_params ); + + + // if a chat stream + else if ( s_event == "stream" ) { - map_params["nick"] = p_user->get_name().c_str(); - - // if a message input. - if ( s_event == "input" ) - { - if ( p_user ) - { - p_user->check_restore_away(); - wrap::CHAT->post( p_user, map_params ); - } - } - - // if a chat stream - else if ( s_event == "stream" ) - { - string s_msg ( wrap::HTML->parse( map_params ) ); - p_user->msg_post( &s_msg); - wrap::SOCK->chat_stream( p_sock, p_user, map_params ); - } - - // if a request for the online list of the active room. - else if ( s_event == "online" ) - { - wrap::HTML->online_list( p_user, map_params ); - } - else //if ( s_event != "input" ) - { - run_html_mod( s_event, map_params, p_user ); - } + 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 ); } - } - } - //*>> - 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 ) ); + // 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 ); + } } - // create the http header. - - string s_resp(s_http); - if ( s_event.compare("stream") == 0 ) - s_resp.append( s_http_stream ); - - 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_resp; -} - -//<<* -void -reqp::run_html_mod( string s_event, map<string,string> &map_params, user* p_user ) -{ - container *c = new container; - - c->elem[0] = (void*) wrap::WRAP; - c->elem[1] = (void*) &map_params; - c->elem[2] = (void*) p_user; - - string s_mod = wrap::CONF->get_elem("httpd.modules.htmldir") + "yc_" + s_event + ".so"; - - dynmod* p_module = wrap::MODL->get_module( s_mod, p_user->get_name() ); - - if ( p_module != NULL ) - ( *( p_module->the_func ) ) ( static_cast<void*>(c) ); - - delete c; -} -//*>> - -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; + return s_rep; } #endif @@ -1,42 +1,47 @@ -#include "incl.h" +// class reqp declaration. this class parses the client requests. + #ifndef REQP_H #define REQP_H -#include "maps/hashmap.h" +#define RQ_GET 1 +#define RQ_POST 2 + +#include <map> +#include "incl.h" +#include "thrd.h" using namespace std; +typedef map<string, string, less<string> > map_string; + class reqp { private: - 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; + static string HTTP_CODEOK, + HTTP_CODENF, + HTTP_SERVER, + HTTP_CONTAC, + HTTP_CACHEC, + HTTP_CONNEC, + HTTP_COTYPE; // returns the request url from thr client's http request header // until the first "?" and stores all request parameter values // ( behind "?" ) into map_params. - string get_url( string s_req, map<string,string> &map_params, int& i_postpayloadoffset ); + virtual string get_url( thrd* p_thrd, string s_req, map_string &map_params ); // returns a specific value of the client's http request header. // ( s.t. like the User-Agent, Referer etc... ). - string get_from_header( string s_req, string s_hdr ); - - int htoi( string *p_str ); - void run_html_mod( string s_event, map<string,string> &map_params, user* p_user ); //<< - // Removes double dots ".." - string remove_dots( string s_req ); + virtual string get_from_header( string s_req, string s_hdr ); - // 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 ); + virtual int htoi( string *s ); public: - 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 ); + // 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 ); }; #endif diff --git a/src/s_modl.cpp b/src/s_modl.cpp new file mode 100644 index 0000000..f6a5913 --- /dev/null +++ b/src/s_modl.cpp @@ -0,0 +1,10 @@ +#ifndef GMOD_CXX +#define GMOD_CXX + +#include "s_modl.h" + +using namespace std; + +modl* s_modl::obj; + +#endif diff --git a/src/s_modl.h b/src/s_modl.h new file mode 100644 index 0000000..cce3f9a --- /dev/null +++ b/src/s_modl.h @@ -0,0 +1,27 @@ +#ifndef GMOD_H +#define GMOD_H + +#include "modl.h" + +using namespace std; + +class s_modl +{ +private: + static modl* obj; + +public: + static void init() + { + obj = new modl(); + } + + static modl& get + () + { + return *obj; + } +}; + + +#endif diff --git a/src/s_tool.cpp b/src/s_tool.cpp index dba93dc..79c3924 100644 --- a/src/s_tool.cpp +++ b/src/s_tool.cpp @@ -116,24 +116,7 @@ s_tool::strip_html( string *s_str ) return; } -} -string -s_tool::replace( string s_string, string s_search, string s_replace ) -{ - unsigned i_pos[2]; - for ( i_pos[0] = s_string.find( s_search ); - i_pos[0] != string::npos; - i_pos[0] = s_string.find( s_search, i_pos[1] ) ) - { - s_string.replace( i_pos[0], s_search.length(), s_replace ); - i_pos[1] = i_pos[0] + s_replace.length(); - } - - return s_string; } - - - #endif diff --git a/src/s_tool.h b/src/s_tool.h index ed76346..e08fb32 100644 --- a/src/s_tool.h +++ b/src/s_tool.h @@ -15,7 +15,6 @@ public: static long unixtime(); static void strip_html( string *s_str); static string getExtension( string s_file ); - static string replace( string s_string, string s_search, string s_replace ); }; #endif diff --git a/src/sman.cpp b/src/sman.cpp index 96c638f..dd2138f 100644 --- a/src/sman.cpp +++ b/src/sman.cpp @@ -12,7 +12,6 @@ sman::~sman() { delete this->sessions; } - string sman::generateId( int len ) { string valid_chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"; @@ -30,18 +29,11 @@ sess *sman::createSession( ) string new_id=this->generateId(s_tool::string2int( s_conf::get ().get_val( "SESSION_LENGTH" ) ) ); - sess* p_sess = getSession(new_id); - - // Prove if session id already exists. - if (p_sess) - return createSession(); - sess *new_sess= new sess( new_id ); this->sessioncount++; this->sessions->add_elem( new_sess, new_id ); - return new_sess; } diff --git a/src/sock.cpp b/src/sock.cpp index 490278f..4645db8 100755 --- a/src/sock.cpp +++ b/src/sock.cpp @@ -24,6 +24,8 @@ sock::sock() this->i_req = 0; this->req_parser = new reqp(); this->thrd_pool = new pool(); + this->log_daemon = new logd(s_conf::get + ().get_val( "ACCESS_LOG" )); } void @@ -82,7 +84,7 @@ sock::make_socket( uint16_t i_port ) { cerr << "Sock: socket error" << endl; - if ( ((int)++i_port) > MAXPORT ) + if ( ++i_port > MAXPORT ) exit(-1); cerr << SOCKERR << i_port << endl; @@ -142,6 +144,9 @@ sock::read_write( thrd* p_thrd, int i_sock ) string s_rep = req_parser->parse( p_thrd, string( c_req ), map_params ); + // send s_rep to the client. + log_daemon->log(map_params); + send( i_sock, s_rep.c_str(), s_rep.size(), 0 ); // dont need those vals anymore. @@ -19,6 +19,7 @@ #include "reqp.h" #include "thrd.h" #include "user.h" +#include "logd.h" using namespace std; class sock @@ -30,6 +31,7 @@ private: bool b_run; // true while socket manager is running. reqp* req_parser; // parses the http requests from clients. pool* thrd_pool; // the thread pool. + logd* log_daemon; // the log daemon // creates a server socket. virtual int make_socket( uint16_t port ); diff --git a/src/user.cpp b/src/user.cpp index 7fd5858..1250254 100755 --- a/src/user.cpp +++ b/src/user.cpp @@ -5,6 +5,7 @@ #include "user.h" #include "s_conf.h" +#include "s_modl.h" #include "s_tool.h" using namespace std; @@ -113,6 +114,34 @@ user::set_sock( int i_sock ) } void +user::command( string &s_command ) +{ + + auto unsigned int pos = s_command.find( "/" ); + while( pos != string::npos ) + { + s_command.replace( pos, 1, "" ); + pos = s_command.find( "/" ); + } + + string s_mod( "cmnd/yc_" ); + s_mod.append( s_command ).append( ".so" ); + + dynmod *mod = s_modl::get + ().get_module( s_mod ); + + if ( mod == NULL ) + { + msg_post( new string( s_lang::get + ().get_val( "ERRORCMD" ) ) ); + return; + } + + // execute the module. + ( *(mod->the_func) ) ( (void*) this ); +} + +void user::renew_stamp( ) { pthread_mutex_lock ( &mut_l_time ); @@ -86,6 +86,9 @@ public: virtual int get_sock ( ); virtual void set_sock ( int i_sock ); + // executes a command. + virtual void command( string &s_command ); + // gets the message and clears s_mess; virtual string get_mess(); |
