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