diff options
Diffstat (limited to 'whiteboard.cpp')
-rw-r--r-- | whiteboard.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/whiteboard.cpp b/whiteboard.cpp index 45434df..6d07576 100644 --- a/whiteboard.cpp +++ b/whiteboard.cpp @@ -93,15 +93,38 @@ namespace { return File::getFile(path); } -} -int main(void) + void usage() { + std::cout << + "Usage: \n" + " whiteboard [-c]\n" + "\n" + "Options:\n" + " -c : Cleanup database according to timeout rules (config: maxage)\n" + "\n" + "Without options, whiteboard will be started as FCGI application" + << std::endl; + } +} // namespace + +// the actual main() for testability +int whiteboard(int argc, char* argv[]) { Config config; data_path = config.getDataPath(); Storage storage(config); + if (argc == 2) { + if (argv[1] == "-h"s || argv[1] == "-?"s) { + usage(); + exit(0); + } else if (argv[1] == "-c"s) { + storage.cleanup(); + exit(0); + } + } + Magick::InitializeMagick(NULL); // for qrcode.cpp int result = FCGX_Init(); |