]> git.tdb.fi Git - libs/core.git/blobdiff - examples/z.cpp
Fix references to deprecated functions
[libs/core.git] / examples / z.cpp
index 54f0eb7d336249c010ccb5911103f8bb88b7ee4a..d98392cfeaa92d18c102607ab171c3d1bed444d1 100644 (file)
@@ -26,13 +26,14 @@ public:
 Z::Z(int argc, char **argv):
        input_file(0)
 {
+       string input_fn;
        GetOpt getopt;
        getopt.add_option('d', "decompress", decompress, GetOpt::NO_ARG);
+       getopt.add_argument("filename", input_fn, GetOpt::OPTIONAL_ARG);
        getopt(argc, argv);
 
-       const vector<string> &args = getopt.get_args();
-       if(!args.empty())
-               input_file = new IO::File(args[0]);
+       if(!input_fn.empty())
+               input_file = new IO::File(input_fn);
 
        input = (input_file ? static_cast<IO::Base *>(input_file) : static_cast<IO::Base *>(&IO::cin));
        output = &IO::cout;