contest: fix network ui age string truncation warning

gcc 11-14 warn:

ui-net.c:114:76: warning: 'snprintf' output may be truncated before the last
	format character [-Wformat-truncation=]

The longest string we ever want to write to age_buf is 6 chars ("XXmYYs")
and a nul.  It is possible that the string strinks in length (eg., from
"10s" to "0s") so we need to overwrite whatever was on the screen.  The
easiest way is to construct the string and then specify the string width and
alignment when actually displaying it using mvwprintw.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 4 insertions(+), 4 deletions(-)

M hlog/contest/ui-net.c
M hlog/contest/ui-net.c +4 -4
@@ 1,5 1,5 @@ 
 /*
- * Copyright (c) 2024 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2024-2025 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

          
@@ 111,18 111,18 @@ void net_refresh(void)
 			if (secs >= (100 * 60)) {
 				age = ">=100m";
 			} else if (secs > 59) {
-				snprintf(age_buf, sizeof(age_buf), "%um%us ",
+				snprintf(age_buf, sizeof(age_buf), "%um%us",
 					 secs / 60, secs % 60);
 				age = age_buf;
 			} else {
-				snprintf(age_buf, sizeof(age_buf), "%us   ",
+				snprintf(age_buf, sizeof(age_buf), "%us",
 					 secs);
 				age = age_buf;
 			}
 		}
 
 		mvwprintw(lines_win, i, 0, "%s", lines[i]->buf);
-		mvwprintw(lines_win, i, lwidth - 5 - 1, "%s", age);
+		mvwprintw(lines_win, i, lwidth - 5 - 1, "%-6s", age);
 	}
 	MXUNLOCK(&lines_lock);