From 2b81dda9735f71914ecac67e38e4d90f70699a1c Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Thu, 7 Mar 2013 20:14:53 -0500 Subject: Fix more portability issues: snprintf is not available everywhere --- nmm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nmm.c b/nmm.c index 508a66a..78cd969 100644 --- a/nmm.c +++ b/nmm.c @@ -716,19 +716,23 @@ getgname(const game *g) void full_redraw(scrgame *sg) { - static char vers[25]; + static char *name = NULL; static size_t vers_len; static const char *helpstr = "? : help"; static const size_t helplen = 8; - snprintf(vers, 25, "%s version %s", getgname(sg->game), VERSION); - vers_len = strnlen(vers, 25); + if (!name) { + name = getgname(sg->game); + } + /* 10 = strlen(" version ") */ + vers_len = strlen(name) + strlen(VERSION) + 10; delwin(sg->board_w); delwin(sg->score_w); delwin(sg->msg_w); clear(); /* We want the ends of the version string and of * helpstr to line up. */ - mvprintw(versrow, helpcol + helplen - vers_len, vers); + mvprintw(versrow, helpcol + helplen - vers_len, + "%s version %s", name, VERSION); mvprintw(helprow, helpcol, helpstr); refresh(); sg->board_w = create_board(sg->game); -- cgit v1.2.3