diff options
| author | verdant <im@verdant.ee> | 2026-07-23 02:59:41 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-07-23 02:59:41 +0800 |
| commit | 6ef3bfdf2f7e19cd74220a2c8c56250a7f13f0ce (patch) | |
| tree | c15aa5b24b585bd7aa894a8053e254c949b27677 | |
| parent | b60c5884744686f4cbc8bb9eb76137c09537aea2 (diff) | |
| download | sf-6ef3bfdf2f7e19cd74220a2c8c56250a7f13f0ce.tar.gz sf-6ef3bfdf2f7e19cd74220a2c8c56250a7f13f0ce.zip | |
Add version function
This function outputs program name, build date, author(s) and license
| -rw-r--r-- | version.c | 16 | ||||
| -rw-r--r-- | version.h | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/version.c b/version.c new file mode 100644 index 0000000..234a9f5 --- /dev/null +++ b/version.c @@ -0,0 +1,16 @@ +#include "./version.h" +#include <stdio.h> +#include <stdlib.h> +void version() +{ + printf(PROGRAM_NAME + " " PROGRAM_VERSION " (built " BUILD_DATE + " with gcc " GCC_VERSION ")\n" + "Copyright (C) 2026 " PROGRAM_AUTHOR ".\n" + "License GPLv3+: GNU GPL version 3 or later " + "<https://gnu.org/licenses/gpl.html>.\n" + "This is free software: you are free to change and redistribute " + "it.\n" + "There is NO WARRANTY, to the extent permitted by law.\n"); + exit(EXIT_SUCCESS); +} @@ -4,5 +4,10 @@ #define PROGRAM_NAME "sf" #define PROGRAM_LONG_NAME "Status & Files" #define PROGRAM_VERSION "0.0.1" +#define PROGRAM_AUTHOR "Verdant <im@verdant.ee>" +#define BUILD_DATE __DATE__ +#define GCC_VERSION __VERSION__ + +void version(); #endif /* SF_VERSION_H */ |
