diff options
author | jsm <jsm@NetBSD.org> | 2002-01-20 00:42:51 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 2002-01-20 00:42:51 +0000 |
commit | 067a8b32991f06a59ed967af92ffa3d577522fd2 (patch) | |
tree | e2a7ce72009b355c7eb8c4c7ef384648261fcf2c /hangman/main.c | |
parent | 8559db615a9f7ef8bc1aa991f6370ad5ef72ae31 (diff) | |
download | bsdgames-darwin-067a8b32991f06a59ed967af92ffa3d577522fd2.tar.gz bsdgames-darwin-067a8b32991f06a59ed967af92ffa3d577522fd2.tar.zst bsdgames-darwin-067a8b32991f06a59ed967af92ffa3d577522fd2.zip |
Allow minimum word length to be set on command line. Patch based on
one by Joey Hess <joeyh@debian.org>.
Diffstat (limited to 'hangman/main.c')
-rw-r--r-- | hangman/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/hangman/main.c b/hangman/main.c index 39fd09bd..3b94565c 100644 --- a/hangman/main.c +++ b/hangman/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.9 2000/05/08 07:56:04 mycroft Exp $ */ +/* $NetBSD: main.c,v 1.10 2002/01/20 00:42:51 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,10 +43,11 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.9 2000/05/08 07:56:04 mycroft Exp $"); +__RCSID("$NetBSD: main.c,v 1.10 2002/01/20 00:42:51 jsm Exp $"); #endif #endif /* not lint */ +#include <err.h> #include "hangman.h" /* @@ -62,14 +63,19 @@ main(argc, argv) /* Revoke setgid privileges */ setgid(getgid()); - while ((ch = getopt(argc, argv, "d:")) != -1) { + while ((ch = getopt(argc, argv, "d:m:")) != -1) { switch (ch) { case 'd': Dict_name = optarg; break; + case 'm': + Minlen = atoi(optarg); + if (Minlen < 2) + errx(1, "minimum word length too short"); + break; case '?': default: - (void)fprintf(stderr, "usage: hangman [-d wordlist]\n"); + (void)fprintf(stderr, "usage: hangman [-d wordlist] [-m minlen]\n"); exit(1); } } |