]>
Commit | Line | Data |
---|---|---|
fa3d749a | 1 | diff -Nru antiword-0.33/antiword.h antiword-0.33.new/antiword.h |
2 | --- antiword-0.33/antiword.h Thu Jun 20 09:16:22 2002 | |
3 | +++ antiword-0.33.new/antiword.h Sat Mar 22 21:29:50 2003 | |
4 | @@ -179,6 +179,7 @@ | |
5 | #else /* All others */ | |
6 | #define GLOBAL_ANTIWORD_DIR "/usr/share/antiword" | |
7 | #define ANTIWORD_DIR ".antiword" | |
8 | +#define CONFIG_DIR_ANTIWORD_DIR "antiword" | |
9 | #define FONTNAMES_FILE "fontnames" | |
10 | #endif /* __dos */ | |
11 | /* The name of the default mapping file */ | |
12 | diff -Nru antiword-0.33/options.c antiword-0.33.new/options.c | |
13 | --- antiword-0.33/options.c Sat Jun 29 12:43:05 2002 | |
14 | +++ antiword-0.33.new/options.c Sat Mar 22 21:34:50 2003 | |
15 | @@ -295,22 +295,42 @@ | |
16 | PS_LEFT_MARGIN + PS_RIGHT_MARGIN)); | |
17 | DBG_DEC(tOptionsCurr.iParagraphBreak); | |
18 | } | |
19 | - /* Try the local version of the mapping file */ | |
20 | - szHome = szGetHomeDirectory(); | |
21 | - if (strlen(szHome) + strlen(szLeafname) < | |
22 | - sizeof(szMappingFile) - | |
23 | - sizeof(ANTIWORD_DIR) - | |
24 | - 2 * sizeof(FILE_SEPARATOR)) { | |
25 | - sprintf(szMappingFile, | |
26 | - "%s" FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR "%s", | |
27 | - szHome, szLeafname); | |
28 | - DBG_MSG(szMappingFile); | |
29 | - if (bReadCharacterMappingTable(szMappingFile)) { | |
30 | - return optind; | |
31 | - } | |
32 | - } else { | |
33 | - werr(0, "Local mappingfilename too long, ignored"); | |
34 | - } | |
35 | + szHome = getenv("CONFIG_DIR"); | |
36 | + if (szHome) { | |
37 | + if (strlen(szHome) + strlen(szLeafname) < | |
38 | + sizeof(szMappingFile) - | |
39 | + sizeof(CONFIG_DIR_ANTIWORD_DIR) - | |
40 | + 2 * sizeof(FILE_SEPARATOR)) { | |
41 | + sprintf(szMappingFile, | |
42 | + "%s" FILE_SEPARATOR CONFIG_DIR_ANTIWORD_DIR FILE_SEPARATOR "%s", | |
43 | + szHome, szLeafname); | |
44 | + DBG_MSG(szMappingFile); | |
45 | + if (bReadCharacterMappingTable(szMappingFile)) { | |
46 | + return optind; | |
47 | + } | |
48 | + } else { | |
49 | + werr(0, "Local mappingfilename too long, ignored"); | |
50 | + | |
51 | + } | |
52 | + } else { | |
53 | + /* Try the local version of the mapping file */ | |
54 | + szHome = szGetHomeDirectory(); | |
55 | + if (strlen(szHome) + strlen(szLeafname) < | |
56 | + sizeof(szMappingFile) - | |
57 | + sizeof(ANTIWORD_DIR) - | |
58 | + 2 * sizeof(FILE_SEPARATOR)) { | |
59 | + sprintf(szMappingFile, | |
60 | + "%s" FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR "%s", | |
61 | + szHome, szLeafname); | |
62 | + DBG_MSG(szMappingFile); | |
63 | + if (bReadCharacterMappingTable(szMappingFile)) { | |
64 | + return optind; | |
65 | + } | |
66 | + } else { | |
67 | + werr(0, "Local mappingfilename too long, ignored"); | |
68 | + | |
69 | + } | |
70 | + } | |
71 | /* Try the global version of the mapping file */ | |
72 | if (strlen(szLeafname) < | |
73 | sizeof(szMappingFile) - | |
74 | @@ -326,9 +346,14 @@ | |
75 | } else { | |
76 | werr(0, "Global mappingfilename too long, ignored"); | |
77 | } | |
78 | - werr(0, "I can't open your mapping file (%s)\n" | |
79 | - "It is not in '%s" FILE_SEPARATOR ANTIWORD_DIR "' nor in '" | |
80 | - GLOBAL_ANTIWORD_DIR "'.", szLeafname, szHome); | |
81 | + if (getenv("CONFIG_DIR") != NULL) | |
82 | + werr(0, "I can't open your mapping file (%s)\n" | |
83 | + "It is not in '%s" FILE_SEPARATOR CONFIG_DIR_ANTIWORD_DIR "' nor in '" | |
84 | + GLOBAL_ANTIWORD_DIR "'.", szLeafname, szHome); | |
85 | + else | |
86 | + werr(0, "I can't open your mapping file (%s)\n" | |
87 | + "It is not in '%s" FILE_SEPARATOR ANTIWORD_DIR "' nor in '" | |
88 | + GLOBAL_ANTIWORD_DIR "'.", szLeafname, szHome); | |
89 | return -1; | |
90 | #endif /* __riscos */ | |
91 | } /* end of iReadOptions */ |