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

Function init_fps

src/pr.c:1327–1388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1325 see also open_file. */
1326
1327static bool
1328init_fps (int number_of_files, char **av)
1329{
1330 COLUMN *p;
1331
1332 total_files = 0;
1333
1334 free (column_vector);
1335 column_vector = xnmalloc (columns, sizeof (COLUMN));
1336
1337 if (parallel_files)
1338 {
1339 int files_left = number_of_files;
1340 for (p = column_vector; files_left--; ++p, ++av)
1341 {
1342 if (! open_file (*av, p))
1343 {
1344 --p;
1345 --columns;
1346 }
1347 }
1348 if (columns == 0)
1349 return false;
1350 init_header ("", -1);
1351 }
1352 else
1353 {
1354 p = column_vector;
1355 if (number_of_files > 0)
1356 {
1357 if (! open_file (*av, p))
1358 return false;
1359 init_header (*av, fileno (p->fp));
1360 p->lines_stored = 0;
1361 }
1362 else
1363 {
1364 p->name = _("standard input");
1365 p->fp = stdin;
1366 have_read_stdin = true;
1367 p->status = OPEN;
1368 p->full_page_printed = false;
1369 ++total_files;
1370 init_header ("", -1);
1371 p->lines_stored = 0;
1372 }
1373
1374 char const *firstname = p->name;
1375 FILE *firstfp = p->fp;
1376 int i;
1377 for (i = columns - 1, ++p; i; --i, ++p)
1378 {
1379 p->name = firstname;
1380 p->fp = firstfp;
1381 p->status = OPEN;
1382 p->full_page_printed = false;
1383 p->lines_stored = 0;
1384 }

Callers 1

print_filesFunction · 0.85

Calls 2

open_fileFunction · 0.85
init_headerFunction · 0.85

Tested by

no test coverage detected