From c683588fe736327b3b3341a42a6813dacc6e8a2b Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 27 Oct 2022 02:10:30 +0200 Subject: example/main.c: Add a help argument and output --- example/main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/example/main.c b/example/main.c index e8e3e31..0214992 100644 --- a/example/main.c +++ b/example/main.c @@ -1,4 +1,6 @@ #include +#include +#include #include #include @@ -6,6 +8,26 @@ #include "./lib/SSVLSystemAlertVolume.h" int main(int argc, char *argv[]) { + if ( + argc == 2 + && + ( + strcmp(argv[1], "-h") == 0 + || strcmp(argv[1], "--help") == 0 + ) + ) { + puts( + "usage: sysalertvol [-h] []\n" + "\n" + " with no arguments, print the current system alert volume\n" + " set alert volume to a value between 0 and 1\n" + " -h, --help print this help message" + ); + + return EX_OK; + } + + OSStatus result = noErr; Float32 volume; -- cgit v1.2.3