[Freeciv-Dev] Re: Xaw truncate long leader names in players dialog
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Jeff Mallatt <jjm@xxxxxxxxxxxx> writes:
> This one-liner truncates long leader names in the Xaw client Players dialog.
> diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-xaw/plrdlg.c
> freeciv/client/gui-xaw/plrdlg.c
> --- FreecivCVS/client/gui-xaw/plrdlg.c Sun Jan 2 06:55:33 2000
> +++ freeciv/client/gui-xaw/plrdlg.c Sat Mar 18 20:44:36 2000
> @@ -196,6 +196,7 @@
> my_snprintf(namebuf, sizeof(namebuf), "*%-15s",game.players[i].name);
> else
> my_snprintf(namebuf, sizeof(namebuf), "%-16s",game.players[i].name);
> + namebuf[16] = '\0';
> my_snprintf(namelist_text[j], sizeof(namelist_text[j]),
> "%-16s %-12s %c %-6s %-15s%s",
> namebuf,
Couldn't we make my_snprintf always add an '\0' if it truncated the
string? That is not how snprintf behaves, but in 99.9% it is what you
want.
Falk
|
|