When I run fortune in pattern match mode (fortune -m) it will
exit 1 when a pattern is found and 0 when not.

hp1$ uname -a
OpenBSD hp1.my.domain 6.8 GENERIC.MP#240 amd64
hp1$ fortune -m INQ ; echo $?
%% (fortunes)
NOBODY EXPECTS THE SPANISH INQUISITION.
1
hp1$ fortune -m XINQ ; echo $?
0

I think it should be the other way round.

tilo

Index: fortune.c
===================================================================
RCS file: /cvs/src/games/fortune/fortune/fortune.c,v
retrieving revision 1.61
diff -u -p -r1.61 fortune.c
--- fortune.c   15 Dec 2020 14:06:32 -0000      1.61
+++ fortune.c   26 Dec 2020 19:03:05 -0000
@@ -160,7 +160,7 @@ main(int ac, char *av[])
        getargs(ac, av);

        if (Match)
-               return find_matches() != 0;
+               return find_matches() == 0;

        init_prob();
        if ((Short_only && minlen_in_list(File_list) > SLEN) ||

Reply via email to