GEBS_CMD() convinience macro
This commit is contained in:
11
gebs.h
11
gebs.h
@ -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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user