summaryrefslogtreecommitdiffhomepage
path: root/whiteboard.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2022-12-31 22:00:11 +0100
committerRoland Reichwein <mail@reichwein.it>2022-12-31 22:00:11 +0100
commit9465fd744cc2117190bafc1a3e2da9f10ca29bf9 (patch)
tree7d94bdaaa37cabb58cede695b03082b8360167bd /whiteboard.cpp
parentaf1c4ee4d74ff7afc997372802d851d11daad418 (diff)
Storage via SQLite, Added tests (WIP)
Diffstat (limited to 'whiteboard.cpp')
-rw-r--r--whiteboard.cpp27
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();