summaryrefslogtreecommitdiff
path: root/accel-pptpd/ctrl/l2tp
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-11-11 14:35:47 +0300
committerKozlov Dmitry <dima@server>2010-11-11 14:35:47 +0300
commit15339d1df496dc3f9225157e97b07f96fa9bdf0b (patch)
treea430e16d9cada376e50bfcadd810aca10e7da3a6 /accel-pptpd/ctrl/l2tp
parentdda81cb1d1ba0229aa4c9a90a6f2b2012a4e9326 (diff)
downloadaccel-ppp-xebd-15339d1df496dc3f9225157e97b07f96fa9bdf0b.tar.gz
accel-ppp-xebd-15339d1df496dc3f9225157e97b07f96fa9bdf0b.zip
cli: simplified cli api
Diffstat (limited to 'accel-pptpd/ctrl/l2tp')
-rw-r--r--accel-pptpd/ctrl/l2tp/l2tp.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/accel-pptpd/ctrl/l2tp/l2tp.c b/accel-pptpd/ctrl/l2tp/l2tp.c
index 899ac6a..18ba6d0 100644
--- a/accel-pptpd/ctrl/l2tp/l2tp.c
+++ b/accel-pptpd/ctrl/l2tp/l2tp.c
@@ -1062,29 +1062,13 @@ static void start_udp_server(void)
static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt, void *client)
{
- char buf[128];
-
- if (cli_send(client, "l2tp:\r\n"))
- return CLI_CMD_FAILED;
-
- sprintf(buf, " starting: %u\r\n", stat_starting);
- if (cli_send(client, buf))
- return CLI_CMD_FAILED;
-
- sprintf(buf, " active: %u\r\n", stat_active);
- if (cli_send(client, buf))
- return CLI_CMD_FAILED;
+ cli_send(client, "l2tp:\r\n");
+ cli_sendv(client, " starting: %u\r\n", stat_starting);
+ cli_sendv(client, " active: %u\r\n", stat_active);
return CLI_CMD_OK;
}
-static const char *show_stat_hdr[] = {"show","stat"};
-static struct cli_simple_cmd_t show_stat_cmd = {
- .hdr_len = 2,
- .hdr = show_stat_hdr,
- .exec = show_stat_exec,
-};
-
static void __init l2tp_init(void)
{
char *opt;
@@ -1120,6 +1104,6 @@ static void __init l2tp_init(void)
start_udp_server();
- cli_register_simple_cmd(&show_stat_cmd);
+ cli_register_simple_cmd2(&show_stat_exec, NULL, 2, "show", "stat");
}