return compnode;
}
-static struct ec_completed_match *
-ec_completed_match(enum ec_completed_type type, struct ec_parsed *state,
+static struct ec_completed_item *
+ec_completed_item(enum ec_completed_type type, struct ec_parsed *state,
const struct ec_node *node, const char *add)
{
- struct ec_completed_match *item = NULL;
+ struct ec_completed_item *item = NULL;
struct ec_parsed *p;
size_t len;
ec_free(item->path);
ec_free(item->add);
}
- ec_completed_match_free(item);
+ ec_completed_item_free(item);
return NULL;
}
const struct ec_node *node, const char *add)
{
struct ec_completed_node *compnode = NULL;
- struct ec_completed_match *match = NULL;
+ struct ec_completed_item *match = NULL;
int ret = -ENOMEM;
/* find the compnode entry corresponding to this node */
if (compnode == NULL)
return -ENOENT;
- match = ec_completed_match(type, parsed_state, node, add);
+ match = ec_completed_item(type, parsed_state, node, add);
if (match == NULL)
goto fail;
return 0;
fail:
- ec_completed_match_free(match);
+ ec_completed_item_free(match);
return ret;
}
return 0;
}
-void ec_completed_match_free(struct ec_completed_match *match)
+void ec_completed_item_free(struct ec_completed_item *match)
{
ec_free(match->add);
ec_free(match->path);
void ec_completed_free(struct ec_completed *completed)
{
struct ec_completed_node *compnode;
- struct ec_completed_match *item;
+ struct ec_completed_item *item;
if (completed == NULL)
return;
while (!TAILQ_EMPTY(&compnode->matches)) {
item = TAILQ_FIRST(&compnode->matches);
TAILQ_REMOVE(&compnode->matches, item, next);
- ec_completed_match_free(item);
+ ec_completed_item_free(item);
}
ec_free(compnode);
}
void ec_completed_dump(FILE *out, const struct ec_completed *completed)
{
struct ec_completed_node *compnode;
- struct ec_completed_match *item;
+ struct ec_completed_item *item;
if (completed == NULL || completed->count == 0) {
fprintf(out, "no completion\n");
char *ec_completed_smallest_start(const struct ec_completed *completed)
{
struct ec_completed_node *compnode;
- struct ec_completed_match *item;
+ struct ec_completed_item *item;
char *smallest_start = NULL;
size_t n;
return iter;
}
-const struct ec_completed_match *ec_completed_iter_next(
+const struct ec_completed_item *ec_completed_iter_next(
struct ec_completed_iter *iter)
{
const struct ec_completed *completed = iter->completed;
const struct ec_completed_node *cur_node;
- const struct ec_completed_match *cur_match;
+ const struct ec_completed_item *cur_match;
if (completed == NULL)
return NULL;
EC_PARTIAL_MATCH,
};
-struct ec_completed_match {
- TAILQ_ENTRY(ec_completed_match) next;
+struct ec_completed_item {
+ TAILQ_ENTRY(ec_completed_item) next;
enum ec_completed_type type;
const struct ec_node *node;
char *add;
size_t pathlen;
};
-TAILQ_HEAD(ec_completed_match_list, ec_completed_match);
+TAILQ_HEAD(ec_completed_item_list, ec_completed_item);
struct ec_completed_node {
TAILQ_ENTRY(ec_completed_node) next;
const struct ec_node *node;
- struct ec_completed_match_list matches;
+ struct ec_completed_item_list matches;
};
TAILQ_HEAD(ec_completed_node_list, ec_completed_node);
int ec_completed_add_node(struct ec_completed *completed,
const struct ec_node *node);
-void ec_completed_match_free(struct ec_completed_match *item);
+void ec_completed_item_free(struct ec_completed_item *item);
void ec_completed_free(struct ec_completed *completed);
void ec_completed_dump(FILE *out,
const struct ec_completed *completed);
enum ec_completed_type type;
const struct ec_completed *completed;
const struct ec_completed_node *cur_node;
- const struct ec_completed_match *cur_match;
+ const struct ec_completed_item *cur_match;
};
struct ec_completed_iter *
ec_completed_iter(struct ec_completed *completed,
enum ec_completed_type type);
-const struct ec_completed_match *ec_completed_iter_next(
+const struct ec_completed_item *ec_completed_iter_next(
struct ec_completed_iter *iter);
void ec_completed_iter_free(struct ec_completed_iter *iter);
s != EC_NODE_ENDLIST;
s = va_arg(ap, const char *)) {
struct ec_completed_iter *iter;
- const struct ec_completed_match *item;
+ const struct ec_completed_item *item;
if (s == NULL) {
ret = -1;
{
static struct ec_completed *c;
static struct ec_completed_iter *iter;
- static const struct ec_completed_match *item;
+ static const struct ec_completed_item *item;
char *out_string;
/* don't append a quote */
}
/* this function builds the help string */
-static char *get_node_help(const struct ec_completed_match *elt)
+static char *get_node_help(const struct ec_completed_item *item)
{
const struct ec_node *node;
char *help = NULL;
const char *node_desc = NULL;
size_t i;
- for (i = 0; i < elt->pathlen; i++) {
- node = elt->path[i];
+ for (i = 0; i < item->pathlen; i++) {
+ node = item->path[i];
if (node_help == NULL)
node_help = ec_keyval_get(ec_node_attrs(node), "help");
if (node_desc == NULL)
static int show_help(int ignore, int invoking_key)
{
const struct ec_completed_node *compnode;
-// const struct ec_completed_match *item;
+// const struct ec_completed_item *item;
// struct ec_completed_iter *iter;
struct ec_completed *c;
struct ec_parsed *p;