-- /* Try the local version of the mapping file */
-- szHome = szGetHomeDirectory();
-- if (strlen(szHome) + strlen(szLeafname) <
-- sizeof(szMappingFile) -
-- sizeof(ANTIWORD_DIR) -
-- 2 * sizeof(FILE_SEPARATOR)) {
-- sprintf(szMappingFile,
-- "%s" FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR "%s",
-- szHome, szLeafname);
-- DBG_MSG(szMappingFile);
-- if (bReadCharacterMappingTable(szMappingFile)) {
-- return optind;
-- }
-- } else {
-- werr(0, "Local mappingfilename too long, ignored");
-- }
-+ szHome = getenv("HOME_ETC");
-+ if (szHome) {
-+ if (strlen(szHome) + strlen(szLeafname) <
-+ sizeof(szMappingFile) -
-+ sizeof(ETC_DIR_ANTIWORD_DIR) -
-+ 2 * sizeof(FILE_SEPARATOR)) {
-+ sprintf(szMappingFile,
-+ "%s" FILE_SEPARATOR ETC_DIR_ANTIWORD_DIR FILE_SEPARATOR "%s",
-+ szHome, szLeafname);
-+ DBG_MSG(szMappingFile);
-+ if (bReadCharacterMappingTable(szMappingFile)) {
-+ return optind;
-+ }
-+ } else {
-+ werr(0, "Local mappingfilename too long, ignored");
-+
-+ }
-+ } else {
-+ /* Try the local version of the mapping file */
-+ szHome = szGetHomeDirectory();
-+ if (strlen(szHome) + strlen(szLeafname) <
-+ sizeof(szMappingFile) -
-+ sizeof(ANTIWORD_DIR) -
-+ 2 * sizeof(FILE_SEPARATOR)) {
-+ sprintf(szMappingFile,
-+ "%s" FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR "%s",
-+ szHome, szLeafname);
-+ DBG_MSG(szMappingFile);
-+ if (bReadCharacterMappingTable(szMappingFile)) {
-+ return optind;
-+ }
-+ } else {
-+ werr(0, "Local mappingfilename too long, ignored");
-+
-+ }
-+ }
- /* Try the global version of the mapping file */
- if (strlen(szLeafname) <
+
+ /* Try the local version of the mapping file */
++ szHome = getenv("HOME_ETC");
++ if (szHome) {
++ if (strlen(szHome) + tFilenameLen <
++ sizeof(szMappingFile) -
++ sizeof(ETC_DIR_ANTIWORD_DIR) -
++ 2 * sizeof(FILE_SEPARATOR)) {
++ sprintf(szMappingFile,
++ "%s" FILE_SEPARATOR ETC_DIR_ANTIWORD_DIR FILE_SEPARATOR "%s%s",
++ szHome, szLeafname, szSuffix);
++ DBG_MSG(szMappingFile);
++ pFile = fopen(szMappingFile, "r");
++ if (pFile != NULL) {
++ return pFile;
++ }
++ } else {
++ werr(0, "Local mappingfilename too long, ignored");
++ }
++ } else {
+ szHome = szGetHomeDirectory();
+ if (strlen(szHome) + tFilenameLen <