| 1513 | the status of all columns in the column list to reflect the close. */ |
| 1514 | |
| 1515 | static void |
| 1516 | close_file (COLUMN *p) |
| 1517 | { |
| 1518 | COLUMN *q; |
| 1519 | int i; |
| 1520 | |
| 1521 | if (p->status == CLOSED) |
| 1522 | return; |
| 1523 | |
| 1524 | int err = errno; |
| 1525 | if (!ferror (p->fp)) |
| 1526 | err = 0; |
| 1527 | if (fileno (p->fp) == STDIN_FILENO) |
| 1528 | clearerr (p->fp); |
| 1529 | else if (fclose (p->fp) != 0 && !err) |
| 1530 | err = errno; |
| 1531 | if (err) |
| 1532 | error (EXIT_FAILURE, err, "%s", quotef (p->name)); |
| 1533 | |
| 1534 | if (!parallel_files) |
| 1535 | { |
| 1536 | for (q = column_vector, i = columns; i; ++q, --i) |
| 1537 | { |
| 1538 | q->status = CLOSED; |
| 1539 | if (q->lines_stored == 0) |
| 1540 | { |
| 1541 | q->lines_to_print = 0; |
| 1542 | } |
| 1543 | } |
| 1544 | } |
| 1545 | else |
| 1546 | { |
| 1547 | p->status = CLOSED; |
| 1548 | p->lines_to_print = 0; |
| 1549 | } |
| 1550 | |
| 1551 | --files_ready_to_read; |
| 1552 | } |
| 1553 | |
| 1554 | /* Put a file on hold until we start a new page, |
| 1555 | since we've hit a form feed. |
no outgoing calls
no test coverage detected