Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games Fix a few of the games to use getprogname() in their u...



details:   https://anonhg.NetBSD.org/src/rev/b08d4dc38d01
branches:  trunk
changeset: 759281:b08d4dc38d01
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Dec 05 04:34:22 2010 +0000

description:
Fix a few of the games to use getprogname() in their usage() functions.

Suggested by Joerg.

XXX There are probably many more that have their progname hard-coded, but
XXX I'm not up for a wholesale roto-till at the moment.

diffstat:

 games/boggle/boggle/bog.c |   7 ++++---
 games/pom/pom.c           |   7 ++++---
 games/snake/snake/snake.c |  12 ++++++++----
 games/tetris/tetris.c     |   5 +++--
 4 files changed, 19 insertions(+), 12 deletions(-)

diffs (106 lines):

diff -r c2e4a2f6218c -r b08d4dc38d01 games/boggle/boggle/bog.c
--- a/games/boggle/boggle/bog.c Sun Dec 05 04:11:51 2010 +0000
+++ b/games/boggle/boggle/bog.c Sun Dec 05 04:34:22 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bog.c,v 1.25 2010/12/05 04:11:51 pgoyette Exp $        */
+/*     $NetBSD: bog.c,v 1.26 2010/12/05 04:34:22 pgoyette Exp $        */
 
 /*-
  * Copyright (c) 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)bog.c      8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: bog.c,v 1.25 2010/12/05 04:11:51 pgoyette Exp $");
+__RCSID("$NetBSD: bog.c,v 1.26 2010/12/05 04:34:22 pgoyette Exp $");
 #endif
 #endif /* not lint */
 
@@ -707,6 +707,7 @@
 usage(void)
 {
        (void) fprintf(stderr,
-           "usage: boggle [-bd] [-s#] [-t#] [-w#] [+[+]] [boardspec]\n");
+           "usage: %s [-bd] [-s#] [-t#] [-w#] [+[+]] [boardspec]\n",
+           getprogname());
        exit(1);
 }
diff -r c2e4a2f6218c -r b08d4dc38d01 games/pom/pom.c
--- a/games/pom/pom.c   Sun Dec 05 04:11:51 2010 +0000
+++ b/games/pom/pom.c   Sun Dec 05 04:34:22 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pom.c,v 1.19 2009/08/12 08:23:20 dholland Exp $        */
+/*     $NetBSD: pom.c,v 1.20 2010/12/05 04:34:22 pgoyette Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)pom.c      8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: pom.c,v 1.19 2009/08/12 08:23:20 dholland Exp $");
+__RCSID("$NetBSD: pom.c,v 1.20 2010/12/05 04:34:22 pgoyette Exp $");
 #endif
 #endif /* not lint */
 
@@ -272,6 +272,7 @@
 badformat(void)
 {
        warnx("illegal time format");
-       (void)fprintf(stderr, "usage: pom [[[[[cc]yy]mm]dd]HH]\n");
+       (void)fprintf(stderr, "usage: %s [[[[[cc]yy]mm]dd]HH]\n",
+           getprogname());
        exit(EXIT_FAILURE);
 }
diff -r c2e4a2f6218c -r b08d4dc38d01 games/snake/snake/snake.c
--- a/games/snake/snake/snake.c Sun Dec 05 04:11:51 2010 +0000
+++ b/games/snake/snake/snake.c Sun Dec 05 04:34:22 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: snake.c,v 1.26 2009/08/12 08:48:15 dholland Exp $      */
+/*     $NetBSD: snake.c,v 1.27 2010/12/05 04:34:22 pgoyette Exp $      */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)snake.c    8.2 (Berkeley) 1/7/94";
 #else
-__RCSID("$NetBSD: snake.c,v 1.26 2009/08/12 08:48:15 dholland Exp $");
+__RCSID("$NetBSD: snake.c,v 1.27 2010/12/05 04:34:22 pgoyette Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -180,9 +180,13 @@
                case '?':
                default:
 #ifdef DEBUG
-                       fputs("usage: snake [-d seed] [-w width] [-l length] [-t]\n", stderr);
+                       fprintf(stderr,
+                           "usage: %s [-d seed] [-w width] [-l length] [-t]\n",
+                           getprogname());
 #else
-                       fputs("usage: snake [-w width] [-l length] [-t]\n", stderr);
+                       fprintf(stderr,
+                           "usage: %s [-w width] [-l length] [-t]\n",
+                           getprogname());
 #endif
                        exit(1);
                }
diff -r c2e4a2f6218c -r b08d4dc38d01 games/tetris/tetris.c
--- a/games/tetris/tetris.c     Sun Dec 05 04:11:51 2010 +0000
+++ b/games/tetris/tetris.c     Sun Dec 05 04:34:22 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tetris.c,v 1.22 2009/08/12 08:51:21 dholland Exp $     */
+/*     $NetBSD: tetris.c,v 1.23 2010/12/05 04:34:23 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -328,6 +328,7 @@
 static void
 usage(void)
 {
-       (void)fprintf(stderr, "usage: tetris [-ps] [-k keys] [-l level]\n");
+       (void)fprintf(stderr, "usage: %s [-ps] [-k keys] [-l level]\n",
+           getprogname());
        exit(1);
 }



Home | Main Index | Thread Index | Old Index