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

Function open_file

src/pr.c:1482–1508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1480 see also init_fps. */
1481
1482static bool
1483open_file (char *name, COLUMN *p)
1484{
1485 if (streq (name, "-"))
1486 {
1487 p->name = _("standard input");
1488 p->fp = stdin;
1489 have_read_stdin = true;
1490 }
1491 else
1492 {
1493 p->name = name;
1494 p->fp = fopen (name, "r");
1495 }
1496 if (p->fp == NULL)
1497 {
1498 failed_opens = true;
1499 if (!ignore_failed_opens)
1500 error (0, errno, "%s", quotef (name));
1501 return false;
1502 }
1503 fadvise (p->fp, FADVISE_SEQUENTIAL);
1504 p->status = OPEN;
1505 p->full_page_printed = false;
1506 ++total_files;
1507 return true;
1508}
1509
1510/* Close the file in P.
1511

Callers 1

init_fpsFunction · 0.85

Calls 1

fadviseFunction · 0.85

Tested by

no test coverage detected