shell: added completion support

This commit is contained in:
2017-08-28 15:40:51 +02:00
parent 66dd178c7e
commit a33c45a530
3 changed files with 30 additions and 2 deletions

View File

@@ -1,5 +1,10 @@
#include "shell.h"
char** s_completion(const char* text, int start, int end) {
rl_attempted_completion_over = 1;
return rl_completion_matches(text, s_names);
}
void s_die(const char* msg) {
fprintf(stderr, "s: %s\n", msg);
exit(1);
@@ -72,6 +77,8 @@ int s_exec(char** args) {
}
void s_loop() {
rl_attempted_completion_function = s_completion;
char** cmd;
int s;