pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
output_none.c
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2022 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 GOptionEntry pcmk__none_output_entries[] = {
19  { NULL }
20 };
21 
22 static void
23 none_free_priv(pcmk__output_t *out) {
24  /* This function intentionally left blank */
25 }
26 
27 static bool
28 none_init(pcmk__output_t *out) {
29  return true;
30 }
31 
32 static void
33 none_finish(pcmk__output_t *out, crm_exit_t exit_status, bool print, void **copy_dest) {
34  /* This function intentionally left blank */
35 }
36 
37 static void
38 none_reset(pcmk__output_t *out) {
39  CRM_ASSERT(out != NULL);
40  none_free_priv(out);
41  none_init(out);
42 }
43 
44 static void
45 none_subprocess_output(pcmk__output_t *out, int exit_status,
46  const char *proc_stdout, const char *proc_stderr) {
47  /* This function intentionally left blank */
48 }
49 
50 static void
51 none_version(pcmk__output_t *out, bool extended) {
52  /* This function intentionally left blank */
53 }
54 
55 G_GNUC_PRINTF(2, 3)
56 static void
57 none_err(pcmk__output_t *out, const char *format, ...) {
58  /* This function intentionally left blank */
59 }
60 
61 G_GNUC_PRINTF(2, 3)
62 static int
63 none_info(pcmk__output_t *out, const char *format, ...) {
64  return pcmk_rc_no_output;
65 }
66 
67 static void
68 none_output_xml(pcmk__output_t *out, const char *name, const char *buf) {
69  /* This function intentionally left blank */
70 }
71 
72 G_GNUC_PRINTF(4, 5)
73 static void
74 none_begin_list(pcmk__output_t *out, const char *singular_noun, const char *plural_noun,
75  const char *format, ...) {
76  /* This function intentionally left blank */
77 }
78 
79 G_GNUC_PRINTF(3, 4)
80 static void
81 none_list_item(pcmk__output_t *out, const char *id, const char *format, ...) {
82  /* This function intentionally left blank */
83 }
84 
85 static void
86 none_increment_list(pcmk__output_t *out) {
87  /* This function intentionally left blank */
88 }
89 
90 static void
91 none_end_list(pcmk__output_t *out) {
92  /* This function intentionally left blank */
93 }
94 
95 static bool
96 none_is_quiet(pcmk__output_t *out) {
97  return out->quiet;
98 }
99 
100 static void
101 none_spacer(pcmk__output_t *out) {
102  /* This function intentionally left blank */
103 }
104 
105 static void
106 none_progress(pcmk__output_t *out, bool end) {
107  /* This function intentionally left blank */
108 }
109 
110 static void
111 none_prompt(const char *prompt, bool echo, char **dest) {
112  /* This function intentionally left blank */
113 }
114 
116 pcmk__mk_none_output(char **argv) {
117  pcmk__output_t *retval = calloc(1, sizeof(pcmk__output_t));
118 
119  if (retval == NULL) {
120  return NULL;
121  }
122 
123  retval->fmt_name = PCMK__VALUE_NONE;
124  retval->request = pcmk__quote_cmdline(argv);
125 
126  retval->init = none_init;
127  retval->free_priv = none_free_priv;
128  retval->finish = none_finish;
129  retval->reset = none_reset;
130 
132  retval->message = pcmk__call_message;
133 
134  retval->subprocess_output = none_subprocess_output;
135  retval->version = none_version;
136  retval->info = none_info;
137  retval->transient = none_info;
138  retval->err = none_err;
139  retval->output_xml = none_output_xml;
140 
141  retval->begin_list = none_begin_list;
142  retval->list_item = none_list_item;
143  retval->increment_list = none_increment_list;
144  retval->end_list = none_end_list;
145 
146  retval->is_quiet = none_is_quiet;
147  retval->spacer = none_spacer;
148  retval->progress = none_progress;
149  retval->prompt = none_prompt;
150 
151  return retval;
152 }
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:188
enum crm_exit_e crm_exit_t
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
#define PCMK__VALUE_NONE
int pcmk__call_message(pcmk__output_t *out, const char *message_id,...)
Definition: output.c:166
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)
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:116
#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
GOptionEntry pcmk__none_output_entries[]
Definition: output_none.c:18
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)