summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luatex.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luatex.c')
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c28
1 files changed, 10 insertions, 18 deletions
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);