summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-04-20 09:05:25 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-04-20 09:51:31 (EDT)
commit0f0c2f185d1b87e0e5bf78e288a984722a6b4a91 (patch)
tree9d5410957232df66c04a45b17920090a0a930bfd /src/main.c
parent851d501c2f8e9378417472aa8e083bddb6a59450 (diff)
main: Add version output
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c21
1 files changed, 19 insertions, 2 deletions
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 <http://www.gnu.org/licenses/>.
*/
+#include <stdio.h>
#include <stdlib.h>
#include "defs.h"
#include "opk.h"
@@ -30,6 +31,8 @@
#include <unistd.h>
#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 "
+ "<http://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");
+ 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;