@@ -692,7 +692,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
692692if (opt_border == 0 )
693693width_total = col_count ;
694694else if (opt_border == 1 )
695- width_total = col_count * 3 - 1 ;
695+ width_total = col_count * 3 - (( col_count > 0 ) ? 1 : 0 ) ;
696696else
697697width_total = col_count * 3 + 1 ;
698698total_header_width = width_total ;
@@ -928,7 +928,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
928928fputs (!header_done [i ] ?format -> header_nl_right :" " ,
929929fout );
930930
931- if (opt_border != 0 && i < col_count - 1 )
931+ if (opt_border != 0 && col_count > 0 && i < col_count - 1 )
932932fputs (dformat -> midvrule ,fout );
933933}
934934curr_nl_line ++ ;
@@ -983,7 +983,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
983983struct lineptr * this_line = & col_lineptrs [j ][curr_nl_line [j ]];
984984int bytes_to_output ;
985985int chars_to_output = width_wrap [j ];
986- bool finalspaces = (opt_border == 2 || j < col_count - 1 );
986+ bool finalspaces = (opt_border == 2 ||
987+ (col_count > 0 && j < col_count - 1 ));
987988
988989/* Print left-hand wrap or newline mark */
989990if (opt_border != 0 )
@@ -1077,11 +1078,11 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
10771078fputs (format -> wrap_right ,fout );
10781079else if (wrap [j ]== PRINT_LINE_WRAP_NEWLINE )
10791080fputs (format -> nl_right ,fout );
1080- else if (opt_border == 2 || j < col_count - 1 )
1081+ else if (opt_border == 2 || ( col_count > 0 && j < col_count - 1 ) )
10811082fputc (' ' ,fout );
10821083
10831084/* Print column divider, if not the last column */
1084- if (opt_border != 0 && j < col_count - 1 )
1085+ if (opt_border != 0 && ( col_count > 0 && j < col_count - 1 ) )
10851086{
10861087if (wrap [j + 1 ]== PRINT_LINE_WRAP_WRAP )
10871088fputs (format -> midvrule_wrap ,fout );
@@ -1236,8 +1237,18 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
12361237if (cont -> cells [0 ]== NULL && cont -> opt -> start_table &&
12371238cont -> opt -> stop_table )
12381239{
1239- if (!opt_tuples_only && cont -> opt -> default_footer )
1240- fprintf (fout ,_ ("(No rows)\n" ));
1240+ printTableFooter * footers = footers_with_default (cont );
1241+
1242+ if (!opt_tuples_only && !cancel_pressed && footers )
1243+ {
1244+ printTableFooter * f ;
1245+
1246+ for (f = footers ;f ;f = f -> next )
1247+ fprintf (fout ,"%s\n" ,f -> data );
1248+ }
1249+
1250+ fputc ('\n' ,fout );
1251+
12411252return ;
12421253}
12431254