diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 2001-02-13 12:17:24 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 2001-02-13 12:17:24 +0000 |
commit | 3e5e7eb34c136379d2be44027a67b7177cecf1f6 (patch) | |
tree | 23139e06b6d4330ee3923c223716abb16900be9d /games/canfield/cfscores | |
parent | f15e31b4a13545b68e026611a2e09f111566a528 (diff) |
Try to keep formatting pretty for long usernames
Diffstat (limited to 'games/canfield/cfscores')
-rw-r--r-- | games/canfield/cfscores/cfscores.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/games/canfield/cfscores/cfscores.c b/games/canfield/cfscores/cfscores.c index fb0bbf7be49..1e3eb4ea95b 100644 --- a/games/canfield/cfscores/cfscores.c +++ b/games/canfield/cfscores/cfscores.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfscores.c,v 1.5 2000/07/23 21:49:07 pjanzen Exp $ */ +/* $OpenBSD: cfscores.c,v 1.6 2001/02/13 12:17:23 pjanzen Exp $ */ /* $NetBSD: cfscores.c,v 1.3 1995/03/21 15:08:37 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: cfscores.c,v 1.5 2000/07/23 21:49:07 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: cfscores.c,v 1.6 2001/02/13 12:17:23 pjanzen Exp $"; #endif #endif /* not lint */ @@ -146,11 +146,29 @@ printuser(pw, printfail) printf("%s has never played canfield.\n", pw->pw_name); return; } + i = strlen(pw->pw_name); printf("*----------------------*\n"); - if (total.worth >= 0) - printf("* Winnings for %-8s*\n", pw->pw_name); - else - printf("* Losses for %-10s*\n", pw->pw_name); + if (total.worth >= 0) { + if (i <= 8) + printf("* Winnings for %-8s*\n", pw->pw_name); + else { + printf("* Winnings for *\n"); + if (i <= 20) + printf("* %20s *\n", pw->pw_name); + else + printf("%s\n", pw->pw_name); + } + } else { + if (i <= 10) + printf("* Losses for %-10s*\n", pw->pw_name); + else { + printf("* Losses for *\n"); + if (i <= 20) + printf("* %20s *\n", pw->pw_name); + else + printf("%s\n", pw->pw_name); + } + } printf("*======================*\n"); printf("|Costs Total |\n"); printf("| Hands %8ld |\n", total.hand); |