X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ustctl%2Fcli.h;fp=ustctl%2Fcli.h;h=a1e4eed9ecb18f7c0bc80f1425ab500b8e176036;hb=0c89df6cb75f1d967003137e7fc334af1128a42f;hp=0000000000000000000000000000000000000000;hpb=91594b712729c0d855efeab849c2093706336941;p=ust.git diff --git a/ustctl/cli.h b/ustctl/cli.h new file mode 100644 index 0000000..a1e4eed --- /dev/null +++ b/ustctl/cli.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2011 Ericsson AB, Nils Carlson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef _CLI_H +#define _CLI_H + +struct cli_cmd { + const char *name; + const char *description; + const char *help_text; + int (*function)(int, char **); + int desired_args; + int desired_args_op; +} __attribute__((aligned(8))); + +#define __cli_cmds __attribute__((section("__cli_cmds"), aligned(8), used)) + +struct cli_cmd *find_cli_cmd(const char *command); + +enum cli_list_opts { + CLI_SIMPLE_LIST, + CLI_DESCRIPTIVE_LIST, + CLI_EXTENDED_LIST, +}; + +void list_cli_cmds(int option); + +int cli_print_help(const char *command); + +enum cli_arg_ops { + CLI_EQ, + CLI_GE, +}; + +void cli_dispatch_cmd(struct cli_cmd *cmd, int argc, char *argv[]); + +#endif /* _CLI_H */