From d0194c03fb908d887912d1edbd6e6340aee64b7b Mon Sep 17 00:00:00 2001 From: "Daniel C. Sobral" Date: Tue, 9 Mar 1999 11:44:51 +0000 Subject: [PATCH] Document -D option. Give a more helpful error message for some cases. PR: bin/10152 Obtained from: Matthew D. Fuller --- games/fortune/fortune/fortune.6 | 8 ++++++-- games/fortune/fortune/fortune.c | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/games/fortune/fortune/fortune.6 b/games/fortune/fortune/fortune.6 index 57b36dbddeed..62265c058ea0 100644 --- a/games/fortune/fortune/fortune.6 +++ b/games/fortune/fortune/fortune.6 @@ -33,7 +33,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)fortune.6 8.3 (Berkeley) 4/19/94 -.\" $Id$ +.\" $Id: fortune.6,v 1.5 1997/02/22 14:46:50 peter Exp $ .\" .Dd April 19, 1994 .Dt FORTUNE 6 @@ -43,7 +43,7 @@ .Nd "print a random, hopefully interesting, adage" .Sh SYNOPSIS .Nm fortune -.Op Fl aefilosw +.Op Fl aDefilosw .Op Fl m Ar pattern .Oo .Op Ar \&N% @@ -63,6 +63,10 @@ Choose from all lists of maxims, both offensive and not. (See the .Fl o option for more information on offensive fortunes.) +.It Fl D +Enable additional debugging output. +Specify this option multiple times for more verbose output. +Only available if compiled with -DDEBUG. .It Fl e Consider all fortune files to be of equal size (see discussion below on multiple files). diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c index 6d7ec8819030..9d7671c3ed8d 100644 --- a/games/fortune/fortune/fortune.c +++ b/games/fortune/fortune/fortune.c @@ -799,8 +799,12 @@ int check_for_offend; datfile = copy(file, (unsigned int) (strlen(file) + 4)); /* +4 for ".dat" */ strcat(datfile, ".dat"); if (access(datfile, R_OK) < 0) { + DPRINTF(2, (stderr, "FALSE (no readable \".dat\" file)\n")); +#ifdef DEBUG + if (Debug < 2) + DPRINTF(0, (stderr, "Warning: file \"%s\" unreadable\n", datfile)); +#endif free(datfile); - DPRINTF(2, (stderr, "FALSE (no \".dat\" file)\n")); return FALSE; } if (datp != NULL)