diff options
Diffstat (limited to 'src/main_compgen.c')
-rw-r--r-- | src/main_compgen.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main_compgen.c b/src/main_compgen.c index 743d2cc..6375c54 100644 --- a/src/main_compgen.c +++ b/src/main_compgen.c @@ -1,10 +1,16 @@ #include <stdio.h> +#include <stdlib.h> #include "compgen.h" #include "string_vec.h" int main() { - struct string_vec commands = compgen_cached(); - string_vec_save(&commands, stdout); - string_vec_destroy(&commands); + char *buf = compgen_cached(); + struct string_ref_vec commands = string_ref_vec_from_buffer(buf); + for (size_t i = 0; i < commands.count; i++) { + fputs(commands.buf[i].string, stdout); + fputc('\n', stdout); + } + string_ref_vec_destroy(&commands); + free(buf); } |