]> git.pld-linux.org Git - packages/antiword.git/blob - antiword-globalconf.patch
36e6f5d8ad3a969c4571b144383eef444658f071
[packages/antiword.git] / antiword-globalconf.patch
1 diff -Nur antiword.0.31.orig/Resources/fontnames antiword.0.31/Resources/fontnames
2 --- antiword.0.31.orig/Resources/fontnames      Thu Jan  1 01:00:00 1970
3 +++ antiword.0.31/Resources/fontnames   Wed Feb 14 23:31:17 2001
4 @@ -0,0 +1,109 @@
5 +# Default fontnames translation table
6 +# uses only Standard PostScript (TM) fonts
7 +#
8 +# MS-Word fontname,    Italic, Bold,   PostScript fontname,    Special
9 +Arial,                 0,      0,      Helvetica,              0
10 +Arial,                 0,      1,      Helvetica-Bold,         0
11 +Arial,                 1,      0,      Helvetica-Oblique,      0
12 +Arial,                 1,      1,      Helvetica-BoldOblique,  0
13 +Arial Black,           0,      0,      Helvetica,              0
14 +Arial Black,           0,      1,      Helvetica-Bold,         0
15 +Arial Black,           1,      0,      Helvetica-Oblique,      0
16 +Arial Black,           1,      1,      Helvetica-BoldOblique,  0
17 +Arial CE,              0,      0,      Helvetica,              0
18 +Arial CE,              0,      1,      Helvetica-Bold,         0
19 +Arial CE,              1,      0,      Helvetica-Oblique,      0
20 +Arial CE,              1,      1,      Helvetica-BoldOblique,  0
21 +Arial Narrow,          0,      0,      Helvetica-Narrow,       0
22 +Arial Narrow,          0,      1,      Helvetica-Narrow-Bold,  0
23 +Arial Narrow,          1,      0,      Helvetica-Narrow-Oblique,       0
24 +Arial Narrow,          1,      1,      Helvetica-Narrow-BoldOblique,   0
25 +AvantGarde,            0,      0,      AvantGarde-Book,        0
26 +AvantGarde,            0,      1,      AvantGarde-Demi,        0
27 +AvantGarde,            1,      0,      AvantGarde-BookOblique, 0
28 +AvantGarde,            1,      1,      AvantGarde-DemiOblique, 0
29 +Bookman Old Style,     0,      0,      Bookman-Light,          0
30 +Bookman Old Style,     0,      1,      Bookman-Demi,           0
31 +Bookman Old Style,     1,      0,      Bookman-LightItalic,    0
32 +Bookman Old Style,     1,      1,      Bookman-DemiItalic,     0
33 +Century Schoolbook,    0,      0,      NewCenturySchlbk-Roman, 0
34 +Century Schoolbook,    0,      1,      NewCenturySchlbk-Bold,  0
35 +Century Schoolbook,    1,      0,      NewCenturySchlbk-Italic,        0
36 +Century Schoolbook,    1,      1,      NewCenturySchlbk-BoldItalic,    0
37 +Comic Sans MS,         0,      0,      Helvetica,              0
38 +Comic Sans MS,         0,      1,      Helvetica-Bold,         0
39 +Comic Sans MS,         1,      0,      Helvetica-Oblique,      0
40 +Comic Sans MS,         1,      1,      Helvetica-BoldOblique,  0
41 +Courier,               0,      0,      Courier,                0
42 +Courier,               0,      1,      Courier-Bold,           0
43 +Courier,               1,      0,      Courier-Oblique,        0
44 +Courier,               1,      1,      Courier-BoldOblique,    0
45 +Courier New,           0,      0,      Courier,                0
46 +Courier New,           0,      1,      Courier-Bold,           0
47 +Courier New,           1,      0,      Courier-Oblique,        0
48 +Courier New,           1,      1,      Courier-BoldOblique,    0
49 +Fixedsys,              0,      0,      Courier,                0
50 +Fixedsys,              0,      1,      Courier-Bold,           0
51 +Fixedsys,              1,      0,      Courier-Oblique,        0
52 +Fixedsys,              1,      1,      Courier-BoldOblique,    0
53 +Helvetica,             0,      0,      Helvetica,              0
54 +Helvetica,             0,      1,      Helvetica-Bold,         0
55 +Helvetica,             1,      0,      Helvetica-Oblique,      0
56 +Helvetica,             1,      1,      Helvetica-BoldOblique,  0
57 +Helvetica-Narrow,      0,      0,      Helvetica-Narrow,       0
58 +Helvetica-Narrow,      0,      1,      Helvetica-Narrow-Bold,  0
59 +Helvetica-Narrow,      1,      0,      Helvetica-Narrow-Oblique,       0
60 +Helvetica-Narrow,      1,      1,      Helvetica-Narrow-BoldOblique,   0
61 +ITC Bookman,           0,      0,      Bookman-Light,          0
62 +ITC Bookman,           0,      1,      Bookman-Demi,           0
63 +ITC Bookman,           1,      0,      Bookman-LightItalic,    0
64 +ITC Bookman,           1,      1,      Bookman-DemiItalic,     0
65 +Lucida Console,        0,      0,      Courier,                0
66 +Lucida Console,        0,      1,      Courier-Bold,           0
67 +Lucida Console,        1,      0,      Courier-Oblique,        0
68 +Lucida Console,        1,      1,      Courier-BoldOblique,    0
69 +Monotype.com,          0,      0,      Courier,                0
70 +Monotype.com,          0,      1,      Courier-Bold,           0
71 +Monotype.com,          1,      0,      Courier-Oblique,        0
72 +Monotype.com,          1,      1,      Courier-BoldOblique,    0
73 +MS Sans Serif,         0,      0,      Helvetica,              0
74 +MS Sans Serif,         0,      1,      Helvetica-Bold,         0
75 +MS Sans Serif,         1,      0,      Helvetica-Oblique,      0
76 +MS Sans Serif,         1,      1,      Helvetica-BoldOblique,  0
77 +New Century Schlbk,    0,      0,      NewCenturySchlbk-Roman, 0
78 +New Century Schlbk,    0,      1,      NewCenturySchlbk-Bold,  0
79 +New Century Schlbk,    1,      0,      NewCenturySchlbk-Italic,        0
80 +New Century Schlbk,    1,      1,      NewCenturySchlbk-BoldItalic,    0
81 +NewCenturySchlbk,      0,      0,      NewCenturySchlbk-Roman, 0
82 +NewCenturySchlbk,      0,      1,      NewCenturySchlbk-Bold,  0
83 +NewCenturySchlbk,      1,      0,      NewCenturySchlbk-Italic,        0
84 +NewCenturySchlbk,      1,      1,      NewCenturySchlbk-BoldItalic,    0
85 +Palatino,              0,      0,      Palatino-Roman,         0
86 +Palatino,              0,      1,      Palatino-Bold,          0
87 +Palatino,              1,      0,      Palatino-Italic,        0
88 +Palatino,              1,      1,      Palatino-BoldItalic,    0
89 +Swiss,                 0,      0,      Helvetica,              0
90 +Swiss,                 0,      1,      Helvetica-Bold,         0
91 +Swiss,                 1,      0,      Helvetica-Oblique,      0
92 +Swiss,                 1,      1,      Helvetica-BoldOblique,  0
93 +Tahoma,                        0,      0,      Helvetica,              0
94 +Tahoma,                        0,      1,      Helvetica-Bold,         0
95 +Tahoma,                        1,      0,      Helvetica-Oblique,      0
96 +Tahoma,                        1,      1,      Helvetica-BoldOblique,  0
97 +Trebuchet MS,          0,      0,      Helvetica,              0
98 +Trebuchet MS,          0,      1,      Helvetica-Bold,         0
99 +Trebuchet MS,          1,      0,      Helvetica-Oblique,      0
100 +Trebuchet MS,          1,      1,      Helvetica-BoldOblique,  0
101 +Univers,               0,      0,      Helvetica,              0
102 +Univers,               0,      1,      Helvetica-Bold,         0
103 +Univers,               1,      0,      Helvetica-Oblique,      0
104 +Univers,               1,      1,      Helvetica-BoldOblique,  0
105 +Verdana,               0,      0,      Helvetica,              0
106 +Verdana,               0,      1,      Helvetica-Bold,         0
107 +Verdana,               1,      0,      Helvetica-Oblique,      0
108 +Verdana,               1,      1,      Helvetica-BoldOblique,  0
109 +# All the other fonts
110 +*,                     0,      0,      Times-Roman,            0
111 +*,                     0,      1,      Times-Bold,             0
112 +*,                     1,      0,      Times-Italic,           0
113 +*,                     1,      1,      Times-BoldItalic,       0
114 diff -Nur antiword.0.31.orig/antiword.h antiword.0.31/antiword.h
115 --- antiword.0.31.orig/antiword.h       Wed Nov 29 20:54:14 2000
116 +++ antiword.0.31/antiword.h    Wed Feb 14 23:31:17 2001
117 @@ -131,17 +131,19 @@
118  #define TABLE_FONT             "Courier"
119  /* The name of the antiword directory */
120  #if defined(__dos)
121 -#define ANTIWORD_DIR           "antiword"
122 +#define HOME_ANTIWORD_DIR      "antiword"
123 +#define SYS_ANTIWORD_DIR       "antiword"
124  #define FONT_BASENAME          "fontname.txt"
125  #else
126 -#define ANTIWORD_DIR           ".antiword"
127 +#define HOME_ANTIWORD_DIR      ".antiword"
128 +#define SYS_ANTIWORD_DIR       "/usr/share/antiword"
129  #define FONT_BASENAME          "fontnames"
130  #endif /* __dos */
131  /* The name of the font information file */
132 -#define FONTNAMES_FILE         ANTIWORD_DIR FILE_SEPARATOR FONT_BASENAME
133 +#define FONTNAMES_FILE         FONT_BASENAME
134  /* The name of the default mapping file */
135 -#define MAPPING_FILE_DEFAULT_1 ANTIWORD_DIR FILE_SEPARATOR "8859-1.txt"
136 -#define MAPPING_FILE_DEFAULT_2 ANTIWORD_DIR FILE_SEPARATOR "8859-2.txt"
137 +#define MAPPING_FILE_DEFAULT_1 "8859-1.txt"
138 +#define MAPPING_FILE_DEFAULT_2 "8859-2.txt"
139  #endif /* __riscos */
140  
141  /* Prototypes */
142 @@ -286,6 +288,7 @@
143  extern char    *unincpy(char *, const char *, size_t);
144  extern size_t  unilen(const char *);
145  extern const char      *szBasename(const char *);
146 +extern int     ConfFilePath(char *,int,const char *);
147  /* notes.c */
148  extern void    vDestroyNotesInfoLists(void);
149  extern void    vGetNotesInfo(FILE *, const pps_info_type *,
150 diff -Nur antiword.0.31.orig/fonts_u.c antiword.0.31/fonts_u.c
151 --- antiword.0.31.orig/fonts_u.c        Wed Nov 29 20:53:05 2000
152 +++ antiword.0.31/fonts_u.c     Wed Feb 14 23:31:17 2001
153 @@ -142,19 +142,15 @@
154  pOpenFontTableFile(void)
155  {
156         FILE    *pFile;
157 -       const char      *szHome;
158         int     iIndex;
159         BOOL    bFailed;
160         char    szFontNamesFile[PATH_MAX+1];
161 -       
162 -       szHome = szGetHomeDirectory();
163 -       if (strlen(szHome) + sizeof(FONTNAMES_FILE) >=
164 -                                               sizeof(szFontNamesFile)) {
165 +
166 +       if (ConfFilePath(szFontNamesFile, sizeof(szFontNamesFile), FONTNAMES_FILE)) {
167                 werr(0, "The name of your HOME directory is too long");
168                 return NULL;
169         }
170  
171 -       sprintf(szFontNamesFile, "%s%s", szHome, FILE_SEPARATOR FONTNAMES_FILE);
172         DBG_MSG(szFontNamesFile);
173  
174         pFile = fopen(szFontNamesFile, "r");
175 diff -Nur antiword.0.31.orig/misc.c antiword.0.31/misc.c
176 --- antiword.0.31.orig/misc.c   Tue Nov 21 07:48:12 2000
177 +++ antiword.0.31/misc.c        Wed Feb 14 23:32:35 2001
178 @@ -676,3 +676,33 @@
179         }
180         return ++szTmp;
181  } /* end of szBasename */
182 +
183 +int ConfFilePath(char *str,int maxlen,const char *fname)
184 +{
185 +       const char *szHome;
186 +       struct stat statbuf;
187 +       int     homeok=0;
188 +
189 +       szHome=szGetHomeDirectory();
190 +       if (strlen(szHome) < maxlen - 2*sizeof(FILE_SEPARATOR) - strlen(fname)
191 +                       - sizeof(HOME_ANTIWORD_DIR)) {
192 +               sprintf(str, "%s" FILE_SEPARATOR HOME_ANTIWORD_DIR
193 +                       FILE_SEPARATOR "%s",szHome,fname);
194 +               homeok=1;
195 +               if(!stat(str,&statbuf))
196 +                       return 0;
197 +       }
198 +       /* file not present in home directory - use global one */
199 +       if(sizeof(SYS_ANTIWORD_DIR) + sizeof(FILE_SEPARATOR) + strlen(fname) > maxlen)
200 +               return -1;
201 +       sprintf(str,SYS_ANTIWORD_DIR FILE_SEPARATOR "%s",fname);
202 +       if(!stat(str,&statbuf))
203 +               return 0;
204 +       /* file not present in global directory - fallback to home, maybe we can make it... */
205 +       if(homeok) {
206 +               sprintf(str, "%s" FILE_SEPARATOR HOME_ANTIWORD_DIR
207 +                       FILE_SEPARATOR "%s",szHome,fname);
208 +               return 0;
209 +       } else
210 +               return -1;
211 +}
212 diff -Nur antiword.0.31.orig/options.c antiword.0.31/options.c
213 --- antiword.0.31.orig/options.c        Wed Nov 29 20:52:36 2000
214 +++ antiword.0.31/options.c     Wed Feb 14 23:31:17 2001
215 @@ -98,7 +98,6 @@
216         extern  char    *optarg;
217         extern int      optind;
218         const papersize_type    *pPaperSize;
219 -       const char      *szHome;
220         char    *pcChar, *szTmp;
221         int     iChar;
222         BOOL    bPostScript, bFound;
223 @@ -179,15 +178,10 @@
224                 }
225         }
226  /* Command line */
227 -       szHome = szGetHomeDirectory();
228 -       if (strlen(szHome) >= sizeof(szMappingFile) -
229 -                       sizeof(FILE_SEPARATOR) -
230 -                       sizeof(MAPPING_FILE_DEFAULT_1)) {
231 +       if(ConfFilePath(szMappingFile, sizeof(szMappingFile), MAPPING_FILE_DEFAULT_1)) {
232                 werr(0, "The name of your home directory is too long");
233                 return -1;
234         }
235 -       sprintf(szMappingFile, "%s" FILE_SEPARATOR MAPPING_FILE_DEFAULT_1,
236 -               szHome);
237         bPostScript = FALSE;
238         while ((iChar = getopt(argc, argv, "LX:hi:m:p:stw:")) != -1) {
239                 switch (iChar) {
240 @@ -199,15 +193,13 @@
241                         switch (iTmp) {
242                         case 1:
243                                 tOptionsCurr.eEncoding = encoding_iso_8859_1;
244 -                               sprintf(szMappingFile,
245 -                               "%s" FILE_SEPARATOR MAPPING_FILE_DEFAULT_1,
246 -                                       szHome);
247 +                               ConfFilePath(szMappingFile, sizeof(szMappingFile),
248 +                                       MAPPING_FILE_DEFAULT_1);
249                                 break;
250                         case 2:
251                                 tOptionsCurr.eEncoding = encoding_iso_8859_2;
252 -                               sprintf(szMappingFile,
253 -                               "%s" FILE_SEPARATOR MAPPING_FILE_DEFAULT_2,
254 -                                       szHome);
255 +                               ConfFilePath(szMappingFile, sizeof(szMappingFile),
256 +                                       MAPPING_FILE_DEFAULT_2);
257                                 break;
258                         default:
259                                 break;
260 @@ -242,18 +234,11 @@
261                         break;
262                 case 'm':
263                         if (optarg[0] == '/') {
264 -                               if (strlen(optarg) < sizeof(szMappingFile)) {
265 +                               if (strlen(optarg) < sizeof(szMappingFile))
266                                         strcpy(szMappingFile, optarg);
267 -                               }
268                         } else {
269 -                               if (strlen(szHome) + strlen(optarg) <
270 -                                               sizeof(szMappingFile) -
271 -                                               sizeof(ANTIWORD_DIR) -
272 -                                               2 * sizeof(FILE_SEPARATOR)) {
273 -                                       sprintf(szMappingFile,
274 -                       "%s" FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR "%s",
275 -                                               szHome, optarg);
276 -                               }
277 +                               ConfFilePath(szMappingFile, sizeof(szMappingFile),
278 +                                       optarg);
279                         }
280                         DBG_MSG(szMappingFile);
281                         break;
This page took 1.59551 seconds and 2 git commands to generate.