diff options
author | Richard Kettlewell <rjk@greenend.org.uk> | 2011-04-28 20:03:55 +0100 |
---|---|---|
committer | Richard Kettlewell <rjk@greenend.org.uk> | 2011-04-28 20:03:55 +0100 |
commit | 30298e0efda22dcf54fdd0a18917d68ed638db2d (patch) | |
tree | 736444fb42e3f2642545ca5c20063faa5dec5218 /src | |
parent | e9bf40783420f0a5d1c31078532920e0486771a1 (diff) |
Comments
Diffstat (limited to 'src')
-rw-r--r-- | src/BulkRemove.cc | 1 | ||||
-rw-r--r-- | src/Check.cc | 3 | ||||
-rw-r--r-- | src/Command.cc | 6 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/BulkRemove.cc b/src/BulkRemove.cc index 983bdb9..61ac149 100644 --- a/src/BulkRemove.cc +++ b/src/BulkRemove.cc @@ -3,6 +3,7 @@ #include "Utils.h" void BulkRemove(const std::string &path) { + // Invoking rm makes more sense than re-implementing it. std::vector<std::string> cmd; cmd.push_back("rm"); cmd.push_back("-rf"); diff --git a/src/Check.cc b/src/Check.cc index ce11a08..75a4a53 100644 --- a/src/Check.cc +++ b/src/Check.cc @@ -7,16 +7,19 @@ #include <cerrno> bool check(const char *format, ...) { + // --force overrides if(command.force) return true; char buffer[64]; for(;;) { + // Display the prompt va_list ap; va_start(ap, format); vfprintf(stdout, format, ap); va_end(ap); printf("yes/no> "); fflush(stdout); + // Get a yes/no answer fgets(buffer, sizeof buffer, stdin); if(feof(stdin)) throw IOError("unexpected EOF reading stdin"); diff --git a/src/Command.cc b/src/Command.cc index bf2b496..40c6800 100644 --- a/src/Command.cc +++ b/src/Command.cc @@ -7,6 +7,10 @@ #include <cstdio> #include <cstdlib> +// Long-only options +// +// The short forms aren't acutally document at the moment, but they might be +// one day. enum { RETIRE_DEVICE = 256, RETIRE = 257, @@ -162,6 +166,8 @@ void Command::parse(int argc, char **argv) { } void Command::selectVolumes() { + // This is a separate method because it has to be called after the config + // file is read. for(size_t n = 0; n < selections.size(); ++n) config.selectVolume(selections[n].host, selections[n].volume, |