static int _cmd_complete(int all) { char **argv = NULL; int argc = 0; int rc = 1; char *line = malloc(strlen(rl_line_buffer) + 2); if (!line) return -1; strcpy(line, rl_line_buffer); line[rl_point] = 2; /* empty character, will force a word */ line[rl_point+1] = 0; if (tokenize_line(line, &argc, &argv) != 0) goto end; char *compl = commands_complete(root, argc, (const char **)argv, all); if (compl && strlen(argv[argc-1]) < strlen(compl)) { if (rl_insert_text(compl + strlen(argv[argc-1])) < 0) { free(compl); goto end; } free(compl); rc = 0; goto end; } /* No completion or several completion available. */ fprintf(stderr, "\n"); rl_forced_update_display(); rc = 0; end: free(line); tokenize_free(argc, argv); return rc; }
////////////////////////////////////////////////////////////////////////// // CLEventSet // bool CLEventSet::clear_complete() { return commands_complete(); }
bool CLProgram::clear_complete() { return commands_complete(); }