/*
- * Copyright (C) 1997-2014 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997 Andre Noll <maan@tuebingen.mpg.de>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
#include "error.h"
#include "version.h"
-INIT_CLIENT_ERRLISTS;
+/** Array of error strings. */
+DEFINE_PARA_ERRLIST;
static struct sched sched;
static struct client_task *ct;
#ifdef HAVE_READLINE
#include "interactive.h"
-#include "server_completion.h"
-#include "afs_completion.h"
+#include "server_cmd.lsg.h"
struct exec_task {
struct task *task;
size_t result_size;
};
-static void exec_pre_select(struct sched *s, struct task *t)
+static void exec_pre_select(struct sched *s, void *context)
{
- struct exec_task *et = task_context(t);
+ struct exec_task *et = context;
int ret = btr_node_status(et->btrn, 0, BTR_NT_LEAF);
if (ret != 0)
sched_min_delay(s);
}
-static int exec_post_select(__a_unused struct sched *s, struct task *t)
+static int exec_post_select(__a_unused struct sched *s, void *context)
{
- struct exec_task *et = task_context(t);
+ struct exec_task *et = context;
struct btr_node *btrn = et->btrn;
char *buf;
size_t sz;
I9E_DUMMY_COMPLETER(play);
I9E_DUMMY_COMPLETER(si);
I9E_DUMMY_COMPLETER(term);
-I9E_DUMMY_COMPLETER(version);
I9E_DUMMY_COMPLETER(stop);
I9E_DUMMY_COMPLETER(addatt);
I9E_DUMMY_COMPLETER(init);
+I9E_DUMMY_COMPLETER(tasks);
static struct i9e_completer completers[];
result->matches = i9e_complete_commands(ci->word, completers);
}
+static void version_completer(struct i9e_completion_info *ci,
+ struct i9e_completion_result *cr)
+{
+ char *opts[] = {"-v", NULL};
+ i9e_complete_option(opts, ci, cr);
+}
+
static void stat_completer(struct i9e_completion_info *ci,
struct i9e_completion_result *cr)
{
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
+ "--", "-l", "-l=s", "-l=l", "-l=v", "-l=p", "-l=m", "-l=c",
+ "-p", "-a", "-r", "-d", "-s=p", "-s=l", "-s=s", "-s=n", "-s=f",
+ "-s=c", "-s=i", "-s=y", "-s=b", "-s=d", "-s=a", "-F", "-b", NULL
};
if (ci->word[0] == '-')
i9e_complete_option(opts, ci, cr);
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);
+ i9e_complete_option(opts, ci, cr);
}
static void mvatt_completer(struct i9e_completion_info *ci,
return 1;
}
+I9E_DUMMY_COMPLETER(SUPERCOMMAND_UNAVAILABLE);
static struct i9e_completer completers[] = {
- SERVER_COMPLETERS
- AFS_COMPLETERS
+#define LSG_SERVER_CMD_CMD(_name) {.name = #_name, \
+ .completer = _name ## _completer}
+ LSG_SERVER_CMD_COMMANDS
+#undef LSG_SERVER_CMD_CMD
{.name = NULL}
};
struct task *task;
};
-static int supervisor_post_select(struct sched *s, struct task *t)
+static int supervisor_post_select(struct sched *s, void *context)
{
- struct supervisor_task *svt = task_context(t);
+ struct supervisor_task *svt = context;
int ret = task_status(ct->task);
if (ret < 0)