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

Function read_block

src/od.c:1404–1430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1402 as usual and return false. Otherwise return true. */
1403
1404static bool
1405read_block (idx_t n, char *block, idx_t *n_bytes_in_buffer)
1406{
1407 bool ok = true;
1408
1409 affirm (0 < n && n <= bytes_per_block);
1410
1411 *n_bytes_in_buffer = 0;
1412
1413 while (in_stream != NULL) /* EOF. */
1414 {
1415 idx_t n_needed = n - *n_bytes_in_buffer;
1416 idx_t n_read = fread (block + *n_bytes_in_buffer,
1417 1, n_needed, in_stream);
1418
1419 *n_bytes_in_buffer += n_read;
1420
1421 if (n_read == n_needed)
1422 break;
1423
1424 ok &= check_and_close (errno);
1425
1426 ok &= open_next_file ();
1427 }
1428
1429 return ok;
1430}
1431
1432/* Return the least common multiple of the sizes associated
1433 with the format specs. */

Callers 1

dumpFunction · 0.85

Calls 2

check_and_closeFunction · 0.85
open_next_fileFunction · 0.85

Tested by

no test coverage detected