27 const char *
id =
_(
"Possible values");
28 GString *buf = g_string_sized_new(256);
33 id =
_(
"Possible values (generated by Pacemaker)");
36 if ((option->
values != NULL) && (strcmp(option->
type,
"select") == 0)) {
37 const char *delim =
", ";
41 for (
const char *value = strtok(str, delim); value != NULL;
42 value = strtok(NULL, delim)) {
45 g_string_append(buf, delim);
47 g_string_append_c(buf,
'"');
48 g_string_append(buf, value);
49 g_string_append_c(buf,
'"');
51 if (!found_default && (strcmp(value, option->
default_value) == 0)) {
53 g_string_append(buf,
_(
" (default)"));
68 g_string_free(buf, TRUE);
85 CRM_ASSERT((desc_short != NULL) || (desc_long != NULL));
87 if (desc_short == NULL) {
88 desc_short = desc_long;
96 if (desc_long != NULL) {
99 add_possible_values_default(out, option);
124 "uint32_t",
"const pcmk__cluster_option_t *",
"bool")
128 const char *
name G_GNUC_UNUSED = va_arg(args,
const char *);
129 const char *desc_short = va_arg(args,
const char *);
130 const char *desc_long = va_arg(args,
const char *);
131 const uint32_t filter = va_arg(args, uint32_t);
134 const bool all = (bool) va_arg(args,
int);
136 const bool show_deprecated = all
139 bool old_fancy =
false;
141 GSList *deprecated = NULL;
142 GSList *advanced = NULL;
144 CRM_ASSERT((out != NULL) && (desc_short != NULL) && (desc_long != NULL)
145 && (option_list != NULL));
150 out->info(out,
"%s",
_(desc_short));
152 out->info(out,
"%s",
_(desc_long));
153 out->begin_list(out, NULL, NULL, NULL);
156 option->
name != NULL; option++) {
159 if (pcmk_all_flags_set(option->
flags, filter)) {
161 if (show_deprecated) {
162 deprecated = g_slist_prepend(deprecated, (gpointer) option);
167 advanced = g_slist_prepend(advanced, (gpointer) option);
172 add_option_metadata_default(out, option);
177 if (advanced != NULL) {
178 advanced = g_slist_reverse(advanced);
181 out->begin_list(out, NULL, NULL,
_(
"ADVANCED OPTIONS"));
182 for (
const GSList *iter = advanced; iter != NULL; iter = iter->next) {
186 add_option_metadata_default(out, option);
189 g_slist_free(advanced);
192 if (deprecated != NULL) {
193 deprecated = g_slist_reverse(deprecated);
196 out->begin_list(out, NULL, NULL,
197 _(
"DEPRECATED OPTIONS (will be removed in a future " 199 for (
const GSList *iter = deprecated; iter != NULL; iter = iter->next) {
203 add_option_metadata_default(out, option);
206 g_slist_free(deprecated);
227 add_desc_xml(
pcmk__output_t *out,
bool for_long,
const char *desc)
236 static const char *locale = NULL;
238 if (strcmp(desc,
_(desc)) == 0) {
242 if (locale == NULL) {
243 locale = strtok(setlocale(LC_ALL, NULL),
"_");
264 if ((option->
values != NULL) && (strcmp(option->
type,
"select") == 0)) {
265 const char *delim =
", ";
267 const char *ptr = strtok(str, delim);
269 while (ptr != NULL) {
273 ptr = strtok(NULL, delim);
288 map_legacy_option_type(
const char *
type)
327 const char *advanced_s = advanced?
"1" :
"0";
328 const char *generated_s = generated?
"1" :
"0";
332 char *desc_long_legacy = NULL;
333 GString *desc_short_legacy = NULL;
339 CRM_ASSERT((desc_long != NULL) || (desc_short != NULL));
341 if (desc_long == NULL) {
342 desc_long = desc_short;
343 }
else if (desc_short == NULL) {
344 desc_short = desc_long;
349 type = map_legacy_option_type(
type);
351 if (option->
values != NULL) {
353 desc_long, option->
values);
354 desc_long = desc_long_legacy;
357 if (deprecated || advanced) {
358 const size_t init_sz = 1023;
372 "*** Deprecated ***", NULL);
376 "*** Advanced Use Only ***", NULL);
380 desc_short = desc_short_legacy->str;
397 if (deprecated && !legacy) {
401 add_desc_xml(out,
true, desc_long);
402 add_desc_xml(out,
false, desc_short);
409 add_possible_values_xml(out, option);
414 free(desc_long_legacy);
415 if (desc_short_legacy != NULL) {
416 g_string_free(desc_short_legacy, TRUE);
439 "uint32_t",
"const pcmk__cluster_option_t *",
"bool")
443 const char *
name = va_arg(args,
const char *);
444 const char *desc_short = va_arg(args,
const char *);
445 const char *desc_long = va_arg(args,
const char *);
446 const uint32_t filter = va_arg(args, uint32_t);
450 CRM_ASSERT((out != NULL) && (
name != NULL) && (desc_short != NULL)
451 && (desc_long != NULL) && (option_list != NULL));
459 add_desc_xml(out,
true, desc_long);
460 add_desc_xml(out,
false, desc_short);
465 option->
name != NULL; option++) {
467 if (pcmk_all_flags_set(option->
flags, filter)) {
468 add_option_metadata_xml(out, option);
478 {
"option-list",
"default", option_list_default },
479 {
"option-list",
"xml", option_list_xml },
void(* end_list)(pcmk__output_t *out)
void pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table)
PCMK__OUTPUT_ARGS("option-list", "const char *", "const char *", "const char *", "uint32_t", "const pcmk__cluster_option_t *", "bool")
#define PCMK_XA_GENERATED
bool pcmk__output_get_legacy_xml(pcmk__output_t *out)
xmlNodePtr pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
#define PCMK_XE_PARAMETERS
void pcmk__add_separated_word(GString **list, size_t init_size, const char *word, const char *separator)
const char * default_value
enum crm_ais_msg_types type
#define PCMK_XE_DEPRECATED
#define PACEMAKER_VERSION
G_GNUC_INTERNAL bool pcmk__output_text_get_fancy(pcmk__output_t *out)
#define PCMK_VALUE_TIMEOUT
#define PCMK_VALUE_DURATION
#define PCMK_XE_PARAMETER
void pcmk__g_strcat(GString *buffer,...) G_GNUC_NULL_TERMINATED
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
xmlNodePtr pcmk__output_create_xml_node(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
#define PCMK_VALUE_NONNEGATIVE_INTEGER
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
#define pcmk__str_copy(str)
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
#define PCMK_XE_SHORTDESC
#define PCMK_XE_RESOURCE_AGENT
void(*) void(* list_item)(pcmk__output_t *out, const char *name, const char *format,...) G_GNUC_PRINTF(3
This structure contains everything that makes up a single output formatter.
void(* begin_list)(pcmk__output_t *out, const char *singular_noun, const char *plural_noun, const char *format,...) G_GNUC_PRINTF(4
const char * description_short
#define PCMK_VALUE_VERSION
void pcmk__output_text_set_fancy(pcmk__output_t *out, bool enabled)
uint32_t flags
Group of enum pcmk__opt_flags
#define PCMK_VALUE_STRING
#define PCMK_VALUE_INTEGER
void pcmk__register_option_messages(pcmk__output_t *out)
xmlNodePtr pcmk__output_create_xml_text_node(pcmk__output_t *out, const char *name, const char *content)
const char * description_long