Browse code

Replaced modified libmspack-0.5alpha with libmspack-0.7alpha (vanilla).

Micah Snyder authored on 2018/09/15 09:54:02
Showing 177 changed files
... ...
@@ -175,7 +175,7 @@ distclean-recursive distdir maintainer-clean-recursive: c++/Makefile
175 175
 endif
176 176
 
177 177
 # libmspack version:
178
-LIBMSPACK_VERSION = 0:5:0
178
+LIBMSPACK_VERSION = 0:7:1
179 179
 
180 180
 libclammspack_la_CFLAGS = -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I@top_srcdir@/libclammspack/mspack
181 181
 libclammspack_la_LDFLAGS = -version-info $(LIBMSPACK_VERSION) -no-undefined -export-symbols-regex '^mspack_'
... ...
@@ -10,3 +10,4 @@ Contributors:
10 10
 - LZX decompressor fixes by Jae Jung and Igor Glucksmann
11 11
 - Debianisation by Markus Sinner
12 12
 - Quantum decompressor fix by Larry Frieson
13
+- OAB decompressor by David Woodhouse
13 14
new file mode 100644
... ...
@@ -0,0 +1,504 @@
0
+		  GNU LESSER GENERAL PUBLIC LICENSE
1
+		       Version 2.1, February 1999
2
+
3
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
4
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+[This is the first released version of the Lesser GPL.  It also counts
9
+ as the successor of the GNU Library Public License, version 2, hence
10
+ the version number 2.1.]
11
+
12
+			    Preamble
13
+
14
+  The licenses for most software are designed to take away your
15
+freedom to share and change it.  By contrast, the GNU General Public
16
+Licenses are intended to guarantee your freedom to share and change
17
+free software--to make sure the software is free for all its users.
18
+
19
+  This license, the Lesser General Public License, applies to some
20
+specially designated software packages--typically libraries--of the
21
+Free Software Foundation and other authors who decide to use it.  You
22
+can use it too, but we suggest you first think carefully about whether
23
+this license or the ordinary General Public License is the better
24
+strategy to use in any particular case, based on the explanations below.
25
+
26
+  When we speak of free software, we are referring to freedom of use,
27
+not price.  Our General Public Licenses are designed to make sure that
28
+you have the freedom to distribute copies of free software (and charge
29
+for this service if you wish); that you receive source code or can get
30
+it if you want it; that you can change the software and use pieces of
31
+it in new free programs; and that you are informed that you can do
32
+these things.
33
+
34
+  To protect your rights, we need to make restrictions that forbid
35
+distributors to deny you these rights or to ask you to surrender these
36
+rights.  These restrictions translate to certain responsibilities for
37
+you if you distribute copies of the library or if you modify it.
38
+
39
+  For example, if you distribute copies of the library, whether gratis
40
+or for a fee, you must give the recipients all the rights that we gave
41
+you.  You must make sure that they, too, receive or can get the source
42
+code.  If you link other code with the library, you must provide
43
+complete object files to the recipients, so that they can relink them
44
+with the library after making changes to the library and recompiling
45
+it.  And you must show them these terms so they know their rights.
46
+
47
+  We protect your rights with a two-step method: (1) we copyright the
48
+library, and (2) we offer you this license, which gives you legal
49
+permission to copy, distribute and/or modify the library.
50
+
51
+  To protect each distributor, we want to make it very clear that
52
+there is no warranty for the free library.  Also, if the library is
53
+modified by someone else and passed on, the recipients should know
54
+that what they have is not the original version, so that the original
55
+author's reputation will not be affected by problems that might be
56
+introduced by others.
57
+
58
+  Finally, software patents pose a constant threat to the existence of
59
+any free program.  We wish to make sure that a company cannot
60
+effectively restrict the users of a free program by obtaining a
61
+restrictive license from a patent holder.  Therefore, we insist that
62
+any patent license obtained for a version of the library must be
63
+consistent with the full freedom of use specified in this license.
64
+
65
+  Most GNU software, including some libraries, is covered by the
66
+ordinary GNU General Public License.  This license, the GNU Lesser
67
+General Public License, applies to certain designated libraries, and
68
+is quite different from the ordinary General Public License.  We use
69
+this license for certain libraries in order to permit linking those
70
+libraries into non-free programs.
71
+
72
+  When a program is linked with a library, whether statically or using
73
+a shared library, the combination of the two is legally speaking a
74
+combined work, a derivative of the original library.  The ordinary
75
+General Public License therefore permits such linking only if the
76
+entire combination fits its criteria of freedom.  The Lesser General
77
+Public License permits more lax criteria for linking other code with
78
+the library.
79
+
80
+  We call this license the "Lesser" General Public License because it
81
+does Less to protect the user's freedom than the ordinary General
82
+Public License.  It also provides other free software developers Less
83
+of an advantage over competing non-free programs.  These disadvantages
84
+are the reason we use the ordinary General Public License for many
85
+libraries.  However, the Lesser license provides advantages in certain
86
+special circumstances.
87
+
88
+  For example, on rare occasions, there may be a special need to
89
+encourage the widest possible use of a certain library, so that it becomes
90
+a de-facto standard.  To achieve this, non-free programs must be
91
+allowed to use the library.  A more frequent case is that a free
92
+library does the same job as widely used non-free libraries.  In this
93
+case, there is little to gain by limiting the free library to free
94
+software only, so we use the Lesser General Public License.
95
+
96
+  In other cases, permission to use a particular library in non-free
97
+programs enables a greater number of people to use a large body of
98
+free software.  For example, permission to use the GNU C Library in
99
+non-free programs enables many more people to use the whole GNU
100
+operating system, as well as its variant, the GNU/Linux operating
101
+system.
102
+
103
+  Although the Lesser General Public License is Less protective of the
104
+users' freedom, it does ensure that the user of a program that is
105
+linked with the Library has the freedom and the wherewithal to run
106
+that program using a modified version of the Library.
107
+
108
+  The precise terms and conditions for copying, distribution and
109
+modification follow.  Pay close attention to the difference between a
110
+"work based on the library" and a "work that uses the library".  The
111
+former contains code derived from the library, whereas the latter must
112
+be combined with the library in order to run.
113
+
114
+		  GNU LESSER GENERAL PUBLIC LICENSE
115
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
116
+
117
+  0. This License Agreement applies to any software library or other
118
+program which contains a notice placed by the copyright holder or
119
+other authorized party saying it may be distributed under the terms of
120
+this Lesser General Public License (also called "this License").
121
+Each licensee is addressed as "you".
122
+
123
+  A "library" means a collection of software functions and/or data
124
+prepared so as to be conveniently linked with application programs
125
+(which use some of those functions and data) to form executables.
126
+
127
+  The "Library", below, refers to any such software library or work
128
+which has been distributed under these terms.  A "work based on the
129
+Library" means either the Library or any derivative work under
130
+copyright law: that is to say, a work containing the Library or a
131
+portion of it, either verbatim or with modifications and/or translated
132
+straightforwardly into another language.  (Hereinafter, translation is
133
+included without limitation in the term "modification".)
134
+
135
+  "Source code" for a work means the preferred form of the work for
136
+making modifications to it.  For a library, complete source code means
137
+all the source code for all modules it contains, plus any associated
138
+interface definition files, plus the scripts used to control compilation
139
+and installation of the library.
140
+
141
+  Activities other than copying, distribution and modification are not
142
+covered by this License; they are outside its scope.  The act of
143
+running a program using the Library is not restricted, and output from
144
+such a program is covered only if its contents constitute a work based
145
+on the Library (independent of the use of the Library in a tool for
146
+writing it).  Whether that is true depends on what the Library does
147
+and what the program that uses the Library does.
148
+  
149
+  1. You may copy and distribute verbatim copies of the Library's
150
+complete source code as you receive it, in any medium, provided that
151
+you conspicuously and appropriately publish on each copy an
152
+appropriate copyright notice and disclaimer of warranty; keep intact
153
+all the notices that refer to this License and to the absence of any
154
+warranty; and distribute a copy of this License along with the
155
+Library.
156
+
157
+  You may charge a fee for the physical act of transferring a copy,
158
+and you may at your option offer warranty protection in exchange for a
159
+fee.
160
+
161
+  2. You may modify your copy or copies of the Library or any portion
162
+of it, thus forming a work based on the Library, and copy and
163
+distribute such modifications or work under the terms of Section 1
164
+above, provided that you also meet all of these conditions:
165
+
166
+    a) The modified work must itself be a software library.
167
+
168
+    b) You must cause the files modified to carry prominent notices
169
+    stating that you changed the files and the date of any change.
170
+
171
+    c) You must cause the whole of the work to be licensed at no
172
+    charge to all third parties under the terms of this License.
173
+
174
+    d) If a facility in the modified Library refers to a function or a
175
+    table of data to be supplied by an application program that uses
176
+    the facility, other than as an argument passed when the facility
177
+    is invoked, then you must make a good faith effort to ensure that,
178
+    in the event an application does not supply such function or
179
+    table, the facility still operates, and performs whatever part of
180
+    its purpose remains meaningful.
181
+
182
+    (For example, a function in a library to compute square roots has
183
+    a purpose that is entirely well-defined independent of the
184
+    application.  Therefore, Subsection 2d requires that any
185
+    application-supplied function or table used by this function must
186
+    be optional: if the application does not supply it, the square
187
+    root function must still compute square roots.)
188
+
189
+These requirements apply to the modified work as a whole.  If
190
+identifiable sections of that work are not derived from the Library,
191
+and can be reasonably considered independent and separate works in
192
+themselves, then this License, and its terms, do not apply to those
193
+sections when you distribute them as separate works.  But when you
194
+distribute the same sections as part of a whole which is a work based
195
+on the Library, the distribution of the whole must be on the terms of
196
+this License, whose permissions for other licensees extend to the
197
+entire whole, and thus to each and every part regardless of who wrote
198
+it.
199
+
200
+Thus, it is not the intent of this section to claim rights or contest
201
+your rights to work written entirely by you; rather, the intent is to
202
+exercise the right to control the distribution of derivative or
203
+collective works based on the Library.
204
+
205
+In addition, mere aggregation of another work not based on the Library
206
+with the Library (or with a work based on the Library) on a volume of
207
+a storage or distribution medium does not bring the other work under
208
+the scope of this License.
209
+
210
+  3. You may opt to apply the terms of the ordinary GNU General Public
211
+License instead of this License to a given copy of the Library.  To do
212
+this, you must alter all the notices that refer to this License, so
213
+that they refer to the ordinary GNU General Public License, version 2,
214
+instead of to this License.  (If a newer version than version 2 of the
215
+ordinary GNU General Public License has appeared, then you can specify
216
+that version instead if you wish.)  Do not make any other change in
217
+these notices.
218
+
219
+  Once this change is made in a given copy, it is irreversible for
220
+that copy, so the ordinary GNU General Public License applies to all
221
+subsequent copies and derivative works made from that copy.
222
+
223
+  This option is useful when you wish to copy part of the code of
224
+the Library into a program that is not a library.
225
+
226
+  4. You may copy and distribute the Library (or a portion or
227
+derivative of it, under Section 2) in object code or executable form
228
+under the terms of Sections 1 and 2 above provided that you accompany
229
+it with the complete corresponding machine-readable source code, which
230
+must be distributed under the terms of Sections 1 and 2 above on a
231
+medium customarily used for software interchange.
232
+
233
+  If distribution of object code is made by offering access to copy
234
+from a designated place, then offering equivalent access to copy the
235
+source code from the same place satisfies the requirement to
236
+distribute the source code, even though third parties are not
237
+compelled to copy the source along with the object code.
238
+
239
+  5. A program that contains no derivative of any portion of the
240
+Library, but is designed to work with the Library by being compiled or
241
+linked with it, is called a "work that uses the Library".  Such a
242
+work, in isolation, is not a derivative work of the Library, and
243
+therefore falls outside the scope of this License.
244
+
245
+  However, linking a "work that uses the Library" with the Library
246
+creates an executable that is a derivative of the Library (because it
247
+contains portions of the Library), rather than a "work that uses the
248
+library".  The executable is therefore covered by this License.
249
+Section 6 states terms for distribution of such executables.
250
+
251
+  When a "work that uses the Library" uses material from a header file
252
+that is part of the Library, the object code for the work may be a
253
+derivative work of the Library even though the source code is not.
254
+Whether this is true is especially significant if the work can be
255
+linked without the Library, or if the work is itself a library.  The
256
+threshold for this to be true is not precisely defined by law.
257
+
258
+  If such an object file uses only numerical parameters, data
259
+structure layouts and accessors, and small macros and small inline
260
+functions (ten lines or less in length), then the use of the object
261
+file is unrestricted, regardless of whether it is legally a derivative
262
+work.  (Executables containing this object code plus portions of the
263
+Library will still fall under Section 6.)
264
+
265
+  Otherwise, if the work is a derivative of the Library, you may
266
+distribute the object code for the work under the terms of Section 6.
267
+Any executables containing that work also fall under Section 6,
268
+whether or not they are linked directly with the Library itself.
269
+
270
+  6. As an exception to the Sections above, you may also combine or
271
+link a "work that uses the Library" with the Library to produce a
272
+work containing portions of the Library, and distribute that work
273
+under terms of your choice, provided that the terms permit
274
+modification of the work for the customer's own use and reverse
275
+engineering for debugging such modifications.
276
+
277
+  You must give prominent notice with each copy of the work that the
278
+Library is used in it and that the Library and its use are covered by
279
+this License.  You must supply a copy of this License.  If the work
280
+during execution displays copyright notices, you must include the
281
+copyright notice for the Library among them, as well as a reference
282
+directing the user to the copy of this License.  Also, you must do one
283
+of these things:
284
+
285
+    a) Accompany the work with the complete corresponding
286
+    machine-readable source code for the Library including whatever
287
+    changes were used in the work (which must be distributed under
288
+    Sections 1 and 2 above); and, if the work is an executable linked
289
+    with the Library, with the complete machine-readable "work that
290
+    uses the Library", as object code and/or source code, so that the
291
+    user can modify the Library and then relink to produce a modified
292
+    executable containing the modified Library.  (It is understood
293
+    that the user who changes the contents of definitions files in the
294
+    Library will not necessarily be able to recompile the application
295
+    to use the modified definitions.)
296
+
297
+    b) Use a suitable shared library mechanism for linking with the
298
+    Library.  A suitable mechanism is one that (1) uses at run time a
299
+    copy of the library already present on the user's computer system,
300
+    rather than copying library functions into the executable, and (2)
301
+    will operate properly with a modified version of the library, if
302
+    the user installs one, as long as the modified version is
303
+    interface-compatible with the version that the work was made with.
304
+
305
+    c) Accompany the work with a written offer, valid for at
306
+    least three years, to give the same user the materials
307
+    specified in Subsection 6a, above, for a charge no more
308
+    than the cost of performing this distribution.
309
+
310
+    d) If distribution of the work is made by offering access to copy
311
+    from a designated place, offer equivalent access to copy the above
312
+    specified materials from the same place.
313
+
314
+    e) Verify that the user has already received a copy of these
315
+    materials or that you have already sent this user a copy.
316
+
317
+  For an executable, the required form of the "work that uses the
318
+Library" must include any data and utility programs needed for
319
+reproducing the executable from it.  However, as a special exception,
320
+the materials to be distributed need not include anything that is
321
+normally distributed (in either source or binary form) with the major
322
+components (compiler, kernel, and so on) of the operating system on
323
+which the executable runs, unless that component itself accompanies
324
+the executable.
325
+
326
+  It may happen that this requirement contradicts the license
327
+restrictions of other proprietary libraries that do not normally
328
+accompany the operating system.  Such a contradiction means you cannot
329
+use both them and the Library together in an executable that you
330
+distribute.
331
+
332
+  7. You may place library facilities that are a work based on the
333
+Library side-by-side in a single library together with other library
334
+facilities not covered by this License, and distribute such a combined
335
+library, provided that the separate distribution of the work based on
336
+the Library and of the other library facilities is otherwise
337
+permitted, and provided that you do these two things:
338
+
339
+    a) Accompany the combined library with a copy of the same work
340
+    based on the Library, uncombined with any other library
341
+    facilities.  This must be distributed under the terms of the
342
+    Sections above.
343
+
344
+    b) Give prominent notice with the combined library of the fact
345
+    that part of it is a work based on the Library, and explaining
346
+    where to find the accompanying uncombined form of the same work.
347
+
348
+  8. You may not copy, modify, sublicense, link with, or distribute
349
+the Library except as expressly provided under this License.  Any
350
+attempt otherwise to copy, modify, sublicense, link with, or
351
+distribute the Library is void, and will automatically terminate your
352
+rights under this License.  However, parties who have received copies,
353
+or rights, from you under this License will not have their licenses
354
+terminated so long as such parties remain in full compliance.
355
+
356
+  9. You are not required to accept this License, since you have not
357
+signed it.  However, nothing else grants you permission to modify or
358
+distribute the Library or its derivative works.  These actions are
359
+prohibited by law if you do not accept this License.  Therefore, by
360
+modifying or distributing the Library (or any work based on the
361
+Library), you indicate your acceptance of this License to do so, and
362
+all its terms and conditions for copying, distributing or modifying
363
+the Library or works based on it.
364
+
365
+  10. Each time you redistribute the Library (or any work based on the
366
+Library), the recipient automatically receives a license from the
367
+original licensor to copy, distribute, link with or modify the Library
368
+subject to these terms and conditions.  You may not impose any further
369
+restrictions on the recipients' exercise of the rights granted herein.
370
+You are not responsible for enforcing compliance by third parties with
371
+this License.
372
+
373
+  11. If, as a consequence of a court judgment or allegation of patent
374
+infringement or for any other reason (not limited to patent issues),
375
+conditions are imposed on you (whether by court order, agreement or
376
+otherwise) that contradict the conditions of this License, they do not
377
+excuse you from the conditions of this License.  If you cannot
378
+distribute so as to satisfy simultaneously your obligations under this
379
+License and any other pertinent obligations, then as a consequence you
380
+may not distribute the Library at all.  For example, if a patent
381
+license would not permit royalty-free redistribution of the Library by
382
+all those who receive copies directly or indirectly through you, then
383
+the only way you could satisfy both it and this License would be to
384
+refrain entirely from distribution of the Library.
385
+
386
+If any portion of this section is held invalid or unenforceable under any
387
+particular circumstance, the balance of the section is intended to apply,
388
+and the section as a whole is intended to apply in other circumstances.
389
+
390
+It is not the purpose of this section to induce you to infringe any
391
+patents or other property right claims or to contest validity of any
392
+such claims; this section has the sole purpose of protecting the
393
+integrity of the free software distribution system which is
394
+implemented by public license practices.  Many people have made
395
+generous contributions to the wide range of software distributed
396
+through that system in reliance on consistent application of that
397
+system; it is up to the author/donor to decide if he or she is willing
398
+to distribute software through any other system and a licensee cannot
399
+impose that choice.
400
+
401
+This section is intended to make thoroughly clear what is believed to
402
+be a consequence of the rest of this License.
403
+
404
+  12. If the distribution and/or use of the Library is restricted in
405
+certain countries either by patents or by copyrighted interfaces, the
406
+original copyright holder who places the Library under this License may add
407
+an explicit geographical distribution limitation excluding those countries,
408
+so that distribution is permitted only in or among countries not thus
409
+excluded.  In such case, this License incorporates the limitation as if
410
+written in the body of this License.
411
+
412
+  13. The Free Software Foundation may publish revised and/or new
413
+versions of the Lesser General Public License from time to time.
414
+Such new versions will be similar in spirit to the present version,
415
+but may differ in detail to address new problems or concerns.
416
+
417
+Each version is given a distinguishing version number.  If the Library
418
+specifies a version number of this License which applies to it and
419
+"any later version", you have the option of following the terms and
420
+conditions either of that version or of any later version published by
421
+the Free Software Foundation.  If the Library does not specify a
422
+license version number, you may choose any version ever published by
423
+the Free Software Foundation.
424
+
425
+  14. If you wish to incorporate parts of the Library into other free
426
+programs whose distribution conditions are incompatible with these,
427
+write to the author to ask for permission.  For software which is
428
+copyrighted by the Free Software Foundation, write to the Free
429
+Software Foundation; we sometimes make exceptions for this.  Our
430
+decision will be guided by the two goals of preserving the free status
431
+of all derivatives of our free software and of promoting the sharing
432
+and reuse of software generally.
433
+
434
+			    NO WARRANTY
435
+
436
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
437
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
438
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
439
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
440
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
441
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
442
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
443
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
444
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
445
+
446
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
447
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
448
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
449
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
450
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
451
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
452
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
453
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
454
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
455
+DAMAGES.
456
+
457
+		     END OF TERMS AND CONDITIONS
458
+
459
+           How to Apply These Terms to Your New Libraries
460
+
461
+  If you develop a new library, and you want it to be of the greatest
462
+possible use to the public, we recommend making it free software that
463
+everyone can redistribute and change.  You can do so by permitting
464
+redistribution under these terms (or, alternatively, under the terms of the
465
+ordinary General Public License).
466
+
467
+  To apply these terms, attach the following notices to the library.  It is
468
+safest to attach them to the start of each source file to most effectively
469
+convey the exclusion of warranty; and each file should have at least the
470
+"copyright" line and a pointer to where the full notice is found.
471
+
472
+    <one line to give the library's name and a brief idea of what it does.>
473
+    Copyright (C) <year>  <name of author>
474
+
475
+    This library is free software; you can redistribute it and/or
476
+    modify it under the terms of the GNU Lesser General Public
477
+    License as published by the Free Software Foundation; either
478
+    version 2.1 of the License, or (at your option) any later version.
479
+
480
+    This library is distributed in the hope that it will be useful,
481
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
482
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
483
+    Lesser General Public License for more details.
484
+
485
+    You should have received a copy of the GNU Lesser General Public
486
+    License along with this library; if not, write to the Free Software
487
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
488
+
489
+Also add information on how to contact you by electronic and paper mail.
490
+
491
+You should also get your employer (if you work as a programmer) or your
492
+school, if any, to sign a "copyright disclaimer" for the library, if
493
+necessary.  Here is a sample; alter the names:
494
+
495
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
496
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
497
+
498
+  <signature of Ty Coon>, 1 April 1990
499
+  Ty Coon, President of Vice
500
+
501
+That's all there is to it!
502
+
503
+
... ...
@@ -1,3 +1,100 @@
1
+2018-08-09  Stuart Caie <kyzer@cabextract.org.uk>
2
+
3
+	* Makefile.am: the test file cve-2015-4467-reset-interval-zero.chm is
4
+	detected by ClamAV as BC.Legacy.Exploit.CVE_2012_1458-1 "infected".
5
+	My hosting deletes anything that ClamAV calls "infected", so has been
6
+	continually deleting the official libmspack 0.7alpha release.
7
+	
8
+	CVE-2012-1458 is the same issue as CVE-2015-4467: both libmspack, and
9
+	ClamAV using libmspack, could get a division-by-zero crash when the LZX
10
+	reset interval was zero. This was fixed years ago, but ClamAV still has 
11
+	it as a signature, which today prevents me from releasing libmspack.
12
+	
13
+	BC.Legacy.Exploit.CVE_2012_1458-1 is a bytecode signature, so I can't
14
+	see the exact trigger conditions, but I can see that it looks for the
15
+	"LZXC" signature of the LZX control file, so I've changed this to
16
+	"lzxc" and added a step in the Makefile to change it back to LZXC, so
17
+	I can release libmspack whether or not ClamAV keeps the signature.
18
+
19
+2018-04-26  Stuart Caie <kyzer@cabextract.org.uk>
20
+
21
+	* read_chunk(): the test that chunk numbers are in bounds was off
22
+	by one, so read_chunk() returned a pointer taken from outside
23
+	allocated memory that usually crashes libmspack when accessed.
24
+	Thanks to Hanno Böck for finding the issue and providing a sample.
25
+
26
+	* chmd_read_headers(): reject files with blank filenames. Thanks
27
+	again to Hanno Böck for finding the issue and providing a sample file.
28
+
29
+2018-02-06  Stuart Caie <kyzer@cabextract.org.uk>
30
+
31
+	* chmd.c: fixed an off-by-one error in the TOLOWER() macro, reported
32
+	by Dmitry Glavatskikh. Thanks Dmitry!
33
+
34
+2017-11-26  Stuart Caie <kyzer@cabextract.org.uk>
35
+
36
+	* kwajd_read_headers(): fix up the logic of reading the filename and
37
+	extension headers to avoid a one or two byte overwrite. Thanks to
38
+	Jakub Wilk for finding the issue.
39
+
40
+	* test/kwajd_test.c: add tests for KWAJ filename.ext handling
41
+
42
+2017-10-16  Stuart Caie <kyzer@cabextract.org.uk>
43
+
44
+	* test/cabd_test.c: update the short string tests to expect not only
45
+	MSPACK_ERR_DATAFORMAT but also MSPACK_ERR_READ, because of the recent
46
+	change to cabd_read_string(). Thanks to maitreyee43 for spotting this.
47
+
48
+	* test/msdecompile_md5: update the setup instructions for this script,
49
+	and also change the script so it works with current Wine. Again, thanks
50
+	to maitreyee43 for trying to use it and finding it not working.
51
+
52
+2017-08-13  Stuart Caie <kyzer@cabextract.org.uk>
53
+
54
+	* src/chmextract.c: support MinGW one-arg mkdir(). Thanks to AntumDeluge
55
+	for reporting this.
56
+
57
+2017-08-13  Stuart Caie <kyzer@cabextract.org.uk>
58
+
59
+	* read_spaninfo(): a CHM file can have no ResetTable and have a
60
+	negative length in SpanInfo, which then feeds a negative output length
61
+	to lzxd_init(), which then sets frame_size to a value of your choosing,
62
+	the lower 32 bits of output length, larger than LZX_FRAME_SIZE. If the
63
+	first LZX block is uncompressed, this writes data beyond the end of the
64
+	window. This issue was raised by ClamAV as CVE-2017-6419.  Thanks to
65
+	Sebastian Andrzej Siewior for finding this by chance!
66
+
67
+	* lzxd_init(), lzxd_set_output_length(), mszipd_init(): due to the issue
68
+	mentioned above, these functions now reject negative lengths
69
+
70
+2017-08-05  Stuart Caie <kyzer@cabextract.org.uk>
71
+
72
+	* cabd_read_string(): add missing error check on result of read().
73
+	If an mspack_system implementation returns an error, it's interpreted
74
+	as a huge positive integer, which leads to reading past the end of the
75
+	stack-based buffer. Thanks to Sebastian Andrzej Siewior for explaining
76
+	the problem. This issue was raised by ClamAV as CVE-2017-11423
77
+
78
+2016-04-20  Stuart Caie <kyzer@cabextract.org.uk>
79
+
80
+	* configure.ac: change my email address to kyzer@cabextract.org.uk
81
+
82
+2015-05-10  Stuart Caie <kyzer@4u.net>
83
+
84
+	* cabd_read_string(): correct rejection of empty strings. Thanks to
85
+	Hanno Böck for finding the issue and providing a sample file.
86
+
87
+2015-05-10  Stuart Caie <kyzer@4u.net>
88
+
89
+	* Makefile.am: Add subdir-objects option as suggested by autoreconf.
90
+
91
+	* configure.ac: Add AM_PROG_AR as suggested by autoreconf.
92
+
93
+2015-01-29  Stuart Caie <kyzer@4u.net>
94
+
95
+	* system.h: if C99 inttypes.h exists, use its PRI{d,u}{32,64} macros.
96
+	Thanks to Johnathan Kollasch for the suggestion.
97
+
1 98
 2015-01-18  Stuart Caie <kyzer@4u.net>
2 99
 
3 100
 	* lzxd_decompress(): the byte-alignment code for reading uncompressed
... ...
@@ -37,7 +134,7 @@
37 37
 	null and thus segfault. Thanks to Jakub Wilk again.
38 38
 
39 39
 	* cabd_read_string: reject empty strings. They are not found in any
40

                
40
+	valid CAB files. Thanks to Hanno Böck for sending me an example.
41 41
 
42 42
 2015-01-05  Stuart Caie <kyzer@4u.net>
43 43
 
... ...
@@ -92,9 +189,9 @@
92 92
 
93 93
 2011-11-23  Stuart Caie <kyzer@4u.net>
94 94
 
95
-	* chmd_fast_find(): add a simple check against infinite PGML
95
+	* chmd_fast_find(): add a simple check against infinite PMGL
96 96
 	loops. Thanks to Sergei Trofimovich for finding sample files.
97
-	Multi-step PGML or PGMI infinite loops remain possible.
97
+	Multi-step PMGL/PMGI infinite loops remain possible.
98 98
 
99 99
 2011-06-17  Stuart Caie <kyzer@4u.net>
100 100
 
... ...
@@ -213,7 +310,7 @@
213 213
 2011-04-26:  Stuart Caie <kyzer@4u.net>
214 214
 
215 215
 	* test/chminfo.c: more sanity checks for corrupted CHM files where
216
-	entries go past the end of a PGML/PGMI chunk, thanks to
216
+	entries go past the end of a PMGL/PMGI chunk, thanks to
217 217
 	Sergei Trofimovich for sending me examples and analysis.
218 218
 
219 219
 2011-04-25:  Stuart Caie <kyzer@4u.net>
... ...
@@ -459,7 +556,7 @@
459 459
 2005-03-22:  Stuart Caie   <kyzer@4u.net>
460 460
 
461 461
 	* system.h: now undefs "read", as the latest glibc defines read()
462

                
462
+	as a macro which messes everything up. Thanks to Ville Skyttä for
463 463
 	the update.
464 464
 
465 465
 2005-03-14:  Stuart Caie   <kyzer@4u.net>
... ...
@@ -1,8 +1,8 @@
1 1
 Installation Instructions
2 2
 *************************
3 3
 
4
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
5
-Inc.
4
+   Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
5
+Foundation, Inc.
6 6
 
7 7
    Copying and distribution of this file, with or without modification,
8 8
 are permitted in any medium without royalty provided the copyright
... ...
@@ -12,97 +12,96 @@ without warranty of any kind.
12 12
 Basic Installation
13 13
 ==================
14 14
 
15
-   Briefly, the shell command `./configure && make && make install'
15
+   Briefly, the shell command './configure && make && make install'
16 16
 should configure, build, and install this package.  The following
17
-more-detailed instructions are generic; see the `README' file for
17
+more-detailed instructions are generic; see the 'README' file for
18 18
 instructions specific to this package.  Some packages provide this
19
-`INSTALL' file but do not implement all of the features documented
19
+'INSTALL' file but do not implement all of the features documented
20 20
 below.  The lack of an optional feature in a given package is not
21 21
 necessarily a bug.  More recommendations for GNU packages can be found
22 22
 in *note Makefile Conventions: (standards)Makefile Conventions.
23 23
 
24
-   The `configure' shell script attempts to guess correct values for
24
+   The 'configure' shell script attempts to guess correct values for
25 25
 various system-dependent variables used during compilation.  It uses
26
-those values to create a `Makefile' in each directory of the package.
27
-It may also create one or more `.h' files containing system-dependent
28
-definitions.  Finally, it creates a shell script `config.status' that
26
+those values to create a 'Makefile' in each directory of the package.
27
+It may also create one or more '.h' files containing system-dependent
28
+definitions.  Finally, it creates a shell script 'config.status' that
29 29
 you can run in the future to recreate the current configuration, and a
30
-file `config.log' containing compiler output (useful mainly for
31
-debugging `configure').
30
+file 'config.log' containing compiler output (useful mainly for
31
+debugging 'configure').
32 32
 
33
-   It can also use an optional file (typically called `config.cache'
34
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
35
-the results of its tests to speed up reconfiguring.  Caching is
36
-disabled by default to prevent problems with accidental use of stale
37
-cache files.
33
+   It can also use an optional file (typically called 'config.cache' and
34
+enabled with '--cache-file=config.cache' or simply '-C') that saves the
35
+results of its tests to speed up reconfiguring.  Caching is disabled by
36
+default to prevent problems with accidental use of stale cache files.
38 37
 
39 38
    If you need to do unusual things to compile the package, please try
40
-to figure out how `configure' could check whether to do them, and mail
41
-diffs or instructions to the address given in the `README' so they can
39
+to figure out how 'configure' could check whether to do them, and mail
40
+diffs or instructions to the address given in the 'README' so they can
42 41
 be considered for the next release.  If you are using the cache, and at
43
-some point `config.cache' contains results you don't want to keep, you
42
+some point 'config.cache' contains results you don't want to keep, you
44 43
 may remove or edit it.
45 44
 
46
-   The file `configure.ac' (or `configure.in') is used to create
47
-`configure' by a program called `autoconf'.  You need `configure.ac' if
48
-you want to change it or regenerate `configure' using a newer version
49
-of `autoconf'.
45
+   The file 'configure.ac' (or 'configure.in') is used to create
46
+'configure' by a program called 'autoconf'.  You need 'configure.ac' if
47
+you want to change it or regenerate 'configure' using a newer version of
48
+'autoconf'.
50 49
 
51 50
    The simplest way to compile this package is:
52 51
 
53
-  1. `cd' to the directory containing the package's source code and type
54
-     `./configure' to configure the package for your system.
52
+  1. 'cd' to the directory containing the package's source code and type
53
+     './configure' to configure the package for your system.
55 54
 
56
-     Running `configure' might take a while.  While running, it prints
55
+     Running 'configure' might take a while.  While running, it prints
57 56
      some messages telling which features it is checking for.
58 57
 
59
-  2. Type `make' to compile the package.
58
+  2. Type 'make' to compile the package.
60 59
 
61
-  3. Optionally, type `make check' to run any self-tests that come with
60
+  3. Optionally, type 'make check' to run any self-tests that come with
62 61
      the package, generally using the just-built uninstalled binaries.
63 62
 
64
-  4. Type `make install' to install the programs and any data files and
63
+  4. Type 'make install' to install the programs and any data files and
65 64
      documentation.  When installing into a prefix owned by root, it is
66 65
      recommended that the package be configured and built as a regular
67
-     user, and only the `make install' phase executed with root
66
+     user, and only the 'make install' phase executed with root
68 67
      privileges.
69 68
 
70
-  5. Optionally, type `make installcheck' to repeat any self-tests, but
69
+  5. Optionally, type 'make installcheck' to repeat any self-tests, but
71 70
      this time using the binaries in their final installed location.
72 71
      This target does not install anything.  Running this target as a
73
-     regular user, particularly if the prior `make install' required
72
+     regular user, particularly if the prior 'make install' required
74 73
      root privileges, verifies that the installation completed
75 74
      correctly.
76 75
 
77 76
   6. You can remove the program binaries and object files from the
78
-     source code directory by typing `make clean'.  To also remove the
79
-     files that `configure' created (so you can compile the package for
80
-     a different kind of computer), type `make distclean'.  There is
81
-     also a `make maintainer-clean' target, but that is intended mainly
77
+     source code directory by typing 'make clean'.  To also remove the
78
+     files that 'configure' created (so you can compile the package for
79
+     a different kind of computer), type 'make distclean'.  There is
80
+     also a 'make maintainer-clean' target, but that is intended mainly
82 81
      for the package's developers.  If you use it, you may have to get
83 82
      all sorts of other programs in order to regenerate files that came
84 83
      with the distribution.
85 84
 
86
-  7. Often, you can also type `make uninstall' to remove the installed
85
+  7. Often, you can also type 'make uninstall' to remove the installed
87 86
      files again.  In practice, not all packages have tested that
88 87
      uninstallation works correctly, even though it is required by the
89 88
      GNU Coding Standards.
90 89
 
91
-  8. Some packages, particularly those that use Automake, provide `make
90
+  8. Some packages, particularly those that use Automake, provide 'make
92 91
      distcheck', which can by used by developers to test that all other
93
-     targets like `make install' and `make uninstall' work correctly.
92
+     targets like 'make install' and 'make uninstall' work correctly.
94 93
      This target is generally not run by end users.
95 94
 
96 95
 Compilers and Options
97 96
 =====================
98 97
 
99 98
    Some systems require unusual options for compilation or linking that
100
-the `configure' script does not know about.  Run `./configure --help'
99
+the 'configure' script does not know about.  Run './configure --help'
101 100
 for details on some of the pertinent environment variables.
102 101
 
103
-   You can give `configure' initial values for configuration parameters
104
-by setting variables in the command line or in the environment.  Here
105
-is an example:
102
+   You can give 'configure' initial values for configuration parameters
103
+by setting variables in the command line or in the environment.  Here is
104
+an example:
106 105
 
107 106
      ./configure CC=c99 CFLAGS=-g LIBS=-lposix
108 107
 
... ...
@@ -113,21 +112,21 @@ Compiling For Multiple Architectures
113 113
 
114 114
    You can compile the package for more than one kind of computer at the
115 115
 same time, by placing the object files for each architecture in their
116
-own directory.  To do this, you can use GNU `make'.  `cd' to the
116
+own directory.  To do this, you can use GNU 'make'.  'cd' to the
117 117
 directory where you want the object files and executables to go and run
118
-the `configure' script.  `configure' automatically checks for the
119
-source code in the directory that `configure' is in and in `..'.  This
120
-is known as a "VPATH" build.
118
+the 'configure' script.  'configure' automatically checks for the source
119
+code in the directory that 'configure' is in and in '..'.  This is known
120
+as a "VPATH" build.
121 121
 
122
-   With a non-GNU `make', it is safer to compile the package for one
122
+   With a non-GNU 'make', it is safer to compile the package for one
123 123
 architecture at a time in the source code directory.  After you have
124
-installed the package for one architecture, use `make distclean' before
124
+installed the package for one architecture, use 'make distclean' before
125 125
 reconfiguring for another architecture.
126 126
 
127 127
    On MacOS X 10.5 and later systems, you can create libraries and
128 128
 executables that work on multiple system types--known as "fat" or
129
-"universal" binaries--by specifying multiple `-arch' options to the
130
-compiler but only a single `-arch' option to the preprocessor.  Like
129
+"universal" binaries--by specifying multiple '-arch' options to the
130
+compiler but only a single '-arch' option to the preprocessor.  Like
131 131
 this:
132 132
 
133 133
      ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
... ...
@@ -136,105 +135,104 @@ this:
136 136
 
137 137
    This is not guaranteed to produce working output in all cases, you
138 138
 may have to build one architecture at a time and combine the results
139
-using the `lipo' tool if you have problems.
139
+using the 'lipo' tool if you have problems.
140 140
 
141 141
 Installation Names
142 142
 ==================
143 143
 
144
-   By default, `make install' installs the package's commands under
145
-`/usr/local/bin', include files under `/usr/local/include', etc.  You
146
-can specify an installation prefix other than `/usr/local' by giving
147
-`configure' the option `--prefix=PREFIX', where PREFIX must be an
144
+   By default, 'make install' installs the package's commands under
145
+'/usr/local/bin', include files under '/usr/local/include', etc.  You
146
+can specify an installation prefix other than '/usr/local' by giving
147
+'configure' the option '--prefix=PREFIX', where PREFIX must be an
148 148
 absolute file name.
149 149
 
150 150
    You can specify separate installation prefixes for
151 151
 architecture-specific files and architecture-independent files.  If you
152
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
152
+pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
153 153
 PREFIX as the prefix for installing programs and libraries.
154 154
 Documentation and other data files still use the regular prefix.
155 155
 
156 156
    In addition, if you use an unusual directory layout you can give
157
-options like `--bindir=DIR' to specify different values for particular
158
-kinds of files.  Run `configure --help' for a list of the directories
159
-you can set and what kinds of files go in them.  In general, the
160
-default for these options is expressed in terms of `${prefix}', so that
161
-specifying just `--prefix' will affect all of the other directory
157
+options like '--bindir=DIR' to specify different values for particular
158
+kinds of files.  Run 'configure --help' for a list of the directories
159
+you can set and what kinds of files go in them.  In general, the default
160
+for these options is expressed in terms of '${prefix}', so that
161
+specifying just '--prefix' will affect all of the other directory
162 162
 specifications that were not explicitly provided.
163 163
 
164 164
    The most portable way to affect installation locations is to pass the
165
-correct locations to `configure'; however, many packages provide one or
165
+correct locations to 'configure'; however, many packages provide one or
166 166
 both of the following shortcuts of passing variable assignments to the
167
-`make install' command line to change installation locations without
167
+'make install' command line to change installation locations without
168 168
 having to reconfigure or recompile.
169 169
 
170 170
    The first method involves providing an override variable for each
171
-affected directory.  For example, `make install
171
+affected directory.  For example, 'make install
172 172
 prefix=/alternate/directory' will choose an alternate location for all
173 173
 directory configuration variables that were expressed in terms of
174
-`${prefix}'.  Any directories that were specified during `configure',
175
-but not in terms of `${prefix}', must each be overridden at install
176
-time for the entire installation to be relocated.  The approach of
177
-makefile variable overrides for each directory variable is required by
178
-the GNU Coding Standards, and ideally causes no recompilation.
179
-However, some platforms have known limitations with the semantics of
180
-shared libraries that end up requiring recompilation when using this
181
-method, particularly noticeable in packages that use GNU Libtool.
182
-
183
-   The second method involves providing the `DESTDIR' variable.  For
184
-example, `make install DESTDIR=/alternate/directory' will prepend
185
-`/alternate/directory' before all installation names.  The approach of
186
-`DESTDIR' overrides is not required by the GNU Coding Standards, and
174
+'${prefix}'.  Any directories that were specified during 'configure',
175
+but not in terms of '${prefix}', must each be overridden at install time
176
+for the entire installation to be relocated.  The approach of makefile
177
+variable overrides for each directory variable is required by the GNU
178
+Coding Standards, and ideally causes no recompilation.  However, some
179
+platforms have known limitations with the semantics of shared libraries
180
+that end up requiring recompilation when using this method, particularly
181
+noticeable in packages that use GNU Libtool.
182
+
183
+   The second method involves providing the 'DESTDIR' variable.  For
184
+example, 'make install DESTDIR=/alternate/directory' will prepend
185
+'/alternate/directory' before all installation names.  The approach of
186
+'DESTDIR' overrides is not required by the GNU Coding Standards, and
187 187
 does not work on platforms that have drive letters.  On the other hand,
188 188
 it does better at avoiding recompilation issues, and works well even
189
-when some directory options were not specified in terms of `${prefix}'
190
-at `configure' time.
189
+when some directory options were not specified in terms of '${prefix}'
190
+at 'configure' time.
191 191
 
192 192
 Optional Features
193 193
 =================
194 194
 
195 195
    If the package supports it, you can cause programs to be installed
196
-with an extra prefix or suffix on their names by giving `configure' the
197
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
198
-
199
-   Some packages pay attention to `--enable-FEATURE' options to
200
-`configure', where FEATURE indicates an optional part of the package.
201
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
202
-is something like `gnu-as' or `x' (for the X Window System).  The
203
-`README' should mention any `--enable-' and `--with-' options that the
196
+with an extra prefix or suffix on their names by giving 'configure' the
197
+option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
198
+
199
+   Some packages pay attention to '--enable-FEATURE' options to
200
+'configure', where FEATURE indicates an optional part of the package.
201
+They may also pay attention to '--with-PACKAGE' options, where PACKAGE
202
+is something like 'gnu-as' or 'x' (for the X Window System).  The
203
+'README' should mention any '--enable-' and '--with-' options that the
204 204
 package recognizes.
205 205
 
206
-   For packages that use the X Window System, `configure' can usually
206
+   For packages that use the X Window System, 'configure' can usually
207 207
 find the X include and library files automatically, but if it doesn't,
208
-you can use the `configure' options `--x-includes=DIR' and
209
-`--x-libraries=DIR' to specify their locations.
208
+you can use the 'configure' options '--x-includes=DIR' and
209
+'--x-libraries=DIR' to specify their locations.
210 210
 
211 211
    Some packages offer the ability to configure how verbose the
212
-execution of `make' will be.  For these packages, running `./configure
212
+execution of 'make' will be.  For these packages, running './configure
213 213
 --enable-silent-rules' sets the default to minimal output, which can be
214
-overridden with `make V=1'; while running `./configure
214
+overridden with 'make V=1'; while running './configure
215 215
 --disable-silent-rules' sets the default to verbose, which can be
216
-overridden with `make V=0'.
216
+overridden with 'make V=0'.
217 217
 
218 218
 Particular systems
219 219
 ==================
220 220
 
221
-   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
222
-CC is not installed, it is recommended to use the following options in
221
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU CC
222
+is not installed, it is recommended to use the following options in
223 223
 order to use an ANSI C compiler:
224 224
 
225 225
      ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
226 226
 
227 227
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
228 228
 
229
-   HP-UX `make' updates targets which have the same time stamps as
230
-their prerequisites, which makes it generally unusable when shipped
231
-generated files such as `configure' are involved.  Use GNU `make'
232
-instead.
229
+   HP-UX 'make' updates targets which have the same time stamps as their
230
+prerequisites, which makes it generally unusable when shipped generated
231
+files such as 'configure' are involved.  Use GNU 'make' instead.
233 232
 
234 233
    On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
235
-parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
236
-a workaround.  If GNU CC is not installed, it is therefore recommended
237
-to try
234
+parse its '<wchar.h>' header file.  The option '-nodtk' can be used as a
235
+workaround.  If GNU CC is not installed, it is therefore recommended to
236
+try
238 237
 
239 238
      ./configure CC="cc"
240 239
 
... ...
@@ -242,26 +240,26 @@ and if that doesn't work, try
242 242
 
243 243
      ./configure CC="cc -nodtk"
244 244
 
245
-   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
245
+   On Solaris, don't put '/usr/ucb' early in your 'PATH'.  This
246 246
 directory contains several dysfunctional programs; working variants of
247
-these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
248
-in your `PATH', put it _after_ `/usr/bin'.
247
+these programs are available in '/usr/bin'.  So, if you need '/usr/ucb'
248
+in your 'PATH', put it _after_ '/usr/bin'.
249 249
 
250
-   On Haiku, software installed for all users goes in `/boot/common',
251
-not `/usr/local'.  It is recommended to use the following options:
250
+   On Haiku, software installed for all users goes in '/boot/common',
251
+not '/usr/local'.  It is recommended to use the following options:
252 252
 
253 253
      ./configure --prefix=/boot/common
254 254
 
255 255
 Specifying the System Type
256 256
 ==========================
257 257
 
258
-   There may be some features `configure' cannot figure out
258
+   There may be some features 'configure' cannot figure out
259 259
 automatically, but needs to determine by the type of machine the package
260 260
 will run on.  Usually, assuming the package is built to be run on the
261
-_same_ architectures, `configure' can figure that out, but if it prints
261
+_same_ architectures, 'configure' can figure that out, but if it prints
262 262
 a message saying it cannot guess the machine type, give it the
263
-`--build=TYPE' option.  TYPE can either be a short name for the system
264
-type, such as `sun4', or a canonical name which has the form:
263
+'--build=TYPE' option.  TYPE can either be a short name for the system
264
+type, such as 'sun4', or a canonical name which has the form:
265 265
 
266 266
      CPU-COMPANY-SYSTEM
267 267
 
... ...
@@ -270,101 +268,101 @@ where SYSTEM can have one of these forms:
270 270
      OS
271 271
      KERNEL-OS
272 272
 
273
-   See the file `config.sub' for the possible values of each field.  If
274
-`config.sub' isn't included in this package, then this package doesn't
273
+   See the file 'config.sub' for the possible values of each field.  If
274
+'config.sub' isn't included in this package, then this package doesn't
275 275
 need to know the machine type.
276 276
 
277 277
    If you are _building_ compiler tools for cross-compiling, you should
278
-use the option `--target=TYPE' to select the type of system they will
278
+use the option '--target=TYPE' to select the type of system they will
279 279
 produce code for.
280 280
 
281 281
    If you want to _use_ a cross compiler, that generates code for a
282 282
 platform different from the build platform, you should specify the
283 283
 "host" platform (i.e., that on which the generated programs will
284
-eventually be run) with `--host=TYPE'.
284
+eventually be run) with '--host=TYPE'.
285 285
 
286 286
 Sharing Defaults
287 287
 ================
288 288
 
289
-   If you want to set default values for `configure' scripts to share,
290
-you can create a site shell script called `config.site' that gives
291
-default values for variables like `CC', `cache_file', and `prefix'.
292
-`configure' looks for `PREFIX/share/config.site' if it exists, then
293
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
294
-`CONFIG_SITE' environment variable to the location of the site script.
295
-A warning: not all `configure' scripts look for a site script.
289
+   If you want to set default values for 'configure' scripts to share,
290
+you can create a site shell script called 'config.site' that gives
291
+default values for variables like 'CC', 'cache_file', and 'prefix'.
292
+'configure' looks for 'PREFIX/share/config.site' if it exists, then
293
+'PREFIX/etc/config.site' if it exists.  Or, you can set the
294
+'CONFIG_SITE' environment variable to the location of the site script.
295
+A warning: not all 'configure' scripts look for a site script.
296 296
 
297 297
 Defining Variables
298 298
 ==================
299 299
 
300 300
    Variables not defined in a site shell script can be set in the
301
-environment passed to `configure'.  However, some packages may run
301
+environment passed to 'configure'.  However, some packages may run
302 302
 configure again during the build, and the customized values of these
303 303
 variables may be lost.  In order to avoid this problem, you should set
304
-them in the `configure' command line, using `VAR=value'.  For example:
304
+them in the 'configure' command line, using 'VAR=value'.  For example:
305 305
 
306 306
      ./configure CC=/usr/local2/bin/gcc
307 307
 
308
-causes the specified `gcc' to be used as the C compiler (unless it is
308
+causes the specified 'gcc' to be used as the C compiler (unless it is
309 309
 overridden in the site shell script).
310 310
 
311
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
312
-an Autoconf limitation.  Until the limitation is lifted, you can use
313
-this workaround:
311
+Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
312
+Autoconf limitation.  Until the limitation is lifted, you can use this
313
+workaround:
314 314
 
315 315
      CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
316 316
 
317
-`configure' Invocation
317
+'configure' Invocation
318 318
 ======================
319 319
 
320
-   `configure' recognizes the following options to control how it
320
+   'configure' recognizes the following options to control how it
321 321
 operates.
322 322
 
323
-`--help'
324
-`-h'
325
-     Print a summary of all of the options to `configure', and exit.
323
+'--help'
324
+'-h'
325
+     Print a summary of all of the options to 'configure', and exit.
326 326
 
327
-`--help=short'
328
-`--help=recursive'
327
+'--help=short'
328
+'--help=recursive'
329 329
      Print a summary of the options unique to this package's
330
-     `configure', and exit.  The `short' variant lists options used
331
-     only in the top level, while the `recursive' variant lists options
332
-     also present in any nested packages.
330
+     'configure', and exit.  The 'short' variant lists options used only
331
+     in the top level, while the 'recursive' variant lists options also
332
+     present in any nested packages.
333 333
 
334
-`--version'
335
-`-V'
336
-     Print the version of Autoconf used to generate the `configure'
334
+'--version'
335
+'-V'
336
+     Print the version of Autoconf used to generate the 'configure'
337 337
      script, and exit.
338 338
 
339
-`--cache-file=FILE'
339
+'--cache-file=FILE'
340 340
      Enable the cache: use and save the results of the tests in FILE,
341
-     traditionally `config.cache'.  FILE defaults to `/dev/null' to
341
+     traditionally 'config.cache'.  FILE defaults to '/dev/null' to
342 342
      disable caching.
343 343
 
344
-`--config-cache'
345
-`-C'
346
-     Alias for `--cache-file=config.cache'.
344
+'--config-cache'
345
+'-C'
346
+     Alias for '--cache-file=config.cache'.
347 347
 
348
-`--quiet'
349
-`--silent'
350
-`-q'
348
+'--quiet'
349
+'--silent'
350
+'-q'
351 351
      Do not print messages saying which checks are being made.  To
352
-     suppress all normal output, redirect it to `/dev/null' (any error
352
+     suppress all normal output, redirect it to '/dev/null' (any error
353 353
      messages will still be shown).
354 354
 
355
-`--srcdir=DIR'
355
+'--srcdir=DIR'
356 356
      Look for the package's source code in directory DIR.  Usually
357
-     `configure' can determine that directory automatically.
357
+     'configure' can determine that directory automatically.
358 358
 
359
-`--prefix=DIR'
360
-     Use DIR as the installation prefix.  *note Installation Names::
361
-     for more details, including other options available for fine-tuning
362
-     the installation locations.
359
+'--prefix=DIR'
360
+     Use DIR as the installation prefix.  *note Installation Names:: for
361
+     more details, including other options available for fine-tuning the
362
+     installation locations.
363 363
 
364
-`--no-create'
365
-`-n'
364
+'--no-create'
365
+'-n'
366 366
      Run the configure checks, but stop before creating any output
367 367
      files.
368 368
 
369
-`configure' also accepts some other, not widely useful, options.  Run
370
-`configure --help' for more details.
369
+'configure' also accepts some other, not widely useful, options.  Run
370
+'configure --help' for more details.
... ...
@@ -1,5 +1,7 @@
1
+AUTOMAKE_OPTIONS =	subdir-objects
2
+EXTRA_DIST =		$(srcdir)/debian/* $(srcdir)/doc/* $(srcdir)/test/test_files/*/*
1 3
 pkgconfigdir =		$(libdir)/pkgconfig
2
-pkgconfig_DATA = 	libclammspack.pc
4
+pkgconfig_DATA = 	libmspack.pc
3 5
 
4 6
 dist-hook:
5 7
 	-rm -f $(distdir)/*.la
... ...
@@ -11,16 +13,20 @@ if DEBUG
11 11
 AM_CFLAGS +=		-DDEBUG
12 12
 endif
13 13
 if GCC
14
-AM_CFLAGS +=		-Wall -Wextra -Wno-unused-parameter
14
+AM_CFLAGS +=		-Wall -Wextra -Wno-unused-parameter -Wno-unused-result
15 15
 endif
16
-AM_CPPFLAGS =		-I$(top_srcdir)/mspack #-I$(top_srcdir)/test 
16
+AM_CPPFLAGS =		-I$(top_srcdir)/mspack -I$(top_srcdir)/test 
17 17
 
18
-lib_LTLIBRARIES =	libclammspack.la
19
-#include_HEADERS =	mspack/mspack.h
18
+bin_PROGRAMS = 		src/cabrip src/chmextract src/msexpand src/oabextract
19
+include_HEADERS =	mspack/mspack.h
20
+lib_LTLIBRARIES =	libmspack.la
20 21
 
21 22
 noinst_LTLIBRARIES =	libmscabd.la libmschmd.la
23
+noinst_PROGRAMS =	examples/cabd_memory examples/multifh test/cabd_md5 \
24
+			test/cabd_test test/chmd_find test/chmd_md5 \
25
+			test/chmd_order test/chmd_test test/chminfo test/kwajd_test
22 26
 
23
-libclammspack_la_SOURCES =	mspack/mspack.h \
27
+libmspack_la_SOURCES =	mspack/mspack.h \
24 28
 			mspack/system.h mspack/system.c \
25 29
 			mspack/cab.h mspack/cabc.c mspack/cabd.c \
26 30
 			mspack/chm.h mspack/chmc.c mspack/chmd.c \
... ...
@@ -36,7 +42,7 @@ libclammspack_la_SOURCES =	mspack/mspack.h \
36 36
 			mspack/lzss.h mspack/lzssd.c \
37 37
 			mspack/des.h mspack/sha.h \
38 38
 			mspack/crc32.c mspack/crc32.h
39
-libclammspack_la_LDFLAGS =	-export-symbols-regex '^mspack_' -version-info 1:0:1
39
+libmspack_la_LDFLAGS =	-export-symbols-regex '^mspack_' -version-info 1:0:1
40 40
 
41 41
 libmscabd_la_SOURCES =	mspack/mspack.h \
42 42
 			mspack/system.h mspack/system.c \
... ...
@@ -54,3 +60,40 @@ libmschmd_la_SOURCES =	mspack/mspack.h \
54 54
 			mspack/readbits.h mspack/readhuff.h
55 55
 libmschmd_la_LDFLAGS =	-export-symbols-regex '^mspack_'
56 56
 
57
+examples_cabd_memory_SOURCES =	examples/cabd_memory.c libmscabd.la
58
+examples_cabd_memory_LDADD =	libmscabd.la
59
+examples_multifh_SOURCES =	examples/multifh.c libmscabd.la
60
+examples_multifh_LDADD =	libmscabd.la
61
+
62
+src_cabrip_SOURCES =		src/cabrip.c libmspack.la
63
+src_cabrip_LDADD =		libmspack.la
64
+src_chmextract_SOURCES =	src/chmextract.c src/error.h libmspack.la
65
+src_chmextract_LDADD =		libmspack.la
66
+src_msexpand_SOURCES =		src/msexpand.c src/error.h libmspack.la
67
+src_msexpand_LDADD =		libmspack.la
68
+src_oabextract_SOURCES =	src/oabextract.c src/error.h libmspack.la
69
+src_oabextract_LDADD =		libmspack.la
70
+
71
+test_cabd_md5_SOURCES =		test/cabd_md5.c test/md5.c test/md5.h \
72
+				test/md5_fh.h test/error.h libmscabd.la
73
+test_cabd_md5_LDADD =		libmscabd.la
74
+test_cabd_test_SOURCES=		test/cabd_test.c libmscabd.la
75
+test_cabd_test_LDADD =		libmscabd.la
76
+test_chmd_find_SOURCES =	test/chmd_find.c test/error.h libmschmd.la
77
+test_chmd_find_LDADD =		libmschmd.la
78
+test_chmd_md5_SOURCES =		test/chmd_md5.c test/md5.c test/md5.h \
79
+				test/md5_fh.h test/error.h libmschmd.la
80
+test_chmd_md5_LDADD =		libmschmd.la
81
+test_chmd_order_SOURCES =	test/chmd_order.c test/md5.c test/md5.h \
82
+				test/md5_fh.h test/error.h libmschmd.la
83
+test_chmd_order_LDADD =		libmschmd.la
84
+test_chmd_test_SOURCES =	test/chmd_test.c libmschmd.la
85
+test_chmd_test_LDADD =		libmschmd.la
86
+test_chmd_test_DEPENDENCIES = 	test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm
87
+test_chminfo_SOURCES =		test/chminfo.c libmschmd.la
88
+test_chminfo_LDADD =		libmschmd.la
89
+test_kwajd_test_SOURCES =	test/kwajd_test.c libmspack.la
90
+test_kwajd_test_LDADD = 	libmspack.la
91
+
92
+test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm: test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm.LZXC-is-lzxc
93
+	sed s/lzxc/LZXC/ $< >$@
57 94
new file mode 100644
... ...
@@ -0,0 +1,1362 @@
0
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
1
+# @configure_input@
2
+
3
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
4
+
5
+# This Makefile.in is free software; the Free Software Foundation
6
+# gives unlimited permission to copy and/or distribute it,
7
+# with or without modifications, as long as this notice is preserved.
8
+
9
+# This program is distributed in the hope that it will be useful,
10
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
+# PARTICULAR PURPOSE.
13
+
14
+@SET_MAKE@
15
+
16
+
17
+
18
+
19
+VPATH = @srcdir@
20
+am__is_gnu_make = { \
21
+  if test -z '$(MAKELEVEL)'; then \
22
+    false; \
23
+  elif test -n '$(MAKE_HOST)'; then \
24
+    true; \
25
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
26
+    true; \
27
+  else \
28
+    false; \
29
+  fi; \
30
+}
31
+am__make_running_with_option = \
32
+  case $${target_option-} in \
33
+      ?) ;; \
34
+      *) echo "am__make_running_with_option: internal error: invalid" \
35
+              "target option '$${target_option-}' specified" >&2; \
36
+         exit 1;; \
37
+  esac; \
38
+  has_opt=no; \
39
+  sane_makeflags=$$MAKEFLAGS; \
40
+  if $(am__is_gnu_make); then \
41
+    sane_makeflags=$$MFLAGS; \
42
+  else \
43
+    case $$MAKEFLAGS in \
44
+      *\\[\ \	]*) \
45
+        bs=\\; \
46
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
47
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
48
+    esac; \
49
+  fi; \
50
+  skip_next=no; \
51
+  strip_trailopt () \
52
+  { \
53
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
54
+  }; \
55
+  for flg in $$sane_makeflags; do \
56
+    test $$skip_next = yes && { skip_next=no; continue; }; \
57
+    case $$flg in \
58
+      *=*|--*) continue;; \
59
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
60
+      -*I?*) strip_trailopt 'I';; \
61
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
62
+      -*O?*) strip_trailopt 'O';; \
63
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
64
+      -*l?*) strip_trailopt 'l';; \
65
+      -[dEDm]) skip_next=yes;; \
66
+      -[JT]) skip_next=yes;; \
67
+    esac; \
68
+    case $$flg in \
69
+      *$$target_option*) has_opt=yes; break;; \
70
+    esac; \
71
+  done; \
72
+  test $$has_opt = yes
73
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
74
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
75
+pkgdatadir = $(datadir)/@PACKAGE@
76
+pkgincludedir = $(includedir)/@PACKAGE@
77
+pkglibdir = $(libdir)/@PACKAGE@
78
+pkglibexecdir = $(libexecdir)/@PACKAGE@
79
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
80
+install_sh_DATA = $(install_sh) -c -m 644
81
+install_sh_PROGRAM = $(install_sh) -c
82
+install_sh_SCRIPT = $(install_sh) -c
83
+INSTALL_HEADER = $(INSTALL_DATA)
84
+transform = $(program_transform_name)
85
+NORMAL_INSTALL = :
86
+PRE_INSTALL = :
87
+POST_INSTALL = :
88
+NORMAL_UNINSTALL = :
89
+PRE_UNINSTALL = :
90
+POST_UNINSTALL = :
91
+build_triplet = @build@
92
+host_triplet = @host@
93
+# add "-DMSPACK_NO_DEFAULT_SYSTEM" to remove default mspack_system
94
+@DEBUG_TRUE@am__append_1 = -DDEBUG
95
+@GCC_TRUE@am__append_2 = -Wall -Wextra -Wno-unused-parameter -Wno-unused-result
96
+bin_PROGRAMS = src/cabrip$(EXEEXT) src/chmextract$(EXEEXT) \
97
+	src/msexpand$(EXEEXT) src/oabextract$(EXEEXT)
98
+noinst_PROGRAMS = examples/cabd_memory$(EXEEXT) \
99
+	examples/multifh$(EXEEXT) test/cabd_md5$(EXEEXT) \
100
+	test/cabd_test$(EXEEXT) test/chmd_find$(EXEEXT) \
101
+	test/chmd_md5$(EXEEXT) test/chmd_order$(EXEEXT) \
102
+	test/chmd_test$(EXEEXT) test/chminfo$(EXEEXT) \
103
+	test/kwajd_test$(EXEEXT)
104
+subdir = .
105
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
106
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
107
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
108
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
109
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
110
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
111
+	$(ACLOCAL_M4)
112
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
113
+	$(am__configure_deps) $(include_HEADERS) $(am__DIST_COMMON)
114
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
115
+ configure.lineno config.status.lineno
116
+mkinstalldirs = $(install_sh) -d
117
+CONFIG_HEADER = config.h
118
+CONFIG_CLEAN_FILES = doc/Makefile doc/Doxyfile libmspack.pc
119
+CONFIG_CLEAN_VPATH_FILES =
120
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
121
+am__vpath_adj = case $$p in \
122
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
123
+    *) f=$$p;; \
124
+  esac;
125
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
126
+am__install_max = 40
127
+am__nobase_strip_setup = \
128
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
129
+am__nobase_strip = \
130
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
131
+am__nobase_list = $(am__nobase_strip_setup); \
132
+  for p in $$list; do echo "$$p $$p"; done | \
133
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
134
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
135
+    if (++n[$$2] == $(am__install_max)) \
136
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
137
+    END { for (dir in files) print dir, files[dir] }'
138
+am__base_list = \
139
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
140
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
141
+am__uninstall_files_from_dir = { \
142
+  test -z "$$files" \
143
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
144
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
145
+         $(am__cd) "$$dir" && rm -f $$files; }; \
146
+  }
147
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
148
+	"$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"
149
+LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
150
+libmscabd_la_LIBADD =
151
+am__dirstamp = $(am__leading_dot)dirstamp
152
+am_libmscabd_la_OBJECTS = mspack/system.lo mspack/cabd.lo \
153
+	mspack/lzxd.lo mspack/mszipd.lo mspack/qtmd.lo
154
+libmscabd_la_OBJECTS = $(am_libmscabd_la_OBJECTS)
155
+AM_V_lt = $(am__v_lt_@AM_V@)
156
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
157
+am__v_lt_0 = --silent
158
+am__v_lt_1 = 
159
+libmscabd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
160
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
161
+	$(libmscabd_la_LDFLAGS) $(LDFLAGS) -o $@
162
+libmschmd_la_LIBADD =
163
+am_libmschmd_la_OBJECTS = mspack/system.lo mspack/chmd.lo \
164
+	mspack/lzxd.lo
165
+libmschmd_la_OBJECTS = $(am_libmschmd_la_OBJECTS)
166
+libmschmd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
167
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
168
+	$(libmschmd_la_LDFLAGS) $(LDFLAGS) -o $@
169
+libmspack_la_LIBADD =
170
+am_libmspack_la_OBJECTS = mspack/system.lo mspack/cabc.lo \
171
+	mspack/cabd.lo mspack/chmc.lo mspack/chmd.lo mspack/hlpc.lo \
172
+	mspack/hlpd.lo mspack/litc.lo mspack/litd.lo mspack/kwajc.lo \
173
+	mspack/kwajd.lo mspack/szddc.lo mspack/szddd.lo mspack/oabc.lo \
174
+	mspack/oabd.lo mspack/lzxc.lo mspack/lzxd.lo mspack/mszipc.lo \
175
+	mspack/mszipd.lo mspack/qtmd.lo mspack/lzssd.lo \
176
+	mspack/crc32.lo
177
+libmspack_la_OBJECTS = $(am_libmspack_la_OBJECTS)
178
+libmspack_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
179
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
180
+	$(libmspack_la_LDFLAGS) $(LDFLAGS) -o $@
181
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
182
+am_examples_cabd_memory_OBJECTS = examples/cabd_memory.$(OBJEXT)
183
+examples_cabd_memory_OBJECTS = $(am_examples_cabd_memory_OBJECTS)
184
+examples_cabd_memory_DEPENDENCIES = libmscabd.la
185
+am_examples_multifh_OBJECTS = examples/multifh.$(OBJEXT)
186
+examples_multifh_OBJECTS = $(am_examples_multifh_OBJECTS)
187
+examples_multifh_DEPENDENCIES = libmscabd.la
188
+am_src_cabrip_OBJECTS = src/cabrip.$(OBJEXT)
189
+src_cabrip_OBJECTS = $(am_src_cabrip_OBJECTS)
190
+src_cabrip_DEPENDENCIES = libmspack.la
191
+am_src_chmextract_OBJECTS = src/chmextract.$(OBJEXT)
192
+src_chmextract_OBJECTS = $(am_src_chmextract_OBJECTS)
193
+src_chmextract_DEPENDENCIES = libmspack.la
194
+am_src_msexpand_OBJECTS = src/msexpand.$(OBJEXT)
195
+src_msexpand_OBJECTS = $(am_src_msexpand_OBJECTS)
196
+src_msexpand_DEPENDENCIES = libmspack.la
197
+am_src_oabextract_OBJECTS = src/oabextract.$(OBJEXT)
198
+src_oabextract_OBJECTS = $(am_src_oabextract_OBJECTS)
199
+src_oabextract_DEPENDENCIES = libmspack.la
200
+am_test_cabd_md5_OBJECTS = test/cabd_md5.$(OBJEXT) test/md5.$(OBJEXT)
201
+test_cabd_md5_OBJECTS = $(am_test_cabd_md5_OBJECTS)
202
+test_cabd_md5_DEPENDENCIES = libmscabd.la
203
+am_test_cabd_test_OBJECTS = test/cabd_test.$(OBJEXT)
204
+test_cabd_test_OBJECTS = $(am_test_cabd_test_OBJECTS)
205
+test_cabd_test_DEPENDENCIES = libmscabd.la
206
+am_test_chmd_find_OBJECTS = test/chmd_find.$(OBJEXT)
207
+test_chmd_find_OBJECTS = $(am_test_chmd_find_OBJECTS)
208
+test_chmd_find_DEPENDENCIES = libmschmd.la
209
+am_test_chmd_md5_OBJECTS = test/chmd_md5.$(OBJEXT) test/md5.$(OBJEXT)
210
+test_chmd_md5_OBJECTS = $(am_test_chmd_md5_OBJECTS)
211
+test_chmd_md5_DEPENDENCIES = libmschmd.la
212
+am_test_chmd_order_OBJECTS = test/chmd_order.$(OBJEXT) \
213
+	test/md5.$(OBJEXT)
214
+test_chmd_order_OBJECTS = $(am_test_chmd_order_OBJECTS)
215
+test_chmd_order_DEPENDENCIES = libmschmd.la
216
+am_test_chmd_test_OBJECTS = test/chmd_test.$(OBJEXT)
217
+test_chmd_test_OBJECTS = $(am_test_chmd_test_OBJECTS)
218
+am_test_chminfo_OBJECTS = test/chminfo.$(OBJEXT)
219
+test_chminfo_OBJECTS = $(am_test_chminfo_OBJECTS)
220
+test_chminfo_DEPENDENCIES = libmschmd.la
221
+am_test_kwajd_test_OBJECTS = test/kwajd_test.$(OBJEXT)
222
+test_kwajd_test_OBJECTS = $(am_test_kwajd_test_OBJECTS)
223
+test_kwajd_test_DEPENDENCIES = libmspack.la
224
+AM_V_P = $(am__v_P_@AM_V@)
225
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
226
+am__v_P_0 = false
227
+am__v_P_1 = :
228
+AM_V_GEN = $(am__v_GEN_@AM_V@)
229
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
230
+am__v_GEN_0 = @echo "  GEN     " $@;
231
+am__v_GEN_1 = 
232
+AM_V_at = $(am__v_at_@AM_V@)
233
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
234
+am__v_at_0 = @
235
+am__v_at_1 = 
236
+DEFAULT_INCLUDES = -I.@am__isrc@
237
+depcomp = $(SHELL) $(top_srcdir)/depcomp
238
+am__depfiles_maybe = depfiles
239
+am__mv = mv -f
240
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
241
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
242
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
243
+	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
244
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
245
+	$(AM_CFLAGS) $(CFLAGS)
246
+AM_V_CC = $(am__v_CC_@AM_V@)
247
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
248
+am__v_CC_0 = @echo "  CC      " $@;
249
+am__v_CC_1 = 
250
+CCLD = $(CC)
251
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
252
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
253
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
254
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
255
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
256
+am__v_CCLD_0 = @echo "  CCLD    " $@;
257
+am__v_CCLD_1 = 
258
+SOURCES = $(libmscabd_la_SOURCES) $(libmschmd_la_SOURCES) \
259
+	$(libmspack_la_SOURCES) $(examples_cabd_memory_SOURCES) \
260
+	$(examples_multifh_SOURCES) $(src_cabrip_SOURCES) \
261
+	$(src_chmextract_SOURCES) $(src_msexpand_SOURCES) \
262
+	$(src_oabextract_SOURCES) $(test_cabd_md5_SOURCES) \
263
+	$(test_cabd_test_SOURCES) $(test_chmd_find_SOURCES) \
264
+	$(test_chmd_md5_SOURCES) $(test_chmd_order_SOURCES) \
265
+	$(test_chmd_test_SOURCES) $(test_chminfo_SOURCES) \
266
+	$(test_kwajd_test_SOURCES)
267
+DIST_SOURCES = $(libmscabd_la_SOURCES) $(libmschmd_la_SOURCES) \
268
+	$(libmspack_la_SOURCES) $(examples_cabd_memory_SOURCES) \
269
+	$(examples_multifh_SOURCES) $(src_cabrip_SOURCES) \
270
+	$(src_chmextract_SOURCES) $(src_msexpand_SOURCES) \
271
+	$(src_oabextract_SOURCES) $(test_cabd_md5_SOURCES) \
272
+	$(test_cabd_test_SOURCES) $(test_chmd_find_SOURCES) \
273
+	$(test_chmd_md5_SOURCES) $(test_chmd_order_SOURCES) \
274
+	$(test_chmd_test_SOURCES) $(test_chminfo_SOURCES) \
275
+	$(test_kwajd_test_SOURCES)
276
+am__can_run_installinfo = \
277
+  case $$AM_UPDATE_INFO_DIR in \
278
+    n|no|NO) false;; \
279
+    *) (install-info --version) >/dev/null 2>&1;; \
280
+  esac
281
+DATA = $(pkgconfig_DATA)
282
+HEADERS = $(include_HEADERS)
283
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
284
+	$(LISP)config.h.in
285
+# Read a list of newline-separated strings from the standard input,
286
+# and print each of them once, without duplicates.  Input order is
287
+# *not* preserved.
288
+am__uniquify_input = $(AWK) '\
289
+  BEGIN { nonempty = 0; } \
290
+  { items[$$0] = 1; nonempty = 1; } \
291
+  END { if (nonempty) { for (i in items) print i; }; } \
292
+'
293
+# Make sure the list of sources is unique.  This is necessary because,
294
+# e.g., the same source file might be shared among _SOURCES variables
295
+# for different programs/libraries.
296
+am__define_uniq_tagged_files = \
297
+  list='$(am__tagged_files)'; \
298
+  unique=`for i in $$list; do \
299
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
300
+  done | $(am__uniquify_input)`
301
+ETAGS = etags
302
+CTAGS = ctags
303
+CSCOPE = cscope
304
+AM_RECURSIVE_TARGETS = cscope
305
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
306
+	$(srcdir)/libmspack.pc.in $(top_srcdir)/doc/Doxyfile.in \
307
+	$(top_srcdir)/doc/Makefile.in AUTHORS COPYING.LIB ChangeLog \
308
+	INSTALL NEWS README TODO ar-lib compile config.guess \
309
+	config.sub depcomp install-sh ltmain.sh missing
310
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
311
+distdir = $(PACKAGE)-$(VERSION)
312
+top_distdir = $(distdir)
313
+am__remove_distdir = \
314
+  if test -d "$(distdir)"; then \
315
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
316
+      && rm -rf "$(distdir)" \
317
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
318
+  else :; fi
319
+am__post_remove_distdir = $(am__remove_distdir)
320
+DIST_ARCHIVES = $(distdir).tar.gz
321
+GZIP_ENV = --best
322
+DIST_TARGETS = dist-gzip
323
+distuninstallcheck_listfiles = find . -type f -print
324
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
325
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
326
+distcleancheck_listfiles = find . -type f -print
327
+ACLOCAL = @ACLOCAL@
328
+AMTAR = @AMTAR@
329
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
330
+AR = @AR@
331
+AUTOCONF = @AUTOCONF@
332
+AUTOHEADER = @AUTOHEADER@
333
+AUTOMAKE = @AUTOMAKE@
334
+AWK = @AWK@
335
+CC = @CC@
336
+CCDEPMODE = @CCDEPMODE@
337
+CFLAGS = @CFLAGS@
338
+CPP = @CPP@
339
+CPPFLAGS = @CPPFLAGS@
340
+CYGPATH_W = @CYGPATH_W@
341
+DEFS = @DEFS@
342
+DEPDIR = @DEPDIR@
343
+DLLTOOL = @DLLTOOL@
344
+DSYMUTIL = @DSYMUTIL@
345
+DUMPBIN = @DUMPBIN@
346
+ECHO_C = @ECHO_C@
347
+ECHO_N = @ECHO_N@
348
+ECHO_T = @ECHO_T@
349
+EGREP = @EGREP@
350
+EXEEXT = @EXEEXT@
351
+FGREP = @FGREP@
352
+GREP = @GREP@
353
+INSTALL = @INSTALL@
354
+INSTALL_DATA = @INSTALL_DATA@
355
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
356
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
357
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
358
+LD = @LD@
359
+LDFLAGS = @LDFLAGS@
360
+LIBOBJS = @LIBOBJS@
361
+LIBS = @LIBS@
362
+LIBTOOL = @LIBTOOL@
363
+LIPO = @LIPO@
364
+LN_S = @LN_S@
365
+LTLIBOBJS = @LTLIBOBJS@
366
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
367
+MAKEINFO = @MAKEINFO@
368
+MANIFEST_TOOL = @MANIFEST_TOOL@
369
+MKDIR_P = @MKDIR_P@
370
+NM = @NM@
371
+NMEDIT = @NMEDIT@
372
+OBJDUMP = @OBJDUMP@
373
+OBJEXT = @OBJEXT@
374
+OTOOL = @OTOOL@
375
+OTOOL64 = @OTOOL64@
376
+PACKAGE = @PACKAGE@
377
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
378
+PACKAGE_NAME = @PACKAGE_NAME@
379
+PACKAGE_STRING = @PACKAGE_STRING@
380
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
381
+PACKAGE_URL = @PACKAGE_URL@
382
+PACKAGE_VERSION = @PACKAGE_VERSION@
383
+PATH_SEPARATOR = @PATH_SEPARATOR@
384
+RANLIB = @RANLIB@
385
+SED = @SED@
386
+SET_MAKE = @SET_MAKE@
387
+SHELL = @SHELL@
388
+STRIP = @STRIP@
389
+VERSION = @VERSION@
390
+abs_builddir = @abs_builddir@
391
+abs_srcdir = @abs_srcdir@
392
+abs_top_builddir = @abs_top_builddir@
393
+abs_top_srcdir = @abs_top_srcdir@
394
+ac_ct_AR = @ac_ct_AR@
395
+ac_ct_CC = @ac_ct_CC@
396
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
397
+am__include = @am__include@
398
+am__leading_dot = @am__leading_dot@
399
+am__quote = @am__quote@
400
+am__tar = @am__tar@
401
+am__untar = @am__untar@
402
+bindir = @bindir@
403
+build = @build@
404
+build_alias = @build_alias@
405
+build_cpu = @build_cpu@
406
+build_os = @build_os@
407
+build_vendor = @build_vendor@
408
+builddir = @builddir@
409
+datadir = @datadir@
410
+datarootdir = @datarootdir@
411
+docdir = @docdir@
412
+dvidir = @dvidir@
413
+exec_prefix = @exec_prefix@
414
+host = @host@
415
+host_alias = @host_alias@
416
+host_cpu = @host_cpu@
417
+host_os = @host_os@
418
+host_vendor = @host_vendor@
419
+htmldir = @htmldir@
420
+includedir = @includedir@
421
+infodir = @infodir@
422
+install_sh = @install_sh@
423
+libdir = @libdir@
424
+libexecdir = @libexecdir@
425
+localedir = @localedir@
426
+localstatedir = @localstatedir@
427
+mandir = @mandir@
428
+mkdir_p = @mkdir_p@
429
+oldincludedir = @oldincludedir@
430
+pdfdir = @pdfdir@
431
+prefix = @prefix@
432
+program_transform_name = @program_transform_name@
433
+psdir = @psdir@
434
+runstatedir = @runstatedir@
435
+sbindir = @sbindir@
436
+sharedstatedir = @sharedstatedir@
437
+srcdir = @srcdir@
438
+sysconfdir = @sysconfdir@
439
+target_alias = @target_alias@
440
+top_build_prefix = @top_build_prefix@
441
+top_builddir = @top_builddir@
442
+top_srcdir = @top_srcdir@
443
+AUTOMAKE_OPTIONS = subdir-objects
444
+EXTRA_DIST = $(srcdir)/debian/* $(srcdir)/doc/* $(srcdir)/test/test_files/*/*
445
+pkgconfigdir = $(libdir)/pkgconfig
446
+pkgconfig_DATA = libmspack.pc
447
+ACLOCAL_AMFLAGS = -I m4
448
+AM_CFLAGS = $(am__append_1) $(am__append_2)
449
+AM_CPPFLAGS = -I$(top_srcdir)/mspack -I$(top_srcdir)/test 
450
+include_HEADERS = mspack/mspack.h
451
+lib_LTLIBRARIES = libmspack.la
452
+noinst_LTLIBRARIES = libmscabd.la libmschmd.la
453
+libmspack_la_SOURCES = mspack/mspack.h \
454
+			mspack/system.h mspack/system.c \
455
+			mspack/cab.h mspack/cabc.c mspack/cabd.c \
456
+			mspack/chm.h mspack/chmc.c mspack/chmd.c \
457
+			mspack/hlp.h mspack/hlpc.c mspack/hlpd.c \
458
+			mspack/lit.h mspack/litc.c mspack/litd.c \
459
+			mspack/kwaj.h mspack/kwajc.c mspack/kwajd.c \
460
+			mspack/szdd.h mspack/szddc.c mspack/szddd.c \
461
+			mspack/oab.h mspack/oabc.c mspack/oabd.c \
462
+			mspack/lzx.h mspack/lzxc.c mspack/lzxd.c \
463
+			mspack/mszip.h mspack/mszipc.c mspack/mszipd.c \
464
+			mspack/qtm.h mspack/qtmd.c \
465
+			mspack/readbits.h mspack/readhuff.h \
466
+			mspack/lzss.h mspack/lzssd.c \
467
+			mspack/des.h mspack/sha.h \
468
+			mspack/crc32.c mspack/crc32.h
469
+
470
+libmspack_la_LDFLAGS = -export-symbols-regex '^mspack_' -version-info 1:0:1
471
+libmscabd_la_SOURCES = mspack/mspack.h \
472
+			mspack/system.h mspack/system.c \
473
+			mspack/cab.h mspack/cabd.c \
474
+			mspack/lzx.h mspack/lzxd.c \
475
+			mspack/mszip.h mspack/mszipd.c \
476
+			mspack/qtm.h mspack/qtmd.c \
477
+			mspack/readbits.h mspack/readhuff.h
478
+
479
+libmscabd_la_LDFLAGS = -export-symbols-regex '^mspack_'
480
+libmschmd_la_SOURCES = mspack/mspack.h \
481
+			mspack/system.h mspack/system.c \
482
+			mspack/chm.h mspack/chmd.c \
483
+			mspack/lzx.h mspack/lzxd.c \
484
+			mspack/readbits.h mspack/readhuff.h
485
+
486
+libmschmd_la_LDFLAGS = -export-symbols-regex '^mspack_'
487
+examples_cabd_memory_SOURCES = examples/cabd_memory.c libmscabd.la
488
+examples_cabd_memory_LDADD = libmscabd.la
489
+examples_multifh_SOURCES = examples/multifh.c libmscabd.la
490
+examples_multifh_LDADD = libmscabd.la
491
+src_cabrip_SOURCES = src/cabrip.c libmspack.la
492
+src_cabrip_LDADD = libmspack.la
493
+src_chmextract_SOURCES = src/chmextract.c src/error.h libmspack.la
494
+src_chmextract_LDADD = libmspack.la
495
+src_msexpand_SOURCES = src/msexpand.c src/error.h libmspack.la
496
+src_msexpand_LDADD = libmspack.la
497
+src_oabextract_SOURCES = src/oabextract.c src/error.h libmspack.la
498
+src_oabextract_LDADD = libmspack.la
499
+test_cabd_md5_SOURCES = test/cabd_md5.c test/md5.c test/md5.h \
500
+				test/md5_fh.h test/error.h libmscabd.la
501
+
502
+test_cabd_md5_LDADD = libmscabd.la
503
+test_cabd_test_SOURCES = test/cabd_test.c libmscabd.la
504
+test_cabd_test_LDADD = libmscabd.la
505
+test_chmd_find_SOURCES = test/chmd_find.c test/error.h libmschmd.la
506
+test_chmd_find_LDADD = libmschmd.la
507
+test_chmd_md5_SOURCES = test/chmd_md5.c test/md5.c test/md5.h \
508
+				test/md5_fh.h test/error.h libmschmd.la
509
+
510
+test_chmd_md5_LDADD = libmschmd.la
511
+test_chmd_order_SOURCES = test/chmd_order.c test/md5.c test/md5.h \
512
+				test/md5_fh.h test/error.h libmschmd.la
513
+
514
+test_chmd_order_LDADD = libmschmd.la
515
+test_chmd_test_SOURCES = test/chmd_test.c libmschmd.la
516
+test_chmd_test_LDADD = libmschmd.la
517
+test_chmd_test_DEPENDENCIES = test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm
518
+test_chminfo_SOURCES = test/chminfo.c libmschmd.la
519
+test_chminfo_LDADD = libmschmd.la
520
+test_kwajd_test_SOURCES = test/kwajd_test.c libmspack.la
521
+test_kwajd_test_LDADD = libmspack.la
522
+all: config.h
523
+	$(MAKE) $(AM_MAKEFLAGS) all-am
524
+
525
+.SUFFIXES:
526
+.SUFFIXES: .c .lo .o .obj
527
+am--refresh: Makefile
528
+	@:
529
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
530
+	@for dep in $?; do \
531
+	  case '$(am__configure_deps)' in \
532
+	    *$$dep*) \
533
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
534
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
535
+		&& exit 0; \
536
+	      exit 1;; \
537
+	  esac; \
538
+	done; \
539
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
540
+	$(am__cd) $(top_srcdir) && \
541
+	  $(AUTOMAKE) --gnu Makefile
542
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
543
+	@case '$?' in \
544
+	  *config.status*) \
545
+	    echo ' $(SHELL) ./config.status'; \
546
+	    $(SHELL) ./config.status;; \
547
+	  *) \
548
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
549
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
550
+	esac;
551
+
552
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
553
+	$(SHELL) ./config.status --recheck
554
+
555
+$(top_srcdir)/configure:  $(am__configure_deps)
556
+	$(am__cd) $(srcdir) && $(AUTOCONF)
557
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
558
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
559
+$(am__aclocal_m4_deps):
560
+
561
+config.h: stamp-h1
562
+	@test -f $@ || rm -f stamp-h1
563
+	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
564
+
565
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
566
+	@rm -f stamp-h1
567
+	cd $(top_builddir) && $(SHELL) ./config.status config.h
568
+$(srcdir)/config.h.in:  $(am__configure_deps) 
569
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
570
+	rm -f stamp-h1
571
+	touch $@
572
+
573
+distclean-hdr:
574
+	-rm -f config.h stamp-h1
575
+doc/Makefile: $(top_builddir)/config.status $(top_srcdir)/doc/Makefile.in
576
+	cd $(top_builddir) && $(SHELL) ./config.status $@
577
+doc/Doxyfile: $(top_builddir)/config.status $(top_srcdir)/doc/Doxyfile.in
578
+	cd $(top_builddir) && $(SHELL) ./config.status $@
579
+libmspack.pc: $(top_builddir)/config.status $(srcdir)/libmspack.pc.in
580
+	cd $(top_builddir) && $(SHELL) ./config.status $@
581
+
582
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
583
+	@$(NORMAL_INSTALL)
584
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
585
+	list2=; for p in $$list; do \
586
+	  if test -f $$p; then \
587
+	    list2="$$list2 $$p"; \
588
+	  else :; fi; \
589
+	done; \
590
+	test -z "$$list2" || { \
591
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
592
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
593
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
594
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
595
+	}
596
+
597
+uninstall-libLTLIBRARIES:
598
+	@$(NORMAL_UNINSTALL)
599
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
600
+	for p in $$list; do \
601
+	  $(am__strip_dir) \
602
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
603
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
604
+	done
605
+
606
+clean-libLTLIBRARIES:
607
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
608
+	@list='$(lib_LTLIBRARIES)'; \
609
+	locs=`for p in $$list; do echo $$p; done | \
610
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
611
+	      sort -u`; \
612
+	test -z "$$locs" || { \
613
+	  echo rm -f $${locs}; \
614
+	  rm -f $${locs}; \
615
+	}
616
+
617
+clean-noinstLTLIBRARIES:
618
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
619
+	@list='$(noinst_LTLIBRARIES)'; \
620
+	locs=`for p in $$list; do echo $$p; done | \
621
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
622
+	      sort -u`; \
623
+	test -z "$$locs" || { \
624
+	  echo rm -f $${locs}; \
625
+	  rm -f $${locs}; \
626
+	}
627
+mspack/$(am__dirstamp):
628
+	@$(MKDIR_P) mspack
629
+	@: > mspack/$(am__dirstamp)
630
+mspack/$(DEPDIR)/$(am__dirstamp):
631
+	@$(MKDIR_P) mspack/$(DEPDIR)
632
+	@: > mspack/$(DEPDIR)/$(am__dirstamp)
633
+mspack/system.lo: mspack/$(am__dirstamp) \
634
+	mspack/$(DEPDIR)/$(am__dirstamp)
635
+mspack/cabd.lo: mspack/$(am__dirstamp) \
636
+	mspack/$(DEPDIR)/$(am__dirstamp)
637
+mspack/lzxd.lo: mspack/$(am__dirstamp) \
638
+	mspack/$(DEPDIR)/$(am__dirstamp)
639
+mspack/mszipd.lo: mspack/$(am__dirstamp) \
640
+	mspack/$(DEPDIR)/$(am__dirstamp)
641
+mspack/qtmd.lo: mspack/$(am__dirstamp) \
642
+	mspack/$(DEPDIR)/$(am__dirstamp)
643
+
644
+libmscabd.la: $(libmscabd_la_OBJECTS) $(libmscabd_la_DEPENDENCIES) $(EXTRA_libmscabd_la_DEPENDENCIES) 
645
+	$(AM_V_CCLD)$(libmscabd_la_LINK)  $(libmscabd_la_OBJECTS) $(libmscabd_la_LIBADD) $(LIBS)
646
+mspack/chmd.lo: mspack/$(am__dirstamp) \
647
+	mspack/$(DEPDIR)/$(am__dirstamp)
648
+
649
+libmschmd.la: $(libmschmd_la_OBJECTS) $(libmschmd_la_DEPENDENCIES) $(EXTRA_libmschmd_la_DEPENDENCIES) 
650
+	$(AM_V_CCLD)$(libmschmd_la_LINK)  $(libmschmd_la_OBJECTS) $(libmschmd_la_LIBADD) $(LIBS)
651
+mspack/cabc.lo: mspack/$(am__dirstamp) \
652
+	mspack/$(DEPDIR)/$(am__dirstamp)
653
+mspack/chmc.lo: mspack/$(am__dirstamp) \
654
+	mspack/$(DEPDIR)/$(am__dirstamp)
655
+mspack/hlpc.lo: mspack/$(am__dirstamp) \
656
+	mspack/$(DEPDIR)/$(am__dirstamp)
657
+mspack/hlpd.lo: mspack/$(am__dirstamp) \
658
+	mspack/$(DEPDIR)/$(am__dirstamp)
659
+mspack/litc.lo: mspack/$(am__dirstamp) \
660
+	mspack/$(DEPDIR)/$(am__dirstamp)
661
+mspack/litd.lo: mspack/$(am__dirstamp) \
662
+	mspack/$(DEPDIR)/$(am__dirstamp)
663
+mspack/kwajc.lo: mspack/$(am__dirstamp) \
664
+	mspack/$(DEPDIR)/$(am__dirstamp)
665
+mspack/kwajd.lo: mspack/$(am__dirstamp) \
666
+	mspack/$(DEPDIR)/$(am__dirstamp)
667
+mspack/szddc.lo: mspack/$(am__dirstamp) \
668
+	mspack/$(DEPDIR)/$(am__dirstamp)
669
+mspack/szddd.lo: mspack/$(am__dirstamp) \
670
+	mspack/$(DEPDIR)/$(am__dirstamp)
671
+mspack/oabc.lo: mspack/$(am__dirstamp) \
672
+	mspack/$(DEPDIR)/$(am__dirstamp)
673
+mspack/oabd.lo: mspack/$(am__dirstamp) \
674
+	mspack/$(DEPDIR)/$(am__dirstamp)
675
+mspack/lzxc.lo: mspack/$(am__dirstamp) \
676
+	mspack/$(DEPDIR)/$(am__dirstamp)
677
+mspack/mszipc.lo: mspack/$(am__dirstamp) \
678
+	mspack/$(DEPDIR)/$(am__dirstamp)
679
+mspack/lzssd.lo: mspack/$(am__dirstamp) \
680
+	mspack/$(DEPDIR)/$(am__dirstamp)
681
+mspack/crc32.lo: mspack/$(am__dirstamp) \
682
+	mspack/$(DEPDIR)/$(am__dirstamp)
683
+
684
+libmspack.la: $(libmspack_la_OBJECTS) $(libmspack_la_DEPENDENCIES) $(EXTRA_libmspack_la_DEPENDENCIES) 
685
+	$(AM_V_CCLD)$(libmspack_la_LINK) -rpath $(libdir) $(libmspack_la_OBJECTS) $(libmspack_la_LIBADD) $(LIBS)
686
+install-binPROGRAMS: $(bin_PROGRAMS)
687
+	@$(NORMAL_INSTALL)
688
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
689
+	if test -n "$$list"; then \
690
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
691
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
692
+	fi; \
693
+	for p in $$list; do echo "$$p $$p"; done | \
694
+	sed 's/$(EXEEXT)$$//' | \
695
+	while read p p1; do if test -f $$p \
696
+	 || test -f $$p1 \
697
+	  ; then echo "$$p"; echo "$$p"; else :; fi; \
698
+	done | \
699
+	sed -e 'p;s,.*/,,;n;h' \
700
+	    -e 's|.*|.|' \
701
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
702
+	sed 'N;N;N;s,\n, ,g' | \
703
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
704
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
705
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
706
+	    else { print "f", $$3 "/" $$4, $$1; } } \
707
+	  END { for (d in files) print "f", d, files[d] }' | \
708
+	while read type dir files; do \
709
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
710
+	    test -z "$$files" || { \
711
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
712
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
713
+	    } \
714
+	; done
715
+
716
+uninstall-binPROGRAMS:
717
+	@$(NORMAL_UNINSTALL)
718
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
719
+	files=`for p in $$list; do echo "$$p"; done | \
720
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
721
+	      -e 's/$$/$(EXEEXT)/' \
722
+	`; \
723
+	test -n "$$list" || exit 0; \
724
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
725
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
726
+
727
+clean-binPROGRAMS:
728
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
729
+	echo " rm -f" $$list; \
730
+	rm -f $$list || exit $$?; \
731
+	test -n "$(EXEEXT)" || exit 0; \
732
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
733
+	echo " rm -f" $$list; \
734
+	rm -f $$list
735
+
736
+clean-noinstPROGRAMS:
737
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
738
+	echo " rm -f" $$list; \
739
+	rm -f $$list || exit $$?; \
740
+	test -n "$(EXEEXT)" || exit 0; \
741
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
742
+	echo " rm -f" $$list; \
743
+	rm -f $$list
744
+examples/$(am__dirstamp):
745
+	@$(MKDIR_P) examples
746
+	@: > examples/$(am__dirstamp)
747
+examples/$(DEPDIR)/$(am__dirstamp):
748
+	@$(MKDIR_P) examples/$(DEPDIR)
749
+	@: > examples/$(DEPDIR)/$(am__dirstamp)
750
+examples/cabd_memory.$(OBJEXT): examples/$(am__dirstamp) \
751
+	examples/$(DEPDIR)/$(am__dirstamp)
752
+
753
+examples/cabd_memory$(EXEEXT): $(examples_cabd_memory_OBJECTS) $(examples_cabd_memory_DEPENDENCIES) $(EXTRA_examples_cabd_memory_DEPENDENCIES) examples/$(am__dirstamp)
754
+	@rm -f examples/cabd_memory$(EXEEXT)
755
+	$(AM_V_CCLD)$(LINK) $(examples_cabd_memory_OBJECTS) $(examples_cabd_memory_LDADD) $(LIBS)
756
+examples/multifh.$(OBJEXT): examples/$(am__dirstamp) \
757
+	examples/$(DEPDIR)/$(am__dirstamp)
758
+
759
+examples/multifh$(EXEEXT): $(examples_multifh_OBJECTS) $(examples_multifh_DEPENDENCIES) $(EXTRA_examples_multifh_DEPENDENCIES) examples/$(am__dirstamp)
760
+	@rm -f examples/multifh$(EXEEXT)
761
+	$(AM_V_CCLD)$(LINK) $(examples_multifh_OBJECTS) $(examples_multifh_LDADD) $(LIBS)
762
+src/$(am__dirstamp):
763
+	@$(MKDIR_P) src
764
+	@: > src/$(am__dirstamp)
765
+src/$(DEPDIR)/$(am__dirstamp):
766
+	@$(MKDIR_P) src/$(DEPDIR)
767
+	@: > src/$(DEPDIR)/$(am__dirstamp)
768
+src/cabrip.$(OBJEXT): src/$(am__dirstamp) \
769
+	src/$(DEPDIR)/$(am__dirstamp)
770
+
771
+src/cabrip$(EXEEXT): $(src_cabrip_OBJECTS) $(src_cabrip_DEPENDENCIES) $(EXTRA_src_cabrip_DEPENDENCIES) src/$(am__dirstamp)
772
+	@rm -f src/cabrip$(EXEEXT)
773
+	$(AM_V_CCLD)$(LINK) $(src_cabrip_OBJECTS) $(src_cabrip_LDADD) $(LIBS)
774
+src/chmextract.$(OBJEXT): src/$(am__dirstamp) \
775
+	src/$(DEPDIR)/$(am__dirstamp)
776
+
777
+src/chmextract$(EXEEXT): $(src_chmextract_OBJECTS) $(src_chmextract_DEPENDENCIES) $(EXTRA_src_chmextract_DEPENDENCIES) src/$(am__dirstamp)
778
+	@rm -f src/chmextract$(EXEEXT)
779
+	$(AM_V_CCLD)$(LINK) $(src_chmextract_OBJECTS) $(src_chmextract_LDADD) $(LIBS)
780
+src/msexpand.$(OBJEXT): src/$(am__dirstamp) \
781
+	src/$(DEPDIR)/$(am__dirstamp)
782
+
783
+src/msexpand$(EXEEXT): $(src_msexpand_OBJECTS) $(src_msexpand_DEPENDENCIES) $(EXTRA_src_msexpand_DEPENDENCIES) src/$(am__dirstamp)
784
+	@rm -f src/msexpand$(EXEEXT)
785
+	$(AM_V_CCLD)$(LINK) $(src_msexpand_OBJECTS) $(src_msexpand_LDADD) $(LIBS)
786
+src/oabextract.$(OBJEXT): src/$(am__dirstamp) \
787
+	src/$(DEPDIR)/$(am__dirstamp)
788
+
789
+src/oabextract$(EXEEXT): $(src_oabextract_OBJECTS) $(src_oabextract_DEPENDENCIES) $(EXTRA_src_oabextract_DEPENDENCIES) src/$(am__dirstamp)
790
+	@rm -f src/oabextract$(EXEEXT)
791
+	$(AM_V_CCLD)$(LINK) $(src_oabextract_OBJECTS) $(src_oabextract_LDADD) $(LIBS)
792
+test/$(am__dirstamp):
793
+	@$(MKDIR_P) test
794
+	@: > test/$(am__dirstamp)
795
+test/$(DEPDIR)/$(am__dirstamp):
796
+	@$(MKDIR_P) test/$(DEPDIR)
797
+	@: > test/$(DEPDIR)/$(am__dirstamp)
798
+test/cabd_md5.$(OBJEXT): test/$(am__dirstamp) \
799
+	test/$(DEPDIR)/$(am__dirstamp)
800
+test/md5.$(OBJEXT): test/$(am__dirstamp) \
801
+	test/$(DEPDIR)/$(am__dirstamp)
802
+
803
+test/cabd_md5$(EXEEXT): $(test_cabd_md5_OBJECTS) $(test_cabd_md5_DEPENDENCIES) $(EXTRA_test_cabd_md5_DEPENDENCIES) test/$(am__dirstamp)
804
+	@rm -f test/cabd_md5$(EXEEXT)
805
+	$(AM_V_CCLD)$(LINK) $(test_cabd_md5_OBJECTS) $(test_cabd_md5_LDADD) $(LIBS)
806
+test/cabd_test.$(OBJEXT): test/$(am__dirstamp) \
807
+	test/$(DEPDIR)/$(am__dirstamp)
808
+
809
+test/cabd_test$(EXEEXT): $(test_cabd_test_OBJECTS) $(test_cabd_test_DEPENDENCIES) $(EXTRA_test_cabd_test_DEPENDENCIES) test/$(am__dirstamp)
810
+	@rm -f test/cabd_test$(EXEEXT)
811
+	$(AM_V_CCLD)$(LINK) $(test_cabd_test_OBJECTS) $(test_cabd_test_LDADD) $(LIBS)
812
+test/chmd_find.$(OBJEXT): test/$(am__dirstamp) \
813
+	test/$(DEPDIR)/$(am__dirstamp)
814
+
815
+test/chmd_find$(EXEEXT): $(test_chmd_find_OBJECTS) $(test_chmd_find_DEPENDENCIES) $(EXTRA_test_chmd_find_DEPENDENCIES) test/$(am__dirstamp)
816
+	@rm -f test/chmd_find$(EXEEXT)
817
+	$(AM_V_CCLD)$(LINK) $(test_chmd_find_OBJECTS) $(test_chmd_find_LDADD) $(LIBS)
818
+test/chmd_md5.$(OBJEXT): test/$(am__dirstamp) \
819
+	test/$(DEPDIR)/$(am__dirstamp)
820
+
821
+test/chmd_md5$(EXEEXT): $(test_chmd_md5_OBJECTS) $(test_chmd_md5_DEPENDENCIES) $(EXTRA_test_chmd_md5_DEPENDENCIES) test/$(am__dirstamp)
822
+	@rm -f test/chmd_md5$(EXEEXT)
823
+	$(AM_V_CCLD)$(LINK) $(test_chmd_md5_OBJECTS) $(test_chmd_md5_LDADD) $(LIBS)
824
+test/chmd_order.$(OBJEXT): test/$(am__dirstamp) \
825
+	test/$(DEPDIR)/$(am__dirstamp)
826
+
827
+test/chmd_order$(EXEEXT): $(test_chmd_order_OBJECTS) $(test_chmd_order_DEPENDENCIES) $(EXTRA_test_chmd_order_DEPENDENCIES) test/$(am__dirstamp)
828
+	@rm -f test/chmd_order$(EXEEXT)
829
+	$(AM_V_CCLD)$(LINK) $(test_chmd_order_OBJECTS) $(test_chmd_order_LDADD) $(LIBS)
830
+test/chmd_test.$(OBJEXT): test/$(am__dirstamp) \
831
+	test/$(DEPDIR)/$(am__dirstamp)
832
+
833
+test/chmd_test$(EXEEXT): $(test_chmd_test_OBJECTS) $(test_chmd_test_DEPENDENCIES) $(EXTRA_test_chmd_test_DEPENDENCIES) test/$(am__dirstamp)
834
+	@rm -f test/chmd_test$(EXEEXT)
835
+	$(AM_V_CCLD)$(LINK) $(test_chmd_test_OBJECTS) $(test_chmd_test_LDADD) $(LIBS)
836
+test/chminfo.$(OBJEXT): test/$(am__dirstamp) \
837
+	test/$(DEPDIR)/$(am__dirstamp)
838
+
839
+test/chminfo$(EXEEXT): $(test_chminfo_OBJECTS) $(test_chminfo_DEPENDENCIES) $(EXTRA_test_chminfo_DEPENDENCIES) test/$(am__dirstamp)
840
+	@rm -f test/chminfo$(EXEEXT)
841
+	$(AM_V_CCLD)$(LINK) $(test_chminfo_OBJECTS) $(test_chminfo_LDADD) $(LIBS)
842
+test/kwajd_test.$(OBJEXT): test/$(am__dirstamp) \
843
+	test/$(DEPDIR)/$(am__dirstamp)
844
+
845
+test/kwajd_test$(EXEEXT): $(test_kwajd_test_OBJECTS) $(test_kwajd_test_DEPENDENCIES) $(EXTRA_test_kwajd_test_DEPENDENCIES) test/$(am__dirstamp)
846
+	@rm -f test/kwajd_test$(EXEEXT)
847
+	$(AM_V_CCLD)$(LINK) $(test_kwajd_test_OBJECTS) $(test_kwajd_test_LDADD) $(LIBS)
848
+
849
+mostlyclean-compile:
850
+	-rm -f *.$(OBJEXT)
851
+	-rm -f examples/*.$(OBJEXT)
852
+	-rm -f mspack/*.$(OBJEXT)
853
+	-rm -f mspack/*.lo
854
+	-rm -f src/*.$(OBJEXT)
855
+	-rm -f test/*.$(OBJEXT)
856
+
857
+distclean-compile:
858
+	-rm -f *.tab.c
859
+
860
+@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/cabd_memory.Po@am__quote@
861
+@AMDEP_TRUE@@am__include@ @am__quote@examples/$(DEPDIR)/multifh.Po@am__quote@
862
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/cabc.Plo@am__quote@
863
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/cabd.Plo@am__quote@
864
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/chmc.Plo@am__quote@
865
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/chmd.Plo@am__quote@
866
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/crc32.Plo@am__quote@
867
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/hlpc.Plo@am__quote@
868
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/hlpd.Plo@am__quote@
869
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/kwajc.Plo@am__quote@
870
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/kwajd.Plo@am__quote@
871
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/litc.Plo@am__quote@
872
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/litd.Plo@am__quote@
873
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/lzssd.Plo@am__quote@
874
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/lzxc.Plo@am__quote@
875
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/lzxd.Plo@am__quote@
876
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/mszipc.Plo@am__quote@
877
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/mszipd.Plo@am__quote@
878
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/oabc.Plo@am__quote@
879
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/oabd.Plo@am__quote@
880
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/qtmd.Plo@am__quote@
881
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/system.Plo@am__quote@
882
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/szddc.Plo@am__quote@
883
+@AMDEP_TRUE@@am__include@ @am__quote@mspack/$(DEPDIR)/szddd.Plo@am__quote@
884
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cabrip.Po@am__quote@
885
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/chmextract.Po@am__quote@
886
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/msexpand.Po@am__quote@
887
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/oabextract.Po@am__quote@
888
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/cabd_md5.Po@am__quote@
889
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/cabd_test.Po@am__quote@
890
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/chmd_find.Po@am__quote@
891
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/chmd_md5.Po@am__quote@
892
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/chmd_order.Po@am__quote@
893
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/chmd_test.Po@am__quote@
894
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/chminfo.Po@am__quote@
895
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/kwajd_test.Po@am__quote@
896
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/md5.Po@am__quote@
897
+
898
+.c.o:
899
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
900
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
901
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
902
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
903
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
904
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
905
+
906
+.c.obj:
907
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
908
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
909
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
910
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
911
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
912
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
913
+
914
+.c.lo:
915
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
916
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
917
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
918
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
919
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
920
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
921
+
922
+mostlyclean-libtool:
923
+	-rm -f *.lo
924
+
925
+clean-libtool:
926
+	-rm -rf .libs _libs
927
+	-rm -rf examples/.libs examples/_libs
928
+	-rm -rf mspack/.libs mspack/_libs
929
+	-rm -rf src/.libs src/_libs
930
+	-rm -rf test/.libs test/_libs
931
+
932
+distclean-libtool:
933
+	-rm -f libtool config.lt
934
+install-pkgconfigDATA: $(pkgconfig_DATA)
935
+	@$(NORMAL_INSTALL)
936
+	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
937
+	if test -n "$$list"; then \
938
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
939
+	  $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
940
+	fi; \
941
+	for p in $$list; do \
942
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
943
+	  echo "$$d$$p"; \
944
+	done | $(am__base_list) | \
945
+	while read files; do \
946
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
947
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
948
+	done
949
+
950
+uninstall-pkgconfigDATA:
951
+	@$(NORMAL_UNINSTALL)
952
+	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
953
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
954
+	dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
955
+install-includeHEADERS: $(include_HEADERS)
956
+	@$(NORMAL_INSTALL)
957
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
958
+	if test -n "$$list"; then \
959
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
960
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
961
+	fi; \
962
+	for p in $$list; do \
963
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
964
+	  echo "$$d$$p"; \
965
+	done | $(am__base_list) | \
966
+	while read files; do \
967
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
968
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
969
+	done
970
+
971
+uninstall-includeHEADERS:
972
+	@$(NORMAL_UNINSTALL)
973
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
974
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
975
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
976
+
977
+ID: $(am__tagged_files)
978
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
979
+tags: tags-am
980
+TAGS: tags
981
+
982
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
983
+	set x; \
984
+	here=`pwd`; \
985
+	$(am__define_uniq_tagged_files); \
986
+	shift; \
987
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
988
+	  test -n "$$unique" || unique=$$empty_fix; \
989
+	  if test $$# -gt 0; then \
990
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
991
+	      "$$@" $$unique; \
992
+	  else \
993
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
994
+	      $$unique; \
995
+	  fi; \
996
+	fi
997
+ctags: ctags-am
998
+
999
+CTAGS: ctags
1000
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
1001
+	$(am__define_uniq_tagged_files); \
1002
+	test -z "$(CTAGS_ARGS)$$unique" \
1003
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
1004
+	     $$unique
1005
+
1006
+GTAGS:
1007
+	here=`$(am__cd) $(top_builddir) && pwd` \
1008
+	  && $(am__cd) $(top_srcdir) \
1009
+	  && gtags -i $(GTAGS_ARGS) "$$here"
1010
+cscope: cscope.files
1011
+	test ! -s cscope.files \
1012
+	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
1013
+clean-cscope:
1014
+	-rm -f cscope.files
1015
+cscope.files: clean-cscope cscopelist
1016
+cscopelist: cscopelist-am
1017
+
1018
+cscopelist-am: $(am__tagged_files)
1019
+	list='$(am__tagged_files)'; \
1020
+	case "$(srcdir)" in \
1021
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
1022
+	  *) sdir=$(subdir)/$(srcdir) ;; \
1023
+	esac; \
1024
+	for i in $$list; do \
1025
+	  if test -f "$$i"; then \
1026
+	    echo "$(subdir)/$$i"; \
1027
+	  else \
1028
+	    echo "$$sdir/$$i"; \
1029
+	  fi; \
1030
+	done >> $(top_builddir)/cscope.files
1031
+
1032
+distclean-tags:
1033
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
1034
+	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
1035
+
1036
+distdir: $(DISTFILES)
1037
+	$(am__remove_distdir)
1038
+	test -d "$(distdir)" || mkdir "$(distdir)"
1039
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
1040
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
1041
+	list='$(DISTFILES)'; \
1042
+	  dist_files=`for file in $$list; do echo $$file; done | \
1043
+	  sed -e "s|^$$srcdirstrip/||;t" \
1044
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
1045
+	case $$dist_files in \
1046
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
1047
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
1048
+			   sort -u` ;; \
1049
+	esac; \
1050
+	for file in $$dist_files; do \
1051
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
1052
+	  if test -d $$d/$$file; then \
1053
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
1054
+	    if test -d "$(distdir)/$$file"; then \
1055
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
1056
+	    fi; \
1057
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
1058
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
1059
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
1060
+	    fi; \
1061
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
1062
+	  else \
1063
+	    test -f "$(distdir)/$$file" \
1064
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
1065
+	    || exit 1; \
1066
+	  fi; \
1067
+	done
1068
+	$(MAKE) $(AM_MAKEFLAGS) \
1069
+	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
1070
+	  dist-hook
1071
+	-test -n "$(am__skip_mode_fix)" \
1072
+	|| find "$(distdir)" -type d ! -perm -755 \
1073
+		-exec chmod u+rwx,go+rx {} \; -o \
1074
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
1075
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
1076
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
1077
+	|| chmod -R a+r "$(distdir)"
1078
+dist-gzip: distdir
1079
+	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
1080
+	$(am__post_remove_distdir)
1081
+
1082
+dist-bzip2: distdir
1083
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
1084
+	$(am__post_remove_distdir)
1085
+
1086
+dist-lzip: distdir
1087
+	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
1088
+	$(am__post_remove_distdir)
1089
+
1090
+dist-xz: distdir
1091
+	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
1092
+	$(am__post_remove_distdir)
1093
+
1094
+dist-tarZ: distdir
1095
+	@echo WARNING: "Support for distribution archives compressed with" \
1096
+		       "legacy program 'compress' is deprecated." >&2
1097
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
1098
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
1099
+	$(am__post_remove_distdir)
1100
+
1101
+dist-shar: distdir
1102
+	@echo WARNING: "Support for shar distribution archives is" \
1103
+	               "deprecated." >&2
1104
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
1105
+	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
1106
+	$(am__post_remove_distdir)
1107
+
1108
+dist-zip: distdir
1109
+	-rm -f $(distdir).zip
1110
+	zip -rq $(distdir).zip $(distdir)
1111
+	$(am__post_remove_distdir)
1112
+
1113
+dist dist-all:
1114
+	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
1115
+	$(am__post_remove_distdir)
1116
+
1117
+# This target untars the dist file and tries a VPATH configuration.  Then
1118
+# it guarantees that the distribution is self-contained by making another
1119
+# tarfile.
1120
+distcheck: dist
1121
+	case '$(DIST_ARCHIVES)' in \
1122
+	*.tar.gz*) \
1123
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
1124
+	*.tar.bz2*) \
1125
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
1126
+	*.tar.lz*) \
1127
+	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
1128
+	*.tar.xz*) \
1129
+	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
1130
+	*.tar.Z*) \
1131
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
1132
+	*.shar.gz*) \
1133
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
1134
+	*.zip*) \
1135
+	  unzip $(distdir).zip ;;\
1136
+	esac
1137
+	chmod -R a-w $(distdir)
1138
+	chmod u+w $(distdir)
1139
+	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
1140
+	chmod a-w $(distdir)
1141
+	test -d $(distdir)/_build || exit 0; \
1142
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
1143
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
1144
+	  && am__cwd=`pwd` \
1145
+	  && $(am__cd) $(distdir)/_build/sub \
1146
+	  && ../../configure \
1147
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
1148
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
1149
+	    --srcdir=../.. --prefix="$$dc_install_base" \
1150
+	  && $(MAKE) $(AM_MAKEFLAGS) \
1151
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
1152
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
1153
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
1154
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
1155
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
1156
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
1157
+	        distuninstallcheck \
1158
+	  && chmod -R a-w "$$dc_install_base" \
1159
+	  && ({ \
1160
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
1161
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
1162
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
1163
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
1164
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
1165
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
1166
+	  && rm -rf "$$dc_destdir" \
1167
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
1168
+	  && rm -rf $(DIST_ARCHIVES) \
1169
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
1170
+	  && cd "$$am__cwd" \
1171
+	  || exit 1
1172
+	$(am__post_remove_distdir)
1173
+	@(echo "$(distdir) archives ready for distribution: "; \
1174
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
1175
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
1176
+distuninstallcheck:
1177
+	@test -n '$(distuninstallcheck_dir)' || { \
1178
+	  echo 'ERROR: trying to run $@ with an empty' \
1179
+	       '$$(distuninstallcheck_dir)' >&2; \
1180
+	  exit 1; \
1181
+	}; \
1182
+	$(am__cd) '$(distuninstallcheck_dir)' || { \
1183
+	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
1184
+	  exit 1; \
1185
+	}; \
1186
+	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
1187
+	   || { echo "ERROR: files left after uninstall:" ; \
1188
+	        if test -n "$(DESTDIR)"; then \
1189
+	          echo "  (check DESTDIR support)"; \
1190
+	        fi ; \
1191
+	        $(distuninstallcheck_listfiles) ; \
1192
+	        exit 1; } >&2
1193
+distcleancheck: distclean
1194
+	@if test '$(srcdir)' = . ; then \
1195
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
1196
+	  exit 1 ; \
1197
+	fi
1198
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
1199
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
1200
+	       $(distcleancheck_listfiles) ; \
1201
+	       exit 1; } >&2
1202
+check-am: all-am
1203
+check: check-am
1204
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \
1205
+		config.h
1206
+install-binPROGRAMS: install-libLTLIBRARIES
1207
+
1208
+installdirs:
1209
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \
1210
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
1211
+	done
1212
+install: install-am
1213
+install-exec: install-exec-am
1214
+install-data: install-data-am
1215
+uninstall: uninstall-am
1216
+
1217
+install-am: all-am
1218
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
1219
+
1220
+installcheck: installcheck-am
1221
+install-strip:
1222
+	if test -z '$(STRIP)'; then \
1223
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1224
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1225
+	      install; \
1226
+	else \
1227
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1228
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1229
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
1230
+	fi
1231
+mostlyclean-generic:
1232
+
1233
+clean-generic:
1234
+
1235
+distclean-generic:
1236
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
1237
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
1238
+	-rm -f examples/$(DEPDIR)/$(am__dirstamp)
1239
+	-rm -f examples/$(am__dirstamp)
1240
+	-rm -f mspack/$(DEPDIR)/$(am__dirstamp)
1241
+	-rm -f mspack/$(am__dirstamp)
1242
+	-rm -f src/$(DEPDIR)/$(am__dirstamp)
1243
+	-rm -f src/$(am__dirstamp)
1244
+	-rm -f test/$(DEPDIR)/$(am__dirstamp)
1245
+	-rm -f test/$(am__dirstamp)
1246
+
1247
+maintainer-clean-generic:
1248
+	@echo "This command is intended for maintainers to use"
1249
+	@echo "it deletes files that may require special tools to rebuild."
1250
+clean: clean-am
1251
+
1252
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
1253
+	clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \
1254
+	mostlyclean-am
1255
+
1256
+distclean: distclean-am
1257
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
1258
+	-rm -rf examples/$(DEPDIR) mspack/$(DEPDIR) src/$(DEPDIR) test/$(DEPDIR)
1259
+	-rm -f Makefile
1260
+distclean-am: clean-am distclean-compile distclean-generic \
1261
+	distclean-hdr distclean-libtool distclean-tags
1262
+
1263
+dvi: dvi-am
1264
+
1265
+dvi-am:
1266
+
1267
+html: html-am
1268
+
1269
+html-am:
1270
+
1271
+info: info-am
1272
+
1273
+info-am:
1274
+
1275
+install-data-am: install-includeHEADERS install-pkgconfigDATA
1276
+
1277
+install-dvi: install-dvi-am
1278
+
1279
+install-dvi-am:
1280
+
1281
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
1282
+
1283
+install-html: install-html-am
1284
+
1285
+install-html-am:
1286
+
1287
+install-info: install-info-am
1288
+
1289
+install-info-am:
1290
+
1291
+install-man:
1292
+
1293
+install-pdf: install-pdf-am
1294
+
1295
+install-pdf-am:
1296
+
1297
+install-ps: install-ps-am
1298
+
1299
+install-ps-am:
1300
+
1301
+installcheck-am:
1302
+
1303
+maintainer-clean: maintainer-clean-am
1304
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
1305
+	-rm -rf $(top_srcdir)/autom4te.cache
1306
+	-rm -rf examples/$(DEPDIR) mspack/$(DEPDIR) src/$(DEPDIR) test/$(DEPDIR)
1307
+	-rm -f Makefile
1308
+maintainer-clean-am: distclean-am maintainer-clean-generic
1309
+
1310
+mostlyclean: mostlyclean-am
1311
+
1312
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
1313
+	mostlyclean-libtool
1314
+
1315
+pdf: pdf-am
1316
+
1317
+pdf-am:
1318
+
1319
+ps: ps-am
1320
+
1321
+ps-am:
1322
+
1323
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
1324
+	uninstall-libLTLIBRARIES uninstall-pkgconfigDATA
1325
+
1326
+.MAKE: all install-am install-strip
1327
+
1328
+.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
1329
+	clean-binPROGRAMS clean-cscope clean-generic \
1330
+	clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
1331
+	clean-noinstPROGRAMS cscope cscopelist-am ctags ctags-am dist \
1332
+	dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \
1333
+	dist-tarZ dist-xz dist-zip distcheck distclean \
1334
+	distclean-compile distclean-generic distclean-hdr \
1335
+	distclean-libtool distclean-tags distcleancheck distdir \
1336
+	distuninstallcheck dvi dvi-am html html-am info info-am \
1337
+	install install-am install-binPROGRAMS install-data \
1338
+	install-data-am install-dvi install-dvi-am install-exec \
1339
+	install-exec-am install-html install-html-am \
1340
+	install-includeHEADERS install-info install-info-am \
1341
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
1342
+	install-pkgconfigDATA install-ps install-ps-am install-strip \
1343
+	installcheck installcheck-am installdirs maintainer-clean \
1344
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
1345
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
1346
+	tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
1347
+	uninstall-includeHEADERS uninstall-libLTLIBRARIES \
1348
+	uninstall-pkgconfigDATA
1349
+
1350
+.PRECIOUS: Makefile
1351
+
1352
+
1353
+dist-hook:
1354
+	-rm -f $(distdir)/*.la
1355
+
1356
+test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm: test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm.LZXC-is-lzxc
1357
+	sed s/lzxc/LZXC/ $< >$@
1358
+
1359
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
1360
+# Otherwise a system limit (for SysV at least) may be exceeded.
1361
+.NOEXPORT:
... ...
@@ -1,4 +1,4 @@
1
-libmspack 0.5alpha
1
+libmspack 0.7.1alpha
2 2
 
3 3
 The purpose of libmspack is to provide compressors and decompressors,
4 4
 archivers and dearchivers for Microsoft compression formats: CAB, CHM, WIM,
... ...
@@ -24,7 +24,7 @@ DOCUMENTATION
24 24
 
25 25
 The API documentation is stored in the doc/ directory. It is generated
26 26
 automatically from mspack.h with doxygen. It is also available online at
27
-http://www.cabextract.org.uk/libmspack/doc/
27
+https://www.cabextract.org.uk/libmspack/doc/
28 28
 
29 29
 
30 30
 BUILDING / INSTALLING
... ...
@@ -56,7 +56,7 @@ source files directly in your application's build environment.
56 56
 
57 57
 LEGAL ISSUES
58 58
 
59
-The the best of my knowledge, libmspack does not infringe on any
59
+To the best of my knowledge, libmspack does not infringe on any
60 60
 compression or decompression patents. However, this is not legal
61 61
 advice, and it is recommended that you perform your own patent search.
62 62
 
... ...
@@ -78,27 +78,31 @@ provided you meet ALL of the following conditions:
78 78
 
79 79
 EXAMPLE CODE
80 80
 
81
-There are a number of useful programs in the test/ directory which
82
-exercise and demonstrate libmspack's features.
83
-
84
-cabd_c10       - Tests the CAB decompressor on the C10 collection.
85
-cabd_compare   - Compares the CAB decompressor with Microsoft's EXTRACT.EXE
86
-cabd_md5       - Prints the MD5 checksums of all files within a CAB file/set.
87
-cabd_memory    - An mspack_system implementation that reads/writes to memory.
88
-cabd_test      - Regression tests for libmspack's CAB decompression.
89
-cabrip         - Extracts any CAB files embedded in another file.
90
-chmd_compare   - Compares the CHM decompressor to Microsoft's HH.EXE
91
-chmd_find      - Fast-finds a file within a CHM file.
92
-chmd_md5       - Prints the MD5 checksums of all files within a CHM file.
93
-chmd_order     - Tests extracting files in a CHM file in four different ways.
94
-chminfo        - Prints verbose information about CHM file structures.
95
-chmx           - Extracts all files in a CHM file to disk.
96
-expand         - Extracts an SZDD or KWAJ file.
97
-msdecompile_md5- Runs Microsoft's HH.EXE -DECOMPILE via WINE.
98
-msexpand_md5   - Runs Microsoft's EXTRACT.EXE via WINE.
99
-multifh        - An mspack_system implementation that can simultaneously work
100
-                 on in-memory images, raw file descriptors, open file handles
101
-                 and regular disk files.
81
+libmspack is bundled with programs which demonstrate the library's features.
82
+
83
+examples/cabd_memory.c - an mspack_system that can read and write to memory
84
+examples/multifh.c     - an mspack_system that can simultaneously work on
85
+                         in-memory images, raw file descriptors, open file
86
+                         handles and regular disk files
87
+
88
+src/cabrip.c           - extracts any CAB files embedded in another file
89
+src/chmextract.c       - extracts all files in a CHM file to disk
90
+src/msexpand.c         - expands an SZDD or KWAJ file
91
+src/oabextract.c       - extracts an Exchange Offline Address Book (.LZX) file
92
+
93
+test/cabd_c10          - tests the CAB decompressor on the C10 collection
94
+test/cabd_compare      - compares libmspack with Microsoft's EXTRACT.EXE
95
+test/cabd_md5          - shows MD5 checksums of all files in a CAB file/set
96
+test/cabd_test.c       - regression tests for libmspack's CAB decompression
97
+test/chmd_compare      - compares libmspack with Microsoft's HH.EXE
98
+test/chmd_find.c       - fast-finds a file within a CHM file.
99
+test/chmd_md5.c        - shows MD5 checksums of all files within a CHM file
100
+test/chmd_order.c      - extracts files in a CHM file in four different ways
101
+test/chmd_test.c       - regression tests for libmspack's CHM decompression
102
+test/kwajd_test.c      - regression tests for libmspack's KWAJ decompression
103
+test/chminfo.c         - prints verbose information about CHM file structures
104
+test/msdecompile_md5   - runs Microsoft's HH.EXE -DECOMPILE via WINE
105
+test/msextract_md5     - runs Microsoft's EXTRACT.EXE via WINE
102 106
 
103 107
 Here is a simple example of usage, which will create a CAB decompressor,
104 108
 then use that to open an existing Microsoft CAB file called "example.cab",
105 109
new file mode 100644
... ...
@@ -0,0 +1,99 @@
0
+# ===========================================================================
1
+#       http://www.gnu.org/software/autoconf-archive/ax_func_mkdir.html
2
+# ===========================================================================
3
+#
4
+# SYNOPSIS
5
+#
6
+#   AX_FUNC_MKDIR
7
+#
8
+# DESCRIPTION
9
+#
10
+#   Check whether mkdir() is mkdir or _mkdir, and whether it takes one or
11
+#   two arguments.
12
+#
13
+#   This macro can define HAVE_MKDIR, HAVE__MKDIR, and MKDIR_TAKES_ONE_ARG,
14
+#   which are expected to be used as follows:
15
+#
16
+#     #if HAVE_MKDIR
17
+#     #  if MKDIR_TAKES_ONE_ARG
18
+#          /* MinGW32 */
19
+#     #    define mkdir(a, b) mkdir(a)
20
+#     #  endif
21
+#     #else
22
+#     #  if HAVE__MKDIR
23
+#          /* plain Windows 32 */
24
+#     #    define mkdir(a, b) _mkdir(a)
25
+#     #  else
26
+#     #    error "Don't know how to create a directory on this system."
27
+#     #  endif
28
+#     #endif
29
+#
30
+# LICENSE
31
+#
32
+#   Copyright (c) 2008 Alexandre Duret-Lutz <adl@gnu.org>
33
+#
34
+#   This program is free software; you can redistribute it and/or modify it
35
+#   under the terms of the GNU General Public License as published by the
36
+#   Free Software Foundation; either version 2 of the License, or (at your
37
+#   option) any later version.
38
+#
39
+#   This program is distributed in the hope that it will be useful, but
40
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
41
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
42
+#   Public License for more details.
43
+#
44
+#   You should have received a copy of the GNU General Public License along
45
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
46
+#
47
+#   As a special exception, the respective Autoconf Macro's copyright owner
48
+#   gives unlimited permission to copy, distribute and modify the configure
49
+#   scripts that are the output of Autoconf when processing the Macro. You
50
+#   need not follow the terms of the GNU General Public License when using
51
+#   or distributing such scripts, even though portions of the text of the
52
+#   Macro appear in them. The GNU General Public License (GPL) does govern
53
+#   all other use of the material that constitutes the Autoconf Macro.
54
+#
55
+#   This special exception to the GPL applies to versions of the Autoconf
56
+#   Macro released by the Autoconf Archive. When you make and distribute a
57
+#   modified version of the Autoconf Macro, you may extend this special
58
+#   exception to the GPL to apply to your modified version as well.
59
+
60
+#serial 4
61
+
62
+AU_ALIAS([AC_FUNC_MKDIR], [AX_FUNC_MKDIR])
63
+AC_DEFUN([AX_FUNC_MKDIR],
64
+[AC_CHECK_FUNCS([mkdir _mkdir])
65
+AC_CACHE_CHECK([whether mkdir takes one argument],
66
+               [ac_cv_mkdir_takes_one_arg],
67
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
68
+#include <sys/stat.h>
69
+#if HAVE_UNISTD_H
70
+#  include <unistd.h>
71
+#endif
72
+], [mkdir (".");])],
73
+[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
74
+if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
75
+  AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
76
+            [Define if mkdir takes only one argument.])
77
+fi
78
+])
79
+
80
+dnl Note:
81
+dnl =====
82
+dnl I have not implemented the following suggestion because I don't have
83
+dnl access to such a broken environment to test the macro.  So I'm just
84
+dnl appending the comments here in case you have, and want to fix
85
+dnl AX_FUNC_MKDIR that way.
86
+dnl
87
+dnl |Thomas E. Dickey (dickey@herndon4.his.com) said:
88
+dnl |  it doesn't cover the problem areas (compilers that mistreat mkdir
89
+dnl |  may prototype it in dir.h and dirent.h, for instance).
90
+dnl |
91
+dnl |Alexandre:
92
+dnl |  Would it be sufficient to check for these headers and #include
93
+dnl |  them in the AC_TRY_COMPILE block?  (and is AC_HEADER_DIRENT
94
+dnl |  suitable for this?)
95
+dnl |
96
+dnl |Thomas:
97
+dnl |  I think that might be a good starting point (with the set of recommended
98
+dnl |  ifdef's and includes for AC_HEADER_DIRENT, of course).
... ...
@@ -1,6 +1,6 @@
1
-# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
1
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
2 2
 
3
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
3
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
4 4
 
5 5
 # This file is free software; the Free Software Foundation
6 6
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -20,7 +20,7 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
20 20
 If you have problems, you may need to regenerate the build system entirely.
21 21
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
22 22
 
23
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
23
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
24 24
 #
25 25
 # This file is free software; the Free Software Foundation
26 26
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
32 32
 # generated from the m4 files accompanying Automake X.Y.
33 33
 # (This private macro should not be called outside this file.)
34 34
 AC_DEFUN([AM_AUTOMAKE_VERSION],
35
-[am__api_version='1.14'
35
+[am__api_version='1.15'
36 36
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
37 37
 dnl require some minimum version.  Point them to the right macro.
38
-m4_if([$1], [1.14.1], [],
38
+m4_if([$1], [1.15.1], [],
39 39
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
40 40
 ])
41 41
 
... ...
@@ -51,14 +51,74 @@ m4_define([_AM_AUTOCONF_VERSION], [])
51 51
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
52 52
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
53 53
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
54
-[AM_AUTOMAKE_VERSION([1.14.1])dnl
54
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
55 55
 m4_ifndef([AC_AUTOCONF_VERSION],
56 56
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
57 57
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
58 58
 
59
+# Copyright (C) 2011-2017 Free Software Foundation, Inc.
60
+#
61
+# This file is free software; the Free Software Foundation
62
+# gives unlimited permission to copy and/or distribute it,
63
+# with or without modifications, as long as this notice is preserved.
64
+
65
+# AM_PROG_AR([ACT-IF-FAIL])
66
+# -------------------------
67
+# Try to determine the archiver interface, and trigger the ar-lib wrapper
68
+# if it is needed.  If the detection of archiver interface fails, run
69
+# ACT-IF-FAIL (default is to abort configure with a proper error message).
70
+AC_DEFUN([AM_PROG_AR],
71
+[AC_BEFORE([$0], [LT_INIT])dnl
72
+AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
73
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
74
+AC_REQUIRE_AUX_FILE([ar-lib])dnl
75
+AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
76
+: ${AR=ar}
77
+
78
+AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
79
+  [AC_LANG_PUSH([C])
80
+   am_cv_ar_interface=ar
81
+   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
82
+     [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
83
+      AC_TRY_EVAL([am_ar_try])
84
+      if test "$ac_status" -eq 0; then
85
+        am_cv_ar_interface=ar
86
+      else
87
+        am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
88
+        AC_TRY_EVAL([am_ar_try])
89
+        if test "$ac_status" -eq 0; then
90
+          am_cv_ar_interface=lib
91
+        else
92
+          am_cv_ar_interface=unknown
93
+        fi
94
+      fi
95
+      rm -f conftest.lib libconftest.a
96
+     ])
97
+   AC_LANG_POP([C])])
98
+
99
+case $am_cv_ar_interface in
100
+ar)
101
+  ;;
102
+lib)
103
+  # Microsoft lib, so override with the ar-lib wrapper script.
104
+  # FIXME: It is wrong to rewrite AR.
105
+  # But if we don't then we get into trouble of one sort or another.
106
+  # A longer-term fix would be to have automake use am__AR in this case,
107
+  # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
108
+  # similar.
109
+  AR="$am_aux_dir/ar-lib $AR"
110
+  ;;
111
+unknown)
112
+  m4_default([$1],
113
+             [AC_MSG_ERROR([could not determine $AR interface])])
114
+  ;;
115
+esac
116
+AC_SUBST([AR])dnl
117
+])
118
+
59 119
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
60 120
 
61
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
121
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
62 122
 #
63 123
 # This file is free software; the Free Software Foundation
64 124
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -103,15 +163,14 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
103 103
 # configured tree to be moved without reconfiguration.
104 104
 
105 105
 AC_DEFUN([AM_AUX_DIR_EXPAND],
106
-[dnl Rely on autoconf to set up CDPATH properly.
107
-AC_PREREQ([2.50])dnl
108
-# expand $ac_aux_dir to an absolute path
109
-am_aux_dir=`cd $ac_aux_dir && pwd`
106
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
107
+# Expand $ac_aux_dir to an absolute path.
108
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
110 109
 ])
111 110
 
112 111
 # AM_CONDITIONAL                                            -*- Autoconf -*-
113 112
 
114
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
113
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
115 114
 #
116 115
 # This file is free software; the Free Software Foundation
117 116
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -142,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE(
142 142
 Usually this means the macro was only invoked conditionally.]])
143 143
 fi])])
144 144
 
145
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
145
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
146 146
 #
147 147
 # This file is free software; the Free Software Foundation
148 148
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -333,7 +392,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
333 333
 
334 334
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
335 335
 
336
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
336
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
337 337
 #
338 338
 # This file is free software; the Free Software Foundation
339 339
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -409,7 +468,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
409 409
 
410 410
 # Do all the work for Automake.                             -*- Autoconf -*-
411 411
 
412
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
412
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
413 413
 #
414 414
 # This file is free software; the Free Software Foundation
415 415
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -499,8 +558,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
499 499
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
500 500
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
501 501
 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
502
-# We need awk for the "check" target.  The system "awk" is bad on
503
-# some platforms.
502
+# We need awk for the "check" target (and possibly the TAP driver).  The
503
+# system "awk" is bad on some platforms.
504 504
 AC_REQUIRE([AC_PROG_AWK])dnl
505 505
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
506 506
 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
... ...
@@ -573,7 +632,11 @@ to "yes", and re-run configure.
573 573
 END
574 574
     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
575 575
   fi
576
-fi])
576
+fi
577
+dnl The trailing newline in this macro's definition is deliberate, for
578
+dnl backward compatibility and to allow trailing 'dnl'-style comments
579
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
580
+])
577 581
 
578 582
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
579 583
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
... ...
@@ -602,7 +665,7 @@ for _am_header in $config_headers :; do
602 602
 done
603 603
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
604 604
 
605
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
605
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
606 606
 #
607 607
 # This file is free software; the Free Software Foundation
608 608
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -613,7 +676,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
613 613
 # Define $install_sh.
614 614
 AC_DEFUN([AM_PROG_INSTALL_SH],
615 615
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
616
-if test x"${install_sh}" != xset; then
616
+if test x"${install_sh+set}" != xset; then
617 617
   case $am_aux_dir in
618 618
   *\ * | *\	*)
619 619
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
... ...
@@ -623,7 +686,7 @@ if test x"${install_sh}" != xset; then
623 623
 fi
624 624
 AC_SUBST([install_sh])])
625 625
 
626
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
626
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
627 627
 #
628 628
 # This file is free software; the Free Software Foundation
629 629
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -642,45 +705,9 @@ fi
642 642
 rmdir .tst 2>/dev/null
643 643
 AC_SUBST([am__leading_dot])])
644 644
 
645
-# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
646
-# From Jim Meyering
647
-
648
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
649
-#
650
-# This file is free software; the Free Software Foundation
651
-# gives unlimited permission to copy and/or distribute it,
652
-# with or without modifications, as long as this notice is preserved.
653
-
654
-# AM_MAINTAINER_MODE([DEFAULT-MODE])
655
-# ----------------------------------
656
-# Control maintainer-specific portions of Makefiles.
657
-# Default is to disable them, unless 'enable' is passed literally.
658
-# For symmetry, 'disable' may be passed as well.  Anyway, the user
659
-# can override the default with the --enable/--disable switch.
660
-AC_DEFUN([AM_MAINTAINER_MODE],
661
-[m4_case(m4_default([$1], [disable]),
662
-       [enable], [m4_define([am_maintainer_other], [disable])],
663
-       [disable], [m4_define([am_maintainer_other], [enable])],
664
-       [m4_define([am_maintainer_other], [enable])
665
-        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
666
-AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
667
-  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
668
-  AC_ARG_ENABLE([maintainer-mode],
669
-    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
670
-      am_maintainer_other[ make rules and dependencies not useful
671
-      (and sometimes confusing) to the casual installer])],
672
-    [USE_MAINTAINER_MODE=$enableval],
673
-    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
674
-  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
675
-  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
676
-  MAINT=$MAINTAINER_MODE_TRUE
677
-  AC_SUBST([MAINT])dnl
678
-]
679
-)
680
-
681 645
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
682 646
 
683
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
647
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
684 648
 #
685 649
 # This file is free software; the Free Software Foundation
686 650
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -730,7 +757,7 @@ rm -f confinc confmf
730 730
 
731 731
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
732 732
 
733
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
733
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
734 734
 #
735 735
 # This file is free software; the Free Software Foundation
736 736
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -769,7 +796,7 @@ fi
769 769
 
770 770
 # Helper functions for option handling.                     -*- Autoconf -*-
771 771
 
772
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
772
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
773 773
 #
774 774
 # This file is free software; the Free Software Foundation
775 775
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -798,7 +825,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
798 798
 AC_DEFUN([_AM_IF_OPTION],
799 799
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
800 800
 
801
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
801
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
802 802
 #
803 803
 # This file is free software; the Free Software Foundation
804 804
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -845,7 +872,7 @@ AC_LANG_POP([C])])
845 845
 # For backward compatibility.
846 846
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
847 847
 
848
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
848
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
849 849
 #
850 850
 # This file is free software; the Free Software Foundation
851 851
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -864,7 +891,7 @@ AC_DEFUN([AM_RUN_LOG],
864 864
 
865 865
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
866 866
 
867
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
867
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
868 868
 #
869 869
 # This file is free software; the Free Software Foundation
870 870
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -945,7 +972,7 @@ AC_CONFIG_COMMANDS_PRE(
945 945
 rm -f conftest.file
946 946
 ])
947 947
 
948
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
948
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
949 949
 #
950 950
 # This file is free software; the Free Software Foundation
951 951
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -1005,7 +1032,7 @@ AC_SUBST([AM_BACKSLASH])dnl
1005 1005
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1006 1006
 ])
1007 1007
 
1008
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
1008
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
1009 1009
 #
1010 1010
 # This file is free software; the Free Software Foundation
1011 1011
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -1033,7 +1060,7 @@ fi
1033 1033
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1034 1034
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
1035 1035
 
1036
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
1036
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
1037 1037
 #
1038 1038
 # This file is free software; the Free Software Foundation
1039 1039
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -1052,7 +1079,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1052 1052
 
1053 1053
 # Check how to create a tarball.                            -*- Autoconf -*-
1054 1054
 
1055
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
1055
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
1056 1056
 #
1057 1057
 # This file is free software; the Free Software Foundation
1058 1058
 # gives unlimited permission to copy and/or distribute it,
... ...
@@ -1188,3 +1215,4 @@ m4_include([m4/ltoptions.m4])
1188 1188
 m4_include([m4/ltsugar.m4])
1189 1189
 m4_include([m4/ltversion.m4])
1190 1190
 m4_include([m4/lt~obsolete.m4])
1191
+m4_include([acinclude.m4])
1191 1192
new file mode 100755
... ...
@@ -0,0 +1,270 @@
0
+#! /bin/sh
1
+# Wrapper for Microsoft lib.exe
2
+
3
+me=ar-lib
4
+scriptversion=2012-03-01.08; # UTC
5
+
6
+# Copyright (C) 2010-2017 Free Software Foundation, Inc.
7
+# Written by Peter Rosin <peda@lysator.liu.se>.
8
+#
9
+# This program is free software; you can redistribute it and/or modify
10
+# it under the terms of the GNU General Public License as published by
11
+# the Free Software Foundation; either version 2, or (at your option)
12
+# any later version.
13
+#
14
+# This program is distributed in the hope that it will be useful,
15
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+# GNU General Public License for more details.
18
+#
19
+# You should have received a copy of the GNU General Public License
20
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+
22
+# As a special exception to the GNU General Public License, if you
23
+# distribute this file as part of a program that contains a
24
+# configuration script generated by Autoconf, you may include it under
25
+# the same distribution terms that you use for the rest of that program.
26
+
27
+# This file is maintained in Automake, please report
28
+# bugs to <bug-automake@gnu.org> or send patches to
29
+# <automake-patches@gnu.org>.
30
+
31
+
32
+# func_error message
33
+func_error ()
34
+{
35
+  echo "$me: $1" 1>&2
36
+  exit 1
37
+}
38
+
39
+file_conv=
40
+
41
+# func_file_conv build_file
42
+# Convert a $build file to $host form and store it in $file
43
+# Currently only supports Windows hosts.
44
+func_file_conv ()
45
+{
46
+  file=$1
47
+  case $file in
48
+    / | /[!/]*) # absolute file, and not a UNC file
49
+      if test -z "$file_conv"; then
50
+	# lazily determine how to convert abs files
51
+	case `uname -s` in
52
+	  MINGW*)
53
+	    file_conv=mingw
54
+	    ;;
55
+	  CYGWIN*)
56
+	    file_conv=cygwin
57
+	    ;;
58
+	  *)
59
+	    file_conv=wine
60
+	    ;;
61
+	esac
62
+      fi
63
+      case $file_conv in
64
+	mingw)
65
+	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
66
+	  ;;
67
+	cygwin)
68
+	  file=`cygpath -m "$file" || echo "$file"`
69
+	  ;;
70
+	wine)
71
+	  file=`winepath -w "$file" || echo "$file"`
72
+	  ;;
73
+      esac
74
+      ;;
75
+  esac
76
+}
77
+
78
+# func_at_file at_file operation archive
79
+# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
80
+# for each of them.
81
+# When interpreting the content of the @FILE, do NOT use func_file_conv,
82
+# since the user would need to supply preconverted file names to
83
+# binutils ar, at least for MinGW.
84
+func_at_file ()
85
+{
86
+  operation=$2
87
+  archive=$3
88
+  at_file_contents=`cat "$1"`
89
+  eval set x "$at_file_contents"
90
+  shift
91
+
92
+  for member
93
+  do
94
+    $AR -NOLOGO $operation:"$member" "$archive" || exit $?
95
+  done
96
+}
97
+
98
+case $1 in
99
+  '')
100
+     func_error "no command.  Try '$0 --help' for more information."
101
+     ;;
102
+  -h | --h*)
103
+    cat <<EOF
104
+Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
105
+
106
+Members may be specified in a file named with @FILE.
107
+EOF
108
+    exit $?
109
+    ;;
110
+  -v | --v*)
111
+    echo "$me, version $scriptversion"
112
+    exit $?
113
+    ;;
114
+esac
115
+
116
+if test $# -lt 3; then
117
+  func_error "you must specify a program, an action and an archive"
118
+fi
119
+
120
+AR=$1
121
+shift
122
+while :
123
+do
124
+  if test $# -lt 2; then
125
+    func_error "you must specify a program, an action and an archive"
126
+  fi
127
+  case $1 in
128
+    -lib | -LIB \
129
+    | -ltcg | -LTCG \
130
+    | -machine* | -MACHINE* \
131
+    | -subsystem* | -SUBSYSTEM* \
132
+    | -verbose | -VERBOSE \
133
+    | -wx* | -WX* )
134
+      AR="$AR $1"
135
+      shift
136
+      ;;
137
+    *)
138
+      action=$1
139
+      shift
140
+      break
141
+      ;;
142
+  esac
143
+done
144
+orig_archive=$1
145
+shift
146
+func_file_conv "$orig_archive"
147
+archive=$file
148
+
149
+# strip leading dash in $action
150
+action=${action#-}
151
+
152
+delete=
153
+extract=
154
+list=
155
+quick=
156
+replace=
157
+index=
158
+create=
159
+
160
+while test -n "$action"
161
+do
162
+  case $action in
163
+    d*) delete=yes  ;;
164
+    x*) extract=yes ;;
165
+    t*) list=yes    ;;
166
+    q*) quick=yes   ;;
167
+    r*) replace=yes ;;
168
+    s*) index=yes   ;;
169
+    S*)             ;; # the index is always updated implicitly
170
+    c*) create=yes  ;;
171
+    u*)             ;; # TODO: don't ignore the update modifier
172
+    v*)             ;; # TODO: don't ignore the verbose modifier
173
+    *)
174
+      func_error "unknown action specified"
175
+      ;;
176
+  esac
177
+  action=${action#?}
178
+done
179
+
180
+case $delete$extract$list$quick$replace,$index in
181
+  yes,* | ,yes)
182
+    ;;
183
+  yesyes*)
184
+    func_error "more than one action specified"
185
+    ;;
186
+  *)
187
+    func_error "no action specified"
188
+    ;;
189
+esac
190
+
191
+if test -n "$delete"; then
192
+  if test ! -f "$orig_archive"; then
193
+    func_error "archive not found"
194
+  fi
195
+  for member
196
+  do
197
+    case $1 in
198
+      @*)
199
+        func_at_file "${1#@}" -REMOVE "$archive"
200
+        ;;
201
+      *)
202
+        func_file_conv "$1"
203
+        $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
204
+        ;;
205
+    esac
206
+  done
207
+
208
+elif test -n "$extract"; then
209
+  if test ! -f "$orig_archive"; then
210
+    func_error "archive not found"
211
+  fi
212
+  if test $# -gt 0; then
213
+    for member
214
+    do
215
+      case $1 in
216
+        @*)
217
+          func_at_file "${1#@}" -EXTRACT "$archive"
218
+          ;;
219
+        *)
220
+          func_file_conv "$1"
221
+          $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
222
+          ;;
223
+      esac
224
+    done
225
+  else
226
+    $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
227
+    do
228
+      $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
229
+    done
230
+  fi
231
+
232
+elif test -n "$quick$replace"; then
233
+  if test ! -f "$orig_archive"; then
234
+    if test -z "$create"; then
235
+      echo "$me: creating $orig_archive"
236
+    fi
237
+    orig_archive=
238
+  else
239
+    orig_archive=$archive
240
+  fi
241
+
242
+  for member
243
+  do
244
+    case $1 in
245
+    @*)
246
+      func_file_conv "${1#@}"
247
+      set x "$@" "@$file"
248
+      ;;
249
+    *)
250
+      func_file_conv "$1"
251
+      set x "$@" "$file"
252
+      ;;
253
+    esac
254
+    shift
255
+    shift
256
+  done
257
+
258
+  if test -n "$orig_archive"; then
259
+    $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
260
+  else
261
+    $AR -NOLOGO -OUT:"$archive" "$@" || exit $?
262
+  fi
263
+
264
+elif test -n "$list"; then
265
+  if test ! -f "$orig_archive"; then
266
+    func_error "archive not found"
267
+  fi
268
+  $AR -NOLOGO -LIST "$archive" || exit $?
269
+fi
... ...
@@ -3,7 +3,7 @@
3 3
 
4 4
 scriptversion=2012-10-14.11; # UTC
5 5
 
6
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
6
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
7 7
 # Written by Tom Tromey <tromey@cygnus.com>.
8 8
 #
9 9
 # This program is free software; you can redistribute it and/or modify
... ...
@@ -1,8 +1,8 @@
1 1
 #! /bin/sh
2 2
 # Attempt to guess a canonical system name.
3
-#   Copyright 1992-2013 Free Software Foundation, Inc.
3
+#   Copyright 1992-2018 Free Software Foundation, Inc.
4 4
 
5
-timestamp='2013-06-10'
5
+timestamp='2018-02-24'
6 6
 
7 7
 # This file is free software; you can redistribute it and/or modify it
8 8
 # under the terms of the GNU General Public License as published by
... ...
@@ -15,7 +15,7 @@ timestamp='2013-06-10'
15 15
 # General Public License for more details.
16 16
 #
17 17
 # You should have received a copy of the GNU General Public License
18
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
18
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
19 19
 #
20 20
 # As a special exception to the GNU General Public License, if you
21 21
 # distribute this file as part of a program that contains a
... ...
@@ -24,12 +24,12 @@ timestamp='2013-06-10'
24 24
 # program.  This Exception is an additional permission under section 7
25 25
 # of the GNU General Public License, version 3 ("GPLv3").
26 26
 #
27
-# Originally written by Per Bothner.
27
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
28 28
 #
29 29
 # You can get the latest version of this script from:
30
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
30
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
31 31
 #
32
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
32
+# Please send patches to <config-patches@gnu.org>.
33 33
 
34 34
 
35 35
 me=`echo "$0" | sed -e 's,.*/,,'`
... ...
@@ -39,7 +39,7 @@ Usage: $0 [OPTION]
39 39
 
40 40
 Output the configuration name of the system \`$me' is run on.
41 41
 
42
-Operation modes:
42
+Options:
43 43
   -h, --help         print this help, then exit
44 44
   -t, --time-stamp   print date of last modification, then exit
45 45
   -v, --version      print version number, then exit
... ...
@@ -50,7 +50,7 @@ version="\
50 50
 GNU config.guess ($timestamp)
51 51
 
52 52
 Originally written by Per Bothner.
53
-Copyright 1992-2013 Free Software Foundation, Inc.
53
+Copyright 1992-2018 Free Software Foundation, Inc.
54 54
 
55 55
 This is free software; see the source for copying conditions.  There is NO
56 56
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
... ...
@@ -107,9 +107,9 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
107 107
 dummy=$tmp/dummy ;
108 108
 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
109 109
 case $CC_FOR_BUILD,$HOST_CC,$CC in
110
- ,,)    echo "int x;" > $dummy.c ;
110
+ ,,)    echo "int x;" > "$dummy.c" ;
111 111
 	for c in cc gcc c89 c99 ; do
112
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
112
+	  if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
113 113
 	     CC_FOR_BUILD="$c"; break ;
114 114
 	  fi ;
115 115
 	done ;
... ...
@@ -132,14 +132,14 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
132 132
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
133 133
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
134 134
 
135
-case "${UNAME_SYSTEM}" in
135
+case "$UNAME_SYSTEM" in
136 136
 Linux|GNU|GNU/*)
137 137
 	# If the system lacks a compiler, then just pick glibc.
138 138
 	# We could probably try harder.
139 139
 	LIBC=gnu
140 140
 
141
-	eval $set_cc_for_build
142
-	cat <<-EOF > $dummy.c
141
+	eval "$set_cc_for_build"
142
+	cat <<-EOF > "$dummy.c"
143 143
 	#include <features.h>
144 144
 	#if defined(__UCLIBC__)
145 145
 	LIBC=uclibc
... ...
@@ -149,13 +149,20 @@ Linux|GNU|GNU/*)
149 149
 	LIBC=gnu
150 150
 	#endif
151 151
 	EOF
152
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
152
+	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
153
+
154
+	# If ldd exists, use it to detect musl libc.
155
+	if command -v ldd >/dev/null && \
156
+		ldd --version 2>&1 | grep -q ^musl
157
+	then
158
+	    LIBC=musl
159
+	fi
153 160
 	;;
154 161
 esac
155 162
 
156 163
 # Note: order is significant - the case branches are not exclusive.
157 164
 
158
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
165
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
159 166
     *:NetBSD:*:*)
160 167
 	# NetBSD (nbsd) targets should (where applicable) match one or
161 168
 	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
... ...
@@ -168,21 +175,31 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
168 168
 	# Note: NetBSD doesn't particularly care about the vendor
169 169
 	# portion of the name.  We always set it to "unknown".
170 170
 	sysctl="sysctl -n hw.machine_arch"
171
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
172
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
173
-	case "${UNAME_MACHINE_ARCH}" in
171
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
172
+	    "/sbin/$sysctl" 2>/dev/null || \
173
+	    "/usr/sbin/$sysctl" 2>/dev/null || \
174
+	    echo unknown)`
175
+	case "$UNAME_MACHINE_ARCH" in
174 176
 	    armeb) machine=armeb-unknown ;;
175 177
 	    arm*) machine=arm-unknown ;;
176 178
 	    sh3el) machine=shl-unknown ;;
177 179
 	    sh3eb) machine=sh-unknown ;;
178 180
 	    sh5el) machine=sh5le-unknown ;;
179
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
181
+	    earmv*)
182
+		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
183
+		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
184
+		machine="${arch}${endian}"-unknown
185
+		;;
186
+	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
180 187
 	esac
181 188
 	# The Operating System including object format, if it has switched
182
-	# to ELF recently, or will in the future.
183
-	case "${UNAME_MACHINE_ARCH}" in
189
+	# to ELF recently (or will in the future) and ABI.
190
+	case "$UNAME_MACHINE_ARCH" in
191
+	    earm*)
192
+		os=netbsdelf
193
+		;;
184 194
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
185
-		eval $set_cc_for_build
195
+		eval "$set_cc_for_build"
186 196
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
187 197
 			| grep -q __ELF__
188 198
 		then
... ...
@@ -197,44 +214,67 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
197 197
 		os=netbsd
198 198
 		;;
199 199
 	esac
200
+	# Determine ABI tags.
201
+	case "$UNAME_MACHINE_ARCH" in
202
+	    earm*)
203
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
204
+		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
205
+		;;
206
+	esac
200 207
 	# The OS release
201 208
 	# Debian GNU/NetBSD machines have a different userland, and
202 209
 	# thus, need a distinct triplet. However, they do not need
203 210
 	# kernel version information, so it can be replaced with a
204 211
 	# suitable tag, in the style of linux-gnu.
205
-	case "${UNAME_VERSION}" in
212
+	case "$UNAME_VERSION" in
206 213
 	    Debian*)
207 214
 		release='-gnu'
208 215
 		;;
209 216
 	    *)
210
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
217
+		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
211 218
 		;;
212 219
 	esac
213 220
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
214 221
 	# contains redundant information, the shorter form:
215 222
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
216
-	echo "${machine}-${os}${release}"
223
+	echo "$machine-${os}${release}${abi}"
217 224
 	exit ;;
218 225
     *:Bitrig:*:*)
219 226
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
220
-	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
227
+	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
221 228
 	exit ;;
222 229
     *:OpenBSD:*:*)
223 230
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
224
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
231
+	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
232
+	exit ;;
233
+    *:LibertyBSD:*:*)
234
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
235
+	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
236
+	exit ;;
237
+    *:MidnightBSD:*:*)
238
+	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
225 239
 	exit ;;
226 240
     *:ekkoBSD:*:*)
227
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
241
+	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
228 242
 	exit ;;
229 243
     *:SolidBSD:*:*)
230
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
244
+	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
231 245
 	exit ;;
232 246
     macppc:MirBSD:*:*)
233
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
247
+	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
234 248
 	exit ;;
235 249
     *:MirBSD:*:*)
236
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
250
+	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
237 251
 	exit ;;
252
+    *:Sortix:*:*)
253
+	echo "$UNAME_MACHINE"-unknown-sortix
254
+	exit ;;
255
+    *:Redox:*:*)
256
+	echo "$UNAME_MACHINE"-unknown-redox
257
+	exit ;;
258
+    mips:OSF1:*.*)
259
+        echo mips-dec-osf1
260
+        exit ;;
238 261
     alpha:OSF1:*:*)
239 262
 	case $UNAME_RELEASE in
240 263
 	*4.0)
... ...
@@ -251,63 +291,54 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
251 251
 	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
252 252
 	case "$ALPHA_CPU_TYPE" in
253 253
 	    "EV4 (21064)")
254
-		UNAME_MACHINE="alpha" ;;
254
+		UNAME_MACHINE=alpha ;;
255 255
 	    "EV4.5 (21064)")
256
-		UNAME_MACHINE="alpha" ;;
256
+		UNAME_MACHINE=alpha ;;
257 257
 	    "LCA4 (21066/21068)")
258
-		UNAME_MACHINE="alpha" ;;
258
+		UNAME_MACHINE=alpha ;;
259 259
 	    "EV5 (21164)")
260
-		UNAME_MACHINE="alphaev5" ;;
260
+		UNAME_MACHINE=alphaev5 ;;
261 261
 	    "EV5.6 (21164A)")
262
-		UNAME_MACHINE="alphaev56" ;;
262
+		UNAME_MACHINE=alphaev56 ;;
263 263
 	    "EV5.6 (21164PC)")
264
-		UNAME_MACHINE="alphapca56" ;;
264
+		UNAME_MACHINE=alphapca56 ;;
265 265
 	    "EV5.7 (21164PC)")
266
-		UNAME_MACHINE="alphapca57" ;;
266
+		UNAME_MACHINE=alphapca57 ;;
267 267
 	    "EV6 (21264)")
268
-		UNAME_MACHINE="alphaev6" ;;
268
+		UNAME_MACHINE=alphaev6 ;;
269 269
 	    "EV6.7 (21264A)")
270
-		UNAME_MACHINE="alphaev67" ;;
270
+		UNAME_MACHINE=alphaev67 ;;
271 271
 	    "EV6.8CB (21264C)")
272
-		UNAME_MACHINE="alphaev68" ;;
272
+		UNAME_MACHINE=alphaev68 ;;
273 273
 	    "EV6.8AL (21264B)")
274
-		UNAME_MACHINE="alphaev68" ;;
274
+		UNAME_MACHINE=alphaev68 ;;
275 275
 	    "EV6.8CX (21264D)")
276
-		UNAME_MACHINE="alphaev68" ;;
276
+		UNAME_MACHINE=alphaev68 ;;
277 277
 	    "EV6.9A (21264/EV69A)")
278
-		UNAME_MACHINE="alphaev69" ;;
278
+		UNAME_MACHINE=alphaev69 ;;
279 279
 	    "EV7 (21364)")
280
-		UNAME_MACHINE="alphaev7" ;;
280
+		UNAME_MACHINE=alphaev7 ;;
281 281
 	    "EV7.9 (21364A)")
282
-		UNAME_MACHINE="alphaev79" ;;
282
+		UNAME_MACHINE=alphaev79 ;;
283 283
 	esac
284 284
 	# A Pn.n version is a patched version.
285 285
 	# A Vn.n version is a released version.
286 286
 	# A Tn.n version is a released field test version.
287 287
 	# A Xn.n version is an unreleased experimental baselevel.
288 288
 	# 1.2 uses "1.2" for uname -r.
289
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
289
+	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
290 290
 	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
291 291
 	exitcode=$?
292 292
 	trap '' 0
293 293
 	exit $exitcode ;;
294
-    Alpha\ *:Windows_NT*:*)
295
-	# How do we know it's Interix rather than the generic POSIX subsystem?
296
-	# Should we change UNAME_MACHINE based on the output of uname instead
297
-	# of the specific Alpha model?
298
-	echo alpha-pc-interix
299
-	exit ;;
300
-    21064:Windows_NT:50:3)
301
-	echo alpha-dec-winnt3.5
302
-	exit ;;
303 294
     Amiga*:UNIX_System_V:4.0:*)
304 295
 	echo m68k-unknown-sysv4
305 296
 	exit ;;
306 297
     *:[Aa]miga[Oo][Ss]:*:*)
307
-	echo ${UNAME_MACHINE}-unknown-amigaos
298
+	echo "$UNAME_MACHINE"-unknown-amigaos
308 299
 	exit ;;
309 300
     *:[Mm]orph[Oo][Ss]:*:*)
310
-	echo ${UNAME_MACHINE}-unknown-morphos
301
+	echo "$UNAME_MACHINE"-unknown-morphos
311 302
 	exit ;;
312 303
     *:OS/390:*:*)
313 304
 	echo i370-ibm-openedition
... ...
@@ -319,7 +350,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
319 319
 	echo powerpc-ibm-os400
320 320
 	exit ;;
321 321
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
322
-	echo arm-acorn-riscix${UNAME_RELEASE}
322
+	echo arm-acorn-riscix"$UNAME_RELEASE"
323 323
 	exit ;;
324 324
     arm*:riscos:*:*|arm*:RISCOS:*:*)
325 325
 	echo arm-unknown-riscos
... ...
@@ -346,38 +377,38 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
346 346
 	    sparc) echo sparc-icl-nx7; exit ;;
347 347
 	esac ;;
348 348
     s390x:SunOS:*:*)
349
-	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
349
+	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
350 350
 	exit ;;
351 351
     sun4H:SunOS:5.*:*)
352
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
352
+	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
353 353
 	exit ;;
354 354
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
355
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
355
+	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
356 356
 	exit ;;
357 357
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
358
-	echo i386-pc-auroraux${UNAME_RELEASE}
358
+	echo i386-pc-auroraux"$UNAME_RELEASE"
359 359
 	exit ;;
360 360
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
361
-	eval $set_cc_for_build
362
-	SUN_ARCH="i386"
361
+	eval "$set_cc_for_build"
362
+	SUN_ARCH=i386
363 363
 	# If there is a compiler, see if it is configured for 64-bit objects.
364 364
 	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
365 365
 	# This test works for both compilers.
366
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
366
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
367 367
 	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
368
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
368
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
369 369
 		grep IS_64BIT_ARCH >/dev/null
370 370
 	    then
371
-		SUN_ARCH="x86_64"
371
+		SUN_ARCH=x86_64
372 372
 	    fi
373 373
 	fi
374
-	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
374
+	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
375 375
 	exit ;;
376 376
     sun4*:SunOS:6*:*)
377 377
 	# According to config.sub, this is the proper way to canonicalize
378 378
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
379 379
 	# it's likely to be more like Solaris than SunOS4.
380
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
380
+	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
381 381
 	exit ;;
382 382
     sun4*:SunOS:*:*)
383 383
 	case "`/usr/bin/arch -k`" in
... ...
@@ -386,25 +417,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
386 386
 		;;
387 387
 	esac
388 388
 	# Japanese Language versions have a version number like `4.1.3-JL'.
389
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
389
+	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
390 390
 	exit ;;
391 391
     sun3*:SunOS:*:*)
392
-	echo m68k-sun-sunos${UNAME_RELEASE}
392
+	echo m68k-sun-sunos"$UNAME_RELEASE"
393 393
 	exit ;;
394 394
     sun*:*:4.2BSD:*)
395 395
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
396
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
396
+	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
397 397
 	case "`/bin/arch`" in
398 398
 	    sun3)
399
-		echo m68k-sun-sunos${UNAME_RELEASE}
399
+		echo m68k-sun-sunos"$UNAME_RELEASE"
400 400
 		;;
401 401
 	    sun4)
402
-		echo sparc-sun-sunos${UNAME_RELEASE}
402
+		echo sparc-sun-sunos"$UNAME_RELEASE"
403 403
 		;;
404 404
 	esac
405 405
 	exit ;;
406 406
     aushp:SunOS:*:*)
407
-	echo sparc-auspex-sunos${UNAME_RELEASE}
407
+	echo sparc-auspex-sunos"$UNAME_RELEASE"
408 408
 	exit ;;
409 409
     # The situation for MiNT is a little confusing.  The machine name
410 410
     # can be virtually everything (everything which is not
... ...
@@ -415,44 +446,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
415 415
     # MiNT.  But MiNT is downward compatible to TOS, so this should
416 416
     # be no problem.
417 417
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
418
-	echo m68k-atari-mint${UNAME_RELEASE}
418
+	echo m68k-atari-mint"$UNAME_RELEASE"
419 419
 	exit ;;
420 420
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
421
-	echo m68k-atari-mint${UNAME_RELEASE}
421
+	echo m68k-atari-mint"$UNAME_RELEASE"
422 422
 	exit ;;
423 423
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
424
-	echo m68k-atari-mint${UNAME_RELEASE}
424
+	echo m68k-atari-mint"$UNAME_RELEASE"
425 425
 	exit ;;
426 426
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
427
-	echo m68k-milan-mint${UNAME_RELEASE}
427
+	echo m68k-milan-mint"$UNAME_RELEASE"
428 428
 	exit ;;
429 429
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
430
-	echo m68k-hades-mint${UNAME_RELEASE}
430
+	echo m68k-hades-mint"$UNAME_RELEASE"
431 431
 	exit ;;
432 432
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
433
-	echo m68k-unknown-mint${UNAME_RELEASE}
433
+	echo m68k-unknown-mint"$UNAME_RELEASE"
434 434
 	exit ;;
435 435
     m68k:machten:*:*)
436
-	echo m68k-apple-machten${UNAME_RELEASE}
436
+	echo m68k-apple-machten"$UNAME_RELEASE"
437 437
 	exit ;;
438 438
     powerpc:machten:*:*)
439
-	echo powerpc-apple-machten${UNAME_RELEASE}
439
+	echo powerpc-apple-machten"$UNAME_RELEASE"
440 440
 	exit ;;
441 441
     RISC*:Mach:*:*)
442 442
 	echo mips-dec-mach_bsd4.3
443 443
 	exit ;;
444 444
     RISC*:ULTRIX:*:*)
445
-	echo mips-dec-ultrix${UNAME_RELEASE}
445
+	echo mips-dec-ultrix"$UNAME_RELEASE"
446 446
 	exit ;;
447 447
     VAX*:ULTRIX*:*:*)
448
-	echo vax-dec-ultrix${UNAME_RELEASE}
448
+	echo vax-dec-ultrix"$UNAME_RELEASE"
449 449
 	exit ;;
450 450
     2020:CLIX:*:* | 2430:CLIX:*:*)
451
-	echo clipper-intergraph-clix${UNAME_RELEASE}
451
+	echo clipper-intergraph-clix"$UNAME_RELEASE"
452 452
 	exit ;;
453 453
     mips:*:*:UMIPS | mips:*:*:RISCos)
454
-	eval $set_cc_for_build
455
-	sed 's/^	//' << EOF >$dummy.c
454
+	eval "$set_cc_for_build"
455
+	sed 's/^	//' << EOF > "$dummy.c"
456 456
 #ifdef __cplusplus
457 457
 #include <stdio.h>  /* for printf() prototype */
458 458
 	int main (int argc, char *argv[]) {
... ...
@@ -461,23 +492,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
461 461
 #endif
462 462
 	#if defined (host_mips) && defined (MIPSEB)
463 463
 	#if defined (SYSTYPE_SYSV)
464
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
464
+	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
465 465
 	#endif
466 466
 	#if defined (SYSTYPE_SVR4)
467
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
467
+	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
468 468
 	#endif
469 469
 	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
470
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
470
+	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
471 471
 	#endif
472 472
 	#endif
473 473
 	  exit (-1);
474 474
 	}
475 475
 EOF
476
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
477
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
478
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
476
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
477
+	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
478
+	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
479 479
 	    { echo "$SYSTEM_NAME"; exit; }
480
-	echo mips-mips-riscos${UNAME_RELEASE}
480
+	echo mips-mips-riscos"$UNAME_RELEASE"
481 481
 	exit ;;
482 482
     Motorola:PowerMAX_OS:*:*)
483 483
 	echo powerpc-motorola-powermax
... ...
@@ -503,17 +534,17 @@ EOF
503 503
     AViiON:dgux:*:*)
504 504
 	# DG/UX returns AViiON for all architectures
505 505
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
506
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
506
+	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
507 507
 	then
508
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
509
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
508
+	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
509
+	       [ "$TARGET_BINARY_INTERFACE"x = x ]
510 510
 	    then
511
-		echo m88k-dg-dgux${UNAME_RELEASE}
511
+		echo m88k-dg-dgux"$UNAME_RELEASE"
512 512
 	    else
513
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
513
+		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
514 514
 	    fi
515 515
 	else
516
-	    echo i586-dg-dgux${UNAME_RELEASE}
516
+	    echo i586-dg-dgux"$UNAME_RELEASE"
517 517
 	fi
518 518
 	exit ;;
519 519
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
... ...
@@ -530,7 +561,7 @@ EOF
530 530
 	echo m68k-tektronix-bsd
531 531
 	exit ;;
532 532
     *:IRIX*:*:*)
533
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
533
+	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
534 534
 	exit ;;
535 535
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
536 536
 	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
... ...
@@ -542,14 +573,14 @@ EOF
542 542
 	if [ -x /usr/bin/oslevel ] ; then
543 543
 		IBM_REV=`/usr/bin/oslevel`
544 544
 	else
545
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
545
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
546 546
 	fi
547
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
547
+	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
548 548
 	exit ;;
549 549
     *:AIX:2:3)
550 550
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
551
-		eval $set_cc_for_build
552
-		sed 's/^		//' << EOF >$dummy.c
551
+		eval "$set_cc_for_build"
552
+		sed 's/^		//' << EOF > "$dummy.c"
553 553
 		#include <sys/systemcfg.h>
554 554
 
555 555
 		main()
... ...
@@ -560,7 +591,7 @@ EOF
560 560
 			exit(0);
561 561
 			}
562 562
 EOF
563
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
563
+		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
564 564
 		then
565 565
 			echo "$SYSTEM_NAME"
566 566
 		else
... ...
@@ -574,26 +605,27 @@ EOF
574 574
 	exit ;;
575 575
     *:AIX:*:[4567])
576 576
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
577
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
577
+	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
578 578
 		IBM_ARCH=rs6000
579 579
 	else
580 580
 		IBM_ARCH=powerpc
581 581
 	fi
582
-	if [ -x /usr/bin/oslevel ] ; then
583
-		IBM_REV=`/usr/bin/oslevel`
582
+	if [ -x /usr/bin/lslpp ] ; then
583
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
584
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
584 585
 	else
585
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
586
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
586 587
 	fi
587
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
588
+	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
588 589
 	exit ;;
589 590
     *:AIX:*:*)
590 591
 	echo rs6000-ibm-aix
591 592
 	exit ;;
592
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
593
+    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
593 594
 	echo romp-ibm-bsd4.4
594 595
 	exit ;;
595 596
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
596
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
597
+	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
597 598
 	exit ;;                             # report: romp-ibm BSD 4.3
598 599
     *:BOSX:*:*)
599 600
 	echo rs6000-bull-bosx
... ...
@@ -608,28 +640,28 @@ EOF
608 608
 	echo m68k-hp-bsd4.4
609 609
 	exit ;;
610 610
     9000/[34678]??:HP-UX:*:*)
611
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
612
-	case "${UNAME_MACHINE}" in
613
-	    9000/31? )            HP_ARCH=m68000 ;;
614
-	    9000/[34]?? )         HP_ARCH=m68k ;;
611
+	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
612
+	case "$UNAME_MACHINE" in
613
+	    9000/31?)            HP_ARCH=m68000 ;;
614
+	    9000/[34]??)         HP_ARCH=m68k ;;
615 615
 	    9000/[678][0-9][0-9])
616 616
 		if [ -x /usr/bin/getconf ]; then
617 617
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
618 618
 		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
619
-		    case "${sc_cpu_version}" in
620
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
621
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
619
+		    case "$sc_cpu_version" in
620
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
621
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
622 622
 		      532)                      # CPU_PA_RISC2_0
623
-			case "${sc_kernel_bits}" in
624
-			  32) HP_ARCH="hppa2.0n" ;;
625
-			  64) HP_ARCH="hppa2.0w" ;;
626
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
623
+			case "$sc_kernel_bits" in
624
+			  32) HP_ARCH=hppa2.0n ;;
625
+			  64) HP_ARCH=hppa2.0w ;;
626
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
627 627
 			esac ;;
628 628
 		    esac
629 629
 		fi
630
-		if [ "${HP_ARCH}" = "" ]; then
631
-		    eval $set_cc_for_build
632
-		    sed 's/^		//' << EOF >$dummy.c
630
+		if [ "$HP_ARCH" = "" ]; then
631
+		    eval "$set_cc_for_build"
632
+		    sed 's/^		//' << EOF > "$dummy.c"
633 633
 
634 634
 		#define _HPUX_SOURCE
635 635
 		#include <stdlib.h>
... ...
@@ -662,13 +694,13 @@ EOF
662 662
 		    exit (0);
663 663
 		}
664 664
 EOF
665
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
665
+		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
666 666
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
667 667
 		fi ;;
668 668
 	esac
669
-	if [ ${HP_ARCH} = "hppa2.0w" ]
669
+	if [ "$HP_ARCH" = hppa2.0w ]
670 670
 	then
671
-	    eval $set_cc_for_build
671
+	    eval "$set_cc_for_build"
672 672
 
673 673
 	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
674 674
 	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
... ...
@@ -679,23 +711,23 @@ EOF
679 679
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
680 680
 	    # => hppa64-hp-hpux11.23
681 681
 
682
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
682
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
683 683
 		grep -q __LP64__
684 684
 	    then
685
-		HP_ARCH="hppa2.0w"
685
+		HP_ARCH=hppa2.0w
686 686
 	    else
687
-		HP_ARCH="hppa64"
687
+		HP_ARCH=hppa64
688 688
 	    fi
689 689
 	fi
690
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
690
+	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
691 691
 	exit ;;
692 692
     ia64:HP-UX:*:*)
693
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
694
-	echo ia64-hp-hpux${HPUX_REV}
693
+	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
694
+	echo ia64-hp-hpux"$HPUX_REV"
695 695
 	exit ;;
696 696
     3050*:HI-UX:*:*)
697
-	eval $set_cc_for_build
698
-	sed 's/^	//' << EOF >$dummy.c
697
+	eval "$set_cc_for_build"
698
+	sed 's/^	//' << EOF > "$dummy.c"
699 699
 	#include <unistd.h>
700 700
 	int
701 701
 	main ()
... ...
@@ -720,11 +752,11 @@ EOF
720 720
 	  exit (0);
721 721
 	}
722 722
 EOF
723
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
723
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
724 724
 		{ echo "$SYSTEM_NAME"; exit; }
725 725
 	echo unknown-hitachi-hiuxwe2
726 726
 	exit ;;
727
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
727
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
728 728
 	echo hppa1.1-hp-bsd
729 729
 	exit ;;
730 730
     9000/8??:4.3bsd:*:*)
... ...
@@ -733,7 +765,7 @@ EOF
733 733
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
734 734
 	echo hppa1.0-hp-mpeix
735 735
 	exit ;;
736
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
736
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
737 737
 	echo hppa1.1-hp-osf
738 738
 	exit ;;
739 739
     hp8??:OSF1:*:*)
... ...
@@ -741,9 +773,9 @@ EOF
741 741
 	exit ;;
742 742
     i*86:OSF1:*:*)
743 743
 	if [ -x /usr/sbin/sysversion ] ; then
744
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
744
+	    echo "$UNAME_MACHINE"-unknown-osf1mk
745 745
 	else
746
-	    echo ${UNAME_MACHINE}-unknown-osf1
746
+	    echo "$UNAME_MACHINE"-unknown-osf1
747 747
 	fi
748 748
 	exit ;;
749 749
     parisc*:Lites*:*:*)
... ...
@@ -768,127 +800,109 @@ EOF
768 768
 	echo c4-convex-bsd
769 769
 	exit ;;
770 770
     CRAY*Y-MP:*:*:*)
771
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
771
+	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
772 772
 	exit ;;
773 773
     CRAY*[A-Z]90:*:*:*)
774
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
774
+	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
775 775
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
776 776
 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
777 777
 	      -e 's/\.[^.]*$/.X/'
778 778
 	exit ;;
779 779
     CRAY*TS:*:*:*)
780
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
780
+	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
781 781
 	exit ;;
782 782
     CRAY*T3E:*:*:*)
783
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
783
+	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
784 784
 	exit ;;
785 785
     CRAY*SV1:*:*:*)
786
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
786
+	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
787 787
 	exit ;;
788 788
     *:UNICOS/mp:*:*)
789
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
789
+	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
790 790
 	exit ;;
791 791
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
792
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
793
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
794
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
792
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
793
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
794
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
795 795
 	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
796 796
 	exit ;;
797 797
     5000:UNIX_System_V:4.*:*)
798
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
799
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
798
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
799
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
800 800
 	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
801 801
 	exit ;;
802 802
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
803
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
803
+	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
804 804
 	exit ;;
805 805
     sparc*:BSD/OS:*:*)
806
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
806
+	echo sparc-unknown-bsdi"$UNAME_RELEASE"
807 807
 	exit ;;
808 808
     *:BSD/OS:*:*)
809
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
809
+	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
810 810
 	exit ;;
811 811
     *:FreeBSD:*:*)
812 812
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
813
-	case ${UNAME_PROCESSOR} in
813
+	case "$UNAME_PROCESSOR" in
814 814
 	    amd64)
815
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
816
-	    *)
817
-		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
815
+		UNAME_PROCESSOR=x86_64 ;;
816
+	    i386)
817
+		UNAME_PROCESSOR=i586 ;;
818 818
 	esac
819
+	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
819 820
 	exit ;;
820 821
     i*:CYGWIN*:*)
821
-	echo ${UNAME_MACHINE}-pc-cygwin
822
+	echo "$UNAME_MACHINE"-pc-cygwin
822 823
 	exit ;;
823 824
     *:MINGW64*:*)
824
-	echo ${UNAME_MACHINE}-pc-mingw64
825
+	echo "$UNAME_MACHINE"-pc-mingw64
825 826
 	exit ;;
826 827
     *:MINGW*:*)
827
-	echo ${UNAME_MACHINE}-pc-mingw32
828
-	exit ;;
829
-    i*:MSYS*:*)
830
-	echo ${UNAME_MACHINE}-pc-msys
828
+	echo "$UNAME_MACHINE"-pc-mingw32
831 829
 	exit ;;
832
-    i*:windows32*:*)
833
-	# uname -m includes "-pc" on this system.
834
-	echo ${UNAME_MACHINE}-mingw32
830
+    *:MSYS*:*)
831
+	echo "$UNAME_MACHINE"-pc-msys
835 832
 	exit ;;
836 833
     i*:PW*:*)
837
-	echo ${UNAME_MACHINE}-pc-pw32
834
+	echo "$UNAME_MACHINE"-pc-pw32
838 835
 	exit ;;
839 836
     *:Interix*:*)
840
-	case ${UNAME_MACHINE} in
837
+	case "$UNAME_MACHINE" in
841 838
 	    x86)
842
-		echo i586-pc-interix${UNAME_RELEASE}
839
+		echo i586-pc-interix"$UNAME_RELEASE"
843 840
 		exit ;;
844 841
 	    authenticamd | genuineintel | EM64T)
845
-		echo x86_64-unknown-interix${UNAME_RELEASE}
842
+		echo x86_64-unknown-interix"$UNAME_RELEASE"
846 843
 		exit ;;
847 844
 	    IA64)
848
-		echo ia64-unknown-interix${UNAME_RELEASE}
845
+		echo ia64-unknown-interix"$UNAME_RELEASE"
849 846
 		exit ;;
850 847
 	esac ;;
851
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
852
-	echo i${UNAME_MACHINE}-pc-mks
853
-	exit ;;
854
-    8664:Windows_NT:*)
855
-	echo x86_64-pc-mks
856
-	exit ;;
857
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
858
-	# How do we know it's Interix rather than the generic POSIX subsystem?
859
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
860
-	# UNAME_MACHINE based on the output of uname instead of i386?
861
-	echo i586-pc-interix
862
-	exit ;;
863 848
     i*:UWIN*:*)
864
-	echo ${UNAME_MACHINE}-pc-uwin
849
+	echo "$UNAME_MACHINE"-pc-uwin
865 850
 	exit ;;
866 851
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
867 852
 	echo x86_64-unknown-cygwin
868 853
 	exit ;;
869
-    p*:CYGWIN*:*)
870
-	echo powerpcle-unknown-cygwin
871
-	exit ;;
872 854
     prep*:SunOS:5.*:*)
873
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
855
+	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
874 856
 	exit ;;
875 857
     *:GNU:*:*)
876 858
 	# the GNU system
877
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
859
+	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
878 860
 	exit ;;
879 861
     *:GNU/*:*:*)
880 862
 	# other systems with GNU libc and userland
881
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
863
+	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
882 864
 	exit ;;
883 865
     i*86:Minix:*:*)
884
-	echo ${UNAME_MACHINE}-pc-minix
866
+	echo "$UNAME_MACHINE"-pc-minix
885 867
 	exit ;;
886 868
     aarch64:Linux:*:*)
887
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
869
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
888 870
 	exit ;;
889 871
     aarch64_be:Linux:*:*)
890 872
 	UNAME_MACHINE=aarch64_be
891
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
873
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
892 874
 	exit ;;
893 875
     alpha:Linux:*:*)
894 876
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
... ...
@@ -901,58 +915,64 @@ EOF
901 901
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
902 902
 	esac
903 903
 	objdump --private-headers /bin/sh | grep -q ld.so.1
904
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
905
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
904
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
905
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
906 906
 	exit ;;
907 907
     arc:Linux:*:* | arceb:Linux:*:*)
908
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
908
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
909 909
 	exit ;;
910 910
     arm*:Linux:*:*)
911
-	eval $set_cc_for_build
911
+	eval "$set_cc_for_build"
912 912
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
913 913
 	    | grep -q __ARM_EABI__
914 914
 	then
915
-	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
915
+	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
916 916
 	else
917 917
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
918 918
 		| grep -q __ARM_PCS_VFP
919 919
 	    then
920
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
920
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
921 921
 	    else
922
-		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
922
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
923 923
 	    fi
924 924
 	fi
925 925
 	exit ;;
926 926
     avr32*:Linux:*:*)
927
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
927
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
928 928
 	exit ;;
929 929
     cris:Linux:*:*)
930
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
930
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
931 931
 	exit ;;
932 932
     crisv32:Linux:*:*)
933
-	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
933
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
934
+	exit ;;
935
+    e2k:Linux:*:*)
936
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
934 937
 	exit ;;
935 938
     frv:Linux:*:*)
936
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
939
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
937 940
 	exit ;;
938 941
     hexagon:Linux:*:*)
939
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
942
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
940 943
 	exit ;;
941 944
     i*86:Linux:*:*)
942
-	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
945
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
943 946
 	exit ;;
944 947
     ia64:Linux:*:*)
945
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
948
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
949
+	exit ;;
950
+    k1om:Linux:*:*)
951
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
946 952
 	exit ;;
947 953
     m32r*:Linux:*:*)
948
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
954
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
949 955
 	exit ;;
950 956
     m68*:Linux:*:*)
951
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
957
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
952 958
 	exit ;;
953 959
     mips:Linux:*:* | mips64:Linux:*:*)
954
-	eval $set_cc_for_build
955
-	sed 's/^	//' << EOF >$dummy.c
960
+	eval "$set_cc_for_build"
961
+	sed 's/^	//' << EOF > "$dummy.c"
956 962
 	#undef CPU
957 963
 	#undef ${UNAME_MACHINE}
958 964
 	#undef ${UNAME_MACHINE}el
... ...
@@ -966,64 +986,74 @@ EOF
966 966
 	#endif
967 967
 	#endif
968 968
 EOF
969
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
970
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
969
+	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
970
+	test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
971 971
 	;;
972
-    or1k:Linux:*:*)
973
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
972
+    mips64el:Linux:*:*)
973
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
974 974
 	exit ;;
975
-    or32:Linux:*:*)
976
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
975
+    openrisc*:Linux:*:*)
976
+	echo or1k-unknown-linux-"$LIBC"
977
+	exit ;;
978
+    or32:Linux:*:* | or1k*:Linux:*:*)
979
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
977 980
 	exit ;;
978 981
     padre:Linux:*:*)
979
-	echo sparc-unknown-linux-${LIBC}
982
+	echo sparc-unknown-linux-"$LIBC"
980 983
 	exit ;;
981 984
     parisc64:Linux:*:* | hppa64:Linux:*:*)
982
-	echo hppa64-unknown-linux-${LIBC}
985
+	echo hppa64-unknown-linux-"$LIBC"
983 986
 	exit ;;
984 987
     parisc:Linux:*:* | hppa:Linux:*:*)
985 988
 	# Look for CPU level
986 989
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
987
-	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
988
-	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
989
-	  *)    echo hppa-unknown-linux-${LIBC} ;;
990
+	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
991
+	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
992
+	  *)    echo hppa-unknown-linux-"$LIBC" ;;
990 993
 	esac
991 994
 	exit ;;
992 995
     ppc64:Linux:*:*)
993
-	echo powerpc64-unknown-linux-${LIBC}
996
+	echo powerpc64-unknown-linux-"$LIBC"
994 997
 	exit ;;
995 998
     ppc:Linux:*:*)
996
-	echo powerpc-unknown-linux-${LIBC}
999
+	echo powerpc-unknown-linux-"$LIBC"
997 1000
 	exit ;;
998 1001
     ppc64le:Linux:*:*)
999
-	echo powerpc64le-unknown-linux-${LIBC}
1002
+	echo powerpc64le-unknown-linux-"$LIBC"
1000 1003
 	exit ;;
1001 1004
     ppcle:Linux:*:*)
1002
-	echo powerpcle-unknown-linux-${LIBC}
1005
+	echo powerpcle-unknown-linux-"$LIBC"
1006
+	exit ;;
1007
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
1008
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1003 1009
 	exit ;;
1004 1010
     s390:Linux:*:* | s390x:Linux:*:*)
1005
-	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
1011
+	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
1006 1012
 	exit ;;
1007 1013
     sh64*:Linux:*:*)
1008
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1014
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1009 1015
 	exit ;;
1010 1016
     sh*:Linux:*:*)
1011
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1017
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1012 1018
 	exit ;;
1013 1019
     sparc:Linux:*:* | sparc64:Linux:*:*)
1014
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1020
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1015 1021
 	exit ;;
1016 1022
     tile*:Linux:*:*)
1017
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1023
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1018 1024
 	exit ;;
1019 1025
     vax:Linux:*:*)
1020
-	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1026
+	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
1021 1027
 	exit ;;
1022 1028
     x86_64:Linux:*:*)
1023
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1029
+	if objdump -f /bin/sh | grep -q elf32-x86-64; then
1030
+	    echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32
1031
+	else
1032
+	    echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
1033
+	fi
1024 1034
 	exit ;;
1025 1035
     xtensa*:Linux:*:*)
1026
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1036
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1027 1037
 	exit ;;
1028 1038
     i*86:DYNIX/ptx:4*:*)
1029 1039
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
... ...
@@ -1037,34 +1067,34 @@ EOF
1037 1037
 	# I am not positive that other SVR4 systems won't match this,
1038 1038
 	# I just have to hope.  -- rms.
1039 1039
 	# Use sysv4.2uw... so that sysv4* matches it.
1040
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1040
+	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
1041 1041
 	exit ;;
1042 1042
     i*86:OS/2:*:*)
1043 1043
 	# If we were able to find `uname', then EMX Unix compatibility
1044 1044
 	# is probably installed.
1045
-	echo ${UNAME_MACHINE}-pc-os2-emx
1045
+	echo "$UNAME_MACHINE"-pc-os2-emx
1046 1046
 	exit ;;
1047 1047
     i*86:XTS-300:*:STOP)
1048
-	echo ${UNAME_MACHINE}-unknown-stop
1048
+	echo "$UNAME_MACHINE"-unknown-stop
1049 1049
 	exit ;;
1050 1050
     i*86:atheos:*:*)
1051
-	echo ${UNAME_MACHINE}-unknown-atheos
1051
+	echo "$UNAME_MACHINE"-unknown-atheos
1052 1052
 	exit ;;
1053 1053
     i*86:syllable:*:*)
1054
-	echo ${UNAME_MACHINE}-pc-syllable
1054
+	echo "$UNAME_MACHINE"-pc-syllable
1055 1055
 	exit ;;
1056 1056
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1057
-	echo i386-unknown-lynxos${UNAME_RELEASE}
1057
+	echo i386-unknown-lynxos"$UNAME_RELEASE"
1058 1058
 	exit ;;
1059 1059
     i*86:*DOS:*:*)
1060
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1060
+	echo "$UNAME_MACHINE"-pc-msdosdjgpp
1061 1061
 	exit ;;
1062
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1063
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1062
+    i*86:*:4.*:*)
1063
+	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1064 1064
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1065
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1065
+		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
1066 1066
 	else
1067
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1067
+		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
1068 1068
 	fi
1069 1069
 	exit ;;
1070 1070
     i*86:*:5:[678]*)
... ...
@@ -1074,12 +1104,12 @@ EOF
1074 1074
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
1075 1075
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1076 1076
 	esac
1077
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1077
+	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
1078 1078
 	exit ;;
1079 1079
     i*86:*:3.2:*)
1080 1080
 	if test -f /usr/options/cb.name; then
1081 1081
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1082
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1082
+		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
1083 1083
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1084 1084
 		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1085 1085
 		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
... ...
@@ -1089,9 +1119,9 @@ EOF
1089 1089
 			&& UNAME_MACHINE=i686
1090 1090
 		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1091 1091
 			&& UNAME_MACHINE=i686
1092
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1092
+		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
1093 1093
 	else
1094
-		echo ${UNAME_MACHINE}-pc-sysv32
1094
+		echo "$UNAME_MACHINE"-pc-sysv32
1095 1095
 	fi
1096 1096
 	exit ;;
1097 1097
     pc:*:*:*)
... ...
@@ -1099,7 +1129,7 @@ EOF
1099 1099
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1100 1100
 	# the processor, so we play safe by assuming i586.
1101 1101
 	# Note: whatever this is, it MUST be the same as what config.sub
1102
-	# prints for the "djgpp" host, or else GDB configury will decide that
1102
+	# prints for the "djgpp" host, or else GDB configure will decide that
1103 1103
 	# this is a cross-build.
1104 1104
 	echo i586-pc-msdosdjgpp
1105 1105
 	exit ;;
... ...
@@ -1111,9 +1141,9 @@ EOF
1111 1111
 	exit ;;
1112 1112
     i860:*:4.*:*) # i860-SVR4
1113 1113
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1114
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1114
+	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
1115 1115
 	else # Add other i860-SVR4 vendors below as they are discovered.
1116
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1116
+	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
1117 1117
 	fi
1118 1118
 	exit ;;
1119 1119
     mini*:CTIX:SYS*5:*)
... ...
@@ -1133,9 +1163,9 @@ EOF
1133 1133
 	test -r /etc/.relid \
1134 1134
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1135 1135
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1136
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1136
+	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1137 1137
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1138
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1138
+	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1139 1139
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1140 1140
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1141 1141
 	  && { echo i486-ncr-sysv4; exit; } ;;
... ...
@@ -1144,28 +1174,28 @@ EOF
1144 1144
 	test -r /etc/.relid \
1145 1145
 	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1146 1146
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1147
-	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1147
+	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1148 1148
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1149
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1149
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1150 1150
 	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1151
-	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1151
+	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1152 1152
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1153
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
1153
+	echo m68k-unknown-lynxos"$UNAME_RELEASE"
1154 1154
 	exit ;;
1155 1155
     mc68030:UNIX_System_V:4.*:*)
1156 1156
 	echo m68k-atari-sysv4
1157 1157
 	exit ;;
1158 1158
     TSUNAMI:LynxOS:2.*:*)
1159
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
1159
+	echo sparc-unknown-lynxos"$UNAME_RELEASE"
1160 1160
 	exit ;;
1161 1161
     rs6000:LynxOS:2.*:*)
1162
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1162
+	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
1163 1163
 	exit ;;
1164 1164
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1165
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1165
+	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
1166 1166
 	exit ;;
1167 1167
     SM[BE]S:UNIX_SV:*:*)
1168
-	echo mips-dde-sysv${UNAME_RELEASE}
1168
+	echo mips-dde-sysv"$UNAME_RELEASE"
1169 1169
 	exit ;;
1170 1170
     RM*:ReliantUNIX-*:*:*)
1171 1171
 	echo mips-sni-sysv4
... ...
@@ -1176,7 +1206,7 @@ EOF
1176 1176
     *:SINIX-*:*:*)
1177 1177
 	if uname -p 2>/dev/null >/dev/null ; then
1178 1178
 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1179
-		echo ${UNAME_MACHINE}-sni-sysv4
1179
+		echo "$UNAME_MACHINE"-sni-sysv4
1180 1180
 	else
1181 1181
 		echo ns32k-sni-sysv
1182 1182
 	fi
... ...
@@ -1196,23 +1226,23 @@ EOF
1196 1196
 	exit ;;
1197 1197
     i*86:VOS:*:*)
1198 1198
 	# From Paul.Green@stratus.com.
1199
-	echo ${UNAME_MACHINE}-stratus-vos
1199
+	echo "$UNAME_MACHINE"-stratus-vos
1200 1200
 	exit ;;
1201 1201
     *:VOS:*:*)
1202 1202
 	# From Paul.Green@stratus.com.
1203 1203
 	echo hppa1.1-stratus-vos
1204 1204
 	exit ;;
1205 1205
     mc68*:A/UX:*:*)
1206
-	echo m68k-apple-aux${UNAME_RELEASE}
1206
+	echo m68k-apple-aux"$UNAME_RELEASE"
1207 1207
 	exit ;;
1208 1208
     news*:NEWS-OS:6*:*)
1209 1209
 	echo mips-sony-newsos6
1210 1210
 	exit ;;
1211 1211
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1212 1212
 	if [ -d /usr/nec ]; then
1213
-		echo mips-nec-sysv${UNAME_RELEASE}
1213
+		echo mips-nec-sysv"$UNAME_RELEASE"
1214 1214
 	else
1215
-		echo mips-unknown-sysv${UNAME_RELEASE}
1215
+		echo mips-unknown-sysv"$UNAME_RELEASE"
1216 1216
 	fi
1217 1217
 	exit ;;
1218 1218
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
... ...
@@ -1231,67 +1261,93 @@ EOF
1231 1231
 	echo x86_64-unknown-haiku
1232 1232
 	exit ;;
1233 1233
     SX-4:SUPER-UX:*:*)
1234
-	echo sx4-nec-superux${UNAME_RELEASE}
1234
+	echo sx4-nec-superux"$UNAME_RELEASE"
1235 1235
 	exit ;;
1236 1236
     SX-5:SUPER-UX:*:*)
1237
-	echo sx5-nec-superux${UNAME_RELEASE}
1237
+	echo sx5-nec-superux"$UNAME_RELEASE"
1238 1238
 	exit ;;
1239 1239
     SX-6:SUPER-UX:*:*)
1240
-	echo sx6-nec-superux${UNAME_RELEASE}
1240
+	echo sx6-nec-superux"$UNAME_RELEASE"
1241 1241
 	exit ;;
1242 1242
     SX-7:SUPER-UX:*:*)
1243
-	echo sx7-nec-superux${UNAME_RELEASE}
1243
+	echo sx7-nec-superux"$UNAME_RELEASE"
1244 1244
 	exit ;;
1245 1245
     SX-8:SUPER-UX:*:*)
1246
-	echo sx8-nec-superux${UNAME_RELEASE}
1246
+	echo sx8-nec-superux"$UNAME_RELEASE"
1247 1247
 	exit ;;
1248 1248
     SX-8R:SUPER-UX:*:*)
1249
-	echo sx8r-nec-superux${UNAME_RELEASE}
1249
+	echo sx8r-nec-superux"$UNAME_RELEASE"
1250
+	exit ;;
1251
+    SX-ACE:SUPER-UX:*:*)
1252
+	echo sxace-nec-superux"$UNAME_RELEASE"
1250 1253
 	exit ;;
1251 1254
     Power*:Rhapsody:*:*)
1252
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1255
+	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
1253 1256
 	exit ;;
1254 1257
     *:Rhapsody:*:*)
1255
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1258
+	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
1256 1259
 	exit ;;
1257 1260
     *:Darwin:*:*)
1258 1261
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1259
-	eval $set_cc_for_build
1262
+	eval "$set_cc_for_build"
1260 1263
 	if test "$UNAME_PROCESSOR" = unknown ; then
1261 1264
 	    UNAME_PROCESSOR=powerpc
1262 1265
 	fi
1263
-	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1264
-	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1265
-		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1266
-		grep IS_64BIT_ARCH >/dev/null
1267
-	    then
1268
-		case $UNAME_PROCESSOR in
1269
-		    i386) UNAME_PROCESSOR=x86_64 ;;
1270
-		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1271
-		esac
1266
+	if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
1267
+	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1268
+		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1269
+		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1270
+		       grep IS_64BIT_ARCH >/dev/null
1271
+		then
1272
+		    case $UNAME_PROCESSOR in
1273
+			i386) UNAME_PROCESSOR=x86_64 ;;
1274
+			powerpc) UNAME_PROCESSOR=powerpc64 ;;
1275
+		    esac
1276
+		fi
1277
+		# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1278
+		if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1279
+		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1280
+		       grep IS_PPC >/dev/null
1281
+		then
1282
+		    UNAME_PROCESSOR=powerpc
1283
+		fi
1272 1284
 	    fi
1285
+	elif test "$UNAME_PROCESSOR" = i386 ; then
1286
+	    # Avoid executing cc on OS X 10.9, as it ships with a stub
1287
+	    # that puts up a graphical alert prompting to install
1288
+	    # developer tools.  Any system running Mac OS X 10.7 or
1289
+	    # later (Darwin 11 and later) is required to have a 64-bit
1290
+	    # processor. This is not true of the ARM version of Darwin
1291
+	    # that Apple uses in portable devices.
1292
+	    UNAME_PROCESSOR=x86_64
1273 1293
 	fi
1274
-	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1294
+	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
1275 1295
 	exit ;;
1276 1296
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
1277 1297
 	UNAME_PROCESSOR=`uname -p`
1278
-	if test "$UNAME_PROCESSOR" = "x86"; then
1298
+	if test "$UNAME_PROCESSOR" = x86; then
1279 1299
 		UNAME_PROCESSOR=i386
1280 1300
 		UNAME_MACHINE=pc
1281 1301
 	fi
1282
-	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1302
+	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
1283 1303
 	exit ;;
1284 1304
     *:QNX:*:4*)
1285 1305
 	echo i386-pc-qnx
1286 1306
 	exit ;;
1287
-    NEO-?:NONSTOP_KERNEL:*:*)
1288
-	echo neo-tandem-nsk${UNAME_RELEASE}
1307
+    NEO-*:NONSTOP_KERNEL:*:*)
1308
+	echo neo-tandem-nsk"$UNAME_RELEASE"
1289 1309
 	exit ;;
1290 1310
     NSE-*:NONSTOP_KERNEL:*:*)
1291
-	echo nse-tandem-nsk${UNAME_RELEASE}
1311
+	echo nse-tandem-nsk"$UNAME_RELEASE"
1292 1312
 	exit ;;
1293
-    NSR-?:NONSTOP_KERNEL:*:*)
1294
-	echo nsr-tandem-nsk${UNAME_RELEASE}
1313
+    NSR-*:NONSTOP_KERNEL:*:*)
1314
+	echo nsr-tandem-nsk"$UNAME_RELEASE"
1315
+	exit ;;
1316
+    NSV-*:NONSTOP_KERNEL:*:*)
1317
+	echo nsv-tandem-nsk"$UNAME_RELEASE"
1318
+	exit ;;
1319
+    NSX-*:NONSTOP_KERNEL:*:*)
1320
+	echo nsx-tandem-nsk"$UNAME_RELEASE"
1295 1321
 	exit ;;
1296 1322
     *:NonStop-UX:*:*)
1297 1323
 	echo mips-compaq-nonstopux
... ...
@@ -1300,18 +1356,18 @@ EOF
1300 1300
 	echo bs2000-siemens-sysv
1301 1301
 	exit ;;
1302 1302
     DS/*:UNIX_System_V:*:*)
1303
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1303
+	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
1304 1304
 	exit ;;
1305 1305
     *:Plan9:*:*)
1306 1306
 	# "uname -m" is not consistent, so use $cputype instead. 386
1307 1307
 	# is converted to i386 for consistency with other x86
1308 1308
 	# operating systems.
1309
-	if test "$cputype" = "386"; then
1309
+	if test "$cputype" = 386; then
1310 1310
 	    UNAME_MACHINE=i386
1311 1311
 	else
1312 1312
 	    UNAME_MACHINE="$cputype"
1313 1313
 	fi
1314
-	echo ${UNAME_MACHINE}-unknown-plan9
1314
+	echo "$UNAME_MACHINE"-unknown-plan9
1315 1315
 	exit ;;
1316 1316
     *:TOPS-10:*:*)
1317 1317
 	echo pdp10-unknown-tops10
... ...
@@ -1332,14 +1388,14 @@ EOF
1332 1332
 	echo pdp10-unknown-its
1333 1333
 	exit ;;
1334 1334
     SEI:*:*:SEIUX)
1335
-	echo mips-sei-seiux${UNAME_RELEASE}
1335
+	echo mips-sei-seiux"$UNAME_RELEASE"
1336 1336
 	exit ;;
1337 1337
     *:DragonFly:*:*)
1338
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1338
+	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
1339 1339
 	exit ;;
1340 1340
     *:*VMS:*:*)
1341 1341
 	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1342
-	case "${UNAME_MACHINE}" in
1342
+	case "$UNAME_MACHINE" in
1343 1343
 	    A*) echo alpha-dec-vms ; exit ;;
1344 1344
 	    I*) echo ia64-dec-vms ; exit ;;
1345 1345
 	    V*) echo vax-dec-vms ; exit ;;
... ...
@@ -1348,182 +1404,48 @@ EOF
1348 1348
 	echo i386-pc-xenix
1349 1349
 	exit ;;
1350 1350
     i*86:skyos:*:*)
1351
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1351
+	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
1352 1352
 	exit ;;
1353 1353
     i*86:rdos:*:*)
1354
-	echo ${UNAME_MACHINE}-pc-rdos
1354
+	echo "$UNAME_MACHINE"-pc-rdos
1355 1355
 	exit ;;
1356 1356
     i*86:AROS:*:*)
1357
-	echo ${UNAME_MACHINE}-pc-aros
1357
+	echo "$UNAME_MACHINE"-pc-aros
1358 1358
 	exit ;;
1359 1359
     x86_64:VMkernel:*:*)
1360
-	echo ${UNAME_MACHINE}-unknown-esx
1360
+	echo "$UNAME_MACHINE"-unknown-esx
1361
+	exit ;;
1362
+    amd64:Isilon\ OneFS:*:*)
1363
+	echo x86_64-unknown-onefs
1361 1364
 	exit ;;
1362 1365
 esac
1363 1366
 
1364
-eval $set_cc_for_build
1365
-cat >$dummy.c <<EOF
1366
-#ifdef _SEQUENT_
1367
-# include <sys/types.h>
1368
-# include <sys/utsname.h>
1369
-#endif
1370
-main ()
1371
-{
1372
-#if defined (sony)
1373
-#if defined (MIPSEB)
1374
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1375
-     I don't know....  */
1376
-  printf ("mips-sony-bsd\n"); exit (0);
1377
-#else
1378
-#include <sys/param.h>
1379
-  printf ("m68k-sony-newsos%s\n",
1380
-#ifdef NEWSOS4
1381
-	"4"
1382
-#else
1383
-	""
1384
-#endif
1385
-	); exit (0);
1386
-#endif
1387
-#endif
1388
-
1389
-#if defined (__arm) && defined (__acorn) && defined (__unix)
1390
-  printf ("arm-acorn-riscix\n"); exit (0);
1391
-#endif
1392
-
1393
-#if defined (hp300) && !defined (hpux)
1394
-  printf ("m68k-hp-bsd\n"); exit (0);
1395
-#endif
1396
-
1397
-#if defined (NeXT)
1398
-#if !defined (__ARCHITECTURE__)
1399
-#define __ARCHITECTURE__ "m68k"
1400
-#endif
1401
-  int version;
1402
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1403
-  if (version < 4)
1404
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1405
-  else
1406
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1407
-  exit (0);
1408
-#endif
1409
-
1410
-#if defined (MULTIMAX) || defined (n16)
1411
-#if defined (UMAXV)
1412
-  printf ("ns32k-encore-sysv\n"); exit (0);
1413
-#else
1414
-#if defined (CMU)
1415
-  printf ("ns32k-encore-mach\n"); exit (0);
1416
-#else
1417
-  printf ("ns32k-encore-bsd\n"); exit (0);
1418
-#endif
1419
-#endif
1420
-#endif
1421
-
1422
-#if defined (__386BSD__)
1423
-  printf ("i386-pc-bsd\n"); exit (0);
1424
-#endif
1425
-
1426
-#if defined (sequent)
1427
-#if defined (i386)
1428
-  printf ("i386-sequent-dynix\n"); exit (0);
1429
-#endif
1430
-#if defined (ns32000)
1431
-  printf ("ns32k-sequent-dynix\n"); exit (0);
1432
-#endif
1433
-#endif
1434
-
1435
-#if defined (_SEQUENT_)
1436
-    struct utsname un;
1437
-
1438
-    uname(&un);
1439
-
1440
-    if (strncmp(un.version, "V2", 2) == 0) {
1441
-	printf ("i386-sequent-ptx2\n"); exit (0);
1442
-    }
1443
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1444
-	printf ("i386-sequent-ptx1\n"); exit (0);
1445
-    }
1446
-    printf ("i386-sequent-ptx\n"); exit (0);
1447
-
1448
-#endif
1449
-
1450
-#if defined (vax)
1451
-# if !defined (ultrix)
1452
-#  include <sys/param.h>
1453
-#  if defined (BSD)
1454
-#   if BSD == 43
1455
-      printf ("vax-dec-bsd4.3\n"); exit (0);
1456
-#   else
1457
-#    if BSD == 199006
1458
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1459
-#    else
1460
-      printf ("vax-dec-bsd\n"); exit (0);
1461
-#    endif
1462
-#   endif
1463
-#  else
1464
-    printf ("vax-dec-bsd\n"); exit (0);
1465
-#  endif
1466
-# else
1467
-    printf ("vax-dec-ultrix\n"); exit (0);
1468
-# endif
1469
-#endif
1367
+echo "$0: unable to guess system type" >&2
1470 1368
 
1471
-#if defined (alliant) && defined (i860)
1472
-  printf ("i860-alliant-bsd\n"); exit (0);
1473
-#endif
1369
+case "$UNAME_MACHINE:$UNAME_SYSTEM" in
1370
+    mips:Linux | mips64:Linux)
1371
+	# If we got here on MIPS GNU/Linux, output extra information.
1372
+	cat >&2 <<EOF
1474 1373
 
1475
-  exit (1);
1476
-}
1374
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1375
+the system type. Please install a C compiler and try again.
1477 1376
 EOF
1478
-
1479
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1480
-	{ echo "$SYSTEM_NAME"; exit; }
1481
-
1482
-# Apollos put the system type in the environment.
1483
-
1484
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1485
-
1486
-# Convex versions that predate uname can use getsysinfo(1)
1487
-
1488
-if [ -x /usr/convex/getsysinfo ]
1489
-then
1490
-    case `getsysinfo -f cpu_type` in
1491
-    c1*)
1492
-	echo c1-convex-bsd
1493
-	exit ;;
1494
-    c2*)
1495
-	if getsysinfo -f scalar_acc
1496
-	then echo c32-convex-bsd
1497
-	else echo c2-convex-bsd
1498
-	fi
1499
-	exit ;;
1500
-    c34*)
1501
-	echo c34-convex-bsd
1502
-	exit ;;
1503
-    c38*)
1504
-	echo c38-convex-bsd
1505
-	exit ;;
1506
-    c4*)
1507
-	echo c4-convex-bsd
1508
-	exit ;;
1509
-    esac
1510
-fi
1377
+	;;
1378
+esac
1511 1379
 
1512 1380
 cat >&2 <<EOF
1513
-$0: unable to guess system type
1514 1381
 
1515
-This script, last modified $timestamp, has failed to recognize
1516
-the operating system you are using. It is advised that you
1517
-download the most up to date version of the config scripts from
1382
+This script (version $timestamp), has failed to recognize the
1383
+operating system you are using. If your script is old, overwrite *all*
1384
+copies of config.guess and config.sub with the latest versions from:
1518 1385
 
1519
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1386
+  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
1520 1387
 and
1521
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1388
+  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
1522 1389
 
1523
-If the version you run ($0) is already up to date, please
1524
-send the following data and any information you think might be
1525
-pertinent to <config-patches@gnu.org> in order to provide the needed
1526
-information to handle your system.
1390
+If $0 has already been updated, send the following data and any
1391
+information you think might be pertinent to config-patches@gnu.org to
1392
+provide the necessary information to handle your system.
1527 1393
 
1528 1394
 config.guess timestamp = $timestamp
1529 1395
 
... ...
@@ -1542,16 +1464,16 @@ hostinfo               = `(hostinfo) 2>/dev/null`
1542 1542
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1543 1543
 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1544 1544
 
1545
-UNAME_MACHINE = ${UNAME_MACHINE}
1546
-UNAME_RELEASE = ${UNAME_RELEASE}
1547
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
1548
-UNAME_VERSION = ${UNAME_VERSION}
1545
+UNAME_MACHINE = "$UNAME_MACHINE"
1546
+UNAME_RELEASE = "$UNAME_RELEASE"
1547
+UNAME_SYSTEM  = "$UNAME_SYSTEM"
1548
+UNAME_VERSION = "$UNAME_VERSION"
1549 1549
 EOF
1550 1550
 
1551 1551
 exit 1
1552 1552
 
1553 1553
 # Local variables:
1554
-# eval: (add-hook 'write-file-hooks 'time-stamp)
1554
+# eval: (add-hook 'write-file-functions 'time-stamp)
1555 1555
 # time-stamp-start: "timestamp='"
1556 1556
 # time-stamp-format: "%:y-%02m-%02d"
1557 1557
 # time-stamp-end: "'"
... ...
@@ -21,6 +21,9 @@
21 21
 /* Define to 1 if you have the <memory.h> header file. */
22 22
 #undef HAVE_MEMORY_H
23 23
 
24
+/* Define to 1 if you have the `mkdir' function. */
25
+#undef HAVE_MKDIR
26
+
24 27
 /* Define to 1 if you have the <stdint.h> header file. */
25 28
 #undef HAVE_STDINT_H
26 29
 
... ...
@@ -51,9 +54,15 @@
51 51
 /* Define to 1 if you have the <wctype.h> header file. */
52 52
 #undef HAVE_WCTYPE_H
53 53
 
54
+/* Define to 1 if you have the `_mkdir' function. */
55
+#undef HAVE__MKDIR
56
+
54 57
 /* Define to the sub-directory where libtool stores uninstalled libraries. */
55 58
 #undef LT_OBJDIR
56 59
 
60
+/* Define if mkdir takes only one argument. */
61
+#undef MKDIR_TAKES_ONE_ARG
62
+
57 63
 /* Name of package */
58 64
 #undef PACKAGE
59 65
 
... ...
@@ -1,8 +1,8 @@
1 1
 #! /bin/sh
2 2
 # Configuration validation subroutine script.
3
-#   Copyright 1992-2013 Free Software Foundation, Inc.
3
+#   Copyright 1992-2018 Free Software Foundation, Inc.
4 4
 
5
-timestamp='2013-08-10'
5
+timestamp='2018-02-22'
6 6
 
7 7
 # This file is free software; you can redistribute it and/or modify it
8 8
 # under the terms of the GNU General Public License as published by
... ...
@@ -15,7 +15,7 @@ timestamp='2013-08-10'
15 15
 # General Public License for more details.
16 16
 #
17 17
 # You should have received a copy of the GNU General Public License
18
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
18
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
19 19
 #
20 20
 # As a special exception to the GNU General Public License, if you
21 21
 # distribute this file as part of a program that contains a
... ...
@@ -25,7 +25,7 @@ timestamp='2013-08-10'
25 25
 # of the GNU General Public License, version 3 ("GPLv3").
26 26
 
27 27
 
28
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
28
+# Please send patches to <config-patches@gnu.org>.
29 29
 #
30 30
 # Configuration subroutine to validate and canonicalize a configuration type.
31 31
 # Supply the specified configuration type as an argument.
... ...
@@ -33,7 +33,7 @@ timestamp='2013-08-10'
33 33
 # Otherwise, we print the canonical config type on stdout and succeed.
34 34
 
35 35
 # You can get the latest version of this script from:
36
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
36
+# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
37 37
 
38 38
 # This file is supposed to be the same for all GNU packages
39 39
 # and recognize all the CPU types, system types and aliases
... ...
@@ -53,12 +53,11 @@ timestamp='2013-08-10'
53 53
 me=`echo "$0" | sed -e 's,.*/,,'`
54 54
 
55 55
 usage="\
56
-Usage: $0 [OPTION] CPU-MFR-OPSYS
57
-       $0 [OPTION] ALIAS
56
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
58 57
 
59 58
 Canonicalize a configuration name.
60 59
 
61
-Operation modes:
60
+Options:
62 61
   -h, --help         print this help, then exit
63 62
   -t, --time-stamp   print date of last modification, then exit
64 63
   -v, --version      print version number, then exit
... ...
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
68 68
 version="\
69 69
 GNU config.sub ($timestamp)
70 70
 
71
-Copyright 1992-2013 Free Software Foundation, Inc.
71
+Copyright 1992-2018 Free Software Foundation, Inc.
72 72
 
73 73
 This is free software; see the source for copying conditions.  There is NO
74 74
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
... ...
@@ -95,7 +94,7 @@ while test $# -gt 0 ; do
95 95
 
96 96
     *local*)
97 97
        # First pass through any local machine types.
98
-       echo $1
98
+       echo "$1"
99 99
        exit ;;
100 100
 
101 101
     * )
... ...
@@ -113,24 +112,24 @@ esac
113 113
 
114 114
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
115 115
 # Here we must recognize all the valid KERNEL-OS combinations.
116
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
116
+maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
117 117
 case $maybe_os in
118 118
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
119 119
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
120
-  knetbsd*-gnu* | netbsd*-gnu* | \
121
-  kopensolaris*-gnu* | \
120
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
121
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
122 122
   storm-chaos* | os2-emx* | rtmk-nova*)
123 123
     os=-$maybe_os
124
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
124
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
125 125
     ;;
126 126
   android-linux)
127 127
     os=-linux-android
128
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
128
+    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
129 129
     ;;
130 130
   *)
131
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
132
-    if [ $basic_machine != $1 ]
133
-    then os=`echo $1 | sed 's/.*-/-/'`
131
+    basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
132
+    if [ "$basic_machine" != "$1" ]
133
+    then os=`echo "$1" | sed 's/.*-/-/'`
134 134
     else os=; fi
135 135
     ;;
136 136
 esac
... ...
@@ -179,44 +178,44 @@ case $os in
179 179
 		;;
180 180
 	-sco6)
181 181
 		os=-sco5v6
182
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
182
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
183 183
 		;;
184 184
 	-sco5)
185 185
 		os=-sco3.2v5
186
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
186
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
187 187
 		;;
188 188
 	-sco4)
189 189
 		os=-sco3.2v4
190
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
190
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
191 191
 		;;
192 192
 	-sco3.2.[4-9]*)
193 193
 		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
194
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
194
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
195 195
 		;;
196 196
 	-sco3.2v[4-9]*)
197 197
 		# Don't forget version if it is 3.2v4 or newer.
198
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
198
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
199 199
 		;;
200 200
 	-sco5v6*)
201 201
 		# Don't forget version if it is 3.2v4 or newer.
202
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
202
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
203 203
 		;;
204 204
 	-sco*)
205 205
 		os=-sco3.2v2
206
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
206
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
207 207
 		;;
208 208
 	-udk*)
209
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
209
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
210 210
 		;;
211 211
 	-isc)
212 212
 		os=-isc2.2
213
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
213
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
214 214
 		;;
215 215
 	-clix*)
216 216
 		basic_machine=clipper-intergraph
217 217
 		;;
218 218
 	-isc*)
219
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
219
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
220 220
 		;;
221 221
 	-lynx*178)
222 222
 		os=-lynxos178
... ...
@@ -228,10 +227,7 @@ case $os in
228 228
 		os=-lynxos
229 229
 		;;
230 230
 	-ptx*)
231
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
232
-		;;
233
-	-windowsnt*)
234
-		os=`echo $os | sed -e 's/windowsnt/winnt/'`
231
+		basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
235 232
 		;;
236 233
 	-psos*)
237 234
 		os=-psos
... ...
@@ -255,16 +251,18 @@ case $basic_machine in
255 255
 	| arc | arceb \
256 256
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
257 257
 	| avr | avr32 \
258
+	| ba \
258 259
 	| be32 | be64 \
259 260
 	| bfin \
260 261
 	| c4x | c8051 | clipper \
261 262
 	| d10v | d30v | dlx | dsp16xx \
262
-	| epiphany \
263
-	| fido | fr30 | frv \
263
+	| e2k | epiphany \
264
+	| fido | fr30 | frv | ft32 \
264 265
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
265 266
 	| hexagon \
266
-	| i370 | i860 | i960 | ia64 \
267
+	| i370 | i860 | i960 | ia16 | ia64 \
267 268
 	| ip2k | iq2000 \
269
+	| k1om \
268 270
 	| le32 | le64 \
269 271
 	| lm32 \
270 272
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
... ...
@@ -282,8 +280,10 @@ case $basic_machine in
282 282
 	| mips64vr5900 | mips64vr5900el \
283 283
 	| mipsisa32 | mipsisa32el \
284 284
 	| mipsisa32r2 | mipsisa32r2el \
285
+	| mipsisa32r6 | mipsisa32r6el \
285 286
 	| mipsisa64 | mipsisa64el \
286 287
 	| mipsisa64r2 | mipsisa64r2el \
288
+	| mipsisa64r6 | mipsisa64r6el \
287 289
 	| mipsisa64sb1 | mipsisa64sb1el \
288 290
 	| mipsisa64sr71k | mipsisa64sr71kel \
289 291
 	| mipsr5900 | mipsr5900el \
... ...
@@ -295,14 +295,15 @@ case $basic_machine in
295 295
 	| nds32 | nds32le | nds32be \
296 296
 	| nios | nios2 | nios2eb | nios2el \
297 297
 	| ns16k | ns32k \
298
-	| open8 \
299
-	| or1k | or32 \
300
-	| pdp10 | pdp11 | pj | pjl \
298
+	| open8 | or1k | or1knd | or32 \
299
+	| pdp10 | pj | pjl \
301 300
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
301
+	| pru \
302 302
 	| pyramid \
303
+	| riscv32 | riscv64 \
303 304
 	| rl78 | rx \
304 305
 	| score \
305
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
306
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
306 307
 	| sh64 | sh64le \
307 308
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
308 309
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
... ...
@@ -310,7 +311,8 @@ case $basic_machine in
310 310
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
311 311
 	| ubicom32 \
312 312
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
313
-	| we32k \
313
+	| visium \
314
+	| wasm32 \
314 315
 	| x86 | xc16x | xstormy16 | xtensa \
315 316
 	| z8k | z80)
316 317
 		basic_machine=$basic_machine-unknown
... ...
@@ -324,11 +326,14 @@ case $basic_machine in
324 324
 	c6x)
325 325
 		basic_machine=tic6x-unknown
326 326
 		;;
327
-	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
327
+	leon|leon[3-9])
328
+		basic_machine=sparc-$basic_machine
329
+		;;
330
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
328 331
 		basic_machine=$basic_machine-unknown
329 332
 		os=-none
330 333
 		;;
331
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
334
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
332 335
 		;;
333 336
 	ms1)
334 337
 		basic_machine=mt-unknown
... ...
@@ -357,7 +362,7 @@ case $basic_machine in
357 357
 	  ;;
358 358
 	# Object if more than one company name word.
359 359
 	*-*-*)
360
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
360
+		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
361 361
 		exit 1
362 362
 		;;
363 363
 	# Recognize the basic CPU types with company name.
... ...
@@ -369,18 +374,20 @@ case $basic_machine in
369 369
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
370 370
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
371 371
 	| avr-* | avr32-* \
372
+	| ba-* \
372 373
 	| be32-* | be64-* \
373 374
 	| bfin-* | bs2000-* \
374 375
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
375 376
 	| c8051-* | clipper-* | craynv-* | cydra-* \
376 377
 	| d10v-* | d30v-* | dlx-* \
377
-	| elxsi-* \
378
+	| e2k-* | elxsi-* \
378 379
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
379 380
 	| h8300-* | h8500-* \
380 381
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
381 382
 	| hexagon-* \
382
-	| i*86-* | i860-* | i960-* | ia64-* \
383
+	| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
383 384
 	| ip2k-* | iq2000-* \
385
+	| k1om-* \
384 386
 	| le32-* | le64-* \
385 387
 	| lm32-* \
386 388
 	| m32c-* | m32r-* | m32rle-* \
... ...
@@ -400,8 +407,10 @@ case $basic_machine in
400 400
 	| mips64vr5900-* | mips64vr5900el-* \
401 401
 	| mipsisa32-* | mipsisa32el-* \
402 402
 	| mipsisa32r2-* | mipsisa32r2el-* \
403
+	| mipsisa32r6-* | mipsisa32r6el-* \
403 404
 	| mipsisa64-* | mipsisa64el-* \
404 405
 	| mipsisa64r2-* | mipsisa64r2el-* \
406
+	| mipsisa64r6-* | mipsisa64r6el-* \
405 407
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
406 408
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
407 409
 	| mipsr5900-* | mipsr5900el-* \
... ...
@@ -413,16 +422,19 @@ case $basic_machine in
413 413
 	| nios-* | nios2-* | nios2eb-* | nios2el-* \
414 414
 	| none-* | np1-* | ns16k-* | ns32k-* \
415 415
 	| open8-* \
416
+	| or1k*-* \
416 417
 	| orion-* \
417 418
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
418 419
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
420
+	| pru-* \
419 421
 	| pyramid-* \
422
+	| riscv32-* | riscv64-* \
420 423
 	| rl78-* | romp-* | rs6000-* | rx-* \
421 424
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
422 425
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
423 426
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
424 427
 	| sparclite-* \
425
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
428
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
426 429
 	| tahoe-* \
427 430
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
428 431
 	| tile*-* \
... ...
@@ -430,6 +442,8 @@ case $basic_machine in
430 430
 	| ubicom32-* \
431 431
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
432 432
 	| vax-* \
433
+	| visium-* \
434
+	| wasm32-* \
433 435
 	| we32k-* \
434 436
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
435 437
 	| xstormy16-* | xtensa*-* \
... ...
@@ -443,7 +457,7 @@ case $basic_machine in
443 443
 	# Recognize the various machine names and aliases which stand
444 444
 	# for a CPU type and a company and sometimes even an OS.
445 445
 	386bsd)
446
-		basic_machine=i386-unknown
446
+		basic_machine=i386-pc
447 447
 		os=-bsd
448 448
 		;;
449 449
 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
... ...
@@ -477,7 +491,7 @@ case $basic_machine in
477 477
 		basic_machine=x86_64-pc
478 478
 		;;
479 479
 	amd64-*)
480
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
480
+		basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
481 481
 		;;
482 482
 	amdahl)
483 483
 		basic_machine=580-amdahl
... ...
@@ -506,6 +520,9 @@ case $basic_machine in
506 506
 		basic_machine=i386-pc
507 507
 		os=-aros
508 508
 		;;
509
+	asmjs)
510
+		basic_machine=asmjs-unknown
511
+		;;
509 512
 	aux)
510 513
 		basic_machine=m68k-apple
511 514
 		os=-aux
... ...
@@ -519,7 +536,7 @@ case $basic_machine in
519 519
 		os=-linux
520 520
 		;;
521 521
 	blackfin-*)
522
-		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
522
+		basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
523 523
 		os=-linux
524 524
 		;;
525 525
 	bluegene*)
... ...
@@ -527,13 +544,13 @@ case $basic_machine in
527 527
 		os=-cnk
528 528
 		;;
529 529
 	c54x-*)
530
-		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
530
+		basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
531 531
 		;;
532 532
 	c55x-*)
533
-		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
533
+		basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
534 534
 		;;
535 535
 	c6x-*)
536
-		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
536
+		basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
537 537
 		;;
538 538
 	c90)
539 539
 		basic_machine=c90-cray
... ...
@@ -622,10 +639,18 @@ case $basic_machine in
622 622
 		basic_machine=rs6000-bull
623 623
 		os=-bosx
624 624
 		;;
625
-	dpx2* | dpx2*-bull)
625
+	dpx2*)
626 626
 		basic_machine=m68k-bull
627 627
 		os=-sysv3
628 628
 		;;
629
+	e500v[12])
630
+		basic_machine=powerpc-unknown
631
+		os=$os"spe"
632
+		;;
633
+	e500v[12]-*)
634
+		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
635
+		os=$os"spe"
636
+		;;
629 637
 	ebmon29k)
630 638
 		basic_machine=a29k-amd
631 639
 		os=-ebmon
... ...
@@ -715,9 +740,6 @@ case $basic_machine in
715 715
 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
716 716
 		basic_machine=hppa1.0-hp
717 717
 		;;
718
-	hppa-next)
719
-		os=-nextstep3
720
-		;;
721 718
 	hppaosf)
722 719
 		basic_machine=hppa1.1-hp
723 720
 		os=-osf
... ...
@@ -730,26 +752,26 @@ case $basic_machine in
730 730
 		basic_machine=i370-ibm
731 731
 		;;
732 732
 	i*86v32)
733
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
733
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
734 734
 		os=-sysv32
735 735
 		;;
736 736
 	i*86v4*)
737
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
737
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
738 738
 		os=-sysv4
739 739
 		;;
740 740
 	i*86v)
741
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
741
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
742 742
 		os=-sysv
743 743
 		;;
744 744
 	i*86sol2)
745
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
745
+		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
746 746
 		os=-solaris2
747 747
 		;;
748 748
 	i386mach)
749 749
 		basic_machine=i386-mach
750 750
 		os=-mach
751 751
 		;;
752
-	i386-vsta | vsta)
752
+	vsta)
753 753
 		basic_machine=i386-unknown
754 754
 		os=-vsta
755 755
 		;;
... ...
@@ -767,17 +789,17 @@ case $basic_machine in
767 767
 		basic_machine=m68k-isi
768 768
 		os=-sysv
769 769
 		;;
770
+	leon-*|leon[3-9]-*)
771
+		basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
772
+		;;
770 773
 	m68knommu)
771 774
 		basic_machine=m68k-unknown
772 775
 		os=-linux
773 776
 		;;
774 777
 	m68knommu-*)
775
-		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
778
+		basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
776 779
 		os=-linux
777 780
 		;;
778
-	m88k-omron*)
779
-		basic_machine=m88k-omron
780
-		;;
781 781
 	magnum | m3230)
782 782
 		basic_machine=mips-mips
783 783
 		os=-sysv
... ...
@@ -809,10 +831,10 @@ case $basic_machine in
809 809
 		os=-mint
810 810
 		;;
811 811
 	mips3*-*)
812
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
812
+		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
813 813
 		;;
814 814
 	mips3*)
815
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
815
+		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
816 816
 		;;
817 817
 	monitor)
818 818
 		basic_machine=m68k-rom68k
... ...
@@ -822,12 +844,16 @@ case $basic_machine in
822 822
 		basic_machine=powerpc-unknown
823 823
 		os=-morphos
824 824
 		;;
825
+	moxiebox)
826
+		basic_machine=moxie-unknown
827
+		os=-moxiebox
828
+		;;
825 829
 	msdos)
826 830
 		basic_machine=i386-pc
827 831
 		os=-msdos
828 832
 		;;
829 833
 	ms1-*)
830
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
834
+		basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
831 835
 		;;
832 836
 	msys)
833 837
 		basic_machine=i686-pc
... ...
@@ -869,7 +895,7 @@ case $basic_machine in
869 869
 		basic_machine=v70-nec
870 870
 		os=-sysv
871 871
 		;;
872
-	next | m*-next )
872
+	next | m*-next)
873 873
 		basic_machine=m68k-next
874 874
 		case $os in
875 875
 		    -nextstep* )
... ...
@@ -914,6 +940,12 @@ case $basic_machine in
914 914
 	nsr-tandem)
915 915
 		basic_machine=nsr-tandem
916 916
 		;;
917
+	nsv-tandem)
918
+		basic_machine=nsv-tandem
919
+		;;
920
+	nsx-tandem)
921
+		basic_machine=nsx-tandem
922
+		;;
917 923
 	op50n-* | op60c-*)
918 924
 		basic_machine=hppa1.1-oki
919 925
 		os=-proelf
... ...
@@ -946,7 +978,7 @@ case $basic_machine in
946 946
 		os=-linux
947 947
 		;;
948 948
 	parisc-*)
949
-		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
949
+		basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
950 950
 		os=-linux
951 951
 		;;
952 952
 	pbd)
... ...
@@ -962,7 +994,7 @@ case $basic_machine in
962 962
 		basic_machine=i386-pc
963 963
 		;;
964 964
 	pc98-*)
965
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
965
+		basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
966 966
 		;;
967 967
 	pentium | p5 | k5 | k6 | nexgen | viac3)
968 968
 		basic_machine=i586-pc
... ...
@@ -977,16 +1009,16 @@ case $basic_machine in
977 977
 		basic_machine=i786-pc
978 978
 		;;
979 979
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
980
-		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
980
+		basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
981 981
 		;;
982 982
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
983
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
983
+		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
984 984
 		;;
985 985
 	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
986
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
986
+		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
987 987
 		;;
988 988
 	pentium4-*)
989
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
989
+		basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
990 990
 		;;
991 991
 	pn)
992 992
 		basic_machine=pn-gould
... ...
@@ -996,23 +1028,23 @@ case $basic_machine in
996 996
 	ppc | ppcbe)	basic_machine=powerpc-unknown
997 997
 		;;
998 998
 	ppc-* | ppcbe-*)
999
-		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
999
+		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1000 1000
 		;;
1001
-	ppcle | powerpclittle | ppc-le | powerpc-little)
1001
+	ppcle | powerpclittle)
1002 1002
 		basic_machine=powerpcle-unknown
1003 1003
 		;;
1004 1004
 	ppcle-* | powerpclittle-*)
1005
-		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
1005
+		basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1006 1006
 		;;
1007 1007
 	ppc64)	basic_machine=powerpc64-unknown
1008 1008
 		;;
1009
-	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
1009
+	ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1010 1010
 		;;
1011
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
1011
+	ppc64le | powerpc64little)
1012 1012
 		basic_machine=powerpc64le-unknown
1013 1013
 		;;
1014 1014
 	ppc64le-* | powerpc64little-*)
1015
-		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
1015
+		basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1016 1016
 		;;
1017 1017
 	ps2)
1018 1018
 		basic_machine=i386-ibm
... ...
@@ -1066,17 +1098,10 @@ case $basic_machine in
1066 1066
 	sequent)
1067 1067
 		basic_machine=i386-sequent
1068 1068
 		;;
1069
-	sh)
1070
-		basic_machine=sh-hitachi
1071
-		os=-hms
1072
-		;;
1073 1069
 	sh5el)
1074 1070
 		basic_machine=sh5le-unknown
1075 1071
 		;;
1076
-	sh64)
1077
-		basic_machine=sh64-unknown
1078
-		;;
1079
-	sparclite-wrs | simso-wrs)
1072
+	simso-wrs)
1080 1073
 		basic_machine=sparclite-wrs
1081 1074
 		os=-vxworks
1082 1075
 		;;
... ...
@@ -1095,7 +1120,7 @@ case $basic_machine in
1095 1095
 		os=-sysv4
1096 1096
 		;;
1097 1097
 	strongarm-* | thumb-*)
1098
-		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
1098
+		basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1099 1099
 		;;
1100 1100
 	sun2)
1101 1101
 		basic_machine=m68000-sun
... ...
@@ -1217,6 +1242,9 @@ case $basic_machine in
1217 1217
 		basic_machine=hppa1.1-winbond
1218 1218
 		os=-proelf
1219 1219
 		;;
1220
+	x64)
1221
+		basic_machine=x86_64-pc
1222
+		;;
1220 1223
 	xbox)
1221 1224
 		basic_machine=i686-pc
1222 1225
 		os=-mingw32
... ...
@@ -1225,20 +1253,12 @@ case $basic_machine in
1225 1225
 		basic_machine=xps100-honeywell
1226 1226
 		;;
1227 1227
 	xscale-* | xscalee[bl]-*)
1228
-		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
1228
+		basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
1229 1229
 		;;
1230 1230
 	ymp)
1231 1231
 		basic_machine=ymp-cray
1232 1232
 		os=-unicos
1233 1233
 		;;
1234
-	z8k-*-coff)
1235
-		basic_machine=z8k-unknown
1236
-		os=-sim
1237
-		;;
1238
-	z80-*-coff)
1239
-		basic_machine=z80-unknown
1240
-		os=-sim
1241
-		;;
1242 1234
 	none)
1243 1235
 		basic_machine=none-none
1244 1236
 		os=-none
... ...
@@ -1267,10 +1287,6 @@ case $basic_machine in
1267 1267
 	vax)
1268 1268
 		basic_machine=vax-dec
1269 1269
 		;;
1270
-	pdp10)
1271
-		# there are many clones, so DEC is not a safe bet
1272
-		basic_machine=pdp10-unknown
1273
-		;;
1274 1270
 	pdp11)
1275 1271
 		basic_machine=pdp11-dec
1276 1272
 		;;
... ...
@@ -1280,9 +1296,6 @@ case $basic_machine in
1280 1280
 	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
1281 1281
 		basic_machine=sh-unknown
1282 1282
 		;;
1283
-	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1284
-		basic_machine=sparc-sun
1285
-		;;
1286 1283
 	cydra)
1287 1284
 		basic_machine=cydra-cydrome
1288 1285
 		;;
... ...
@@ -1302,7 +1315,7 @@ case $basic_machine in
1302 1302
 		# Make sure to match an already-canonicalized machine name.
1303 1303
 		;;
1304 1304
 	*)
1305
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1305
+		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
1306 1306
 		exit 1
1307 1307
 		;;
1308 1308
 esac
... ...
@@ -1310,10 +1323,10 @@ esac
1310 1310
 # Here we canonicalize certain aliases for manufacturers.
1311 1311
 case $basic_machine in
1312 1312
 	*-digital*)
1313
-		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1313
+		basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
1314 1314
 		;;
1315 1315
 	*-commodore*)
1316
-		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1316
+		basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
1317 1317
 		;;
1318 1318
 	*)
1319 1319
 		;;
... ...
@@ -1324,8 +1337,8 @@ esac
1324 1324
 if [ x"$os" != x"" ]
1325 1325
 then
1326 1326
 case $os in
1327
-	# First match some system type aliases
1328
-	# that might get confused with valid system types.
1327
+	# First match some system type aliases that might get confused
1328
+	# with valid system types.
1329 1329
 	# -solaris* is a basic system type, with this one exception.
1330 1330
 	-auroraux)
1331 1331
 		os=-auroraux
... ...
@@ -1336,45 +1349,48 @@ case $os in
1336 1336
 	-solaris)
1337 1337
 		os=-solaris2
1338 1338
 		;;
1339
-	-svr4*)
1340
-		os=-sysv4
1341
-		;;
1342 1339
 	-unixware*)
1343 1340
 		os=-sysv4.2uw
1344 1341
 		;;
1345 1342
 	-gnu/linux*)
1346 1343
 		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1347 1344
 		;;
1348
-	# First accept the basic system types.
1345
+	# es1800 is here to avoid being matched by es* (a different OS)
1346
+	-es1800*)
1347
+		os=-ose
1348
+		;;
1349
+	# Now accept the basic system types.
1349 1350
 	# The portable systems comes first.
1350
-	# Each alternative MUST END IN A *, to match a version number.
1351
+	# Each alternative MUST end in a * to match a version number.
1351 1352
 	# -sysv* is not here because it comes later, after sysvr4.
1352 1353
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1353 1354
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
1354 1355
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
1355 1356
 	      | -sym* | -kopensolaris* | -plan9* \
1356 1357
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1357
-	      | -aos* | -aros* \
1358
+	      | -aos* | -aros* | -cloudabi* | -sortix* \
1358 1359
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1359 1360
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1360
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1361
-	      | -bitrig* | -openbsd* | -solidbsd* \
1361
+	      | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
1362
+	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
1362 1363
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1363 1364
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1364 1365
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1365 1366
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1366
-	      | -chorusos* | -chorusrdb* | -cegcc* \
1367
+	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
1367 1368
 	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1368
-	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
1369
+	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
1369 1370
 	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
1370
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
1371
-	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1371
+	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
1372
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
1372 1373
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1373 1374
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1374 1375
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1375
-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1376
+	      | -morphos* | -superux* | -rtmk* | -windiss* \
1376 1377
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1377
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
1378
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
1379
+	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
1380
+	      | -midnightbsd*)
1378 1381
 	# Remember, each alternative MUST END IN *, to match a version number.
1379 1382
 		;;
1380 1383
 	-qnx*)
... ...
@@ -1391,12 +1407,12 @@ case $os in
1391 1391
 	-nto*)
1392 1392
 		os=`echo $os | sed -e 's|nto|nto-qnx|'`
1393 1393
 		;;
1394
-	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1395
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1394
+	-sim | -xray | -os68k* | -v88r* \
1395
+	      | -windows* | -osx | -abug | -netware* | -os9* \
1396 1396
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1397 1397
 		;;
1398 1398
 	-mac*)
1399
-		os=`echo $os | sed -e 's|mac|macos|'`
1399
+		os=`echo "$os" | sed -e 's|mac|macos|'`
1400 1400
 		;;
1401 1401
 	-linux-dietlibc)
1402 1402
 		os=-linux-dietlibc
... ...
@@ -1405,10 +1421,10 @@ case $os in
1405 1405
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
1406 1406
 		;;
1407 1407
 	-sunos5*)
1408
-		os=`echo $os | sed -e 's|sunos5|solaris2|'`
1408
+		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1409 1409
 		;;
1410 1410
 	-sunos6*)
1411
-		os=`echo $os | sed -e 's|sunos6|solaris3|'`
1411
+		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1412 1412
 		;;
1413 1413
 	-opened*)
1414 1414
 		os=-openedition
... ...
@@ -1419,12 +1435,6 @@ case $os in
1419 1419
 	-wince*)
1420 1420
 		os=-wince
1421 1421
 		;;
1422
-	-osfrose*)
1423
-		os=-osfrose
1424
-		;;
1425
-	-osf*)
1426
-		os=-osf
1427
-		;;
1428 1422
 	-utek*)
1429 1423
 		os=-bsd
1430 1424
 		;;
... ...
@@ -1449,7 +1459,7 @@ case $os in
1449 1449
 	-nova*)
1450 1450
 		os=-rtmk-nova
1451 1451
 		;;
1452
-	-ns2 )
1452
+	-ns2)
1453 1453
 		os=-nextstep2
1454 1454
 		;;
1455 1455
 	-nsk*)
... ...
@@ -1471,7 +1481,7 @@ case $os in
1471 1471
 	-oss*)
1472 1472
 		os=-sysv3
1473 1473
 		;;
1474
-	-svr4)
1474
+	-svr4*)
1475 1475
 		os=-sysv4
1476 1476
 		;;
1477 1477
 	-svr3)
... ...
@@ -1486,32 +1496,38 @@ case $os in
1486 1486
 	-ose*)
1487 1487
 		os=-ose
1488 1488
 		;;
1489
-	-es1800*)
1490
-		os=-ose
1491
-		;;
1492
-	-xenix)
1493
-		os=-xenix
1494
-		;;
1495 1489
 	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1496 1490
 		os=-mint
1497 1491
 		;;
1498
-	-aros*)
1499
-		os=-aros
1500
-		;;
1501 1492
 	-zvmoe)
1502 1493
 		os=-zvmoe
1503 1494
 		;;
1504 1495
 	-dicos*)
1505 1496
 		os=-dicos
1506 1497
 		;;
1498
+	-pikeos*)
1499
+		# Until real need of OS specific support for
1500
+		# particular features comes up, bare metal
1501
+		# configurations are quite functional.
1502
+		case $basic_machine in
1503
+		    arm*)
1504
+			os=-eabi
1505
+			;;
1506
+		    *)
1507
+			os=-elf
1508
+			;;
1509
+		esac
1510
+		;;
1507 1511
 	-nacl*)
1508 1512
 		;;
1513
+	-ios)
1514
+		;;
1509 1515
 	-none)
1510 1516
 		;;
1511 1517
 	*)
1512 1518
 		# Get rid of the `-' at the beginning of $os.
1513 1519
 		os=`echo $os | sed 's/[^-]*-//'`
1514
-		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1520
+		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
1515 1521
 		exit 1
1516 1522
 		;;
1517 1523
 esac
... ...
@@ -1592,9 +1608,6 @@ case $basic_machine in
1592 1592
 	mips*-*)
1593 1593
 		os=-elf
1594 1594
 		;;
1595
-	or1k-*)
1596
-		os=-elf
1597
-		;;
1598 1595
 	or32-*)
1599 1596
 		os=-coff
1600 1597
 		;;
... ...
@@ -1604,12 +1617,12 @@ case $basic_machine in
1604 1604
 	sparc-* | *-sun)
1605 1605
 		os=-sunos4.1.1
1606 1606
 		;;
1607
+	pru-*)
1608
+		os=-elf
1609
+		;;
1607 1610
 	*-be)
1608 1611
 		os=-beos
1609 1612
 		;;
1610
-	*-haiku)
1611
-		os=-haiku
1612
-		;;
1613 1613
 	*-ibm)
1614 1614
 		os=-aix
1615 1615
 		;;
... ...
@@ -1649,7 +1662,7 @@ case $basic_machine in
1649 1649
 	m88k-omron*)
1650 1650
 		os=-luna
1651 1651
 		;;
1652
-	*-next )
1652
+	*-next)
1653 1653
 		os=-nextstep
1654 1654
 		;;
1655 1655
 	*-sequent)
... ...
@@ -1664,9 +1677,6 @@ case $basic_machine in
1664 1664
 	i370-*)
1665 1665
 		os=-mvs
1666 1666
 		;;
1667
-	*-next)
1668
-		os=-nextstep3
1669
-		;;
1670 1667
 	*-gould)
1671 1668
 		os=-sysv
1672 1669
 		;;
... ...
@@ -1776,15 +1786,15 @@ case $basic_machine in
1776 1776
 				vendor=stratus
1777 1777
 				;;
1778 1778
 		esac
1779
-		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1779
+		basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
1780 1780
 		;;
1781 1781
 esac
1782 1782
 
1783
-echo $basic_machine$os
1783
+echo "$basic_machine$os"
1784 1784
 exit
1785 1785
 
1786 1786
 # Local variables:
1787
-# eval: (add-hook 'write-file-hooks 'time-stamp)
1787
+# eval: (add-hook 'write-file-functions 'time-stamp)
1788 1788
 # time-stamp-start: "timestamp='"
1789 1789
 # time-stamp-format: "%:y-%02m-%02d"
1790 1790
 # time-stamp-end: "'"
... ...
@@ -1,8 +1,8 @@
1 1
 #! /bin/sh
2 2
 # Guess values for system-dependent variables and create Makefiles.
3
-# Generated by GNU Autoconf 2.69 for libmspack 0.5alpha.
3
+# Generated by GNU Autoconf 2.69 for libmspack 0.7.1alpha.
4 4
 #
5
-# Report bugs to <kyzer@4u.net>.
5
+# Report bugs to <kyzer@cabextract.org.uk>.
6 6
 #
7 7
 #
8 8
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
... ...
@@ -274,10 +274,11 @@ fi
274 274
     $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
275 275
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
276 276
   else
277
-    $as_echo "$0: Please tell bug-autoconf@gnu.org and kyzer@4u.net about
278
-$0: your system, including any error possibly output before
279
-$0: this message. Then install a modern shell, or manually
280
-$0: run the script under such a shell if you do have one."
277
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
278
+$0: kyzer@cabextract.org.uk about your system, including
279
+$0: any error possibly output before this message. Then
280
+$0: install a modern shell, or manually run the script
281
+$0: under such a shell if you do have one."
281 282
   fi
282 283
   exit 1
283 284
 fi
... ...
@@ -589,9 +590,9 @@ MAKEFLAGS=
589 589
 # Identity of this package.
590 590
 PACKAGE_NAME='libmspack'
591 591
 PACKAGE_TARNAME='libmspack'
592
-PACKAGE_VERSION='0.5alpha'
593
-PACKAGE_STRING='libmspack 0.5alpha'
594
-PACKAGE_BUGREPORT='kyzer@4u.net'
592
+PACKAGE_VERSION='0.7.1alpha'
593
+PACKAGE_STRING='libmspack 0.7.1alpha'
594
+PACKAGE_BUGREPORT='kyzer@cabextract.org.uk'
595 595
 PACKAGE_URL=''
596 596
 
597 597
 ac_unique_file="mspack/mspack.h"
... ...
@@ -644,8 +645,6 @@ NMEDIT
644 644
 DSYMUTIL
645 645
 MANIFEST_TOOL
646 646
 RANLIB
647
-ac_ct_AR
648
-AR
649 647
 DLLTOOL
650 648
 OBJDUMP
651 649
 LN_S
... ...
@@ -666,6 +665,8 @@ build_vendor
666 666
 build_cpu
667 667
 build
668 668
 LIBTOOL
669
+ac_ct_AR
670
+AR
669 671
 GCC_FALSE
670 672
 GCC_TRUE
671 673
 am__fastdepCC_FALSE
... ...
@@ -687,9 +688,6 @@ CFLAGS
687 687
 CC
688 688
 DEBUG_FALSE
689 689
 DEBUG_TRUE
690
-MAINT
691
-MAINTAINER_MODE_FALSE
692
-MAINTAINER_MODE_TRUE
693 690
 AM_BACKSLASH
694 691
 AM_DEFAULT_VERBOSITY
695 692
 AM_DEFAULT_V
... ...
@@ -736,6 +734,7 @@ infodir
736 736
 docdir
737 737
 oldincludedir
738 738
 includedir
739
+runstatedir
739 740
 localstatedir
740 741
 sharedstatedir
741 742
 sysconfdir
... ...
@@ -759,7 +758,6 @@ ac_subst_files=''
759 759
 ac_user_opts='
760 760
 enable_option_checking
761 761
 enable_silent_rules
762
-enable_maintainer_mode
763 762
 enable_debug
764 763
 enable_dependency_tracking
765 764
 enable_shared
... ...
@@ -820,6 +818,7 @@ datadir='${datarootdir}'
820 820
 sysconfdir='${prefix}/etc'
821 821
 sharedstatedir='${prefix}/com'
822 822
 localstatedir='${prefix}/var'
823
+runstatedir='${localstatedir}/run'
823 824
 includedir='${prefix}/include'
824 825
 oldincludedir='/usr/include'
825 826
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
... ...
@@ -1072,6 +1071,15 @@ do
1072 1072
   | -silent | --silent | --silen | --sile | --sil)
1073 1073
     silent=yes ;;
1074 1074
 
1075
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
1076
+  | --runstate | --runstat | --runsta | --runst | --runs \
1077
+  | --run | --ru | --r)
1078
+    ac_prev=runstatedir ;;
1079
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1080
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1081
+  | --run=* | --ru=* | --r=*)
1082
+    runstatedir=$ac_optarg ;;
1083
+
1075 1084
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
1076 1085
     ac_prev=sbindir ;;
1077 1086
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
... ...
@@ -1209,7 +1217,7 @@ fi
1209 1209
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
1210 1210
 		datadir sysconfdir sharedstatedir localstatedir includedir \
1211 1211
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1212
-		libdir localedir mandir
1212
+		libdir localedir mandir runstatedir
1213 1213
 do
1214 1214
   eval ac_val=\$$ac_var
1215 1215
   # Remove trailing slashes.
... ...
@@ -1322,7 +1330,7 @@ if test "$ac_init_help" = "long"; then
1322 1322
   # Omit some internal or obsolete options to make the list less imposing.
1323 1323
   # This message is too long to be a string in the A/UX 3.1 sh.
1324 1324
   cat <<_ACEOF
1325
-\`configure' configures libmspack 0.5alpha to adapt to many kinds of systems.
1325
+\`configure' configures libmspack 0.7.1alpha to adapt to many kinds of systems.
1326 1326
 
1327 1327
 Usage: $0 [OPTION]... [VAR=VALUE]...
1328 1328
 
... ...
@@ -1362,6 +1370,7 @@ Fine tuning of the installation directories:
1362 1362
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
1363 1363
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
1364 1364
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
1365
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
1365 1366
   --libdir=DIR            object code libraries [EPREFIX/lib]
1366 1367
   --includedir=DIR        C header files [PREFIX/include]
1367 1368
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
... ...
@@ -1392,7 +1401,7 @@ fi
1392 1392
 
1393 1393
 if test -n "$ac_init_help"; then
1394 1394
   case $ac_init_help in
1395
-     short | recursive ) echo "Configuration of libmspack 0.5alpha:";;
1395
+     short | recursive ) echo "Configuration of libmspack 0.7.1alpha:";;
1396 1396
    esac
1397 1397
   cat <<\_ACEOF
1398 1398
 
... ...
@@ -1402,9 +1411,6 @@ Optional Features:
1402 1402
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
1403 1403
   --enable-silent-rules   less verbose build output (undo: "make V=1")
1404 1404
   --disable-silent-rules  verbose build output (undo: "make V=0")
1405
-  --enable-maintainer-mode
1406
-                          enable make rules and dependencies not useful (and
1407
-                          sometimes confusing) to the casual installer
1408 1405
   --enable-debug          enable debugging
1409 1406
   --enable-dependency-tracking
1410 1407
                           do not reject slow dependency extractors
... ...
@@ -1444,7 +1450,7 @@ Some influential environment variables:
1444 1444
 Use these variables to override the choices made by `configure' or to help
1445 1445
 it to find libraries and programs with nonstandard names/locations.
1446 1446
 
1447
-Report bugs to <kyzer@4u.net>.
1447
+Report bugs to <kyzer@cabextract.org.uk>.
1448 1448
 _ACEOF
1449 1449
 ac_status=$?
1450 1450
 fi
... ...
@@ -1507,7 +1513,7 @@ fi
1507 1507
 test -n "$ac_init_help" && exit $ac_status
1508 1508
 if $ac_init_version; then
1509 1509
   cat <<\_ACEOF
1510
-libmspack configure 0.5alpha
1510
+libmspack configure 0.7.1alpha
1511 1511
 generated by GNU Autoconf 2.69
1512 1512
 
1513 1513
 Copyright (C) 2012 Free Software Foundation, Inc.
... ...
@@ -1852,9 +1858,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
1852 1852
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
1853 1853
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
1854 1854
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
1855
-( $as_echo "## --------------------------- ##
1856
-## Report this to kyzer@4u.net ##
1857
-## --------------------------- ##"
1855
+( $as_echo "## -------------------------------------- ##
1856
+## Report this to kyzer@cabextract.org.uk ##
1857
+## -------------------------------------- ##"
1858 1858
      ) | sed "s/^/$as_me: WARNING:     /" >&2
1859 1859
     ;;
1860 1860
 esac
... ...
@@ -2113,7 +2119,7 @@ cat >config.log <<_ACEOF
2113 2113
 This file contains any messages produced by compilers while
2114 2114
 running configure, to aid debugging if configure makes a mistake.
2115 2115
 
2116
-It was created by libmspack $as_me 0.5alpha, which was
2116
+It was created by libmspack $as_me 0.7.1alpha, which was
2117 2117
 generated by GNU Autoconf 2.69.  Invocation command line was
2118 2118
 
2119 2119
   $ $0 $@
... ...
@@ -2462,7 +2468,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
2462 2462
 
2463 2463
 
2464 2464
 
2465
-am__api_version='1.14'
2465
+am__api_version='1.15'
2466 2466
 
2467 2467
 ac_aux_dir=
2468 2468
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
... ...
@@ -2663,8 +2669,8 @@ test "$program_suffix" != NONE &&
2663 2663
 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
2664 2664
 program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
2665 2665
 
2666
-# expand $ac_aux_dir to an absolute path
2667
-am_aux_dir=`cd $ac_aux_dir && pwd`
2666
+# Expand $ac_aux_dir to an absolute path.
2667
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
2668 2668
 
2669 2669
 if test x"${MISSING+set}" != xset; then
2670 2670
   case $am_aux_dir in
... ...
@@ -2683,7 +2689,7 @@ else
2683 2683
 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
2684 2684
 fi
2685 2685
 
2686
-if test x"${install_sh}" != xset; then
2686
+if test x"${install_sh+set}" != xset; then
2687 2687
   case $am_aux_dir in
2688 2688
   *\ * | *\	*)
2689 2689
     install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
... ...
@@ -2977,7 +2983,7 @@ fi
2977 2977
 
2978 2978
 # Define the identity of the package.
2979 2979
  PACKAGE='libmspack'
2980
- VERSION='0.5alpha'
2980
+ VERSION='0.7.1alpha'
2981 2981
 
2982 2982
 
2983 2983
 cat >>confdefs.h <<_ACEOF
... ...
@@ -3011,8 +3017,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
3011 3011
 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
3012 3012
 mkdir_p='$(MKDIR_P)'
3013 3013
 
3014
-# We need awk for the "check" target.  The system "awk" is bad on
3015
-# some platforms.
3014
+# We need awk for the "check" target (and possibly the TAP driver).  The
3015
+# system "awk" is bad on some platforms.
3016 3016
 # Always define AMTAR for backward compatibility.  Yes, it's still used
3017 3017
 # in the wild :-(  We should find a proper way to deprecate it ...
3018 3018
 AMTAR='$${TAR-tar}'
... ...
@@ -3070,28 +3076,6 @@ END
3070 3070
   fi
3071 3071
 fi
3072 3072
 
3073
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
3074
-$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
3075
-    # Check whether --enable-maintainer-mode was given.
3076
-if test "${enable_maintainer_mode+set}" = set; then :
3077
-  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
3078
-else
3079
-  USE_MAINTAINER_MODE=no
3080
-fi
3081
-
3082
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
3083
-$as_echo "$USE_MAINTAINER_MODE" >&6; }
3084
-   if test $USE_MAINTAINER_MODE = yes; then
3085
-  MAINTAINER_MODE_TRUE=
3086
-  MAINTAINER_MODE_FALSE='#'
3087
-else
3088
-  MAINTAINER_MODE_TRUE='#'
3089
-  MAINTAINER_MODE_FALSE=
3090
-fi
3091
-
3092
-  MAINT=$MAINTAINER_MODE_TRUE
3093
-
3094
-
3095 3073
 
3096 3074
 ac_config_headers="$ac_config_headers config.h"
3097 3075
 
... ...
@@ -4207,6 +4191,178 @@ else
4207 4207
 fi
4208 4208
 
4209 4209
 
4210
+if test -n "$ac_tool_prefix"; then
4211
+  for ac_prog in ar lib "link -lib"
4212
+  do
4213
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
4214
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
4215
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4216
+$as_echo_n "checking for $ac_word... " >&6; }
4217
+if ${ac_cv_prog_AR+:} false; then :
4218
+  $as_echo_n "(cached) " >&6
4219
+else
4220
+  if test -n "$AR"; then
4221
+  ac_cv_prog_AR="$AR" # Let the user override the test.
4222
+else
4223
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4224
+for as_dir in $PATH
4225
+do
4226
+  IFS=$as_save_IFS
4227
+  test -z "$as_dir" && as_dir=.
4228
+    for ac_exec_ext in '' $ac_executable_extensions; do
4229
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
4230
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
4231
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4232
+    break 2
4233
+  fi
4234
+done
4235
+  done
4236
+IFS=$as_save_IFS
4237
+
4238
+fi
4239
+fi
4240
+AR=$ac_cv_prog_AR
4241
+if test -n "$AR"; then
4242
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
4243
+$as_echo "$AR" >&6; }
4244
+else
4245
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4246
+$as_echo "no" >&6; }
4247
+fi
4248
+
4249
+
4250
+    test -n "$AR" && break
4251
+  done
4252
+fi
4253
+if test -z "$AR"; then
4254
+  ac_ct_AR=$AR
4255
+  for ac_prog in ar lib "link -lib"
4256
+do
4257
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
4258
+set dummy $ac_prog; ac_word=$2
4259
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4260
+$as_echo_n "checking for $ac_word... " >&6; }
4261
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
4262
+  $as_echo_n "(cached) " >&6
4263
+else
4264
+  if test -n "$ac_ct_AR"; then
4265
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
4266
+else
4267
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4268
+for as_dir in $PATH
4269
+do
4270
+  IFS=$as_save_IFS
4271
+  test -z "$as_dir" && as_dir=.
4272
+    for ac_exec_ext in '' $ac_executable_extensions; do
4273
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
4274
+    ac_cv_prog_ac_ct_AR="$ac_prog"
4275
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4276
+    break 2
4277
+  fi
4278
+done
4279
+  done
4280
+IFS=$as_save_IFS
4281
+
4282
+fi
4283
+fi
4284
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
4285
+if test -n "$ac_ct_AR"; then
4286
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
4287
+$as_echo "$ac_ct_AR" >&6; }
4288
+else
4289
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4290
+$as_echo "no" >&6; }
4291
+fi
4292
+
4293
+
4294
+  test -n "$ac_ct_AR" && break
4295
+done
4296
+
4297
+  if test "x$ac_ct_AR" = x; then
4298
+    AR="false"
4299
+  else
4300
+    case $cross_compiling:$ac_tool_warned in
4301
+yes:)
4302
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
4303
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
4304
+ac_tool_warned=yes ;;
4305
+esac
4306
+    AR=$ac_ct_AR
4307
+  fi
4308
+fi
4309
+
4310
+: ${AR=ar}
4311
+
4312
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5
4313
+$as_echo_n "checking the archiver ($AR) interface... " >&6; }
4314
+if ${am_cv_ar_interface+:} false; then :
4315
+  $as_echo_n "(cached) " >&6
4316
+else
4317
+  ac_ext=c
4318
+ac_cpp='$CPP $CPPFLAGS'
4319
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4320
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4321
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
4322
+
4323
+   am_cv_ar_interface=ar
4324
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4325
+/* end confdefs.h.  */
4326
+int some_variable = 0;
4327
+_ACEOF
4328
+if ac_fn_c_try_compile "$LINENO"; then :
4329
+  am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5'
4330
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5
4331
+  (eval $am_ar_try) 2>&5
4332
+  ac_status=$?
4333
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
4334
+  test $ac_status = 0; }
4335
+      if test "$ac_status" -eq 0; then
4336
+        am_cv_ar_interface=ar
4337
+      else
4338
+        am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5'
4339
+        { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5
4340
+  (eval $am_ar_try) 2>&5
4341
+  ac_status=$?
4342
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
4343
+  test $ac_status = 0; }
4344
+        if test "$ac_status" -eq 0; then
4345
+          am_cv_ar_interface=lib
4346
+        else
4347
+          am_cv_ar_interface=unknown
4348
+        fi
4349
+      fi
4350
+      rm -f conftest.lib libconftest.a
4351
+
4352
+fi
4353
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4354
+   ac_ext=c
4355
+ac_cpp='$CPP $CPPFLAGS'
4356
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4357
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4358
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
4359
+
4360
+fi
4361
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5
4362
+$as_echo "$am_cv_ar_interface" >&6; }
4363
+
4364
+case $am_cv_ar_interface in
4365
+ar)
4366
+  ;;
4367
+lib)
4368
+  # Microsoft lib, so override with the ar-lib wrapper script.
4369
+  # FIXME: It is wrong to rewrite AR.
4370
+  # But if we don't then we get into trouble of one sort or another.
4371
+  # A longer-term fix would be to have automake use am__AR in this case,
4372
+  # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
4373
+  # similar.
4374
+  AR="$am_aux_dir/ar-lib $AR"
4375
+  ;;
4376
+unknown)
4377
+  as_fn_error $? "could not determine $AR interface" "$LINENO" 5
4378
+  ;;
4379
+esac
4380
+
4381
+
4210 4382
 case `pwd` in
4211 4383
   *\ * | *\	*)
4212 4384
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
... ...
@@ -5516,7 +5672,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
5516 5516
   lt_cv_deplibs_check_method=pass_all
5517 5517
   ;;
5518 5518
 
5519
-netbsd*)
5519
+netbsd* | netbsdelf*-gnu)
5520 5520
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
5521 5521
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
5522 5522
   else
... ...
@@ -5777,7 +5933,6 @@ test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
5777 5777
 
5778 5778
 
5779 5779
 
5780
-
5781 5780
 if test -n "$ac_tool_prefix"; then
5782 5781
   for ac_prog in ar
5783 5782
   do
... ...
@@ -9209,6 +9364,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
9209 9209
   openbsd* | bitrig*)
9210 9210
     with_gnu_ld=no
9211 9211
     ;;
9212
+  linux* | k*bsd*-gnu | gnu*)
9213
+    link_all_deplibs=no
9214
+    ;;
9212 9215
   esac
9213 9216
 
9214 9217
   ld_shlibs=yes
... ...
@@ -9463,7 +9621,7 @@ _LT_EOF
9463 9463
       fi
9464 9464
       ;;
9465 9465
 
9466
-    netbsd*)
9466
+    netbsd* | netbsdelf*-gnu)
9467 9467
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
9468 9468
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
9469 9469
 	wlarc=
... ...
@@ -10133,6 +10291,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
10133 10133
 	if test yes = "$lt_cv_irix_exported_symbol"; then
10134 10134
           archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
10135 10135
 	fi
10136
+	link_all_deplibs=no
10136 10137
       else
10137 10138
 	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
10138 10139
 	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
... ...
@@ -10154,7 +10313,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
10154 10154
       esac
10155 10155
       ;;
10156 10156
 
10157
-    netbsd*)
10157
+    netbsd* | netbsdelf*-gnu)
10158 10158
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
10159 10159
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
10160 10160
       else
... ...
@@ -11269,6 +11428,18 @@ fi
11269 11269
   dynamic_linker='GNU/Linux ld.so'
11270 11270
   ;;
11271 11271
 
11272
+netbsdelf*-gnu)
11273
+  version_type=linux
11274
+  need_lib_prefix=no
11275
+  need_version=no
11276
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
11277
+  soname_spec='${libname}${release}${shared_ext}$major'
11278
+  shlibpath_var=LD_LIBRARY_PATH
11279
+  shlibpath_overrides_runpath=no
11280
+  hardcode_into_libs=yes
11281
+  dynamic_linker='NetBSD ld.elf_so'
11282
+  ;;
11283
+
11272 11284
 netbsd*)
11273 11285
   version_type=sunos
11274 11286
   need_lib_prefix=no
... ...
@@ -12391,7 +12562,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
12391 12391
 
12392 12392
 fi
12393 12393
 
12394
-for ac_header in ctype.h limits.h stdlib.h wctype.h
12394
+for ac_header in ctype.h inttypes.h limits.h stdlib.h wctype.h
12395 12395
 do :
12396 12396
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
12397 12397
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
... ...
@@ -12595,6 +12766,56 @@ cat >>confdefs.h <<_ACEOF
12595 12595
 _ACEOF
12596 12596
 
12597 12597
 
12598
+
12599
+# Checks for library functions
12600
+for ac_func in mkdir _mkdir
12601
+do :
12602
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
12603
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
12604
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
12605
+  cat >>confdefs.h <<_ACEOF
12606
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
12607
+_ACEOF
12608
+
12609
+fi
12610
+done
12611
+
12612
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mkdir takes one argument" >&5
12613
+$as_echo_n "checking whether mkdir takes one argument... " >&6; }
12614
+if ${ac_cv_mkdir_takes_one_arg+:} false; then :
12615
+  $as_echo_n "(cached) " >&6
12616
+else
12617
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12618
+/* end confdefs.h.  */
12619
+
12620
+#include <sys/stat.h>
12621
+#if HAVE_UNISTD_H
12622
+#  include <unistd.h>
12623
+#endif
12624
+
12625
+int
12626
+main ()
12627
+{
12628
+mkdir (".");
12629
+  ;
12630
+  return 0;
12631
+}
12632
+_ACEOF
12633
+if ac_fn_c_try_compile "$LINENO"; then :
12634
+  ac_cv_mkdir_takes_one_arg=yes
12635
+else
12636
+  ac_cv_mkdir_takes_one_arg=no
12637
+fi
12638
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12639
+fi
12640
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mkdir_takes_one_arg" >&5
12641
+$as_echo "$ac_cv_mkdir_takes_one_arg" >&6; }
12642
+if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
12643
+
12644
+$as_echo "#define MKDIR_TAKES_ONE_ARG 1" >>confdefs.h
12645
+
12646
+fi
12647
+
12598 12648
 for ac_func in tolower towlower
12599 12649
 do :
12600 12650
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
... ...
@@ -12879,7 +13100,7 @@ fi
12879 12879
 
12880 12880
 
12881 12881
 # Checks for library functions.
12882
-ac_config_files="$ac_config_files Makefile libclammspack.pc"
12882
+ac_config_files="$ac_config_files Makefile doc/Makefile doc/Doxyfile libmspack.pc"
12883 12883
 
12884 12884
 cat >confcache <<\_ACEOF
12885 12885
 # This file is a shell script that caches the results of configure
... ...
@@ -13006,10 +13227,6 @@ else
13006 13006
   am__EXEEXT_FALSE=
13007 13007
 fi
13008 13008
 
13009
-if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
13010
-  as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
13011
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
13012
-fi
13013 13009
 if test -z "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then
13014 13010
   as_fn_error $? "conditional \"DEBUG\" was never defined.
13015 13011
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
... ...
@@ -13423,7 +13640,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
13423 13423
 # report actual input values of CONFIG_FILES etc. instead of their
13424 13424
 # values after options handling.
13425 13425
 ac_log="
13426
-This file was extended by libmspack $as_me 0.5alpha, which was
13426
+This file was extended by libmspack $as_me 0.7.1alpha, which was
13427 13427
 generated by GNU Autoconf 2.69.  Invocation command line was
13428 13428
 
13429 13429
   CONFIG_FILES    = $CONFIG_FILES
... ...
@@ -13483,13 +13700,13 @@ $config_headers
13483 13483
 Configuration commands:
13484 13484
 $config_commands
13485 13485
 
13486
-Report bugs to <kyzer@4u.net>."
13486
+Report bugs to <kyzer@cabextract.org.uk>."
13487 13487
 
13488 13488
 _ACEOF
13489 13489
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
13490 13490
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
13491 13491
 ac_cs_version="\\
13492
-libmspack config.status 0.5alpha
13492
+libmspack config.status 0.7.1alpha
13493 13493
 configured by $0, generated by GNU Autoconf 2.69,
13494 13494
   with options \\"\$ac_cs_config\\"
13495 13495
 
... ...
@@ -13905,7 +14122,9 @@ do
13905 13905
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
13906 13906
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
13907 13907
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
13908
-    "libclammspack.pc") CONFIG_FILES="$CONFIG_FILES libclammspack.pc" ;;
13908
+    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
13909
+    "doc/Doxyfile") CONFIG_FILES="$CONFIG_FILES doc/Doxyfile" ;;
13910
+    "libmspack.pc") CONFIG_FILES="$CONFIG_FILES libmspack.pc" ;;
13909 13911
 
13910 13912
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
13911 13913
   esac
... ...
@@ -14609,7 +14828,6 @@ $as_echo X"$file" |
14609 14609
     cat <<_LT_EOF >> "$cfgfile"
14610 14610
 #! $SHELL
14611 14611
 # Generated automatically by $as_me ($PACKAGE) $VERSION
14612
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
14613 14612
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
14614 14613
 
14615 14614
 # Provide generalized library-building support services.
... ...
@@ -1,10 +1,9 @@
1 1
 # -*- Autoconf -*-
2 2
 # Process this file with autoconf to produce a configure script.
3 3
 AC_PREREQ(2.59)
4
-AC_INIT([libmspack],[0.5alpha],[kyzer@4u.net])
4
+AC_INIT([libmspack],[0.7.1alpha],[kyzer@cabextract.org.uk])
5 5
 AC_CONFIG_MACRO_DIR([m4])
6
-AM_INIT_AUTOMAKE([foreign])
7
-AM_MAINTAINER_MODE([disable])
6
+AM_INIT_AUTOMAKE
8 7
 AC_CONFIG_SRCDIR([mspack/mspack.h])
9 8
 AC_CONFIG_HEADER([config.h])
10 9
 
... ...
@@ -25,13 +24,14 @@ AM_CONDITIONAL(DEBUG, test x$enable_debug = 'xyes')
25 25
 # Checks for programs.
26 26
 AC_PROG_CC
27 27
 AM_CONDITIONAL(GCC, test x$GCC = 'xyes')
28
+AM_PROG_AR
28 29
 AC_PROG_INSTALL
29 30
 LT_INIT
30 31
 AC_EXEEXT
31 32
 
32 33
 # Checks for header files.
33 34
 AC_HEADER_STDC
34
-AC_CHECK_HEADERS([ctype.h limits.h stdlib.h wctype.h])
35
+AC_CHECK_HEADERS([ctype.h inttypes.h limits.h stdlib.h wctype.h])
35 36
 
36 37
 # Checks for typedefs, structures, and compiler characteristics.
37 38
 AC_C_CONST
... ...
@@ -40,6 +40,9 @@ AC_TYPE_MODE_T
40 40
 AC_TYPE_OFF_T
41 41
 AC_TYPE_SIZE_T
42 42
 AC_CHECK_SIZEOF([off_t])
43
+
44
+# Checks for library functions
45
+AX_FUNC_MKDIR
43 46
 AC_CHECK_FUNCS([tolower towlower])
44 47
 
45 48
 # largefile support
... ...
@@ -47,5 +50,5 @@ AC_SYS_LARGEFILE
47 47
 AC_FUNC_FSEEKO
48 48
 
49 49
 # Checks for library functions.
50
-AC_CONFIG_FILES([Makefile libclammspack.pc])
50
+AC_CONFIG_FILES([Makefile doc/Makefile doc/Doxyfile libmspack.pc])
51 51
 AC_OUTPUT
52 52
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+libmspack (0.9-1) stable; urgency=low
1
+
2
+  * Initial Release.
3
+
4
+ -- Markus Sinner <sinner@herdsoft.com>  Tue, 26 Aug 2003 18:04:14 +0200
5
+
0 6
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+Source: libmspack
1
+Section: libs
2
+Priority: optional
3
+Maintainer: Markus Sinner <sinner@herdsoft.com>
4
+Build-Depends: debhelper (>> 3.0.0)
5
+Standards-Version: 3.5.2
6
+
7
+Package: libmspack
8
+Architecture: any
9
+Depends: ${shlibs:Depends}
10
+Description: Library that implements different Microsoft-Compressions
11
+ The purpose of libmspack is to provide both compression and decompression
12
+ of some loosely related file formats used by Microsoft. Currently the most
13
+ common formats are implemented.
0 14
\ No newline at end of file
1 15
new file mode 100755
... ...
@@ -0,0 +1,101 @@
0
+#!/usr/bin/make -f
1
+# Sample debian/rules that uses debhelper.
2
+# GNU copyright 1997 to 1999 by Joey Hess.
3
+
4
+# Uncomment this to turn on verbose mode.
5
+#export DH_VERBOSE=1
6
+
7
+# This is the debhelper compatibility version to use.
8
+export DH_COMPAT=3
9
+
10
+# These are used for cross-compiling and for saving the configure script
11
+# from having to guess our platform (since we know it already)
12
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
13
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
14
+
15
+
16
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
17
+	CFLAGS += -g
18
+endif
19
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
20
+	INSTALL_PROGRAM += -s
21
+endif
22
+
23
+config.status: configure
24
+	dh_testdir
25
+	# Add here commands to configure the package.
26
+	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
27
+
28
+
29
+build: build-stamp
30
+
31
+build-stamp:  config.status
32
+	dh_testdir
33
+
34
+	# Add here commands to compile the package.
35
+	$(MAKE)
36
+	#/usr/bin/docbook-to-man debian/libmspack.sgml > libmspack.1
37
+
38
+	touch build-stamp
39
+
40
+clean:
41
+	dh_testdir
42
+	dh_testroot
43
+	rm -f build-stamp 
44
+
45
+	# Add here commands to clean up after the build process.
46
+	-$(MAKE) distclean
47
+	-test -r /usr/share/misc/config.sub && \
48
+	  cp -f /usr/share/misc/config.sub config.sub
49
+	-test -r /usr/share/misc/config.guess && \
50
+	  cp -f /usr/share/misc/config.guess config.guess
51
+
52
+
53
+	dh_clean
54
+
55
+install: build
56
+	dh_testdir
57
+	dh_testroot
58
+	dh_clean -k
59
+	dh_installdirs
60
+
61
+	# Add here commands to install the package into debian/libmspack.
62
+	$(MAKE) install prefix=$(CURDIR)/debian/libmspack/usr
63
+
64
+
65
+# Build architecture-independent files here.
66
+binary-indep: build install
67
+# We have nothing to do by default.
68
+
69
+# Build architecture-dependent files here.
70
+binary-arch: build install
71
+	dh_testdir
72
+	dh_testroot
73
+#	dh_installdebconf	
74
+	dh_installdocs
75
+	dh_installexamples
76
+	dh_installmenu
77
+#	dh_installlogrotate
78
+#	dh_installemacsen
79
+#	dh_installpam
80
+#	dh_installmime
81
+#	dh_installinit
82
+	dh_installcron
83
+	dh_installman
84
+	dh_installinfo
85
+#	dh_undocumented
86
+	dh_installchangelogs ChangeLog
87
+	dh_link
88
+	dh_strip
89
+	dh_compress
90
+	dh_fixperms
91
+#	dh_makeshlibs
92
+	dh_installdeb
93
+#	dh_perl
94
+	dh_shlibdeps
95
+	dh_gencontrol
96
+	dh_md5sums
97
+	dh_builddeb
98
+
99
+binary: binary-indep binary-arch
100
+.PHONY: build clean binary-indep binary-arch binary install 
... ...
@@ -1,9 +1,9 @@
1 1
 #! /bin/sh
2 2
 # depcomp - compile a program generating dependencies as side-effects
3 3
 
4
-scriptversion=2013-05-30.07; # UTC
4
+scriptversion=2016-01-11.22; # UTC
5 5
 
6
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
6
+# Copyright (C) 1999-2017 Free Software Foundation, Inc.
7 7
 
8 8
 # This program is free software; you can redistribute it and/or modify
9 9
 # it under the terms of the GNU General Public License as published by
... ...
@@ -786,6 +786,6 @@ exit 0
786 786
 # eval: (add-hook 'write-file-hooks 'time-stamp)
787 787
 # time-stamp-start: "scriptversion="
788 788
 # time-stamp-format: "%:y-%02m-%02d.%02H"
789
-# time-stamp-time-zone: "UTC"
789
+# time-stamp-time-zone: "UTC0"
790 790
 # time-stamp-end: "; # UTC"
791 791
 # End:
792 792
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+PROJECT_NAME           = libmspack
1
+OUTPUT_DIRECTORY       = .
2
+EXTRACT_ALL            = YES
3
+EXTRACT_LOCAL_CLASSES  = YES
4
+HIDE_UNDOC_MEMBERS     = YES
5
+SHOW_INCLUDE_FILES     = YES
6
+JAVADOC_AUTOBRIEF      = YES
7
+OPTIMIZE_OUTPUT_FOR_C  = YES
8
+SHOW_USED_FILES        = YES
9
+INPUT                  = ../mspack/mspack.h
10
+FULL_PATH_NAMES        = NO
11
+GENERATE_HTML          = YES
12
+HTML_OUTPUT            = .
13
+HTML_FILE_EXTENSION    = .html
14
+HTML_TIMESTAMP         = NO
15
+GENERATE_HTMLHELP      = NO
16
+GENERATE_LATEX         = NO
17
+GENERATE_RTF           = NO
18
+GENERATE_MAN           = NO
19
+GENERATE_XML           = NO
20
+GENERATE_AUTOGEN_DEF   = NO
21
+CLASS_DIAGRAMS         = NO
0 22
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+PROJECT_NAME           = libmspack
1
+OUTPUT_DIRECTORY       = .
2
+EXTRACT_ALL            = YES
3
+EXTRACT_LOCAL_CLASSES  = YES
4
+HIDE_UNDOC_MEMBERS     = YES
5
+SHOW_INCLUDE_FILES     = YES
6
+JAVADOC_AUTOBRIEF      = YES
7
+OPTIMIZE_OUTPUT_FOR_C  = YES
8
+SHOW_USED_FILES        = YES
9
+INPUT                  = @top_srcdir@/mspack/mspack.h
10
+FULL_PATH_NAMES        = NO
11
+GENERATE_HTML          = YES
12
+HTML_OUTPUT            = .
13
+HTML_FILE_EXTENSION    = .html
14
+HTML_TIMESTAMP         = NO
15
+GENERATE_HTMLHELP      = NO
16
+GENERATE_LATEX         = NO
17
+GENERATE_RTF           = NO
18
+GENERATE_MAN           = NO
19
+GENERATE_XML           = NO
20
+GENERATE_AUTOGEN_DEF   = NO
21
+CLASS_DIAGRAMS         = NO
0 22
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+DOCS =	annotated.html classes.html dir_*.html doxygen.* dynsections.js \
1
+	files.html functions*.html globals*.html graph_legend.html index.html \
2
+	jquery.js mspack*.html search struct*.html tab* *.map *.md5 *.png
3
+
4
+all: index.html
5
+
6
+clean:
7
+	-rm -rf $(DOCS) installdox
8
+
9
+index.html: ../mspack/mspack.h Doxyfile
10
+	doxygen
11
+
12
+mspack_docs.zip: index.html
13
+	zip -9r $@ $(DOCS) szdd_kwaj_format.html
0 14
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+DOCS =	annotated.html classes.html dir_*.html doxygen.* dynsections.js \
1
+	files.html functions*.html globals*.html graph_legend.html index.html \
2
+	jquery.js mspack*.html search struct*.html tab* *.map *.md5 *.png
3
+
4
+all: index.html
5
+
6
+clean:
7
+	-rm -rf $(DOCS) installdox
8
+
9
+index.html: @top_srcdir@/mspack/mspack.h Doxyfile
10
+	doxygen
11
+
12
+mspack_docs.zip: index.html
13
+	zip -9r $@ $(DOCS) szdd_kwaj_format.html
0 14
new file mode 100644
... ...
@@ -0,0 +1,331 @@
0
+<?xml version="1.0" encoding="iso-8859-1"?>
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
4
+<head>
5
+<style type="text/css">
6
+dt {
7
+  font-weight:bold;
8
+}
9
+pre {
10
+  background-color:#F9F9F9;
11
+  border:1px dashed #2F6FAB;
12
+  color:black;
13
+  padding:1em;
14
+}
15
+table.wikitable  {
16
+  background:none repeat scroll 0 0 #F9F9F9;
17
+  border:1px solid #AAAAAA;
18
+  border-collapse:collapse;
19
+  margin:1em 1em 1em 0;
20
+}
21
+.wikitable th, .wikitable td {
22
+  border:1px solid #AAAAAA;
23
+  padding:0.2em;
24
+}
25
+.wikitable th {
26
+  background:none repeat scroll 0 0 #F2F2F2;
27
+  text-align:center;
28
+}
29
+.wikitable caption {
30
+  font-weight:bold;
31
+}
32
+.c.source-c .de1, .c.source-c .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
33
+.c.source-c  {font-family:monospace;}
34
+.c.source-c .imp {font-weight: bold; color: red;}
35
+.c.source-c li, .c.source-c .li1 {font-weight: normal; vertical-align:top;}
36
+.c.source-c .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
37
+.c.source-c .li2 {font-weight: bold; vertical-align:top;}
38
+.c.source-c .kw1 {color: #b1b100;}
39
+.c.source-c .kw2 {color: #000000; font-weight: bold;}
40
+.c.source-c .kw3 {color: #000066;}
41
+.c.source-c .kw4 {color: #993333;}
42
+.c.source-c .co1 {color: #666666; font-style: italic;}
43
+.c.source-c .co2 {color: #339933;}
44
+.c.source-c .coMULTI {color: #808080; font-style: italic;}
45
+.c.source-c .es0 {color: #000099; font-weight: bold;}
46
+.c.source-c .es1 {color: #000099; font-weight: bold;}
47
+.c.source-c .es2 {color: #660099; font-weight: bold;}
48
+.c.source-c .es3 {color: #660099; font-weight: bold;}
49
+.c.source-c .es4 {color: #660099; font-weight: bold;}
50
+.c.source-c .es5 {color: #006699; font-weight: bold;}
51
+.c.source-c .br0 {color: #009900;}
52
+.c.source-c .sy0 {color: #339933;}
53
+.c.source-c .st0 {color: #ff0000;}
54
+.c.source-c .nu0 {color: #0000dd;}
55
+.c.source-c .nu6 {color: #208080;}
56
+.c.source-c .nu8 {color: #208080;}
57
+.c.source-c .nu12 {color: #208080;}
58
+.c.source-c .nu16 {color:#800080;}
59
+.c.source-c .nu17 {color:#800080;}
60
+.c.source-c .nu18 {color:#800080;}
61
+.c.source-c .nu19 {color:#800080;}
62
+.c.source-c .me1 {color: #202020;}
63
+.c.source-c .me2 {color: #202020;}
64
+.c.source-c .ln-xtra, .c.source-c li.ln-xtra, .c.source-c div.ln-xtra {background-color: #ffc;}
65
+.c.source-c span.xtra { display:block; }
66
+</style>
67
+<meta name="author" content="Stuart Caie" />
68
+<title>COMPRESS.EXE file formats: SZDD and KWAJ</title>
69
+</head>
70
+<body>
71
+<h1>COMPRESS.EXE file formats: SZDD and KWAJ</h1>
72
+
73
+<p>This document describes the <b>SZDD</b> and <b>KWAJ</b> file
74
+formats which are implemented in the MS-DOS commands
75
+<tt>COMPRESS.EXE</tt> and <tt>EXPAND.EXE</tt>.</p>
76
+
77
+<p>Both formats compress a single file to another single file,
78
+replacing the last character in the filename with an underscore or
79
+dollar character, e.g. <tt>README.TXT</tt> becomes <tt>README.TX_</tt>
80
+or <tt>README.TX$</tt>.</p>
81
+
82
+<a name="SZDD_file_format"><h2>SZDD file format</h2></a>
83
+
84
+<p>An SZDD file begins with this fixed header:</p>
85
+
86
+<table class="wikitable">
87
+<caption>SZDD header format</caption>
88
+<tr><th>Offset</th><th>Length</th><th>Description</th></tr>
89
+<tr><td>0x00</td><td>8</td><td>"SZDD" signature: 0x53,0x5A,0x44,0x44,0x88,0xF0,0x27,0x33</td></tr>
90
+<tr><td>0x08</td><td>1</td><td>Compression mode: only "A" (0x41) is valid here</td></tr>
91
+<tr><td>0x09</td><td>1</td><td>The character missing from the end of the filename (0=unknown)</td></tr>
92
+<tr><td>0x0A</td><td>4</td><td>The integer length of the file when unpacked</td></tr>
93
+</table>
94
+
95
+<p>The header is immediately followed by the compressed data. The
96
+following pseudocode explains how to unpack this data; it's a form of
97
+the LZSS algorithm.</p>
98
+
99
+<table class="wikitable">
100
+<caption>SZDD decompression pseudocode</caption>
101
+<tr><td>
102
+<div dir="ltr" style="text-align: left;"><div class="c source-c" style="font-family:monospace;"><pre class="de1"><span class="kw4">char</span> window<span class="br0">&#91;</span><span class="nu0">4096</span><span class="br0">&#93;</span><span class="sy0">;</span>
103
+<span class="kw4">int</span> pos <span class="sy0">=</span> <span class="nu0">4096</span> <span class="sy0">-</span> <span class="nu0">16</span><span class="sy0">;</span>
104
+memset<span class="br0">&#40;</span>window<span class="sy0">,</span> <span class="nu12">0x20</span><span class="sy0">,</span> <span class="nu0">4096</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="coMULTI">/* window initially full of spaces */</span>
105
+<span class="kw1">for</span> <span class="br0">&#40;</span><span class="sy0">;;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
106
+    <span class="kw4">int</span> control <span class="sy0">=</span> GETBYTE<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
107
+    <span class="kw1">if</span> <span class="br0">&#40;</span>control <span class="sy0">==</span> EOF<span class="br0">&#41;</span> <span class="kw2">break</span><span class="sy0">;</span> <span class="coMULTI">/* exit if no more to read */</span>
108
+    <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> cbit <span class="sy0">=</span> <span class="nu12">0x01</span><span class="sy0">;</span> cbit <span class="sy0">&amp;</span> <span class="nu12">0xFF</span><span class="sy0">;</span> cbit <span class="sy0">&lt;&lt;=</span> <span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
109
+        <span class="kw1">if</span> <span class="br0">&#40;</span>control <span class="sy0">&amp;</span> cbit<span class="br0">&#41;</span> <span class="br0">&#123;</span>
110
+            <span class="coMULTI">/* literal */</span>
111
+            PUTBYTE<span class="br0">&#40;</span>window<span class="br0">&#91;</span>pos<span class="sy0">++</span><span class="br0">&#93;</span> <span class="sy0">=</span> GETBYTE<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
112
+        <span class="br0">&#125;</span>
113
+        <span class="kw1">else</span> <span class="br0">&#123;</span>
114
+            <span class="coMULTI">/* match */</span>
115
+            <span class="kw4">int</span> matchpos <span class="sy0">=</span> GETBYTE<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
116
+            <span class="kw4">int</span> matchlen <span class="sy0">=</span> GETBYTE<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
117
+            matchpos <span class="sy0">|=</span> <span class="br0">&#40;</span>matchlen <span class="sy0">&amp;</span> <span class="nu12">0xF0</span><span class="br0">&#41;</span> <span class="sy0">&lt;&lt;</span> <span class="nu0">4</span><span class="sy0">;</span>
118
+            matchlen <span class="sy0">=</span> <span class="br0">&#40;</span>matchlen <span class="sy0">&amp;</span> <span class="nu12">0x0F</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="nu0">3</span><span class="sy0">;</span>
119
+            <span class="kw1">while</span> <span class="br0">&#40;</span>matchlen<span class="sy0">--</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
120
+                PUTBYTE<span class="br0">&#40;</span>window<span class="br0">&#91;</span>pos<span class="sy0">++</span><span class="br0">&#93;</span> <span class="sy0">=</span> window<span class="br0">&#91;</span>matchpos<span class="sy0">++</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
121
+                pos <span class="sy0">&amp;=</span> <span class="nu0">4095</span><span class="sy0">;</span> matchpos <span class="sy0">&amp;=</span> <span class="nu0">4095</span><span class="sy0">;</span>
122
+            <span class="br0">&#125;</span>
123
+        <span class="br0">&#125;</span>
124
+    <span class="br0">&#125;</span>
125
+<span class="br0">&#125;</span></pre></div></div>
126
+</td></tr></table>
127
+
128
+<p>There is also a variant SZDD format seen in the installation
129
+package for QBasic 4.5, so I call it the QBasic variant. It has a
130
+different header and the <tt>pos</tt> variable in the pseudocode above
131
+is set to <tt>4096-18</tt> instead of <tt>4096-16</tt>.</p>
132
+
133
+<table class="wikitable">
134
+<caption>QBasic SZDD variant header format</caption>
135
+<tr><th>Offset</th><th>Length</th><th>Description</th></tr>
136
+<tr><td>0x00</td><td>8</td><td>"SZ" signature: 0x53,0x5A,0x20,0x88,0xF0,0x27,0x33,0xD1</td></tr>
137
+<tr><td>0x08</td><td>4</td><td>The integer length of the file when unpacked</td></tr></table>
138
+
139
+<a name="KWAJ_file_format"><h2>KWAJ file format</h2></a>
140
+
141
+<p>A KWAJ file begins with this fixed header:</p>
142
+
143
+<table class="wikitable">
144
+<caption>KWAJ header format</caption>
145
+<tr><th>Offset</th><th>Length</th><th>Description</th></tr>
146
+<tr><td>0x00</td><td>8</td><td>"KWAJ" signature: 0x4B,0x57,0x41,0x4A,0x88,0xF0,0x27,0xD1</td></tr>
147
+<tr><td>0x08</td><td>2</td><td>compression method (0-4)</td></tr>
148
+<tr><td>0x0A</td><td>2</td><td>file offset of compressed data</td></tr>
149
+<tr><td>0x0C</td><td>2</td><td>header flags to mark header extensions</td></tr>
150
+</table>
151
+
152
+<a name="Compression_methods"><h3>Compression methods</h3></a>
153
+
154
+<p>The "compression method" field indicates the type of data
155
+compression used:</p>
156
+
157
+<ol start="0">
158
+<li>No compression</li>
159
+<li>No compression, data is XORed with byte 0xFF</li>
160
+<li>The same compression method as regular SZDD</li>
161
+<li>LZ + Huffman "Jeff Johnson" compression</li>
162
+<li>MS-ZIP</li>
163
+</ol>
164
+
165
+<a name="Header_extensions"><h3>Header extensions</h3></a>
166
+
167
+<p>Header extensions immediately follow the header.</p>
168
+
169
+<p>If you don't care about the header extensions, use the file offset
170
+to skip to the compressed data.</p>
171
+
172
+<p>The header extensions appear in this order:</p>
173
+
174
+<dl>
175
+<dt>When header flags bit 0 is set</dt><dd>4 bytes: decompressed length of file</dd>
176
+<dt>When header flags bit 1 is set</dt><dd>2 bytes: unknown purpose</dd>
177
+<dt>When header flags bit 2 is set</dt><dd>2 bytes: length of data, followed by that many bytes of (unknown purpose) data</dd>
178
+<dt>When header flags bit 3 is set</dt><dd>1-9 bytes: null-terminated string with max length 8: file name</dd>
179
+<dt>When header flags bit 4 is set</dt><dd>1-4 bytes: null-terminated string with max length 3: file extension</dd>
180
+<dt>When header flags bit 5 is set</dt><dd>2 bytes: length of data, followed by that many bytes of (arbitrary text) data</dd>
181
+</dl>
182
+
183
+<a name="KWAJ_compression_method_3"><h3>KWAJ compression method 3</h3></a>
184
+
185
+<p>Compression method 3 is unique to the KWAJ format. It's an
186
+LZ+Huffman algorithm created by Jeff Johnson.</p>
187
+
188
+<p>Bits are always read from MSB to LSB, one byte at a time.</p>
189
+
190
+<p>There are three parts:</p>
191
+
192
+<ol>
193
+ <li>The data starts off with 6 nybbles; 4 bits each. Each nybble is
194
+  between 0-3 and is the encoding type of the 5 huffman length lists to
195
+  follow. The 6th nybble is just padding.</li>
196
+ <li>Then follow 5 huffman code length lists.</li>
197
+ <li>Then follows the compressed data, which is a mix of huffman
198
+  symbols and raw bits.</li>
199
+</ol>
200
+
201
+<a name="Huffman_code_length_lists"><h4>Huffman code length lists</h4></a>
202
+
203
+<p>KWAJ uses 5 huffman trees. They always have the same number of
204
+symbols in them. They are, in order:</p>
205
+
206
+<ol>
207
+ <li>16 symbol tree (0-15) to store match run lengths (MATCHLEN)</li>
208
+ <li>16 symbol tree (0-15) to store match run lengths immediately following a short literal run (MATCHLEN2)</li>
209
+ <li>32 symbol tree (0-31) to store literal run lengths (LITLEN)</li>
210
+ <li>64 symbol tree (0-63) to store the upper 6 bits of match distances (OFFSET)</li>
211
+ <li>256 symbol tree (0-255) to store literals (LITERAL)</li>
212
+</ol>
213
+
214
+<p>Canonical huffman codes are used, which means you simply need to
215
+know how many symbols in each huffman tree (given above), and how long
216
+each huffman symbol is</p>
217
+
218
+<p>How the symbol lengths are encoded depends on the encoding type, as
219
+given by the 6 nybbles at the start of the compressed data.</p>
220
+
221
+<p>Symbol lengths are read in ascending order, and the number of
222
+symbols to read is implied by which tree you're defining.</p>
223
+
224
+<dl>
225
+<dt>Huffman code length list, encoding type 0</dt>
226
+<dd>All symbol have the same length, implied by the number of symbols in the tree:
227
+<ul>
228
+ <li>16 symbols -&gt; all symbols are length 4</li>
229
+ <li>32 symbols -&gt; all symbols are length 5</li>
230
+ <li>64 symbols -&gt; all symbols are length 6</li>
231
+ <li>256 symbols -&gt; all symbols are length 8</li>
232
+</ul>
233
+</dd>
234
+<dd>You don't need to read anything.</dd>
235
+</dl>
236
+
237
+<dl>
238
+<dt>Huffman code length list, encoding type 1</dt>
239
+<dd>A run-length encoding is used:
240
+<ul>
241
+ <li>read 4 bits for the first symbol length (0-15)</li>
242
+ <li>LOOP:
243
+  <ul>
244
+   <li>read 1 bit == 0 if symbol length is the same as the previous, OTHERWISE:</li>
245
+   <li>read 1 bit == 0 if symbol length is previous + 1, OTHERWISE:</li>
246
+   <li>read 4 bits for symbol length (0-15)</li>
247
+  </ul>
248
+ </li>
249
+</ul>
250
+</dd>
251
+</dl>
252
+
253
+<dl>
254
+<dt>Huffman code length list, encoding type 2</dt>
255
+<dd>Another run-length encoding is used:
256
+<ul>
257
+ <li>read 4 bits for the first symbol length (0-15)</li>
258
+ <li>LOOP:
259
+  <ul>
260
+   <li> read 2 bits as selector (0-3):
261
+    <ul>
262
+     <li> selector == 3: read 4 bits for symbol length, OTHERWISE:</li>
263
+     <li> symbol length is previous symbol + (selector-1), i.e. -1, 0 or +1</li>
264
+    </ul>
265
+   </li>
266
+  </ul>
267
+ </li>
268
+</ul>
269
+</dd>
270
+</dl>
271
+
272
+<dl>
273
+<dt>Huffman code length list, encoding type 3</dt>
274
+<dd>There is no compression. Read 4 bits per symbol (0-15).</dd>
275
+</dl>
276
+
277
+<a name="Compressed_data"><h4>Compressed data</h4></a>
278
+
279
+<p>At this point, the compressed data begins.</p>
280
+
281
+<p>We have a 4096 byte ring buffer, initially filled with byte 0x20
282
+(ASCII space). Unlike the SZDD format, the starting position in the
283
+buffer is irrelevant, as match positions are stored relative to the
284
+current position in the window, not as absolute positions in the
285
+window.</p>
286
+
287
+<p>Pseudo-code:</p>
288
+<pre>
289
+ ring buffer position = 4096-17
290
+ selected table = MATCHLEN
291
+ LOOP:
292
+     code = read huffman code using selected table (MATCHLEN or MATCHLEN2)
293
+     if EOF reached, exit loop
294
+     if code &gt; 0, this is a match:
295
+         match length = code + 2
296
+         x = read huffman code using OFFSET table
297
+         y = read 6 bits
298
+         match offset = current ring buffer position - (x&lt;&lt;6 | y)
299
+         copy match as output and into the ring buffer
300
+         selected table = MATCHLEN
301
+     if code == 0, this is a run of literals:
302
+         x = read huffman code using LITLEN table
303
+         if x != 31, selected table = MATCHLEN2
304
+         read {x+1} literals using LITERAL huffman table, copy as output and into the ring buffer
305
+</pre>
306
+
307
+<a name="MSZIP"><h2>MS-ZIP</h2></a>
308
+
309
+KWAJ type 4 compression is called MS-ZIP, because it is almost
310
+identical to the MS-ZIP compression found in Microsoft Cabinet files.
311
+
312
+Each 32768 bytes of data is compressed independently using Phil
313
+Katz's DEFLATE algorithm. However, the history window is shared
314
+between blocks, so they must be unpacked in order.
315
+The format of each block is as follows:
316
+
317
+<table class="wikitable">
318
+<caption>KWAJ MS-ZIP block format</caption>
319
+<tr><th>Offset</th><th>Length</th><th>Description</th></tr>
320
+<tr><td>0</td><td>2</td><td>Compressed length of this block (n).
321
+  Stored in Intel byte order.
322
+  Doesn't include these two bytes.</td></tr>
323
+<tr><td>2</td><td>2</td><td>"CK" in ASCII (0x43, 0x4B)</td></tr>
324
+<tr><td>4</td><td>n-2</td><td>Data compressed in DEFLATE format</td></tr>
325
+</table>
326
+
327
+The final block will unpack to 1-32768 bytes. It will be followed by two
328
+zero bytes.
329
+
330
+</body></html>
0 331
new file mode 100644
... ...
@@ -0,0 +1,179 @@
0
+/* An implementation of the mspack_system interface using only memory */
1
+
2
+#ifdef HAVE_CONFIG_H
3
+#include <config.h>
4
+#endif
5
+
6
+#include <stdio.h>
7
+#include <stdlib.h>
8
+#include <string.h>
9
+#include <mspack.h>
10
+
11
+/* use a pointer to a mem_buf structure as "filenames" */
12
+struct mem_buf {
13
+  void *data;
14
+  size_t length;
15
+};
16
+
17
+struct mem_file {
18
+  char *data;
19
+  size_t length, posn;
20
+};
21
+
22
+static void *mem_alloc(struct mspack_system *self, size_t bytes) {
23
+  /* put your memory allocator here */
24
+  return malloc(bytes);
25
+}
26
+
27
+static void mem_free(void *buffer) {
28
+  /* put your memory deallocator here */
29
+  free(buffer);
30
+}
31
+
32
+static void mem_copy(void *src, void *dest, size_t bytes) {
33
+  /* put your own memory copy routine here */
34
+  memcpy(dest, src, bytes);
35
+}
36
+
37
+static void mem_msg(struct mem_file *file, const char *format, ...) {
38
+  /* put your own printf-type routine here, or leave it empty */
39
+}
40
+
41
+static struct mem_file *mem_open(struct mspack_system *self,
42
+				 struct mem_buf *fn, int mode)
43
+{
44
+  struct mem_file *fh;
45
+  if (!fn || !fn->data || !fn->length) return NULL;
46
+  if ((fh = (struct mem_file *) mem_alloc(self, sizeof(struct mem_file)))) {
47
+    fh->data   = (char *) fn->data;
48
+    fh->length = fn->length;
49
+    fh->posn   = (mode == MSPACK_SYS_OPEN_APPEND) ? fn->length : 0;
50
+  }
51
+  return fh;
52
+}
53
+
54
+static void mem_close(struct mem_file *fh) {
55
+  if (fh) mem_free(fh);
56
+}
57
+
58
+static int mem_read(struct mem_file *fh, void *buffer, int bytes) {
59
+  int todo;
60
+  if (!fh || !buffer || bytes < 0) return -1;
61
+  todo = fh->length - fh->posn;
62
+  if (todo > bytes) todo = bytes;
63
+  if (todo > 0) mem_copy(&fh->data[fh->posn], buffer, (size_t) todo);
64
+  fh->posn += todo; return todo;
65
+}
66
+
67
+static int mem_write(struct mem_file *fh, void *buffer, int bytes) {
68
+  int todo;
69
+  if (!fh || !buffer || bytes < 0) return -1;
70
+  todo = fh->length - fh->posn;
71
+  if (todo > bytes) todo = bytes;
72
+  if (todo > 0) mem_copy(buffer, &fh->data[fh->posn], (size_t) todo);
73
+  fh->posn += todo; return todo;
74
+}
75
+
76
+static int mem_seek(struct mem_file *fh, off_t offset, int mode) {
77
+  if (!fh) return 1;
78
+  switch (mode) {
79
+  case MSPACK_SYS_SEEK_START: break;
80
+  case MSPACK_SYS_SEEK_CUR:   offset += (off_t) fh->posn; break;
81
+  case MSPACK_SYS_SEEK_END:   offset += (off_t) fh->length; break;
82
+  default: return 1;
83
+  }
84
+  if ((offset < 0) || (offset > (off_t) fh->length)) return 1;
85
+  fh->posn = (size_t) offset;
86
+  return 0;
87
+}
88
+
89
+static off_t mem_tell(struct mem_file *fh) {
90
+  return (fh) ? (off_t) fh->posn : -1;
91
+}
92
+
93
+static struct mspack_system mem_system = {
94
+  (struct mspack_file * (*)(struct mspack_system *, const char *, int)) &mem_open,
95
+  (void (*)(struct mspack_file *)) &mem_close,
96
+  (int (*)(struct mspack_file *, void *, int)) &mem_read, 
97
+  (int (*)(struct mspack_file *, void *, int)) &mem_write,
98
+  (int (*)(struct mspack_file *, off_t, int)) &mem_seek, 
99
+  (off_t (*)(struct mspack_file *)) &mem_tell,
100
+  (void (*)(struct mspack_file *, const char *, ...)) &mem_msg,
101
+  &mem_alloc,
102
+  &mem_free,
103
+  &mem_copy,
104
+  NULL
105
+};
106
+
107
+/* example of usage with mscab_decompressor */
108
+
109
+/* a simple cabinet */
110
+static unsigned char embedded_cab[] = {
111
+  0x4D,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0xFD,0x00,0x00,0x00,0x00,0x00,0x00,
112
+  0x00,0x2C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x02,0x00,
113
+  0x00,0x00,0x22,0x06,0x00,0x00,0x5E,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x4D,
114
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x22,0xBA,0x59,0x20,0x00,
115
+  0x68,0x65,0x6C,0x6C,0x6F,0x2E,0x63,0x00,0x4A,0x00,0x00,0x00,0x4D,0x00,0x00,
116
+  0x00,0x00,0x00,0x6C,0x22,0xE7,0x59,0x20,0x00,0x77,0x65,0x6C,0x63,0x6F,0x6D,
117
+  0x65,0x2E,0x63,0x00,0xBD,0x5A,0xA6,0x30,0x97,0x00,0x97,0x00,0x23,0x69,0x6E,
118
+  0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,0x68,0x3E,
119
+  0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,0x28,0x76,
120
+  0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,0x70,0x72,
121
+  0x69,0x6E,0x74,0x66,0x28,0x22,0x48,0x65,0x6C,0x6C,0x6F,0x2C,0x20,0x77,0x6F,
122
+  0x72,0x6C,0x64,0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x23,
123
+  0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,
124
+  0x68,0x3E,0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,
125
+  0x28,0x76,0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,
126
+  0x70,0x72,0x69,0x6E,0x74,0x66,0x28,0x22,0x57,0x65,0x6C,0x63,0x6F,0x6D,0x65,
127
+  0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x0D,0x0A
128
+};
129
+
130
+int main() {
131
+  struct mscab_decompressor *cabd;
132
+  struct mscabd_cabinet *cab;
133
+  struct mscabd_file *file;
134
+  struct mem_buf source = { &embedded_cab[0], sizeof(embedded_cab) };
135
+  struct mem_buf output;
136
+  int err;
137
+
138
+  /* if self-test reveals an error */
139
+  MSPACK_SYS_SELFTEST(err);
140
+  if (err) return 1;
141
+
142
+  /* create a cab decompressor using our custom mspack_system interface */
143
+  if ((cabd = mspack_create_cab_decompressor(&mem_system))) {
144
+
145
+    /* open a cab file direct from memory */
146
+    if ((cab = cabd->open(cabd, (char *) &source))) {
147
+
148
+      /* for all files */
149
+      for (file = cab->files; file; file = file->next) {
150
+	/* fill out our "filename" (memory pointer and length) */
151
+	output.data = (char *) malloc(file->length);
152
+	output.length = file->length;
153
+
154
+	/* let cabd extract this file to our memory buffer */
155
+	if (output.data && cabd->extract(cabd, file, (char *) &output)) {
156
+	  exit(1);
157
+	}
158
+
159
+	/* dump the memory buffer to stdout (for display purposes) */
160
+	printf("Filename: %s\nContents:\n", file->filename);
161
+	fwrite(output.data, 1, output.length, stdout);
162
+
163
+	/* free our buffer */
164
+	free(output.data);
165
+      }
166
+      cabd->close(cabd, cab);
167
+    }
168
+    else {
169
+      fprintf(stderr, "can't open cabinet (%d)\n", cabd->last_error(cabd));
170
+    }
171
+    mspack_destroy_cab_decompressor(cabd);
172
+  }
173
+  else {
174
+    fprintf(stderr, "can't make decompressor\n");
175
+  }
176
+  return 0;
177
+
178
+}
0 179
new file mode 100644
... ...
@@ -0,0 +1,435 @@
0
+/* An implementation of the mspack_system interface which can access many
1
+ * things:
2
+ * - regular disk files
3
+ * - already opened stdio FILE* file pointers
4
+ * - open file descriptors
5
+ * - blocks of memory
6
+ */
7
+
8
+#ifdef HAVE_CONFIG_H
9
+#include <config.h>
10
+#endif
11
+
12
+#include <stdio.h>
13
+#include <stdlib.h>
14
+#include <stdarg.h>
15
+#include <string.h>
16
+#include <mspack.h>
17
+
18
+/* definitions */
19
+
20
+#define MTYPE_DISKFILE  (0x01)
21
+#define MTYPE_STDIOFH   (0x02)
22
+#define MTYPE_FILEDESC  (0x03)
23
+#define MTYPE_MEMORY    (0x04)
24
+
25
+struct m_filename {
26
+  unsigned char type;   /* one of MTYPE_DISKFILE, STDIOFH, FILEDESC or MEMORY */
27
+  const char *filename; /* the user-friendly printable filename (may be NULL) */
28
+  union {
29
+    const char *diskfile; /* char *filename      for MTYPE_DISKFILE */
30
+    FILE *stdiofh;        /* FILE *existing_fh   for MTYPE_STDIOFH */
31
+    int filedesc;         /* int file_descriptor for MTYPE_FILEDESC */
32
+    struct {
33
+      unsigned char *data;
34
+      size_t length;
35
+    } memory;
36
+  } x;
37
+};
38
+
39
+struct m_file {
40
+  struct m_filename *file; /* pointer back to the m_filename data */
41
+  union {
42
+    FILE *fh;        /* only used in DISKFILE, STDIOFH and FILEDESC types */
43
+    size_t position; /* only used in MEMORY types */
44
+  } x;
45
+};
46
+
47
+/* ------------------------------------------------------------------------ */
48
+/* mspack_system implementation */
49
+
50
+static void *m_alloc(struct mspack_system *self, size_t bytes) {
51
+  return malloc(bytes);
52
+}
53
+
54
+static void m_free(void *buffer) {
55
+  free(buffer);
56
+}
57
+
58
+static void m_copy(void *src, void *dest, size_t bytes) {
59
+  memcpy(dest, src, bytes);
60
+}
61
+
62
+/* A message printer that prints to stderr */
63
+static void m_msg(struct m_file *file, const char *format, ...) {
64
+  va_list ap;
65
+  if (file && file->file && file->file->filename) {
66
+    fprintf(stderr, "%s: ", file->file->filename);
67
+  }
68
+  va_start(ap, format);
69
+  vfprintf(stderr, format, ap);
70
+  va_end(ap);
71
+  fputc((int) '\n', stderr);
72
+  fflush(stderr);
73
+}
74
+
75
+
76
+static struct m_file *m_open_mem(struct mspack_system *self,
77
+				 struct m_filename *fn, int mode)
78
+{
79
+  struct m_file *fh;
80
+
81
+  /* validate arguments of the filename */
82
+  if (!fn->x.memory.data)   return NULL;
83
+  if (!fn->x.memory.length) return NULL;
84
+
85
+  if ((fh = (struct m_file *) m_alloc(self, sizeof(struct m_file)))) {
86
+    fh->x.position = (mode == MSPACK_SYS_OPEN_APPEND) ?
87
+      fn->x.memory.length : 0;
88
+    fh->file = fn;
89
+  }
90
+  return fh;
91
+}
92
+
93
+static struct m_file *m_open_file(struct mspack_system *self,
94
+				  struct m_filename *fn, int mode)
95
+{
96
+  struct m_file *fh;
97
+  const char *fmode;
98
+  int fd;
99
+
100
+  switch (mode) {
101
+  case MSPACK_SYS_OPEN_READ:   fmode = "rb";  break;
102
+  case MSPACK_SYS_OPEN_WRITE:  fmode = "wb";  break;
103
+  case MSPACK_SYS_OPEN_UPDATE: fmode = "r+b"; break;
104
+  case MSPACK_SYS_OPEN_APPEND: fmode = "ab";  break;
105
+  default: return NULL;
106
+  }
107
+
108
+  /* validate the arguments in the provided filename */
109
+  switch (fn->type) {
110
+  case MTYPE_DISKFILE: if (!fn->x.diskfile)    return NULL; break;
111
+  case MTYPE_STDIOFH:  if (!fn->x.stdiofh)     return NULL; break;
112
+  case MTYPE_FILEDESC: if (fn->x.filedesc < 0) return NULL; break;
113
+  }
114
+
115
+  /* allocate memory for the file handle */
116
+  if (!(fh = (struct m_file *) m_alloc(self, sizeof(struct m_file)))) return NULL;
117
+
118
+  /* open or duplicate the filehandle */
119
+  switch (fn->type) {
120
+  case MTYPE_DISKFILE:
121
+    fh->x.fh = fopen(fn->x.diskfile, fmode);
122
+    break;
123
+
124
+  case MTYPE_STDIOFH:
125
+    fd = fileno(fn->x.stdiofh);
126
+    fh->x.fh = (fd >= 0) ? fdopen(fd, fmode) : NULL;
127
+    break;
128
+
129
+  case MTYPE_FILEDESC:
130
+    fh->x.fh = fdopen(fn->x.filedesc, fmode);
131
+    break;
132
+  }
133
+
134
+  /* validate the new stdio filehandle */
135
+  if (fh->x.fh) {
136
+    fh->file = fn;
137
+  }
138
+  else {
139
+    free(fh);
140
+    fh = NULL;
141
+  }
142
+
143
+  return fh;
144
+}
145
+
146
+static struct m_file *m_open(struct mspack_system *self,
147
+			     struct m_filename *fn, int mode)
148
+{
149
+  if (!self || !fn) return NULL;
150
+
151
+  switch (fn->type) {
152
+  case MTYPE_DISKFILE:
153
+  case MTYPE_STDIOFH:
154
+  case MTYPE_FILEDESC:
155
+    return m_open_file(self, fn, mode);
156
+
157
+  case MTYPE_MEMORY:
158
+    return m_open_mem(self, fn, mode);
159
+  }
160
+  return NULL;
161
+}
162
+
163
+static void m_close(struct m_file *fh) {
164
+  if (!fh || !fh->file) return;
165
+  if (fh->file->type != MTYPE_MEMORY) fclose(fh->x.fh);
166
+  m_free(fh);
167
+}
168
+
169
+
170
+static int m_read(struct m_file *fh, void *buffer, int bytes) {
171
+  if (!fh || !fh->file || !buffer || bytes < 0) return -1;
172
+
173
+  if (fh->file->type == MTYPE_MEMORY) {
174
+    int count = fh->file->x.memory.length - fh->x.position;
175
+    if (count > bytes) count = bytes;
176
+    if (count > 0) {
177
+      m_copy(&fh->file->x.memory.data[fh->x.position], buffer, (size_t) count);
178
+    }
179
+    fh->x.position += count;
180
+    return count;
181
+  }
182
+  else {
183
+    size_t count = fread(buffer, 1, (size_t) bytes, fh->x.fh);
184
+    if (!ferror(fh->x.fh)) return (int) count;
185
+  }
186
+  return -1;
187
+}
188
+
189
+
190
+static int m_write(struct m_file *fh, void *buffer, int bytes) {
191
+  if (!fh || !fh->file || !buffer || bytes < 0) return -1;
192
+
193
+  if (fh->file->type == MTYPE_MEMORY) {
194
+    int count = fh->file->x.memory.length - fh->x.position;
195
+    if (count > bytes) count = bytes;
196
+    if (count > 0) {
197
+      m_copy(buffer, &fh->file->x.memory.data[fh->x.position], (size_t) count);
198
+    }
199
+    fh->x.position += count;
200
+    return count;
201
+  }
202
+  else {
203
+    size_t count = fwrite(buffer, 1, (size_t) bytes, fh->x.fh);
204
+    if (!ferror(fh->x.fh)) return (int) count;
205
+  }
206
+  return -1;
207
+}
208
+
209
+
210
+static int m_seek(struct m_file *fh, off_t offset, int mode) {
211
+  if (!fh || !fh->file) return 1;
212
+
213
+  if (fh->file->type == MTYPE_MEMORY) {
214
+    switch (mode) {
215
+    case MSPACK_SYS_SEEK_START:
216
+      break;
217
+    case MSPACK_SYS_SEEK_CUR:
218
+      offset += (off_t) fh->x.position;
219
+      break;
220
+    case MSPACK_SYS_SEEK_END:
221
+      offset += (off_t) fh->file->x.memory.length;
222
+      break;
223
+    default:
224
+      return 1;
225
+    }
226
+
227
+    if (offset < 0) return 1;
228
+    if (offset > (off_t) fh->file->x.memory.length) return 1;
229
+    fh->x.position = (size_t) offset;
230
+    return 0;
231
+  }
232
+
233
+  /* file IO based method */
234
+  switch (mode) {
235
+  case MSPACK_SYS_SEEK_START: mode = SEEK_SET; break;
236
+  case MSPACK_SYS_SEEK_CUR:   mode = SEEK_CUR; break;
237
+  case MSPACK_SYS_SEEK_END:   mode = SEEK_END; break;
238
+  default: return 1;
239
+  }
240
+#if HAVE_FSEEKO
241
+  return fseeko(fh->x.fh, offset, mode);
242
+#else
243
+  return fseek(fh->x.fh, offset, mode);
244
+#endif
245
+}
246
+
247
+
248
+static off_t m_tell(struct m_file *fh) {
249
+  if (!fh || !fh->file) return -1;
250
+  if (fh->file->type == MTYPE_MEMORY) {
251
+    return (off_t) fh->x.position;
252
+  }
253
+#if HAVE_FSEEKO
254
+  return (off_t) ftello(fh->x.fh);
255
+#else
256
+  return (off_t) ftell(fh->x.fh);
257
+#endif
258
+}
259
+
260
+
261
+static struct mspack_system multi_system = {
262
+  (struct mspack_file * (*)(struct mspack_system *, const char *, int)) &m_open,
263
+  (void (*)(struct mspack_file *)) &m_close,
264
+  (int (*)(struct mspack_file *, void *, int)) &m_read, 
265
+  (int (*)(struct mspack_file *, void *, int)) &m_write,
266
+  (int (*)(struct mspack_file *, off_t, int)) &m_seek, 
267
+  (off_t (*)(struct mspack_file *)) &m_tell,
268
+  (void (*)(struct mspack_file *, const char *, ...))  &m_msg,
269
+  &m_alloc,
270
+  &m_free,
271
+  &m_copy,
272
+  NULL
273
+};
274
+
275
+/* ------------------------------------------------------------------------ */
276
+/* constructors and destructor */
277
+
278
+const char *create_filename(const char *filename) {
279
+  struct m_filename *fn;
280
+
281
+  if (!filename) return NULL; /* filename must not be null */
282
+
283
+  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
284
+    fn->type = MTYPE_DISKFILE;
285
+    fn->filename = filename; /* pretty-printable filename */
286
+    fn->x.diskfile = filename;
287
+  }
288
+  return (const char *) fn;
289
+}
290
+
291
+const char *create_filename_from_handle(FILE *fh) {
292
+  struct m_filename *fn;
293
+
294
+  if (!fh) return NULL; /* file handle must not be null */
295
+
296
+  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
297
+    fn->type = MTYPE_STDIOFH;
298
+    fn->filename = NULL; /* pretty-printable filename */
299
+    fn->x.stdiofh = fh;
300
+  }
301
+  return (const char *) fn;
302
+}
303
+
304
+const char *create_filename_from_descriptor(int fd) {
305
+  struct m_filename *fn;
306
+
307
+  if (fd < 0) return NULL; /* file descriptor must be valid */
308
+
309
+  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
310
+    fn->type = MTYPE_FILEDESC;
311
+    fn->filename = NULL; /* pretty-printable filename */
312
+    fn->x.filedesc = fd;
313
+  }
314
+  return (const char *) fn;
315
+}
316
+
317
+const char *create_filename_from_memory(void *data, size_t length) {
318
+  struct m_filename *fn;
319
+
320
+  if (!data) return NULL; /* data pointer must not be NULL */
321
+  if (length == 0) return NULL; /* length must not be zero */
322
+
323
+  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
324
+    fn->type = MTYPE_MEMORY;
325
+    fn->filename = NULL; /* pretty-printable filename */
326
+    fn->x.memory.data   = (unsigned char *) data;
327
+    fn->x.memory.length = length;
328
+  }
329
+  return (const char *) fn;
330
+}
331
+
332
+void set_filename_printable_name(const char *filename, const char *name) {
333
+  struct m_filename *fn = (struct m_filename *) filename;
334
+  if (!fn) return;
335
+  /* very basic validation of structure */
336
+  if ((fn->type < MTYPE_DISKFILE) || (fn->type > MTYPE_MEMORY)) return;
337
+  fn->filename = name;
338
+}
339
+
340
+void free_filename(const char *filename) {
341
+  free((void *) filename);
342
+}
343
+
344
+/* ------------------------------------------------------------------------ */
345
+/* example of usage with mscab_decompressor */
346
+
347
+/* a simple cabinet */
348
+static unsigned char memory_cab[] = {
349
+  0x4D,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0xFD,0x00,0x00,0x00,0x00,0x00,0x00,
350
+  0x00,0x2C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x02,0x00,
351
+  0x00,0x00,0x22,0x06,0x00,0x00,0x5E,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x4D,
352
+  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x22,0xBA,0x59,0x20,0x00,
353
+  0x68,0x65,0x6C,0x6C,0x6F,0x2E,0x63,0x00,0x4A,0x00,0x00,0x00,0x4D,0x00,0x00,
354
+  0x00,0x00,0x00,0x6C,0x22,0xE7,0x59,0x20,0x00,0x77,0x65,0x6C,0x63,0x6F,0x6D,
355
+  0x65,0x2E,0x63,0x00,0xBD,0x5A,0xA6,0x30,0x97,0x00,0x97,0x00,0x23,0x69,0x6E,
356
+  0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,0x68,0x3E,
357
+  0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,0x28,0x76,
358
+  0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,0x70,0x72,
359
+  0x69,0x6E,0x74,0x66,0x28,0x22,0x48,0x65,0x6C,0x6C,0x6F,0x2C,0x20,0x77,0x6F,
360
+  0x72,0x6C,0x64,0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x23,
361
+  0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,
362
+  0x68,0x3E,0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,
363
+  0x28,0x76,0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,
364
+  0x70,0x72,0x69,0x6E,0x74,0x66,0x28,0x22,0x57,0x65,0x6C,0x63,0x6F,0x6D,0x65,
365
+  0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x0D,0x0A
366
+};
367
+
368
+int main() {
369
+  const char *mem_cab, *std_out, *std_err, *example;
370
+  struct mscab_decompressor *cabd;
371
+  struct mscabd_cabinet *cab;
372
+  struct mscabd_file *file;
373
+  int err;
374
+
375
+  mem_cab = create_filename_from_memory(&memory_cab[0], sizeof(memory_cab));
376
+  if (!mem_cab) exit(1);
377
+
378
+  std_out = create_filename_from_descriptor(1);
379
+  if (!std_out) exit(1);
380
+
381
+  std_err = create_filename_from_handle(stderr);
382
+  if (!std_err) exit(1);
383
+
384
+  example = create_filename("example.txt");
385
+  if (!example) exit(1);
386
+
387
+  set_filename_printable_name(mem_cab, "internal");
388
+  set_filename_printable_name(std_out, "stdout");
389
+  set_filename_printable_name(std_err, "stderr");
390
+
391
+  /* if self-test reveals an error */
392
+  MSPACK_SYS_SELFTEST(err);
393
+  if (err) exit(1);
394
+
395
+  /* create a cab decompressor using our custom mspack_system interface */
396
+  if ((cabd = mspack_create_cab_decompressor(&multi_system))) {
397
+
398
+    /* open a cab file direct from memory */
399
+    if ((cab = cabd->open(cabd, mem_cab))) {
400
+
401
+      /* first file in the cabinet: print it to stdout */
402
+      file = cab->files;
403
+      if (cabd->extract(cabd, file, std_out)) {
404
+	exit(1);
405
+      }
406
+
407
+      /* second file in the cabinet: print it to stderr */
408
+      file = file->next;
409
+      if (cabd->extract(cabd, file, std_err)) {
410
+	exit(1);
411
+      }
412
+      /* also write it to "example.txt" */
413
+      if (cabd->extract(cabd, file, example)) {
414
+	exit(1);
415
+      }
416
+      cabd->close(cabd, cab);
417
+    }
418
+    else {
419
+      fprintf(stderr, "can't open cabinet (%d)\n", cabd->last_error(cabd));
420
+    }
421
+    mspack_destroy_cab_decompressor(cabd);
422
+  }
423
+  else {
424
+    fprintf(stderr, "can't make decompressor\n");
425
+  }
426
+
427
+  free_filename(example);
428
+  free_filename(std_err);
429
+  free_filename(std_out);
430
+  free_filename(mem_cab);
431
+
432
+  return 0;
433
+
434
+}
... ...
@@ -1,7 +1,7 @@
1 1
 #!/bin/sh
2 2
 # install - install a program, script, or datafile
3 3
 
4
-scriptversion=2011-11-20.07; # UTC
4
+scriptversion=2014-09-12.12; # UTC
5 5
 
6 6
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 7
 # later released in X11R6 (xc/config/util/install.sh) with the
... ...
@@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC
41 41
 # This script is compatible with the BSD install script, but was written
42 42
 # from scratch.
43 43
 
44
+tab='	'
44 45
 nl='
45 46
 '
46
-IFS=" ""	$nl"
47
+IFS=" $tab$nl"
47 48
 
48
-# set DOITPROG to echo to test this script
49
+# Set DOITPROG to "echo" to test this script.
49 50
 
50
-# Don't use :- since 4.3BSD and earlier shells don't like it.
51 51
 doit=${DOITPROG-}
52
-if test -z "$doit"; then
53
-  doit_exec=exec
54
-else
55
-  doit_exec=$doit
56
-fi
52
+doit_exec=${doit:-exec}
57 53
 
58 54
 # Put in absolute file names if you don't have them in your path;
59 55
 # or use environment vars.
... ...
@@ -68,17 +64,6 @@ mvprog=${MVPROG-mv}
68 68
 rmprog=${RMPROG-rm}
69 69
 stripprog=${STRIPPROG-strip}
70 70
 
71
-posix_glob='?'
72
-initialize_posix_glob='
73
-  test "$posix_glob" != "?" || {
74
-    if (set -f) 2>/dev/null; then
75
-      posix_glob=
76
-    else
77
-      posix_glob=:
78
-    fi
79
-  }
80
-'
81
-
82 71
 posix_mkdir=
83 72
 
84 73
 # Desired mode of installed file.
... ...
@@ -97,7 +82,7 @@ dir_arg=
97 97
 dst_arg=
98 98
 
99 99
 copy_on_change=false
100
-no_target_directory=
100
+is_target_a_directory=possibly
101 101
 
102 102
 usage="\
103 103
 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
... ...
@@ -137,46 +122,57 @@ while test $# -ne 0; do
137 137
     -d) dir_arg=true;;
138 138
 
139 139
     -g) chgrpcmd="$chgrpprog $2"
140
-	shift;;
140
+        shift;;
141 141
 
142 142
     --help) echo "$usage"; exit $?;;
143 143
 
144 144
     -m) mode=$2
145
-	case $mode in
146
-	  *' '* | *'	'* | *'
147
-'*	  | *'*'* | *'?'* | *'['*)
148
-	    echo "$0: invalid mode: $mode" >&2
149
-	    exit 1;;
150
-	esac
151
-	shift;;
145
+        case $mode in
146
+          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
147
+            echo "$0: invalid mode: $mode" >&2
148
+            exit 1;;
149
+        esac
150
+        shift;;
152 151
 
153 152
     -o) chowncmd="$chownprog $2"
154
-	shift;;
153
+        shift;;
155 154
 
156 155
     -s) stripcmd=$stripprog;;
157 156
 
158
-    -t) dst_arg=$2
159
-	# Protect names problematic for 'test' and other utilities.
160
-	case $dst_arg in
161
-	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
162
-	esac
163
-	shift;;
157
+    -t)
158
+        is_target_a_directory=always
159
+        dst_arg=$2
160
+        # Protect names problematic for 'test' and other utilities.
161
+        case $dst_arg in
162
+          -* | [=\(\)!]) dst_arg=./$dst_arg;;
163
+        esac
164
+        shift;;
164 165
 
165
-    -T) no_target_directory=true;;
166
+    -T) is_target_a_directory=never;;
166 167
 
167 168
     --version) echo "$0 $scriptversion"; exit $?;;
168 169
 
169
-    --)	shift
170
-	break;;
170
+    --) shift
171
+        break;;
171 172
 
172
-    -*)	echo "$0: invalid option: $1" >&2
173
-	exit 1;;
173
+    -*) echo "$0: invalid option: $1" >&2
174
+        exit 1;;
174 175
 
175 176
     *)  break;;
176 177
   esac
177 178
   shift
178 179
 done
179 180
 
181
+# We allow the use of options -d and -T together, by making -d
182
+# take the precedence; this is for compatibility with GNU install.
183
+
184
+if test -n "$dir_arg"; then
185
+  if test -n "$dst_arg"; then
186
+    echo "$0: target directory not allowed when installing a directory." >&2
187
+    exit 1
188
+  fi
189
+fi
190
+
180 191
 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
181 192
   # When -d is used, all remaining arguments are directories to create.
182 193
   # When -t is used, the destination is already specified.
... ...
@@ -208,6 +204,15 @@ if test $# -eq 0; then
208 208
 fi
209 209
 
210 210
 if test -z "$dir_arg"; then
211
+  if test $# -gt 1 || test "$is_target_a_directory" = always; then
212
+    if test ! -d "$dst_arg"; then
213
+      echo "$0: $dst_arg: Is not a directory." >&2
214
+      exit 1
215
+    fi
216
+  fi
217
+fi
218
+
219
+if test -z "$dir_arg"; then
211 220
   do_exit='(exit $ret); exit $ret'
212 221
   trap "ret=129; $do_exit" 1
213 222
   trap "ret=130; $do_exit" 2
... ...
@@ -223,16 +228,16 @@ if test -z "$dir_arg"; then
223 223
 
224 224
     *[0-7])
225 225
       if test -z "$stripcmd"; then
226
-	u_plus_rw=
226
+        u_plus_rw=
227 227
       else
228
-	u_plus_rw='% 200'
228
+        u_plus_rw='% 200'
229 229
       fi
230 230
       cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
231 231
     *)
232 232
       if test -z "$stripcmd"; then
233
-	u_plus_rw=
233
+        u_plus_rw=
234 234
       else
235
-	u_plus_rw=,u+rw
235
+        u_plus_rw=,u+rw
236 236
       fi
237 237
       cp_umask=$mode$u_plus_rw;;
238 238
   esac
... ...
@@ -269,41 +274,15 @@ do
269 269
     # If destination is a directory, append the input filename; won't work
270 270
     # if double slashes aren't ignored.
271 271
     if test -d "$dst"; then
272
-      if test -n "$no_target_directory"; then
273
-	echo "$0: $dst_arg: Is a directory" >&2
274
-	exit 1
272
+      if test "$is_target_a_directory" = never; then
273
+        echo "$0: $dst_arg: Is a directory" >&2
274
+        exit 1
275 275
       fi
276 276
       dstdir=$dst
277 277
       dst=$dstdir/`basename "$src"`
278 278
       dstdir_status=0
279 279
     else
280
-      # Prefer dirname, but fall back on a substitute if dirname fails.
281
-      dstdir=`
282
-	(dirname "$dst") 2>/dev/null ||
283
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
284
-	     X"$dst" : 'X\(//\)[^/]' \| \
285
-	     X"$dst" : 'X\(//\)$' \| \
286
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
287
-	echo X"$dst" |
288
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
289
-		   s//\1/
290
-		   q
291
-		 }
292
-		 /^X\(\/\/\)[^/].*/{
293
-		   s//\1/
294
-		   q
295
-		 }
296
-		 /^X\(\/\/\)$/{
297
-		   s//\1/
298
-		   q
299
-		 }
300
-		 /^X\(\/\).*/{
301
-		   s//\1/
302
-		   q
303
-		 }
304
-		 s/.*/./; q'
305
-      `
306
-
280
+      dstdir=`dirname "$dst"`
307 281
       test -d "$dstdir"
308 282
       dstdir_status=$?
309 283
     fi
... ...
@@ -314,74 +293,81 @@ do
314 314
   if test $dstdir_status != 0; then
315 315
     case $posix_mkdir in
316 316
       '')
317
-	# Create intermediate dirs using mode 755 as modified by the umask.
318
-	# This is like FreeBSD 'install' as of 1997-10-28.
319
-	umask=`umask`
320
-	case $stripcmd.$umask in
321
-	  # Optimize common cases.
322
-	  *[2367][2367]) mkdir_umask=$umask;;
323
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
324
-
325
-	  *[0-7])
326
-	    mkdir_umask=`expr $umask + 22 \
327
-	      - $umask % 100 % 40 + $umask % 20 \
328
-	      - $umask % 10 % 4 + $umask % 2
329
-	    `;;
330
-	  *) mkdir_umask=$umask,go-w;;
331
-	esac
332
-
333
-	# With -d, create the new directory with the user-specified mode.
334
-	# Otherwise, rely on $mkdir_umask.
335
-	if test -n "$dir_arg"; then
336
-	  mkdir_mode=-m$mode
337
-	else
338
-	  mkdir_mode=
339
-	fi
340
-
341
-	posix_mkdir=false
342
-	case $umask in
343
-	  *[123567][0-7][0-7])
344
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
345
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
346
-	    ;;
347
-	  *)
348
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
349
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
350
-
351
-	    if (umask $mkdir_umask &&
352
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
353
-	    then
354
-	      if test -z "$dir_arg" || {
355
-		   # Check for POSIX incompatibilities with -m.
356
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
357
-		   # other-writable bit of parent directory when it shouldn't.
358
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
359
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
360
-		   case $ls_ld_tmpdir in
361
-		     d????-?r-*) different_mode=700;;
362
-		     d????-?--*) different_mode=755;;
363
-		     *) false;;
364
-		   esac &&
365
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
366
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
367
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
368
-		   }
369
-		 }
370
-	      then posix_mkdir=:
371
-	      fi
372
-	      rmdir "$tmpdir/d" "$tmpdir"
373
-	    else
374
-	      # Remove any dirs left behind by ancient mkdir implementations.
375
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
376
-	    fi
377
-	    trap '' 0;;
378
-	esac;;
317
+        # Create intermediate dirs using mode 755 as modified by the umask.
318
+        # This is like FreeBSD 'install' as of 1997-10-28.
319
+        umask=`umask`
320
+        case $stripcmd.$umask in
321
+          # Optimize common cases.
322
+          *[2367][2367]) mkdir_umask=$umask;;
323
+          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
324
+
325
+          *[0-7])
326
+            mkdir_umask=`expr $umask + 22 \
327
+              - $umask % 100 % 40 + $umask % 20 \
328
+              - $umask % 10 % 4 + $umask % 2
329
+            `;;
330
+          *) mkdir_umask=$umask,go-w;;
331
+        esac
332
+
333
+        # With -d, create the new directory with the user-specified mode.
334
+        # Otherwise, rely on $mkdir_umask.
335
+        if test -n "$dir_arg"; then
336
+          mkdir_mode=-m$mode
337
+        else
338
+          mkdir_mode=
339
+        fi
340
+
341
+        posix_mkdir=false
342
+        case $umask in
343
+          *[123567][0-7][0-7])
344
+            # POSIX mkdir -p sets u+wx bits regardless of umask, which
345
+            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
346
+            ;;
347
+          *)
348
+            # $RANDOM is not portable (e.g. dash);  use it when possible to
349
+            # lower collision chance
350
+            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
351
+            trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
352
+
353
+            # As "mkdir -p" follows symlinks and we work in /tmp possibly;  so
354
+            # create the $tmpdir first (and fail if unsuccessful) to make sure
355
+            # that nobody tries to guess the $tmpdir name.
356
+            if (umask $mkdir_umask &&
357
+                $mkdirprog $mkdir_mode "$tmpdir" &&
358
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
359
+            then
360
+              if test -z "$dir_arg" || {
361
+                   # Check for POSIX incompatibilities with -m.
362
+                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
363
+                   # other-writable bit of parent directory when it shouldn't.
364
+                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
365
+                   test_tmpdir="$tmpdir/a"
366
+                   ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
367
+                   case $ls_ld_tmpdir in
368
+                     d????-?r-*) different_mode=700;;
369
+                     d????-?--*) different_mode=755;;
370
+                     *) false;;
371
+                   esac &&
372
+                   $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
373
+                     ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
374
+                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
375
+                   }
376
+                 }
377
+              then posix_mkdir=:
378
+              fi
379
+              rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
380
+            else
381
+              # Remove any dirs left behind by ancient mkdir implementations.
382
+              rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
383
+            fi
384
+            trap '' 0;;
385
+        esac;;
379 386
     esac
380 387
 
381 388
     if
382 389
       $posix_mkdir && (
383
-	umask $mkdir_umask &&
384
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
390
+        umask $mkdir_umask &&
391
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
385 392
       )
386 393
     then :
387 394
     else
... ...
@@ -391,53 +377,51 @@ do
391 391
       # directory the slow way, step by step, checking for races as we go.
392 392
 
393 393
       case $dstdir in
394
-	/*) prefix='/';;
395
-	[-=\(\)!]*) prefix='./';;
396
-	*)  prefix='';;
394
+        /*) prefix='/';;
395
+        [-=\(\)!]*) prefix='./';;
396
+        *)  prefix='';;
397 397
       esac
398 398
 
399
-      eval "$initialize_posix_glob"
400
-
401 399
       oIFS=$IFS
402 400
       IFS=/
403
-      $posix_glob set -f
401
+      set -f
404 402
       set fnord $dstdir
405 403
       shift
406
-      $posix_glob set +f
404
+      set +f
407 405
       IFS=$oIFS
408 406
 
409 407
       prefixes=
410 408
 
411 409
       for d
412 410
       do
413
-	test X"$d" = X && continue
414
-
415
-	prefix=$prefix$d
416
-	if test -d "$prefix"; then
417
-	  prefixes=
418
-	else
419
-	  if $posix_mkdir; then
420
-	    (umask=$mkdir_umask &&
421
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
422
-	    # Don't fail if two instances are running concurrently.
423
-	    test -d "$prefix" || exit 1
424
-	  else
425
-	    case $prefix in
426
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
427
-	      *) qprefix=$prefix;;
428
-	    esac
429
-	    prefixes="$prefixes '$qprefix'"
430
-	  fi
431
-	fi
432
-	prefix=$prefix/
411
+        test X"$d" = X && continue
412
+
413
+        prefix=$prefix$d
414
+        if test -d "$prefix"; then
415
+          prefixes=
416
+        else
417
+          if $posix_mkdir; then
418
+            (umask=$mkdir_umask &&
419
+             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
420
+            # Don't fail if two instances are running concurrently.
421
+            test -d "$prefix" || exit 1
422
+          else
423
+            case $prefix in
424
+              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
425
+              *) qprefix=$prefix;;
426
+            esac
427
+            prefixes="$prefixes '$qprefix'"
428
+          fi
429
+        fi
430
+        prefix=$prefix/
433 431
       done
434 432
 
435 433
       if test -n "$prefixes"; then
436
-	# Don't fail if two instances are running concurrently.
437
-	(umask $mkdir_umask &&
438
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
439
-	  test -d "$dstdir" || exit 1
440
-	obsolete_mkdir_used=true
434
+        # Don't fail if two instances are running concurrently.
435
+        (umask $mkdir_umask &&
436
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
437
+          test -d "$dstdir" || exit 1
438
+        obsolete_mkdir_used=true
441 439
       fi
442 440
     fi
443 441
   fi
... ...
@@ -472,15 +456,12 @@ do
472 472
 
473 473
     # If -C, don't bother to copy if it wouldn't change the file.
474 474
     if $copy_on_change &&
475
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
476
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
477
-
478
-       eval "$initialize_posix_glob" &&
479
-       $posix_glob set -f &&
475
+       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
476
+       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
477
+       set -f &&
480 478
        set X $old && old=:$2:$4:$5:$6 &&
481 479
        set X $new && new=:$2:$4:$5:$6 &&
482
-       $posix_glob set +f &&
483
-
480
+       set +f &&
484 481
        test "$old" = "$new" &&
485 482
        $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
486 483
     then
... ...
@@ -493,24 +474,24 @@ do
493 493
       # to itself, or perhaps because mv is so ancient that it does not
494 494
       # support -f.
495 495
       {
496
-	# Now remove or move aside any old file at destination location.
497
-	# We try this two ways since rm can't unlink itself on some
498
-	# systems and the destination file might be busy for other
499
-	# reasons.  In this case, the final cleanup might fail but the new
500
-	# file should still install successfully.
501
-	{
502
-	  test ! -f "$dst" ||
503
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
504
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
505
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
506
-	  } ||
507
-	  { echo "$0: cannot unlink or rename $dst" >&2
508
-	    (exit 1); exit 1
509
-	  }
510
-	} &&
511
-
512
-	# Now rename the file to the real destination.
513
-	$doit $mvcmd "$dsttmp" "$dst"
496
+        # Now remove or move aside any old file at destination location.
497
+        # We try this two ways since rm can't unlink itself on some
498
+        # systems and the destination file might be busy for other
499
+        # reasons.  In this case, the final cleanup might fail but the new
500
+        # file should still install successfully.
501
+        {
502
+          test ! -f "$dst" ||
503
+          $doit $rmcmd -f "$dst" 2>/dev/null ||
504
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
505
+            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
506
+          } ||
507
+          { echo "$0: cannot unlink or rename $dst" >&2
508
+            (exit 1); exit 1
509
+          }
510
+        } &&
511
+
512
+        # Now rename the file to the real destination.
513
+        $doit $mvcmd "$dsttmp" "$dst"
514 514
       }
515 515
     fi || exit 1
516 516
 
517 517
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+prefix=@prefix@
1
+exec_prefix=@exec_prefix@
2
+libdir=@libdir@
3
+includedir=@includedir@
4
+
5
+Name: @PACKAGE@
6
+Description: Compressors and decompressors for Microsoft formats
7
+Version: @VERSION@
8
+Libs: -L${libdir} -lmspack
9
+Cflags: -I${includedir}
... ...
@@ -31,7 +31,7 @@
31 31
 
32 32
 PROGRAM=libtool
33 33
 PACKAGE=libtool
34
-VERSION=2.4.6
34
+VERSION="2.4.6 Debian-2.4.6-2"
35 35
 package_revision=2.4.6
36 36
 
37 37
 
... ...
@@ -2068,12 +2068,12 @@ include the following information:
2068 2068
        compiler:       $LTCC
2069 2069
        compiler flags: $LTCFLAGS
2070 2070
        linker:         $LD (gnu? $with_gnu_ld)
2071
-       version:        $progname (GNU libtool) 2.4.6
2071
+       version:        $progname $scriptversion Debian-2.4.6-2
2072 2072
        automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2073 2073
        autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2074 2074
 
2075 2075
 Report bugs to <bug-libtool@gnu.org>.
2076
-GNU libtool home page: <http://www.gnu.org/software/libtool/>.
2076
+GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2077 2077
 General help using GNU software: <http://www.gnu.org/gethelp/>."
2078 2078
     exit 0
2079 2079
 }
... ...
@@ -7272,10 +7272,13 @@ func_mode_link ()
7272 7272
       # -tp=*                Portland pgcc target processor selection
7273 7273
       # --sysroot=*          for sysroot support
7274 7274
       # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7275
+      # -specs=*             GCC specs files
7275 7276
       # -stdlib=*            select c++ std lib with clang
7277
+      # -fsanitize=*         Clang/GCC memory and address sanitizer
7276 7278
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7277 7279
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7278
-      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
7280
+      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7281
+      -specs=*|-fsanitize=*)
7279 7282
         func_quote_for_eval "$arg"
7280 7283
 	arg=$func_quote_for_eval_result
7281 7284
         func_append compile_command " $arg"
... ...
@@ -7568,7 +7571,10 @@ func_mode_link ()
7568 7568
 	case $pass in
7569 7569
 	dlopen) libs=$dlfiles ;;
7570 7570
 	dlpreopen) libs=$dlprefiles ;;
7571
-	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
7571
+	link)
7572
+	  libs="$deplibs %DEPLIBS%"
7573
+	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
7574
+	  ;;
7572 7575
 	esac
7573 7576
       fi
7574 7577
       if test lib,dlpreopen = "$linkmode,$pass"; then
... ...
@@ -7887,19 +7893,19 @@ func_mode_link ()
7887 7887
 	    # It is a libtool convenience library, so add in its objects.
7888 7888
 	    func_append convenience " $ladir/$objdir/$old_library"
7889 7889
 	    func_append old_convenience " $ladir/$objdir/$old_library"
7890
+	    tmp_libs=
7891
+	    for deplib in $dependency_libs; do
7892
+	      deplibs="$deplib $deplibs"
7893
+	      if $opt_preserve_dup_deps; then
7894
+		case "$tmp_libs " in
7895
+		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
7896
+		esac
7897
+	      fi
7898
+	      func_append tmp_libs " $deplib"
7899
+	    done
7890 7900
 	  elif test prog != "$linkmode" && test lib != "$linkmode"; then
7891 7901
 	    func_fatal_error "'$lib' is not a convenience library"
7892 7902
 	  fi
7893
-	  tmp_libs=
7894
-	  for deplib in $dependency_libs; do
7895
-	    deplibs="$deplib $deplibs"
7896
-	    if $opt_preserve_dup_deps; then
7897
-	      case "$tmp_libs " in
7898
-	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7899
-	      esac
7900
-	    fi
7901
-	    func_append tmp_libs " $deplib"
7902
-	  done
7903 7903
 	  continue
7904 7904
 	fi # $pass = conv
7905 7905
 
... ...
@@ -8823,6 +8829,9 @@ func_mode_link ()
8823 8823
 	    revision=$number_minor
8824 8824
 	    lt_irix_increment=no
8825 8825
 	    ;;
8826
+	  *)
8827
+	    func_fatal_configuration "$modename: unknown library version type '$version_type'"
8828
+	    ;;
8826 8829
 	  esac
8827 8830
 	  ;;
8828 8831
 	no)
8829 8832
deleted file mode 100644
... ...
@@ -1,8 +0,0 @@
1
-dnl Act as a single handler point for libmspack options
2
-dnl Assigns system_libmspack variable
3
-
4
-dnl Determine whether to use the internal libmspack or to use system-specified libmspack
5
-AC_ARG_WITH([system-libmspack], AC_HELP_STRING([--with-system-libmspack],
6
-[Specify system libmspack location or to use internal package, uses full path to libmspack or bin directory
7
-     (default=search PATH environment variable)]),
8
-[system_libmspack=$withval], [system_libmspack="no"])
... ...
@@ -728,7 +728,6 @@ _LT_CONFIG_SAVE_COMMANDS([
728 728
     cat <<_LT_EOF >> "$cfgfile"
729 729
 #! $SHELL
730 730
 # Generated automatically by $as_me ($PACKAGE) $VERSION
731
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
732 731
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
733 732
 
734 733
 # Provide generalized library-building support services.
... ...
@@ -2887,6 +2886,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
2887 2887
   dynamic_linker='GNU/Linux ld.so'
2888 2888
   ;;
2889 2889
 
2890
+netbsdelf*-gnu)
2891
+  version_type=linux
2892
+  need_lib_prefix=no
2893
+  need_version=no
2894
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2895
+  soname_spec='${libname}${release}${shared_ext}$major'
2896
+  shlibpath_var=LD_LIBRARY_PATH
2897
+  shlibpath_overrides_runpath=no
2898
+  hardcode_into_libs=yes
2899
+  dynamic_linker='NetBSD ld.elf_so'
2900
+  ;;
2901
+
2890 2902
 netbsd*)
2891 2903
   version_type=sunos
2892 2904
   need_lib_prefix=no
... ...
@@ -3546,7 +3557,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
3546 3546
   lt_cv_deplibs_check_method=pass_all
3547 3547
   ;;
3548 3548
 
3549
-netbsd*)
3549
+netbsd* | netbsdelf*-gnu)
3550 3550
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
3551 3551
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
3552 3552
   else
... ...
@@ -4424,7 +4435,7 @@ m4_if([$1], [CXX], [
4424 4424
 	    ;;
4425 4425
 	esac
4426 4426
 	;;
4427
-      netbsd*)
4427
+      netbsd* | netbsdelf*-gnu)
4428 4428
 	;;
4429 4429
       *qnx* | *nto*)
4430 4430
         # QNX uses GNU C++, but need to define -shared option too, otherwise
... ...
@@ -4936,6 +4947,9 @@ m4_if([$1], [CXX], [
4936 4936
       ;;
4937 4937
     esac
4938 4938
     ;;
4939
+  linux* | k*bsd*-gnu | gnu*)
4940
+    _LT_TAGVAR(link_all_deplibs, $1)=no
4941
+    ;;
4939 4942
   *)
4940 4943
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
4941 4944
     ;;
... ...
@@ -4998,6 +5012,9 @@ dnl Note also adjust exclude_expsyms for C++ above.
4998 4998
   openbsd* | bitrig*)
4999 4999
     with_gnu_ld=no
5000 5000
     ;;
5001
+  linux* | k*bsd*-gnu | gnu*)
5002
+    _LT_TAGVAR(link_all_deplibs, $1)=no
5003
+    ;;
5001 5004
   esac
5002 5005
 
5003 5006
   _LT_TAGVAR(ld_shlibs, $1)=yes
... ...
@@ -5252,7 +5269,7 @@ _LT_EOF
5252 5252
       fi
5253 5253
       ;;
5254 5254
 
5255
-    netbsd*)
5255
+    netbsd* | netbsdelf*-gnu)
5256 5256
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
5257 5257
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
5258 5258
 	wlarc=
... ...
@@ -5773,6 +5790,7 @@ _LT_EOF
5773 5773
 	if test yes = "$lt_cv_irix_exported_symbol"; then
5774 5774
           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
5775 5775
 	fi
5776
+	_LT_TAGVAR(link_all_deplibs, $1)=no
5776 5777
       else
5777 5778
 	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
5778 5779
 	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
... ...
@@ -5794,7 +5812,7 @@ _LT_EOF
5794 5794
       esac
5795 5795
       ;;
5796 5796
 
5797
-    netbsd*)
5797
+    netbsd* | netbsdelf*-gnu)
5798 5798
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
5799 5799
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
5800 5800
       else
... ...
@@ -3,7 +3,7 @@
3 3
 
4 4
 scriptversion=2013-10-28.13; # UTC
5 5
 
6
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
6
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
7 7
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
8 8
 
9 9
 # This program is free software; you can redistribute it and/or modify
... ...
@@ -67,8 +67,7 @@
67 67
  * more than 6144 bytes. Quantum has no documentation, but the largest
68 68
  * block seen in the wild is 337 bytes above uncompressed size.
69 69
  */
70
-#define CAB_BLOCKMAX (65535)
71
-#define CAB_BLOCKSTD (32768)
70
+#define CAB_BLOCKMAX (32768)
72 71
 #define CAB_INPUTMAX (CAB_BLOCKMAX+6144)
73 72
 
74 73
 /* There are no more than 65535 data blocks per folder, so a folder cannot
... ...
@@ -76,7 +75,7 @@
76 76
  * one folder, this is also their max offset, length and offset+length limit.
77 77
  */
78 78
 #define CAB_FOLDERMAX (65535)
79
-#define CAB_LENGTHMAX UINT_MAX
79
+#define CAB_LENGTHMAX (CAB_BLOCKMAX * CAB_FOLDERMAX)
80 80
 
81 81
 /* CAB compression definitions */
82 82
 
... ...
@@ -132,10 +131,4 @@ struct mscabd_folder_p {
132 132
   struct mscabd_file *merge_next;    /* first file needing forwards merge    */
133 133
 };
134 134
 
135
-#ifdef _WIN32
136
-#include <basetsd.h>
137
-#define ssize_t SSIZE_T
138
-#endif // _WIN32
139
-
140
-
141 135
 #endif
... ...
@@ -15,13 +15,10 @@
15 15
 struct mscab_compressor *
16 16
   mspack_create_cab_compressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_cab_compressor(struct mscab_compressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -24,7 +24,6 @@
24 24
 #include <system.h>
25 25
 #include <cab.h>
26 26
 #include <assert.h>
27
-#include <ctype.h>
28 27
 
29 28
 /* Notes on compliance with cabinet specification:
30 29
  *
... ...
@@ -156,7 +155,7 @@ struct mscab_decompressor *
156 156
     self->error           = MSPACK_ERR_OK;
157 157
 
158 158
     self->param[MSCABD_PARAM_SEARCHBUF] = 32768;
159
-    self->param[MSCABD_PARAM_FIXMSZIP]  = 1;
159
+    self->param[MSCABD_PARAM_FIXMSZIP]  = 0;
160 160
     self->param[MSCABD_PARAM_DECOMPBUF] = 4096;
161 161
   }
162 162
   return (struct mscab_decompressor *) self;
... ...
@@ -296,33 +295,6 @@ static void cabd_close(struct mscab_decompressor *base,
296 296
   }
297 297
 }
298 298
 
299
-static int cab_chkname(
300
-           struct mspack_system *sys,
301
-           char *name,
302
-           int san)
303
-{
304
-  size_t i, len = 0;
305
-
306
-  if (NULL == sys || NULL == name) return 1;
307
-
308
-  len = strlen(name);
309
-
310
-  for (i = 0; i < len; i++)
311
-  {
312
-    if (!san && (strchr("%/*?|\\\"+=<>;:\t ", name[i]) || !isascii(name[i])))
313
-    {
314
-      sys->message(NULL, "cab_chkname: File name contains disallowed characters");
315
-      return 1;
316
-    }
317
-    else if (san && !isalnum((unsigned char)(name[i])))
318
-    {
319
-      name[i] = '*';
320
-    }
321
-  }
322
-
323
-  return 0;
324
-}
325
-
326 299
 /***************************************
327 300
  * CABD_READ_HEADERS
328 301
  ***************************************
... ...
@@ -335,9 +307,7 @@ static int cabd_read_headers(struct mspack_system *sys,
335 335
 			     struct mscabd_cabinet_p *cab,
336 336
 			     off_t offset, int quiet)
337 337
 {
338
-  unsigned int found_files = 0, found_folders = 0;
339
-  unsigned int num_folders, num_files, folder_resv, i, x, fidx;
340
-  int read_string_errno = 0;
338
+  int num_folders, num_files, folder_resv, i, x;
341 339
   struct mscabd_folder_p *fol, *linkfol = NULL;
342 340
   struct mscabd_file *file, *linkfile = NULL;
343 341
   unsigned char buf[64];
... ...
@@ -375,26 +345,24 @@ static int cabd_read_headers(struct mspack_system *sys,
375 375
   /* get the number of folders */
376 376
   num_folders = EndGetI16(&buf[cfhead_NumFolders]);
377 377
   if (num_folders == 0) {
378
-    sys->message(fh, "no folders in cabinet.");
378
+    if (!quiet) sys->message(fh, "no folders in cabinet.");
379 379
     return MSPACK_ERR_DATAFORMAT;
380 380
   }
381 381
 
382 382
   /* get the number of files */
383 383
   num_files = EndGetI16(&buf[cfhead_NumFiles]);
384 384
   if (num_files == 0) {
385
-    sys->message(fh, "no files in cabinet.");
385
+    if (!quiet) sys->message(fh, "no files in cabinet.");
386 386
     return MSPACK_ERR_DATAFORMAT;
387 387
   }
388 388
 
389 389
   /* check cabinet version */
390 390
   if ((buf[cfhead_MajorVersion] != 1) && (buf[cfhead_MinorVersion] != 3)) {
391
-    sys->message(fh, "WARNING; unexpected cabinet version %d.%d (expected 1.3)", buf[cfhead_MajorVersion], buf[cfhead_MinorVersion]);
391
+    if (!quiet) sys->message(fh, "WARNING; cabinet version is not 1.3");
392 392
   }
393 393
 
394 394
   /* read the reserved-sizes part of header, if present */
395 395
   cab->base.flags = EndGetI16(&buf[cfhead_Flags]);
396
-  cab->base.file_offset = EndGetI32(&buf[cfhead_FileOffset]);
397
-
398 396
   if (cab->base.flags & cfheadRESERVE_PRESENT) {
399 397
     if (sys->read(fh, &buf[0], cfheadext_SIZEOF) != cfheadext_SIZEOF) {
400 398
       return MSPACK_ERR_READ;
... ...
@@ -422,31 +390,15 @@ static int cabd_read_headers(struct mspack_system *sys,
422 422
 
423 423
   /* read name and info of preceeding cabinet in set, if present */
424 424
   if (cab->base.flags & cfheadPREV_CABINET) {
425
-    cab->base.prevname = cabd_read_string(sys, fh, &read_string_errno); if (read_string_errno) return read_string_errno;
426
-    if(cab_chkname(sys, cab->base.prevname, 0))
427
-        sys->message(NULL, "CAB: Invalid name of preceding cabinet");
428
-    else
429
-        sys->message(NULL, "CAB: Preceding cabinet name: %s", cab->base.prevname);
430
-    cab->base.previnfo = cabd_read_string(sys, fh, &read_string_errno); if (read_string_errno) return read_string_errno;
431
-    if(cab_chkname(sys, cab->base.previnfo, 0))
432
-        sys->message(NULL, "CAB: Invalid info of preceding cabinet");
433
-    else
434
-        sys->message(NULL, "CAB: Preceding cabinet info: %s", cab->base.previnfo);
425
+    cab->base.prevname = cabd_read_string(sys, fh, &x); if (x) return x;
426
+    cab->base.previnfo = cabd_read_string(sys, fh, &x); if (x) return x;
435 427
   }
436 428
 
437 429
   /* read name and info of next cabinet in set, if present */
438 430
   if (cab->base.flags & cfheadNEXT_CABINET) {
439
-    cab->base.nextname = cabd_read_string(sys, fh, &read_string_errno); if (read_string_errno) return read_string_errno;
440
-    if(cab_chkname(sys, cab->base.nextname, 0))
441
-        sys->message(NULL, "CAB: Invalid name of next cabinet");
442
-    else
443
-        sys->message(NULL, "CAB: Next cabinet name: %s", cab->base.nextname);
444
-    cab->base.nextinfo = cabd_read_string(sys, fh, &read_string_errno); if (read_string_errno) return read_string_errno;
445
-    if(cab_chkname(sys, cab->base.nextinfo, 0))
446
-        sys->message(NULL, "CAB: Invalid info of next cabinet");
447
-    else
448
-        sys->message(NULL, "CAB: Next cabinet info: %s", cab->base.nextinfo);
449
-}
431
+    cab->base.nextname = cabd_read_string(sys, fh, &x); if (x) return x;
432
+    cab->base.nextinfo = cabd_read_string(sys, fh, &x); if (x) return x;
433
+  }
450 434
 
451 435
   /* read folders */
452 436
   for (i = 0; i < num_folders; i++) {
... ...
@@ -472,26 +424,10 @@ static int cabd_read_headers(struct mspack_system *sys,
472 472
     fol->merge_prev      = NULL;
473 473
     fol->merge_next      = NULL;
474 474
 
475
-    sys->message(fh, "CAB: Folder record %u", i);
476
-    sys->message(fh, "CAB: Folder offset: %u", (unsigned int) fol->data.offset);
477
-    sys->message(fh, "CAB: Folder compression method: %d", fol->base.comp_type);
478
-
479 475
     /* link folder into list of folders */
480 476
     if (!linkfol) cab->base.folders = (struct mscabd_folder *) fol;
481 477
     else linkfol->base.next = (struct mscabd_folder *) fol;
482 478
     linkfol = fol;
483
-    found_folders++;
484
-  }
485
-
486
-  sys->message(fh, "CAB: Recorded folders: %u", found_folders);
487
-
488
-  /* if the # folders found does not match the # listed in the header
489
-   * then adjust the offset to point to the first file entry because
490
-   * the offset is probably incorrect now */
491
-  if(num_folders != found_folders) {
492
-    /* if the file offset is bogus and we just seeked out of the file,
493
-     * the next read will fail */
494
-    sys->seek(fh, cab->base.file_offset, MSPACK_SYS_SEEK_START);
495 479
   }
496 480
 
497 481
   /* read files */
... ...
@@ -504,37 +440,31 @@ static int cabd_read_headers(struct mspack_system *sys,
504 504
       return MSPACK_ERR_NOMEMORY;
505 505
     }
506 506
 
507
-    file->folder   = NULL;
508 507
     file->next     = NULL;
509 508
     file->length   = EndGetI32(&buf[cffile_UncompressedSize]);
510 509
     file->attribs  = EndGetI16(&buf[cffile_Attribs]);
511 510
     file->offset   = EndGetI32(&buf[cffile_FolderOffset]);
512 511
 
513 512
     /* set folder pointer */
514
-    fidx = EndGetI16(&buf[cffile_FolderIndex]);
515
-    if (fidx < num_folders) {
513
+    x = EndGetI16(&buf[cffile_FolderIndex]);
514
+    if (x < cffileCONTINUED_FROM_PREV) {
516 515
       /* normal folder index; count up to the correct folder. the folder
517 516
        * pointer will be NULL if folder index is invalid */
518 517
       struct mscabd_folder *ifol = cab->base.folders; 
519
-      while (fidx--) if (ifol) ifol = ifol->next;
518
+      while (x--) if (ifol) ifol = ifol->next;
520 519
       file->folder = ifol;
521 520
 
522 521
       if (!ifol) {
523
-        sys->free(file);
524
-        sys->message(NULL, "Folder not found for file %s", file->filename);
525
-        /* ignore invalid file and continue parsing */
526
-        if (file->filename) {
527
-          sys->free(file->filename);
528
-          file->filename = NULL;
529
-        }
530
-        sys->free(file);
531
-        continue;
522
+	sys->free(file);
523
+	D(("invalid folder index"))
524
+	return MSPACK_ERR_DATAFORMAT;
532 525
       }
533 526
     }
534
-    else if (fidx >= cffileCONTINUED_FROM_PREV) {
527
+    else {
535 528
       /* either CONTINUED_TO_NEXT, CONTINUED_FROM_PREV or
536 529
        * CONTINUED_PREV_AND_NEXT */
537
-      if ((fidx == cffileCONTINUED_TO_NEXT) || (fidx == cffileCONTINUED_PREV_AND_NEXT))
530
+      if ((x == cffileCONTINUED_TO_NEXT) ||
531
+	  (x == cffileCONTINUED_PREV_AND_NEXT))
538 532
       {
539 533
 	/* get last folder */
540 534
 	struct mscabd_folder *ifol = cab->base.folders;
... ...
@@ -546,7 +476,8 @@ static int cabd_read_headers(struct mspack_system *sys,
546 546
 	if (!fol->merge_next) fol->merge_next = file;
547 547
       }
548 548
 
549
-      if ((fidx == cffileCONTINUED_FROM_PREV) || (fidx == cffileCONTINUED_PREV_AND_NEXT))
549
+      if ((x == cffileCONTINUED_FROM_PREV) ||
550
+	  (x == cffileCONTINUED_PREV_AND_NEXT))
550 551
       {
551 552
 	/* get first folder */
552 553
 	file->folder = cab->base.folders;
... ...
@@ -556,12 +487,6 @@ static int cabd_read_headers(struct mspack_system *sys,
556 556
 	if (!fol->merge_prev) fol->merge_prev = file;
557 557
       }
558 558
     }
559
-    else {
560
-      /* unexpected/invalid folder index */
561
-      file->folder = NULL;
562
-      sys->message(fh, "WARNING; cab header file %d of %d has invalid folder index (%d out of %d folders)", 
563
-        i + 1, num_files, fidx, num_folders);
564
-    }
565 559
 
566 560
     /* get time */
567 561
     x = EndGetI16(&buf[cffile_Time]);
... ...
@@ -576,59 +501,16 @@ static int cabd_read_headers(struct mspack_system *sys,
576 576
     file->date_y = (x >> 9) + 1980;
577 577
 
578 578
     /* get filename */
579
-    file->filename = cabd_read_string(sys, fh, &read_string_errno);
580
-    if (read_string_errno) {
581
-        /* unexpected/invalid folder index */
582
-        file->filename = NULL;
583
-        sys->message(fh, "WARNING; cab header file %d of %d has invalid filename", i + 1, num_files);
584
-    }
585
-    else {
586
-      /* sanitize the name, incase it contains invalid characters */
587
-      cab_chkname(sys, file->filename, 1);
588
-    }
589
-
590
-    if (file->folder && !read_string_errno) {
591
-        sys->message(NULL, "CAB: File record %u", i);
592
-        sys->message(NULL, "CAB: File name: %s", file->filename);
593
-        sys->message(NULL, "CAB: File offset: %u", (unsigned int) file->offset);
594
-        sys->message(NULL, "CAB: File folder index: %u", fidx);
595
-        sys->message(NULL, "CAB: File attribs: 0x%x", file->attribs);
596
-        if(file->attribs & 0x01)
597
-            sys->message(NULL, "CAB:   * file is read-only");
598
-        if(file->attribs & 0x02)
599
-            sys->message(NULL, "CAB:   * file is hidden");
600
-        if(file->attribs & 0x04)
601
-            sys->message(NULL, "CAB:   * file is a system file");
602
-        if(file->attribs & 0x20)
603
-            sys->message(NULL, "CAB:   * file modified since last backup");
604
-        if(file->attribs & 0x40)
605
-            sys->message(NULL, "CAB:   * file to be run after extraction");
606
-        if(file->attribs & 0x80)
607
-            sys->message(NULL, "CAB:   * file name contains UTF");
608
-    
609
-        /* link file entry into file list */
610
-        if (!linkfile) cab->base.files = file;
611
-        else linkfile->next = file;
612
-        linkfile = file;
613
-        found_files++;
614
-    }
615
-    else {
616
-        /* ignore invalid file and continue parsing */
617
-        if (file->filename) {
618
-          sys->free(file->filename);
619
-          file->filename = NULL;
620
-        }
621
-        sys->free(file);
622
-        sys->message(fh, "WARNING; omitting file %d of %d from file list.", i, num_files);
579
+    file->filename = cabd_read_string(sys, fh, &x);
580
+    if (x) { 
581
+      sys->free(file);
582
+      return x;
623 583
     }
624
-  }
625
-  sys->message(NULL, "CAB: Recorded files: %u\n", found_files);
626 584
 
627
-  if (cab->base.files == NULL) {
628
-    /* We never actually added any files to the file list.  Something went wrong.
629
-     * The file header may have been invalid */
630
-    sys->message(NULL, "No files found, even though header claimed to have %d files", num_files);
631
-    return MSPACK_ERR_DATAFORMAT;
585
+    /* link file entry into file list */
586
+    if (!linkfile) cab->base.files = file;
587
+    else linkfile->next = file;
588
+    linkfile = file;
632 589
   }
633 590
 
634 591
   return MSPACK_ERR_OK;
... ...
@@ -639,21 +521,21 @@ static char *cabd_read_string(struct mspack_system *sys,
639 639
 {
640 640
   off_t base = sys->tell(fh);
641 641
   char buf[256], *str;
642
-  unsigned int ok;
643
-  int i, len;
642
+  int len, i, ok;
644 643
 
645 644
   /* read up to 256 bytes */
646
-  len = sys->read(fh, &buf[0], 256);
647
-  if (len <= 0) {
648
-      *error = MSPACK_ERR_READ;
649
-      return NULL;
645
+  if ((len = sys->read(fh, &buf[0], 256)) <= 0) {
646
+    *error = MSPACK_ERR_READ;
647
+    return NULL;
650 648
   }
651
-  
652
-  /* search for a null terminator in the buffer. reject empty strings */
653
-  for (i = 1, ok = 0; i < len; i++) if (!buf[i]) { ok = 1; break; }
649
+
650
+  /* search for a null terminator in the buffer */
651
+  for (i = 0, ok = 0; i < len; i++) if (!buf[i]) { ok = 1; break; }
652
+  /* reject empty strings */
653
+  if (i == 0) ok = 0;
654
+
654 655
   if (!ok) {
655 656
     *error = MSPACK_ERR_DATAFORMAT;
656
-    sys->message(NULL, "Unable to find null terminator for string read in buffer of len %d", len);
657 657
     return NULL;
658 658
   }
659 659
 
... ...
@@ -751,7 +633,7 @@ static int cabd_find(struct mscab_decompressor_p *self, unsigned char *buf,
751 751
   unsigned int cablen_u32 = 0, foffset_u32 = 0;
752 752
   int false_cabs = 0;
753 753
 
754
-#ifndef LARGEFILE_SUPPORT
754
+#if !LARGEFILE_SUPPORT
755 755
   /* detect 32-bit off_t overflow */
756 756
   if (flen < 0) {
757 757
     sys->message(fh, largefile_msg);
... ...
@@ -853,7 +735,7 @@ static int cabd_find(struct mscab_decompressor_p *self, unsigned char *buf,
853 853
 	    /* cause the search to restart after this cab's data. */
854 854
 	    offset = caboff + (off_t) cablen_u32;
855 855
 
856
-#ifndef LARGEFILE_SUPPORT
856
+#if !LARGEFILE_SUPPORT
857 857
 	    /* detect 32-bit off_t overflow */
858 858
 	    if (offset < caboff) {
859 859
 	      sys->message(fh, largefile_msg);
... ...
@@ -976,7 +858,6 @@ static int cabd_merge(struct mscab_decompressor *base,
976 976
   else {
977 977
     /* folder merge required - do the files match? */
978 978
     if (! cabd_can_merge_folders(sys, lfol, rfol)) {
979
-      sys->message(NULL, "Failed to merge folders");
980 979
       return self->error = MSPACK_ERR_DATAFORMAT;
981 980
     }
982 981
 
... ...
@@ -1112,7 +993,7 @@ static int cabd_extract(struct mscab_decompressor *base,
1112 1112
   struct mscab_decompressor_p *self = (struct mscab_decompressor_p *) base;
1113 1113
   struct mscabd_folder_p *fol;
1114 1114
   struct mspack_system *sys;
1115
-  struct mspack_file *fh = NULL;
1115
+  struct mspack_file *fh;
1116 1116
 
1117 1117
   if (!self) return MSPACK_ERR_ARGS;
1118 1118
   if (!file) return self->error = MSPACK_ERR_ARGS;
... ...
@@ -1124,8 +1005,6 @@ static int cabd_extract(struct mscab_decompressor *base,
1124 1124
   if ( (file->offset > CAB_LENGTHMAX) || (file->length > CAB_LENGTHMAX) ||
1125 1125
       ((file->offset + file->length) > CAB_LENGTHMAX))
1126 1126
   {
1127
-    sys->message(NULL, "ERROR; file \"%s\" cannot be extracted, "
1128
-      "invalid file offset and length.", file->filename);
1129 1127
     return self->error = MSPACK_ERR_DATAFORMAT;
1130 1128
   }
1131 1129
 
... ...
@@ -1206,11 +1085,9 @@ static int cabd_extract(struct mscab_decompressor *base,
1206 1206
      *   and pass back MSPACK_ERR_READ
1207 1207
      */
1208 1208
     self->d->outfh = NULL;
1209
-    if ((self->d->comp_type & cffoldCOMPTYPE_MASK) != cffoldCOMPTYPE_LZX) {
1210
-        if ((bytes = file->offset - self->d->offset)) {
1211
-            error = self->d->decompress(self->d->state, bytes);
1212
-            self->error = (error == MSPACK_ERR_READ) ? self->read_error : error;
1213
-        }
1209
+    if ((bytes = file->offset - self->d->offset)) {
1210
+      error = self->d->decompress(self->d->state, bytes);
1211
+      self->error = (error == MSPACK_ERR_READ) ? self->read_error : error;
1214 1212
     }
1215 1213
 
1216 1214
     /* if getting to the correct offset was error free, unpack file */
... ...
@@ -1248,32 +1125,27 @@ static int cabd_init_decomp(struct mscab_decompressor_p *self, unsigned int ct)
1248 1248
 
1249 1249
   switch (ct & cffoldCOMPTYPE_MASK) {
1250 1250
   case cffoldCOMPTYPE_NONE:
1251
-    self->d->sys.message(NULL, "Detected CAB Compression Type: None (%x)", ct & cffoldCOMPTYPE_MASK);
1252 1251
     self->d->decompress = (int (*)(void *, off_t)) &noned_decompress;
1253 1252
     self->d->state = noned_init(&self->d->sys, fh, fh,
1254 1253
 				self->param[MSCABD_PARAM_DECOMPBUF]);
1255 1254
     break;
1256 1255
   case cffoldCOMPTYPE_MSZIP:
1257
-    self->d->sys.message(NULL, "Detected CAB Compression Type: MSZIP (%x)", ct & cffoldCOMPTYPE_MASK);
1258 1256
     self->d->decompress = (int (*)(void *, off_t)) &mszipd_decompress;
1259 1257
     self->d->state = mszipd_init(&self->d->sys, fh, fh,
1260 1258
 				 self->param[MSCABD_PARAM_DECOMPBUF],
1261 1259
 				 self->param[MSCABD_PARAM_FIXMSZIP]);
1262 1260
     break;
1263 1261
   case cffoldCOMPTYPE_QUANTUM:
1264
-    self->d->sys.message(NULL, "Detected CAB Compression Type: QUANTUM (%x)", ct & cffoldCOMPTYPE_MASK);
1265 1262
     self->d->decompress = (int (*)(void *, off_t)) &qtmd_decompress;
1266 1263
     self->d->state = qtmd_init(&self->d->sys, fh, fh, (int) (ct >> 8) & 0x1f,
1267 1264
 			       self->param[MSCABD_PARAM_DECOMPBUF]);
1268 1265
     break;
1269 1266
   case cffoldCOMPTYPE_LZX:
1270
-    self->d->sys.message(NULL, "Detected CAB Compression Type: LZX (%x)", ct & cffoldCOMPTYPE_MASK);
1271 1267
     self->d->decompress = (int (*)(void *, off_t)) &lzxd_decompress;
1272 1268
     self->d->state = lzxd_init(&self->d->sys, fh, fh, (int) (ct >> 8) & 0x1f, 0,
1273 1269
 			       self->param[MSCABD_PARAM_DECOMPBUF], (off_t)0,0);
1274 1270
     break;
1275 1271
   default:
1276
-    self->d->sys.message(NULL, "Unsupported compression type for CAB: %x", ct & cffoldCOMPTYPE_MASK);
1277 1272
     return self->error = MSPACK_ERR_DATAFORMAT;
1278 1273
   }
1279 1274
   return self->error = (self->d->state) ? MSPACK_ERR_OK : MSPACK_ERR_NOMEMORY;
... ...
@@ -1330,10 +1202,8 @@ static int cabd_sys_read(struct mspack_file *file, void *buffer, int bytes) {
1330 1330
       /* out of data, read a new block */
1331 1331
 
1332 1332
       /* check if we're out of input blocks, advance block counter */
1333
-        //sys->message(NULL, "block num: %d", self->d->block);
1334
-        //sys->message(NULL, "folder num of blocks: %d", self->d->folder->base.num_blocks);
1335 1333
       if (self->d->block++ >= self->d->folder->base.num_blocks) {
1336
-	sys->message(NULL, "Ran out of CAB input blocks prematurely");
1334
+	self->read_error = MSPACK_ERR_DATAFORMAT;
1337 1335
 	break;
1338 1336
       }
1339 1337
 
... ...
@@ -1355,11 +1225,15 @@ static int cabd_sys_read(struct mspack_file *file, void *buffer, int bytes) {
1355 1355
 	  /* special LZX hack -- on the last block, inform LZX of the
1356 1356
 	   * size of the output data stream. */
1357 1357
 	  lzxd_set_output_length((struct lzxd_stream *) self->d->state, (off_t)
1358
-				 ((self->d->block-1) * CAB_BLOCKSTD + outlen));
1358
+				 ((self->d->block-1) * CAB_BLOCKMAX + outlen));
1359 1359
 	}
1360 1360
       }
1361 1361
       else {
1362
-        /* not the last block */
1362
+	/* not the last block */
1363
+	if (outlen != CAB_BLOCKMAX) {
1364
+	  self->system->message(self->d->infh,
1365
+				"WARNING; non-maximal data block");
1366
+	}
1363 1367
       }
1364 1368
     } /* if (avail) */
1365 1369
   } /* while (todo > 0) */
... ...
@@ -1387,9 +1261,7 @@ static int cabd_sys_read_block(struct mspack_system *sys,
1387 1387
 {
1388 1388
   unsigned char hdr[cfdata_SIZEOF];
1389 1389
   unsigned int cksum;
1390
-  unsigned int len;
1391
-
1392
-  (void) ignore_cksum;
1390
+  int len;
1393 1391
 
1394 1392
   /* reset the input block pointer and end of block pointer */
1395 1393
   d->i_ptr = d->i_end = &d->input[0];
... ...
@@ -1411,19 +1283,19 @@ static int cabd_sys_read_block(struct mspack_system *sys,
1411 1411
     /* blocks must not be over CAB_INPUTMAX in size */
1412 1412
     len = EndGetI16(&hdr[cfdata_CompressedSize]);
1413 1413
     if (((d->i_end - d->i_ptr) + len) > CAB_INPUTMAX) {
1414
-      sys->message(NULL, "block size > CAB_INPUTMAX (%ld + %d)",
1415
-          (long)(d->i_end - d->i_ptr), len);
1414
+      D(("block size > CAB_INPUTMAX (%ld + %d)",
1415
+          (long)(d->i_end - d->i_ptr), len))
1416 1416
       return MSPACK_ERR_DATAFORMAT;
1417 1417
     }
1418 1418
 
1419 1419
      /* blocks must not expand to more than CAB_BLOCKMAX */
1420 1420
     if (EndGetI16(&hdr[cfdata_UncompressedSize]) > CAB_BLOCKMAX) {
1421
-      sys->message(NULL, "block size > CAB_BLOCKMAX");
1421
+      D(("block size > CAB_BLOCKMAX"))
1422 1422
       return MSPACK_ERR_DATAFORMAT;
1423 1423
     }
1424 1424
 
1425 1425
     /* read the block data */
1426
-    if (sys->read(d->infh, d->i_end, len) != (int)len) {
1426
+    if (sys->read(d->infh, d->i_end, len) != len) {
1427 1427
       return MSPACK_ERR_READ;
1428 1428
     }
1429 1429
 
... ...
@@ -1431,13 +1303,8 @@ static int cabd_sys_read_block(struct mspack_system *sys,
1431 1431
     if ((cksum = EndGetI32(&hdr[cfdata_CheckSum]))) {
1432 1432
       unsigned int sum2 = cabd_checksum(d->i_end, (unsigned int) len, 0);
1433 1433
       if (cabd_checksum(&hdr[4], 4, sum2) != cksum) {
1434
-        /* 
1435
-         * Do not validate the checksum --
1436
-         * Because the checksum does not necessarily matter
1437
-         * and we still want to scan the block if possible
1438
-         */
1439
-        //if (!ignore_cksum) return MSPACK_ERR_CHECKSUM;
1440
-        sys->message(d->infh, "WARNING; bad block checksum found: 0x%x", cksum);
1434
+	if (!ignore_cksum) return MSPACK_ERR_CHECKSUM;
1435
+	sys->message(d->infh, "WARNING; bad block checksum found");
1441 1436
       }
1442 1437
     }
1443 1438
 
... ...
@@ -1462,7 +1329,7 @@ static int cabd_sys_read_block(struct mspack_system *sys,
1462 1462
 
1463 1463
     /* advance to next member in the cabinet set */
1464 1464
     if (!(d->data = d->data->next)) {
1465
-      sys->message(NULL, "ran out of splits in cabinet set");
1465
+      D(("ran out of splits in cabinet set"))
1466 1466
       return MSPACK_ERR_DATAFORMAT;
1467 1467
     }
1468 1468
 
... ...
@@ -1494,8 +1361,8 @@ static unsigned int cabd_checksum(unsigned char *data, unsigned int bytes,
1494 1494
   }
1495 1495
 
1496 1496
   switch (bytes & 3) {
1497
-  case 3: ul |= *data++ << 16;
1498
-  case 2: ul |= *data++ <<  8;
1497
+  case 3: ul |= *data++ << 16; /*@fallthrough@*/
1498
+  case 2: ul |= *data++ <<  8; /*@fallthrough@*/
1499 1499
   case 1: ul |= *data;
1500 1500
   }
1501 1501
   cksum ^= ul;
... ...
@@ -15,13 +15,10 @@
15 15
 struct mschm_compressor *
16 16
   mspack_create_chm_compressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_chm_compressor(struct mschm_compressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -1,5 +1,5 @@
1 1
 /* This file is part of libmspack.
2
- * (C) 2003-2011 Stuart Caie.
2
+ * (C) 2003-2018 Stuart Caie.
3 3
  *
4 4
  * libmspack is free software; you can redistribute it and/or modify it under
5 5
  * the terms of the GNU Lesser General Public License (LGPL) version 2.1
... ...
@@ -397,7 +397,7 @@ static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,
397 397
     D(("first pmgl chunk is after last pmgl chunk"))
398 398
     return MSPACK_ERR_DATAFORMAT;
399 399
   }
400
-  if (chm->index_root != 0xFFFFFFFF && chm->index_root > chm->num_chunks) {
400
+  if (chm->index_root != 0xFFFFFFFF && chm->index_root >= chm->num_chunks) {
401 401
     D(("index_root outside valid range"))
402 402
     return MSPACK_ERR_DATAFORMAT;
403 403
   }
... ...
@@ -447,7 +447,10 @@ static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,
447 447
     while (num_entries--) {
448 448
       READ_ENCINT(name_len);
449 449
       if (name_len > (unsigned int) (end - p)) goto chunk_end;
450
+      /* consider blank filenames to be an error */
451
+      if (name_len == 0) goto chunk_end;
450 452
       name = p; p += name_len;
453
+
451 454
       READ_ENCINT(section);
452 455
       READ_ENCINT(offset);
453 456
       READ_ENCINT(length);
... ...
@@ -524,7 +527,7 @@ static int chmd_read_headers(struct mspack_system *sys, struct mspack_file *fh,
524 524
  * directly from the on-disk index.
525 525
  *
526 526
  * TODO: protect against infinite loops in chunks (where pgml_NextChunk
527
- * or a PGMI index entry point to an already visited chunk)
527
+ * or a PMGI index entry point to an already visited chunk)
528 528
  */
529 529
 static int chmd_fast_find(struct mschm_decompressor *base,
530 530
 			  struct mschmd_header *chm, const char *filename,
... ...
@@ -533,7 +536,7 @@ static int chmd_fast_find(struct mschm_decompressor *base,
533 533
     struct mschm_decompressor_p *self = (struct mschm_decompressor_p *) base;
534 534
     struct mspack_system *sys;
535 535
     struct mspack_file *fh;
536
-    const unsigned char *chunk = NULL, *p = NULL, *end = NULL;
536
+    const unsigned char *chunk, *p, *end;
537 537
     int err = MSPACK_ERR_OK, result = -1;
538 538
     unsigned int n, sec;
539 539
 
... ...
@@ -622,11 +625,11 @@ static unsigned char *read_chunk(struct mschm_decompressor_p *self,
622 622
     unsigned char *buf;
623 623
 
624 624
     /* check arguments - most are already checked by chmd_fast_find */
625
-    if (chunk_num > chm->num_chunks) return NULL;
625
+    if (chunk_num >= chm->num_chunks) return NULL;
626 626
     
627 627
     /* ensure chunk cache is available */
628 628
     if (!chm->chunk_cache) {
629
-	size_t size = sizeof(unsigned char *) * (chm->num_chunks + 1);
629
+	size_t size = sizeof(unsigned char *) * chm->num_chunks;
630 630
 	if (!(chm->chunk_cache = (unsigned char **) sys->alloc(sys, size))) {
631 631
 	    self->error = MSPACK_ERR_NOMEMORY;
632 632
 	    return NULL;
... ...
@@ -831,7 +834,7 @@ static int search_chunk(struct mschmd_header *chm,
831 831
 # endif
832 832
 # define TOLOWER(x) tolower(x)
833 833
 #else
834
-# define TOLOWER(x) (((x)<0||(x)>256)?(x):mspack_tolower_map[(x)])
834
+# define TOLOWER(x) (((x)<0||(x)>255)?(x):mspack_tolower_map[(x)])
835 835
 /* Map of char -> lowercase char for the first 256 chars. Generated with:
836 836
  * LC_CTYPE=en_GB.utf-8 perl -Mlocale -le 'print map{ord(lc chr).","} 0..255'
837 837
  */
... ...
@@ -1269,9 +1272,15 @@ static int read_spaninfo(struct mschm_decompressor_p *self,
1269 1269
 
1270 1270
     /* get the uncompressed length of the LZX stream */
1271 1271
     err = read_off64(length_ptr, data, sys, self->d->infh);
1272
-
1273 1272
     sys->free(data);
1274
-    return (err) ? MSPACK_ERR_DATAFORMAT : MSPACK_ERR_OK;
1273
+    if (err) return MSPACK_ERR_DATAFORMAT;
1274
+
1275
+    if (*length_ptr <= 0) {
1276
+        D(("output length is invalid"))
1277
+        return MSPACK_ERR_DATAFORMAT;
1278
+    }
1279
+
1280
+    return MSPACK_ERR_OK;
1275 1281
 }
1276 1282
 
1277 1283
 /***************************************
... ...
@@ -1371,22 +1380,16 @@ static int chmd_error(struct mschm_decompressor *base) {
1371 1371
  * are accepted, offsets beyond that cause an error message.
1372 1372
  */
1373 1373
 static int read_off64(off_t *var, unsigned char *mem,
1374
-                      struct mspack_system *sys, struct mspack_file *fh)
1374
+		      struct mspack_system *sys, struct mspack_file *fh)
1375 1375
 {
1376
-  (void) sys;
1377
-
1378
-#ifdef LARGEFILE_SUPPORT
1379
-  (void) fh;
1380
-
1381
-  *var = EndGetI64(mem);
1376
+#if LARGEFILE_SUPPORT
1377
+    *var = EndGetI64(mem);
1382 1378
 #else
1383
-  *var = EndGetI32(mem);
1384
-
1385
-  if ((*var & 0x80000000) || EndGetI32(mem + 4))
1386
-  {
1387
-    sys->message(fh, (char *)largefile_msg);
1388
-    return 1;
1389
-  }
1379
+    *var = EndGetI32(mem);
1380
+    if ((*var & 0x80000000) || EndGetI32(mem+4)) {
1381
+	sys->message(fh, (char *)largefile_msg);
1382
+	return 1;
1383
+    }
1390 1384
 #endif
1391
-  return 0;
1385
+    return 0;
1392 1386
 }
... ...
@@ -15,13 +15,10 @@
15 15
 struct mshlp_compressor *
16 16
   mspack_create_hlp_compressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_hlp_compressor(struct mshlp_compressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -15,13 +15,10 @@
15 15
 struct mshlp_decompressor *
16 16
   mspack_create_hlp_decompressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_hlp_decompressor(struct mshlp_decompressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -15,13 +15,10 @@
15 15
 struct mskwaj_compressor *
16 16
   mspack_create_kwaj_compressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_kwaj_compressor(struct mskwaj_compressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -198,30 +198,36 @@ static int kwajd_read_headers(struct mspack_system *sys,
198 198
 
199 199
     /* filename and extension */
200 200
     if (hdr->headers & (MSKWAJ_HDR_HASFILENAME | MSKWAJ_HDR_HASFILEEXT)) {
201
-	off_t pos = sys->tell(fh);
202
-	char *fn = (char *) sys->alloc(sys, (size_t) 13);
203
-
201
+	int len;
204 202
 	/* allocate memory for maximum length filename */
205
-	if (! fn) return MSPACK_ERR_NOMEMORY;
206
-	hdr->filename = fn;
203
+	char *fn = (char *) sys->alloc(sys, (size_t) 13);
204
+	if (!(hdr->filename = fn)) return MSPACK_ERR_NOMEMORY;
207 205
 
208 206
 	/* copy filename if present */
209 207
 	if (hdr->headers & MSKWAJ_HDR_HASFILENAME) {
210
-	    if (sys->read(fh, &buf[0], 9) != 9) return MSPACK_ERR_READ;
211
-	    for (i = 0; i < 9; i++, fn++) if (!(*fn = buf[i])) break;
212
-	    pos += (i < 9) ? i+1 : 9;
213
-	    if (sys->seek(fh, pos, MSPACK_SYS_SEEK_START))
208
+	    /* read and copy up to 9 bytes of a null terminated string */
209
+	    if ((len = sys->read(fh, &buf[0], 9)) < 2) return MSPACK_ERR_READ;
210
+	    for (i = 0; i < len; i++) if (!(*fn++ = buf[i])) break;
211
+	    /* if string was 9 bytes with no null terminator, reject it */
212
+	    if (i == 9 && buf[8] != '\0') return MSPACK_ERR_DATAFORMAT;
213
+	    /* seek to byte after string ended in file */
214
+	    if (sys->seek(fh, (off_t)(i + 1 - len), MSPACK_SYS_SEEK_CUR))
214 215
 		return MSPACK_ERR_SEEK;
216
+	    fn--; /* remove the null terminator */
215 217
 	}
216 218
 
217 219
 	/* copy extension if present */
218 220
 	if (hdr->headers & MSKWAJ_HDR_HASFILEEXT) {
219 221
 	    *fn++ = '.';
220
-	    if (sys->read(fh, &buf[0], 4) != 4) return MSPACK_ERR_READ;
221
-	    for (i = 0; i < 4; i++, fn++) if (!(*fn = buf[i])) break;
222
-	    pos += (i < 4) ? i+1 : 4;
223
-	    if (sys->seek(fh, pos, MSPACK_SYS_SEEK_START))
222
+	    /* read and copy up to 4 bytes of a null terminated string */
223
+	    if ((len = sys->read(fh, &buf[0], 4)) < 2) return MSPACK_ERR_READ;
224
+	    for (i = 0; i < len; i++) if (!(*fn++ = buf[i])) break;
225
+	    /* if string was 4 bytes with no null terminator, reject it */
226
+	    if (i == 4 && buf[3] != '\0') return MSPACK_ERR_DATAFORMAT;
227
+	    /* seek to byte after string ended in file */
228
+	    if (sys->seek(fh, (off_t)(i + 1 - len), MSPACK_SYS_SEEK_CUR))
224 229
 		return MSPACK_ERR_SEEK;
230
+	    fn--; /* remove the null terminator */
225 231
 	}
226 232
 	*fn = '\0';
227 233
     }
... ...
@@ -15,13 +15,10 @@
15 15
 struct mslit_compressor *
16 16
   mspack_create_lit_compressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_lit_compressor(struct mslit_compressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -15,13 +15,10 @@
15 15
 struct mslit_decompressor *
16 16
   mspack_create_lit_decompressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_lit_decompressor(struct mslit_decompressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -294,15 +294,20 @@ struct lzxd_stream *lzxd_init(struct mspack_system *system,
294 294
    * regular LZX windows are between 2^15 (32KiB) and 2^21 (2MiB)
295 295
    */
296 296
   if (is_delta) {
297
-      system->message(NULL, "Detected LZX Compression Type: DELTA");
298 297
       if (window_bits < 17 || window_bits > 25) return NULL;
299 298
   }
300 299
   else {
301 300
       if (window_bits < 15 || window_bits > 21) return NULL;
302 301
   }
303 302
 
303
+  if (reset_interval < 0 || output_length < 0) {
304
+      D(("reset interval or output length < 0"))
305
+      return NULL;
306
+  }
307
+
308
+  /* round up input buffer size to multiple of two */
304 309
   input_buffer_size = (input_buffer_size + 1) & -2;
305
-  if (!input_buffer_size) return NULL;
310
+  if (input_buffer_size < 2) return NULL;
306 311
 
307 312
   /* allocate decompression state */
308 313
   if (!(lzx = (struct lzxd_stream *) system->alloc(system, sizeof(struct lzxd_stream)))) {
... ...
@@ -383,7 +388,7 @@ int lzxd_set_reference_data(struct lzxd_stream *lzx,
383 383
 }
384 384
 
385 385
 void lzxd_set_output_length(struct lzxd_stream *lzx, off_t out_bytes) {
386
-  if (lzx) lzx->length = out_bytes;
386
+  if (lzx && out_bytes > 0) lzx->length = out_bytes;
387 387
 }
388 388
 
389 389
 int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
... ...
@@ -394,7 +399,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
394 394
   register unsigned short sym;
395 395
 
396 396
   int match_length, length_footer, extra, verbatim_bits, bytes_todo;
397
-  int this_run, main_element, aligned_bits, j, warned = 0;
397
+  int this_run, main_element, aligned_bits, j;
398 398
   unsigned char *window, *runsrc, *rundest, buf[12];
399 399
   unsigned int frame_size=0, end_frame, match_offset, window_posn;
400 400
   unsigned int R0, R1, R2;
... ...
@@ -405,7 +410,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
405 405
 
406 406
   /* flush out any stored-up bytes before we begin */
407 407
   i = lzx->o_end - lzx->o_ptr;
408
-  if (((off_t) i > out_bytes) && ((int) out_bytes >= 0)) i = (int) out_bytes;
408
+  if ((off_t) i > out_bytes) i = (int) out_bytes;
409 409
   if (i) {
410 410
     if (lzx->sys->write(lzx->output, lzx->o_ptr, i) != i) {
411 411
       return lzx->error = MSPACK_ERR_WRITE;
... ...
@@ -425,19 +430,13 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
425 425
   R2 = lzx->R2;
426 426
 
427 427
   end_frame = (unsigned int)((lzx->offset + out_bytes) / LZX_FRAME_SIZE) + 1;
428
-  lzx->sys->message(NULL, "lzx_decompress: end_frame = %u", end_frame);
429 428
 
430 429
   while (lzx->frame < end_frame) {
431
-    lzx->sys->message(NULL, "lzx_decompress: current_frame = %u", lzx->frame);
432 430
     /* have we reached the reset interval? (if there is one?) */
433 431
     if (lzx->reset_interval && ((lzx->frame % lzx->reset_interval) == 0)) {
434 432
       if (lzx->block_remaining) {
435
-        /* this is a file format error, but we need to extract what we can and scan that */
436
-        lzx->sys->message(NULL, "lzx_decompress: bytes remaining at reset interval", lzx->block_remaining);
437
-        if (!warned) {
438
-            lzx->sys->message(NULL, "lzx_decompress: detected an invalid reset interval during decompresion");
439
-            warned++;
440
-        }
433
+	D(("%d bytes remaining at reset interval", lzx->block_remaining))
434
+	return lzx->error = MSPACK_ERR_DECRUNCH;
441 435
       }
442 436
 
443 437
       /* re-read the intel header and reset the huffman lengths */
... ...
@@ -495,7 +494,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
495 495
 	  /* read lengths of and build aligned huffman decoding tree */
496 496
 	  for (i = 0; i < 8; i++) { READ_BITS(j, 3); lzx->ALIGNED_len[i] = j; }
497 497
 	  BUILD_TABLE(ALIGNED);
498
-	  /* no break -- rest of aligned header is same as verbatim */
498
+	  /* rest of aligned header is same as verbatim */ /*@fallthrough@*/
499 499
 	case LZX_BLOCKTYPE_VERBATIM:
500 500
 	  /* read lengths of and build main huffman decoding tree */
501 501
 	  READ_LENGTHS(MAINTREE, 0, 256);
... ...
@@ -527,7 +526,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
527 527
 	  break;
528 528
 
529 529
 	default:
530
-	  lzx->sys->message(NULL, "lzx_decompress: bad block type");
530
+	  D(("bad block type"))
531 531
 	  return lzx->error = MSPACK_ERR_DECRUNCH;
532 532
 	}
533 533
       }
... ...
@@ -559,7 +558,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
559 559
 	    match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
560 560
 	    if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
561 561
 	      if (lzx->LENGTH_empty) {
562
-                lzx->sys->message(NULL, "lzx_decompress: LENGTH symbol needed but tree is empty");
562
+                D(("LENGTH symbol needed but tree is empty"))
563 563
                 return lzx->error = MSPACK_ERR_DECRUNCH;
564 564
               }
565 565
 	      READ_HUFFSYM(LENGTH, length_footer);
... ...
@@ -606,7 +605,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
606 606
 	    }
607 607
 
608 608
 	    if ((window_posn + match_length) > lzx->window_size) {
609
-	      lzx->sys->message(NULL, "lzx_decompress: match ran over window wrap");
609
+	      D(("match ran over window wrap"))
610 610
 	      return lzx->error = MSPACK_ERR_DECRUNCH;
611 611
 	    }
612 612
 	    
... ...
@@ -618,13 +617,13 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
618 618
 	      if (match_offset > lzx->offset &&
619 619
 		  (match_offset - window_posn) > lzx->ref_data_size)
620 620
 	      {
621
-		lzx->sys->message(NULL, "lzx_decompress: match offset beyond LZX stream");
621
+		D(("match offset beyond LZX stream"))
622 622
 		return lzx->error = MSPACK_ERR_DECRUNCH;
623 623
 	      }
624 624
 	      /* j = length from match offset to end of window */
625 625
 	      j = match_offset - window_posn;
626 626
 	      if (j > (int) lzx->window_size) {
627
-		lzx->sys->message(NULL, "lzx_decompress: match offset beyond window boundaries");
627
+		D(("match offset beyond window boundaries"))
628 628
 		return lzx->error = MSPACK_ERR_DECRUNCH;
629 629
 	      }
630 630
 	      runsrc = &window[lzx->window_size - j];
... ...
@@ -662,7 +661,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
662 662
 	    match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
663 663
 	    if (match_length == LZX_NUM_PRIMARY_LENGTHS) {
664 664
               if (lzx->LENGTH_empty) {
665
-                lzx->sys->message(NULL, "lzx_decompress: LENGTH symbol needed but tree is empty");
665
+                D(("LENGTH symbol needed but tree is empty"))
666 666
                 return lzx->error = MSPACK_ERR_DECRUNCH;
667 667
               } 
668 668
 	      READ_HUFFSYM(LENGTH, length_footer);
... ...
@@ -730,7 +729,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
730 730
 	    }
731 731
 
732 732
 	    if ((window_posn + match_length) > lzx->window_size) {
733
-	      lzx->sys->message(NULL, "lzx_decompress: match ran over window wrap");
733
+	      D(("match ran over window wrap"))
734 734
 	      return lzx->error = MSPACK_ERR_DECRUNCH;
735 735
 	    }
736 736
 
... ...
@@ -742,13 +741,13 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
742 742
 	      if (match_offset > lzx->offset &&
743 743
 		  (match_offset - window_posn) > lzx->ref_data_size)
744 744
 	      {
745
-		lzx->sys->message(NULL, "lzx_decompress: match offset beyond LZX stream");
745
+		D(("match offset beyond LZX stream"))
746 746
 		return lzx->error = MSPACK_ERR_DECRUNCH;
747 747
 	      }
748 748
 	      /* j = length from match offset to end of window */
749 749
 	      j = match_offset - window_posn;
750 750
 	      if (j > (int) lzx->window_size) {
751
-		lzx->sys->message(NULL, "lzx_decompress: match offset beyond window boundaries");
751
+		D(("match offset beyond window boundaries"))
752 752
 		return lzx->error = MSPACK_ERR_DECRUNCH;
753 753
 	      }
754 754
 	      runsrc = &window[lzx->window_size - j];
... ...
@@ -773,13 +772,8 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
773 773
       case LZX_BLOCKTYPE_UNCOMPRESSED:
774 774
 	/* as this_run is limited not to wrap a frame, this also means it
775 775
 	 * won't wrap the window (as the window is a multiple of 32k) */
776
-        if (window_posn + this_run > lzx->window_size) {
777
-                lzx->sys->message(NULL, "lzx_decompress: match ran over window boundary");
778
-                return lzx->error = MSPACK_ERR_DECRUNCH;
779
-        }
780 776
 	rundest = &window[window_posn];
781 777
 	window_posn += this_run;
782
-
783 778
 	while (this_run > 0) {
784 779
 	  if ((i = i_end - i_ptr) == 0) {
785 780
 	    READ_IF_NEEDED;
... ...
@@ -801,8 +795,8 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
801 801
       /* did the final match overrun our desired this_run length? */
802 802
       if (this_run < 0) {
803 803
 	if ((unsigned int)(-this_run) > lzx->block_remaining) {
804
-	  lzx->sys->message(NULL, "lzx_decompress: overrun went past end of block by %d (%d remaining)",
805
-	     -this_run, lzx->block_remaining );
804
+	  D(("overrun went past end of block by %d (%d remaining)",
805
+	     -this_run, lzx->block_remaining ))
806 806
 	  return lzx->error = MSPACK_ERR_DECRUNCH;
807 807
 	}
808 808
 	lzx->block_remaining -= -this_run;
... ...
@@ -811,8 +805,8 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
811 811
 
812 812
     /* streams don't extend over frame boundaries */
813 813
     if ((window_posn - lzx->frame_posn) != frame_size) {
814
-      lzx->sys->message(NULL, "lzx_decompress: decode beyond output frame limits! %d != %d",
815
-	 window_posn - lzx->frame_posn, frame_size);
814
+      D(("decode beyond output frame limits! %d != %d",
815
+	 window_posn - lzx->frame_posn, frame_size))
816 816
       return lzx->error = MSPACK_ERR_DECRUNCH;
817 817
     }
818 818
 
... ...
@@ -822,8 +816,8 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
822 822
 
823 823
     /* check that we've used all of the previous frame first */
824 824
     if (lzx->o_ptr != lzx->o_end) {
825
-       lzx->sys->message(NULL, "lzx_decompress: %ld avail bytes, new %d frame",
826
-          (long)(lzx->o_end - lzx->o_ptr), frame_size);
825
+      D(("%ld avail bytes, new %d frame",
826
+          (long)(lzx->o_end - lzx->o_ptr), frame_size))
827 827
       return lzx->error = MSPACK_ERR_DECRUNCH;
828 828
     }
829 829
 
... ...
@@ -882,7 +876,7 @@ int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) {
882 882
   } /* while (lzx->frame < end_frame) */
883 883
 
884 884
   if (out_bytes) {
885
-    lzx->sys->message(NULL, "lzx_decompress: bytes left to output");
885
+    D(("bytes left to output"))
886 886
     return lzx->error = MSPACK_ERR_DECRUNCH;
887 887
   }
888 888
 
... ...
@@ -900,10 +894,8 @@ void lzxd_free(struct lzxd_stream *lzx) {
900 900
   struct mspack_system *sys;
901 901
   if (lzx) {
902 902
     sys = lzx->sys;
903
-    if(lzx->inbuf)
904
-        sys->free(lzx->inbuf);
905
-    if(lzx->window)
906
-        sys->free(lzx->window);
903
+    sys->free(lzx->inbuf);
904
+    sys->free(lzx->window);
907 905
     sys->free(lzx);
908 906
   }
909 907
 }
910 908
deleted file mode 100644
... ...
@@ -1,28 +0,0 @@
1
-LIBRARY mspack
2
-EXPORTS
3
-	mspack_create_cab_compressor
4
-	mspack_create_cab_decompressor
5
-	mspack_create_chm_compressor
6
-	mspack_create_chm_decompressor
7
-	mspack_create_hlp_compressor
8
-	mspack_create_hlp_decompressor
9
-	mspack_create_kwaj_compressor
10
-	mspack_create_kwaj_decompressor
11
-	mspack_create_lit_compressor
12
-	mspack_create_lit_decompressor
13
-	mspack_create_szdd_compressor
14
-	mspack_create_szdd_decompressor
15
-	mspack_destroy_cab_compressor
16
-	mspack_destroy_cab_decompressor
17
-	mspack_destroy_chm_compressor
18
-	mspack_destroy_chm_decompressor
19
-	mspack_destroy_hlp_compressor
20
-	mspack_destroy_hlp_decompressor
21
-	mspack_destroy_kwaj_compressor
22
-	mspack_destroy_kwaj_decompressor
23
-	mspack_destroy_lit_compressor
24
-	mspack_destroy_lit_decompressor
25
-	mspack_destroy_szdd_compressor
26
-	mspack_destroy_szdd_decompressor
27
-	mspack_sys_selftest_internal
28
-	mspack_version
29 1
\ No newline at end of file
30 2
old mode 100644
31 3
new mode 100755
... ...
@@ -1,5 +1,5 @@
1 1
 /* libmspack -- a library for working with Microsoft compression formats.
2
- * (C) 2003-2013 Stuart Caie <kyzer@4u.net>
2
+ * (C) 2003-2016 Stuart Caie <kyzer@cabextract.org.uk>
3 3
  *
4 4
  * libmspack is free software; you can redistribute it and/or modify it under
5 5
  * the terms of the GNU Lesser General Public License (LGPL) version 2.1
... ...
@@ -328,7 +328,9 @@ struct mspack_system {
328 328
    * @param bytes   the number of bytes to read from the file.
329 329
    * @return the number of bytes successfully read (this can be less than
330 330
    *         the number requested), zero to mark the end of file, or less
331
-   *         than zero to indicate an error.
331
+   *         than zero to indicate an error. The library does not "retry"
332
+   *         reads and assumes short reads are due to EOF, so you should
333
+   *         avoid returning short reads because of transient errors.
332 334
    * @see open(), write()
333 335
    */
334 336
   int (*read)(struct mspack_file *file,
... ...
@@ -712,9 +714,6 @@ struct mscabd_cabinet {
712 712
   /** The file offset of cabinet within the physical file it resides in. */
713 713
   off_t base_offset;
714 714
 
715
-  /** The offset within the cabinet of the first file entry */
716
-  off_t file_offset;
717
-
718 715
   /** The length of the cabinet file in bytes. */
719 716
   unsigned int length;
720 717
 
... ...
@@ -187,15 +187,9 @@ static int inflate(struct mszipd_stream *zip) {
187 187
       }
188 188
       if (bits_left != 0) return INF_ERR_BITBUF;
189 189
       while (i < 4) {
190
-        if (i_ptr >= i_end) {
191
-          if (read_input(BITS_VAR)) return BITS_VAR->error;
192
-          i_ptr = BITS_VAR->i_ptr;
193
-          i_end = BITS_VAR->i_end;
194
-          if(i_ptr >= i_end) break;
195
-        }
196
-        lens_buf[i++] = *i_ptr++;
190
+	READ_IF_NEEDED;
191
+	lens_buf[i++] = *i_ptr++;
197 192
       }
198
-      if (i < 4) return INF_ERR_BITBUF;
199 193
 
200 194
       /* get the length and its complement */
201 195
       length = lens_buf[0] | (lens_buf[1] << 8);
... ...
@@ -204,12 +198,7 @@ static int inflate(struct mszipd_stream *zip) {
204 204
 
205 205
       /* read and copy the uncompressed data into the window */
206 206
       while (length > 0) {
207
-        if (i_ptr >= i_end) {
208
-          if (read_input(BITS_VAR)) return BITS_VAR->error;
209
-          i_ptr = BITS_VAR->i_ptr;
210
-          i_end = BITS_VAR->i_end;
211
-          if(i_ptr == i_end) break;
212
-        }
207
+	READ_IF_NEEDED;
213 208
 
214 209
 	this_run = length;
215 210
 	if (this_run > (unsigned int)(i_end - i_ptr)) this_run = i_end - i_ptr;
... ...
@@ -360,8 +349,9 @@ struct mszipd_stream *mszipd_init(struct mspack_system *system,
360 360
 
361 361
   if (!system) return NULL;
362 362
 
363
+  /* round up input buffer size to multiple of two */
363 364
   input_buffer_size = (input_buffer_size + 1) & -2;
364
-  if (!input_buffer_size) return NULL;
365
+  if (input_buffer_size < 2) return NULL;
365 366
 
366 367
   /* allocate decompression state */
367 368
   if (!(zip = (struct mszipd_stream *) system->alloc(system, sizeof(struct mszipd_stream)))) {
... ...
@@ -15,13 +15,10 @@
15 15
 struct msoab_compressor *
16 16
   mspack_create_oab_compressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_oab_compressor(struct msoab_compressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
... ...
@@ -197,6 +197,7 @@ struct qtmd_stream *qtmd_init(struct mspack_system *system,
197 197
   /* Quantum supports window sizes of 2^10 (1Kb) through 2^21 (2Mb) */
198 198
   if (window_bits < 10 || window_bits > 21) return NULL;
199 199
 
200
+  /* round up input buffer size to multiple of two */
200 201
   input_buffer_size = (input_buffer_size + 1) & -2;
201 202
   if (input_buffer_size < 2) return NULL;
202 203
 
... ...
@@ -258,10 +259,6 @@ int qtmd_decompress(struct qtmd_stream *qtm, off_t out_bytes) {
258 258
   int i, j, selector, extra, sym, match_length;
259 259
   unsigned short H, L, C, symf;
260 260
 
261
-  unsigned char *prev_o_ptr = NULL, *prev_o_end = NULL;
262
-  off_t prev_out_bytes = 0;
263
-  int prev_i = 0;
264
-
265 261
   register unsigned int bit_buffer;
266 262
   register unsigned char bits_left;
267 263
 
... ...
@@ -292,11 +289,6 @@ int qtmd_decompress(struct qtmd_stream *qtm, off_t out_bytes) {
292 292
 
293 293
   /* while we do not have enough decoded bytes in reserve: */
294 294
   while ((qtm->o_end - qtm->o_ptr) < out_bytes) {
295
-    prev_o_ptr = qtm->o_ptr;
296
-    prev_o_end = qtm->o_end;
297
-    prev_out_bytes = out_bytes;
298
-    prev_i = i;
299
-
300 295
     /* read header if necessary. Initialises H, L and C */
301 296
     if (!qtm->header_read) {
302 297
       H = 0xFFFF; L = 0; READ_BITS(C, 16);
... ...
@@ -465,15 +457,6 @@ int qtmd_decompress(struct qtmd_stream *qtm, off_t out_bytes) {
465 465
       window_posn = 0;
466 466
    }
467 467
 
468
-    if ((prev_o_ptr == qtm->o_ptr) &&
469
-        (prev_o_end == qtm->o_end) &&
470
-        (prev_out_bytes == out_bytes) &&
471
-        (i == prev_i))
472
-    {
473
-      /* It appears that we've hit and infinite loop.  Bail out */
474
-      return qtm->error = MSPACK_ERR_DATAFORMAT;
475
-    }
476
-
477 468
   } /* while (more bytes needed) */
478 469
 
479 470
   if (out_bytes) {
... ...
@@ -13,7 +13,7 @@
13 13
 
14 14
 #include <system.h>
15 15
 
16
-#ifndef LARGEFILE_SUPPORT
16
+#if !LARGEFILE_SUPPORT
17 17
 const char *largefile_msg = "library not compiled to support large files.";
18 18
 #endif
19 19
 
... ...
@@ -118,8 +118,6 @@ static struct mspack_file *msp_open(struct mspack_system *self,
118 118
   struct mspack_file_p *fh;
119 119
   const char *fmode;
120 120
 
121
-  (void) self;
122
-
123 121
   switch (mode) {
124 122
   case MSPACK_SYS_OPEN_READ:   fmode = "rb";  break;
125 123
   case MSPACK_SYS_OPEN_WRITE:  fmode = "wb";  break;
... ...
@@ -171,7 +169,7 @@ static int msp_seek(struct mspack_file *file, off_t offset, int mode) {
171 171
     case MSPACK_SYS_SEEK_END:   mode = SEEK_END; break;
172 172
     default: return -1;
173 173
     }
174
-#ifdef HAVE_FSEEKO
174
+#if HAVE_FSEEKO
175 175
     return fseeko(self->fh, offset, mode);
176 176
 #else
177 177
     return fseek(self->fh, offset, mode);
... ...
@@ -182,7 +180,7 @@ static int msp_seek(struct mspack_file *file, off_t offset, int mode) {
182 182
 
183 183
 static off_t msp_tell(struct mspack_file *file) {
184 184
   struct mspack_file_p *self = (struct mspack_file_p *) file;
185
-#ifdef HAVE_FSEEKO
185
+#if HAVE_FSEEKO
186 186
   return (self) ? (off_t) ftello(self->fh) : 0;
187 187
 #else
188 188
   return (self) ? (off_t) ftell(self->fh) : 0;
... ...
@@ -200,21 +198,19 @@ static void msp_msg(struct mspack_file *file, const char *format, ...) {
200 200
 }
201 201
 
202 202
 static void *msp_alloc(struct mspack_system *self, size_t bytes) {
203
-#ifdef DEBUG
203
+#if DEBUG
204 204
   /* make uninitialised data obvious */
205 205
   char *buf = malloc(bytes + 8);
206
-  (void) self;
207 206
   if (buf) memset(buf, 0xDC, bytes);
208 207
   *((size_t *)buf) = bytes;
209 208
   return &buf[8];
210 209
 #else
211
-  (void) self;
212 210
   return malloc(bytes);
213 211
 #endif
214 212
 }
215 213
 
216 214
 static void msp_free(void *buffer) {
217
-#ifdef DEBUG
215
+#if DEBUG
218 216
   char *buf = buffer;
219 217
   size_t bytes;
220 218
   if (buf) {
... ...
@@ -28,32 +28,21 @@ extern "C" {
28 28
 # undef read
29 29
 #endif
30 30
 
31
-
32
-
33
-
34
-
35
-#ifdef DEBUG
36
-# include <stdio.h>
37
-# include <stdint.h>
38
-
39
-extern uint8_t cli_debug_flag;
40 31
 /* Old GCCs don't have __func__, but __FUNCTION__:
41 32
  * http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html
42 33
  */
43
-# if __STDC_VERSION__ < 199901L
44
-#  if __GNUC__ >= 2
45
-#   define __func__ __FUNCTION__
46
-#  else
47
-#   define __func__ "<unknown>"
48
-#  endif
34
+#if __STDC_VERSION__ < 199901L
35
+# if __GNUC__ >= 2
36
+#  define __func__ __FUNCTION__
37
+# else
38
+#  define __func__ "<unknown>"
49 39
 # endif
50
-/* Adding custom clamav debug code. */
51
-# define D(x) do {   if(cli_debug_flag) { \
52
-                        printf("LibClamAV debug: %s:%d (%s)", __FILE__, __LINE__, __func__); \
53
-                        printf x ; fputc('\n', stdout); fflush(stdout); \
54
-                     } \
55
-                  } while (0);
40
+#endif
56 41
 
42
+#if DEBUG
43
+# include <stdio.h>
44
+# define D(x) do { printf("%s:%d (%s) ",__FILE__, __LINE__, __func__); \
45
+                   printf x ; fputc('\n', stdout); fflush(stdout);} while (0);
57 46
 #else
58 47
 # define D(x)
59 48
 #endif
... ...
@@ -65,21 +54,30 @@ extern uint8_t cli_debug_flag;
65 65
  * greater than 2GB is detected, an error message indicating the library
66 66
  * can't support the file should be printed.
67 67
  */
68
-#ifdef HAVE_LIMITS_H
68
+#if HAVE_LIMITS_H
69 69
 # include <limits.h>
70 70
 #endif
71 71
 
72
+#if HAVE_INTTYPES_H
73
+# include <inttypes.h>
74
+#else
75
+# define PRId64 "lld"
76
+# define PRIu64 "llu"
77
+# define PRId32 "ld"
78
+# define PRIu32 "lu"
79
+#endif
80
+
72 81
 #if ((defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS >= 64) || \
73 82
      (defined(FILESIZEBITS)      && FILESIZEBITS      >= 64) || \
74 83
      (defined(SIZEOF_OFF_T)      && SIZEOF_OFF_T      >= 8)  || \
75 84
      defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE))
76
-# define LARGEFILE_SUPPORT
77
-# define LD "lld"
78
-# define LU "llu"
85
+# define LARGEFILE_SUPPORT 1
86
+# define LD PRId64
87
+# define LU PRIu64
79 88
 #else
80 89
 extern const char *largefile_msg;
81
-# define LD "ld"
82
-# define LU "lu"
90
+# define LD PRId32
91
+# define LU PRIu32
83 92
 #endif
84 93
 
85 94
 /* endian-neutral reading of little-endian data */
... ...
@@ -15,13 +15,10 @@
15 15
 struct msszdd_compressor *
16 16
   mspack_create_szdd_compressor(struct mspack_system *sys)
17 17
 {
18
-  (void) sys;
19 18
   /* todo */
20 19
   return NULL;
21 20
 }
22 21
 
23 22
 void mspack_destroy_szdd_compressor(struct msszdd_compressor *self) {
24
-  (void) self;
25 23
   /* todo */
26
-  return;
27 24
 }
28 25
new file mode 100644
... ...
@@ -0,0 +1,81 @@
0
+#ifdef HAVE_CONFIG_H
1
+#include <config.h>
2
+#endif
3
+
4
+#include <stdio.h>
5
+#include <stdlib.h>
6
+#include <sys/stat.h>
7
+#include <mspack.h>
8
+#include <system.h>
9
+
10
+#define BUF_SIZE (1024*4096)
11
+char buf[BUF_SIZE];
12
+
13
+void rip(char *fname, off_t offset, unsigned int length) {
14
+  static unsigned int counter = 1;
15
+   struct stat st_buf;
16
+  char outname[13];
17
+  FILE *in, *out;
18
+
19
+  do {
20
+    snprintf(outname, 13, "%08u.cab", counter++);
21
+  } while (stat(outname, &st_buf) == 0);
22
+
23
+  printf("ripping %s offset %" LD " length %u to %s\n",
24
+	 fname, offset, length, outname);
25
+
26
+  if ((in = fopen(fname, "rb"))) {
27
+#if HAVE_FSEEKO
28
+    if (!fseeko(in, offset, SEEK_SET)) {
29
+#else
30
+    if (!fseek(in, offset, SEEK_SET)) {
31
+#endif
32
+      if ((out = fopen(outname, "wb"))) {
33
+	while (length > 0) {
34
+	  unsigned int run = BUF_SIZE;
35
+	  if (run > length) run = length;
36
+	  if (fread(&buf[0], 1, run, in) != run) {
37
+	    perror(fname);
38
+	    break;
39
+	  }
40
+	  if (fwrite(&buf[0], 1, run, out) != run) {
41
+	    perror(outname);
42
+	    break;
43
+	  }
44
+	  length -= run;
45
+	}
46
+	fclose(out);
47
+      }
48
+      else {
49
+	perror(outname);
50
+      }
51
+    }
52
+    else {
53
+      perror(fname);
54
+    }
55
+    fclose(in);
56
+  }
57
+  else {
58
+    perror(fname);
59
+  }
60
+}
61
+
62
+int main(int argc, char *argv[]) {
63
+  struct mscab_decompressor *cabd;
64
+  struct mscabd_cabinet *cab, *c;
65
+  int err;
66
+
67
+  MSPACK_SYS_SELFTEST(err);
68
+  if (err) return 0;
69
+
70
+  if ((cabd = mspack_create_cab_decompressor(NULL))) {
71
+    for (argv++; *argv; argv++) {
72
+      if ((cab = cabd->search(cabd, *argv))) {
73
+	for (c = cab; c; c = c->next) rip(*argv, c->base_offset, c->length);
74
+	cabd->close(cabd, cab);
75
+      }
76
+    }
77
+    mspack_destroy_cab_decompressor(cabd);
78
+  }
79
+  return 0;
80
+}
0 81
new file mode 100644
... ...
@@ -0,0 +1,228 @@
0
+#ifdef HAVE_CONFIG_H
1
+#include <config.h>
2
+#endif
3
+
4
+#include <stdio.h>
5
+#include <stdlib.h>
6
+#include <string.h>
7
+#include <mspack.h>
8
+#include <ctype.h>
9
+#include <sys/stat.h>
10
+
11
+#include <error.h>
12
+
13
+#if HAVE_MKDIR
14
+# if MKDIR_TAKES_ONE_ARG
15
+#  define mkdir(a, b) mkdir(a)
16
+# endif
17
+#else
18
+# if HAVE__MKDIR
19
+#  define mkdir(a, b) _mkdir(a)
20
+# else
21
+#  error "Don't know how to create a directory on this system."
22
+# endif
23
+#endif
24
+
25
+mode_t user_umask;
26
+
27
+#define FILENAME ".test.chmx"
28
+
29
+/**
30
+ * Ensures that all directory components in a filepath exist. New directory
31
+ * components are created, if necessary.
32
+ *
33
+ * @param path the filepath to check
34
+ * @return non-zero if all directory components in a filepath exist, zero
35
+ *         if components do not exist and cannot be created
36
+ */
37
+static int ensure_filepath(char *path) {
38
+  struct stat st_buf;
39
+  char *p;
40
+  int ok;
41
+
42
+  for (p = &path[1]; *p; p++) {
43
+    if (*p != '/') continue;
44
+    *p = '\0';
45
+    ok = (stat(path, &st_buf) == 0) && S_ISDIR(st_buf.st_mode);
46
+    if (!ok) ok = (mkdir(path, 0777 & ~user_umask) == 0);
47
+    *p = '/';
48
+    if (!ok) return 0;
49
+  }
50
+  return 1;
51
+}
52
+
53
+/**
54
+ * Creates a UNIX filename from the internal CAB filename and the given
55
+ * parameters.
56
+ *
57
+ * @param fname  the internal CAB filename.
58
+ * @param dir    a directory path to prepend to the output filename.
59
+ * @param lower  if non-zero, filename should be made lower-case.
60
+ * @param isunix if zero, MS-DOS path seperators are used in the internal
61
+ *               CAB filename. If non-zero, UNIX path seperators are used.
62
+ * @param utf8   if non-zero, the internal CAB filename is encoded in UTF8.
63
+ * @return a freshly allocated and created filename, or NULL if there was
64
+ *         not enough memory.
65
+ * @see unix_path_seperators()
66
+ */
67
+static char *create_output_name(unsigned char *fname, unsigned char *dir,
68
+			 int lower, int isunix, int utf8)
69
+{
70
+  unsigned char *p, *name, c, *fe, sep, slash;
71
+  unsigned int x;
72
+
73
+  sep   = (isunix) ? '/'  : '\\'; /* the path-seperator */
74
+  slash = (isunix) ? '\\' : '/';  /* the other slash */
75
+
76
+  /* length of filename */
77
+  x = strlen((char *) fname);
78
+  /* UTF8 worst case scenario: tolower() expands all chars from 1 to 3 bytes */
79
+  if (utf8) x *= 3;
80
+  /* length of output directory */
81
+  if (dir) x += strlen((char *) dir);
82
+
83
+  if (!(name = (unsigned char *) malloc(x + 2))) {
84
+    fprintf(stderr, "out of memory!\n");
85
+    return NULL;
86
+  }
87
+  
88
+  /* start with blank name */
89
+  *name = '\0';
90
+
91
+  /* add output directory if needed */
92
+  if (dir) {
93
+    strcpy((char *) name, (char *) dir);
94
+    strcat((char *) name, "/");
95
+  }
96
+
97
+  /* remove leading slashes */
98
+  while (*fname == sep) fname++;
99
+
100
+  /* copy from fi->filename to new name, converting MS-DOS slashes to UNIX
101
+   * slashes as we go. Also lowercases characters if needed.
102
+   */
103
+  p = &name[strlen((char *)name)];
104
+  fe = &fname[strlen((char *)fname)];
105
+
106
+  if (utf8) {
107
+    /* UTF8 translates two-byte unicode characters into 1, 2 or 3 bytes.
108
+     * %000000000xxxxxxx -> %0xxxxxxx
109
+     * %00000xxxxxyyyyyy -> %110xxxxx %10yyyyyy
110
+     * %xxxxyyyyyyzzzzzz -> %1110xxxx %10yyyyyy %10zzzzzz
111
+     *
112
+     * Therefore, the inverse is as follows:
113
+     * First char:
114
+     *  0x00 - 0x7F = one byte char
115
+     *  0x80 - 0xBF = invalid
116
+     *  0xC0 - 0xDF = 2 byte char (next char only 0x80-0xBF is valid)
117
+     *  0xE0 - 0xEF = 3 byte char (next 2 chars only 0x80-0xBF is valid)
118
+     *  0xF0 - 0xFF = invalid
119
+     */
120
+    do {
121
+      if (fname >= fe) {
122
+	free(name);
123
+	return NULL;
124
+      }
125
+
126
+      /* get next UTF8 char */
127
+      if ((c = *fname++) < 0x80) x = c;
128
+      else {
129
+	if ((c >= 0xC0) && (c < 0xE0)) {
130
+	  x = (c & 0x1F) << 6;
131
+	  x |= *fname++ & 0x3F;
132
+	}
133
+	else if ((c >= 0xE0) && (c < 0xF0)) {
134
+	  x = (c & 0xF) << 12;
135
+	  x |= (*fname++ & 0x3F) << 6;
136
+	  x |= *fname++ & 0x3F;
137
+	}
138
+	else x = '?';
139
+      }
140
+
141
+      /* whatever is the path seperator -> '/'
142
+       * whatever is the other slash    -> '\\'
143
+       * otherwise, if lower is set, the lowercase version */
144
+      if      (x == sep)   x = '/';
145
+      else if (x == slash) x = '\\';
146
+      else if (lower)      x = (unsigned int) tolower((int) x);
147
+
148
+      /* integer back to UTF8 */
149
+      if (x < 0x80) {
150
+	*p++ = (unsigned char) x;
151
+      }
152
+      else if (x < 0x800) {
153
+	*p++ = 0xC0 | (x >> 6);   
154
+	*p++ = 0x80 | (x & 0x3F);
155
+      }
156
+      else {
157
+	*p++ = 0xE0 | (x >> 12);
158
+	*p++ = 0x80 | ((x >> 6) & 0x3F);
159
+	*p++ = 0x80 | (x & 0x3F);
160
+      }
161
+    } while (x);
162
+  }
163
+  else {
164
+    /* regular non-utf8 version */
165
+    do {
166
+      c = *fname++;
167
+      if      (c == sep)   c = '/';
168
+      else if (c == slash) c = '\\';
169
+      else if (lower)      c = (unsigned char) tolower((int) c);
170
+    } while ((*p++ = c));
171
+  }
172
+  return (char *) name;
173
+}
174
+
175
+static int sortfunc(const void *a, const void *b) {
176
+  off_t diff = 
177
+    ((* ((struct mschmd_file **) a))->offset) -
178
+    ((* ((struct mschmd_file **) b))->offset);
179
+  return (diff < 0) ? -1 : ((diff > 0) ? 1 : 0);
180
+}
181
+
182
+int main(int argc, char *argv[]) {
183
+  struct mschm_decompressor *chmd;
184
+  struct mschmd_header *chm;
185
+  struct mschmd_file *file, **f;
186
+  unsigned int numf, i;
187
+
188
+  setbuf(stdout, NULL);
189
+  setbuf(stderr, NULL);
190
+  user_umask = umask(0); umask(user_umask);
191
+
192
+  MSPACK_SYS_SELFTEST(i);
193
+  if (i) return 0;
194
+
195
+  if ((chmd = mspack_create_chm_decompressor(NULL))) {
196
+    for (argv++; *argv; argv++) {
197
+      printf("%s\n", *argv);
198
+      if ((chm = chmd->open(chmd, *argv))) {
199
+
200
+	/* build an ordered list of files for maximum extraction speed */
201
+	for (numf=0, file=chm->files; file; file = file->next) numf++;
202
+	if ((f = (struct mschmd_file **) calloc(numf, sizeof(struct mschmd_file *)))) {
203
+	  for (i=0, file=chm->files; file; file = file->next) f[i++] = file;
204
+	  qsort(f, numf, sizeof(struct mschmd_file *), &sortfunc);
205
+
206
+	  for (i = 0; i < numf; i++) {
207
+	    char *outname = create_output_name((unsigned char *)f[i]->filename,NULL,0,1,0);
208
+	    printf("Extracting %s\n", outname);
209
+	    ensure_filepath(outname);
210
+	    if (chmd->extract(chmd, f[i], outname)) {
211
+	      printf("%s: extract error on \"%s\": %s\n",
212
+		     *argv, f[i]->filename, ERROR(chmd));
213
+	    }
214
+	    free(outname);
215
+	  }
216
+	  free(f);
217
+	}
218
+	chmd->close(chmd, chm);
219
+      }
220
+      else {
221
+	printf("%s: can't open -- %s\n", *argv, ERROR(chmd));
222
+      }
223
+    }
224
+    mspack_destroy_chm_decompressor(chmd);
225
+  }
226
+  return 0;
227
+}
0 228
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+#define ERROR(base) error_msg(base->last_error(base))
1
+
2
+const char *error_msg(int error) {
3
+    static char buf[32];
4
+    switch (error) {
5
+    case MSPACK_ERR_OK:         return "no error";
6
+    case MSPACK_ERR_ARGS:       return "bad arguments to library function";
7
+    case MSPACK_ERR_OPEN:       return "error opening file";
8
+    case MSPACK_ERR_READ:       return "read error";
9
+    case MSPACK_ERR_WRITE:      return "write error";
10
+    case MSPACK_ERR_SEEK:       return "seek error";
11
+    case MSPACK_ERR_NOMEMORY:   return "out of memory";
12
+    case MSPACK_ERR_SIGNATURE:  return "bad signature";
13
+    case MSPACK_ERR_DATAFORMAT: return "error in data format";
14
+    case MSPACK_ERR_CHECKSUM:   return "checksum error";
15
+    case MSPACK_ERR_CRUNCH:     return "compression error";
16
+    case MSPACK_ERR_DECRUNCH:   return "decompression error";
17
+    }
18
+
19
+    snprintf(buf, sizeof(buf), "unknown error %d", error);
20
+    return buf;
21
+}
0 22
new file mode 100644
... ...
@@ -0,0 +1,48 @@
0
+/* acts like Microsoft's EXPAND.EXE */
1
+#ifdef HAVE_CONFIG_H
2
+#include <config.h>
3
+#endif
4
+
5
+#include <stdio.h>
6
+#include <stdlib.h>
7
+#include <string.h>
8
+
9
+#include <mspack.h>
10
+#include <error.h>
11
+
12
+int main(int argc, char *argv[]) {
13
+    struct msszdd_decompressor *szddd;
14
+    struct mskwaj_decompressor *kwajd;
15
+    int err;
16
+
17
+    if (argc != 3) {
18
+	fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
19
+	return 1;
20
+    }
21
+
22
+    /* exit if self-test reveals an error */
23
+    MSPACK_SYS_SELFTEST(err);
24
+    if (err) return 1;
25
+
26
+    szddd = mspack_create_szdd_decompressor(NULL);
27
+    kwajd = mspack_create_kwaj_decompressor(NULL);
28
+
29
+    if (szddd && kwajd) {
30
+        err = szddd->decompress(szddd, argv[1], argv[2]);
31
+        /* if not SZDD file, try decompressing as KWAJ */
32
+        if (err == MSPACK_ERR_SIGNATURE) {
33
+            err = kwajd->decompress(kwajd, argv[1], argv[2]);
34
+        }
35
+        if (err != MSPACK_ERR_OK) {
36
+            fprintf(stderr, "%s -> %s: %s\n", argv[1], argv[2], error_msg(err));
37
+        }
38
+    }
39
+    else {
40
+         fprintf(stderr, "can't create SZDD/KWAJ decompressor\n");
41
+         err = 1;
42
+    }
43
+
44
+    mspack_destroy_szdd_decompressor(szddd);
45
+    mspack_destroy_kwaj_decompressor(kwajd);
46
+    return err ? 1 : 0;
47
+}
0 48
new file mode 100644
... ...
@@ -0,0 +1,41 @@
0
+#ifdef HAVE_CONFIG_H
1
+#include <config.h>
2
+#endif
3
+
4
+#include <stdio.h>
5
+#include <stdlib.h>
6
+#include <string.h>
7
+#include <mspack.h>
8
+
9
+#include <error.h>
10
+
11
+int main(int argc, char *argv[]) {
12
+    struct msoab_decompressor *oabd;
13
+    int err;
14
+
15
+    setbuf(stdout, NULL);
16
+    setbuf(stderr, NULL);
17
+
18
+    MSPACK_SYS_SELFTEST(err);
19
+    if (err) return 0;
20
+
21
+    if ((oabd = mspack_create_oab_decompressor(NULL))) {
22
+        if (argc == 3) {
23
+            err = oabd->decompress(oabd, argv[1], argv[2]);
24
+            if (err) fprintf(stderr, "%s -> %s: %s\n", argv[1], argv[2], error_msg(err));
25
+        }
26
+        else if (argc == 4) {
27
+            err = oabd->decompress_incremental(oabd, argv[2], argv[1], argv[3]);
28
+            if (err) fprintf(stderr, "%s + %s -> %s: %s\n", argv[1], argv[2], argv[3], error_msg(err));
29
+        }
30
+        else {
31
+            fprintf(stderr, "Usage: %s <input> <output>\n", *argv);
32
+            fprintf(stderr, "   or  %s <base> <patch> <output>\n", *argv);
33
+        }
34
+        mspack_destroy_oab_decompressor(oabd);
35
+    }
36
+    else {
37
+        fprintf(stderr, "%s: can't make OAB decompressor\n", *argv);
38
+    }
39
+    return 0;
40
+}
0 41
deleted file mode 100644
... ...
@@ -1,179 +0,0 @@
1
-/* An implementation of the mspack_system interface using only memory */
2
-
3
-#ifdef HAVE_CONFIG_H
4
-#include <config.h>
5
-#endif
6
-
7
-#include <stdio.h>
8
-#include <stdlib.h>
9
-#include <string.h>
10
-#include <mspack.h>
11
-
12
-/* use a pointer to a mem_buf structure as "filenames" */
13
-struct mem_buf {
14
-  void *data;
15
-  size_t length;
16
-};
17
-
18
-struct mem_file {
19
-  char *data;
20
-  size_t length, posn;
21
-};
22
-
23
-static void *mem_alloc(struct mspack_system *self, size_t bytes) {
24
-  /* put your memory allocator here */
25
-  return malloc(bytes);
26
-}
27
-
28
-static void mem_free(void *buffer) {
29
-  /* put your memory deallocator here */
30
-  free(buffer);
31
-}
32
-
33
-static void mem_copy(void *src, void *dest, size_t bytes) {
34
-  /* put your own memory copy routine here */
35
-  memcpy(dest, src, bytes);
36
-}
37
-
38
-static void mem_msg(struct mem_file *file, const char *format, ...) {
39
-  /* put your own printf-type routine here, or leave it empty */
40
-}
41
-
42
-static struct mem_file *mem_open(struct mspack_system *self,
43
-				 struct mem_buf *fn, int mode)
44
-{
45
-  struct mem_file *fh;
46
-  if (!fn || !fn->data || !fn->length) return NULL;
47
-  if ((fh = (struct mem_file *) mem_alloc(self, sizeof(struct mem_file)))) {
48
-    fh->data   = (char *) fn->data;
49
-    fh->length = fn->length;
50
-    fh->posn   = (mode == MSPACK_SYS_OPEN_APPEND) ? fn->length : 0;
51
-  }
52
-  return fh;
53
-}
54
-
55
-static void mem_close(struct mem_file *fh) {
56
-  if (fh) mem_free(fh);
57
-}
58
-
59
-static int mem_read(struct mem_file *fh, void *buffer, int bytes) {
60
-  int todo;
61
-  if (!fh || !buffer || bytes < 0) return -1;
62
-  todo = fh->length - fh->posn;
63
-  if (todo > bytes) todo = bytes;
64
-  if (todo > 0) mem_copy(&fh->data[fh->posn], buffer, (size_t) todo);
65
-  fh->posn += todo; return todo;
66
-}
67
-
68
-static int mem_write(struct mem_file *fh, void *buffer, int bytes) {
69
-  int todo;
70
-  if (!fh || !buffer || bytes < 0) return -1;
71
-  todo = fh->length - fh->posn;
72
-  if (todo > bytes) todo = bytes;
73
-  if (todo > 0) mem_copy(buffer, &fh->data[fh->posn], (size_t) todo);
74
-  fh->posn += todo; return todo;
75
-}
76
-
77
-static int mem_seek(struct mem_file *fh, off_t offset, int mode) {
78
-  if (!fh) return 1;
79
-  switch (mode) {
80
-  case MSPACK_SYS_SEEK_START: break;
81
-  case MSPACK_SYS_SEEK_CUR:   offset += (off_t) fh->posn; break;
82
-  case MSPACK_SYS_SEEK_END:   offset += (off_t) fh->length; break;
83
-  default: return 1;
84
-  }
85
-  if ((offset < 0) || (offset > (off_t) fh->length)) return 1;
86
-  fh->posn = (size_t) offset;
87
-  return 0;
88
-}
89
-
90
-static off_t mem_tell(struct mem_file *fh) {
91
-  return (fh) ? (off_t) fh->posn : -1;
92
-}
93
-
94
-static struct mspack_system mem_system = {
95
-  (struct mspack_file * (*)(struct mspack_system *, const char *, int)) &mem_open,
96
-  (void (*)(struct mspack_file *)) &mem_close,
97
-  (int (*)(struct mspack_file *, void *, int)) &mem_read, 
98
-  (int (*)(struct mspack_file *, void *, int)) &mem_write,
99
-  (int (*)(struct mspack_file *, off_t, int)) &mem_seek, 
100
-  (off_t (*)(struct mspack_file *)) &mem_tell,
101
-  (void (*)(struct mspack_file *, const char *, ...)) &mem_msg,
102
-  &mem_alloc,
103
-  &mem_free,
104
-  &mem_copy,
105
-  NULL
106
-};
107
-
108
-/* example of usage with mscab_decompressor */
109
-
110
-/* a simple cabinet */
111
-static unsigned char embedded_cab[] = {
112
-  0x4D,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0xFD,0x00,0x00,0x00,0x00,0x00,0x00,
113
-  0x00,0x2C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x02,0x00,
114
-  0x00,0x00,0x22,0x06,0x00,0x00,0x5E,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x4D,
115
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x22,0xBA,0x59,0x20,0x00,
116
-  0x68,0x65,0x6C,0x6C,0x6F,0x2E,0x63,0x00,0x4A,0x00,0x00,0x00,0x4D,0x00,0x00,
117
-  0x00,0x00,0x00,0x6C,0x22,0xE7,0x59,0x20,0x00,0x77,0x65,0x6C,0x63,0x6F,0x6D,
118
-  0x65,0x2E,0x63,0x00,0xBD,0x5A,0xA6,0x30,0x97,0x00,0x97,0x00,0x23,0x69,0x6E,
119
-  0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,0x68,0x3E,
120
-  0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,0x28,0x76,
121
-  0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,0x70,0x72,
122
-  0x69,0x6E,0x74,0x66,0x28,0x22,0x48,0x65,0x6C,0x6C,0x6F,0x2C,0x20,0x77,0x6F,
123
-  0x72,0x6C,0x64,0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x23,
124
-  0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,
125
-  0x68,0x3E,0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,
126
-  0x28,0x76,0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,
127
-  0x70,0x72,0x69,0x6E,0x74,0x66,0x28,0x22,0x57,0x65,0x6C,0x63,0x6F,0x6D,0x65,
128
-  0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x0D,0x0A
129
-};
130
-
131
-int main() {
132
-  struct mscab_decompressor *cabd;
133
-  struct mscabd_cabinet *cab;
134
-  struct mscabd_file *file;
135
-  struct mem_buf source = { &embedded_cab[0], sizeof(embedded_cab) };
136
-  struct mem_buf output;
137
-  int err;
138
-
139
-  /* if self-test reveals an error */
140
-  MSPACK_SYS_SELFTEST(err);
141
-  if (err) return 1;
142
-
143
-  /* create a cab decompressor using our custom mspack_system interface */
144
-  if ((cabd = mspack_create_cab_decompressor(&mem_system))) {
145
-
146
-    /* open a cab file direct from memory */
147
-    if ((cab = cabd->open(cabd, (char *) &source))) {
148
-
149
-      /* for all files */
150
-      for (file = cab->files; file; file = file->next) {
151
-	/* fill out our "filename" (memory pointer and length) */
152
-	output.data = (char *) malloc(file->length);
153
-	output.length = file->length;
154
-
155
-	/* let cabd extract this file to our memory buffer */
156
-	if (output.data && cabd->extract(cabd, file, (char *) &output)) {
157
-	  exit(1);
158
-	}
159
-
160
-	/* dump the memory buffer to stdout (for display purposes) */
161
-	printf("Filename: %s\nContents:\n", file->filename);
162
-	fwrite(output.data, 1, output.length, stdout);
163
-
164
-	/* free our buffer */
165
-	free(output.data);
166
-      }
167
-      cabd->close(cabd, cab);
168
-    }
169
-    else {
170
-      fprintf(stderr, "can't open cabinet (%d)\n", cabd->last_error(cabd));
171
-    }
172
-    mspack_destroy_cab_decompressor(cabd);
173
-  }
174
-  else {
175
-    fprintf(stderr, "can't make decompressor\n");
176
-  }
177
-  return 0;
178
-
179
-}
... ...
@@ -8,12 +8,13 @@
8 8
 #include <stdlib.h>
9 9
 #include <string.h>
10 10
 #include <mspack.h>
11
+#include <system.h>
11 12
 
12 13
 unsigned int test_count = 0;
13 14
 
14 15
 #define TEST(x) do {\
15 16
   test_count++; \
16
-  if (!(x)) {printf("%s:%d FAILED %s\n",__FUNCTION__,__LINE__,#x);exit(1);} \
17
+  if (!(x)) {printf("%s:%d FAILED %s\n",__func__,__LINE__,#x);exit(1);} \
17 18
 } while (0)
18 19
 
19 20
 /* open where cab file doesn't exist */
... ...
@@ -140,6 +141,10 @@ void cabd_open_test_04() {
140 140
   cab = cabd->open(cabd, "test_files/cabd/bad_folderindex.cab");
141 141
   TEST(cab == NULL);
142 142
 
143
+  /* cab has one file with empty filename */
144
+  cab = cabd->open(cabd, "test_files/cabd/filename-read-violation-1.cab");
145
+  TEST(cab == NULL);
146
+
143 147
   mspack_destroy_cab_decompressor(cabd);
144 148
 }
145 149
 
... ...
@@ -186,7 +191,8 @@ void cabd_open_test_05() {
186 186
   for (i = 0; i < (sizeof(str_files)/sizeof(char *)); i++) {
187 187
     cab = cabd->open(cabd, str_files[i]);
188 188
     TEST(cab == NULL);
189
-    TEST(cabd->last_error(cabd) == MSPACK_ERR_DATAFORMAT);
189
+    TEST(cabd->last_error(cabd) == MSPACK_ERR_DATAFORMAT ||
190
+         cabd->last_error(cabd) == MSPACK_ERR_READ);
190 191
   }
191 192
 
192 193
   /* lack of data blocks should NOT be a problem for merely reading */
... ...
@@ -358,7 +364,66 @@ void cabd_merge_test_02() {
358 358
   cabd->close(cabd, cab[0]);
359 359
   mspack_destroy_cab_decompressor(cabd);
360 360
 }
361
-  
361
+
362
+/* test bad cabinets cannot be extracted */
363
+void cabd_extract_test_01() {
364
+    struct mscab_decompressor *cabd;
365
+    struct mscabd_cabinet *cab;
366
+    struct mscabd_file *file;
367
+    unsigned int i;
368
+    const char *files[] = {
369
+        "test_files/cabd/cve-2010-2800-mszip-infinite-loop.cab",
370
+        "test_files/cabd/cve-2014-9556-qtm-infinite-loop.cab",
371
+        "test_files/cabd/cve-2015-4470-mszip-over-read.cab",
372
+        "test_files/cabd/cve-2015-4471-lzx-under-read.cab",
373
+        "test_files/cabd/filename-read-violation-2.cab",
374
+        "test_files/cabd/filename-read-violation-3.cab",
375
+        "test_files/cabd/filename-read-violation-4.cab",
376
+        "test_files/cabd/lzx-main-tree-no-lengths.cab",
377
+        "test_files/cabd/lzx-premature-matches.cab"
378
+    };
379
+
380
+    cabd = mspack_create_cab_decompressor(NULL);
381
+    TEST(cabd != NULL);
382
+
383
+    for (i = 0; i < (sizeof(files)/sizeof(char *)); i++) {
384
+        cab = cabd->open(cabd, files[i]);
385
+        TEST(cab != NULL);
386
+        TEST(cab->files != NULL);
387
+        for (file = cab->files; file; file = file->next) {
388
+            int err = cabd->extract(cabd, file, "/dev/null");
389
+            TEST(err == MSPACK_ERR_DATAFORMAT || err == MSPACK_ERR_DECRUNCH);
390
+        }
391
+        cabd->close(cabd, cab);
392
+    }
393
+    mspack_destroy_cab_decompressor(cabd);
394
+}
395
+
396
+/* test that CVE-2014-9732 is fixed */
397
+void cabd_extract_test_02() {
398
+    struct mscab_decompressor *cabd;
399
+    struct mscabd_cabinet *cab;
400
+    int err;
401
+
402
+    /* the first file in this cabinet belongs to a valid folder. The
403
+     * second belongs to an invalid folder. Unpacking files 1, 2, 1
404
+     * caused cabd.c to try and free the invalid folder state left by
405
+     * extracting from folder 2, which caused a jump to NULL / segfault
406
+     */
407
+    cabd = mspack_create_cab_decompressor(NULL);
408
+    TEST(cabd != NULL);
409
+    cab = cabd->open(cabd, "test_files/cabd/cve-2014-9732-folders-segfault.cab");
410
+    TEST(cab != NULL);
411
+    err = cabd->extract(cabd, cab->files, "/dev/null");
412
+    TEST(err == MSPACK_ERR_OK);
413
+    err = cabd->extract(cabd, cab->files->next, "/dev/null");
414
+    TEST(err == MSPACK_ERR_DATAFORMAT || err == MSPACK_ERR_DECRUNCH);
415
+    err = cabd->extract(cabd, cab->files, "/dev/null");
416
+    TEST(err == MSPACK_ERR_OK);
417
+    cabd->close(cabd, cab);
418
+    mspack_destroy_cab_decompressor(cabd);
419
+}
420
+
362 421
 int main() {
363 422
   int selftest;
364 423
 
... ...
@@ -379,7 +444,8 @@ int main() {
379 379
   cabd_merge_test_01();
380 380
   cabd_merge_test_02();
381 381
 
382
-  /* extract() tests */
382
+  cabd_extract_test_01();
383
+  cabd_extract_test_02();
383 384
 
384 385
   printf("ALL %d TESTS PASSED.\n", test_count);
385 386
   return 0;
386 387
deleted file mode 100644
... ...
@@ -1,81 +0,0 @@
1
-#ifdef HAVE_CONFIG_H
2
-#include <config.h>
3
-#endif
4
-
5
-#include <stdio.h>
6
-#include <stdlib.h>
7
-#include <sys/stat.h>
8
-#include <mspack.h>
9
-#include <system.h>
10
-
11
-#define BUF_SIZE (1024*4096)
12
-char buf[BUF_SIZE];
13
-
14
-void rip(char *fname, off_t offset, unsigned int length) {
15
-  static unsigned int counter = 1;
16
-   struct stat st_buf;
17
-  char outname[13];
18
-  FILE *in, *out;
19
-
20
-  do {
21
-    snprintf(outname, 13, "%08u.cab", counter++);
22
-  } while (stat(outname, &st_buf) == 0);
23
-
24
-  printf("ripping %s offset %" LD " length %u to %s\n",
25
-	 fname, offset, length, outname);
26
-
27
-  if ((in = fopen(fname, "rb"))) {
28
-#ifdef HAVE_FSEEKO
29
-    if (!fseeko(in, offset, SEEK_SET)) {
30
-#else
31
-    if (!fseek(in, offset, SEEK_SET)) {
32
-#endif
33
-      if ((out = fopen(outname, "wb"))) {
34
-	while (length > 0) {
35
-	  unsigned int run = BUF_SIZE;
36
-	  if (run > length) run = length;
37
-	  if (fread(&buf[0], 1, run, in) != run) {
38
-	    perror(fname);
39
-	    break;
40
-	  }
41
-	  if (fwrite(&buf[0], 1, run, out) != run) {
42
-	    perror(outname);
43
-	    break;
44
-	  }
45
-	  length -= run;
46
-	}
47
-	fclose(out);
48
-      }
49
-      else {
50
-	perror(outname);
51
-      }
52
-    }
53
-    else {
54
-      perror(fname);
55
-    }
56
-    fclose(in);
57
-  }
58
-  else {
59
-    perror(fname);
60
-  }
61
-}
62
-
63
-int main(int argc, char *argv[]) {
64
-  struct mscab_decompressor *cabd;
65
-  struct mscabd_cabinet *cab, *c;
66
-  int err;
67
-
68
-  MSPACK_SYS_SELFTEST(err);
69
-  if (err) return 0;
70
-
71
-  if ((cabd = mspack_create_cab_decompressor(NULL))) {
72
-    for (argv++; *argv; argv++) {
73
-      if ((cab = cabd->search(cabd, *argv))) {
74
-	for (c = cab; c; c = c->next) rip(*argv, c->base_offset, c->length);
75
-	cabd->close(cabd, cab);
76
-      }
77
-    }
78
-    mspack_destroy_cab_decompressor(cabd);
79
-  }
80
-  return 0;
81
-}
82 1
new file mode 100644
... ...
@@ -0,0 +1,103 @@
0
+/* CHM regression test suite */
1
+
2
+#ifdef HAVE_CONFIG_H
3
+#include <config.h>
4
+#endif
5
+
6
+#include <stdio.h>
7
+#include <stdlib.h>
8
+#include <string.h>
9
+#include <mspack.h>
10
+#include <system.h>
11
+
12
+unsigned int test_count = 0;
13
+#define TEST(x) do {\
14
+    test_count++; \
15
+    if (!(x)) {printf("%s:%d FAILED %s\n",__func__,__LINE__,#x);exit(1);} \
16
+} while (0)
17
+
18
+/* check opening bad files is rejected */
19
+void chmd_open_test_01() {
20
+    struct mschm_decompressor *chmd;
21
+    struct mschmd_header *chm;
22
+    unsigned int i;
23
+    const char *files[] = {
24
+        "test_files/chmd/cve-2017-6419-lzx-negative-spaninfo.chm"
25
+    };
26
+
27
+    chmd =  mspack_create_chm_decompressor(NULL);
28
+    TEST(chmd != NULL);
29
+    for (i = 0; i < (sizeof(files)/sizeof(char *)); i++) {
30
+        chm = chmd->open(chmd, files[i]);
31
+        TEST(chm == NULL);
32
+    }
33
+    mspack_destroy_chm_decompressor(chmd);
34
+}
35
+
36
+/* check searching bad files doesn't crash */
37
+void chmd_search_test_01() {
38
+    struct mschm_decompressor *chmd;
39
+    struct mschmd_header *chm1, *chm2;
40
+    struct mschmd_file *f, result;
41
+    unsigned int i;
42
+    const char *files[] = {
43
+        "test_files/chmd/cve-2015-4468-namelen-bounds.chm",
44
+        "test_files/chmd/cve-2015-4469-namelen-bounds.chm",
45
+        "test_files/chmd/cve-2015-4472-namelen-bounds.chm"
46
+    };
47
+
48
+    chmd =  mspack_create_chm_decompressor(NULL);
49
+    TEST(chmd != NULL);
50
+    for (i = 0; i < (sizeof(files)/sizeof(char *)); i++) {
51
+        chm1 = chmd->open(chmd, files[i]);
52
+        TEST(chm1 != NULL);
53
+        chm2 = chmd->fast_open(chmd, files[i]);
54
+        TEST(chm2 != NULL);
55
+        for (f = chm1->files; f; f = f->next) {
56
+            if (!chmd->fast_find(chmd, chm2, f->filename, &result, sizeof(result))) {
57
+                TEST(f->offset == result.offset);
58
+                TEST(f->length == result.length);
59
+            }
60
+        }
61
+        chmd->close(chmd, chm2);
62
+        chmd->close(chmd, chm1);
63
+    }
64
+    mspack_destroy_chm_decompressor(chmd);
65
+}
66
+
67
+/* check extracting bad files doesn't crash */
68
+void chmd_extract_test_01() {
69
+    struct mschm_decompressor *chmd;
70
+    struct mschmd_header *chm;
71
+    struct mschmd_file *f;
72
+    unsigned int i;
73
+    const char *files[] = {
74
+        "test_files/chmd/cve-2015-4467-reset-interval-zero.chm",
75
+    };
76
+
77
+    chmd = mspack_create_chm_decompressor(NULL);
78
+    TEST(chmd != NULL);
79
+    for (i = 0; i < (sizeof(files)/sizeof(char *)); i++) {
80
+        chm = chmd->open(chmd, files[i]);
81
+        TEST(chm != NULL);
82
+        for (f = chm->files; f; f = f->next) {
83
+            chmd->extract(chmd, f, "/dev/null");
84
+        }
85
+        chmd->close(chmd, chm);
86
+    }
87
+    mspack_destroy_chm_decompressor(chmd);
88
+}
89
+
90
+int main() {
91
+  int selftest;
92
+
93
+  MSPACK_SYS_SELFTEST(selftest);
94
+  TEST(selftest == MSPACK_ERR_OK);
95
+
96
+  chmd_open_test_01();
97
+  chmd_search_test_01();
98
+  chmd_extract_test_01();
99
+
100
+  printf("ALL %d TESTS PASSED.\n", test_count);
101
+  return 0;
102
+}
... ...
@@ -68,7 +68,7 @@ void print_dir(struct mschmd_header *chm, char *filename) {
68 68
   if (!(chunk = (unsigned char *) malloc(chm->chunk_size))) return;
69 69
   
70 70
   if ((fh = fopen(filename, "rb"))) {
71
-#ifdef HAVE_FSEEKO
71
+#if HAVE_FSEEKO
72 72
     fseeko(fh, chm->dir_offset - 84, SEEK_SET);
73 73
 #else
74 74
     fseek(fh, chm->dir_offset - 84, SEEK_SET);
75 75
deleted file mode 100644
... ...
@@ -1,216 +0,0 @@
1
-#ifdef HAVE_CONFIG_H
2
-#include <config.h>
3
-#endif
4
-
5
-#include <stdio.h>
6
-#include <stdlib.h>
7
-#include <string.h>
8
-#include <mspack.h>
9
-#include <ctype.h>
10
-#include <sys/stat.h>
11
-
12
-#include <error.h>
13
-
14
-mode_t user_umask;
15
-
16
-#define FILENAME ".test.chmx"
17
-
18
-/**
19
- * Ensures that all directory components in a filepath exist. New directory
20
- * components are created, if necessary.
21
- *
22
- * @param path the filepath to check
23
- * @return non-zero if all directory components in a filepath exist, zero
24
- *         if components do not exist and cannot be created
25
- */
26
-static int ensure_filepath(char *path) {
27
-  struct stat st_buf;
28
-  char *p;
29
-  int ok;
30
-
31
-  for (p = &path[1]; *p; p++) {
32
-    if (*p != '/') continue;
33
-    *p = '\0';
34
-    ok = (stat(path, &st_buf) == 0) && S_ISDIR(st_buf.st_mode);
35
-    if (!ok) ok = (mkdir(path, 0777 & ~user_umask) == 0);
36
-    *p = '/';
37
-    if (!ok) return 0;
38
-  }
39
-  return 1;
40
-}
41
-
42
-/**
43
- * Creates a UNIX filename from the internal CAB filename and the given
44
- * parameters.
45
- *
46
- * @param fname  the internal CAB filename.
47
- * @param dir    a directory path to prepend to the output filename.
48
- * @param lower  if non-zero, filename should be made lower-case.
49
- * @param isunix if zero, MS-DOS path seperators are used in the internal
50
- *               CAB filename. If non-zero, UNIX path seperators are used.
51
- * @param utf8   if non-zero, the internal CAB filename is encoded in UTF8.
52
- * @return a freshly allocated and created filename, or NULL if there was
53
- *         not enough memory.
54
- * @see unix_path_seperators()
55
- */
56
-static char *create_output_name(unsigned char *fname, unsigned char *dir,
57
-			 int lower, int isunix, int utf8)
58
-{
59
-  unsigned char *p, *name, c, *fe, sep, slash;
60
-  unsigned int x;
61
-
62
-  sep   = (isunix) ? '/'  : '\\'; /* the path-seperator */
63
-  slash = (isunix) ? '\\' : '/';  /* the other slash */
64
-
65
-  /* length of filename */
66
-  x = strlen((char *) fname);
67
-  /* UTF8 worst case scenario: tolower() expands all chars from 1 to 3 bytes */
68
-  if (utf8) x *= 3;
69
-  /* length of output directory */
70
-  if (dir) x += strlen((char *) dir);
71
-
72
-  if (!(name = (unsigned char *) malloc(x + 2))) {
73
-    fprintf(stderr, "out of memory!\n");
74
-    return NULL;
75
-  }
76
-  
77
-  /* start with blank name */
78
-  *name = '\0';
79
-
80
-  /* add output directory if needed */
81
-  if (dir) {
82
-    strcpy((char *) name, (char *) dir);
83
-    strcat((char *) name, "/");
84
-  }
85
-
86
-  /* remove leading slashes */
87
-  while (*fname == sep) fname++;
88
-
89
-  /* copy from fi->filename to new name, converting MS-DOS slashes to UNIX
90
-   * slashes as we go. Also lowercases characters if needed.
91
-   */
92
-  p = &name[strlen((char *)name)];
93
-  fe = &fname[strlen((char *)fname)];
94
-
95
-  if (utf8) {
96
-    /* UTF8 translates two-byte unicode characters into 1, 2 or 3 bytes.
97
-     * %000000000xxxxxxx -> %0xxxxxxx
98
-     * %00000xxxxxyyyyyy -> %110xxxxx %10yyyyyy
99
-     * %xxxxyyyyyyzzzzzz -> %1110xxxx %10yyyyyy %10zzzzzz
100
-     *
101
-     * Therefore, the inverse is as follows:
102
-     * First char:
103
-     *  0x00 - 0x7F = one byte char
104
-     *  0x80 - 0xBF = invalid
105
-     *  0xC0 - 0xDF = 2 byte char (next char only 0x80-0xBF is valid)
106
-     *  0xE0 - 0xEF = 3 byte char (next 2 chars only 0x80-0xBF is valid)
107
-     *  0xF0 - 0xFF = invalid
108
-     */
109
-    do {
110
-      if (fname >= fe) {
111
-	free(name);
112
-	return NULL;
113
-      }
114
-
115
-      /* get next UTF8 char */
116
-      if ((c = *fname++) < 0x80) x = c;
117
-      else {
118
-	if ((c >= 0xC0) && (c < 0xE0)) {
119
-	  x = (c & 0x1F) << 6;
120
-	  x |= *fname++ & 0x3F;
121
-	}
122
-	else if ((c >= 0xE0) && (c < 0xF0)) {
123
-	  x = (c & 0xF) << 12;
124
-	  x |= (*fname++ & 0x3F) << 6;
125
-	  x |= *fname++ & 0x3F;
126
-	}
127
-	else x = '?';
128
-      }
129
-
130
-      /* whatever is the path seperator -> '/'
131
-       * whatever is the other slash    -> '\\'
132
-       * otherwise, if lower is set, the lowercase version */
133
-      if      (x == sep)   x = '/';
134
-      else if (x == slash) x = '\\';
135
-      else if (lower)      x = (unsigned int) tolower((int) x);
136
-
137
-      /* integer back to UTF8 */
138
-      if (x < 0x80) {
139
-	*p++ = (unsigned char) x;
140
-      }
141
-      else if (x < 0x800) {
142
-	*p++ = 0xC0 | (x >> 6);   
143
-	*p++ = 0x80 | (x & 0x3F);
144
-      }
145
-      else {
146
-	*p++ = 0xE0 | (x >> 12);
147
-	*p++ = 0x80 | ((x >> 6) & 0x3F);
148
-	*p++ = 0x80 | (x & 0x3F);
149
-      }
150
-    } while (x);
151
-  }
152
-  else {
153
-    /* regular non-utf8 version */
154
-    do {
155
-      c = *fname++;
156
-      if      (c == sep)   c = '/';
157
-      else if (c == slash) c = '\\';
158
-      else if (lower)      c = (unsigned char) tolower((int) c);
159
-    } while ((*p++ = c));
160
-  }
161
-  return (char *) name;
162
-}
163
-
164
-static int sortfunc(const void *a, const void *b) {
165
-  off_t diff = 
166
-    ((* ((struct mschmd_file **) a))->offset) -
167
-    ((* ((struct mschmd_file **) b))->offset);
168
-  return (diff < 0) ? -1 : ((diff > 0) ? 1 : 0);
169
-}
170
-
171
-int main(int argc, char *argv[]) {
172
-  struct mschm_decompressor *chmd;
173
-  struct mschmd_header *chm;
174
-  struct mschmd_file *file, **f;
175
-  unsigned int numf, i;
176
-
177
-  setbuf(stdout, NULL);
178
-  setbuf(stderr, NULL);
179
-  user_umask = umask(0); umask(user_umask);
180
-
181
-  MSPACK_SYS_SELFTEST(i);
182
-  if (i) return 0;
183
-
184
-  if ((chmd = mspack_create_chm_decompressor(NULL))) {
185
-    for (argv++; *argv; argv++) {
186
-      printf("%s\n", *argv);
187
-      if ((chm = chmd->open(chmd, *argv))) {
188
-
189
-	/* build an ordered list of files for maximum extraction speed */
190
-	for (numf=0, file=chm->files; file; file = file->next) numf++;
191
-	if ((f = (struct mschmd_file **) calloc(numf, sizeof(struct mschmd_file *)))) {
192
-	  for (i=0, file=chm->files; file; file = file->next) f[i++] = file;
193
-	  qsort(f, numf, sizeof(struct mschmd_file *), &sortfunc);
194
-
195
-	  for (i = 0; i < numf; i++) {
196
-	    char *outname = create_output_name((unsigned char *)f[i]->filename,NULL,0,1,0);
197
-	    printf("Extracting %s\n", outname);
198
-	    ensure_filepath(outname);
199
-	    if (chmd->extract(chmd, f[i], outname)) {
200
-	      printf("%s: extract error on \"%s\": %s\n",
201
-		     *argv, f[i]->filename, ERROR(chmd));
202
-	    }
203
-	    free(outname);
204
-	  }
205
-	  free(f);
206
-	}
207
-	chmd->close(chmd, chm);
208
-      }
209
-      else {
210
-	printf("%s: can't open -- %s\n", *argv, ERROR(chmd));
211
-      }
212
-    }
213
-    mspack_destroy_chm_decompressor(chmd);
214
-  }
215
-  return 0;
216
-}
217 1
deleted file mode 100644
... ...
@@ -1,79 +0,0 @@
1
-/* acts like Microsoft's EXPAND.EXE */
2
-#ifdef HAVE_CONFIG_H
3
-#include <config.h>
4
-#endif
5
-
6
-#include <stdio.h>
7
-#include <stdlib.h>
8
-#include <string.h>
9
-
10
-#include <mspack.h>
11
-#include <error.h>
12
-
13
-int main(int argc, char *argv[]) {
14
-    struct msszdd_decompressor *szddd;
15
-    struct mskwaj_decompressor *kwajd;
16
-    struct msszddd_header *szdd;
17
-    struct mskwajd_header *kwaj;
18
-    int err;
19
-
20
-    if (argc != 3) {
21
-	fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
22
-	return 1;
23
-    }
24
-
25
-    /* if self-test reveals an error */
26
-    MSPACK_SYS_SELFTEST(err);
27
-    if (err) return 1;
28
-
29
-    szddd = mspack_create_szdd_decompressor(NULL);
30
-    kwajd = mspack_create_kwaj_decompressor(NULL);
31
-
32
-    if (!szddd || !kwajd) {
33
-	fprintf(stderr, "can't make either SZDD or KWAJ decompressor\n");
34
-	mspack_destroy_szdd_decompressor(szddd);
35
-	mspack_destroy_kwaj_decompressor(kwajd);
36
-	return 1;
37
-    }
38
-
39
-    /* open then extract; try SZDD */
40
-    if ((szdd = szddd->open(szddd, argv[1]))) {
41
-	if (szddd->extract(szddd, szdd, argv[2]) != MSPACK_ERR_OK) {
42
-	    fprintf(stderr, "%s: SZDD extract error: %s\n", argv[2], ERROR(szddd));
43
-	}
44
-	szddd->close(szddd, szdd);
45
-    }
46
-    else {
47
-	if (szddd->last_error(szddd) == MSPACK_ERR_SIGNATURE) {
48
-	    /* try KWAJ */
49
-	    if ((kwaj = kwajd->open(kwajd, argv[1]))) {
50
-		if (kwajd->extract(kwajd, kwaj, argv[2]) != MSPACK_ERR_OK) {
51
-		    fprintf(stderr, "%s: KWAJ extract error: %s\n", argv[2], ERROR(kwajd));
52
-		}
53
-		kwajd->close(kwajd, kwaj);
54
-	    }
55
-	    else {
56
-		fprintf(stderr, "%s: KWAJ open error: %s\n", argv[1], ERROR(kwajd));
57
-	    }
58
-	}
59
-	else {
60
-	    fprintf(stderr, "%s: SZDD open error: %s\n", argv[1], ERROR(szddd));
61
-	}
62
-    }
63
-
64
-    /* decompress in a single step; try KWAJ */
65
-    if (kwajd->decompress(kwajd, argv[1], argv[2]) != MSPACK_ERR_OK) {
66
-	if (kwajd->last_error(kwajd) == MSPACK_ERR_SIGNATURE) {
67
-	    if (szddd->decompress(szddd, argv[1], argv[2]) != MSPACK_ERR_OK) {
68
-		fprintf(stderr, "%s -> %s: SZDD decompress error: %s\n", argv[1], argv[2], ERROR(szddd));
69
-	    }
70
-	}
71
-	else {
72
-	    fprintf(stderr, "%s -> %s: KWAJ decompress error: %s\n", argv[1], argv[2], ERROR(kwajd));
73
-	}
74
-    }
75
-
76
-    mspack_destroy_szdd_decompressor(szddd);
77
-    mspack_destroy_kwaj_decompressor(kwajd);
78
-    return 0;
79
-}
80 1
new file mode 100644
... ...
@@ -0,0 +1,117 @@
0
+/* KWAJ regression test suite */
1
+
2
+#ifdef HAVE_CONFIG_H
3
+#include <config.h>
4
+#endif
5
+
6
+#include <stdio.h>
7
+#include <stdlib.h>
8
+#include <string.h>
9
+#include <mspack.h>
10
+#include <system.h>
11
+
12
+unsigned int test_count = 0;
13
+#define TEST(x) do {\
14
+    test_count++; \
15
+    if (!(x)) {printf("%s:%d FAILED %s\n",__func__,__LINE__,#x);exit(1);} \
16
+} while (0)
17
+
18
+/* test parsing of KWAJ filename/extension headers */
19
+void kwajd_open_test_01() {
20
+    struct mskwaj_decompressor *kwajd;
21
+    struct mskwajd_header *hdr;
22
+
23
+    kwajd = mspack_create_kwaj_decompressor(NULL);
24
+    TEST(kwajd != NULL);
25
+
26
+    hdr = kwajd->open(kwajd, "test_files/kwajd/f00.kwj");
27
+    TEST(hdr != NULL);
28
+    TEST(hdr->filename == NULL);
29
+    kwajd->close(kwajd, hdr);
30
+
31
+#define TEST_FNAME(testfile, fname)      \
32
+    hdr = kwajd->open(kwajd, testfile);  \
33
+    TEST(hdr != NULL);                   \
34
+    TEST(hdr->filename != NULL);         \
35
+    TEST(!strcmp(fname, hdr->filename)); \
36
+    kwajd->close(kwajd, hdr)
37
+#define TEST_FNAME_BAD(testfile)         \
38
+    hdr = kwajd->open(kwajd, testfile);  \
39
+    TEST(hdr == NULL);                   \
40
+    TEST(kwajd->last_error(kwajd) == MSPACK_ERR_DATAFORMAT)
41
+
42
+    TEST_FNAME("test_files/kwajd/f01.kwj", ".1");
43
+    TEST_FNAME("test_files/kwajd/f02.kwj", ".12");
44
+    TEST_FNAME("test_files/kwajd/f03.kwj", ".123");
45
+
46
+    TEST_FNAME("test_files/kwajd/f10.kwj", "1");
47
+    TEST_FNAME("test_files/kwajd/f11.kwj", "1.1");
48
+    TEST_FNAME("test_files/kwajd/f12.kwj", "1.12");
49
+    TEST_FNAME("test_files/kwajd/f13.kwj", "1.123");
50
+
51
+    TEST_FNAME("test_files/kwajd/f20.kwj", "12");
52
+    TEST_FNAME("test_files/kwajd/f21.kwj", "12.1");
53
+    TEST_FNAME("test_files/kwajd/f22.kwj", "12.12");
54
+    TEST_FNAME("test_files/kwajd/f23.kwj", "12.123");
55
+
56
+    TEST_FNAME("test_files/kwajd/f30.kwj", "123");
57
+    TEST_FNAME("test_files/kwajd/f31.kwj", "123.1");
58
+    TEST_FNAME("test_files/kwajd/f32.kwj", "123.12");
59
+    TEST_FNAME("test_files/kwajd/f33.kwj", "123.123");
60
+
61
+    TEST_FNAME("test_files/kwajd/f40.kwj", "1234");
62
+    TEST_FNAME("test_files/kwajd/f41.kwj", "1234.1");
63
+    TEST_FNAME("test_files/kwajd/f42.kwj", "1234.12");
64
+    TEST_FNAME("test_files/kwajd/f43.kwj", "1234.123");
65
+
66
+    TEST_FNAME("test_files/kwajd/f50.kwj", "12345");
67
+    TEST_FNAME("test_files/kwajd/f51.kwj", "12345.1");
68
+    TEST_FNAME("test_files/kwajd/f52.kwj", "12345.12");
69
+    TEST_FNAME("test_files/kwajd/f53.kwj", "12345.123");
70
+
71
+    TEST_FNAME("test_files/kwajd/f60.kwj", "123456");
72
+    TEST_FNAME("test_files/kwajd/f61.kwj", "123456.1");
73
+    TEST_FNAME("test_files/kwajd/f62.kwj", "123456.12");
74
+    TEST_FNAME("test_files/kwajd/f63.kwj", "123456.123");
75
+
76
+    TEST_FNAME("test_files/kwajd/f70.kwj", "1234567");
77
+    TEST_FNAME("test_files/kwajd/f71.kwj", "1234567.1");
78
+    TEST_FNAME("test_files/kwajd/f72.kwj", "1234567.12");
79
+    TEST_FNAME("test_files/kwajd/f73.kwj", "1234567.123");
80
+
81
+    TEST_FNAME("test_files/kwajd/f80.kwj", "12345678");
82
+    TEST_FNAME("test_files/kwajd/f81.kwj", "12345678.1");
83
+    TEST_FNAME("test_files/kwajd/f82.kwj", "12345678.12");
84
+    TEST_FNAME("test_files/kwajd/f83.kwj", "12345678.123");
85
+
86
+    TEST_FNAME_BAD("test_files/kwajd/f04.kwj");
87
+    TEST_FNAME_BAD("test_files/kwajd/f14.kwj");
88
+    TEST_FNAME_BAD("test_files/kwajd/f24.kwj");
89
+    TEST_FNAME_BAD("test_files/kwajd/f34.kwj");
90
+    TEST_FNAME_BAD("test_files/kwajd/f44.kwj");
91
+    TEST_FNAME_BAD("test_files/kwajd/f54.kwj");
92
+    TEST_FNAME_BAD("test_files/kwajd/f64.kwj");
93
+    TEST_FNAME_BAD("test_files/kwajd/f74.kwj");
94
+    TEST_FNAME_BAD("test_files/kwajd/f84.kwj");
95
+
96
+    TEST_FNAME_BAD("test_files/kwajd/f90.kwj");
97
+    TEST_FNAME_BAD("test_files/kwajd/f91.kwj");
98
+    TEST_FNAME_BAD("test_files/kwajd/f92.kwj");
99
+    TEST_FNAME_BAD("test_files/kwajd/f93.kwj");
100
+    TEST_FNAME_BAD("test_files/kwajd/f94.kwj");
101
+
102
+
103
+    mspack_destroy_kwaj_decompressor(kwajd);
104
+}
105
+
106
+int main() {
107
+  int selftest;
108
+
109
+  MSPACK_SYS_SELFTEST(selftest);
110
+  TEST(selftest == MSPACK_ERR_OK);
111
+
112
+  kwajd_open_test_01();
113
+
114
+  printf("ALL %d TESTS PASSED.\n", test_count);
115
+  return 0;
116
+}
0 117
deleted file mode 100644
... ...
@@ -1,435 +0,0 @@
1
-/* An implementation of the mspack_system interface which can access many
2
- * things:
3
- * - regular disk files
4
- * - already opened stdio FILE* file pointers
5
- * - open file descriptors
6
- * - blocks of memory
7
- */
8
-
9
-#ifdef HAVE_CONFIG_H
10
-#include <config.h>
11
-#endif
12
-
13
-#include <stdio.h>
14
-#include <stdlib.h>
15
-#include <stdarg.h>
16
-#include <string.h>
17
-#include <mspack.h>
18
-
19
-/* definitions */
20
-
21
-#define MTYPE_DISKFILE  (0x01)
22
-#define MTYPE_STDIOFH   (0x02)
23
-#define MTYPE_FILEDESC  (0x03)
24
-#define MTYPE_MEMORY    (0x04)
25
-
26
-struct m_filename {
27
-  unsigned char type;   /* one of MTYPE_DISKFILE, STDIOFH, FILEDESC or MEMORY */
28
-  const char *filename; /* the user-friendly printable filename (may be NULL) */
29
-  union {
30
-    const char *diskfile; /* char *filename      for MTYPE_DISKFILE */
31
-    FILE *stdiofh;        /* FILE *existing_fh   for MTYPE_STDIOFH */
32
-    int filedesc;         /* int file_descriptor for MTYPE_FILEDESC */
33
-    struct {
34
-      unsigned char *data;
35
-      size_t length;
36
-    } memory;
37
-  } x;
38
-};
39
-
40
-struct m_file {
41
-  struct m_filename *file; /* pointer back to the m_filename data */
42
-  union {
43
-    FILE *fh;        /* only used in DISKFILE, STDIOFH and FILEDESC types */
44
-    size_t position; /* only used in MEMORY types */
45
-  } x;
46
-};
47
-
48
-/* ------------------------------------------------------------------------ */
49
-/* mspack_system implementation */
50
-
51
-static void *m_alloc(struct mspack_system *self, size_t bytes) {
52
-  return malloc(bytes);
53
-}
54
-
55
-static void m_free(void *buffer) {
56
-  free(buffer);
57
-}
58
-
59
-static void m_copy(void *src, void *dest, size_t bytes) {
60
-  memcpy(dest, src, bytes);
61
-}
62
-
63
-/* A message printer that prints to stderr */
64
-static void m_msg(struct m_file *file, const char *format, ...) {
65
-  va_list ap;
66
-  if (file && file->file && file->file->filename) {
67
-    fprintf(stderr, "%s: ", file->file->filename);
68
-  }
69
-  va_start(ap, format);
70
-  vfprintf(stderr, format, ap);
71
-  va_end(ap);
72
-  fputc((int) '\n', stderr);
73
-  fflush(stderr);
74
-}
75
-
76
-
77
-static struct m_file *m_open_mem(struct mspack_system *self,
78
-				 struct m_filename *fn, int mode)
79
-{
80
-  struct m_file *fh;
81
-
82
-  /* validate arguments of the filename */
83
-  if (!fn->x.memory.data)   return NULL;
84
-  if (!fn->x.memory.length) return NULL;
85
-
86
-  if ((fh = (struct m_file *) m_alloc(self, sizeof(struct m_file)))) {
87
-    fh->x.position = (mode == MSPACK_SYS_OPEN_APPEND) ?
88
-      fn->x.memory.length : 0;
89
-    fh->file = fn;
90
-  }
91
-  return fh;
92
-}
93
-
94
-static struct m_file *m_open_file(struct mspack_system *self,
95
-				  struct m_filename *fn, int mode)
96
-{
97
-  struct m_file *fh;
98
-  const char *fmode;
99
-  int fd;
100
-
101
-  switch (mode) {
102
-  case MSPACK_SYS_OPEN_READ:   fmode = "rb";  break;
103
-  case MSPACK_SYS_OPEN_WRITE:  fmode = "wb";  break;
104
-  case MSPACK_SYS_OPEN_UPDATE: fmode = "r+b"; break;
105
-  case MSPACK_SYS_OPEN_APPEND: fmode = "ab";  break;
106
-  default: return NULL;
107
-  }
108
-
109
-  /* validate the arguments in the provided filename */
110
-  switch (fn->type) {
111
-  case MTYPE_DISKFILE: if (!fn->x.diskfile)    return NULL; break;
112
-  case MTYPE_STDIOFH:  if (!fn->x.stdiofh)     return NULL; break;
113
-  case MTYPE_FILEDESC: if (fn->x.filedesc < 0) return NULL; break;
114
-  }
115
-
116
-  /* allocate memory for the file handle */
117
-  if (!(fh = (struct m_file *) m_alloc(self, sizeof(struct m_file)))) return NULL;
118
-
119
-  /* open or duplicate the filehandle */
120
-  switch (fn->type) {
121
-  case MTYPE_DISKFILE:
122
-    fh->x.fh = fopen(fn->x.diskfile, fmode);
123
-    break;
124
-
125
-  case MTYPE_STDIOFH:
126
-    fd = fileno(fn->x.stdiofh);
127
-    fh->x.fh = (fd >= 0) ? fdopen(fd, fmode) : NULL;
128
-    break;
129
-
130
-  case MTYPE_FILEDESC:
131
-    fh->x.fh = fdopen(fn->x.filedesc, fmode);
132
-    break;
133
-  }
134
-
135
-  /* validate the new stdio filehandle */
136
-  if (fh->x.fh) {
137
-    fh->file = fn;
138
-  }
139
-  else {
140
-    free(fh);
141
-    fh = NULL;
142
-  }
143
-
144
-  return fh;
145
-}
146
-
147
-static struct m_file *m_open(struct mspack_system *self,
148
-			     struct m_filename *fn, int mode)
149
-{
150
-  if (!self || !fn) return NULL;
151
-
152
-  switch (fn->type) {
153
-  case MTYPE_DISKFILE:
154
-  case MTYPE_STDIOFH:
155
-  case MTYPE_FILEDESC:
156
-    return m_open_file(self, fn, mode);
157
-
158
-  case MTYPE_MEMORY:
159
-    return m_open_mem(self, fn, mode);
160
-  }
161
-  return NULL;
162
-}
163
-
164
-static void m_close(struct m_file *fh) {
165
-  if (!fh || !fh->file) return;
166
-  if (fh->file->type != MTYPE_MEMORY) fclose(fh->x.fh);
167
-  m_free(fh);
168
-}
169
-
170
-
171
-static int m_read(struct m_file *fh, void *buffer, int bytes) {
172
-  if (!fh || !fh->file || !buffer || bytes < 0) return -1;
173
-
174
-  if (fh->file->type == MTYPE_MEMORY) {
175
-    int count = fh->file->x.memory.length - fh->x.position;
176
-    if (count > bytes) count = bytes;
177
-    if (count > 0) {
178
-      m_copy(&fh->file->x.memory.data[fh->x.position], buffer, (size_t) count);
179
-    }
180
-    fh->x.position += count;
181
-    return count;
182
-  }
183
-  else {
184
-    size_t count = fread(buffer, 1, (size_t) bytes, fh->x.fh);
185
-    if (!ferror(fh->x.fh)) return (int) count;
186
-  }
187
-  return -1;
188
-}
189
-
190
-
191
-static int m_write(struct m_file *fh, void *buffer, int bytes) {
192
-  if (!fh || !fh->file || !buffer || bytes < 0) return -1;
193
-
194
-  if (fh->file->type == MTYPE_MEMORY) {
195
-    int count = fh->file->x.memory.length - fh->x.position;
196
-    if (count > bytes) count = bytes;
197
-    if (count > 0) {
198
-      m_copy(buffer, &fh->file->x.memory.data[fh->x.position], (size_t) count);
199
-    }
200
-    fh->x.position += count;
201
-    return count;
202
-  }
203
-  else {
204
-    size_t count = fwrite(buffer, 1, (size_t) bytes, fh->x.fh);
205
-    if (!ferror(fh->x.fh)) return (int) count;
206
-  }
207
-  return -1;
208
-}
209
-
210
-
211
-static int m_seek(struct m_file *fh, off_t offset, int mode) {
212
-  if (!fh || !fh->file) return 1;
213
-
214
-  if (fh->file->type == MTYPE_MEMORY) {
215
-    switch (mode) {
216
-    case MSPACK_SYS_SEEK_START:
217
-      break;
218
-    case MSPACK_SYS_SEEK_CUR:
219
-      offset += (off_t) fh->x.position;
220
-      break;
221
-    case MSPACK_SYS_SEEK_END:
222
-      offset += (off_t) fh->file->x.memory.length;
223
-      break;
224
-    default:
225
-      return 1;
226
-    }
227
-
228
-    if (offset < 0) return 1;
229
-    if (offset > (off_t) fh->file->x.memory.length) return 1;
230
-    fh->x.position = (size_t) offset;
231
-    return 0;
232
-  }
233
-
234
-  /* file IO based method */
235
-  switch (mode) {
236
-  case MSPACK_SYS_SEEK_START: mode = SEEK_SET; break;
237
-  case MSPACK_SYS_SEEK_CUR:   mode = SEEK_CUR; break;
238
-  case MSPACK_SYS_SEEK_END:   mode = SEEK_END; break;
239
-  default: return 1;
240
-  }
241
-#if HAVE_FSEEKO
242
-  return fseeko(fh->x.fh, offset, mode);
243
-#else
244
-  return fseek(fh->x.fh, offset, mode);
245
-#endif
246
-}
247
-
248
-
249
-static off_t m_tell(struct m_file *fh) {
250
-  if (!fh || !fh->file) return -1;
251
-  if (fh->file->type == MTYPE_MEMORY) {
252
-    return (off_t) fh->x.position;
253
-  }
254
-#if HAVE_FSEEKO
255
-  return (off_t) ftello(fh->x.fh);
256
-#else
257
-  return (off_t) ftell(fh->x.fh);
258
-#endif
259
-}
260
-
261
-
262
-static struct mspack_system multi_system = {
263
-  (struct mspack_file * (*)(struct mspack_system *, const char *, int)) &m_open,
264
-  (void (*)(struct mspack_file *)) &m_close,
265
-  (int (*)(struct mspack_file *, void *, int)) &m_read, 
266
-  (int (*)(struct mspack_file *, void *, int)) &m_write,
267
-  (int (*)(struct mspack_file *, off_t, int)) &m_seek, 
268
-  (off_t (*)(struct mspack_file *)) &m_tell,
269
-  (void (*)(struct mspack_file *, const char *, ...))  &m_msg,
270
-  &m_alloc,
271
-  &m_free,
272
-  &m_copy,
273
-  NULL
274
-};
275
-
276
-/* ------------------------------------------------------------------------ */
277
-/* constructors and destructor */
278
-
279
-const char *create_filename(const char *filename) {
280
-  struct m_filename *fn;
281
-
282
-  if (!filename) return NULL; /* filename must not be null */
283
-
284
-  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
285
-    fn->type = MTYPE_DISKFILE;
286
-    fn->filename = filename; /* pretty-printable filename */
287
-    fn->x.diskfile = filename;
288
-  }
289
-  return (const char *) fn;
290
-}
291
-
292
-const char *create_filename_from_handle(FILE *fh) {
293
-  struct m_filename *fn;
294
-
295
-  if (!fh) return NULL; /* file handle must not be null */
296
-
297
-  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
298
-    fn->type = MTYPE_STDIOFH;
299
-    fn->filename = NULL; /* pretty-printable filename */
300
-    fn->x.stdiofh = fh;
301
-  }
302
-  return (const char *) fn;
303
-}
304
-
305
-const char *create_filename_from_descriptor(int fd) {
306
-  struct m_filename *fn;
307
-
308
-  if (fd < 0) return NULL; /* file descriptor must be valid */
309
-
310
-  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
311
-    fn->type = MTYPE_FILEDESC;
312
-    fn->filename = NULL; /* pretty-printable filename */
313
-    fn->x.filedesc = fd;
314
-  }
315
-  return (const char *) fn;
316
-}
317
-
318
-const char *create_filename_from_memory(void *data, size_t length) {
319
-  struct m_filename *fn;
320
-
321
-  if (!data) return NULL; /* data pointer must not be NULL */
322
-  if (length == 0) return NULL; /* length must not be zero */
323
-
324
-  if ((fn = (struct m_filename *) malloc(sizeof(struct m_filename)))) {
325
-    fn->type = MTYPE_MEMORY;
326
-    fn->filename = NULL; /* pretty-printable filename */
327
-    fn->x.memory.data   = (unsigned char *) data;
328
-    fn->x.memory.length = length;
329
-  }
330
-  return (const char *) fn;
331
-}
332
-
333
-void set_filename_printable_name(const char *filename, const char *name) {
334
-  struct m_filename *fn = (struct m_filename *) filename;
335
-  if (!fn) return;
336
-  /* very basic validation of structure */
337
-  if ((fn->type < MTYPE_DISKFILE) || (fn->type > MTYPE_MEMORY)) return;
338
-  fn->filename = name;
339
-}
340
-
341
-void free_filename(const char *filename) {
342
-  free((void *) filename);
343
-}
344
-
345
-/* ------------------------------------------------------------------------ */
346
-/* example of usage with mscab_decompressor */
347
-
348
-/* a simple cabinet */
349
-static unsigned char memory_cab[] = {
350
-  0x4D,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0xFD,0x00,0x00,0x00,0x00,0x00,0x00,
351
-  0x00,0x2C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x02,0x00,
352
-  0x00,0x00,0x22,0x06,0x00,0x00,0x5E,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x4D,
353
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x22,0xBA,0x59,0x20,0x00,
354
-  0x68,0x65,0x6C,0x6C,0x6F,0x2E,0x63,0x00,0x4A,0x00,0x00,0x00,0x4D,0x00,0x00,
355
-  0x00,0x00,0x00,0x6C,0x22,0xE7,0x59,0x20,0x00,0x77,0x65,0x6C,0x63,0x6F,0x6D,
356
-  0x65,0x2E,0x63,0x00,0xBD,0x5A,0xA6,0x30,0x97,0x00,0x97,0x00,0x23,0x69,0x6E,
357
-  0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,0x68,0x3E,
358
-  0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,0x28,0x76,
359
-  0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,0x70,0x72,
360
-  0x69,0x6E,0x74,0x66,0x28,0x22,0x48,0x65,0x6C,0x6C,0x6F,0x2C,0x20,0x77,0x6F,
361
-  0x72,0x6C,0x64,0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x23,
362
-  0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x20,0x3C,0x73,0x74,0x64,0x69,0x6F,0x2E,
363
-  0x68,0x3E,0x0D,0x0A,0x0D,0x0A,0x76,0x6F,0x69,0x64,0x20,0x6D,0x61,0x69,0x6E,
364
-  0x28,0x76,0x6F,0x69,0x64,0x29,0x0D,0x0A,0x7B,0x0D,0x0A,0x20,0x20,0x20,0x20,
365
-  0x70,0x72,0x69,0x6E,0x74,0x66,0x28,0x22,0x57,0x65,0x6C,0x63,0x6F,0x6D,0x65,
366
-  0x21,0x5C,0x6E,0x22,0x29,0x3B,0x0D,0x0A,0x7D,0x0D,0x0A,0x0D,0x0A
367
-};
368
-
369
-int main() {
370
-  const char *mem_cab, *std_out, *std_err, *example;
371
-  struct mscab_decompressor *cabd;
372
-  struct mscabd_cabinet *cab;
373
-  struct mscabd_file *file;
374
-  int err;
375
-
376
-  mem_cab = create_filename_from_memory(&memory_cab[0], sizeof(memory_cab));
377
-  if (!mem_cab) exit(1);
378
-
379
-  std_out = create_filename_from_descriptor(1);
380
-  if (!std_out) exit(1);
381
-
382
-  std_err = create_filename_from_handle(stderr);
383
-  if (!std_err) exit(1);
384
-
385
-  example = create_filename("example.txt");
386
-  if (!example) exit(1);
387
-
388
-  set_filename_printable_name(mem_cab, "internal");
389
-  set_filename_printable_name(std_out, "stdout");
390
-  set_filename_printable_name(std_err, "stderr");
391
-
392
-  /* if self-test reveals an error */
393
-  MSPACK_SYS_SELFTEST(err);
394
-  if (err) exit(1);
395
-
396
-  /* create a cab decompressor using our custom mspack_system interface */
397
-  if ((cabd = mspack_create_cab_decompressor(&multi_system))) {
398
-
399
-    /* open a cab file direct from memory */
400
-    if ((cab = cabd->open(cabd, mem_cab))) {
401
-
402
-      /* first file in the cabinet: print it to stdout */
403
-      file = cab->files;
404
-      if (cabd->extract(cabd, file, std_out)) {
405
-	exit(1);
406
-      }
407
-
408
-      /* second file in the cabinet: print it to stderr */
409
-      file = file->next;
410
-      if (cabd->extract(cabd, file, std_err)) {
411
-	exit(1);
412
-      }
413
-      /* also write it to "example.txt" */
414
-      if (cabd->extract(cabd, file, example)) {
415
-	exit(1);
416
-      }
417
-      cabd->close(cabd, cab);
418
-    }
419
-    else {
420
-      fprintf(stderr, "can't open cabinet (%d)\n", cabd->last_error(cabd));
421
-    }
422
-    mspack_destroy_cab_decompressor(cabd);
423
-  }
424
-  else {
425
-    fprintf(stderr, "can't make decompressor\n");
426
-  }
427
-
428
-  free_filename(example);
429
-  free_filename(std_err);
430
-  free_filename(std_out);
431
-  free_filename(mem_cab);
432
-
433
-  return 0;
434
-
435
-}
436 1
deleted file mode 100644
... ...
@@ -1,41 +0,0 @@
1
-#ifdef HAVE_CONFIG_H
2
-#include <config.h>
3
-#endif
4
-
5
-#include <stdio.h>
6
-#include <stdlib.h>
7
-#include <string.h>
8
-#include <mspack.h>
9
-
10
-#include <error.h>
11
-
12
-int main(int argc, char *argv[]) {
13
-    struct msoab_decompressor *oabd;
14
-    int err;
15
-
16
-    setbuf(stdout, NULL);
17
-    setbuf(stderr, NULL);
18
-
19
-    MSPACK_SYS_SELFTEST(err);
20
-    if (err) return 0;
21
-
22
-    if ((oabd = mspack_create_oab_decompressor(NULL))) {
23
-        if (argc == 3) {
24
-            err = oabd->decompress(oabd, argv[1], argv[2]);
25
-            if (err) fprintf(stderr, "%s -> %s: %s\n", argv[1], argv[2], error_msg(err));
26
-        }
27
-        else if (argc == 4) {
28
-            err = oabd->decompress_incremental(oabd, argv[2], argv[1], argv[3]);
29
-            if (err) fprintf(stderr, "%s + %s -> %s: %s\n", argv[1], argv[2], argv[3], error_msg(err));
30
-        }
31
-        else {
32
-            fprintf(stderr, "Usage: %s <input> <output>\n", *argv);
33
-            fprintf(stderr, "   or  %s <base> <patch> <output>\n", *argv);
34
-        }
35
-        mspack_destroy_oab_decompressor(oabd);
36
-    }
37
-    else {
38
-        fprintf(stderr, "%s: can't make OAB decompressor\n", *argv);
39
-    }
40
-    return 0;
41
-}
42 1
new file mode 100644
... ...
@@ -0,0 +1,84 @@
0
+#!perl -w
1
+use strict;
2
+
3
+sub  byte($)  {pack 'c',$_[0]};
4
+sub ubyte($)  {pack 'C',$_[0]};
5
+sub uword($)  {pack 'v',$_[0]};
6
+sub ulong($)  {pack 'V',$_[0]};
7
+
8
+my $RESV_HEADER = 'reserved header test 12345';
9
+#my $RESV_HEADER = '';
10
+#my $RESV_FOLDER = 'reserved folder test 12345';
11
+my $RESV_FOLDER = '';
12
+my $RESV_DATA   = 'reserved data test 12345';
13
+#my $RESV_DATA   = '';
14
+
15
+my $header
16
+  = 'MSCF'     # 00 SIGNATURE
17
+  . ulong(0)   # 04
18
+  . ulong(0)   # 08 CABINET SIZE
19
+  . ulong(0)   # 0C
20
+  . ulong(0)   # 10 FILES OFFSET
21
+  . ulong(0)   # 14
22
+  . ubyte(3)   # 18 MINOR VERSION
23
+  . ubyte(1)   # 19 MAJOR VERSION
24
+  . uword(1)   # 1A number of folders
25
+  . uword(2)   # 1C number of files
26
+  . uword(4)   # 1E flags
27
+  . uword(1)   # 20 set id
28
+  . uword(0)   # 22 cab index
29
+
30
+  . uword(length($RESV_HEADER))   # 00 header reserved
31
+  . ubyte(length($RESV_FOLDER))   # 02 folder resv
32
+  . ubyte(length($RESV_DATA))     # 03 data resv
33
+  . $RESV_HEADER
34
+;
35
+
36
+my $folder
37
+  = ulong(0)  # data offset
38
+  . uword(2)  # number of blocks
39
+  . uword(0)  # compression method
40
+  . $RESV_FOLDER
41
+;
42
+
43
+my $files
44
+  = ulong(5) # uncompressed size
45
+  . ulong(0) # folder offset
46
+  . uword(0) # folder index
47
+  . uword(0x226C) # time
48
+  . uword(0x59BA) # date
49
+  . uword(0x20)   # attribs
50
+  . "test1.txt\0"
51
+
52
+  . ulong(5) # uncompressed size
53
+  . ulong(5) # folder offset
54
+  . uword(0) # folder index
55
+  . uword(0x226C) # time
56
+  . uword(0x59BA) # date
57
+  . uword(0x20)   # attribs
58
+  . "test2.txt\0"
59
+;
60
+
61
+my $datablocks
62
+  = ulong(0) # checksum
63
+  . uword(5) # compressed size
64
+  . uword(5) # uncompressed size
65
+  . $RESV_DATA
66
+  . "TEST\n" # actual data
67
+
68
+  . ulong(0) # checksum
69
+  . uword(5) # compressed size
70
+  . uword(5) # uncompressed size
71
+  . $RESV_DATA
72
+  . "test\n" # actual data
73
+;
74
+
75
+my $pre_files = $header . $folder;
76
+my $pre_data  = $pre_files . $files;
77
+my $cab       = $pre_data . $datablocks;
78
+
79
+substr($header, 0x08, 4, ulong(length($cab)));
80
+substr($header, 0x10, 4, ulong(length($pre_files)));
81
+substr($folder, 0x00, 4, ulong(length($pre_data)));
82
+
83
+print $header . $folder . $files . $datablocks;
0 84
new file mode 100644
... ...
@@ -0,0 +1,75 @@
0
+#!perl -w
1
+use strict;
2
+
3
+sub  byte($)  {pack 'c',$_[0]};
4
+sub ubyte($)  {pack 'C',$_[0]};
5
+sub uword($)  {pack 'v',$_[0]};
6
+sub ulong($)  {pack 'V',$_[0]};
7
+
8
+my $header
9
+  = 'MSCF'     # 00 SIGNATURE
10
+  . ulong(0)   # 04
11
+  . ulong(0)   # 08 CABINET SIZE
12
+  . ulong(0)   # 0C
13
+  . ulong(0)   # 10 FILES OFFSET
14
+  . ulong(0)   # 14
15
+  . ubyte(3)   # 18 MINOR VERSION
16
+  . ubyte(1)   # 19 MAJOR VERSION
17
+  . uword(1)   # 1A number of folders
18
+  . uword(3)   # 1C number of files
19
+  . uword(1)   # 1E flags
20
+  . uword(12345) # 20 set id
21
+  . uword(4)   # 22 cab index
22
+  . "cabd_multi_basic_pt4.cab\0"
23
+  . "basic multipart test part 4\0"
24
+
25
+;
26
+
27
+my $folder
28
+  = ulong(0)  # data offset
29
+  . uword(1)  # number of blocks
30
+  . uword(0)  # compression method
31
+;
32
+
33
+my $files
34
+  = ulong(76) # uncompressed size
35
+  . ulong(0) # folder offset
36
+  . uword(0xFFFD) # folder index
37
+  . uword(0x226C) # time
38
+  . uword(0x59BA) # date
39
+  . uword(0x20)   # attribs
40
+  . "test1.txt\0"
41
+
42
+  . ulong(38) # uncompressed size
43
+  . ulong(76) # folder offset
44
+  . uword(0xFFFD) # folder index
45
+  . uword(0x226C) # time
46
+  . uword(0x59BA) # date
47
+  . uword(0x20)   # attribs
48
+  . "test2.txt\0"
49
+
50
+  . ulong(76) # uncompressed size
51
+  . ulong(76+38) # folder offset
52
+  . uword(0xFFFD) # folder index
53
+  . uword(0x226C) # time
54
+  . uword(0x59BA) # date
55
+  . uword(0x20)   # attribs
56
+  . "test3.txt\0"
57
+;
58
+
59
+my $datablocks
60
+  = ulong(0) # checksum
61
+  . uword(38) # compressed size
62
+  . uword(190) # uncompressed size
63
+  . "This is the data from cabinet part 5.\n" # actual data
64
+;
65
+
66
+my $pre_files = $header . $folder;
67
+my $pre_data  = $pre_files . $files;
68
+my $cab       = $pre_data . $datablocks;
69
+
70
+substr($header, 0x08, 4, ulong(length($cab)));
71
+substr($header, 0x10, 4, ulong(length($pre_files)));
72
+substr($folder, 0x00, 4, ulong(length($pre_data)));
73
+
74
+print $header . $folder . $files . $datablocks;
0 75
new file mode 100644
1 76
Binary files /dev/null and b/libclammspack/test/test_files/cabd/bad_folderindex.cab differ
2 77
new file mode 100644
3 78
Binary files /dev/null and b/libclammspack/test/test_files/cabd/bad_nofiles.cab differ
4 79
new file mode 100644
5 80
Binary files /dev/null and b/libclammspack/test/test_files/cabd/bad_nofolders.cab differ
6 81
new file mode 100644
7 82
Binary files /dev/null and b/libclammspack/test/test_files/cabd/bad_signature.cab differ
8 83
new file mode 100644
9 84
Binary files /dev/null and b/libclammspack/test/test_files/cabd/cve-2010-2800-mszip-infinite-loop.cab differ
10 85
new file mode 100644
11 86
Binary files /dev/null and b/libclammspack/test/test_files/cabd/cve-2014-9556-qtm-infinite-loop.cab differ
12 87
new file mode 100644
13 88
Binary files /dev/null and b/libclammspack/test/test_files/cabd/cve-2014-9732-folders-segfault.cab differ
14 89
new file mode 100644
15 90
Binary files /dev/null and b/libclammspack/test/test_files/cabd/cve-2015-4470-mszip-over-read.cab differ
16 91
new file mode 100644
17 92
Binary files /dev/null and b/libclammspack/test/test_files/cabd/cve-2015-4471-lzx-under-read.cab differ
18 93
new file mode 100644
19 94
Binary files /dev/null and b/libclammspack/test/test_files/cabd/filename-read-violation-1.cab differ
20 95
new file mode 100644
21 96
Binary files /dev/null and b/libclammspack/test/test_files/cabd/filename-read-violation-2.cab differ
22 97
new file mode 100644
23 98
Binary files /dev/null and b/libclammspack/test/test_files/cabd/filename-read-violation-3.cab differ
24 99
new file mode 100644
25 100
Binary files /dev/null and b/libclammspack/test/test_files/cabd/filename-read-violation-4.cab differ
26 101
new file mode 100644
27 102
Binary files /dev/null and b/libclammspack/test/test_files/cabd/lzx-main-tree-no-lengths.cab differ
28 103
new file mode 100644
29 104
Binary files /dev/null and b/libclammspack/test/test_files/cabd/lzx-premature-matches.cab differ
30 105
new file mode 100644
31 106
Binary files /dev/null and b/libclammspack/test/test_files/cabd/multi_basic_pt1.cab differ
32 107
new file mode 100644
33 108
Binary files /dev/null and b/libclammspack/test/test_files/cabd/multi_basic_pt2.cab differ
34 109
new file mode 100644
35 110
Binary files /dev/null and b/libclammspack/test/test_files/cabd/multi_basic_pt3.cab differ
36 111
new file mode 100644
37 112
Binary files /dev/null and b/libclammspack/test/test_files/cabd/multi_basic_pt4.cab differ
38 113
new file mode 100644
39 114
Binary files /dev/null and b/libclammspack/test/test_files/cabd/multi_basic_pt5.cab differ
40 115
new file mode 100644
41 116
Binary files /dev/null and b/libclammspack/test/test_files/cabd/normal_255c_filename.cab differ
42 117
new file mode 100644
43 118
Binary files /dev/null and b/libclammspack/test/test_files/cabd/normal_2files_1folder.cab differ
44 119
new file mode 100644
45 120
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_nodata.cab differ
46 121
new file mode 100644
47 122
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_nofiles.cab differ
48 123
new file mode 100644
49 124
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_nofolder.cab differ
50 125
new file mode 100644
51 126
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_shortextheader.cab differ
52 127
new file mode 100644
53 128
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_shortfile1.cab differ
54 129
new file mode 100644
55 130
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_shortfile2.cab differ
56 131
new file mode 100644
57 132
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_shortfolder.cab differ
58 133
new file mode 100644
59 134
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_shortheader.cab differ
60 135
new file mode 100644
61 136
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_nofname.cab differ
62 137
new file mode 100644
63 138
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_noninfo.cab differ
64 139
new file mode 100644
65 140
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_nonname.cab differ
66 141
new file mode 100644
67 142
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_nopinfo.cab differ
68 143
new file mode 100644
69 144
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_nopname.cab differ
70 145
new file mode 100644
71 146
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_shortfname.cab differ
72 147
new file mode 100644
73 148
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_shortninfo.cab differ
74 149
new file mode 100644
75 150
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_shortnname.cab differ
76 151
new file mode 100644
77 152
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_shortpinfo.cab differ
78 153
new file mode 100644
79 154
Binary files /dev/null and b/libclammspack/test/test_files/cabd/partial_str_shortpname.cab differ
80 155
new file mode 100644
81 156
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_---.cab differ
82 157
new file mode 100644
83 158
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_--D.cab differ
84 159
new file mode 100644
85 160
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_-F-.cab differ
86 161
new file mode 100644
87 162
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_-FD.cab differ
88 163
new file mode 100644
89 164
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_H--.cab differ
90 165
new file mode 100644
91 166
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_H-D.cab differ
92 167
new file mode 100644
93 168
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_HF-.cab differ
94 169
new file mode 100644
95 170
Binary files /dev/null and b/libclammspack/test/test_files/cabd/reserve_HFD.cab differ
96 171
new file mode 100644
97 172
Binary files /dev/null and b/libclammspack/test/test_files/cabd/search_basic.cab differ
98 173
new file mode 100644
99 174
Binary files /dev/null and b/libclammspack/test/test_files/cabd/search_tricky1.cab differ
100 175
new file mode 100644
101 176
Binary files /dev/null and b/libclammspack/test/test_files/chmd/cve-2015-4467-reset-interval-zero.chm.LZXC-is-lzxc differ
102 177
new file mode 100644
103 178
Binary files /dev/null and b/libclammspack/test/test_files/chmd/cve-2015-4468-namelen-bounds.chm differ
104 179
new file mode 100644
105 180
Binary files /dev/null and b/libclammspack/test/test_files/chmd/cve-2015-4469-namelen-bounds.chm differ
106 181
new file mode 100644
107 182
Binary files /dev/null and b/libclammspack/test/test_files/chmd/cve-2015-4472-namelen-bounds.chm differ
108 183
new file mode 100644
109 184
Binary files /dev/null and b/libclammspack/test/test_files/chmd/cve-2017-6419-lzx-negative-spaninfo.chm differ
110 185
new file mode 100644
111 186
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f00.kwj differ
112 187
new file mode 100644
113 188
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f01.kwj differ
114 189
new file mode 100644
115 190
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f02.kwj differ
116 191
new file mode 100644
117 192
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f03.kwj differ
118 193
new file mode 100644
119 194
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f04.kwj differ
120 195
new file mode 100644
121 196
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f10.kwj differ
122 197
new file mode 100644
123 198
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f11.kwj differ
124 199
new file mode 100644
125 200
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f12.kwj differ
126 201
new file mode 100644
127 202
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f13.kwj differ
128 203
new file mode 100644
129 204
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f14.kwj differ
130 205
new file mode 100644
131 206
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f20.kwj differ
132 207
new file mode 100644
133 208
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f21.kwj differ
134 209
new file mode 100644
135 210
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f22.kwj differ
136 211
new file mode 100644
137 212
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f23.kwj differ
138 213
new file mode 100644
139 214
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f24.kwj differ
140 215
new file mode 100644
141 216
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f30.kwj differ
142 217
new file mode 100644
143 218
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f31.kwj differ
144 219
new file mode 100644
145 220
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f32.kwj differ
146 221
new file mode 100644
147 222
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f33.kwj differ
148 223
new file mode 100644
149 224
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f34.kwj differ
150 225
new file mode 100644
151 226
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f40.kwj differ
152 227
new file mode 100644
153 228
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f41.kwj differ
154 229
new file mode 100644
155 230
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f42.kwj differ
156 231
new file mode 100644
157 232
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f43.kwj differ
158 233
new file mode 100644
159 234
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f44.kwj differ
160 235
new file mode 100644
161 236
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f50.kwj differ
162 237
new file mode 100644
163 238
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f51.kwj differ
164 239
new file mode 100644
165 240
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f52.kwj differ
166 241
new file mode 100644
167 242
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f53.kwj differ
168 243
new file mode 100644
169 244
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f54.kwj differ
170 245
new file mode 100644
171 246
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f60.kwj differ
172 247
new file mode 100644
173 248
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f61.kwj differ
174 249
new file mode 100644
175 250
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f62.kwj differ
176 251
new file mode 100644
177 252
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f63.kwj differ
178 253
new file mode 100644
179 254
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f64.kwj differ
180 255
new file mode 100644
181 256
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f70.kwj differ
182 257
new file mode 100644
183 258
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f71.kwj differ
184 259
new file mode 100644
185 260
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f72.kwj differ
186 261
new file mode 100644
187 262
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f73.kwj differ
188 263
new file mode 100644
189 264
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f74.kwj differ
190 265
new file mode 100644
191 266
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f80.kwj differ
192 267
new file mode 100644
193 268
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f81.kwj differ
194 269
new file mode 100644
195 270
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f82.kwj differ
196 271
new file mode 100644
197 272
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f83.kwj differ
198 273
new file mode 100644
199 274
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f84.kwj differ
200 275
new file mode 100644
201 276
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f90.kwj differ
202 277
new file mode 100644
203 278
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f91.kwj differ
204 279
new file mode 100644
205 280
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f92.kwj differ
206 281
new file mode 100644
207 282
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f93.kwj differ
208 283
new file mode 100644
209 284
Binary files /dev/null and b/libclammspack/test/test_files/kwajd/f94.kwj differ
210 285
new file mode 100755
... ...
@@ -0,0 +1,17 @@
0
+#!/usr/bin/perl -w
1
+use strict;
2
+my $name = '123456789';
3
+for my $file (0 .. 9) {
4
+    for my $ext (0 .. 4) {
5
+	open my $fh, '>', "f$file$ext.kwj";
6
+        my $offset = 14  + $file + $ext;
7
+	my $flags  = ($file > 0 ? 8 : 0) | ($ext > 0 ? 16 : 0);
8
+	print $fh pack 'A4Vvvv', 'KWAJ', 0xD127F088, 0, $offset, $flags;
9
+	print $fh substr $name, 0, $file if $file > 0;
10
+	print $fh "\0" if $file > 0 && $file < 9;
11
+	print $fh substr $name, 0, $ext if $ext > 0;
12
+	print $fh "\0" if $ext > 0 && $ext < 4;
13
+        print $fh "\xFF";
14
+	close $fh;
15
+    }
16
+}