Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170459996
D59057.id185295.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D59057.id185295.diff
View Options
diff --git a/usr.bin/fortune/fortune/fortune.6 b/usr.bin/fortune/fortune/fortune.6
--- a/usr.bin/fortune/fortune/fortune.6
+++ b/usr.bin/fortune/fortune/fortune.6
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 1, 2021
+.Dd August 20, 2026
.Dt FORTUNE 6
.Os
.Sh NAME
@@ -46,6 +46,12 @@
When
.Nm
is run with no arguments it prints out a random epigram.
+It prefers a database named
+.Pa fortunes
+if one exists in the search path; otherwise it uses every database
+in that path, including the base system's
+.Pa freebsd-tips
+file and any files installed by ports.
Epigrams are divided into several categories, where each category
is subdivided into those which are potentially offensive and those
which are not.
@@ -172,9 +178,13 @@
it was up to on disk.
.El
.Sh FILES
-.Bl -tag -width ".Pa /usr/share/games/fortune/*"
+.Bl -tag -width ".Pa /usr/local/share/games/fortune/*"
.It Pa /usr/share/games/fortune/*
-the fortunes databases (those files ending
+the base system fortune databases, currently
+.Pa freebsd-tips
+.It Pa /usr/local/share/games/fortune/*
+additional databases installed by ports
+(those files ending in
.Dq Pa -o
contain the
.Sy offensive
diff --git a/usr.bin/fortune/fortune/fortune.c b/usr.bin/fortune/fortune/fortune.c
--- a/usr.bin/fortune/fortune/fortune.c
+++ b/usr.bin/fortune/fortune/fortune.c
@@ -85,7 +85,6 @@
static bool Found_one; /* did we find a match? */
static bool Find_files = FALSE; /* just find a list of proper fortune files */
-static bool Fortunes_only = FALSE; /* check only "fortunes" files */
static bool Wait = FALSE; /* wait desired after fortune */
static bool Short_only = FALSE; /* short fortune desired */
static bool Long_only = FALSE; /* long fortune desired */
@@ -352,33 +351,32 @@
char **pstr;
if (file_cnt == 0) {
- if (Find_files) {
- Fortunes_only = TRUE;
+ /*
+ * Prefer a database named "fortunes" so a port that
+ * restores that file keeps the historic default. If
+ * it is absent (the base system has shipped only
+ * freebsd-tips since the other datfiles left src),
+ * use every database in the search path. LOCALBASE
+ * stays on that path; port cookies are not moved.
+ */
+ pstr = Fortune_path_arr;
+ i = 0;
+ while (*pstr) {
+ i += add_file(NO_PROB, "fortunes", *pstr++,
+ &File_list, &File_tail, NULL);
+ }
+ if (!i) {
pstr = Fortune_path_arr;
- i = 0;
while (*pstr) {
i += add_file(NO_PROB, *pstr++, NULL,
&File_list, &File_tail, NULL);
}
- Fortunes_only = FALSE;
- if (!i) {
- fprintf(stderr, "No fortunes found in %s.\n",
- Fortune_path);
- }
- return (i != 0);
- } else {
- pstr = Fortune_path_arr;
- i = 0;
- while (*pstr) {
- i += add_file(NO_PROB, "fortunes", *pstr++,
- &File_list, &File_tail, NULL);
- }
- if (!i) {
- fprintf(stderr, "No fortunes found in %s.\n",
- Fortune_path);
- }
- return (i != 0);
}
+ if (!i) {
+ fprintf(stderr, "No fortunes found in %s.\n",
+ Fortune_path);
+ }
+ return (i != 0);
}
for (i = 0; i < file_cnt; i++) {
percent = NO_PROB;
@@ -776,10 +774,6 @@
DPRINTF(2, (stderr, "FALSE (file starts with '.')\n"));
return (FALSE);
}
- if (Fortunes_only && strncmp(sp, "fortunes", 8) != 0) {
- DPRINTF(2, (stderr, "FALSE (check fortunes only)\n"));
- return (FALSE);
- }
if ((sp = strrchr(sp, '.')) != NULL) {
sp++;
for (i = 0; suflist[i] != NULL; i++)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 5, 10:32 PM (3 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37617906
Default Alt Text
D59057.id185295.diff (3 KB)
Attached To
Mode
D59057: fortune: fall back to all databases if fortunes is missing
Attached
Detach File
Event Timeline
Log In to Comment