diff -Nru antiword-0.33/antiword.h antiword-0.33.new/antiword.h --- antiword-0.33/antiword.h Thu Jun 20 09:16:22 2002 +++ antiword-0.33.new/antiword.h Sat Mar 22 21:29:50 2003 @@ -179,6 +179,7 @@ #else /* All others */ #define GLOBAL_ANTIWORD_DIR "/usr/share/antiword" #define ANTIWORD_DIR ".antiword" +#define CONFIG_DIR_ANTIWORD_DIR "antiword" #define FONTNAMES_FILE "fontnames" #endif /* __dos */ /* The name of the default mapping file */ diff -Nru antiword-0.33/options.c antiword-0.33.new/options.c --- antiword-0.33/options.c Sat Jun 29 12:43:05 2002 +++ antiword-0.33.new/options.c Sat Mar 22 21:34:50 2003 @@ -295,22 +295,42 @@ PS_LEFT_MARGIN + PS_RIGHT_MARGIN)); DBG_DEC(tOptionsCurr.iParagraphBreak); } - /* 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("CONFIG_DIR"); + if (szHome) { + if (strlen(szHome) + strlen(szLeafname) < + sizeof(szMappingFile) - + sizeof(CONFIG_DIR_ANTIWORD_DIR) - + 2 * sizeof(FILE_SEPARATOR)) { + sprintf(szMappingFile, + "%s" FILE_SEPARATOR CONFIG_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) < sizeof(szMappingFile) - @@ -326,9 +346,14 @@ } else { werr(0, "Global mappingfilename too long, ignored"); } - werr(0, "I can't open your mapping file (%s)\n" - "It is not in '%s" FILE_SEPARATOR ANTIWORD_DIR "' nor in '" - GLOBAL_ANTIWORD_DIR "'.", szLeafname, szHome); + if (getenv("CONFIG_DIR") != NULL) + werr(0, "I can't open your mapping file (%s)\n" + "It is not in '%s" FILE_SEPARATOR CONFIG_DIR_ANTIWORD_DIR "' nor in '" + GLOBAL_ANTIWORD_DIR "'.", szLeafname, szHome); + else + werr(0, "I can't open your mapping file (%s)\n" + "It is not in '%s" FILE_SEPARATOR ANTIWORD_DIR "' nor in '" + GLOBAL_ANTIWORD_DIR "'.", szLeafname, szHome); return -1; #endif /* __riscos */ } /* end of iReadOptions */