pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
output_none.c
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2024 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 <stdlib.h>
13 #include <glib.h>
14 
15 #include <crm/crm.h>
17 
18 static void
19 none_free_priv(pcmk__output_t *out) {
20  /* This function intentionally left blank */
21 }
22 
23 static bool
24 none_init(pcmk__output_t *out) {
25  return true;
26 }
27 
28 static void
29 none_finish(pcmk__output_t *out, crm_exit_t exit_status, bool print, void **copy_dest) {
30  /* This function intentionally left blank */
31 }
32 
33 static void
34 none_reset(pcmk__output_t *out) {
35  CRM_ASSERT(out != NULL);
36  none_free_priv(out);
37  none_init(out);
38 }
39 
40 static void
41 none_subprocess_output(pcmk__output_t *out, int exit_status,
42  const char *proc_stdout, const char *proc_stderr) {
43  /* This function intentionally left blank */
44 }
45 
46 static void
47 none_version(pcmk__output_t *out, bool extended) {
48  /* This function intentionally left blank */
49 }
50 
51 G_GNUC_PRINTF(2, 3)
52 static void
53 none_err(pcmk__output_t *out, const char *format, ...) {
54  /* This function intentionally left blank */
55 }
56 
57 G_GNUC_PRINTF(2, 3)
58 static int
59 none_info(pcmk__output_t *out, const char *format, ...) {
60  return pcmk_rc_no_output;
61 }
62 
63 static void
64 none_output_xml(pcmk__output_t *out, const char *name, const char *buf) {
65  /* This function intentionally left blank */
66 }
67 
68 G_GNUC_PRINTF(4, 5)
69 static void
70 none_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plural_noun,
71  const char *format, ...) {
72  /* This function intentionally left blank */
73 }
74 
75 G_GNUC_PRINTF(3, 4)
76 static void
77 none_list_item(pcmk__output_t *out, const char *id, const char *format, ...) {
78  /* This function intentionally left blank */
79 }
80 
81 static void
82 none_increment_list(pcmk__output_t *out) {
83  /* This function intentionally left blank */
84 }
85 
86 static void
87 none_end_list(pcmk__output_t *out) {
88  /* This function intentionally left blank */
89 }
90 
91 static bool
92 none_is_quiet(pcmk__output_t *out) {
93  return out->quiet;
94 }
95 
96 static void
97 none_spacer(pcmk__output_t *out) {
98  /* This function intentionally left blank */
99 }
100 
101 static void
102 none_progress(pcmk__output_t *out, bool end) {
103  /* This function intentionally left blank */
104 }
105 
106 static void
107 none_prompt(const char *prompt, bool echo, char **dest) {
108  /* This function intentionally left blank */
109 }
110 
112 pcmk__mk_none_output(char **argv) {
113  pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));
114 
115  if (retval == NULL) {
116  return NULL;
117  }
118 
119  retval->fmt_name = PCMK_VALUE_NONE;
120  retval->request = pcmk__quote_cmdline(argv);
121 
122  retval->init = none_init;
123  retval->free_priv = none_free_priv;
124  retval->finish = none_finish;
125  retval->reset = none_reset;
126 
128  retval->message = pcmk__call_message;
129 
130  retval->subprocess_output = none_subprocess_output;
131  retval->version = none_version;
132  retval->info = none_info;
133  retval->transient = none_info;
134  retval->err = none_err;
135  retval->output_xml = none_output_xml;
136 
137  retval->begin_list = none_begin_list;
138  retval->list_item = none_list_item;
139  retval->increment_list = none_increment_list;
140  retval->end_list = none_end_list;
141 
142  retval->is_quiet = none_is_quiet;
143  retval->spacer = none_spacer;
144  retval->progress = none_progress;
145  retval->prompt = none_prompt;
146 
147  return retval;
148 }
void(* end_list)(pcmk__output_t *out)
A dumping ground.
const char * name
Definition: cib.c:26
int(* message)(pcmk__output_t *out, const char *message_id,...)
const char * fmt_name
The name of this output formatter.
bool(* is_quiet)(pcmk__output_t *out)
void(* spacer)(pcmk__output_t *out)
void pcmk__register_message(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
Definition: output.c:196
enum crm_exit_e crm_exit_t
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
int pcmk__call_message(pcmk__output_t *out, const char *message_id,...)
Definition: output.c:174
void(* prompt)(const char *prompt, bool echo, char **dest)
void(* register_message)(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
#define PCMK_VALUE_NONE
Definition: options.h:178
bool quiet
Should this formatter supress most output?
void(* free_priv)(pcmk__output_t *out)
bool(* init)(pcmk__output_t *out)
int(*) int(*) void(*) void(* output_xml)(pcmk__output_t *out, const char *name, const char *buf)
int(*) int(*) void(* err)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
void(* finish)(pcmk__output_t *out, crm_exit_t exit_status, bool print, void **copy_dest)
int(*) int(* transient)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
pcmk__output_t * pcmk__mk_none_output(char **argv)
Definition: output_none.c:112
#define CRM_ASSERT(expr)
Definition: results.h:42
void(*) void(* list_item)(pcmk__output_t *out, const char *name, const char *format,...) G_GNUC_PRINTF(3
gchar * request
A copy of the request that generated this output.
This structure contains everything that makes up a single output formatter.
void(* version)(pcmk__output_t *out, bool extended)
void(* begin_list)(pcmk__output_t *out, const char *singular_noun, const char *plural_noun, const char *format,...) G_GNUC_PRINTF(4
void(* reset)(pcmk__output_t *out)
void(* progress)(pcmk__output_t *out, bool end)
gchar * pcmk__quote_cmdline(gchar **argv)
Definition: cmdline.c:163
void(*) void(*) void(* increment_list)(pcmk__output_t *out)
void(* subprocess_output)(pcmk__output_t *out, int exit_status, const char *proc_stdout, const char *proc_stderr)