lttng.c: show man page with --help and remove usage
[lttng-tools.git] / src / bin / lttng / command.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2 only,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18#ifndef _LTTNG_CMD_H
19#define _LTTNG_CMD_H
20
21#include <lttng/lttng.h>
22#include <common/common.h>
23#include <common/defaults.h>
24
25#include "conf.h"
26#include "utils.h"
27
28#define DECL_COMMAND(_name) \
29 extern int cmd_##_name(int, const char **)
30
31#define SHOW_HELP() \
32 do { \
33 ret = show_cmd_man_page(argv[0]); \
34 \
35 if (ret) { \
36 ERR("Cannot view man page lttng-%s(1)", argv[0]); \
37 perror("exec"); \
38 } \
39 } while (0)
40
41enum cmd_error_code {
42 CMD_SUCCESS = 0,
43 CMD_ERROR,
44 CMD_UNDEFINED,
45 CMD_FATAL,
46 CMD_WARNING,
47 CMD_UNSUPPORTED,
48};
49
50struct cmd_struct {
51 const char *name;
52 int (*func)(int argc, const char **argv);
53};
54
55DECL_COMMAND(list);
56DECL_COMMAND(status);
57DECL_COMMAND(create);
58DECL_COMMAND(destroy);
59DECL_COMMAND(start);
60DECL_COMMAND(stop);
61DECL_COMMAND(enable_events);
62DECL_COMMAND(disable_events);
63DECL_COMMAND(enable_channels);
64DECL_COMMAND(disable_channels);
65DECL_COMMAND(add_context);
66DECL_COMMAND(set_session);
67DECL_COMMAND(version);
68DECL_COMMAND(calibrate);
69DECL_COMMAND(view);
70DECL_COMMAND(enable_consumer);
71DECL_COMMAND(disable_consumer);
72DECL_COMMAND(snapshot);
73DECL_COMMAND(save);
74DECL_COMMAND(load);
75DECL_COMMAND(track);
76DECL_COMMAND(untrack);
77DECL_COMMAND(metadata);
78
79#endif /* _LTTNG_CMD_H */
This page took 0.023275 seconds and 4 git commands to generate.