| 1966 | |
| 1967 | |
| 1968 | static void |
| 1969 | print_html_vertical(const printTableContent *cont, FILE *fout) |
| 1970 | { |
| 1971 | bool opt_tuples_only = cont->opt->tuples_only; |
| 1972 | unsigned short opt_border = cont->opt->border; |
| 1973 | const char *opt_table_attr = cont->opt->tableAttr; |
| 1974 | unsigned long record = cont->opt->prior_records + 1; |
| 1975 | unsigned int i; |
| 1976 | const char *const *ptr; |
| 1977 | |
| 1978 | if (cancel_pressed) |
| 1979 | return; |
| 1980 | |
| 1981 | if (cont->opt->start_table) |
| 1982 | { |
| 1983 | fprintf(fout, "<table border=\"%d\"", opt_border); |
| 1984 | if (opt_table_attr) |
| 1985 | fprintf(fout, " %s", opt_table_attr); |
| 1986 | fputs(">\n", fout); |
| 1987 | |
| 1988 | /* print title */ |
| 1989 | if (!opt_tuples_only && cont->title) |
| 1990 | { |
| 1991 | fputs(" <caption>", fout); |
| 1992 | html_escaped_print(cont->title, fout); |
| 1993 | fputs("</caption>\n", fout); |
| 1994 | } |
| 1995 | } |
| 1996 | |
| 1997 | /* print records */ |
| 1998 | for (i = 0, ptr = cont->cells; *ptr; i++, ptr++) |
| 1999 | { |
| 2000 | if (i % cont->ncolumns == 0) |
| 2001 | { |
| 2002 | if (cancel_pressed) |
| 2003 | break; |
| 2004 | if (!opt_tuples_only) |
| 2005 | fprintf(fout, |
| 2006 | "\n <tr><td colspan=\"2\" align=\"center\">Record %lu</td></tr>\n", |
| 2007 | record++); |
| 2008 | else |
| 2009 | fputs("\n <tr><td colspan=\"2\"> </td></tr>\n", fout); |
| 2010 | } |
| 2011 | fputs(" <tr valign=\"top\">\n" |
| 2012 | " <th>", fout); |
| 2013 | html_escaped_print(cont->headers[i % cont->ncolumns], fout); |
| 2014 | fputs("</th>\n", fout); |
| 2015 | |
| 2016 | fprintf(fout, " <td align=\"%s\">", cont->aligns[i % cont->ncolumns] == 'r' ? "right" : "left"); |
| 2017 | /* is string only whitespace? */ |
| 2018 | if ((*ptr)[strspn(*ptr, " \t")] == '\0') |
| 2019 | fputs(" ", fout); |
| 2020 | else |
| 2021 | html_escaped_print(*ptr, fout); |
| 2022 | |
| 2023 | fputs("</td>\n </tr>\n", fout); |
| 2024 | } |
| 2025 |
no test coverage detected