From 0f0c2f185d1b87e0e5bf78e288a984722a6b4a91 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 20 Apr 2023 09:05:25 -0400 Subject: main: Add version output --- (limited to 'src') diff --git a/src/main.c b/src/main.c index 94fed74..1cc20a4 100644 --- a/src/main.c +++ b/src/main.c @@ -17,6 +17,7 @@ * along with opkg-opk. If not, see . */ +#include #include #include "defs.h" #include "opk.h" @@ -30,6 +31,8 @@ #include #endif +extern const char *PACKAGE_VERSION_GIT; + const char *_optstring = "I:fchV"; #ifdef HAVE_GETOPT_LONG struct option _longopts[] = { @@ -66,6 +69,20 @@ struct option _longopts[] = { }; #endif +static void +_version(void) +{ + printf("%s %s%s\n", PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_VERSION_GIT); + printf("Copyright (C) %s %s\n", "2023", "Patrick McDermott"); + puts("License GPLv3+: GNU GPL version 3 or later " + ".\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"); + printf("Please report bugs to <%s>.\n", PACKAGE_BUGREPORT); +} + int main(int argc, char *argv[]) { @@ -104,8 +121,8 @@ main(int argc, char *argv[]) /* TODO */ break; case 'V': - /* TODO */ - break; + _version(); + return EXIT_SUCCESS; default: /* TODO */ break; -- cgit v0.9.1