msh/src/builtins/builtins.c

22 lines
434 B
C
Raw Normal View History

2026-01-19 15:03:36 -07:00
#include "builtins.h"
#include "../system/system.h"
#include "../util/util.h"
int hashes_calced = 0;
int cd_hash = 0;
int msh_try_builtin(char *cmd, char **args) {
int hash = str_hash(cmd);
if (hashes_calced == 0) {
cd_hash = str_hash("cd");
hashes_calced = 1;
}
if (hash == cd_hash) {
msh_builtin_cd(args[1]);
return 1;
}
return 0;
};
void msh_builtin_cd(char *ch) { msh_set_working_directory(ch); };