diff options
| -rw-r--r-- | main.c | 23 | ||||
| -rw-r--r-- | version.h | 11 |
2 files changed, 26 insertions, 8 deletions
@@ -3,11 +3,14 @@ #include <stdarg.h> #include <getopt.h> +#include "version.h" + void help(const char *argv0) { printf("Usage: %s [options]\n" "\nAvailable options:\n" " -h,--help this help\n" " -v,--version show version\n" + " -l,--list list available devices\n" " -p,--port=client:port device port\n", argv0); } @@ -15,11 +18,11 @@ void help(const char *argv0) { int main(int argc, char *argv[]) { const char short_options[] = "hvlp"; const struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"version", 0, NULL, 'v'}, - {"list", 0, NULL, 'l'}, - {"port", 1, NULL, 'p'}, - {0}, + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'v' }, + { "list", 0, NULL, 'l' }, + { "port", 1, NULL, 'p' }, + { 0 }, }; int c; @@ -29,13 +32,17 @@ int main(int argc, char *argv[]) { help(argv[0]); return 0; case 'v': - fprintf(stdout, "Version\n"); + fprintf(stdout, "ttdaw version %s\n", TTDAW_VERSION); + fprintf(stdout, "Website: %s.\n", TTDAW_WEBSITE); + fprintf(stdout, "%s\n", TTDAW_LICENSE); + fprintf(stdout, "%s\n", TTDAW_WARRANTY); + fprintf(stdout, "\n%s\n", TTDAW_AUTHOR); return 0; case 'l': - fprintf(stdout, "List\n"); + fprintf(stderr, "List feature is NOT implemented yet.\n"); return 0; case 'p': - fprintf(stdout, "Port\n"); + fprintf(stderr, "Port feature is NOT implemented yet.\n"); return 0; default: 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 @@ +#ifndef TTDAW_VERSION_H +#define TTDAW_VERSION_H + +#define TTDAW_VERSION "0.1" +#define TTDAW_WEBSITE "https://github.com/mitjafelicijan/ttdaw" +#define TTDAW_LICENSE "This is free software: you are free to change and redistribute it." +#define TTDAW_WARRANTY "There is NO WARRANTY, to the extent permitted by law." +#define TTDAW_AUTHOR "Written by Mitja Felicijan <https://mitjafelicijan.com>." + +#endif + |
