wdvi

network DVI viewer
Log | Files | Refs

commit ba4f1395866fa07a77032848c0ebe7859fa480f4
parent d43aa7b4720f8309080ff194bf6760844b20f730
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Wed, 15 Sep 2021 17:59:13 +0000

use brute force to search for texmf trees

Since kpathsea is a disaster, instead revert to hard coding a large list
of possible texmf trees to search for files we need. This is essentially
what kpathsea does already.

Make opendir() fail as it did originally so we can search non-existent
directories.

Diffstat:
Mfilefind.c | 7+++++--
Mutil.c | 16----------------
Mutil.h | 2--
3 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/filefind.c b/filefind.c @@ -38,6 +38,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * <pwd.h> */ +#include <sys/types.h> /* opendir() */ + +#include <dirent.h> /* opendir() */ #include <err.h> #include <setjmp.h> /* jmp_buf, longjmp(), setjmp() */ #include <stdlib.h> /* getenv() */ @@ -48,7 +51,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* default list of texmf trees */ -#define DEFAULT_TEXMF_PATH "/usr/local/share/texmf-dist" +#define DEFAULT_TEXMF_PATH "/usr/local/share/texmf-local:/usr/local/share/texmf-dist:/usr/local/share/texmf:/usr/share/texmf-dist:/usr/share/texmf-local:/usr/share/texmf:/usr/share/texlive/texmf-dist" #if !defined(S_ISREG) && defined(S_IFREG) @@ -1330,7 +1333,7 @@ filltree(pos, treepp, atom, slashslash) if (FFDEBUG) printf("Opening directory %s\n", ffline); - f = xopendir(ffline); + f = opendir(ffline); if (f == NULL) { if (FFDEBUG) printf("%s: %s\n", ffline, strerror(errno)); *treepp = NULL; diff --git a/util.c b/util.c @@ -207,22 +207,6 @@ xpipe(int *fd) /* - * Open a directory for reading - */ - -DIR * -xopendir(const char *name) -{ - DIR *retval; - - if ((retval = opendir(name)) == NULL) - err(1, "opendir '%s'", name); - - return retval; -} - - -/* * Perform tilde expansion, updating the character pointer unless the * user was not found. */ diff --git a/util.h b/util.h @@ -1,4 +1,3 @@ -#include <dirent.h> /* DIR */ #include <stdio.h> /* FILE */ #include <X11/Intrinsic.h> /* Boolean */ @@ -18,7 +17,6 @@ int memicmp(const char *, const char *, size_t); void prep_fd(int, Boolean); FILE *xfopen(const char *, const char *); -DIR *xopendir(const char *); int xpipe(int *); void xputenv(const char *, const char *);