inial commit
This commit is contained in:
commit
e7972b56ad
2 changed files with 36 additions and 0 deletions
4
CMakeLists.txt
Normal file
4
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
project(winecmdwrap C)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} main.c)
|
||||||
32
main.c
Normal file
32
main.c
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#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;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue