aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2021-09-01 23:11:59 +0000
committerla-ninpre <leobrekalini@gmail.com>2021-09-01 23:11:59 +0000
commit9751403aeb161a49287582fab5965d33801bd76c (patch)
tree2c567c9eace65834f8980f856a031ccaa7086658 /main.c
parent58a402d36d5014c6dd06b8c8845671b85f0d1916 (diff)
downloadnimisewi_c-0.2.0.tar.gz
nimisewi_c-0.2.0.zip
changed build system to cmake (yeah, it's pretty big and complex, but i kindav0.2.0
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
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/main.c b/main.c
index 5c3a8de..04116fd 100644
--- a/main.c
+++ b/main.c
@@ -25,18 +25,34 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#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) {