summaryrefslogtreecommitdiffstats
path: root/lib/common/output_none.c
blob: d1cdaccde4031e1120104a8412b3383f3012139a (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
 * Copyright 2019-2024 the Pacemaker project contributors
 *
 * The version control history for this file may have further details.
 *
 * This source code is licensed under the GNU Lesser General Public License
 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
 */

#include <crm_internal.h>

#include <stdlib.h>
#include <glib.h>

#include <crm/crm.h>
#include <crm/common/cmdline_internal.h>

static void
none_free_priv(pcmk__output_t *out) {
    /* This function intentionally left blank */
}

static bool
none_init(pcmk__output_t *out) {
    return true;
}

static void
none_finish(pcmk__output_t *out, crm_exit_t exit_status, bool print, void **copy_dest) {
    /* This function intentionally left blank */
}

static void
none_reset(pcmk__output_t *out) {
    CRM_ASSERT(out != NULL);
    none_free_priv(out);
    none_init(out);
}

static void
none_subprocess_output(pcmk__output_t *out, int exit_status,
                       const char *proc_stdout, const char *proc_stderr) {
    /* This function intentionally left blank */
}

static void
none_version(pcmk__output_t *out, bool extended) {
    /* This function intentionally left blank */
}

G_GNUC_PRINTF(2, 3)
static void
none_err(pcmk__output_t *out, const char *format, ...) {
    /* This function intentionally left blank */
}

G_GNUC_PRINTF(2, 3)
static int
none_info(pcmk__output_t *out, const char *format, ...) {
    return pcmk_rc_no_output;
}

static void
none_output_xml(pcmk__output_t *out, const char *name, const char *buf) {
    /* This function intentionally left blank */
}

G_GNUC_PRINTF(4, 5)
static void
none_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plural_noun,
                const char *format, ...) {
    /* This function intentionally left blank */
}

G_GNUC_PRINTF(3, 4)
static void
none_list_item(pcmk__output_t *out, const char *id, const char *format, ...) {
    /* This function intentionally left blank */
}

static void
none_increment_list(pcmk__output_t *out) {
    /* This function intentionally left blank */
}

static void
none_end_list(pcmk__output_t *out) {
    /* This function intentionally left blank */
}

static bool
none_is_quiet(pcmk__output_t *out) {
    return out->quiet;
}

static void
none_spacer(pcmk__output_t *out) {
    /* This function intentionally left blank */
}

static void
none_progress(pcmk__output_t *out, bool end) {
    /* This function intentionally left blank */
}

static void
none_prompt(const char *prompt, bool echo, char **dest) {
    /* This function intentionally left blank */
}

pcmk__output_t *
pcmk__mk_none_output(char **argv) {
    pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));

    if (retval == NULL) {
        return NULL;
    }

    retval->fmt_name = PCMK_VALUE_NONE;
    retval->request = pcmk__quote_cmdline(argv);

    retval->init = none_init;
    retval->free_priv = none_free_priv;
    retval->finish = none_finish;
    retval->reset = none_reset;

    retval->register_message = pcmk__register_message;
    retval->message = pcmk__call_message;

    retval->subprocess_output = none_subprocess_output;
    retval->version = none_version;
    retval->info = none_info;
    retval->transient = none_info;
    retval->err = none_err;
    retval->output_xml = none_output_xml;

    retval->begin_list = none_begin_list;
    retval->list_item = none_list_item;
    retval->increment_list = none_increment_list;
    retval->end_list = none_end_list;

    retval->is_quiet = none_is_quiet;
    retval->spacer = none_spacer;
    retval->progress = none_progress;
    retval->prompt = none_prompt;

    return retval;
}