+ sender = ci->argv[1];
+ //PARA_CRIT_LOG("sender: %s\n", sender);
+ if (strcmp(sender, "http") == 0)
+ cmds = http_cmds;
+ else if (strcmp(sender, "dccp") == 0)
+ cmds = dccp_cmds;
+ else if (strcmp(sender, "udp") == 0)
+ cmds = udp_cmds;
+ else
+ return;
+ i9e_extract_completions(ci->word, cmds, &cr->matches);
+}
+
+static void add_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *opts[] = {"-a", "-l", "-f", "-v", "--", NULL};
+
+ if (ci->word[0] == '-')
+ i9e_complete_option(opts, ci, cr);
+ cr->filename_completion_desired = true;
+}
+
+static void ls_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *opts[] = {
+ "--", "-l", "-ls", "-ll", "-lv", "-lp", "-lm", "-lc", "-p",
+ "-a", "-r", "-d", "-sp", "-sl", "-ss", "-sn", "-sf", "-sc",
+ "-si", "-sy", "-sb", "-sd", "-sa", NULL
+ };
+ if (ci->word[0] == '-')
+ i9e_complete_option(opts, ci, cr);
+ cr->filename_completion_desired = true;
+}
+
+static void setatt_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *buf, **sl;
+ int i, ret, num_atts;
+
+ if (ci->word_num == 0)
+ return;
+
+ if (*ci->word == '/' || *ci->word == '\0')
+ cr->filename_completion_desired = true;
+ if (*ci->word == '/')
+ return;
+ ret = execute_client_command("lsatt", &buf);
+ if (ret < 0)
+ return;
+ ret = create_argv(buf, "\n", &sl);
+ if (ret < 0)
+ goto out;
+ num_atts = ret;
+ sl = para_realloc(sl, (2 * num_atts + 1) * sizeof(char *));
+ for (i = 0; i < num_atts; i++) {
+ char *orig = sl[i];
+ sl[i] = make_message("%s+", orig);
+ sl[num_atts + i] = make_message("%s-", orig);
+ free(orig);
+ }
+ sl[2 * num_atts] = NULL;
+ i9e_extract_completions(ci->word, sl, &cr->matches);
+out:
+ free(buf);
+ free_argv(sl);
+}
+
+static void lsatt_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *opts[] = {"-i", "-l", "-r", NULL};
+
+ if (ci->word[0] == '-')
+ i9e_complete_option(opts, ci, cr);
+ else
+ complete_attributes(ci->word, &cr->matches);
+}
+
+static void mvatt_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ complete_attributes(ci->word, &cr->matches);
+}
+
+static void rmatt_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ complete_attributes(ci->word, &cr->matches);
+}
+
+static void check_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *opts[] = {"-a", "-m", "-p", NULL};
+ i9e_complete_option(opts, ci, cr);
+}
+
+static void rm_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *opts[] = {"-v", "-f", "-p", NULL};
+
+ if (ci->word[0] == '-') {
+ i9e_complete_option(opts, ci, cr);