aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@debian.org>2013-03-07 20:14:53 -0500
committerRyan Kavanagh <rak@debian.org>2013-03-07 20:15:03 -0500
commit2b81dda9735f71914ecac67e38e4d90f70699a1c (patch)
tree95190051fb1e4a1d0665fa882a83c103b20659d4
parentFix broken help key (diff)
Fix more portability issues: snprintf is not available everywhere
-rw-r--r--nmm.c12
1 files 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);