32 lines
578 B
C
32 lines
578 B
C
#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
if(argc < 2) {
|
|
puts("Usage: winecdmwrap.exe [PROGRAM] [ARGS]");
|
|
return 1;
|
|
}
|
|
|
|
size_t len = 0;
|
|
for(int i = 1; i < argc; ++i)
|
|
len += strlen(argv[i])+1;
|
|
const char* uniprefix = "cmd /c start /unix ";
|
|
len+=strlen(uniprefix);
|
|
char* cmd = calloc(1, len);
|
|
strcat(cmd, uniprefix);
|
|
|
|
for(int i = 1; i < argc; ++i) {
|
|
len += strlen(argv[i])+1;
|
|
strcat(cmd, argv[i]);
|
|
strcat(cmd, " ");
|
|
}
|
|
|
|
printf("running command: %s\n", cmd);
|
|
|
|
system(cmd);
|
|
|
|
return 0;
|
|
}
|