@@ -115,8 +115,8 @@ contains |
| 115 | return | 115 | return |
| 116 | end if | 116 | end if |
| 117 | | 117 | |
| 118 | - ! Validate: need at least one pattern | 118 | + ! Validate: need at least one pattern source (but empty pattern file is valid) |
| 119 | - if (size(patterns) == 0) then | 119 | + if (.not. has_explicit_pattern) then |
| 120 | write(error_unit, '(A)') 'ferp: no pattern specified' | 120 | write(error_unit, '(A)') 'ferp: no pattern specified' |
| 121 | write(error_unit, '(A)') "Try 'ferp --help' for more information." | 121 | write(error_unit, '(A)') "Try 'ferp --help' for more information." |
| 122 | ierr = 2 | 122 | ierr = 2 |
@@ -699,9 +699,9 @@ contains |
| 699 | character(len=1) :: ch | 699 | character(len=1) :: ch |
| 700 | | 700 | |
| 701 | ierr = 0 | 701 | ierr = 0 |
| 702 | - ! Use stream access to read exact line lengths (preserving whitespace patterns) | 702 | + ! Use unformatted stream access for byte-by-byte reading |
| 703 | open(newunit=unit_num, file=filename, status='old', action='read', & | 703 | open(newunit=unit_num, file=filename, status='old', action='read', & |
| 704 | - access='stream', form='formatted', iostat=ios) | 704 | + access='stream', form='unformatted', iostat=ios) |
| 705 | if (ios /= 0) then | 705 | if (ios /= 0) then |
| 706 | write(error_unit, '(A)') 'ferp: ' // trim(filename) // ': No such file or directory' | 706 | write(error_unit, '(A)') 'ferp: ' // trim(filename) // ': No such file or directory' |
| 707 | ierr = 2 | 707 | ierr = 2 |
@@ -712,7 +712,7 @@ contains |
| 712 | line = '' | 712 | line = '' |
| 713 | | 713 | |
| 714 | do | 714 | do |
| 715 | - read(unit_num, '(A1)', iostat=ios, advance='no') ch | 715 | + read(unit_num, iostat=ios) ch |
| 716 | if (ios /= 0) then | 716 | if (ios /= 0) then |
| 717 | ! EOF or error - save current line if non-empty | 717 | ! EOF or error - save current line if non-empty |
| 718 | if (line_len > 0) then | 718 | if (line_len > 0) then |