| 1307 | That condition may be false only for the last input block. */ |
| 1308 | |
| 1309 | static void |
| 1310 | write_block (intmax_t current_offset, idx_t n_bytes, |
| 1311 | char const *prev_block, char const *curr_block) |
| 1312 | { |
| 1313 | static bool first = true; |
| 1314 | static bool prev_pair_equal = false; |
| 1315 | |
| 1316 | if (abbreviate_duplicate_blocks |
| 1317 | && !first && n_bytes == bytes_per_block |
| 1318 | && memeq (prev_block, curr_block, bytes_per_block)) |
| 1319 | { |
| 1320 | if (prev_pair_equal) |
| 1321 | { |
| 1322 | /* The two preceding blocks were equal, and the current |
| 1323 | block is the same as the last one, so print nothing. */ |
| 1324 | } |
| 1325 | else |
| 1326 | { |
| 1327 | printf ("*\n"); |
| 1328 | prev_pair_equal = true; |
| 1329 | } |
| 1330 | } |
| 1331 | else |
| 1332 | { |
| 1333 | prev_pair_equal = false; |
| 1334 | for (idx_t i = 0; i < n_specs; i++) |
| 1335 | { |
| 1336 | int datum_width = width_bytes[spec[i].size]; |
| 1337 | idx_t fields_per_block = bytes_per_block / datum_width; |
| 1338 | idx_t blank_fields = (bytes_per_block - n_bytes) / datum_width; |
| 1339 | if (i == 0) |
| 1340 | format_address (current_offset, '\0'); |
| 1341 | else |
| 1342 | print_n_spaces (address_pad_len); |
| 1343 | (*spec[i].print_function) (fields_per_block, blank_fields, |
| 1344 | curr_block, spec[i].fmt_string, |
| 1345 | spec[i].field_width, spec[i].pad_width); |
| 1346 | if (spec[i].hexl_mode_trailer) |
| 1347 | { |
| 1348 | /* Space-pad out to full line width, then dump the trailer. */ |
| 1349 | int field_width = spec[i].field_width; |
| 1350 | for (idx_t f = 0; f < blank_fields; f++) |
| 1351 | print_n_spaces (field_width); |
| 1352 | idx_t pad_width = pad_at (fields_per_block, blank_fields, |
| 1353 | spec[i].pad_width); |
| 1354 | print_n_spaces (pad_width); |
| 1355 | dump_hexl_mode_trailer (n_bytes, curr_block); |
| 1356 | } |
| 1357 | putchar ('\n'); |
| 1358 | } |
| 1359 | } |
| 1360 | first = false; |
| 1361 | } |
| 1362 | |
| 1363 | /* Read a single byte into *C from the concatenation of the input files |
| 1364 | named in the global array FILE_LIST. On the first call to this |
no test coverage detected