summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormestre <mestre@cvs.openbsd.org>2016-03-07 12:07:58 +0000
committermestre <mestre@cvs.openbsd.org>2016-03-07 12:07:58 +0000
commitbc31d3ab9380405749109f50c712a4ff98a7b573 (patch)
tree757450abe6a8a34b28ea9250a9edb99e061a025c
parent6b01e9e6ca0144f4e1dca633ed40522da3b9ff79 (diff)
- General changes:
- Remove -? from getopt(3) options, but still keep (or add) -h where applicable - Replace hardcoded program strings by getprogname(3) - Specific changes: - atc(6): this used -? and -u for usage(), remove both from game and manpage - bcd(6): use __progname instead of getprogname(3), no need to include stdlib.h - hunt(6): replace fputs(3) by fprintf(3) OK tb@ after his suggestions
-rw-r--r--games/atc/atc.611
-rw-r--r--games/atc/main.c7
-rw-r--r--games/banner/banner.c7
-rw-r--r--games/bcd/bcd.c9
-rw-r--r--games/boggle/boggle/bog.c6
-rw-r--r--games/bs/bs.c4
-rw-r--r--games/cribbage/crib.c9
-rw-r--r--games/factor/factor.c8
-rw-r--r--games/fish/fish.c5
-rw-r--r--games/fortune/fortune/fortune.c8
-rw-r--r--games/fortune/strfile/strfile.c8
-rw-r--r--games/fortune/unstr/unstr.c4
-rw-r--r--games/grdc/grdc.c8
-rw-r--r--games/hunt/hunt/hunt.c8
-rw-r--r--games/morse/morse.c7
-rw-r--r--games/number/number.c5
-rw-r--r--games/phantasia/setup.c6
-rw-r--r--games/pig/pig.c8
-rw-r--r--games/pom/pom.c5
-rw-r--r--games/ppt/ppt.c4
-rw-r--r--games/primes/primes.c8
-rw-r--r--games/quiz/quiz.c8
-rw-r--r--games/random/random.c6
-rw-r--r--games/robots/main.c4
-rw-r--r--games/snake/snake.c3
-rw-r--r--games/tetris/tetris.c5
-rw-r--r--games/wump/wump.c7
27 files changed, 87 insertions, 91 deletions
diff --git a/games/atc/atc.6 b/games/atc/atc.6
index 58032a393d0..12b71e5eb9b 100644
--- a/games/atc/atc.6
+++ b/games/atc/atc.6
@@ -1,4 +1,4 @@
-.\" $OpenBSD: atc.6,v 1.22 2015/11/29 16:04:14 jmc Exp $
+.\" $OpenBSD: atc.6,v 1.23 2016/03/07 12:07:55 mestre Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -34,7 +34,7 @@
.\"
.\" Copyright (c) 1986 Ed James. All rights reserved.
.\"
-.Dd $Mdocdate: November 29 2015 $
+.Dd $Mdocdate: March 7 2016 $
.Dt ATC 6
.Os
.Sh NAME
@@ -42,7 +42,7 @@
.Nd air traffic controller game
.Sh SYNOPSIS
.Nm atc
-.Op Fl lpqstu?
+.Op Fl lpqst
.Op Fl f Ar game
.Op Fl g Ar game
.Op Fl r Ar seed
@@ -91,11 +91,6 @@ successfully dealt with.
.It Fl t
Same as
.Fl s .
-.It Fl u
-Print the usage line and exit.
-.It Fl \&?
-Same as
-.Fl u .
.El
.Sh GOALS
Your goal in
diff --git a/games/atc/main.c b/games/atc/main.c
index ea3a42da1f8..d801b620df2 100644
--- a/games/atc/main.c
+++ b/games/atc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.27 2016/01/07 16:00:31 tb Exp $ */
+/* $OpenBSD: main.c,v 1.28 2016/03/07 12:07:55 mestre Exp $ */
/* $NetBSD: main.c,v 1.4 1995/04/27 21:22:25 mycroft Exp $ */
/*-
@@ -71,7 +71,7 @@ main(int argc, char *argv[])
makenoise = 1;
seed = NULL;
- while ((ch = getopt(argc, argv, "f:g:lpqr:stu?")) != -1) {
+ while ((ch = getopt(argc, argv, "f:g:hlpqr:st")) != -1) {
switch (ch) {
case 'f':
case 'g':
@@ -93,8 +93,7 @@ main(int argc, char *argv[])
case 't':
f_showscore = 1;
break;
- case 'u':
- case '?':
+ case 'h':
default:
f_usage = 1;
break;
diff --git a/games/banner/banner.c b/games/banner/banner.c
index 61e3eb82171..88c8fa80197 100644
--- a/games/banner/banner.c
+++ b/games/banner/banner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: banner.c,v 1.20 2016/01/07 16:00:31 tb Exp $ */
+/* $OpenBSD: banner.c,v 1.21 2016/03/07 12:07:55 mestre Exp $ */
/* $NetBSD: banner.c,v 1.4 1995/04/22 11:55:15 cgd Exp $ */
/*
@@ -1034,10 +1034,11 @@ main(int argc, char *argv[])
if (errstr)
errx(1, "width is %s: %s", errstr, optarg);
break;
- case '?': case 'h':
+ case 'h':
default:
(void)fprintf(stderr,
- "usage: banner [-w width] message ...\n");
+ "usage: %s [-w width] message ...\n",
+ getprogname());
return 1;
}
argc -= optind;
diff --git a/games/bcd/bcd.c b/games/bcd/bcd.c
index 096d6fe8ce3..59b15bb1f84 100644
--- a/games/bcd/bcd.c
+++ b/games/bcd/bcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcd.c,v 1.24 2016/01/08 20:15:15 mestre Exp $ */
+/* $OpenBSD: bcd.c,v 1.25 2016/03/07 12:07:55 mestre Exp $ */
/* $NetBSD: bcd.c,v 1.6 1995/04/24 12:22:23 cgd Exp $ */
/*
@@ -115,11 +115,11 @@ int decode(char *buf);
int columns = 48;
-
int
main(int argc, char *argv[])
{
char cardline[1024];
+ extern char *__progname;
int dflag = 0;
int ch;
@@ -135,8 +135,9 @@ main(int argc, char *argv[])
columns = 80;
break;
default:
- fprintf(stderr, "usage: bcd [-l] [string ...]\n");
- fprintf(stderr, "usage: bcd -d [-l]\n");
+ fprintf(stderr, "usage: %s [-l] [string ...]\n",
+ __progname);
+ fprintf(stderr, "usage: %s -d [-l]\n", __progname);
return 1;
}
}
diff --git a/games/boggle/boggle/bog.c b/games/boggle/boggle/bog.c
index 2f6eebfce19..26b74f08f33 100644
--- a/games/boggle/boggle/bog.c
+++ b/games/boggle/boggle/bog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bog.c,v 1.29 2016/01/10 13:18:07 mestre Exp $ */
+/* $OpenBSD: bog.c,v 1.30 2016/03/07 12:07:55 mestre Exp $ */
/* $NetBSD: bog.c,v 1.5 1995/04/24 12:22:32 cgd Exp $ */
/*-
@@ -97,7 +97,7 @@ main(int argc, char *argv[])
minlength = -1;
tlimit = 180; /* 3 minutes is standard */
- while ((ch = getopt(argc, argv, "Bbcdt:w:")) != -1)
+ while ((ch = getopt(argc, argv, "Bbcdht:w:")) != -1)
switch(ch) {
case 'B':
grid = 5;
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
if ((minlength = atoi(optarg)) < 3)
errx(1, "min word length must be > 2");
break;
- case '?':
+ case 'h':
default:
usage();
}
diff --git a/games/bs/bs.c b/games/bs/bs.c
index 94786b5dda3..8d0b51b1c4c 100644
--- a/games/bs/bs.c
+++ b/games/bs/bs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bs.c,v 1.38 2016/01/10 14:10:39 mestre Exp $ */
+/* $OpenBSD: bs.c,v 1.39 2016/03/07 12:07:55 mestre Exp $ */
/*
* Copyright (c) 1986, Bruce Holloway
* All rights reserved.
@@ -1266,7 +1266,7 @@ playagain(void)
__dead void
usage(void)
{
- (void) fprintf(stderr, "usage: bs [-b | -s] [-c]\n");
+ (void) fprintf(stderr, "usage: %s [-b | -s] [-c]\n", getprogname());
(void) fprintf(stderr, "\tWhere the options are:\n");
(void) fprintf(stderr, "\t-b : play a blitz game\n");
(void) fprintf(stderr, "\t-s : play a salvo game\n");
diff --git a/games/cribbage/crib.c b/games/cribbage/crib.c
index 6e04b4bddfa..e45fbd2c335 100644
--- a/games/cribbage/crib.c
+++ b/games/cribbage/crib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crib.c,v 1.22 2016/01/07 16:00:32 tb Exp $ */
+/* $OpenBSD: crib.c,v 1.23 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: crib.c,v 1.7 1997/07/10 06:47:29 mikel Exp $ */
/*-
@@ -47,7 +47,7 @@ main(int argc, char *argv[])
if (pledge("stdio rpath tty proc exec", NULL) == -1)
err(1, "pledge");
- while ((ch = getopt(argc, argv, "emqr")) != -1)
+ while ((ch = getopt(argc, argv, "ehmqr")) != -1)
switch (ch) {
case 'e':
explain = TRUE;
@@ -61,9 +61,10 @@ main(int argc, char *argv[])
case 'r':
rflag = TRUE;
break;
- case '?':
+ case 'h':
default:
- (void) fprintf(stderr, "usage: cribbage [-emqr]\n");
+ (void) fprintf(stderr, "usage: %s [-emqr]\n",
+ getprogname());
return 1;
}
diff --git a/games/factor/factor.c b/games/factor/factor.c
index d7457c42bad..fc86828ca25 100644
--- a/games/factor/factor.c
+++ b/games/factor/factor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: factor.c,v 1.26 2016/01/07 16:00:32 tb Exp $ */
+/* $OpenBSD: factor.c,v 1.27 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $ */
/*
@@ -88,9 +88,9 @@ main(int argc, char *argv[])
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
- while ((ch = getopt(argc, argv, "")) != -1) {
+ while ((ch = getopt(argc, argv, "h")) != -1) {
switch (ch) {
- case '?':
+ case 'h':
default:
usage();
}
@@ -286,6 +286,6 @@ pr_bigfact(u_int64_t val) /* Factor this value. */
void
usage(void)
{
- (void)fprintf(stderr, "usage: factor [number ...]\n");
+ (void)fprintf(stderr, "usage: %s [number ...]\n", getprogname());
exit (1);
}
diff --git a/games/fish/fish.c b/games/fish/fish.c
index 48d8e6ee600..2d1d22005fc 100644
--- a/games/fish/fish.c
+++ b/games/fish/fish.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fish.c,v 1.22 2016/01/10 13:35:09 mestre Exp $ */
+/* $OpenBSD: fish.c,v 1.23 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: fish.c,v 1.3 1995/03/23 08:28:18 cgd Exp $ */
/*-
@@ -95,7 +95,6 @@ main(int argc, char *argv[])
case 'p':
promode = 1;
break;
- case '?':
case 'h':
default:
usage();
@@ -489,6 +488,6 @@ instructions(void)
void
usage(void)
{
- (void)fprintf(stderr, "usage: fish [-p]\n");
+ (void)fprintf(stderr, "usage: %s [-p]\n", getprogname());
exit(1);
}
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index 492d0ee06cf..2968e30bdf3 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fortune.c,v 1.52 2016/03/05 11:06:43 tb Exp $ */
+/* $OpenBSD: fortune.c,v 1.53 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $ */
/*-
@@ -247,9 +247,9 @@ getargs(int argc, char *argv[])
ignore_case = 0;
#ifdef DEBUG
- while ((ch = getopt(argc, argv, "aDefilm:osw")) != -1)
+ while ((ch = getopt(argc, argv, "aDefhilm:osw")) != -1)
#else
- while ((ch = getopt(argc, argv, "aefilm:osw")) != -1)
+ while ((ch = getopt(argc, argv, "aefhilm:osw")) != -1)
#endif /* DEBUG */
switch(ch) {
case 'a': /* any fortune */
@@ -287,7 +287,7 @@ getargs(int argc, char *argv[])
case 'i': /* case-insensitive match */
ignore_case = 1;
break;
- case '?':
+ case 'h':
default:
usage();
}
diff --git a/games/fortune/strfile/strfile.c b/games/fortune/strfile/strfile.c
index c8ade5f0fd0..9a9e6dce867 100644
--- a/games/fortune/strfile/strfile.c
+++ b/games/fortune/strfile/strfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strfile.c,v 1.27 2016/01/07 16:00:32 tb Exp $ */
+/* $OpenBSD: strfile.c,v 1.28 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: strfile.c,v 1.4 1995/04/24 12:23:09 cgd Exp $ */
/*-
@@ -257,7 +257,7 @@ getargs(int argc, char *argv[])
extern int optind;
int ch;
- while ((ch = getopt(argc, argv, "c:iorsx")) != -1) {
+ while ((ch = getopt(argc, argv, "c:hiorsx")) != -1) {
switch(ch) {
case 'c': /* new delimiting char */
Delimch = *optarg;
@@ -281,7 +281,7 @@ getargs(int argc, char *argv[])
case 'x': /* set the rotated bit */
Xflag++;
break;
- case '?':
+ case 'h':
default:
usage();
}
@@ -308,7 +308,7 @@ void
usage(void)
{
(void) fprintf(stderr,
- "strfile [-iorsx] [-c char] sourcefile [datafile]\n");
+ "%s [-iorsx] [-c char] sourcefile [datafile]\n", getprogname());
exit(1);
}
diff --git a/games/fortune/unstr/unstr.c b/games/fortune/unstr/unstr.c
index 2e51170240f..f48c19a47e1 100644
--- a/games/fortune/unstr/unstr.c
+++ b/games/fortune/unstr/unstr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unstr.c,v 1.14 2016/01/10 13:35:09 mestre Exp $ */
+/* $OpenBSD: unstr.c,v 1.15 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: unstr.c,v 1.3 1995/03/23 08:29:00 cgd Exp $ */
/*-
@@ -101,7 +101,7 @@ void
getargs(char *av[])
{
if (!*++av) {
- (void) fprintf(stderr, "usage: unstr datafile\n");
+ (void) fprintf(stderr, "usage: %s datafile\n", getprogname());
exit(1);
}
Infile = *av;
diff --git a/games/grdc/grdc.c b/games/grdc/grdc.c
index ae49b2bc324..e1d770b46dd 100644
--- a/games/grdc/grdc.c
+++ b/games/grdc/grdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grdc.c,v 1.25 2016/01/07 16:00:32 tb Exp $ */
+/* $OpenBSD: grdc.c,v 1.26 2016/03/07 12:07:56 mestre Exp $ */
/*
*
* Copyright 2002 Amos Shapir. Public domain.
@@ -79,7 +79,6 @@ main(int argc, char *argv[])
scrol = 1;
break;
case 'h':
- case '?':
default:
usage();
}
@@ -233,7 +232,8 @@ main(int argc, char *argv[])
clear();
refresh();
endwin();
- fprintf(stderr, "grdc terminated by signal %d\n", sigtermed);
+ fprintf(stderr, "%s terminated by signal %d\n",
+ getprogname(), sigtermed);
return 1;
}
} while (n == 0 || nowtv.tv_sec < endtv.tv_sec);
@@ -293,6 +293,6 @@ getwinsize(int *wid, int *ht)
void
usage(void)
{
- (void)fprintf(stderr, "usage: grdc [-s] [number]\n");
+ (void)fprintf(stderr, "usage: %s [-s] [number]\n", getprogname());
exit(1);
}
diff --git a/games/hunt/hunt/hunt.c b/games/hunt/hunt/hunt.c
index 84c3b6265de..dae57951cac 100644
--- a/games/hunt/hunt/hunt.c
+++ b/games/hunt/hunt/hunt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hunt.c,v 1.20 2016/01/10 14:10:39 mestre Exp $ */
+/* $OpenBSD: hunt.c,v 1.21 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: hunt.c,v 1.8 1998/09/13 15:27:28 hubertf Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -141,9 +141,9 @@ main(int ac, char **av)
break;
default:
usage:
- fputs("usage: hunt [-bcfmqSs] [-n name] [-p port] "
- "[-t team] [-w message] [[-h] host]\n",
- stderr);
+ fprintf(stderr, "usage: %s [-bcfmqSs] [-n name] "
+ "[-p port] [-t team] [-w message] [[-h] host]\n",
+ getprogname());
return 1;
}
}
diff --git a/games/morse/morse.c b/games/morse/morse.c
index ae246ad67e0..f703b5c8434 100644
--- a/games/morse/morse.c
+++ b/games/morse/morse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: morse.c,v 1.21 2016/01/19 23:21:26 sthen Exp $ */
+/* $OpenBSD: morse.c,v 1.22 2016/03/07 12:07:56 mestre Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -142,9 +142,10 @@ main(int argc, char *argv[])
case 's':
sflag = 1;
break;
- case '?': case 'h':
+ case 'h':
default:
- fprintf(stderr, "usage: morse [-d | -s] [string ...]\n");
+ fprintf(stderr, "usage: %s [-d | -s] [string ...]\n",
+ getprogname());
return 1;
}
argc -= optind;
diff --git a/games/number/number.c b/games/number/number.c
index 749e9b9efe4..aeef08913b4 100644
--- a/games/number/number.c
+++ b/games/number/number.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: number.c,v 1.19 2016/01/07 16:00:33 tb Exp $ */
+/* $OpenBSD: number.c,v 1.20 2016/03/07 12:07:56 mestre Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@@ -85,7 +85,6 @@ main(int argc, char *argv[])
case 'l':
lflag = 1;
break;
- case '?':
case 'h':
default:
usage();
@@ -328,6 +327,6 @@ pfract(int len)
void
usage(void)
{
- (void)fprintf(stderr, "usage: number [-l] [--] [# ...]\n");
+ (void)fprintf(stderr, "usage: %s [-l] [--] [# ...]\n", getprogname());
exit(1);
}
diff --git a/games/phantasia/setup.c b/games/phantasia/setup.c
index 899d728066e..24ff234f8ca 100644
--- a/games/phantasia/setup.c
+++ b/games/phantasia/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.18 2016/01/10 13:35:10 mestre Exp $ */
+/* $OpenBSD: setup.c,v 1.19 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: setup.c,v 1.4 1995/04/24 12:24:41 cgd Exp $ */
/*
@@ -77,12 +77,12 @@ main(int argc, char *argv[])
int ch;
char path[PATH_MAX], *prefix;
- while ((ch = getopt(argc, argv, "m:")) != -1)
+ while ((ch = getopt(argc, argv, "hm:")) != -1)
switch(ch) {
case 'm':
monsterfile = optarg;
break;
- case '?':
+ case 'h':
default:
break;
}
diff --git a/games/pig/pig.c b/games/pig/pig.c
index 4818cd72366..9a65e17ba97 100644
--- a/games/pig/pig.c
+++ b/games/pig/pig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pig.c,v 1.16 2016/01/07 16:00:33 tb Exp $ */
+/* $OpenBSD: pig.c,v 1.17 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: pig.c,v 1.2 1995/03/23 08:41:40 cgd Exp $ */
/*-
@@ -50,9 +50,9 @@ main(int argc, char *argv[])
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
- while ((ch = getopt(argc, argv, "")) != -1)
+ while ((ch = getopt(argc, argv, "h")) != -1)
switch(ch) {
- case '?':
+ case 'h':
default:
usage();
}
@@ -117,6 +117,6 @@ pigout(char *buf, int len)
void
usage(void)
{
- (void)fprintf(stderr, "usage: pig\n");
+ (void)fprintf(stderr, "usage: %s\n", getprogname());
exit(1);
}
diff --git a/games/pom/pom.c b/games/pom/pom.c
index e8e61792f48..d50b8845da5 100644
--- a/games/pom/pom.c
+++ b/games/pom/pom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pom.c,v 1.21 2016/01/07 16:00:33 tb Exp $ */
+/* $OpenBSD: pom.c,v 1.22 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: pom.c,v 1.6 1996/02/06 22:47:29 jtc Exp $ */
/*
@@ -261,6 +261,7 @@ void
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(1);
}
diff --git a/games/ppt/ppt.c b/games/ppt/ppt.c
index cd997f7f043..89fd3fb4e8c 100644
--- a/games/ppt/ppt.c
+++ b/games/ppt/ppt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppt.c,v 1.16 2016/01/07 16:00:33 tb Exp $ */
+/* $OpenBSD: ppt.c,v 1.17 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: ppt.c,v 1.4 1995/03/23 08:35:40 cgd Exp $ */
/*
@@ -71,7 +71,7 @@ main(int argc, char **argv)
case 'b':
bflag = 1;
break;
- case '?': case 'h':
+ case 'h':
default:
usage();
}
diff --git a/games/primes/primes.c b/games/primes/primes.c
index 26eaf6760f4..b8e2cad0f54 100644
--- a/games/primes/primes.c
+++ b/games/primes/primes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: primes.c,v 1.21 2016/01/07 16:00:33 tb Exp $ */
+/* $OpenBSD: primes.c,v 1.22 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: primes.c,v 1.5 1995/04/24 12:24:47 cgd Exp $ */
/*
@@ -104,9 +104,9 @@ main(int argc, char *argv[])
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
- while ((ch = getopt(argc, argv, "")) != -1) {
+ while ((ch = getopt(argc, argv, "h")) != -1) {
switch (ch) {
- case '?':
+ case 'h':
default:
usage();
}
@@ -322,6 +322,6 @@ primes(ubig start, ubig stop)
void
usage(void)
{
- (void)fprintf(stderr, "usage: primes [start [stop]]\n");
+ (void)fprintf(stderr, "usage: %s [start [stop]]\n", getprogname());
exit(1);
}
diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c
index 0f95982cbf9..c1b33ca9328 100644
--- a/games/quiz/quiz.c
+++ b/games/quiz/quiz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: quiz.c,v 1.28 2016/01/10 13:35:10 mestre Exp $ */
+/* $OpenBSD: quiz.c,v 1.29 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: quiz.c,v 1.9 1995/04/22 10:16:58 cgd Exp $ */
/*-
@@ -68,7 +68,7 @@ main(int argc, char *argv[])
err(1, "pledge");
indexfile = _PATH_QUIZIDX;
- while ((ch = getopt(argc, argv, "i:t")) != -1)
+ while ((ch = getopt(argc, argv, "hi:t")) != -1)
switch(ch) {
case 'i':
indexfile = optarg;
@@ -76,7 +76,7 @@ main(int argc, char *argv[])
case 't':
tflag = 1;
break;
- case '?':
+ case 'h':
default:
usage();
}
@@ -363,6 +363,6 @@ void
usage(void)
{
(void)fprintf(stderr,
- "usage: quiz [-t] [-i file] category1 category2\n");
+ "usage: %s [-t] [-i file] category1 category2\n", getprogname());
exit(1);
}
diff --git a/games/random/random.c b/games/random/random.c
index 2dd07eaf269..a1b22744d22 100644
--- a/games/random/random.c
+++ b/games/random/random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: random.c,v 1.19 2016/01/10 13:35:10 mestre Exp $ */
+/* $OpenBSD: random.c,v 1.20 2016/03/07 12:07:56 mestre Exp $ */
/* $NetBSD: random.c,v 1.3 1995/04/22 07:44:05 cgd Exp $ */
/*
@@ -61,7 +61,7 @@ main(int argc, char *argv[])
unbuffer_output = 1;
break;
default:
- case '?': case 'h':
+ case 'h':
usage();
}
@@ -123,6 +123,6 @@ void
usage(void)
{
- (void)fprintf(stderr, "usage: random [-er] [denominator]\n");
+ (void)fprintf(stderr, "usage: %s [-er] [denominator]\n", getprogname());
exit(1);
}
diff --git a/games/robots/main.c b/games/robots/main.c
index d8b5ef9158f..dd082a90624 100644
--- a/games/robots/main.c
+++ b/games/robots/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.24 2016/01/07 16:00:33 tb Exp $ */
+/* $OpenBSD: main.c,v 1.25 2016/03/07 12:07:57 mestre Exp $ */
/* $NetBSD: main.c,v 1.5 1995/04/22 10:08:54 cgd Exp $ */
/*
@@ -43,7 +43,7 @@
void
usage(void)
{
- fprintf(stderr, "usage: robots [-ajrst] [scorefile]\n");
+ fprintf(stderr, "usage: %s [-ajrst] [scorefile]\n", getprogname());
exit(1);
}
diff --git a/games/snake/snake.c b/games/snake/snake.c
index 69f3b2f677e..32b6a3a8bef 100644
--- a/games/snake/snake.c
+++ b/games/snake/snake.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snake.c,v 1.25 2016/02/09 13:41:59 mestre Exp $ */
+/* $OpenBSD: snake.c,v 1.26 2016/03/07 12:07:57 mestre Exp $ */
/* $NetBSD: snake.c,v 1.8 1995/04/29 00:06:41 mycroft Exp $ */
/*
@@ -171,7 +171,6 @@ main(int argc, char *argv[])
case 't': /* slow terminal */
fast = 0;
break;
- case '?':
case 'h':
default:
fprintf(stderr, "usage: %s [-st] [-l length] "
diff --git a/games/tetris/tetris.c b/games/tetris/tetris.c
index 90ce7d0f838..73ceaae708b 100644
--- a/games/tetris/tetris.c
+++ b/games/tetris/tetris.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tetris.c,v 1.29 2016/01/07 16:00:33 tb Exp $ */
+/* $OpenBSD: tetris.c,v 1.30 2016/03/07 12:07:57 mestre Exp $ */
/* $NetBSD: tetris.c,v 1.2 1995/04/22 07:42:47 cgd Exp $ */
/*-
@@ -356,6 +356,7 @@ onintr(int signo)
void
usage(void)
{
- (void)fprintf(stderr, "usage: tetris [-cps] [-k keys] [-l level]\n");
+ (void)fprintf(stderr, "usage: %s [-cps] [-k keys] "
+ "[-l level]\n", getprogname());
exit(1);
}
diff --git a/games/wump/wump.c b/games/wump/wump.c
index 441223a3cc8..e41319af67a 100644
--- a/games/wump/wump.c
+++ b/games/wump/wump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wump.c,v 1.32 2016/01/10 13:35:10 mestre Exp $ */
+/* $OpenBSD: wump.c,v 1.33 2016/03/07 12:07:57 mestre Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -179,7 +179,6 @@ main(int argc, char *argv[])
errx(1,
"wumpii like extra doors in their caves!");
break;
- case '?':
default:
usage();
}
@@ -909,8 +908,8 @@ void
usage(void)
{
(void)fprintf(stderr,
- "usage: wump [-ho] [-a arrows] [-b bats] [-p pits] "
- "[-r rooms] [-t tunnels]\n");
+ "usage: %s [-ho] [-a arrows] [-b bats] [-p pits] "
+ "[-r rooms] [-t tunnels]\n", getprogname());
exit(1);
}