22 lines
434 B
C
22 lines
434 B
C
|
|
#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); };
|