summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/win32/mktexupd.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2015-06-22 07:32:51 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2015-06-22 07:32:51 +0000
commit1e154e99250227dea61d1ddab8d687d5be2a3620 (patch)
tree899b3cdeefdcce4805b7efca779ba5d285d676b1 /Build/source/texk/kpathsea/win32/mktexupd.c
parenta4f909a88620667e86955c1876be8e5b07bfd6ca (diff)
texk/kpathsea: Update mktex* programs for w32
git-svn-id: svn://tug.org/texlive/trunk@37637 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/win32/mktexupd.c')
-rw-r--r--Build/source/texk/kpathsea/win32/mktexupd.c79
1 files changed, 5 insertions, 74 deletions
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);