File: fortune.c.diff

package info (click to toggle)
fortune-mod 1%3A1.99.1-9
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 14,024 kB
  • sloc: ansic: 1,957; makefile: 244; python: 35; sh: 15
file content (53 lines) | stat: -rw-r--r-- 1,730 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Description: Add No_recode option. 
Origin: fortune-mod/1.99.1-4

--- b/fortune/fortune.c
+++ a/fortune/fortune.c
@@ -206,6 +206,7 @@ bool Offend = FALSE;		/* offensive fortunes only */
 bool All_forts = FALSE;		/* any fortune allowed */
 bool Equal_probs = FALSE;	/* scatter un-allocated prob equally */
 bool Show_filename = FALSE;
+bool No_recode = FALSE;		/* Do we want to stop recoding from occuring */
 
 bool ErrorMessage = FALSE;	/* Set to true if an error message has been displayed */
 
@@ -1013,9 +1014,9 @@ void getargs(int argc, char **argv)
     ignore_case = FALSE;
 
 #ifdef DEBUG
-    while ((ch = getopt(argc, argv, "acDefilm:n:osvw")) != EOF)
+    while ((ch = getopt(argc, argv, "acDefilm:n:osuvw")) != EOF)
 #else
-    while ((ch = getopt(argc, argv, "acefilm:n:osvw")) != EOF)
+    while ((ch = getopt(argc, argv, "acefilm:n:osuvw")) != EOF)
 #endif /* DEBUG */
 	switch (ch)
 	  {
@@ -1050,6 +1051,9 @@ void getargs(int argc, char **argv)
 	  case 'w':		/* give time to read */
 	      Wait++;
 	      break;
+	  case 'u':		/* Don't recode the fortune */
+	      No_recode++;
+	      break;
 #ifdef	NO_REGEX
 	  case 'i':		/* case-insensitive match */
 	  case 'm':		/* dump out the fortunes */
@@ -1544,7 +1548,7 @@ void matches_in_list(FILEDESC * list)
 		*sp = '\0';
 		nchar = sp - Fortbuf;
 
-		if (fp->utf8_charset) 
+		if (fp->utf8_charset && No_recode == FALSE) 
 		{
 		    output = recode_string (request, Fortbuf);
 		} else {
@@ -1626,7 +1630,7 @@ void display(FILEDESC * fp)
 		    *p = 'a' + (ch - 'a' + 13) % 26;
 	    }
 	}
-	if(fp->utf8_charset) {
+	if(fp->utf8_charset && No_recode == FALSE) {
 	    char *output;
 	    output = recode_string (request, line);
 	    fputs(output, stdout);