vinix-ports / readline / check-history.c
15 lines · 14 sloc · 437 bytes · d7c07d8d2662c86b2ccd53b86eac2460f42dbddf
Raw
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <readline/history.h>
5#include <readline/readline.h>
6
7int main(void) {
8 using_history();
9 add_history("Vinix history");
10 HIST_ENTRY *entry = history_get(history_base);
11 int valid = rl_readline_version == RL_READLINE_VERSION && entry &&
12 strcmp(entry->line, "Vinix history") == 0;
13 clear_history();
14 return valid ? EXIT_SUCCESS : EXIT_FAILURE;
15}
16