nmps

simple network-based command-line rpg wrote in c99
git clone git://git.kocotian.pl/nmps.git
Log | Files | Refs | LICENSE

commit 67ab7b9ad2f51941dd3a5fbce5e5f2ad91ff67ab
parent e1c49d2cc2ea60ba61d118e57bca5ed2ec6bf9df
Author: kocotian <kocotian@kocotian.pl>
Date:   Mon, 23 Nov 2020 12:04:47 +0100

default username in config

Diffstat:
Mconfig.h | 2++
Anmps | 0
Mnmps.c | 6++++--
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];