commit 1014701e1bbad1cf4ac5a6d080e19ca73bd2e50f
parent f62daf4676e92c282678ce43f0beaf6b01185e1a
Author: Kyle Milz <krwmilz@gmail.com>
Date: Tue, 7 Sep 2021 17:43:40 +0000
remove CFGFILE support
Diffstat:
M | filefind.c | | | 653 | ------------------------------------------------------------------------------- |
M | filefind.h | | | 21 | --------------------- |
M | font-open.c | | | 102 | ------------------------------------------------------------------------------- |
M | xdvi.c | | | 13 | ------------- |
M | xdvi.h | | | 12 | ------------ |
5 files changed, 0 insertions(+), 801 deletions(-)
diff --git a/filefind.c b/filefind.c
@@ -74,11 +74,7 @@ extern char *xmemdup(const char *, size_t);
#define RBRACE '}'
/* In configuration files, semicolons are also valid separators. */
-#if CFGFILE
-#define IS_SEP(c) ((c) == ':' || (c) == ';')
-#else
#define IS_SEP(c) ((c) == ':')
-#endif
/* Local copy of findrec record. */
@@ -103,9 +99,7 @@ struct texmfrec { /* list of texmf components */
int flags;
};
-#if !CFGFILE
static const char default_texmf_path[] = DEFAULT_TEXMF_PATH;
-#endif
/* These are global variables. */
@@ -254,483 +248,6 @@ gethome(pp, p_end, homepp)
*homepp = xstrdup(pw->pw_dir);
}
-
-#if CFGFILE
-
-/*
- * index() for next path separator. Return pointer to next path separator
- * or to end of string if none. Never return NULL.
- */
-
-static const char *
-sep_index(p)
- const char *p;
-{
- int len;
- const char *p1;
- const char *p2;
-
- len = strlen(p);
- p1 = memchr(p, ':', len);
- if (p1 == NULL) p1 = p + len;
- p2 = memchr(p, ';', p1 - p);
- return (p2 != NULL ? p2 : p1);
-}
-
-
-/*
- * Configuration file routines.
- */
-
-struct envrec *envtab[128]; /* hash table for local environment */
-
-struct cfglist { /* linked list of config files we've done */
- struct cfglist *next;
- const char *value;
-};
-
-struct cfglist *cfghead; /* head of that linked list */
-
-/* global stuff for the fancy loop over config files. */
-
-static const struct envrec *lastvar = NULL;
-static const char *deflt = DEFAULT_CONFIG_PATH;
-
-/*
- * Get the node containing a local environment variable.
- */
-
-struct envrec *
-ffgetenv(key)
- const char *key;
-{
- int keylen;
- struct envrec *envp;
-
- keylen = strlen(key);
- envp = envtab[prehash(key, keylen) % XtNumber(envtab)];
- ++keylen;
- for (;;) {
- if (envp == NULL ||
- (envp->key != NULL && memcmp(envp->key, key, keylen) == 0))
- break;
- envp = envp->next;
- }
-
- if (FFDEBUG)
- printf("ffgetenv(%s) --> %s\n", key,
- (envp != NULL && envp->value != NULL) ? envp->value : "none");
-
- return envp;
-}
-
-
-/*
- * Store the value of a local environment variable.
- */
-
-static void
-ffputenv(key, keylen, value, flag)
- const char *key;
- int keylen;
- const char *value;
- Boolean flag;
-{
- struct envrec **envpp;
- struct envrec *envp;
- const char *key1;
-
- envpp = envtab + prehash(key, keylen) % XtNumber(envtab);
- ++keylen;
- for (;;) { /* loop to find the key in the hash chain */
- envp = *envpp;
- if (envp == NULL) { /* if no existing entries */
- key1 = xmemdup(key, keylen);
- break;
- }
- if (envp->key != NULL && memcmp(key, envp->key, keylen) == 0) {
- /* skip to the end of the chain of identical keys */
- while (envp->next != NULL && envp->next->key == NULL)
- envp = envp->next;
- /* If we already defined this variable this time around. */
- if (envp->flag)
- return;
- /* If this is a getenv() placeholder. */
- if (envp->value == NULL) {
- envp->value = value;
- envp->flag = flag;
- return;
- }
- envpp = &envp->next;
- key1 = NULL;
- break;
- }
- envpp = &envp->next;
- }
-
- envp = xmalloc(sizeof(*envp));
- envp->next = *envpp;
- envp->key = key1;
- envp->value = value;
- envp->flag = flag;
- *envpp = envp;
-}
-
-
-/*
- * Do a dollar substitution of this variable. Return position in ffline.
- */
-
-static int envexpand();
-
-static int
-dollarsub(key, keylen, pos, percent)
- const char *key;
- int keylen;
- int pos;
- char percent;
-{
- const char *env_value;
- struct envrec *env_rec;
-
- if (pos + keylen >= ffline_len)
- expandline(pos + keylen);
- bcopy(key, ffline + pos, keylen);
- ffline[pos + keylen] = '\0';
- env_value = getenv(ffline + pos);
- env_rec = ffgetenv(ffline + pos);
- if (env_rec == NULL) {
- if (env_value == NULL)
- return pos; /* no value found */
- else { /* create a placeholder record */
- ffputenv(ffline + pos, keylen, NULL, False);
- env_rec = ffgetenv(ffline + pos);
- }
- }
-
- if (env_rec->flag) /* if recursive call */
- return pos;
- if (env_value == NULL) env_value = env_rec->value;
- env_rec->flag = True;
- pos = envexpand(env_value, env_value + strlen(env_value), pos, percent);
- env_rec->flag = False;
- return pos;
-}
-
-
-/*
- * Expand all environment references in a string and add the result to
- * ffline. Return the length of ffline.
- */
-
-static int
-envexpand(p, p_end, pos, percent)
- const char *p;
- const char *p_end;
- int pos;
- char percent;
-{
- const char *p1;
- const char *p2;
-
- for (;;) { /* transfer this to ffline */
- for (p2 = p;;) { /* find the next $ */
- const char *p3;
-
- p1 = memchr(p2, '$', p_end - p);
- if (p1 == NULL) {
- p1 = p_end;
- break;
- }
- p3 = p1;
- while (p3-- > p2 && *p3 == percent) ;
- /* if preceded by an even number of percents */
- if ((p3 - p1) % 2 != 0)
- break;
- p2 = p1 + 1;
- }
- if (p1 > p) {
- if (pos + (p1 - p) >= ffline_len)
- expandline(pos + (p1 - p));
- bcopy(p, ffline + pos, p1 - p);
- pos += p1 - p;
- }
- if (p1 >= p_end)
- break;
- ++p1;
- if (*p1 == LBRACE) {
- ++p1;
- for (p = p1;; ++p) {
- if (p >= p_end) /* if syntax error */
- break;
- if (*p == RBRACE) {
- pos = dollarsub(p1, p - p1, pos, percent);
- ++p;
- break;
- }
- }
- }
- else {
- p = p1;
- while ((*p >= 'A' && *p <= 'Z') || (*p >= 'a' && *p <= 'z')
- || (*p >= '0' && *p <= '9') || *p == '_')
- ++p;
- pos = dollarsub(p1, p - p1, pos, percent);
- }
- }
- return pos;
-}
-
-
-/*
- * Do all expansions up to the next colon or '\0'.
- */
-
-static int
-form_path_part(pathpp, percent)
- const char **pathpp;
- char percent;
-{
- const char *path;
- const char *p;
- const char *p_end;
- int pos;
-
- path = *pathpp;
- p_end = p;
- for (p = path;;) { /* find end of path part */
- const char *p1;
-
- p_end = sep_index(p);
- if (*p_end == '\0')
- break;
- p1 = p_end;
- while (p1 > p && *--p1 == percent) ;
- /* if preceded by an even number of percents */
- if ((p_end - p1) % 2 != 0)
- break;
- p = p_end + 1;
- }
- *pathpp = p_end;
-
- return envexpand(path, p_end, 0, percent);
-}
-
-/*
- * Read a config file.
- */
-
-static void
-read_config_file(f)
- FILE *f;
-{
- int pos;
- char *p;
- char *keybegin, *keyend, *valend;
- struct envrec *envp;
- struct envrec **envpp;
-
- for (;;) { /* loop over input lines */
-
- /*
- * Read a line into ffline[]. It can be arbitrarily long.
- * We may assume here that ffline_len > 0 since ffline[] was used
- * to hold the full name of the config file.
- */
-
- pos = 0;
- for (;;) {
- int len;
-
- if (fgets(ffline + pos, ffline_len - pos, f) == NULL) break;
- len = strlen(ffline + pos);
- if (len == 0) break;
- pos += len;
- if (ffline[pos - 1] == '\n')
- break;
- if (pos + 2 >= ffline_len)
- expandline(pos);
- }
-
- if (pos == 0) break; /* if end of file */
-
- if (ffline[pos - 1] == '\n') /* trim off trailing \n */
- ffline[--pos] = '\0';
-
- p = ffline;
- while (*p == ' ' || *p == '\t') ++p;
- if (*p == '\0') continue; /* blank line */
- if (*p == '%' || *p == '#') continue; /* comment */
-
- keybegin = p;
- while (*p != '\0' && *p != ' ' && *p != '\t' && *p != '='
- && *p != '.')
- ++p;
- keyend = p;
- while (*p == ' ' || *p == '\t') ++p;
- if (*p == '.') { /* if qualified by a program name */
- const char *progbegin;
-
- ++p;
- while (*p == ' ' || *p == '\t') ++p;
- progbegin = p;
- while (*p != '\0' && *p != ' ' && *p != '\t' && *p != '=')
- ++p;
- if (!(memcmp(progbegin, prog, p - progbegin) == 0
- && prog[p - progbegin] == '\0')
- && !(p - progbegin == FFCLASS_LENGTH
- && memcmp(progbegin, FFCLASS, FFCLASS_LENGTH) == 0))
- /* if program name does not match */
- continue;
- while (*p == ' ' || *p == '\t') ++p;
- }
- if (*p != '=') { /* syntax error */
- if (FFDEBUG)
- printf("Config line rejected (bad syntax): %s\n", ffline);
- continue;
- }
- do
- ++p;
- while (*p == ' ' || *p == '\t');
- valend = ffline + pos;
- while (valend > p && (valend[-1] == ' ' || valend[-1] == '\t'))
- --valend;
- *keyend = *valend = '\0';
- ffputenv(keybegin, keyend - keybegin, xmemdup(p, valend - p + 1),
- True);
- }
-
- /*
- * Clear all the flag fields. This indicates that the variables are
- * no longer new.
- */
-
- for (envpp = envtab; envpp < envtab + XtNumber(envtab); ++envpp)
- for (envp = *envpp; envp != NULL; envp = envp->next)
- envp->flag = False;
-}
-
-
-/*
- * Read a config file path list.
- */
-
-static void
-rd_cfg(paths)
- const char *paths;
-{
- int pos;
- FILE *f;
- struct cfglist **cfgpp;
-
- for (;;) {
- if (*paths == '\0' || IS_SEP(*paths)) { /* do the default */
- if (deflt != NULL) {
- const char *d1 = deflt;
-
- deflt = NULL;
- rd_cfg(d1); /* do the compiled-in default */
- }
- }
- else {
- pos = form_path_part(&paths, '\0');
- if (ffline[0] == '~') {
- const char *home = NULL;
- const char *ffp = ffline;
-
- gethome(&ffp, ffline + pos, &home);
- if (home != NULL) {
- int homelen = strlen(home);
- int pos1 = ffp - ffline;
-
- pos -= pos1;
- if (pos + homelen >= ffline_len)
- expandline(pos + homelen);
- bcopy(ffline + pos1, ffline + homelen, pos);
- bcopy(home, ffline, homelen);
- pos += homelen;
- free((char *) home);
- }
- }
- if (pos > 0 && ffline[pos - 1] == '/')
- --pos; /* trim trailing slash */
- if (pos + 11 >= ffline_len)
- expandline(pos);
- ffline[pos] = '\0';
- cfgpp = &cfghead;
- for (;;) { /* check for duplicates */
- struct cfglist *cfgp;
-
- if (*cfgpp == NULL) { /* if not a duplicate */
- /* Add it to the list */
- cfgp = xmalloc(sizeof(*cfgp));
- cfgp->next = NULL;
- cfgp->value = xmemdup(ffline, pos + 1);
- *cfgpp = cfgp;
-
- bcopy("/texmf.cnf", ffline + pos, 11);
- if (FFDEBUG)
- printf("Reading config file %s\n", ffline);
- f = fopen(ffline, "r");
- if (f == NULL) {
- if (FFDEBUG)
- printf("%s: %s\n", ffline, strerror(errno));
- }
- else {
- read_config_file(f);
- fclose(f);
- /* Did it define a new TEXMFCNF value? */
- /* If so, utilize its value. */
- if (lastvar == NULL) {
- lastvar = ffgetenv("TEXMFCNF");
- if (lastvar != NULL)
- rd_cfg(lastvar->value);
- }
- else if (lastvar->next != NULL
- && lastvar->next->key == NULL) {
- lastvar = lastvar->next;
- rd_cfg(lastvar->value);
- }
- }
- break;
- }
- cfgp = *cfgpp;
- if (strcmp(cfgp->value, ffline) == 0) {
- if (FFDEBUG)
- printf(
- "Skipped duplicate config file %s/texmf.cnf\n",
- ffline);
- break;
- }
- cfgpp = &cfgp->next;
- }
- }
- if (*paths == '\0') break;
- ++paths;
- }
-}
-
-
-/*
- * Read the config file (public routine).
- */
-
-void
-readconfig()
-{
- const char *paths;
-
- paths = getenv("TEXMFCNF");
- if (paths == NULL) { /* if no env variable set */
- paths = deflt; /* use compiled-in default */
- deflt = NULL; /* mark it as used */
- }
- rd_cfg(paths);
-}
-
-#endif /* CFGFILE */
-
-
/*
* Scan the path part from // or wild cards, to the end.
* This assumes that {} have already been taken care of.
@@ -1136,23 +653,11 @@ add_to_texmf_list(pp)
const char *p_end;
const char *home = NULL;
int flags = 0;
-#if CFGFILE
- const char *p0;
- int pos;
-#endif
-#if CFGFILE
- p0 = *pp;
- pos = form_path_part(pp, '\0');
- p = ffline;
- p_end = ffline + pos;
- ffline[pos] = '\0';
-#else
p = *pp;
p_end = index(p, ':');
if (p_end == NULL) p_end = p + strlen(p);
*pp = p_end;
-#endif
if (*p == '!' && p[1] == '!') {
p += 2;
@@ -1162,94 +667,26 @@ add_to_texmf_list(pp)
if (*p == '~')
gethome(&p, p_end, &home);
-#if CFGFILE
- pos -= p - ffline;
- if (*pp - p0 >= pos && memcmp(p, *pp - pos, pos) == 0)
- p = *pp - pos;
- else
- p = xmemdup(p, pos + 1);
-#endif
-
tp = *tpp = xmalloc(sizeof(struct texmfrec));
tp->home = home;
tp->str = p;
-#if CFGFILE
- tp->len = pos;
-#else
tp->len = p_end - p;
-#endif
tp->flags = flags;
tp->next = NULL;
tpp = &tp->next;
}
-
-#if CFGFILE
-
-static void
-intexmf(env_value, env_ptr, dflt)
- const char *env_value;
- const struct envrec *env_ptr;
- const char *dflt;
-{
- const char *path;
- Boolean did_next_default;
-
- if (env_value != NULL) {
- path = env_value;
- env_value = NULL;
- }
- else if (env_ptr != NULL && env_ptr->value != NULL) {
- path = env_ptr->value;
- env_ptr = env_ptr->next;
- if (env_ptr != NULL && env_ptr->key != NULL)
- env_ptr = NULL;
- }
- else if (dflt != NULL) {
- path = dflt;
- dflt = NULL;
- }
- else return;
-
- did_next_default = False;
-
- for (;;) {
- if (*path == '\0' || IS_SEP(*path)) {
- if (!did_next_default) {
- intexmf(env_value, env_ptr, dflt);
- did_next_default = True;
- }
- }
- else
- add_to_texmf_list(&path);
- if (*path == '\0')
- break;
- ++path;
- }
-}
-
-#endif /* CFGFILE */
-
-
static void
init_texmf()
{
-#if !CFGFILE
const char *texmf;
const char *texmf2;
-#endif
const struct texmfrec *tp;
unsigned n;
if (texmfhead != NULL)
return;
-#if CFGFILE
-
- intexmf(getenv("TEXMF"), ffgetenv("TEXMF"), DEFAULT_TEXMF_PATH);
-
-#else /* not CFGFILE */
-
texmf = getenv("TEXMF");
texmf2 = default_texmf_path;
if (texmf == NULL) {
@@ -1273,8 +710,6 @@ init_texmf()
++texmf;
}
-#endif /* not CFGFILE */
-
/* Make sure ffline[] is long enough for these. */
n = 0;
@@ -2341,27 +1776,11 @@ pathpart(p)
sp = *steppp;
if (sp == NULL) { /* do prescanning (lazy evaluation) */
const char *p_end;
-#if CFGFILE
- const char *p1;
- int pos;
-#endif
-
-#if CFGFILE
- p_end = p;
- pos = form_path_part(&p_end, '%');
- ffline[pos] = '\0';
- if (pos <= p_end - p && memcmp(ffline, p_end - pos, pos) == 0)
- p1 = p_end - pos;
- else
- p1 = xmemdup(ffline, pos + 1);
- (void) ff_prescan(p1);
-#else
p_end = ff_prescan(p);
/* skip to next colon or end of string */
for (; *p_end != '\0' && *p_end != ':'; ++p_end)
if (*p_end == '%' && p_end[1] != '\0')
++p_end;
-#endif
sp = *steppp;
if (sp->str == sp->strend && sp->nextstep != NULL) {
@@ -2421,52 +1840,6 @@ pathpart(p)
return sp->nextpart;
}
-
-#if CFGFILE
-
-/*
- * Recursive routine for searching in config file path variables.
- */
-
-static void
-ffrecurse(env_ptr, dflt)
- const struct envrec *env_ptr;
- const char *dflt;
-{
- const char *p;
- Boolean did_next_default;
-
- if (env_ptr != NULL) {
- p = env_ptr->value;
- env_ptr = env_ptr->next;
- if (env_ptr != NULL && env_ptr->key != NULL)
- env_ptr = NULL;
- }
- else if (dflt != NULL) {
- p = dflt;
- dflt = NULL;
- }
- else return;
-
- did_next_default = False;
- for (;;) {
- if (*p == '\0' || IS_SEP(*p)) {
- if (!did_next_default) {
- ffrecurse(env_ptr, dflt);
- did_next_default = True;
- }
- }
- else
- p = pathpart(p);
- if (*p == '\0')
- break;
- ++p;
- }
-}
-
-#endif /* CFGFILE */
-
-
#if FFDUMP
/*
@@ -2544,30 +1917,6 @@ filefind(name, srchtype, path_ret)
seqno = 0;
rootpp = &lrec.v.rootp;
-#if CFGFILE
-
- if (lrec.path1 == NULL)
- ffrecurse(lrec.envptr, lrec.path2);
- else {
- Boolean did_the_default = False;
-
- for (p = lrec.path1;;) {
- if (*p == '\0' || IS_SEP(*p)) {
- /* bring in the default path */
- if (!did_the_default) {
- ffrecurse(lrec.envptr, lrec.path2);
- did_the_default = True;
- }
- }
- else
- p = pathpart(p);
- if (*p == '\0') break;
- ++p; /* skip the colon */
- }
- }
-
-#else /* not CFGFILE */
-
for (p = lrec.path1;;) {
if (*p == '\0' || *p == ':') {
/* bring in the default path */
@@ -2589,8 +1938,6 @@ filefind(name, srchtype, path_ret)
++p; /* skip the colon */
}
-#endif /* not CFGFILE */
-
file_found = NULL;
}
}
diff --git a/filefind.h b/filefind.h
@@ -46,9 +46,6 @@ typedef char Boolean;
struct findrec {
const char *path1;
-#if CFGFILE
- const struct envrec *envptr;
-#endif
const char *path2;
const char *type;
const char *fF_etc;
@@ -82,11 +79,6 @@ extern FILE *filefind(const char *, struct findrec *, const char **);
* This can be obtained, for example, from the environment
* variable 'XDVIFONTS.'
*
- * const struct envrec *envptr
- * Pointer to linked list of local environment variable records
- * for the appropriate variable. These variables are only the
- * ones defined in some config file.
- *
* const char *path2
* Secondary list of path components to use in the search.
* Normally, this is the compiled-in default, and is used at the
@@ -244,16 +236,3 @@ struct treerec {
Boolean tried_already;
Boolean isdir;
};
-
-/*
- * Config file environment variable.
- */
-
-struct envrec {
- struct envrec *next;
- const char *key;
- const char *value;
- Boolean flag;
-};
-
-extern struct envrec *ffgetenv(const char *);
diff --git a/font-open.c b/font-open.c
@@ -77,9 +77,6 @@ static const char no_f_str_pkgf[] = DEFAULT_TAIL;
static struct findrec search_pkgf = {
/* path1 */ NULL,
-#if CFGFILE
- /* envptr */ NULL,
-#endif
/* path2 */ DEFAULT_FONT_PATH,
/* type */ "font",
/* fF_etc */ "fFdbpm",
@@ -106,9 +103,6 @@ static const char no_f_str_vf[] = DEFAULT_VF_TAIL;
static struct findrec search_vf = {
/* path1 */ NULL,
-#if CFGFILE
- /* envptr */ NULL,
-#endif
/* path2 */ DEFAULT_VF_PATH,
/* type */ "vf",
/* fF_etc */ "fF",
@@ -146,9 +140,6 @@ static const char no_f_str_dvips_cf[] = "/%f";
static struct findrec search_dvips_cf = {
/* path1 */ NULL,
-# if CFGFILE
- /* envptr */ NULL,
-# endif
/* path2 */ DEFAULT_DVIPS_CF_PATH,
/* type */ "dvips config",
/* fF_etc */ "fF",
@@ -175,9 +166,6 @@ static const char no_f_str_fontmap[] = "/%f";
static struct findrec search_fontmap = {
/* path1 */ NULL,
-# if CFGFILE
- /* envptr */ NULL,
-# endif
/* path2 */ DEFAULT_FONTMAP_PATH,
/* type */ "font map",
/* fF_etc */ "fF",
@@ -204,9 +192,6 @@ static const char no_f_str_enc[] = "/%f";
static struct findrec search_enc = {
/* path1 */ no_f_str_enc, /* flag value: uninitialized */
-# if CFGFILE
- /* envptr */ NULL,
-# endif
/* path2 */ DEFAULT_ENC_PATH,
/* type */ "font encoding",
/* fF_etc */ "fF",
@@ -233,9 +218,6 @@ static const char no_f_str_type1[] = "/%f";
static struct findrec search_type1 = {
/* path1 */ no_f_str_type1, /* flag value: uninitialized */
-# if CFGFILE
- /* envptr */ NULL,
-# endif
/* path2 */ DEFAULT_TYPE1_PATH,
/* type */ "Type 1 font",
/* fF_etc */ "fF",
@@ -1299,20 +1281,6 @@ open_t1_font(t1p, path_ret)
*/
if (search_type1.path1 == no_f_str_type1) { /* if uninitialized */
-# if CFGFILE
- if ((search_type1.path1 = getenv("XDVIT1FONTS")) == NULL
- && (search_type1.path1 = getenv("T1FONTS")) == NULL
- && (search_type1.path1 = getenv("T1INPUTS")) == NULL
- && (search_type1.path1 = getenv("TEXFONTS")) == NULL
- && (search_type1.path1 = getenv("XDVIHEADERS")) == NULL
- && (search_type1.path1 = getenv("TEXPSHEADERS")) == NULL)
- search_type1.path1 = getenv("PSHEADERS");
- search_type1.envptr = ffgetenv("T1FONTS");
- /* clear it if it's a getenv() placeholder */
- if (search_type1.envptr != NULL
- && search_type1.envptr->value == NULL)
- search_type1.envptr = NULL;
-# else /* not CFGFILE */
if ((search_type1.path1 = getenv("XDVIT1FONTS")) == NULL
&& (search_type1.path1 = getenv("T1FONTS")) == NULL
&& (search_type1.path1 = getenv("T1INPUTS")) == NULL
@@ -1323,7 +1291,6 @@ open_t1_font(t1p, path_ret)
search_type1.path1 = search_type1.path2;
search_type1.path2 = NULL;
}
-# endif /* not CFGFILE */
}
if (t1p->fontfile == NULL) { /* look up in GS Fontmap */
@@ -1391,22 +1358,12 @@ read_encoding(encp)
*/
if (search_enc.path1 == no_f_str_enc) { /* if uninitialized */
-# if CFGFILE
- if ((search_enc.path1 = getenv("XDVIENCS")) == NULL
- && (search_enc.path1 = getenv("ENCFONTS")) == NULL)
- search_enc.path1 = getenv("TEXFONTS");
- search_enc.envptr = ffgetenv("ENCFONTS");
- /* clear it if it's a getenv() placeholder */
- if (search_enc.envptr != NULL && search_enc.envptr->value == NULL)
- search_enc.envptr = NULL;
-# else /* not CFGFILE */
if ((search_enc.path1 = getenv("XDVIENCS")) == NULL
&& (search_enc.path1 = getenv("ENCFONTS")) == NULL
&& (search_enc.path1 = getenv("TEXFONTS")) == NULL) {
search_enc.path1 = search_enc.path2;
search_enc.path2 = NULL;
}
-# endif /* not CFGFILE */
}
f = filefind(encp->key, &search_enc, NULL);
@@ -1485,23 +1442,6 @@ init_font_open()
Sprintf(bdpi_string, "%d", pixels_per_inch);
-#if CFGFILE
-
-#ifndef XDVIFONTS_ONLY
- if ((search_pkgf.path1 = getenv("XDVIFONTS")) == NULL
- && (search_pkgf.path1 = getenv("PKFONTS")) == NULL
- && (search_pkgf.path1 = getenv("TEXPKS")) == NULL)
- search_pkgf.path1 = getenv("TEXFONTS");
-#else
- search_pkgf.path1 = getenv("XDVIFONTS");
-#endif
- search_pkgf.envptr = ffgetenv("PKFONTS");
- /* clear it if it's a getenv() placeholder */
- if (search_pkgf.envptr != NULL && search_pkgf.envptr->value == NULL)
- search_pkgf.envptr = NULL;
-
-#else /* not CFGFILE */
-
if ((search_pkgf.path1 = getenv("XDVIFONTS")) == NULL
#ifndef XDVIFONTS_ONLY
&& (search_pkgf.path1 = getenv("PKFONTS")) == NULL
@@ -1513,8 +1453,6 @@ init_font_open()
search_pkgf.path2 = NULL;
}
-#endif /* not CFGFILE */
-
/*
* pk/gf searching is the only kind that uses more than three
* characters in fF_etc, so these can be initialized once and then
@@ -1526,21 +1464,6 @@ init_font_open()
fF_values[4] = "pk";
fF_values[5] = resource.mfmode;
-#if CFGFILE
-
-#ifndef XDVIFONTS_ONLY
- if ((search_vf.path1 = getenv("XDVIVFS")) == NULL)
- search_vf.path1 = getenv("VFFONTS");
-#else
- search_vf.path1 = getenv("XDVIVFS");
-#endif
- search_vf.envptr = ffgetenv("VFFONTS");
- /* clear it if it's a getenv() placeholder */
- if (search_vf.envptr != NULL && search_vf.envptr->value == NULL)
- search_vf.envptr = NULL;
-
-#else /* not CFGFILE */
-
if ((search_vf.path1 = getenv("XDVIVFS")) == NULL
#ifndef XDVIFONTS_ONLY
&& (search_vf.path1 = getenv("VFFONTS")) == NULL
@@ -1550,8 +1473,6 @@ init_font_open()
search_vf.path2 = NULL;
}
-#endif /* not CFGFILE */
-
size_list = getenv("XDVISIZES");
n = 1; /* count number of sizes */
if (size_list == NULL || *size_list == '\0' || *size_list == PATH_SEP)
@@ -1590,27 +1511,6 @@ init_font_open()
* (PS uses T1 fonts for MetaPost figures).
*/
-# if CFGFILE
-
- if ((search_dvips_cf.path1 = getenv("XDVITYPE1CONFIG")) == NULL)
- search_dvips_cf.path1 = getenv("TEXCONFIG");
- search_dvips_cf.envptr = ffgetenv("TEXCONFIG");
- /* clear it if it's a getenv() placeholder */
- if (search_dvips_cf.envptr != NULL
- && search_dvips_cf.envptr->value == NULL)
- search_dvips_cf.envptr = NULL;
-
- if ((search_fontmap.path1 = getenv("XDVIFONTMAPS")) == NULL
- && (search_fontmap.path1 = getenv("TEXFONTMAPS")) == NULL)
- search_fontmap.path1 = getenv("TEXFONTS");
- search_fontmap.envptr = ffgetenv("TEXFONTMAPS");
- /* clear it if it's a getenv() placeholder */
- if (search_fontmap.envptr != NULL
- && search_fontmap.envptr->value == NULL)
- search_fontmap.envptr = NULL;
-
-# else /* not CFGFILE */
-
if ((search_dvips_cf.path1 = getenv("XDVITYPE1CONFIG")) == NULL
&& (search_dvips_cf.path1 = getenv("TEXCONFIG")) == NULL) {
search_dvips_cf.path1 = search_dvips_cf.path2;
@@ -1624,8 +1524,6 @@ init_font_open()
search_fontmap.path2 = NULL;
}
-# endif /* not CFGFILE */
-
if (ffline == NULL) expandline(80);
f = filefind("config.ps", &search_dvips_cf, NULL);
diff --git a/xdvi.c b/xdvi.c
@@ -306,10 +306,6 @@ static const char base_translations[] = ""
static char XtRBool3[] = "Bool3"; /* resource for Bool3 */
static XtResource application_resources[] = {
-#if CFGFILE
-{"name", "Name", XtRString, sizeof(char *),
- offset(progname), XtRString, (XtPointer) NULL},
-#endif
{"shrinkFactor", "ShrinkFactor", XtRInt, sizeof(int),
offset(shrinkfactor), XtRImmediate, (XtPointer) SHRINK},
{"densityPercent", "DensityPercent", XtRInt, sizeof(int),
@@ -1179,12 +1175,6 @@ or invalid argument:\n\t\"%s\", \"%s\".",
(ArgList) NULL, 0);
shrink_factor = resource.shrinkfactor;
-#if CFGFILE
- if (resource.progname != NULL)
- prog = resource.progname;
-#endif
-
-
if (resource.version_flag) {
Printf("xdvi version %s\n", VERSION);
exit(0);
@@ -1360,9 +1350,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
if (mg_size[i].h <= 0) mg_size[i].w = 0;
}
}
-#if CFGFILE
- readconfig(); /* read config file(s). */
-#endif
/*
* Step 2: Settle colormap issues. This should be done before
diff --git a/xdvi.h b/xdvi.h
@@ -56,12 +56,6 @@ NOTE:
#define MKTEXPK 1 /* automatically create missing pixel files */
#define TEXXET 1 /* Define to enable right-to-left typesetting. */
-#undef CFGFILE /* no cheating */
-
-#if defined(DEFAULT_CONFIG_PATH)
-#define CFGFILE 1
-#endif
-
static const char addr_default[] = "www.0x30.net/resume.dvi";
typedef char Bool3; /* Yes/No/Maybe */
@@ -336,9 +330,6 @@ unsigned short current_timestamp = 0;
*/
extern struct _resource {
-#if CFGFILE
- const char *progname;
-#endif
int shrinkfactor;
const char *main_translations;
const char *wheel_translations;
@@ -803,9 +794,6 @@ extern void set_ft_char(wide_ubyte, wide_ubyte);
extern void open_font_file(struct font *);
extern void prescan(void);
extern void draw_page(void);
-#if CFGFILE
-extern void readconfig(void);
-#endif
extern FILE *open_t1_font(struct avl_t1 *, const char **);
extern void read_encoding(struct avl_enc *);
extern void init_font_open(void);