diff -ur fortune-mod-9708/fortune/fortune.6 fortune-mod-9708-/fortune/fortune.6 --- fortune-mod-9708/fortune/fortune.6 Mon Apr 24 20:16:52 1995 +++ fortune-mod-9708-/fortune/fortune.6 Tue Jun 4 17:54:23 2002 @@ -110,6 +110,8 @@ number of characters in the message. This is useful if it is executed as part of the logout procedure to guarantee that the message can be read before the screen is cleared. +.It Fl d +Display source of fortune before it (i.e. file it comes from in []). .El .Pp The user may specify alternate sayings. diff -ur fortune-mod-9708/fortune/fortune.c fortune-mod-9708-/fortune/fortune.c --- fortune-mod-9708/fortune/fortune.c Tue Jun 4 17:55:30 2002 +++ fortune-mod-9708-/fortune/fortune.c Tue Jun 4 17:47:52 2002 @@ -168,6 +168,7 @@ bool Offend = FALSE; /* offensive fortunes only */ bool All_forts = FALSE; /* any fortune allowed */ bool Equal_probs = FALSE; /* scatter un-allocated prob equally */ +bool Display_source = FALSE; /* display [fortune-file] before fortune */ #ifndef NO_REGEX bool Match = FALSE; /* dump fortunes matching a pattern */ @@ -232,7 +233,7 @@ #ifndef NO_REGEX (void) fprintf(stderr, "i"); #endif /* NO_REGEX */ - (void) fprintf(stderr, "losw]"); + (void) fprintf(stderr, "loswd]"); #ifndef NO_REGEX (void) fprintf(stderr, " [-m pattern]"); #endif /* NO_REGEX */ @@ -709,9 +710,9 @@ ignore_case = FALSE; #ifdef DEBUG - while ((ch = getopt(argc, argv, "aDefilm:n:osvw")) != EOF) + while ((ch = getopt(argc, argv, "aDefilm:n:osdvw")) != EOF) #else - while ((ch = getopt(argc, argv, "aefilm:n:osvw")) != EOF) + while ((ch = getopt(argc, argv, "aefilm:n:osdvw")) != EOF) #endif /* DEBUG */ switch (ch) { @@ -733,6 +734,9 @@ Long_only++; Short_only = FALSE; break; + case 'd': + Display_source++; + break; case 'n': SLEN = atoi(optarg); break; @@ -1213,6 +1217,9 @@ register char *p, ch; unsigned char line[BUFSIZ]; + if (Display_source) + printf("[%s]\n\n", fp->name); + open_fp(fp); fseek(fp->inf, (long) Seekpts[0], 0); for (Fort_len = 0; fgets(line, sizeof line, fp->inf) != NULL &&