summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPiotr Strzelczyk <piotr@eps.gda.pl>2009-09-21 18:40:41 +0000
committerPiotr Strzelczyk <piotr@eps.gda.pl>2009-09-21 18:40:41 +0000
commit4b33efcf0eb29d722a2960bed609bcd20ed699af (patch)
treede4075c294fed69569a6e054de40aa1444c59a57 /Build/source
parent9e74a36317b6ac49bcaa668675d8f753769f80ee (diff)
exe stubs as proxy to dll & fix for propagation of exit code
git-svn-id: svn://tug.org/texlive/trunk@15404 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/texlive/runscript.dllbin0 -> 4608 bytes
-rwxr-xr-xBuild/source/texk/texlive/runscript.exebin4096 -> 1536 bytes
-rw-r--r--Build/source/texk/texlive/runscript_dll.c (renamed from Build/source/texk/texlive/runscript.c)20
-rw-r--r--Build/source/texk/texlive/runscript_exe.c7
4 files changed, 19 insertions, 8 deletions
diff --git a/Build/source/texk/texlive/runscript.dll b/Build/source/texk/texlive/runscript.dll
new file mode 100644
index 00000000000..a46d3977d6d
--- /dev/null
+++ b/Build/source/texk/texlive/runscript.dll
Binary files differ
diff --git a/Build/source/texk/texlive/runscript.exe b/Build/source/texk/texlive/runscript.exe
index a93ef24732b..5777d90a17a 100755
--- a/Build/source/texk/texlive/runscript.exe
+++ b/Build/source/texk/texlive/runscript.exe
Binary files differ
diff --git a/Build/source/texk/texlive/runscript.c b/Build/source/texk/texlive/runscript_dll.c
index bb06bc2d5d5..b961f03714b 100644
--- a/Build/source/texk/texlive/runscript.c
+++ b/Build/source/texk/texlive/runscript_dll.c
@@ -1,7 +1,5 @@
/*
-runscript.c
-
Public Domain
Originally written 2009 by T.M.Trzeciak
@@ -18,15 +16,20 @@ are some odd cases where they are not interchangeable with them.
Usage:
-simply copy and rename the compiled binary
+Simply copy and rename the compiled program. The executable part
+is just a proxy the runscript function in runscript.dll. This arrangement
+is for maintenance reasons - upgrades can be done by replacement of
+a single .dll rather than all .exe stubs
Compilation:
with gcc (size optimized):
-gcc -Os -s -o runscript.exe runscript.c
+gcc -Os -s -shared -o runscript.dll runscript_dll.c
+gcc -Os -s -o runscript.exe runscript_exe.c -L./ -lrunscript
with tcc (ver. 0.9.24), extra small size
-tcc -o runscript.exe runscript.c
+tcc -shared -o runscript.dll runscript_dll.c
+tcc -o runscript.exe runscript_exe.c runscript.def
*/
@@ -42,7 +45,7 @@ static char basename[MAX_PATH];
static char progname[MAX_PATH];
static char cmdline[MAX_CMD];
-int main( int argc, char *argv[] ) {
+__declspec(dllexport) int dllrunscript( int argc, char *argv[] ) {
int i;
static char path[MAX_PATH];
@@ -98,9 +101,10 @@ int main( int argc, char *argv[] ) {
PROGRAM_FOUND:
if ( !cmdline[0] ) {
- strcpy(cmdline, "\"");
+ // batch file has to be executed through the call command in order to propagate its exit code
+ strcpy(cmdline, "cmd.exe /c call \"");
strcat(cmdline, path);
- strcat(cmdline, "\"");
+ strcat(cmdline, "\" ");
}
// get the command line for this process
diff --git a/Build/source/texk/texlive/runscript_exe.c b/Build/source/texk/texlive/runscript_exe.c
new file mode 100644
index 00000000000..7aaf08140bf
--- /dev/null
+++ b/Build/source/texk/texlive/runscript_exe.c
@@ -0,0 +1,7 @@
+// an .exe part of runscript program
+// see runscript_dll.c for more details
+#include <windows.h>
+__declspec(dllimport) int dllrunscript( argc, argv );
+int main( int argc, char *argv[] ) {
+ return dllrunscript( argc, argv );
+}