2021-06-27 14:34:03 -04:00
|
|
|
void loop() {
|
|
|
|
while (1) {
|
|
|
|
print_input_line();
|
|
|
|
|
|
|
|
char *line = get_console_input();
|
|
|
|
|
|
|
|
StringArray args;
|
|
|
|
create_string_array(&args);
|
|
|
|
|
|
|
|
char *saveptr = NULL;
|
|
|
|
char *token = strtok_r(line, " ", &saveptr);
|
|
|
|
while (token) {
|
|
|
|
insert_string_array(&args, token);
|
|
|
|
token = strtok_r(NULL, " ", &saveptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (args.size == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_builtin(args.array[0])) {
|
|
|
|
run_builtin(&args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|