From 116ce841b0cf38330e4a68967b368eafbba6fe77 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Mon, 21 Oct 2024 06:39:04 +0000 Subject: Emit a warning if all fortunes in the file are too short or too long From Nir Lichtman --- games/fortune/fortune/fortune.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'games/fortune') 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(); -- cgit v1.2.3