summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-misc.c
blob: 1e356c63beab78a9e7f8437288fc49aae2f0b459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
  Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
  This file is part of GlusterFS.

  GlusterFS is free software; you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published
  by the Free Software Foundation; either version 3 of the License,
  or (at your option) any later version.

  GlusterFS 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
  Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see
  <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>

#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif

#include "cli.h"
#include "cli-cmd.h"
#include "cli-mem-types.h"
#include "protocol-common.h"

extern struct rpc_clnt *global_rpc;

extern rpc_clnt_prog_t *cli_rpc_prog;

extern struct cli_cmd volume_cmds[];
extern struct cli_cmd cli_probe_cmds[];
extern struct cli_cmd cli_log_cmds[];
extern struct cli_cmd cli_system_cmds[];
struct cli_cmd cli_misc_cmds[];

int
cli_cmd_quit_cbk (struct cli_state *state, struct cli_cmd_word *word,
                   const char **words, int wordcount)
{
        exit (0);
}

int
cli_cmd_display_help (struct cli_state *state, struct cli_cmd_word *in_word,
                      const char **words, int wordcount)
{
        struct cli_cmd        *cmd = NULL;

        for (cmd = volume_cmds; cmd->pattern; cmd++)
                cli_out ("%s - %s", cmd->pattern, cmd->desc);

        for (cmd = cli_probe_cmds; cmd->pattern; cmd++)
                cli_out ("%s - %s", cmd->pattern, cmd->desc);

        /*
         * commands for internal usage, don't expose

        for (cmd = cli_system_cmds; cmd->pattern; cmd++)
                cli_out ("%s - %s", cmd->pattern, cmd->desc);
         */

        for (cmd = cli_misc_cmds; cmd->pattern; cmd++)
                cli_out ("%s - %s", cmd->pattern, cmd->desc);

        return 0;
}

struct cli_cmd cli_misc_cmds[] = {
        { "quit",
          cli_cmd_quit_cbk,
          "quit"},

        { "help",
           cli_cmd_display_help,
           "display command options"},

        { NULL, NULL, NULL }
};


int
cli_cmd_misc_register (struct cli_state *state)
{
        int  ret = 0;
        struct cli_cmd *cmd = NULL;

        for (cmd = cli_misc_cmds; cmd->pattern; cmd++) {
                ret = cli_cmd_register (&state->tree, cmd->pattern, cmd->cbk,
                                        cmd->desc);
                if (ret)
                        goto out;
        }
out:
        return ret;
}
class='insertions'>+10 * cli: avoid unnecessary strtail for geo rep config.Ravishankar N2018-11-111-20/+20 * cli: add a warning/confirmation message in peer detach code pathAtin Mukherjee2018-11-091-1/+13 * all: fix the format string exceptionsAmar Tumballi2018-11-051-1/+1 * stripe: remove the translator from build and glusterdAmar Tumballi2018-10-312-77/+7 * cluster/ec : Prevent volume create without redundant brickSunil Kumar Acharya2018-10-241-3/+3 * glusterd: set integer instead of stringSanju Rakonde2018-10-241-2/+2 * cli: Fix heap-buffer-overflow issue reported by ASANKotresh HR2018-10-241-1/+4 * cli: Fix memory leaks reported by ASANKotresh HR2018-10-121-0/+38 * cli: Fix memory leaks reported by ASANKotresh HR2018-10-121-64/+52 * cli: memory leak issues reported by asanAmar Tumballi2018-10-092-4/+16 * cli: Resource leak coverity fixSanju Rakonde2018-10-081-0/+1 * cli : coverity fix in cli-rl.cSunny Kumar2018-10-051-3/+1 * cli: fix glusterd memory leak cause by "gluster v status volume_name"shujun100862018-10-031-0/+1 * cli: handle negative scenariosSanju Rakonde2018-10-014-17/+79 * Quota related files: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}Yaniv Kaul2018-09-262-6/+13 * Land part 2 of clang-format changesGluster Ant2018-09-1215-25123/+24747 * Land clang-format changesGluster Ant2018-09-124-350/+364 * cli: Add warning message while converting to replica 2 configurationkarthik-us2018-09-113-15/+59 * cli/src/cli-cmd-parser.c: Move to GF_MALLOC() instead of GF_CALLOC() when pos...Yaniv Kaul2018-09-051-4/+5 * cli : fix coverity issue in cli-cmd-parser.cSunny Kumar2018-09-051-13/+8 * multiple files: calloc -> mallocYaniv Kaul2018-09-047-13/+15 * cli : fix coverity issue in cli-cmd-volume.cSunny Kumar2018-08-311-6/+6 * cli: dereferencing null coverity fixSanju Rakonde2018-08-291-1/+1 * cli : fix coverity cli-rl.cSunny Kumar