summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-02-19 11:50:08 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-02-19 11:50:08 +0100
commit6320a4e9534595d9c5f0d6d73e6858f548092a3e (patch)
treec3868b66592980b87bdf1c78d3ce635899553776
parent24172ca0e014454a7a6f3f1a12104175f9ff7c71 (diff)
downloadmonitoring-plugins-6320a4e9534595d9c5f0d6d73e6858f548092a3e.tar.gz
Fix one-line formatting
-rw-r--r--lib/output.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/output.c b/lib/output.c
index 2c40bc7f..62a00fed 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -260,7 +260,7 @@ char *mp_fmt_output(mp_check check) {
260 subchecks = subchecks->next; 260 subchecks = subchecks->next;
261 } 261 }
262 262
263 break; 263 return result;
264 } 264 }
265 case MP_FORMAT_ICINGA_WEB_2: { 265 case MP_FORMAT_ICINGA_WEB_2: {
266 if (check.summary == NULL) { 266 if (check.summary == NULL) {
@@ -354,13 +354,14 @@ static char *generate_indentation_string(unsigned int indentation) {
354 */ 354 */
355static inline char *fmt_subcheck_output(mp_output_format output_format, mp_subcheck check, unsigned int indentation) { 355static inline char *fmt_subcheck_output(mp_output_format output_format, mp_subcheck check, unsigned int indentation) {
356 char *result = NULL; 356 char *result = NULL;
357 mp_subcheck_list *subchecks = NULL;
357 358
358 switch (output_format) { 359 switch (output_format) {
359 case MP_FORMAT_ICINGA_WEB_2: 360 case MP_FORMAT_ICINGA_WEB_2:
360 xasprintf(&result, "%s\\_[%s] - %s", generate_indentation_string(indentation), state_text(mp_compute_subcheck_state(check)), 361 xasprintf(&result, "%s\\_[%s] - %s", generate_indentation_string(indentation), state_text(mp_compute_subcheck_state(check)),
361 check.output); 362 check.output);
362 363
363 mp_subcheck_list *subchecks = check.subchecks; 364 subchecks = check.subchecks;
364 365
365 while (subchecks != NULL) { 366 while (subchecks != NULL) {
366 xasprintf(&result, "%s\n%s", result, fmt_subcheck_output(output_format, subchecks->subcheck, indentation + 1)); 367 xasprintf(&result, "%s\n%s", result, fmt_subcheck_output(output_format, subchecks->subcheck, indentation + 1));
@@ -368,6 +369,14 @@ static inline char *fmt_subcheck_output(mp_output_format output_format, mp_subch
368 } 369 }
369 return result; 370 return result;
370 case MP_FORMAT_ONE_LINE: 371 case MP_FORMAT_ONE_LINE:
372 xasprintf(&result, "[%s] - %s", state_text(mp_compute_subcheck_state(check)), check.output);
373
374 subchecks = check.subchecks;
375
376 while (subchecks != NULL) {
377 xasprintf(&result, " - %s\n%s", result, fmt_subcheck_output(output_format, subchecks->subcheck, indentation + 1));
378 subchecks = subchecks->next;
379 }
371 return result; 380 return result;
372 case MP_FORMAT_SUMMARY_ONLY: 381 case MP_FORMAT_SUMMARY_ONLY:
373 return result; 382 return result;