/src/pacemaker/lib/common/output_none.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2019-2026 the Pacemaker project contributors |
3 | | * |
4 | | * The version control history for this file may have further details. |
5 | | * |
6 | | * This source code is licensed under the GNU Lesser General Public License |
7 | | * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. |
8 | | */ |
9 | | |
10 | | #include <crm_internal.h> |
11 | | |
12 | | #include <stdbool.h> |
13 | | #include <stdlib.h> |
14 | | |
15 | | #include <glib.h> |
16 | | |
17 | | #include <crm/crm.h> |
18 | | |
19 | | static void |
20 | | none_free_priv(pcmk__output_t *out) |
21 | 0 | { |
22 | | /* This function intentionally left blank */ |
23 | 0 | } |
24 | | |
25 | | static bool |
26 | | none_init(pcmk__output_t *out) |
27 | 0 | { |
28 | 0 | return true; |
29 | 0 | } |
30 | | |
31 | | static void |
32 | | none_finish(pcmk__output_t *out, crm_exit_t exit_status, bool print, |
33 | | void **copy_dest) |
34 | 0 | { |
35 | | /* This function intentionally left blank */ |
36 | 0 | } |
37 | | |
38 | | static void |
39 | | none_reset(pcmk__output_t *out) |
40 | 0 | { |
41 | 0 | pcmk__assert(out != NULL); |
42 | 0 | none_free_priv(out); |
43 | 0 | none_init(out); |
44 | 0 | } |
45 | | |
46 | | static void |
47 | | none_subprocess_output(pcmk__output_t *out, int exit_status, |
48 | | const char *proc_stdout, const char *proc_stderr) |
49 | 0 | { |
50 | | /* This function intentionally left blank */ |
51 | 0 | } |
52 | | |
53 | | static void |
54 | | none_version(pcmk__output_t *out) |
55 | 0 | { |
56 | | /* This function intentionally left blank */ |
57 | 0 | } |
58 | | |
59 | | G_GNUC_PRINTF(2, 3) |
60 | | static void |
61 | | none_err(pcmk__output_t *out, const char *format, ...) |
62 | 0 | { |
63 | | /* This function intentionally left blank */ |
64 | 0 | } |
65 | | |
66 | | G_GNUC_PRINTF(2, 3) |
67 | | static int |
68 | | none_info(pcmk__output_t *out, const char *format, ...) |
69 | 0 | { |
70 | 0 | return pcmk_rc_no_output; |
71 | 0 | } |
72 | | |
73 | | static void |
74 | | none_output_xml(pcmk__output_t *out, const char *name, const char *buf) |
75 | 0 | { |
76 | | /* This function intentionally left blank */ |
77 | 0 | } |
78 | | |
79 | | G_GNUC_PRINTF(4, 5) |
80 | | static void |
81 | | none_begin_list(pcmk__output_t *out, const char *singular_noun, |
82 | | const char *plural_noun, const char *format, ...) |
83 | 0 | { |
84 | | /* This function intentionally left blank */ |
85 | 0 | } |
86 | | |
87 | | G_GNUC_PRINTF(3, 4) |
88 | | static void |
89 | | none_list_item(pcmk__output_t *out, const char *id, const char *format, ...) |
90 | 0 | { |
91 | | /* This function intentionally left blank */ |
92 | 0 | } |
93 | | |
94 | | static void |
95 | | none_increment_list(pcmk__output_t *out) |
96 | 0 | { |
97 | | /* This function intentionally left blank */ |
98 | 0 | } |
99 | | |
100 | | static void |
101 | | none_end_list(pcmk__output_t *out) |
102 | 0 | { |
103 | | /* This function intentionally left blank */ |
104 | 0 | } |
105 | | |
106 | | static bool |
107 | | none_is_quiet(pcmk__output_t *out) |
108 | 0 | { |
109 | 0 | return out->quiet; |
110 | 0 | } |
111 | | |
112 | | static void |
113 | | none_spacer(pcmk__output_t *out) |
114 | 0 | { |
115 | | /* This function intentionally left blank */ |
116 | 0 | } |
117 | | |
118 | | static void |
119 | | none_progress(pcmk__output_t *out, bool end) |
120 | 0 | { |
121 | | /* This function intentionally left blank */ |
122 | 0 | } |
123 | | |
124 | | static void |
125 | | none_prompt(const char *prompt, char **dest) |
126 | 0 | { |
127 | | /* This function intentionally left blank */ |
128 | 0 | } |
129 | | |
130 | | pcmk__output_t * |
131 | | pcmk__mk_none_output(char **argv) |
132 | 0 | { |
133 | 0 | pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t)); |
134 | |
|
135 | 0 | if (retval == NULL) { |
136 | 0 | return NULL; |
137 | 0 | } |
138 | | |
139 | 0 | retval->fmt_name = PCMK_VALUE_NONE; |
140 | 0 | retval->request = pcmk__quote_cmdline(argv); |
141 | |
|
142 | 0 | retval->init = none_init; |
143 | 0 | retval->free_priv = none_free_priv; |
144 | 0 | retval->finish = none_finish; |
145 | 0 | retval->reset = none_reset; |
146 | |
|
147 | 0 | retval->register_message = pcmk__register_message; |
148 | 0 | retval->message = pcmk__call_message; |
149 | |
|
150 | 0 | retval->subprocess_output = none_subprocess_output; |
151 | 0 | retval->version = none_version; |
152 | 0 | retval->info = none_info; |
153 | 0 | retval->transient = none_info; |
154 | 0 | retval->err = none_err; |
155 | 0 | retval->output_xml = none_output_xml; |
156 | |
|
157 | 0 | retval->begin_list = none_begin_list; |
158 | 0 | retval->list_item = none_list_item; |
159 | 0 | retval->increment_list = none_increment_list; |
160 | 0 | retval->end_list = none_end_list; |
161 | |
|
162 | 0 | retval->is_quiet = none_is_quiet; |
163 | 0 | retval->spacer = none_spacer; |
164 | 0 | retval->progress = none_progress; |
165 | 0 | retval->prompt = none_prompt; |
166 | |
|
167 | 0 | return retval; |
168 | 0 | } |