X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=scandir.cc;h=30b8d4572aa6eab67a9796018f8ba8c59310e6a4;hb=6ac0cb32a08c81ddb87cd3a1373e8e64e8757534;hp=079324a9ee0bd83c1538b39187805f8f25d44533;hpb=6f81c0103906376cf23a084f3a2b0807fbefc376;p=cumulus.git diff --git a/scandir.cc b/scandir.cc index 079324a..30b8d45 100644 --- a/scandir.cc +++ b/scandir.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -310,11 +311,15 @@ int main(int argc, char *argv[]) { block_buf = new char[LBS_BLOCK_SIZE]; - if (argc > 1) { - tss = new TarSegmentStore(argv[1]); - } else { - tss = new TarSegmentStore("."); - } + string backup_dest = "."; + + if (argc > 1) + backup_dest = argv[1]; + + tss = new TarSegmentStore(backup_dest); + + string desc_filename = backup_dest + "/snapshot.lbs"; + std::ofstream descriptor(desc_filename.c_str()); try { scanfile("."); @@ -332,14 +337,14 @@ int main(int argc, char *argv[]) root->checksum(); segment_list.insert(root->get_ref().get_segment()); - string r = root->get_ref().to_string(); - printf("\nroot: %s\n\n", r.c_str()); + descriptor << "root: " << root->get_ref().to_string() << "\n\n"; + delete root; - printf("segments:\n"); + descriptor << "segments:\n"; for (std::set::iterator i = segment_list.begin(); i != segment_list.end(); ++i) { - printf(" %s\n", i->c_str()); + descriptor << " " << *i << "\n"; } tss->sync();