From dafe7639674f3bfc66d3a116ec836c269c08f473 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 31 Oct 2023 12:01:51 -0400 Subject: msg() function is now type void * Add debug_shell() function to interactively examine the runtime environment --- src/utils.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index c0bb28f..4e82a64 100644 --- a/src/utils.c +++ b/src/utils.c @@ -370,14 +370,14 @@ char *git_describe(const char *path) { #define OMC_COLOR_WHITE "\e[1;97m" #define OMC_COLOR_RESET "\e[0;37m\e[0m" -int msg(unsigned type, char *fmt, ...) { +void msg(unsigned type, char *fmt, ...) { FILE *stream = NULL; char header[255]; char status[255]; if (type & OMC_MSG_NOP) { // quiet mode - return 0; + return; } memset(header, 0, sizeof(header)); @@ -415,3 +415,10 @@ int msg(unsigned type, char *fmt, ...) { printf("%s", OMC_COLOR_RESET); va_end(args); } + +void debug_shell() { + msg(OMC_MSG_L1 | OMC_MSG_WARN, "ENTERING OMC DEBUG SHELL\n" OMC_COLOR_RESET); + system("/bin/bash -c 'PS1=\"(OMC DEBUG) \\W $ \" bash --norc --noprofile'"); + msg(OMC_MSG_L1 | OMC_MSG_WARN, "EXITING OMC DEBUG SHELL\n" OMC_COLOR_RESET); + exit(255); +} -- cgit