summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-10-21 06:39:04 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-10-21 06:39:04 +0000
commit116ce841b0cf38330e4a68967b368eafbba6fe77 (patch)
tree3360dc0df5a62b70b89f1fd5db84de555dfb76ca /games
parent563a2e5af53192f350bd8128696465e47d11916b (diff)
Emit a warning if all fortunes in the file are too short or too long
From Nir Lichtman
Diffstat (limited to 'games')
-rw-r--r--games/fortune/fortune/fortune.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c
index eb5a78f0e93..3cc8b450c01 100644
--- a/games/fortune/fortune/fortune.c
+++ b/games/fortune/fortune/fortune.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fortune.c,v 1.66 2024/10/20 21:07:58 tb Exp $ */
+/* $OpenBSD: fortune.c,v 1.67 2024/10/21 06:39:03 tb Exp $ */
/* $NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $ */
/*-
@@ -163,8 +163,11 @@ main(int ac, char *av[])
init_prob();
if ((Short_only && minlen_in_list(File_list) > SLEN) ||
- (Long_only && maxlen_in_list(File_list) <= SLEN))
+ (Long_only && maxlen_in_list(File_list) <= SLEN)) {
+ fprintf(stderr,
+ "no fortunes matching length constraint found\n");
return 1;
+ }
do {
get_fort();