program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
n = next;
}
- return table_print(table, NULL);
+ return table_print(table);
}
int verb_calendar(int argc, char *argv[], uintptr_t _data, void *userdata) {
putc('\n', stdout);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return r;
}
if (sd_json_format_enabled(json_flags))
sd_json_variant_dump(package_metadata, json_flags, stdout, NULL);
else {
- r = table_print(t, NULL);
+ r = table_print(t);
if (r < 0)
return table_log_print_error(r);
}
if (sd_json_format_enabled(arg_json_format_flags))
r = table_print_json(table, NULL, arg_json_format_flags | SD_JSON_FORMAT_COLOR_AUTO);
else
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
}
if (r < 0)
return table_log_add_error(r);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return r;
if (r < 0)
return table_log_add_error(r);
- return table_print(table, NULL);
+ return table_print(table);
}
int verb_timestamp(int argc, char *argv[], uintptr_t _data, void *userdata) {
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(verbs, stdout);
+ table_print(verbs);
printf("\nOptions:\n");
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
return 0;
}
- r = table_print(t, stdout);
+ r = table_print(t);
if (r < 0)
return log_error_errno(r, "Failed to show slot table: %m");
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
ansi_underline(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\n%sCommands:%s\n", ansi_underline(), ansi_normal());
- table_print(commands, stdout);
+ table_print(commands);
printf("\nSee the %s for details.\n", link);
return 0;
if (!sd_json_format_enabled(arg_json_format_flags)) {
table_set_header(t, arg_legend);
- r = table_print(t, NULL);
+ r = table_print(t);
if (r < 0)
return table_log_print_error(r);
} else {
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(verbs, stdout);
+ table_print(verbs);
printf("\nOptions:\n");
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
}
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(verbs, stdout);
+ table_print(verbs);
printf("\nOptions:\n");
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(verbs, stdout);
+ table_print(verbs);
printf("\nOptions:\n");
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
if (table_isempty(table))
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "No well-known IMDS data available.");
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
/* We don't use the table to show the header, in order to make the width of the column stable. */
printf("%s%s - %s (" UID_FMT ")%s\n", ansi_highlight(), i.id, i.name, i.uid, ansi_normal());
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
printf("%s%s (" UID_FMT ")%s\n", ansi_highlight(), i.name, i.uid, ansi_normal());
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
printf("%s%s%s\n", ansi_highlight(), i.id, ansi_normal());
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
if (OUTPUT_MODE_IS_JSON(arg_output))
r = table_print_json(table, NULL, output_mode_to_json_format_flags(arg_output) | SD_JSON_FORMAT_COLOR_AUTO);
else
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
}
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
}
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
on_color_operational, glyph(GLYPH_BLACK_CIRCLE), off_color_operational,
info->ifindex, info->name);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
on_color_operational, glyph(GLYPH_BLACK_CIRCLE), off_color_operational,
strna(netifs_joined));
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
ansi_highlight(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
table_set_header(table, arg_legend);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
}
ansi_normal(),
ansi_underline(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
return 0;
}
if (r < 0)
return table_log_add_error(r);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
if (r < 0)
return table_log_add_error(r);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
return table_log_add_error(r);
}
- r = table_print(t, stderr);
+ r = table_print_full(t, stderr, /* flush= */ true);
if (r < 0)
return table_log_print_error(r);
return r;
}
-int table_print(Table *t, FILE *f) {
+int table_print_full(Table *t, FILE *f, bool flush) {
size_t n_rows, *minimum_width, *maximum_width, display_columns, *requested_width,
table_minimum_width, table_maximum_width, table_requested_width, table_effective_width,
*width = NULL;
} while (more_sublines);
}
+ if (!flush)
+ return 0;
+
return fflush_and_check(f);
}
if (!f)
return -ENOMEM;
- r = table_print(t, f);
+ r = table_print_full(t, f, /* flush= */ true);
if (r < 0)
return r;
assert(t);
if (!sd_json_format_enabled(flags)) /* If JSON output is turned off, use regular output */
- return table_print(t, f);
+ return table_print_full(t, f, /* flush= */ true);
if (!f)
f = stdout;
int _table_sync_column_widths(size_t column, Table *a, ...);
#define table_sync_column_widths(column, a, ...) _table_sync_column_widths(column, a, __VA_ARGS__, NULL)
-int table_print(Table *t, FILE *f);
+int table_print_full(Table *t, FILE *f, bool flush);
+static inline int table_print(Table *t) {
+ return table_print_full(t, /* f= */ NULL, /* flush= */ false);
+}
+
int table_format(Table *t, char **ret);
static inline TableCell* TABLE_HEADER_CELL(size_t i) {
}
}
- r = table_print(t, stdout);
+ r = table_print(t);
if (r < 0) {
log_error_errno(r, "Failed to show device table: %m");
goto finish;
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
return 0;
}
- r = table_print(t, stdout);
+ r = table_print(t);
if (r < 0)
return log_error_errno(r, "Failed to show device table: %m");
return 0;
}
- r = table_print(t, stdout);
+ r = table_print(t);
if (r < 0)
return log_error_errno(r, "Failed to show device table: %m");
output_waiting_jobs(bus, table, j->id, "GetJobBefore", "\twaiting for job");
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return log_error_errno(r, "Failed to print the table: %m");
if (OUTPUT_MODE_IS_JSON(arg_output))
r = table_print_json(table, NULL, output_mode_to_json_format_flags(arg_output) | SD_JSON_FORMAT_COLOR_AUTO);
else
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
"FOO BAR BAZ KKK\n"
"hallo knuerzredgreen noansi thisisgrey\n");
- ASSERT_OK(table_print(table, /* f= */ NULL));
+ ASSERT_OK(table_print(table));
_cleanup_(sd_json_variant_unrefp) sd_json_variant *j = NULL, *jj = NULL;
if (r < 0)
return table_log_add_error(r);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
if (r < 0)
return table_log_add_error(r);
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
if (i->dest < i->origin || i->trans < i->recv || i->dest - i->origin < i->trans - i->recv) {
log_error("Invalid NTP response");
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = table_print(table);
if (r < 0)
return table_log_print_error(r);
ansi_normal(),
ansi_underline(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
- table_print(options, stdout);
+ table_print(options);
printf("\nSee the %s for details.\n", link);
return 0;
if (r < 0)
return table_log_add_error(r);
- r = table_print(t, NULL);
+ r = table_print(t);
if (r < 0)
return table_log_print_error(r);
}
return table_log_add_error(r);
}
- r = table_print(t, stdout);
+ r = table_print(t);
if (r < 0)
return table_log_print_error(r);