MCPcopy Create free account
hub / github.com/coreutils/coreutils / close_file

Function close_file

src/pr.c:1515–1552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1513 the status of all columns in the column list to reflect the close. */
1514
1515static void
1516close_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.

Callers 3

read_rest_of_lineFunction · 0.85
skip_readFunction · 0.85
read_lineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected