archivemuh
This commit is contained in:
27
archive/dusk/console/consolecmd.c
Normal file
27
archive/dusk/console/consolecmd.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "consolecmd.h"
|
||||
#include "assert/assert.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/string.h"
|
||||
|
||||
void consoleCmdInit(
|
||||
consolecmd_t *cmd,
|
||||
const char_t *name,
|
||||
consolecmdfunc_t function
|
||||
) {
|
||||
assertNotNull(cmd, "Command is NULL.");
|
||||
assertNotNull(name, "Name is NULL.");
|
||||
assertNotNull(function, "Function is NULL.");
|
||||
assertStrLenMin(name, 1, "Name is empty.");
|
||||
assertStrLenMax(name, CONSOLE_CMD_NAME_MAX, "Name is too long.");
|
||||
|
||||
memoryZero(cmd, sizeof(consolecmd_t));
|
||||
stringCopy(cmd->name, name, CONSOLE_CMD_NAME_MAX);
|
||||
cmd->function = function;
|
||||
}
|
Reference in New Issue
Block a user