new beta-0.90.0
[luatex.git] / source / texk / texlive / w32_wrapper / callexe.c
blob2aa041ea0da956139640b46b649cf9830fd0e50f
1 /* Public domain.
2 * Originally written by Akira Kakuto <kakuto@fuk.kindai.ac.jp>
4 * WIN32 wrapper program replacing Unix symlinks such as,
5 * e.g., ofm2opl -> omfonts.
7 * EXEPROG must be defined in the Makefile as,
8 * e.g., -DEXEPROG=\"omfonts.exe\".
9 */
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <process.h>
13 #include <string.h>
14 #include <malloc.h>
16 static int is_include_space(char *s)
18 char *p;
19 p = strchr(s, ' ');
20 if(p) return 1;
21 p = strchr(s, '\t');
22 if(p) return 1;
23 return 0;
26 int main(int argc, char *argv[])
28 int i;
29 char *p;
31 for(i = 0; i < argc; i++) {
32 if(is_include_space(argv[i])) {
33 p = (char *)malloc(strlen(argv[i])+3);
34 strcpy(p, "\"");
35 strcat(p, argv[i]);
36 strcat(p, "\"");
37 free(argv[i]);
38 argv[i] = p;
41 argv[argc] = NULL;
42 return _spawnvp(_P_WAIT, EXEPROG, (const char * const *)argv);