diff options
author | Ryan Kavanagh <rak@debian.org> | 2013-03-07 20:14:53 -0500 |
---|---|---|
committer | Ryan Kavanagh <rak@debian.org> | 2013-03-07 20:15:03 -0500 |
commit | 2b81dda9735f71914ecac67e38e4d90f70699a1c (patch) | |
tree | 95190051fb1e4a1d0665fa882a83c103b20659d4 /nmm.c | |
parent | Fix broken help key (diff) |
Fix more portability issues: snprintf is not available everywhere
Diffstat (limited to 'nmm.c')
-rw-r--r-- | nmm.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); |