diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-28 15:39:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-28 15:39:18 +0200 |
commit | 5e086efce1ae4f8825f6b90c4dc15324d8bea13a (patch) | |
tree | f038cdc710242ff6fe9bbece3fcddbee365097bc /tests | |
parent | 85b6c6f799806a944f3f70f95407c272036f716e (diff) |
Quiet down dir-iterator test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dir-iterator/driver.cxx | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/tests/dir-iterator/driver.cxx b/tests/dir-iterator/driver.cxx index 9eebb9f..7e4de84 100644 --- a/tests/dir-iterator/driver.cxx +++ b/tests/dir-iterator/driver.cxx @@ -30,24 +30,34 @@ operator<< (ostream& os, entry_type e) int main (int argc, const char* argv[]) { - if (argc != 2) + if (!(argc == 2 || (argc == 3 && argv[1] == string ("-v")))) { - cerr << "usage: " << argv[0] << " <dir>" << endl; + cerr << "usage: " << argv[0] << " [-v] <dir>" << endl; return 1; } + bool v (argc == 3); + const char* d (argv[argc - 1]); + try { - for (const dir_entry& de: dir_iterator (dir_path (argv[1]))) + for (const dir_entry& de: dir_iterator (dir_path (d))) { - cerr << de.ltype () << " "; + entry_type lt (de.ltype ()); + entry_type t (lt == entry_type::symlink ? de.ltype () : lt); + const path& p (de.path ()); + + if (v) + { + cerr << lt << " "; - if (de.ltype () == entry_type::symlink) - cerr << de.type (); - else - cerr << " "; + if (lt == entry_type::symlink) + cerr << t; + else + cerr << " "; - cerr << " " << de.path () << endl; + cerr << " " << p << endl; + } } } catch (const exception& e) |