summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-12-01 11:21:22 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-12-01 11:21:22 +0000
commit788e5954ed32bd4609c5ae5015aad4404d1b9aac (patch)
tree33019e06fd49e3234d7e1deaba73d4ad2cccce75 /Build/source/texk
parent6a6e883e80a6273c5376e7039c04b641405b6ad2 (diff)
factor common WIN32 & Unix code
avoid compiler warnings git-svn-id: svn://tug.org/texlive/trunk@20628 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/tex-make.c50
2 files changed, 18 insertions, 37 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 8dd247b1435..1edf310abee 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+2010-12-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * tex-make.c (maketex): Factor out common WIN32 & Unix code.
+ [WIN32]: Avoid compiler warnings.
+
2010-12-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* tex-make.c (maketex): [WIN32] spawnvp(_P_NOWAIT, ...) and pipe.
diff --git a/Build/source/texk/kpathsea/tex-make.c b/Build/source/texk/kpathsea/tex-make.c
index f3c7d2a5c0e..16918f8c36a 100644
--- a/Build/source/texk/kpathsea/tex-make.c
+++ b/Build/source/texk/kpathsea/tex-make.c
@@ -195,24 +195,26 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args)
}
#elif defined (MSDOS) && !defined(__DJGPP__)
#error Implement new MSDOS mktex call interface here
-#elif defined (WIN32)
- { /* spawnvp(_P_NOWAIT, ...) and pipe --ak 2002/12/15 */
+#else /* WIN32 or Unix */
+ {
+#if defined (WIN32)
+ /* spawnvp(_P_NOWAIT, ...) and pipe --ak 2002/12/15 */
- int nexitcode = STILL_ACTIVE;
+ unsigned long nexitcode = STILL_ACTIVE;
HANDLE hchild;
int hstdout, childpipe[2];
- int hstderr;
+ int hstderr = -1;
FILE *Hnul = NULL;
+ fn = NULL;
+
if(_pipe(childpipe, 1024, O_TEXT | _O_NOINHERIT) == -1) {
perror("kpathsea: pipe()");
- fn = NULL;
goto labeldone;
}
hstdout = _dup(fileno(stdout));
if(_dup2(childpipe[1], fileno(stdout)) != 0) {
- fn = NULL;
close(hstdout);
close(childpipe[0]);
close(childpipe[1]);
@@ -232,13 +234,12 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args)
}
}
fprintf(stderr, "\nThe command name is %s\n", fullbin);
- hchild = (HANDLE)spawnvp(_P_NOWAIT, fullbin, args);
+ hchild = (HANDLE)spawnvp(_P_NOWAIT, fullbin, (const char * const *) args);
_dup2(hstdout, fileno(stdout));
close(hstdout);
if((int)hchild == -1) {
- fn = NULL;
close(childpipe[0]);
goto labeldone;
}
@@ -257,7 +258,7 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args)
free(fn);
fn = newfn;
}
- if(!GetExitCodeProcess((HANDLE)hchild, (unsigned long*)&nexitcode)) {
+ if(!GetExitCodeProcess(hchild, &nexitcode)) {
fn = NULL;
close(childpipe[0]);
goto labeldone;
@@ -272,31 +273,7 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args)
close(hstderr);
fclose(Hnul);
}
-
- if (fn) {
- len = strlen(fn);
-
- /* Remove trailing newlines and returns. */
- while (len && (fn[len - 1] == '\n' || fn[len - 1] == '\r')) {
- fn[len - 1] = '\0';
- len--;
- }
-
- ret = len == 0 ? NULL : kpathsea_readable_file (kpse, fn);
- if (!ret && len > 1) {
- WARNING2("kpathsea: %s output `%s' instead of a filename",
- args[0], fn);
- }
-
- /* Free the name if we're not returning it. */
- if (fn != ret)
- free (fn);
- } else {
- ret = NULL;
- }
- }
-#else
- {
+#else /* !WIN32 */
/* Standard input for the child. Set to /dev/null */
int childin;
/* Standard output for the child, what we're interested in. */
@@ -396,6 +373,7 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args)
/* We don't really care about the exit status at this point. */
wait(NULL);
}
+#endif /* !WIN32 */
if (fn) {
len = strlen(fn);
@@ -415,11 +393,9 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args)
/* Free the name if we're not returning it. */
if (fn != ret)
free (fn);
- } else {
- ret = NULL;
}
}
-#endif
+#endif /* WIN32 or Unix */
if (ret == NULL)
misstex (kpse, format, args);