cli: Support showing session by login
This commit is contained in:
parent
943717e48d
commit
01f0062d2d
1 changed files with 13 additions and 5 deletions
10
cli.c
10
cli.c
|
|
@ -419,13 +419,21 @@ static int cmd_show_session(struct cli_def *cli, const char *command, char **arg
|
||||||
// Show individual session
|
// Show individual session
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
unsigned int s, b_in, b_out;
|
unsigned int s, b_in, b_out, r;
|
||||||
|
|
||||||
|
for (s = 0; s < MAXSESSION; s++)
|
||||||
|
if (!strcmp(argv[i], session[s].user))
|
||||||
|
break;
|
||||||
|
if (s >= MAXSESSION)
|
||||||
|
{
|
||||||
s = atoi(argv[i]);
|
s = atoi(argv[i]);
|
||||||
if (s <= 0 || s >= MAXSESSION)
|
if (s <= 0 || s >= MAXSESSION)
|
||||||
{
|
{
|
||||||
cli_print(cli, "Invalid session id \"%s\"", argv[i]);
|
cli_print(cli, "Invalid session id \"%s\"", argv[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cli_print(cli, "\r\nSession %d:", s);
|
cli_print(cli, "\r\nSession %d:", s);
|
||||||
cli_print(cli, "\tUser:\t\t%s", session[s].user[0] ? session[s].user : "none");
|
cli_print(cli, "\tUser:\t\t%s", session[s].user[0] ? session[s].user : "none");
|
||||||
cli_print(cli, "\tCalling Num:\t%s", session[s].calling);
|
cli_print(cli, "\tCalling Num:\t%s", session[s].calling);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue