tb Enable/disable command logging dynamically + setlogcmds builtin

This commit is contained in:
2025-10-18 10:48:31 +02:00
parent d136c001df
commit a46da0a7ae
6 changed files with 56 additions and 21 deletions

View File

@ -4,6 +4,7 @@
#include "interp.h"
#include "runtime.h"
#include "macros.h"
#include "config.h"
extern PID_t PID;
extern Dev_t ps2kbdev;
@ -124,6 +125,7 @@ void tz_classify(Tokenizer *tz) {
else IF_RTCMD(stackpop)
else IF_RTCMD(eachfile)
else IF_RTCMD(mkaliasbn)
else IF_RTCMD(setlogcmds)
else {
tk->type = TOK_MISC;
}
@ -166,7 +168,7 @@ void tz_expandspecial(Tokenizer *tz) {
#define LINE_MAX 1024
bool interp_runstring(char *string, InterpResult **res, bool logcmds, bool interactive) {
bool interp_runstring(char *string, InterpResult **res, bool interactive) {
*res = &RES;
string_memset(RES.errmsg, 0, sizeof(RES.errmsg));
@ -175,7 +177,7 @@ bool interp_runstring(char *string, InterpResult **res, bool logcmds, bool inter
char *line = string_tokenizealloc_linecontinue(string, "\n");
while (line != NULL) {
if (logcmds) {
if (CONFIG.logcmds) {
uprintf("+%s\n", line);
}