39 lines
815 B
C
39 lines
815 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "dusk.h"
|
|
#include "error/error.h"
|
|
#include "console/console.h"
|
|
#include "util/string.h"
|
|
|
|
bool_t exitRequested = false;
|
|
|
|
void cmdExit(const consolecmdexec_t *exec) {
|
|
exitRequested = true;
|
|
}
|
|
|
|
void testChange(const consolevar_t *var) {
|
|
consolePrint("Variable '%s' changed to '%s'.", var->name, var->value);
|
|
}
|
|
|
|
int main() {
|
|
consoleInit();
|
|
|
|
consoleRegCmd("exit", cmdExit);
|
|
consoleRegVar("test", "Hello", testChange);
|
|
consolePrint(" = Dusk Console = ");
|
|
|
|
char_t buffer[CONSOLE_LINE_MAX];
|
|
while(fgets(buffer, sizeof(buffer), stdin)) {
|
|
consoleExec(buffer);
|
|
consoleProcess();
|
|
if(exitRequested) break;
|
|
}
|
|
printf("Goodbye!\n");
|
|
|
|
return 0;
|
|
} |