From a9bfc1b0e37fef1aaec0f6e41b949464d6e237b0 Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Mon, 25 Aug 2025 20:17:41 +1000 Subject: [PATCH] exec external library --- extlibs/exec.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 extlibs/exec.cpp diff --git a/extlibs/exec.cpp b/extlibs/exec.cpp new file mode 100644 index 0000000..d0f6f83 --- /dev/null +++ b/extlibs/exec.cpp @@ -0,0 +1,16 @@ +#include "ground_lib.h" + +GroundValue exec(GroundValue* args, int arg_count) { + VALIDATE_ARGS_1(GROUND_STRING); + int exec = system(GET_STRING(args[0])); + return GROUND_INT_VAL(exec); +} + +GROUND_LIBRARY_INTERFACE() + +GROUND_LIBRARY_INIT() + REGISTER_GROUND_FUNCTION(exec); +GROUND_LIBRARY_INIT_END() + +GROUND_LIBRARY_CLEANUP() +GROUND_LIBRARY_CLEANUP_END()