| 1 |
/* Public domain. |
| 2 |
* Originally written by Akira Kakuto <[email protected]> |
| 3 |
* |
| 4 |
* WIN32 wrapper program replacing Unix symlinks such as, |
| 5 |
* e.g., ofm2opl -> omfonts. |
| 6 |
* |
| 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> |
| 15 |
|
| 16 |
static int is_include_space(char *s) |
| 17 |
{ |
| 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; |
| 24 |
} |
| 25 |
|
| 26 |
int main(int argc, char *argv[]) |
| 27 |
{ |
| 28 |
int i; |
| 29 |
char *p; |
| 30 |
|
| 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; |
| 39 |
} |
| 40 |
} |
| 41 |
argv[argc] = NULL; |
| 42 |
return _spawnvp(_P_WAIT, EXEPROG, (const char * const *)argv); |
| 43 |
} |