1 | diff -Purp mc-4.6.2/edit/edit.c mc-4.6.2-rhs/edit/edit.c |
---|
2 | --- mc-4.6.2/edit/edit.c 2009-02-01 19:30:21.000000000 +0000 |
---|
3 | +++ mc-4.6.2-rhs/edit/edit.c 2009-08-14 05:21:44.000000000 +0000 |
---|
4 | @@ -178,15 +178,18 @@ edit_load_file_fast (WEdit *edit, const |
---|
5 | } |
---|
6 | = |
---|
7 | |
---|
8 | /* detecting an error on save is easy: just check if every byte has = |
---|
9 | |
---|
10 | been written. */ |
---|
11 | -/* detecting an error on read, is not so easy 'cos there is not way to tell |
---|
12 | +/* detecting an error on read, is not so easy 'cos there is no way to tell |
---|
13 | whether you read everything or not. */ |
---|
14 | /* FIXME: add proper `triple_pipe_open' to read, write and check errors. */ |
---|
15 | static const struct edit_filters { |
---|
16 | const char *read, *write, *extension; |
---|
17 | } all_filters[] =3D { |
---|
18 | - { "bzip2 -cd %s 2>&1", "bzip2 > %s", ".bz2" }, |
---|
19 | - { "gzip -cd %s 2>&1", "gzip > %s", ".gz" }, |
---|
20 | - { "gzip -cd %s 2>&1", "gzip > %s", ".Z" } |
---|
21 | + { "xz -cd %s 2>&1", "xz > %s", ".xz" }, |
---|
22 | + { "lzip -cd %s 2>&1", "lzip > %s", ".lz" }, |
---|
23 | + { "lzma -cd %s 2>&1", "lzma > %s", ".lzma" }, |
---|
24 | + { "bzip2 -cd %s 2>&1", "bzip2 > %s", ".bz2" }, |
---|
25 | + { "gzip -cd %s 2>&1", "gzip > %s", ".gz" }, |
---|
26 | + { "gzip -cd %s 2>&1", "gzip > %s", ".Z" } |
---|
27 | }; |
---|
28 | = |
---|
29 | |
---|
30 | /* Return index of the filter or -1 is there is no appropriate filter */ |
---|
31 | diff -Purp mc-4.6.2/src/util.c mc-4.6.2-rhs/src/util.c |
---|
32 | --- mc-4.6.2/src/util.c 2009-02-01 19:30:21.000000000 +0000 |
---|
33 | +++ mc-4.6.2-rhs/src/util.c 2009-08-14 05:07:48.000000000 +0000 |
---|
34 | @@ -947,10 +947,10 @@ get_current_wd (char *buffer, int size) |
---|
35 | enum compression_type |
---|
36 | get_compression_type (int fd) |
---|
37 | { |
---|
38 | - unsigned char magic[4]; |
---|
39 | + unsigned char magic[16]; |
---|
40 | = |
---|
41 | |
---|
42 | /* Read the magic signature */ |
---|
43 | - if (mc_read (fd, (char *) magic, 4) !=3D 4) |
---|
44 | + if (mc_read (fd, (char *) magic, 6) !=3D 6) |
---|
45 | return COMPRESSION_NONE; |
---|
46 | = |
---|
47 | |
---|
48 | /* GZIP_MAGIC and OLD_GZIP_MAGIC */ |
---|
49 | @@ -991,16 +991,73 @@ get_compression_type (int fd) |
---|
50 | return COMPRESSION_BZIP2; |
---|
51 | } |
---|
52 | } |
---|
53 | - return 0; |
---|
54 | + |
---|
55 | + /* LZIP files */ |
---|
56 | + if ((magic[0] =3D=3D 'L') && (magic[1] =3D=3D 'Z') && |
---|
57 | + (magic[2] =3D=3D 'I') && (magic[3] =3D=3D 'P')) { |
---|
58 | + switch (magic[4]) { |
---|
59 | + case 0:case 1: |
---|
60 | + return COMPRESSION_LZIP; |
---|
61 | + default: |
---|
62 | + return COMPRESSION_NONE; |
---|
63 | + } |
---|
64 | + } |
---|
65 | + |
---|
66 | + /* XZ format */ |
---|
67 | + if ((magic[0] =3D=3D 0xFD) && (magic[1] =3D=3D '7') && (magic[2] =3D= |
---|
68 | =3D 'z') && |
---|
69 | + (magic[3] =3D=3D 'X') && (magic[4] =3D=3D 'Z')) { |
---|
70 | + switch (magic[5]) { |
---|
71 | + case 0: |
---|
72 | + return COMPRESSION_XZ; |
---|
73 | + default: |
---|
74 | + return COMPRESSION_NONE; |
---|
75 | + } |
---|
76 | + } |
---|
77 | + |
---|
78 | + /* LZMA Utils format. |
---|
79 | + * This format is the default for LZMA utils 4.32.1 and later. */ |
---|
80 | + if ((magic[0] =3D=3D 0xFF) && (magic[1] =3D=3D 'L') && (magic[2] =3D= |
---|
81 | =3D 'Z') && |
---|
82 | + (magic[3] =3D=3D 'M') && (magic[4] =3D=3D 'A')) { |
---|
83 | + switch (magic[5]) { |
---|
84 | + case 0: |
---|
85 | + return COMPRESSION_LZMA; |
---|
86 | + default: |
---|
87 | + return COMPRESSION_NONE; |
---|
88 | + } |
---|
89 | + } |
---|
90 | + |
---|
91 | + /* LZMA_Alone format. |
---|
92 | + * It is used by the LZMA_Alone tool from the LZMA SDK. */ |
---|
93 | + if (magic[0] < 0xE1) { |
---|
94 | + if (mc_read (fd, (char *) magic + 6, 7) =3D=3D 7) { |
---|
95 | + /* The LZMA_Alone format has no magic bytes, thus we |
---|
96 | + * need to play a wizard. This can give false positives, |
---|
97 | + * thus the detection below should be removed when |
---|
98 | + * the newer LZMA utils format has got popular. */ |
---|
99 | + if (magic[4] < 0x20 && |
---|
100 | + ((magic[10] =3D=3D 0x00 && magic[11] =3D=3D 0x00 && |
---|
101 | + magic[12] =3D=3D 0x00) || |
---|
102 | + (magic[5] =3D=3D 0xFF && magic[6] =3D=3D 0xFF && |
---|
103 | + magic[7] =3D=3D 0xFF && magic[8] =3D=3D 0xFF && |
---|
104 | + magic[9] =3D=3D 0xFF && magic[10] =3D=3D 0xFF && |
---|
105 | + magic[11] =3D=3D 0xFF && magic[12] =3D=3D 0xFF))) |
---|
106 | + return COMPRESSION_LZMA; |
---|
107 | + } |
---|
108 | + } |
---|
109 | + |
---|
110 | + return COMPRESSION_NONE; |
---|
111 | } |
---|
112 | = |
---|
113 | |
---|
114 | const char * |
---|
115 | decompress_extension (int type) |
---|
116 | { |
---|
117 | switch (type){ |
---|
118 | - case COMPRESSION_GZIP: return "#ugz"; |
---|
119 | - case COMPRESSION_BZIP: return "#ubz"; |
---|
120 | - case COMPRESSION_BZIP2: return "#ubz2"; |
---|
121 | + case COMPRESSION_GZIP: return "#ugz"; |
---|
122 | + case COMPRESSION_BZIP: return "#ubz"; |
---|
123 | + case COMPRESSION_BZIP2: return "#ubz2"; |
---|
124 | + case COMPRESSION_LZMA: return "#ulzma"; |
---|
125 | + case COMPRESSION_LZIP: return "#ulzip"; |
---|
126 | + case COMPRESSION_XZ: return "#uxz"; |
---|
127 | } |
---|
128 | /* Should never reach this place */ |
---|
129 | fprintf (stderr, "Fatal: decompress_extension called with an = |
---|
130 | |
---|
131 | unknown argument\n"); |
---|
132 | diff -Purp mc-4.6.2/src/util.h mc-4.6.2-rhs/src/util.h |
---|
133 | --- mc-4.6.2/src/util.h 2009-02-01 19:30:21.000000000 +0000 |
---|
134 | +++ mc-4.6.2-rhs/src/util.h 2009-08-14 05:21:44.000000000 +0000 |
---|
135 | @@ -178,7 +178,10 @@ enum compression_type { |
---|
136 | COMPRESSION_NONE, |
---|
137 | COMPRESSION_GZIP, |
---|
138 | COMPRESSION_BZIP, |
---|
139 | - COMPRESSION_BZIP2 |
---|
140 | + COMPRESSION_BZIP2, |
---|
141 | + COMPRESSION_LZMA, |
---|
142 | + COMPRESSION_LZIP, |
---|
143 | + COMPRESSION_XZ |
---|
144 | }; |
---|
145 | = |
---|
146 | |
---|
147 | /* Looks for ``magic'' bytes at the start of the VFS file to guess the |
---|
148 | diff -Purp mc-4.6.2/vfs/extfs/iso9660.in mc-4.6.2-rhs/vfs/extfs/iso9660.in |
---|
149 | --- mc-4.6.2/vfs/extfs/iso9660.in 2009-02-01 19:30:21.000000000 +0000 |
---|
150 | +++ mc-4.6.2-rhs/vfs/extfs/iso9660.in 2009-08-14 05:21:44.000000000 +0000 |
---|
151 | @@ -29,7 +29,10 @@ test_iso () { |
---|
152 | mcisofs_list () { |
---|
153 | # left as a reminder to implement compressed image support =3D) |
---|
154 | case "$1" in |
---|
155 | + *.lzma) MYCAT=3D"lzma -dc";; |
---|
156 | *.bz2) MYCAT=3D"bzip2 -dc";; |
---|
157 | + *.xz) MYCAT=3D"xz -dc";; |
---|
158 | + *.lz) MYCAT=3D"lzip -dc";; |
---|
159 | *.gz) MYCAT=3D"gzip -dc";; |
---|
160 | *.z) MYCAT=3D"gzip -dc";; |
---|
161 | *.Z) MYCAT=3D"gzip -dc";; |
---|
162 | diff -Purp mc-4.6.2/vfs/extfs/lslR.in mc-4.6.2-rhs/vfs/extfs/lslR.in |
---|
163 | --- mc-4.6.2/vfs/extfs/lslR.in 2009-02-01 19:30:21.000000000 +0000 |
---|
164 | +++ mc-4.6.2-rhs/vfs/extfs/lslR.in 2009-08-14 05:21:44.000000000 +0000 |
---|
165 | @@ -12,7 +12,10 @@ AWK=3D@AWK@ |
---|
166 | = |
---|
167 | |
---|
168 | mclslRfs_list () { |
---|
169 | case "$1" in |
---|
170 | + *.lzma) MYCAT=3D"lzma -dc";; |
---|
171 | *.bz2) MYCAT=3D"bzip2 -dc";; |
---|
172 | + *.xz) MYCAT=3D"xz -dc";; |
---|
173 | + *.lz) MYCAT=3D"lzip -dc";; |
---|
174 | *.gz) MYCAT=3D"gzip -dc";; |
---|
175 | *.z) MYCAT=3D"gzip -dc";; |
---|
176 | *.Z) MYCAT=3D"gzip -dc";; |
---|
177 | diff -Purp mc-4.6.2/vfs/extfs/mailfs.in mc-4.6.2-rhs/vfs/extfs/mailfs.in |
---|
178 | --- mc-4.6.2/vfs/extfs/mailfs.in 2009-02-01 19:30:21.000000000 +0000 |
---|
179 | +++ mc-4.6.2-rhs/vfs/extfs/mailfs.in 2009-08-14 05:21:44.000000000 +0000 |
---|
180 | @@ -7,6 +7,9 @@ use bytes; |
---|
181 | = |
---|
182 | |
---|
183 | $zcat=3D"zcat"; # gunzip to stdout |
---|
184 | $bzcat=3D"bzip2 -dc"; # bunzip2 to stdout |
---|
185 | +$lzcat=3D"lzma -dc"; # unlzma to stdout |
---|
186 | +$lzkat=3D"lzip -dc"; # unlzip to stdout |
---|
187 | +$xzcat=3D"xz -dc"; # unxzip to stdout |
---|
188 | $file=3D"file"; # "file" command |
---|
189 | $TZ=3D'GMT'; # default timezone (for Date module) |
---|
190 | = |
---|
191 | |
---|
192 | @@ -182,6 +185,10 @@ if (/gzip/) { |
---|
193 | exit 1 unless (open IN, "$zcat $mbox_qname|"); |
---|
194 | } elsif (/bzip/) { |
---|
195 | exit 1 unless (open IN, "$bzcat $mbox_qname|"); |
---|
196 | +} elsif (/lzma/) { |
---|
197 | + exit 1 unless (open IN, "$lzcat $mbox_qname|"); |
---|
198 | +} elsif (/lzip/) { |
---|
199 | + exit 1 unless (open IN, "$lzkat $mbox_qname|"); |
---|
200 | } else { |
---|
201 | exit 1 unless (open IN, "<$mbox_name"); |
---|
202 | } |
---|
203 | diff -Purp mc-4.6.2/vfs/extfs/patchfs.in mc-4.6.2-rhs/vfs/extfs/patchfs.in |
---|
204 | --- mc-4.6.2/vfs/extfs/patchfs.in 2009-02-01 19:30:21.000000000 +0000 |
---|
205 | +++ mc-4.6.2-rhs/vfs/extfs/patchfs.in 2009-08-14 05:21:44.000000000 +0000 |
---|
206 | @@ -12,8 +12,10 @@ use POSIX; |
---|
207 | use File::Temp 'tempfile'; |
---|
208 | = |
---|
209 | |
---|
210 | # standard binaries |
---|
211 | +my $lzma =3D 'lzma'; |
---|
212 | my $bzip =3D 'bzip2'; |
---|
213 | my $gzip =3D 'gzip'; |
---|
214 | +my $lzip =3D 'lzip'; |
---|
215 | my $fileutil =3D 'file'; |
---|
216 | = |
---|
217 | |
---|
218 | # date parsing requires Date::Parse from TimeDate module |
---|
219 | @@ -70,10 +72,14 @@ sub myin |
---|
220 | my ($qfname)=3D(quotemeta $_[0]); |
---|
221 | = |
---|
222 | |
---|
223 | $_=3D`$fileutil $qfname`; |
---|
224 | - if (/bzip/) { |
---|
225 | + if (/lzma/) { |
---|
226 | + return "$lzma -dc $qfname"; |
---|
227 | + } elsif (/bzip/) { |
---|
228 | return "$bzip -dc $qfname"; |
---|
229 | } elsif (/gzip/) { |
---|
230 | return "$gzip -dc $qfname"; |
---|
231 | + } elsif (/lzip/) { |
---|
232 | + return "$lzip -dc $qfname"; |
---|
233 | } else { |
---|
234 | return "cat $qfname"; |
---|
235 | } |
---|
236 | @@ -86,7 +92,9 @@ sub myout |
---|
237 | my ($sep) =3D $append ? '>>' : '>'; |
---|
238 | = |
---|
239 | |
---|
240 | $_=3D`$fileutil $qfname`; |
---|
241 | - if (/bzip/) { |
---|
242 | + if (/lzma/) { |
---|
243 | + return "$lzma -c $sep $qfname"; |
---|
244 | + } elsif (/bzip/) { |
---|
245 | return "$bzip -c $sep $qfname"; |
---|
246 | } elsif (/gzip/) { |
---|
247 | return "$gzip -c $sep $qfname"; |
---|
248 | diff -Purp mc-4.6.2/vfs/extfs/sfs.ini mc-4.6.2-rhs/vfs/extfs/sfs.ini |
---|
249 | --- mc-4.6.2/vfs/extfs/sfs.ini 2009-02-01 19:30:21.000000000 +0000 |
---|
250 | +++ mc-4.6.2-rhs/vfs/extfs/sfs.ini 2009-08-14 05:20:26.000000000 +0000 |
---|
251 | @@ -10,6 +10,12 @@ bz/1 bzip < %1 > %3 |
---|
252 | ubz/1 bzip -d < %1 > %3 |
---|
253 | bz2/1 bzip2 < %1 > %3 |
---|
254 | ubz2/1 bzip2 -d < %1 > %3 |
---|
255 | +lzma/1 lzma < %1 > %3 |
---|
256 | +ulzma/1 lzma -dc < %1 > %3 |
---|
257 | +lzip/1 lzip < %1 > %3 |
---|
258 | +ulzip/1 lzip -dc < %1 > %3 |
---|
259 | +xz/1 xz < %1 > %3 |
---|
260 | +uxz/1 xz -dc < %1 > %3 |
---|
261 | tar/1 tar cf %3 %1 |
---|
262 | tgz/1 tar czf %3 %1 |
---|
263 | uhtml/1 lynx -force_html -dump %1 > %3 |
---|
264 | diff -Purp mc-4.6.2/vfs/extfs/ulha.in mc-4.6.2-rhs/vfs/extfs/ulha.in |
---|
265 | --- mc-4.6.2/vfs/extfs/ulha.in 2009-02-01 19:30:21.000000000 +0000 |
---|
266 | +++ mc-4.6.2-rhs/vfs/extfs/ulha.in 2009-08-14 05:21:44.000000000 +0000 |
---|
267 | @@ -45,6 +45,12 @@ mc_lha_fs_list() |
---|
268 | $(NF) ~ /^\// { $(NF) =3D substr($NF,2) } |
---|
269 | # Print the line this way if there is no permission string |
---|
270 | $1 ~ /^\[.*\]/ { |
---|
271 | + # AR, PMA and CP/M LHARC lack date info |
---|
272 | + if ($6 =3D=3D "") { |
---|
273 | + $6 =3D $4 |
---|
274 | + $5 =3D "00:00" |
---|
275 | + $4 =3D "01-01-1980" |
---|
276 | + } |
---|
277 | # Invent a generic permission |
---|
278 | $1 =3D ($NF ~ /\/$/) ? "drwxr-xr-x":"-rwxr--r--"; |
---|
279 | # Print it |
---|
280 | @@ -76,7 +82,7 @@ mc_lha_fs_list() |
---|
281 | # Well, that is the intent. At the moment mc is translating them. |
---|
282 | split($2, id, "/"); |
---|
283 | printf "%s 1 %-8d %-8d %-8d %s %s %s %s\n", |
---|
284 | - $1, id[1], id[2], $3, $5, $6, $7, $8; |
---|
285 | + $1, id[1], id[2], $3, $5, $6, $7, substr($0, 52); |
---|
286 | # Get the next line of the list |
---|
287 | next; |
---|
288 | } |
---|