/* ============================================================================ * Douglas Thrift's Search Engine License * * Copyright (C) 2002-2004, 2008, Douglas Thrift. All Rights Reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Douglas Thrift * (http://computers.douglasthrift.net/searchengine/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * * 4. The names "Douglas Thrift" and "Douglas Thrift's Search Engine" must not * be used to endorse or promote products derived from this software without * specific prior written permission. For written permission, please visit * http://www.douglasthrift.net/contact.cgi for contact information. * * 5. Products derived from this software may not be called "Douglas Thrift's * Search Engine", nor may "Douglas Thrift's Search Engine" appear in their * name, without prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ============================================================================ */ // Douglas Thrift's Search Engine Main // // Douglas Thrift // // $Id$ #ifndef _Search_hpp_ #define _Search_hpp_ #ifdef _DEBUG #pragma warning(disable:4786) #endif // _DEBUG #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #ifdef _WIN32 const char slash = '\\'; #else const char slash = '/'; #endif // _WIN32 extern string program, programName, programVersion; extern bool debug; string platform(); void usage(); void version(); void license(); void entities(string& line, char character, const string& entity); void entities(string& line, const string& entity, char character); void normalize(string& abbynormal); inline string tolower(const string& upper) { string lower; for (size_t index = 0; index < upper.length(); index++) { lower += tolower(upper[index]); } return lower; } inline string agent(bool version) { return programName + (version ? ('/' + programVersion) : ""); } #ifdef _OpenSSL_ #include inline string openssl(bool agent = false) { ostringstream openssl; openssl << "OpenSSL" << (agent ? "/" : " "); long version = SSLeay(); long major = version / 0x10000000; long minor = (version % 0x10000000) / 0x100000; long fix = (version % 0x100000) / 0x1000; long patch = (version % 0x1000); openssl << major << "." << minor << "." << fix; if (patch == 0x0) { openssl << "-dev"; } else if (patch >= 0x1 && patch <= 0xe) { openssl << "-beta" << patch; } else if (patch > 0xf) { openssl << char('a' - 1 + (patch / 0x10) % 26); } return openssl.str(); } #endif #endif // _Search_hpp_