aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/hash_fd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/hash_fd.cpp')
-rw-r--r--doc/examples/hash_fd.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/doc/examples/hash_fd.cpp b/doc/examples/hash_fd.cpp
index 19d744287..d6487095a 100644
--- a/doc/examples/hash_fd.cpp
+++ b/doc/examples/hash_fd.cpp
@@ -33,29 +33,28 @@ int main(int argc, char* argv[])
return 1;
}
- Botan::LibraryInitializer init;
-
- try {
- Botan::Pipe pipe(new Botan::Hash_Filter(argv[1]),
- new Botan::Hex_Encoder);
-
- int skipped = 0;
- for(int j = 2; argv[j] != 0; j++)
+ try
{
- int file = open(argv[j], O_RDONLY);
- if(file == -1)
+ Botan::Pipe pipe(new Botan::Hash_Filter(argv[1]),
+ new Botan::Hex_Encoder);
+
+ int skipped = 0;
+ for(int j = 2; argv[j] != 0; j++)
{
- std::cout << "ERROR: could not open " << argv[j] << std::endl;
- skipped++;
- continue;
+ int file = open(argv[j], O_RDONLY);
+ if(file == -1)
+ {
+ std::cout << "ERROR: could not open " << argv[j] << std::endl;
+ skipped++;
+ continue;
+ }
+ pipe.start_msg();
+ file >> pipe;
+ pipe.end_msg();
+ close(file);
+ pipe.set_default_msg(j-2-skipped);
+ std::cout << pipe << " " << argv[j] << std::endl;
}
- pipe.start_msg();
- file >> pipe;
- pipe.end_msg();
- close(file);
- pipe.set_default_msg(j-2-skipped);
- std::cout << pipe << " " << argv[j] << std::endl;
- }
}
catch(Botan::Algorithm_Not_Found)
{