diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-11-29 05:52:13 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-11-29 05:52:13 -0500 |
| commit | 7c5d9ba68d782a52ef58e4f2597e27bd7c52cdee (patch) | |
| tree | 4a8641331a1c0b3502d0fb5b53a856dc2b99f55b /src | |
| parent | 4f2347c1d8015a092f990db6fa3b53ffbb5b85fd (diff) | |
| download | alftools-7c5d9ba68d782a52ef58e4f2597e27bd7c52cdee.tar.gz | |
alf: Handle 0-byte input files.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alf.1 | 6 | ||||
| -rw-r--r-- | src/alf.c | 10 | ||||
| -rw-r--r-- | src/alf.rst | 6 |
3 files changed, 9 insertions, 13 deletions
@@ -169,6 +169,9 @@ must be given as command\-line arguments. overwrites (making a backup) by default, and can append with the \fB\-a\fP option. .IP \(bu 2 +\fBLZ.COM\fP doesn\(aqt handle 0\-byte (empty) files correctly, but \fBalf\fP +does. Not that this is very useful. +.IP \(bu 2 Turning the screen off for speed makes no sense on modern operating systems, so there\(aqs no option for that. .UNINDENT @@ -190,9 +193,6 @@ actually can\(aqt handle files above about 15MB, if you compress one with a pathological case. A real Atari would take hours or even days to compress/decompress such files, and you\(aqd have to have a hard disk and a DOS capable of handling multi\-megabyte files... -.sp -It\(aqs also impossible to compress empty (0\-byte) files. \fBalf\fP will -skip them, if any are found. .SS Performance .sp Performance is \fIhorrible\fP\&. This shouldn\(aqt be a real problem on @@ -285,13 +285,14 @@ void crunch(void) { out_bitpos = 0; - store_token(TOK_RESET); + /* 0-byte input files don't get a TOK_RESET */ + if(input_len) + store_token(TOK_RESET); while(in_pos < input_len) { token = match_token(in_pos); store_token(token); new_pos = in_pos + tokentab[token].length; - // printf(" in_pos %d, new_pos %d\n", in_pos, new_pos); if(new_pos < input_len) make_token(in_pos, new_pos); in_pos = new_pos; @@ -332,11 +333,6 @@ void crunch_file(const char *filename) { fprintf(stderr, "%s: %s: this file is too large; only compressing the first 16MB.\n", self, filename); } - if(!input_len) { - fprintf(stderr, "%s: %s: can't compress a 0-byte (empty) file, skipping.\n", self, filename); - return; - } - if(opt_txtconv) convert_eols(); diff --git a/src/alf.rst b/src/alf.rst index 4bf2c6c..4d48afc 100644 --- a/src/alf.rst +++ b/src/alf.rst @@ -141,6 +141,9 @@ Atari **LZ.COM** aka **ALF.COM**, with the following differences: overwrites (making a backup) by default, and can append with the **-a** option. +- **LZ.COM** doesn't handle 0-byte (empty) files correctly, but **alf** + does. Not that this is very useful. + - Turning the screen off for speed makes no sense on modern operating systems, so there's no option for that. @@ -164,9 +167,6 @@ a pathological case. A real Atari would take hours or even days to compress/decompress such files, and you'd have to have a hard disk and a DOS capable of handling multi-megabyte files... -It's also impossible to compress empty (0-byte) files. **alf** will -skip them, if any are found. - Performance ----------- |
