diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2015-06-22 07:32:51 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2015-06-22 07:32:51 +0000 |
commit | 1e154e99250227dea61d1ddab8d687d5be2a3620 (patch) | |
tree | 899b3cdeefdcce4805b7efca779ba5d285d676b1 | |
parent | a4f909a88620667e86955c1876be8e5b07bfd6ca (diff) |
texk/kpathsea: Update mktex* programs for w32
git-svn-id: svn://tug.org/texlive/trunk@37637 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/kpathsea/win32/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/Makefile.am | 29 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/Makefile.in | 42 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/dirutil.c | 3 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/dirutil.h | 21 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/getdestdir.c | 27 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mkpaths.c | 95 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktex.h (renamed from Build/source/texk/kpathsea/win32/getdestdir.h) | 34 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktexlsr.c | 89 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktexmf.c | 5 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktexpk.c | 29 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktextfm.c | 5 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktexupd.c | 79 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktexupd.h | 19 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/win32/mktexupdmain.c | 10 |
15 files changed, 200 insertions, 296 deletions
diff --git a/Build/source/texk/kpathsea/win32/ChangeLog b/Build/source/texk/kpathsea/win32/ChangeLog index b63e5da113d..4bce31540dc 100644 --- a/Build/source/texk/kpathsea/win32/ChangeLog +++ b/Build/source/texk/kpathsea/win32/ChangeLog @@ -1,3 +1,12 @@ +2015-06-20 Peter Breitenlohner <peb@mppmu.mpg.de> + + * dirutil.h, getdestdir.h, mktexupd.h (removed): Merged ... + * mktex.h (new): ... into this and define normalize(). + * mkpaths.c (new): Define mkpaths() to handle TEXMFDBS. + * getdestdir.c, mktexpk.c, mktexupdmain.c: Use normalize(). + * mktexlsr.c: Use normalize() and mkpaths(). + * mktexupd.c: Use mkpaths(). + 2015-06-18 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am (AM_CPPFLAGS): WEB2C_KPSE_VERSION => WEB2CVERSION. diff --git a/Build/source/texk/kpathsea/win32/Makefile.am b/Build/source/texk/kpathsea/win32/Makefile.am index 7c43878a6df..3447a3dbde5 100644 --- a/Build/source/texk/kpathsea/win32/Makefile.am +++ b/Build/source/texk/kpathsea/win32/Makefile.am @@ -21,40 +21,39 @@ mktexfmt_SOURCES = \ mktexlsr_SOURCES = \ dirutil.c \ - dirutil.h \ + mkpaths.c \ + mktex.h \ mktexlsr.c mktexmf_SOURCES = \ dirutil.c \ - dirutil.h \ getdestdir.c \ - getdestdir.h \ + mkpaths.c \ + mktex.h \ mktexmf.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c mktexpk_SOURCES = \ dirutil.c \ - dirutil.h \ getdestdir.c \ - getdestdir.h \ + mkpaths.c \ + mktex.h \ mktexpk.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c mktextfm_SOURCES = \ dirutil.c \ - dirutil.h \ getdestdir.c \ - getdestdir.h \ + mkpaths.c \ + mktex.h \ mktextfm.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c mktexupd_SOURCES = \ + mkpaths.c \ + mktex.h \ mktexupdmain.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c LDADD = ../libkpathsea.la diff --git a/Build/source/texk/kpathsea/win32/Makefile.in b/Build/source/texk/kpathsea/win32/Makefile.in index d3c08ce9f44..075e67b5ab8 100644 --- a/Build/source/texk/kpathsea/win32/Makefile.in +++ b/Build/source/texk/kpathsea/win32/Makefile.in @@ -121,26 +121,28 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -am_mktexlsr_OBJECTS = dirutil.$(OBJEXT) mktexlsr.$(OBJEXT) +am_mktexlsr_OBJECTS = dirutil.$(OBJEXT) mkpaths.$(OBJEXT) \ + mktexlsr.$(OBJEXT) mktexlsr_OBJECTS = $(am_mktexlsr_OBJECTS) mktexlsr_LDADD = $(LDADD) mktexlsr_DEPENDENCIES = ../libkpathsea.la am_mktexmf_OBJECTS = dirutil.$(OBJEXT) getdestdir.$(OBJEXT) \ - mktexmf.$(OBJEXT) mktexupd.$(OBJEXT) + mkpaths.$(OBJEXT) mktexmf.$(OBJEXT) mktexupd.$(OBJEXT) mktexmf_OBJECTS = $(am_mktexmf_OBJECTS) mktexmf_LDADD = $(LDADD) mktexmf_DEPENDENCIES = ../libkpathsea.la am_mktexpk_OBJECTS = dirutil.$(OBJEXT) getdestdir.$(OBJEXT) \ - mktexpk.$(OBJEXT) mktexupd.$(OBJEXT) + mkpaths.$(OBJEXT) mktexpk.$(OBJEXT) mktexupd.$(OBJEXT) mktexpk_OBJECTS = $(am_mktexpk_OBJECTS) mktexpk_LDADD = $(LDADD) mktexpk_DEPENDENCIES = ../libkpathsea.la am_mktextfm_OBJECTS = dirutil.$(OBJEXT) getdestdir.$(OBJEXT) \ - mktextfm.$(OBJEXT) mktexupd.$(OBJEXT) + mkpaths.$(OBJEXT) mktextfm.$(OBJEXT) mktexupd.$(OBJEXT) mktextfm_OBJECTS = $(am_mktextfm_OBJECTS) mktextfm_LDADD = $(LDADD) mktextfm_DEPENDENCIES = ../libkpathsea.la -am_mktexupd_OBJECTS = mktexupdmain.$(OBJEXT) mktexupd.$(OBJEXT) +am_mktexupd_OBJECTS = mkpaths.$(OBJEXT) mktexupdmain.$(OBJEXT) \ + mktexupd.$(OBJEXT) mktexupd_OBJECTS = $(am_mktexupd_OBJECTS) mktexupd_LDADD = $(LDADD) mktexupd_DEPENDENCIES = ../libkpathsea.la @@ -340,40 +342,39 @@ mktexfmt_SOURCES = \ mktexlsr_SOURCES = \ dirutil.c \ - dirutil.h \ + mkpaths.c \ + mktex.h \ mktexlsr.c mktexmf_SOURCES = \ dirutil.c \ - dirutil.h \ getdestdir.c \ - getdestdir.h \ + mkpaths.c \ + mktex.h \ mktexmf.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c mktexpk_SOURCES = \ dirutil.c \ - dirutil.h \ getdestdir.c \ - getdestdir.h \ + mkpaths.c \ + mktex.h \ mktexpk.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c mktextfm_SOURCES = \ dirutil.c \ - dirutil.h \ getdestdir.c \ - getdestdir.h \ + mkpaths.c \ + mktex.h \ mktextfm.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c mktexupd_SOURCES = \ + mkpaths.c \ + mktex.h \ mktexupdmain.c \ - mktexupd.c \ - mktexupd.h + mktexupd.c LDADD = ../libkpathsea.la EXTRA_DIST = ChangeLog @@ -492,6 +493,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirutil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdestdir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkpaths.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktexfmt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktexlsr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktexmf.Po@am__quote@ diff --git a/Build/source/texk/kpathsea/win32/dirutil.c b/Build/source/texk/kpathsea/win32/dirutil.c index 4b471ad543d..c219efd27d0 100644 --- a/Build/source/texk/kpathsea/win32/dirutil.c +++ b/Build/source/texk/kpathsea/win32/dirutil.c @@ -17,8 +17,7 @@ */ #include <kpathsea/kpathsea.h> - -#include "dirutil.h" +#include "mktex.h" /* check a directory */ int diff --git a/Build/source/texk/kpathsea/win32/dirutil.h b/Build/source/texk/kpathsea/win32/dirutil.h deleted file mode 100644 index 72fb1dc3da9..00000000000 --- a/Build/source/texk/kpathsea/win32/dirutil.h +++ /dev/null @@ -1,21 +0,0 @@ -/* dirutil.h - - Copyright 2000, 2015 Akira Kakuto. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -extern int is_dir (char *buff); -extern int make_dir (char *buff); -extern int make_dir_p (char *buff); diff --git a/Build/source/texk/kpathsea/win32/getdestdir.c b/Build/source/texk/kpathsea/win32/getdestdir.c index 136f6fab4c2..281e3540fbd 100644 --- a/Build/source/texk/kpathsea/win32/getdestdir.c +++ b/Build/source/texk/kpathsea/win32/getdestdir.c @@ -15,6 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. + from mktexmf: + argv[0] = "Dummy", argv[1] = "source", argv[2] = path from mktexpk: argv[0] = "Dummy", argv[1] = "pk", argv[2] = path, argv[3] = mode from mktextfm: @@ -22,9 +24,7 @@ */ #include <kpathsea/kpathsea.h> - -#include "dirutil.h" -#include "getdestdir.h" +#include "mktex.h" #define NUMBUF 32 #define LENBUF 128 @@ -66,12 +66,7 @@ getdestdir (int ac, char **av) strcpy (spec, av[1]); - for (p = av[2]; *p; p++) { /* path */ - if (IS_KANJI(p)) - p++; - else if (*p == '\\') - *p = '/'; - } + normalize (av[2]); /* path */ p = av[2]; q = buff; @@ -143,12 +138,7 @@ getdestdir (int ac, char **av) topdir = kpse_var_value ("MAKETEXPK_TOP_DIR"); if (topdir && *topdir && ispk) { - for (i = 0; topdir[i]; i++) { - if (IS_KANJI(topdir+i)) - i++; - else if (topdir[i] == '\\') - topdir[i] = '/'; - } + normalize (topdir); i = (int)strlen (topdir); while(topdir[i - 1] == '/') i--; @@ -178,12 +168,7 @@ getdestdir (int ac, char **av) free(topdir); } else { if((topdir = kpse_var_value("TEXMFVAR")) != NULL) { - for (i = 0; topdir[i]; i++) { - if (IS_KANJI(topdir+i)) - i++; - else if (topdir[i] == '\\') - topdir[i] = '/'; - } + normalize (topdir); i = (int)strlen (topdir); while(topdir[i - 1] == '/') i--; diff --git a/Build/source/texk/kpathsea/win32/mkpaths.c b/Build/source/texk/kpathsea/win32/mkpaths.c new file mode 100644 index 00000000000..5de8c65658f --- /dev/null +++ b/Build/source/texk/kpathsea/win32/mkpaths.c @@ -0,0 +1,95 @@ +/* mkpaths.c + + Copyright 2015 Akira Kakuto. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include <kpathsea/kpathsea.h> +#include "mktex.h" + +char ** +mkpaths (int *numptr) +{ + char **pathbuff; + char *texmfdbs; + char *p, *pa, *pc; + int i; + + if (!(p = kpse_var_value ("TEXMFDBS"))) { + fprintf (stderr, "No definition of TEXMFDBS.\n"); + return NULL; + } + + texmfdbs = kpse_brace_expand (p); + free (p); + if (!texmfdbs) { + fprintf (stderr, "I cannot expand braces in TEXMFDBS.\n"); + return NULL; + } + + p = texmfdbs; + i = 0; + + while(*p) { + if(*p == '!' && *(p+1) == '!') + p += 2; + if(*p == ';') + while(*p == ';') + p++; + if(*p && *p != '!') { + while(*p != ';' && *p) + p++; + i++; + while(*p == ';') + p++; + } + } + + if (!i) { + free (texmfdbs); + fprintf (stderr, "No database paths in TEXMFDBS.\n"); + return NULL; + } + + *numptr = i; + pathbuff = xmalloc(i * sizeof(char *)); + + p = texmfdbs; + i = 0; + + while (*p) { + if (*p == '!' && *(p + 1) == '!') + p += 2; + if (*p == ';') { + while (*p == ';') + p++; + } + if(*p && *p != '!') { + pa = p; + while(*p != ';' && *p) + p++; + pc = p; + pathbuff[i] = xmalloc(pc - pa + 1); + strncpy(pathbuff[i], pa, pc - pa); + pathbuff[i][pc - pa] = 0; + i++; + while(*p == ';') + p++; + } + } + + free(texmfdbs); + return pathbuff; +} diff --git a/Build/source/texk/kpathsea/win32/getdestdir.h b/Build/source/texk/kpathsea/win32/mktex.h index ab1f2d652f9..b4deb0eba7b 100644 --- a/Build/source/texk/kpathsea/win32/getdestdir.h +++ b/Build/source/texk/kpathsea/win32/mktex.h @@ -1,4 +1,4 @@ -/* getdestdir.h +/* mktex.h Copyright 2000, 2015 Akira Kakuto. @@ -14,11 +14,41 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef MKTEX_H +#define MKTEX_H + +static inline void +normalize (char *p) { + for (; *p; p++) { + if (IS_KANJI(p)) + p++; + else if (*p == '\\') + *p = '/'; + } +} + +/* dirutil.c */ +extern int is_dir (char *buff); +extern int make_dir (char *buff); +extern int make_dir_p (char *buff); + +/* getdestdir.c + from mktexmf: + argv[0] = "Dummy", argv[1] = "source", argv[2] = path from mktexpk: argv[0] = "Dummy", argv[1] = "pk", argv[2] = path, argv[3] = mode from mktextfm: argv[0] = "Dummy", argv[1] = "tfm", argv[2] = path */ - extern char *getdestdir (int ac, char **av); + +/* mkpaths.c */ +extern char **mkpaths (int *numptr); + +/* mktexupd.c*/ +extern void mktexupd (char *s); + +#endif diff --git a/Build/source/texk/kpathsea/win32/mktexlsr.c b/Build/source/texk/kpathsea/win32/mktexlsr.c index c2ddc81273f..a7926f7eb5e 100644 --- a/Build/source/texk/kpathsea/win32/mktexlsr.c +++ b/Build/source/texk/kpathsea/win32/mktexlsr.c @@ -19,12 +19,10 @@ */ #include <kpathsea/kpathsea.h> - -#ifdef __MINGW32__ -#include "dirutil.h" -#else +#ifndef __MINGW32__ #include <kpathsea/dirent.h> #endif +#include "mktex.h" /* magic header */ #define HDL "%% ls-R -- filename database for kpathsea; do not change this line.\n" @@ -39,15 +37,9 @@ search(char *name) DIR *dp; struct dirent *de; char buff[256]; - char *p; int len; - for(p = name; *p; p++) { - if(IS_KANJI(p)) - p++; - else if (*p == '\\') - *p = '/'; - } + normalize (name); if((dp = opendir(name))) { fprintf(ls_R, "\n%s:\n", name); @@ -110,14 +102,12 @@ char first_name[] = "./"; int main(int ac, char **av) { - char *texmfdbs = NULL; int cdrive, tdrive; char ls_R_name[512]; int i, numtree; size_t len; char *progname; - char **pathbuff = NULL; - char *p, *pa, *pc; + char **pathbuff; kpse_set_program_name(av[0], NULL); progname = kpse_program_name; @@ -151,75 +141,13 @@ int main(int ac, char **av) pathbuff = xmalloc(numtree * sizeof(char *)); for(i=0; i < numtree; i++) { pathbuff[i] = xstrdup(av[i+1]); - for(p = pathbuff[i]; *p; p++) { - if(IS_KANJI(p)) - p++; - else if(*p == '\\') - *p = '/'; - } + normalize (pathbuff[i]); } } else { - if(!(p = kpse_var_value("TEXMFDBS"))) { - fprintf(stderr, "TEXMFDBS is not defined in texmf.cnf.\n"); + if (!(pathbuff = mkpaths (&numtree))) { + fprintf (stderr, "Maybe you are not using ls-R.\n"); exit (100); } - - texmfdbs = kpse_brace_expand(p); - free(p); - - p = texmfdbs; - i = 0; - - while(*p) { - if(*p == '!' && *(p+1) == '!') - p += 2; - if(*p == ';') - while(*p == ';') - p++; - if(*p && *p != '!') { - while(*p != ';' && *p) - p++; - if(*p == ';') { - i++; - while(*p == ';') - p++; - } else if(*p == '\0') { - i++; - break; - } - } - } - - numtree = i; - - pathbuff = malloc(numtree * sizeof(char *)); - - i = 0; - pa = texmfdbs; - - while (*pa) { - if (*pa == '!' && *(pa + 1) == '!') - pa += 2; - if (*pa == ';') { - while (*pa == ';') - pa++; - } - if(*pa && *pa != '!') { - pathbuff[i] = malloc(strlen(pa) + 1); - pc = pathbuff[i]; - while (*pa != ';' && *pa) - *pc++ = *pa++; - *pc = '\0'; - if (*pa == ';') { - while (*pa == ';') - pa++; - i++; - } else if (*pa == '\0') { - i++; - break; - } - } - } } for(i = 0; i < numtree; i++) { @@ -264,8 +192,5 @@ int main(int ac, char **av) free (pathbuff); - if(texmfdbs) - free(texmfdbs); - return 0; } diff --git a/Build/source/texk/kpathsea/win32/mktexmf.c b/Build/source/texk/kpathsea/win32/mktexmf.c index 876719d1c54..af38fa50b68 100644 --- a/Build/source/texk/kpathsea/win32/mktexmf.c +++ b/Build/source/texk/kpathsea/win32/mktexmf.c @@ -17,10 +17,7 @@ */ #include <kpathsea/kpathsea.h> - -#include "dirutil.h" -#include "getdestdir.h" -#include "mktexupd.h" +#include "mktex.h" #define SBUF 512 diff --git a/Build/source/texk/kpathsea/win32/mktexpk.c b/Build/source/texk/kpathsea/win32/mktexpk.c index ee716b8de76..de7d6b45607 100644 --- a/Build/source/texk/kpathsea/win32/mktexpk.c +++ b/Build/source/texk/kpathsea/win32/mktexpk.c @@ -47,10 +47,7 @@ #ifndef __MINGW32__ #include <web2c/w2c/c-auto.h> #endif - -#include "dirutil.h" -#include "getdestdir.h" -#include "mktexupd.h" +#include "mktex.h" #define LLBUF 1024 #define LBUF 512 @@ -300,16 +297,11 @@ main (int ac, char **av) return (100); } tmp = xstrdup(tmp); + /* * normalize directory separators */ - - for (fpp = tmp; *fpp; fpp++) { - if (IS_KANJI(fpp)) - fpp++; - else if (*fpp == '\\') - *fpp = '/'; - } + normalize (tmp); for (i = 0; i < 4; i++) arg[i] = (char *) malloc (SBUF); @@ -679,12 +671,7 @@ main (int ac, char **av) free(tmp); return (100); } - for (fpp = currdir; *fpp; fpp++) { - if (IS_KANJI(fpp)) - fpp++; - else if (*fpp == '\\') - *fpp = '/'; - } + normalize (currdir); i = (int)strlen (currdir); if (currdir[i - 1] == '/') @@ -717,13 +704,7 @@ main (int ac, char **av) /* * Change backslash into slash */ - - for (p = rbuff; *p; p++) { - if (IS_KANJI(p)) - p++; - else if (*p == '\\') - *p = '/'; - } + normalize (rbuff); p = rbuff; i = (int)strlen (p); diff --git a/Build/source/texk/kpathsea/win32/mktextfm.c b/Build/source/texk/kpathsea/win32/mktextfm.c index d9da4aeb5ab..34cea032d7b 100644 --- a/Build/source/texk/kpathsea/win32/mktextfm.c +++ b/Build/source/texk/kpathsea/win32/mktextfm.c @@ -23,10 +23,7 @@ #ifndef __MINGW32__ #include <web2c/w2c/c-auto.h> #endif - -#include "dirutil.h" -#include "getdestdir.h" -#include "mktexupd.h" +#include "mktex.h" #define LBUF 512 #define SBUF 512 diff --git a/Build/source/texk/kpathsea/win32/mktexupd.c b/Build/source/texk/kpathsea/win32/mktexupd.c index 48a5de2b540..c05ae1f74b8 100644 --- a/Build/source/texk/kpathsea/win32/mktexupd.c +++ b/Build/source/texk/kpathsea/win32/mktexupd.c @@ -17,13 +17,11 @@ */ #include <kpathsea/kpathsea.h> - -#include "mktexupd.h" +#include "mktex.h" #define MBUF 512 #define SBUF 512 #define LBUF 512 -#define DBS "TEXMFDBS" void mktexupd (char *s) @@ -31,83 +29,17 @@ mktexupd (char *s) char fname[MBUF]; char lsrname[SBUF]; char path[LBUF]; - char **pathbuff = NULL; + char **pathbuff; int i, j, numtree; - char *pa, *pb, *pc; + char *pa, *pb; int existflag = 0; FILE *f; - pa = kpse_var_value (DBS); - if (pa == NULL) { - fprintf (stderr, "No definition of TEXMFDBS.\n"); - fprintf (stderr, "Maybe you are not using ls-R.\n"); - return; - } - - pb = kpse_brace_expand (pa); - free (pa); - if (pb == NULL) { - fprintf (stderr, "I cannot expand braces in TEXMFDBS.\n"); + if (!(pathbuff = mkpaths (&numtree))) { fprintf (stderr, "Maybe you are not using ls-R.\n"); return; } - pa = pb; - i = 0; - - while(*pa) { - if(*pa == '!' && *(pa+1) == '!') - pa += 2; - if(*pa == ';') - while(*pa == ';') - pa++; - if(*pa && *pa != '!') { - while(*pa != ';' && *pa) - pa++; - if(*pa == ';') { - i++; - while(*pa == ';') - pa++; - } else if(*pa == '\0') { - i++; - break; - } - } - } - - numtree = i; - - pathbuff = xmalloc(numtree * sizeof(char *)); - - pa = pb; - i = 0; - - while (*pa) { - if (*pa == '!' && *(pa + 1) == '!') - pa += 2; - if (*pa == ';') { - while (*pa == ';') - pa++; - } - if(*pa && *pa != '!') { - pathbuff[i] = malloc(strlen(pa) + 1); - pc = pathbuff[i]; - while (*pa != ';' && *pa) - *pc++ = *pa++; - *pc = '\0'; - if (*pa == ';') { - while (*pa == ';') - pa++; - i++; - } else if (*pa == '\0') { - i++; - break; - } - } - } - - free (pb); - for (i = 0; i < numtree; i++) { j = (int)strlen (pathbuff[i]); if (pathbuff[i][j - 1] == '/') @@ -154,9 +86,8 @@ mktexupd (char *s) f = fopen (lsrname, "ab"); fprintf (f, "\n.%s:\n%s\n", pa, fname); fclose (f); - } else { + } else fprintf(stderr, "mktexupd failed\n"); - } for (i = 0; i < numtree; i++) free (pathbuff[i]); free (pathbuff); diff --git a/Build/source/texk/kpathsea/win32/mktexupd.h b/Build/source/texk/kpathsea/win32/mktexupd.h deleted file mode 100644 index 2e0ea6277f8..00000000000 --- a/Build/source/texk/kpathsea/win32/mktexupd.h +++ /dev/null @@ -1,19 +0,0 @@ -/* mktexupd.h - - Copyright 2000, 2015 Akira Kakuto. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -extern void mktexupd (char *s); diff --git a/Build/source/texk/kpathsea/win32/mktexupdmain.c b/Build/source/texk/kpathsea/win32/mktexupdmain.c index 1aa9e88e737..841dac288c7 100644 --- a/Build/source/texk/kpathsea/win32/mktexupdmain.c +++ b/Build/source/texk/kpathsea/win32/mktexupdmain.c @@ -17,15 +17,13 @@ */ #include <kpathsea/kpathsea.h> - -#include "mktexupd.h" +#include "mktex.h" int main(int argc, char **argv) { char dir[256]; char file[256]; char path[256]; - char *p; size_t i; kpse_set_program_name (argv[0], NULL); @@ -35,11 +33,7 @@ int main(int argc, char **argv) } strcpy(dir, argv[1]); strcpy(file, argv[2]); - for(p = dir; *p; ++p) { - if(IS_KANJI(p)) - p++; - else if(*p == '\\') *p = '/'; - } + normalize (dir); i = strlen(dir); while(dir[i-1] == '/') i--; |