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

Function digest_break_file

src/ptx.c:623–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621`----------------------------------------------------------------------*/
622
623static void
624digest_break_file (char const *file_name)
625{
626 BLOCK file_contents; /* to receive a copy of the file */
627
628 swallow_file_in_memory (file_name, &file_contents);
629
630 /* Make the fastmap and record the file contents in it. */
631
632 memset (word_fastmap, 1, CHAR_SET_SIZE);
633 for (char *cursor = file_contents.start; cursor < file_contents.end;
634 cursor++)
635 word_fastmap[to_uchar (*cursor)] = 0;
636
637 if (!gnu_extensions)
638 {
639
640 /* If GNU extensions are enabled, the only way to avoid newline as
641 a break character is to write all the break characters in the
642 file with no newline at all, not even at the end of the file.
643 If disabled, spaces, tabs and newlines are always considered as
644 break characters even if not included in the break file. */
645
646 word_fastmap[' '] = 0;
647 word_fastmap['\t'] = 0;
648 word_fastmap['\n'] = 0;
649 }
650
651 /* Return the space of the file, which is no more required. */
652
653 free (file_contents.start);
654}
655
656/*-----------------------------------------------------------------------.
657| Read a file named FILE_NAME, containing one word per line, then |

Callers 1

mainFunction · 0.85

Calls 2

swallow_file_in_memoryFunction · 0.85
to_ucharFunction · 0.85

Tested by

no test coverage detected