From 493998a8e5601018e974451a4aa1621d752698bb Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 8 Oct 2014 08:27:03 +0000 Subject: LuaTeX: Apply some recent changes from texk/web2c/lib/texmfmp.c git-svn-id: svn://tug.org/texlive/trunk@35331 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/ChangeLog | 5 +++++ Build/source/texk/web2c/luatexdir/luatex.c | 28 ++++++++++------------------ 2 files changed, 15 insertions(+), 18 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 8602a488d12..e3c1942051e 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,8 @@ +2014-10-08 Peter Breitenlohner + + * luatex.c: Sync with some recent changes in ../lib/texmfmp.c + (and luatexfirst.c from W32TeX). + 2014-09-16 Peter Breitenlohner * am/luatex.am: Factor out common *_LDADD and *_DEPENDENCIES. diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index b98c250493b..1b9df5f06e1 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -113,40 +113,31 @@ void mk_shellcmdlist(char *v) { char **p; char *q, *r; - unsigned int n; + size_t n; q = v; - n = 0; + n = 1; /* analyze the variable shell_escape_commands = foo,bar,... spaces before and after (,) are not allowed. */ while ((r = strchr(q, ',')) != 0) { n++; - r++; - q = r; + q = r + 1; } if (*q) n++; - cmdlist = (char **) xmalloc((unsigned) ((n + 1) * sizeof(char *))); + cmdlist = (char **) xmalloc(n * sizeof(char *)); p = cmdlist; q = v; while ((r = strchr(q, ',')) != 0) { *r = '\0'; - *p = (char *) xmalloc((unsigned) strlen(q) + 1); - strcpy(*p, q); - *r = ','; - r++; - q = r; - p++; + *p++ = xstrdup (q); + q = r + 1; } - if (*q) { - *p = (char *) xmalloc((unsigned) strlen(q) + 1); - strcpy(*p, q); - p++; - *p = NULL; - } else - *p = NULL; + if (*q) + *p++ = xstrdup (q); + *p = NULL; } /* Called from maininit. Not static because also called from @@ -468,6 +459,7 @@ main (int ac, string *av) # ifdef WIN32 _setmaxstdio(2048); SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); + setmode(fileno(stdin), _O_BINARY); # endif lua_initialize(ac, av); -- cgit v1.2.3