diff options
author | Teddy Wing | 2022-10-27 02:10:30 +0200 |
---|---|---|
committer | Teddy Wing | 2022-10-27 02:11:20 +0200 |
commit | c683588fe736327b3b3341a42a6813dacc6e8a2b (patch) | |
tree | 5defc617a24ee03fbdf1fa25c11dbc29bf488534 /example | |
parent | 2226f598a26b9f2943e98ae8d89fd0502b398362 (diff) | |
download | SSVLSystemAlertVolume-c683588fe736327b3b3341a42a6813dacc6e8a2b.tar.bz2 |
example/main.c: Add a help argument and output
Diffstat (limited to 'example')
-rw-r--r-- | example/main.c | 22 |
1 files changed, 22 insertions, 0 deletions
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 <stdlib.h> +#include <stdio.h> +#include <string.h> #include <sysexits.h> #include <CoreFoundation/CoreFoundation.h> @@ -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] [<volume>]\n" + "\n" + " with no arguments, print the current system alert volume\n" + " <volume> 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; |