... returns 1 if nothing printed.
Signed-off-by: Karel Zak <kzak@redhat.com>
struct tt *tt = NULL;
int tt_flags = 0;
- int i, c, rc = EXIT_FAILURE;
+ int i, c, nlines = 0, rc = EXIT_FAILURE;
struct option longopts[] = {
{ "ascii", 0, 0, 'a' },
while((fs = get_next_fs(tb, itr))) {
if (!add_line(tt, fs, NULL))
goto leave;
+ nlines++;
if (flags & FL_FIRSTONLY)
break;
}
* Print the output table
*/
tt_print_table(tt);
- rc = EXIT_SUCCESS;
+
+ if (is_listall_mode() || nlines)
+ rc = EXIT_SUCCESS;
leave:
tt_free_table(tt);