| 545 | |
| 546 | |
| 547 | static void |
| 548 | output_row(FILE *fout, const PQprintOpt *po, const int nFields, char **fields, |
| 549 | unsigned char *fieldNotNum, int *fieldMax, char *border, |
| 550 | const int row_index) |
| 551 | { |
| 552 | int field_index; /* for loop index */ |
| 553 | |
| 554 | if (po->html3) |
| 555 | fputs("<tr>", fout); |
| 556 | else if (po->standard) |
| 557 | fputs(po->fieldSep, fout); |
| 558 | for (field_index = 0; field_index < nFields; field_index++) |
| 559 | { |
| 560 | char *p = fields[row_index * nFields + field_index]; |
| 561 | |
| 562 | if (po->html3) |
| 563 | fprintf(fout, "<td align=\"%s\">%s</td>", |
| 564 | fieldNotNum[field_index] ? "left" : "right", p ? p : ""); |
| 565 | else |
| 566 | { |
| 567 | fprintf(fout, |
| 568 | fieldNotNum[field_index] ? |
| 569 | (po->standard ? " %-*s " : "%-*s") : |
| 570 | (po->standard ? " %*s " : "%*s"), |
| 571 | fieldMax[field_index], |
| 572 | p ? p : ""); |
| 573 | if (po->standard || field_index + 1 < nFields) |
| 574 | fputs(po->fieldSep, fout); |
| 575 | } |
| 576 | } |
| 577 | if (po->html3) |
| 578 | fputs("</tr>", fout); |
| 579 | else if (po->standard) |
| 580 | fprintf(fout, "\n%s", border); |
| 581 | fputc('\n', fout); |
| 582 | } |
| 583 | |
| 584 | |
| 585 | |