commit 67ab7b9ad2f51941dd3a5fbce5e5f2ad91ff67ab
parent e1c49d2cc2ea60ba61d118e57bca5ed2ec6bf9df
Author: kocotian <kocotian@kocotian.pl>
Date: Mon, 23 Nov 2020 12:04:47 +0100
default username in config
Diffstat:
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/config.h b/config.h
@@ -2,3 +2,5 @@
health, saturation, protection, \
emotion, hydration, cash, \
username, host
+
+static const char *defaultusername = NULL;
diff --git a/nmps b/nmps
Binary files differ.
diff --git a/nmps.c b/nmps.c
@@ -13,7 +13,7 @@
#include "http.h"
#include "util.c"
-#define VERSION "a0.2.2"
+#define VERSION "a0.2.2.1"
extern void herror(const char *s);
@@ -179,9 +179,11 @@ main(int argc, char *argv[])
if (argc != 1)
usage();
- if (username == NULL) {
+ if (username == NULL && defaultusername == NULL) {
username = malloc(32);
getlogin_r(username, 32);
+ } else if (username == NULL && defaultusername != NULL) {
+ username = strdup(defaultusername);
}
host = argv[argc - 1];