From 96e89d34eb2acfd71de6ed38d7029d7f662b9ad5 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Thu, 21 Jul 2016 16:12:38 -0400 Subject: Conditionalize feature sets, to make it easier to build for an embedded environment. The biggest things we need are 1) No dynamic memory allocations 2) No socket oriented I/O While doing so, I've tried to make sure it still works in other build scenarios (hosted Linux build with malloc). --- clitest.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clitest.c') diff --git a/clitest.c b/clitest.c index ace87bc..bff0866 100644 --- a/clitest.c +++ b/clitest.c @@ -227,10 +227,14 @@ int main() cli = cli_init(); cli_set_banner(cli, "libcli test environment"); cli_set_hostname(cli, "router"); +#if DO_TELNET cli_telnet_protocol(cli, 1); +#endif +#if DO_REGULAR cli_regular(cli, regular_callback); cli_regular_interval(cli, 5); // Defaults to 1 second cli_set_idle_timeout_callback(cli, 60, idle_timeout); // 60 second idle timeout +#endif cli_register_command(cli, NULL, "test", cmd_test, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, NULL); cli_register_command(cli, NULL, "simple", NULL, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, NULL); @@ -269,6 +273,7 @@ int main() cli_set_auth_callback(cli, check_auth); cli_set_enable_callback(cli, check_enable); +#if DO_FILE // Test reading from a file { FILE *fh; @@ -282,6 +287,7 @@ int main() fclose(fh); } } +#endif if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { -- cgit v1.2.3