aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c23
-rw-r--r--version.h11
2 files changed, 26 insertions, 8 deletions
diff --git a/main.c b/main.c
index 4fc3d1a..c196cdd 100644
--- a/main.c
+++ b/main.c
@@ -3,11 +3,14 @@
3#include <stdarg.h> 3#include <stdarg.h>
4#include <getopt.h> 4#include <getopt.h>
5 5
6#include "version.h"
7
6void help(const char *argv0) { 8void help(const char *argv0) {
7 printf("Usage: %s [options]\n" 9 printf("Usage: %s [options]\n"
8 "\nAvailable options:\n" 10 "\nAvailable options:\n"
9 " -h,--help this help\n" 11 " -h,--help this help\n"
10 " -v,--version show version\n" 12 " -v,--version show version\n"
13 " -l,--list list available devices\n"
11 " -p,--port=client:port device port\n", 14 " -p,--port=client:port device port\n",
12 argv0); 15 argv0);
13} 16}
@@ -15,11 +18,11 @@ void help(const char *argv0) {
15int main(int argc, char *argv[]) { 18int main(int argc, char *argv[]) {
16 const char short_options[] = "hvlp"; 19 const char short_options[] = "hvlp";
17 const struct option long_options[] = { 20 const struct option long_options[] = {
18 {"help", 0, NULL, 'h'}, 21 { "help", 0, NULL, 'h' },
19 {"version", 0, NULL, 'v'}, 22 { "version", 0, NULL, 'v' },
20 {"list", 0, NULL, 'l'}, 23 { "list", 0, NULL, 'l' },
21 {"port", 1, NULL, 'p'}, 24 { "port", 1, NULL, 'p' },
22 {0}, 25 { 0 },
23 }; 26 };
24 27
25 int c; 28 int c;
@@ -29,13 +32,17 @@ int main(int argc, char *argv[]) {
29 help(argv[0]); 32 help(argv[0]);
30 return 0; 33 return 0;
31 case 'v': 34 case 'v':
32 fprintf(stdout, "Version\n"); 35 fprintf(stdout, "ttdaw version %s\n", TTDAW_VERSION);
36 fprintf(stdout, "Website: %s.\n", TTDAW_WEBSITE);
37 fprintf(stdout, "%s\n", TTDAW_LICENSE);
38 fprintf(stdout, "%s\n", TTDAW_WARRANTY);
39 fprintf(stdout, "\n%s\n", TTDAW_AUTHOR);
33 return 0; 40 return 0;
34 case 'l': 41 case 'l':
35 fprintf(stdout, "List\n"); 42 fprintf(stderr, "List feature is NOT implemented yet.\n");
36 return 0; 43 return 0;
37 case 'p': 44 case 'p':
38 fprintf(stdout, "Port\n"); 45 fprintf(stderr, "Port feature is NOT implemented yet.\n");
39 return 0; 46 return 0;
40 default: 47 default:
41 fprintf(stdout, "No option provided\n"); 48 fprintf(stdout, "No option provided\n");
diff --git a/version.h b/version.h
new file mode 100644
index 0000000..e5962f6
--- /dev/null
+++ b/version.h
@@ -0,0 +1,11 @@
1#ifndef TTDAW_VERSION_H
2#define TTDAW_VERSION_H
3
4#define TTDAW_VERSION "0.1"
5#define TTDAW_WEBSITE "https://github.com/mitjafelicijan/ttdaw"
6#define TTDAW_LICENSE "This is free software: you are free to change and redistribute it."
7#define TTDAW_WARRANTY "There is NO WARRANTY, to the extent permitted by law."
8#define TTDAW_AUTHOR "Written by Mitja Felicijan <https://mitjafelicijan.com>."
9
10#endif
11