summaryrefslogtreecommitdiff
path: root/src/main_compgen.c
blob: 6375c54ac06fe921ba877fa85e42cf90f4ad259e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
#include <stdlib.h>
#include "compgen.h"
#include "string_vec.h"

int main()
{
	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);
}