GEBS_CMD() convinience macro

This commit is contained in:
kamkow1
2025-05-19 11:44:52 +02:00
parent 6cbfd5ca91
commit 0087c523b5
3 changed files with 16 additions and 9 deletions

11
gebs.h
View File

@ -182,6 +182,17 @@ typedef Gebs_NString_List Gebs_Cmd;
int gebs_cmd_run_sync_alloc(Gebs_Allocator *alloc, Gebs_Cmd *cmd);
#define GEBS_CMD(...) \
({ \
char *__args[] = { __VA_ARGS__ }; \
Gebs_Cmd __cmd = {0}; \
defer { gebs_cmd_free(&__cmd); } \
for (size_t __i = 0; __i < sizeof(__args)/sizeof(__args[0]); __i++) { \
gebs_cmd_append(&__cmd, __args[__i]); \
} \
gebs_cmd_run(&__cmd); \
})
// ----------------------------------------------------------------------------
// The build system
// ----------------------------------------------------------------------------