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

Comparing trunk/Search/Indexer.cpp (file contents):
Revision 36 by douglas, 2003-01-16T17:27:03-08:00 vs.
Revision 37 by douglas, 2003-01-16T22:24:01-08:00

# Line 50 | Line 50
50  
51   #include "Indexer.h"
52  
53 < Indexer::Indexer(string& indexFile, set<string>& domains,
54 <        set<string>& restrictions)
53 > #ifndef _WIN32
54 > #include <unistd.h>
55 > #endif // _WIN32
56 >
57 > Indexer::Indexer(string& indexFile, set<string>& domains, set<string>&
58 >        restrictions)
59   {
60          this->indexFile = indexFile;
61          this->domains = domains;
# Line 89 | Line 93 | void Indexer::index(string& begin)
93  
94          fin.close();
95  
96 <        ofstream fout(indexFile.c_str());
96 >        string lock = indexFile + ".lock";
97 >
98 >        ofstream fout(lock.c_str());
99 >        fout.close();
100 >        fout.open(indexFile.c_str());
101  
102          fout << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"no\"?>"
103                  << "\n<!DOCTYPE index SYSTEM \"index.dtd\">\n"
# Line 102 | Line 110 | void Indexer::index(string& begin)
110          fout << "</index>\n";
111  
112          fout.close();
113 +
114 +        unlink(lock.c_str());
115   }
116  
117   void Indexer::index(URL& url, ofstream& fout, const string referer)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines