summaryrefslogtreecommitdiff
path: root/games-misc/fortune-mod/files/fortune-mod-1.99.1-gentoo.patch
blob: 97f04259ba9290ff549c2e0cf980741297d59f42 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
--- a/datfiles/Makefile
+++ b/datfiles/Makefile
@@ -58,7 +58,7 @@
 	if [ $(WEB) = 1 ] ; then cd html && $(MAKE) install ; fi
 	for i in $(COOKIES) ; do \
 		install -m 0644 $$i $$i.dat $(COOKIEDIR) || exit $? ; \
-		cp -d $$i.u8 $(COOKIEDIR) ; \
+		cp -P $$i.u8 $(COOKIEDIR) ; \
 		done
 
 clean:
--- a/datfiles/off/Makefile
+++ b/datfiles/off/Makefile
@@ -38,7 +38,7 @@
 	install -m 0755 -d $(OCOOKIEDIR)
 	for i in $(OCOOKIES) ; \
 	    do install -m 0644 $$i $$i.dat $(OCOOKIEDIR) || exit $$? ; \
-	    cp -d $$i.u8 $(OCOOKIEDIR) ; \
+	    cp -P $$i.u8 $(OCOOKIEDIR) ; \
 	done
 
 clean:
--- a/Makefile
+++ b/Makefile
@@ -65,8 +65,7 @@
 RECODELIBS=-lrecode
 
 DEFINES=-DFORTDIR="\"$(COOKIEDIR)\"" -DOFFDIR="\"$(OCOOKIEDIR)\"" -DLOCFORTDIR="\"$(LOCALDIR)\"" -DLOCOFFDIR="\"$(LOCALODIR)\""
-CFLAGS=-O2 $(DEFINES) -Wall -fomit-frame-pointer -pipe -fsigned-char
-LDFLAGS=-s
+CFLAGS += $(DEFINES) -fsigned-char
 
 # The above flags are used by default; the debug flags are used when make
 # is called with a debug target, such as 'make debug'
--- a/fortune/fortune.c
+++ b/fortune/fortune.c
@@ -97,7 +97,7 @@
 #endif /* killing warnings */
 
 #define		PROGRAM_NAME		"fortune-mod"
-#define		PROGRAM_VERSION		"9708"
+#define		PROGRAM_VERSION		"1.99.1"
 
 #ifdef HAVE_STDBOOL_H
 #include <stdbool.h>
@@ -256,6 +256,7 @@
 
 int add_dir(register FILEDESC *);
 
+const char *program_name;
 char *program_version(void)
 {
     static char buf[BUFSIZ];
@@ -1675,14 +1675,17 @@
     char *ctype, *crequest;
     getargs(ac, av);
 
+    program_name = (char *const) av[0];
     outer = recode_new_outer(true);
     request = recode_new_request (outer);
 
     setlocale(LC_ALL,"");
     ctype = nl_langinfo(CODESET);
-    if(strcmp(ctype,"ANSI_X3.4-1968") == 0)
-        ctype="ISO-8859-1";
-	
+    if (!ctype || !*ctype)
+    	ctype="C"; /* revert to C if no valid envvars! */
+    else
+    	if(strcmp(ctype,"ANSI_X3.4-1968") == 0)
+    		ctype="ISO-8859-1";
     crequest = malloc(strlen(ctype) + 7 + 1);
     sprintf(crequest, "UTF-8..%s", ctype);
     recode_scan_request (request, crequest);
--- a/util/rot.c
+++ b/util/rot.c
@@ -5,10 +5,11 @@
 
 #include <stdio.h>
 #include <ctype.h>
+#include <stdlib.h>
 
 int main(void)
 {
-    char a, b;
+    short int a, b;
 
     while ((a = getchar()) != EOF)
     {
--- a/util/unstr.c
+++ b/util/unstr.c
@@ -96,6 +96,7 @@
 #include	<string.h>
 #include	<unistd.h>
 
+#include	<stdlib.h>
 #ifndef MAXPATHLEN
 #define	MAXPATHLEN	1024
 #endif /* MAXPATHLEN */