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