Regular commit
[backups/.git] / main.cpp
index 945cc0d0b36c91de96147dddb469355a87e89d75..b630ec8e78f42649351b3c66f2d3cdaa198c6fb3 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -10,7 +10,7 @@
 using namespace std;
 
 static const unsigned int bytes_in_block = 0x800;
-static const char * dbname = "/var/tmp/backups.db";
+static const char * dbname = "/var/lib/backups/backups.db";
 
 unsigned long long current_time() {
   unsigned long long rc = 0;
@@ -109,6 +109,17 @@ void sizes( ITER begin, const ITER &end, INT &numblocks, INT &numbytes ) {
   }
 }
 
+template<class I, class O>
+void copy_filenames( I begin, const I &end, O out ) {
+  while( begin != end ) {
+    string output = (*begin)->getFileName();
+    output.push_back( 0 );
+    *out = output;
+    ++out;
+    ++begin;
+  }
+}
+
 int main() {
   // Parse the list of current files on stdin
   file_set current;
@@ -201,7 +212,7 @@ int main() {
   copy( current.begin(), current.end(), ostream_iterator<FileData*>( dbout, "" ) );
 
   // Write the 'final' list to stdout
-  copy( final.begin(), final.end(), ostream_iterator<FileData*>( cout, "" ) );
+  copy_filenames( final.begin(), final.end(), ostream_iterator<string>( cout, "" ) );
 
   cerr << "Need backing up..." << endl;
   cerr << "    Added Bytes:            " << added_bytes << endl;