diff options
Diffstat (limited to 'Build/source/texk/kpathsea/tex-file.c')
-rw-r--r-- | Build/source/texk/kpathsea/tex-file.c | 79 |
1 files changed, 1 insertions, 78 deletions
diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index f34f58924e8..30d7d0fca26 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -1182,91 +1182,16 @@ Isspace (char c) return (c == ' ' || c == '\t'); } -/* Create a list of executable suffixes of files not to be written. */ -#define EXE_SUFFIXES ".com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.ws;.tcl;.py;.pyw" - -static void -mk_suffixlist (char ***ext) -{ - char **p; - char *q, *r, *v; - int n; - -#if defined(__CYGWIN__) - v = (char *) xmalloc (strlen (EXE_SUFFIXES) + 1); - strcpy (v, EXE_SUFFIXES); -#else - v = (char *) getenv ("PATHEXT"); - if (v) /* strlwr() exists also in MingW */ - (void) strlwr (v); - else { - v = (char *) xmalloc (strlen (EXE_SUFFIXES) + 1); - strcpy (v, EXE_SUFFIXES); - } -#endif - - q = v; - n = 0; - - while ((r = strchr (q, ';')) != 0) { - n++; - r++; - q = r; - } - if (*q) - n++; - *ext = (char **) xmalloc ((n + 2) * sizeof (char *)); - p = *ext; - *p = (char *) xmalloc(5); - strcpy(*p, ".dll"); - p++; - q = v; - while ((r = strchr (q, ';')) != 0) { - *r = '\0'; - *p = (char *) xmalloc (strlen (q) + 1); - strcpy (*p, q); - *r = ';'; - r++; - q = r; - p++; - } - if (*q) { - *p = (char *) xmalloc (strlen (q) + 1); - strcpy (*p, q); - p++; - *p = NULL; - } else - *p = NULL; - free (v); -} - -static void -free_suffixlist (char ***ext) -{ - char **p; - - if (*ext) { - p = *ext; - while (*p) { - free (*p); - p++; - } - free (*ext); - } -} - static boolean executable_filep (kpathsea kpse, const_string fname) { string p, q, base; string *pp; - char **suffixlist = NULL; /* check openout_any */ p = kpathsea_var_value (kpse, "openout_any"); if (p && *p == 'p') { free (p); - mk_suffixlist (&suffixlist); /* get base name we cannot use xbasename() for abnormal names. */ @@ -1293,21 +1218,19 @@ executable_filep (kpathsea kpse, const_string fname) *q = '\0'; /* remove trailing '.' , ' ' and '\t' */ } q = strrchr (p, '.'); /* get extension part */ - pp = suffixlist; + pp = kpse->suffixlist; if (pp && q) { while (*pp) { if (strchr (fname, ':') || !strcmp (q, *pp)) { fprintf (stderr, "\nThe name %s is forbidden to open for writing.\n", fname); free (base); - free_suffixlist (&suffixlist); return true; } pp++; } } free (base); - free_suffixlist (&suffixlist); } else if (p) { free (p); } |