]> git.pld-linux.org Git - packages/fortune-mod.git/blob - fortune-mod-display-source.patch
- obsolete
[packages/fortune-mod.git] / fortune-mod-display-source.patch
1 diff -ur fortune-mod-9708/fortune/fortune.6 fortune-mod-9708-/fortune/fortune.6
2 --- fortune-mod-9708/fortune/fortune.6  Mon Apr 24 20:16:52 1995
3 +++ fortune-mod-9708-/fortune/fortune.6 Tue Jun  4 17:54:23 2002
4 @@ -110,6 +110,8 @@
5  number of characters in the message.
6  This is useful if it is executed as part of the logout procedure
7  to guarantee that the message can be read before the screen is cleared.
8 +.It Fl d
9 +Display source of fortune before it (i.e. file it comes from in []).
10  .El
11  .Pp
12  The user may specify alternate sayings.
13 diff -ur fortune-mod-9708/fortune/fortune.c fortune-mod-9708-/fortune/fortune.c
14 --- fortune-mod-9708/fortune/fortune.c  Tue Jun  4 17:55:30 2002
15 +++ fortune-mod-9708-/fortune/fortune.c Tue Jun  4 17:47:52 2002
16 @@ -168,6 +168,7 @@
17  bool Offend = FALSE;           /* offensive fortunes only */
18  bool All_forts = FALSE;                /* any fortune allowed */
19  bool Equal_probs = FALSE;      /* scatter un-allocated prob equally */
20 +bool Display_source = FALSE;   /* display [fortune-file] before fortune */
21  
22  #ifndef NO_REGEX
23  bool Match = FALSE;            /* dump fortunes matching a pattern */
24 @@ -232,7 +233,7 @@
25  #ifndef        NO_REGEX
26      (void) fprintf(stderr, "i");
27  #endif /* NO_REGEX */
28 -    (void) fprintf(stderr, "losw]");
29 +    (void) fprintf(stderr, "loswd]");
30  #ifndef        NO_REGEX
31      (void) fprintf(stderr, " [-m pattern]");
32  #endif /* NO_REGEX */
33 @@ -709,9 +710,9 @@
34      ignore_case = FALSE;
35  
36  #ifdef DEBUG
37 -    while ((ch = getopt(argc, argv, "aDefilm:n:osvw")) != EOF)
38 +    while ((ch = getopt(argc, argv, "aDefilm:n:osdvw")) != EOF)
39  #else
40 -    while ((ch = getopt(argc, argv, "aefilm:n:osvw")) != EOF)
41 +    while ((ch = getopt(argc, argv, "aefilm:n:osdvw")) != EOF)
42  #endif /* DEBUG */
43         switch (ch)
44           {
45 @@ -733,6 +734,9 @@
46               Long_only++;
47               Short_only = FALSE;
48               break;
49 +         case 'd':
50 +             Display_source++;
51 +             break;
52           case 'n':
53               SLEN = atoi(optarg);
54               break;
55 @@ -1213,6 +1217,9 @@
56      register char *p, ch;
57      unsigned char line[BUFSIZ];
58  
59 +    if (Display_source)
60 +        printf("[%s]\n\n", fp->name);
61 +       
62      open_fp(fp);
63      fseek(fp->inf, (long) Seekpts[0], 0);
64      for (Fort_len = 0; fgets(line, sizeof line, fp->inf) != NULL &&
This page took 0.060116 seconds and 3 git commands to generate.