From 9751403aeb161a49287582fab5965d33801bd76c Mon Sep 17 00:00:00 2001 From: la-ninpre Date: Wed, 1 Sep 2021 23:11:59 +0000 Subject: changed build system to cmake (yeah, it's pretty big and complex, but i kinda like it). added "-v" and "--version" flags to nimisewi, that are outputting version information and compile features. updated readme with new build instructions. FossilOrigin-Name: 2ca71b4636bf84c76232e040f8ad5e8769a5381f7f99b76360233e6e6c78d686 --- main.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 5c3a8de..04116fd 100644 --- a/main.c +++ b/main.c @@ -25,18 +25,34 @@ #include #include #include +#include #include "nimisewi.h" int -main(void) +main(int argc, char *argv[]) { #ifdef HAVE_PLEDGE if (pledge("stdio", NULL) == -1) { err(EXIT_FAILURE, "pledge"); } #endif - + if (argc == 2) { + if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) { + printf("%s\n", PACKAGE_STRING); + printf("%s\n", PACKAGE_DESCRIPTION); +#if defined(HAVE_PLEDGE) || defined(HAVE_STRLCAT) + printf("features:\n"); +#endif +#ifdef HAVE_PLEDGE + printf("HAVE_PLEDGE\n"); +#endif +#ifdef HAVE_STRLCAT + printf("HAVE_STRLCAT\n"); +#endif + return EXIT_SUCCESS; + } + } char *ns; ns = nimi_sewi(); if (ns == NULL) { -- cgit v1.2.3