ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/Search/trunk/Search.cpp
(Generate patch)

Comparing trunk/Search/Search.cpp (file contents):
Revision 12 by douglas, 2002-12-06T12:03:05-08:00 vs.
Revision 345 by Douglas Thrift, 2004-05-11T22:31:44-07:00

# Line 1 | Line 1
1   /* ============================================================================
2   * Douglas Thrift's Search Engine License
3   *
4 < * Copyright (C) 2002, 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   *
# Line 46 | Line 46
46   //
47   // Douglas Thrift
48   //
49 < // Search.cpp
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 // _WIN32
60 >
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 >
69 > #endif
70  
71   string program;
72   string programName = "Douglas Thrift's Search Engine";
73 < string programVersion = "1.1alpha";
73 > string programVersion = "1.3svn";
74   bool debug = false;
75  
76   int main(int argc, char* argv[])
# Line 84 | Line 93 | int main(int argc, char* argv[])
93          string notfound = "notfound.html";
94          string pages = "pages.html";
95  
96 +        string email;
97 +
98          for (int index = 1; index < argc; index++)
99          {
100                  string arg(argv[index]);
# Line 107 | Line 118 | 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                          {
127                                  cerr << program << ": Bad arguments\n";
128 +                                usage();
129                                  return 1;
130                          }
131                  }
# Line 126 | Line 140 | int main(int argc, char* argv[])
140                          else
141                          {
142                                  cerr << program << ": Bad arguments\n";
143 +                                usage();
144                                  return 1;
145                          }
146                  }
# Line 138 | Line 153 | int main(int argc, char* argv[])
153                          else
154                          {
155                                  cerr << program << ": Bad arguments\n";
156 +                                usage();
157                                  return 1;
158                          }
159                  }
# Line 150 | Line 166 | int main(int argc, char* argv[])
166                          else
167                          {
168                                  cerr << program << ": Bad arguments\n";
169 +                                usage();
170                                  return 1;
171                          }
172                  }
# Line 162 | Line 179 | int main(int argc, char* argv[])
179                          else
180                          {
181                                  cerr << program << ": Bad arguments\n";
182 +                                usage();
183                                  return 1;
184                          }
185                  }
# Line 174 | Line 192 | int main(int argc, char* argv[])
192                          else
193                          {
194                                  cerr << program << ": Bad arguments\n";
195 +                                usage();
196                                  return 1;
197                          }
198                  }
# Line 186 | Line 205 | int main(int argc, char* argv[])
205                          else
206                          {
207                                  cerr << program << ": Bad arguments\n";
208 +                                usage();
209                                  return 1;
210                          }
211                  }
# Line 198 | Line 218 | int main(int argc, char* argv[])
218                          else
219                          {
220                                  cerr << program << ": Bad arguments\n";
221 +                                usage();
222                                  return 1;
223                          }
224                  }
# Line 210 | Line 231 | int main(int argc, char* argv[])
231                          else
232                          {
233                                  cerr << program << ": Bad arguments\n";
234 +                                usage();
235                                  return 1;
236                          }
237                  }
238                  else if (arg == "-D")
239                  {
240                          debug = true;
241 +                        cerr.setf(ios_base::boolalpha);
242                  }
243                  else
244                  {
# Line 235 | Line 258 | int main(int argc, char* argv[])
258                  {
259                          cerr << program << ": Too many indices, can only build one index"
260                                  << " at a time\n";
261 +                        usage();
262                          return 1;
263                  }
264  
265                  if (indexDomains.size() < 1)
266                  {
267                          cerr << program << ": Must specify at least one domain\n";
268 +                        usage();
269                          return 1;
270                  }
271  
# Line 373 | Line 398 | string platform()
398  
399   void usage()
400   {
401 + #ifdef _WIN32
402 +        OSVERSIONINFO* computer = new OSVERSIONINFO;
403 +        computer->dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
404 +        GetVersionEx(computer);
405 +
406 +        string program = ::program;
407 +        if (computer->dwPlatformId != VER_PLATFORM_WIN32_NT)
408 +        {
409 +                program = "Search";
410 +        }
411 +
412 +        delete computer;
413 + #endif // _WIN32
414 +
415          string tab(8 + program.length(), ' ');
416  
417          cout << "Usage: " << program << " [index ...] [-P page] [-h header] [-b bo"
# Line 406 | Line 445 | void usage()
445   void version()
446   {
447          cout << programName << " " << programVersion << " "<< platform() << "\n\n"
448 <                << "   Copyright (C) 2002, Douglas Thrift. All Rights Reserved.\n\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() << " " << SSLeay_version(SSLEAY_BUILT_ON) << " "
454 +                << SSLeay_version(SSLEAY_PLATFORM) << "\n";
455 + #endif
456   }
457  
458   void license()
459   {
460          cout << "License:\n"
461                  << "   Douglas Thrift's Search Engine License\n\n"
462 <                << "   Copyright (C) 2002, Douglas Thrift. All Rights Reserved.\n\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"
466                  << "   modification, are permitted provided that the following conditi"

Comparing trunk/Search/Search.cpp (property svn:eol-style):
Revision 12 by douglas, 2002-12-06T12:03:05-08:00 vs.
Revision 345 by Douglas Thrift, 2004-05-11T22:31:44-07:00

# Line 0 | Line 1
1 + native

Comparing trunk/Search/Search.cpp (property svn:keywords):
Revision 12 by douglas, 2002-12-06T12:03:05-08:00 vs.
Revision 345 by Douglas Thrift, 2004-05-11T22:31:44-07:00

# Line 0 | Line 1
1 + Id

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines