1 |
|
/* ============================================================================ |
2 |
|
* Douglas Thrift's Search Engine License |
3 |
|
* |
4 |
< |
* Copyright (C) 2002-2003, Douglas Thrift. All Rights Reserved. |
4 |
> |
* Copyright (C) 2002-2004, Douglas Thrift. All Rights Reserved. |
5 |
|
* Redistribution and use in source and binary forms, with or without |
6 |
|
* modification, are permitted provided that the following conditions are met: |
7 |
|
* |
46 |
|
// |
47 |
|
// Douglas Thrift |
48 |
|
// |
49 |
< |
// $Id: Search.cpp,v 1.18 2003/07/15 07:41:43 douglas Exp $ |
49 |
> |
// $Id$ |
50 |
|
|
51 |
< |
#include "Search.h" |
52 |
< |
#include "Indexer.h" |
53 |
< |
#include "Searcher.h" |
54 |
< |
#include "Outputer.h" |
51 |
> |
#include "Search.hpp" |
52 |
> |
#include "Indexer.hpp" |
53 |
> |
#include "Searcher.hpp" |
54 |
> |
#include "Outputer.hpp" |
55 |
|
|
56 |
|
#ifndef _WIN32 |
57 |
|
#include <sys/utsname.h> |
58 |
|
#else |
59 |
|
#include <windows.h> |
60 |
– |
#endif |
61 |
– |
|
62 |
– |
#ifdef _OpenSSL_ |
63 |
– |
#include <openssl/crypto.h> |
64 |
– |
|
65 |
– |
inline string openssl(bool agent = false) |
66 |
– |
{ |
67 |
– |
ostringstream openssl; |
68 |
– |
|
69 |
– |
openssl << "OpenSSL" << (agent ? "/" : " "); |
70 |
– |
|
71 |
– |
long version = SSLeay(); |
72 |
– |
long major = version / 0x10000000; |
73 |
– |
long minor = (version % 0x10000000) / 0x100000; |
74 |
– |
long fix = (version % 0x100000) / 0x1000; |
75 |
– |
long patch = (version % 0x1000); |
76 |
– |
|
77 |
– |
openssl << major << "." << minor << "." << fix; |
78 |
– |
|
79 |
– |
if (patch == 0x0) |
80 |
– |
{ |
81 |
– |
openssl << "-dev"; |
82 |
– |
} |
83 |
– |
else if (patch >= 0x1 && patch <= 0xe) |
84 |
– |
{ |
85 |
– |
openssl << "-beta" << patch; |
86 |
– |
} |
87 |
– |
else if (patch > 0xf) |
88 |
– |
{ |
89 |
– |
openssl << char('a' - 1 + (patch / 0x10) % 26); |
90 |
– |
} |
60 |
|
|
61 |
< |
if (!agent) |
62 |
< |
{ |
63 |
< |
openssl << " " << SSLeay_version(SSLEAY_BUILT_ON) << " " |
64 |
< |
<< SSLeay_version(SSLEAY_PLATFORM); |
65 |
< |
} |
61 |
> |
// Stupid MinGW |
62 |
> |
#ifndef PROCESSOR_ARCHITECTURE_AMD64 |
63 |
> |
#define PROCESSOR_ARCHITECTURE_AMD64 9 |
64 |
> |
#endif |
65 |
> |
#ifndef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 |
66 |
> |
#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10 |
67 |
> |
#endif |
68 |
|
|
98 |
– |
return openssl.str(); |
99 |
– |
} |
69 |
|
#endif |
70 |
|
|
71 |
|
string program; |
72 |
|
string programName = "Douglas Thrift's Search Engine"; |
73 |
< |
string programVersion = "1.2alpha"; |
73 |
> |
string programVersion = "1.3svn"; |
74 |
|
bool debug = false; |
75 |
|
|
76 |
|
int main(int argc, char* argv[]) |
118 |
|
{ |
119 |
|
if (++index < argc) |
120 |
|
{ |
121 |
< |
page = strtoul(argv[index],0,0); |
121 |
> |
istringstream number(argv[index]); |
122 |
> |
|
123 |
> |
number >> page; |
124 |
|
} |
125 |
|
else |
126 |
|
{ |
445 |
|
void version() |
446 |
|
{ |
447 |
|
cout << programName << " " << programVersion << " "<< platform() << "\n\n" |
448 |
< |
<< " Copyright (C) 2002-2003, Douglas Thrift. All Rights Reserved.\n" |
448 |
> |
<< " Copyright (C) 2002-2004, Douglas Thrift. All Rights Reserved.\n" |
449 |
|
<< "\n" |
450 |
|
<< " This product includes software developed by Douglas Thrift\n" |
451 |
|
<< " (http://computers.douglasthrift.net/searchengine/).\n"; |
452 |
|
#ifdef _OpenSSL_ |
453 |
< |
cout << "\n" << openssl() << "\n"; |
453 |
> |
cout << "\n" << openssl() << " " << SSLeay_version(SSLEAY_BUILT_ON) << " " |
454 |
> |
<< SSLeay_version(SSLEAY_PLATFORM) << "\n"; |
455 |
|
#endif |
456 |
|
} |
457 |
|
|
459 |
|
{ |
460 |
|
cout << "License:\n" |
461 |
|
<< " Douglas Thrift's Search Engine License\n\n" |
462 |
< |
<< " Copyright (C) 2002-2003, Douglas Thrift. All Rights Reserved.\n" |
462 |
> |
<< " Copyright (C) 2002-2004, Douglas Thrift. All Rights Reserved.\n" |
463 |
|
<< "\n" |
464 |
|
<< " Redistribution and use in source and binary forms, with or with" |
465 |
|
<< "out\n" |