Skip to content

Commit

Permalink
add .consoles command
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz authored and Marco van Wieringen committed Jul 28, 2016
1 parent ded698f commit 51f2e38
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dird/ua_cmds.c
Expand Up @@ -65,6 +65,7 @@ extern bool dot_jobs_cmd(UAContext *ua, const char *cmd);
extern bool dot_jobstatus_cmd(UAContext *ua, const char *cmd);
extern bool dot_filesets_cmd(UAContext *ua, const char *cmd);
extern bool dot_clients_cmd(UAContext *ua, const char *cmd);
extern bool dot_consoles_cmd(UAContext *ua, const char *cmd);
extern bool dot_msgs_cmd(UAContext *ua, const char *cmd);
extern bool dot_pools_cmd(UAContext *ua, const char *cmd);
extern bool dot_schedule_cmd(UAContext *ua, const char *cmd);
Expand Down Expand Up @@ -158,6 +159,8 @@ static struct cmdstruct commands[] = {
NULL, false, false },
{ NT_(".clients"), dot_clients_cmd, _("List all client resources"),
NULL, true, false },
{ NT_(".consoles"), dot_consoles_cmd, _("List all console resources"),
NULL, true, false },
{ NT_(".defaults"), dot_defaults_cmd, _("Get default settings"),
NT_("job=<job-name> | client=<client-name> | storage=<storage-name | pool=<pool-name>"), false, false },
#ifdef DEVELOPER
Expand Down
17 changes: 17 additions & 0 deletions src/dird/ua_dotcmds.c
Expand Up @@ -923,6 +923,23 @@ bool dot_clients_cmd(UAContext *ua, const char *cmd)
return true;
}

bool dot_consoles_cmd(UAContext *ua, const char *cmd)
{
CONRES *console;

LockRes();
ua->send->array_start("consoles");
foreach_res(console, R_CONSOLE) {
ua->send->object_start();
ua->send->object_key_value("name", console->name(), "%s\n");
ua->send->object_end();
}
ua->send->array_end("consoles");
UnlockRes();

return true;
}

bool dot_msgs_cmd(UAContext *ua, const char *cmd)
{
MSGSRES *msgs = NULL;
Expand Down

0 comments on commit 51f2e38

Please sign in to comment.