diff options
| -rw-r--r-- | src/cli.c | 8 | ||||
| -rw-r--r-- | src/std.h | 1 | ||||
| -rw-r--r-- | src/version.h | 6 | ||||
| -rw-r--r-- | tests/111.sh | 6 |
4 files changed, 21 insertions, 0 deletions
@@ -1,5 +1,10 @@ #include "cli.h" #include "common.h" +#include "version.h" + +static void print_version() { + printf("ducc v%s\n", DUCC_VERSION); +} CliArgs* parse_cli_args(int argc, char** argv) { const char* output_filename = NULL; @@ -29,6 +34,9 @@ CliArgs* parse_cli_args(int argc, char** argv) { only_compile = TRUE; } else if (strcmp(argv[i], "-MMD") == 0) { generate_deps = TRUE; + } else if (strcmp(argv[i], "--version") == 0) { + print_version(); + exit(0); } else { fatal_error("unknown option: %s", argv[i]); } @@ -26,6 +26,7 @@ void* memcpy(void*, const void*, size_t); void* memmove(void*, const void*, size_t); void* memset(void*, int, size_t); int mkstemps(char*, int); +int printf(const char*, ...); void* realloc(void*, size_t); int sprintf(char*, const char*, ...); int strcmp(const char*, const char*); diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..8f8b201 --- /dev/null +++ b/src/version.h @@ -0,0 +1,6 @@ +#ifndef DUCC_VERSION_H +#define DUCC_VERSION_H + +#define DUCC_VERSION "0.1.0" + +#endif diff --git a/tests/111.sh b/tests/111.sh new file mode 100644 index 0000000..9f500fd --- /dev/null +++ b/tests/111.sh @@ -0,0 +1,6 @@ +expected="ducc v0.1.0" + +if [[ "$("$ducc" --version)" != "$expected" ]]; then + echo "invalid output" >&2 + exit 1 +fi |
