summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-07-31 18:03:33 +0200
committerlouiz’ <louiz@louiz.org>2016-07-31 18:16:29 +0200
commitf89361c3701ef66e17a7d8159d99e3d0b0c76e4e (patch)
treeeab4390e42d6d10568d7fffc8aedadc90ebc9c35 /src
parent47902953131a6fc6fc3ab24d15f5fd163c2f7add (diff)
downloadbiboumi-f89361c3701ef66e17a7d8159d99e3d0b0c76e4e.tar.gz
biboumi-f89361c3701ef66e17a7d8159d99e3d0b0c76e4e.tar.bz2
biboumi-f89361c3701ef66e17a7d8159d99e3d0b0c76e4e.tar.xz
biboumi-f89361c3701ef66e17a7d8159d99e3d0b0c76e4e.zip
Provide a --help option
fix #3183
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9b36880..905cfa6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -34,6 +34,12 @@ int config_help(const std::string& missing_option)
return 1;
}
+int display_help()
+{
+ std::cout << "Usage: biboumi [configuration_file]" << std::endl;
+ return 0;
+}
+
static void sigint_handler(int sig, siginfo_t*, void*)
{
// In 2 seconds, repeat the same signal, to force the exit
@@ -49,6 +55,20 @@ static void sigusr_handler(int, siginfo_t*, void*)
int main(int ac, char** av)
{
+ if (ac > 1)
+ {
+ const std::string arg = av[1];
+ if (arg.size() >= 2 && arg[0] == '-' && arg[1] == '-')
+ {
+ if (arg == "--help")
+ return display_help();
+ else
+ {
+ std::cerr << "Unknow command line option: " << arg << std::endl;
+ return 1;
+ }
+ }
+ }
const std::string conf_filename = ac > 1 ? av[1] : xdg_config_path("biboumi.cfg");
std::cout << "Using configuration file: " << conf_filename << std::endl;