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

Function skip_to_page

src/pr.c:2336–2374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2334 PAGE may be larger than total number of pages. */
2335
2336static bool
2337skip_to_page (uintmax_t page)
2338{
2339 for (uintmax_t n = 1; n < page; ++n)
2340 {
2341 COLUMN *p;
2342 int j;
2343
2344 for (int i = 1; i < lines_per_body; ++i)
2345 {
2346 for (j = 1, p = column_vector; j <= columns; ++j, ++p)
2347 if (p->status == OPEN)
2348 skip_read (p, j);
2349 }
2350 last_line = true;
2351 for (j = 1, p = column_vector; j <= columns; ++j, ++p)
2352 if (p->status == OPEN)
2353 skip_read (p, j);
2354
2355 if (storing_columns) /* change FF_FOUND to ON_HOLD */
2356 for (j = 1, p = column_vector; j <= columns; ++j, ++p)
2357 if (p->status != CLOSED)
2358 p->status = ON_HOLD;
2359
2360 reset_status ();
2361 last_line = false;
2362
2363 if (files_ready_to_read < 1)
2364 {
2365 /* It's very helpful, normally the total number of pages is
2366 not known in advance. */
2367 error (0, 0,
2368 _("starting page number %ju exceeds page count %ju"),
2369 page, n);
2370 break;
2371 }
2372 }
2373 return files_ready_to_read > 0;
2374}
2375
2376/* Print a header.
2377

Callers 1

print_filesFunction · 0.85

Calls 2

skip_readFunction · 0.85
reset_statusFunction · 0.85

Tested by

no test coverage detected