Update upstream source from tag 'upstream/1.8'
Update to upstream version '1.8'
with Debian dir 31bb77cf26fe63782f42e9e6f4a02fc230fe9a23
Florian Schlichting
1 year, 3 months ago
0 | 0 | This interface is distributed under the same license as perl itself, i.e. |
1 | 1 | either the Artistic License (COPYING.Artistic) or the GPL (COPYING.GNU). |
2 | 2 | |
3 | However, the uulib library itself (see the subdirectory uulib) is ONLY | |
4 | distributed under the GENERAL PUBLIC LICENSE (COPYING.GNU). Depending on | |
5 | how you use and distribute it, this makes the whole package fall under the | |
6 | GPL. | |
3 | The uulib library itself (see the subdirectory uulib) is distributed under | |
4 | the GENERAL PUBLIC LICENSE (COPYING.GNU). Depending on how you use and | |
5 | distribute it, this makes the whole package fall under the GPL. | |
6 | ||
7 | At least some parts of the uulib library are licensed differently: | |
8 | ||
9 | uulib/ecb.h distributed unter GPL, to be in line with uulib. | |
10 | uulib/crc32.c 3-clause BSD, adapted from cyrus, see the file for details | |
7 | 11 | |
8 | 12 | If you make modifications, please consider sending them to me, |
9 | 13 | Marc Lehmann <schmorp@schmorp.de> |
0 | 0 | Revision history for Perl extension Convert::UUlib. |
1 | ||
2 | TODO: biggest timesinks: FP_fgets/getc_unlocked overall, UUInsertPartToList dominates large loads due to O(n**2) search | |
3 | ||
4 | 1.8 Thu Dec 17 02:23:53 CET 2020 | |
5 | - no bugfixes in this release due to lack of known bugs, but the major changes | |
6 | in this release might have introduced new bugs, so watch out. | |
7 | - update large decoder example to disable OPT_AUTOCHK and use Smerge -1. | |
8 | - some micro-optimisations. | |
9 | - avoid costly string comparisons by comparing hashes when isnerting items, | |
10 | which speeds up insertion by a constant factor. | |
11 | - improve uulist (and other) structure layout and size. | |
12 | - reverse the order of file list items, which heuristically improves | |
13 | match speed with large usenet file lists. | |
14 | - use getc instead of fgetc, which makes no difference on gnu/linux. | |
15 | - clean up _FP symbol names toi not start with an underscore. | |
16 | - use feof_unlocked and ferror_unlocked. | |
17 | - implement a faster ascii-only strnicmp. | |
18 | - misc very minor code improvements. | |
19 | - remove quite a bit of pre-posix/dos/etc. cruft. | |
20 | - use flockfile, if available, for a potential but small | |
21 | speed gain. | |
22 | - speed up inner yenc decoder loop. | |
23 | - kentnl said that this module should no longer claim to be a simple | |
24 | interface to uulib, as the bunndled copy is now better maintained | |
25 | than the original upstream library. | |
26 | ||
27 | 1.71 Tue Mar 17 00:54:06 CET 2020 | |
28 | - backport to c89 (patch by Paul Howarth). | |
29 | ||
30 | 1.7 Sat Feb 29 22:07:54 CET 2020 | |
31 | - new function: GetFileList. | |
32 | - experimental perlmulticore support (see manpage). | |
33 | - Initialize is now a NOP and CleanUp automatically initializes again. | |
34 | - updated example decoder and documentation a bit. | |
35 | - include ecb.h to deal with compiler builtins and endianness. | |
36 | - some further µ-optimisations in hot code, especially for yEnc. | |
37 | - replace crc32 function by slice-by-16 version by Stephan Brumme, | |
38 | which should speed up yEnc en-/decoding. | |
39 | - yEnc: do not calculate two crcs per part, instead, combine | |
40 | the part crcs together to form the file crc. | |
41 | - yEnc: allow pcrc= in addition to pcrc32= for yenc trailers, as | |
42 | some draft mentions both and it is actually in active use. | |
43 | - yEnc: ignore crc32= on multiparts, except on the last part, | |
44 | which avoids spurious corruption warnings. | |
45 | - be more precise in documenting code licenses in COPYING. | |
46 | - convert constant creation to the method I normally use. | |
47 | - use common::sense. | |
48 | ||
49 | 1.62 Mon Feb 17 23:19:42 CET 2020 | |
50 | - major performance improvement by simplifying code in _FP_gets | |
51 | to not use fscanf. This might slow things down on platforms | |
52 | with very slow fgetc. | |
53 | ||
54 | 1.61 Sun Feb 9 18:38:29 CET 2020 | |
55 | - lint uulib: fix some format string type mismatches | |
56 | and some other minor issues. | |
57 | ||
58 | 1.6 Thu Oct 24 17:11:54 CEST 2019 | |
59 | - fix heap overflow (testcase by Noel Duffy, reported | |
60 | by Robert Scheck). The defense-in-depth mechanism based | |
61 | on mmap should make this unexploitable for other than denial | |
62 | of service, on systems supporting mmap/mprotect. | |
1 | 63 | |
2 | 64 | 1.5 Sat Jul 11 03:56:06 CEST 2015 |
3 | 65 | - fix a heap overflow (testcase by Krzysztof Wojtaś). |
11 | 11 | t/cb.t |
12 | 12 | doc/library.pdf |
13 | 13 | doc/HISTORY |
14 | perlmulticore.h | |
15 | uulib/ecb.h | |
14 | 16 | uulib/safealloc.c |
15 | 17 | uulib/Makefile.in |
16 | 18 | uulib/acconfig.h |
3 | 3 | "unknown" |
4 | 4 | ], |
5 | 5 | "dynamic_config" : 1, |
6 | "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001", | |
6 | "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150001", | |
7 | 7 | "license" : [ |
8 | 8 | "unknown" |
9 | 9 | ], |
31 | 31 | } |
32 | 32 | }, |
33 | 33 | "runtime" : { |
34 | "requires" : {} | |
34 | "requires" : { | |
35 | "common::sense" : "3.74" | |
36 | } | |
35 | 37 | } |
36 | 38 | }, |
37 | 39 | "release_status" : "stable", |
38 | "version" : 1.5 | |
40 | "version" : 1.8 | |
39 | 41 | } |
7 | 7 | Canary::Stability: '0' |
8 | 8 | ExtUtils::MakeMaker: '6.52' |
9 | 9 | dynamic_config: 1 |
10 | generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001' | |
10 | generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150001' | |
11 | 11 | license: unknown |
12 | 12 | meta-spec: |
13 | 13 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
17 | 17 | directory: |
18 | 18 | - t |
19 | 19 | - inc |
20 | requires: {} | |
21 | version: 1.5 | |
20 | requires: | |
21 | common::sense: '3.74' | |
22 | version: 1.8 |
34 | 34 | "ExtUtils::MakeMaker" => 6.52, |
35 | 35 | "Canary::Stability" => 0, |
36 | 36 | }, |
37 | PREREQ_PM => { | |
38 | "common::sense" => 3.74, | |
39 | }, | |
37 | 40 | ); |
0 | 0 | NAME |
1 | Convert::UUlib - Perl interface to the uulib library (a.k.a. | |
2 | uudeview/uuenview). | |
1 | Convert::UUlib - decode uu/xx/b64/mime/yenc/etc-encoded data from a | |
2 | massive number of files | |
3 | 3 | |
4 | 4 | SYNOPSIS |
5 | 5 | use Convert::UUlib ':all'; |
7 | 7 | # read all the files named on the commandline and decode them |
8 | 8 | # into the CURRENT directory. See below for a longer example. |
9 | 9 | LoadFile $_ for @ARGV; |
10 | for (my $i = 0; my $uu = GetFileListItem $i; $i++) { | |
10 | ||
11 | for my $uu (GetFileList) { | |
11 | 12 | if ($uu->state & FILE_OK) { |
12 | 13 | $uu->decode; |
13 | 14 | print $uu->filename, "\n"; |
15 | 16 | } |
16 | 17 | |
17 | 18 | DESCRIPTION |
19 | This module started as an interface to the uulib/uudeview library by | |
20 | Frank Pilhofer that can be used to decode all kinds of usenet (and | |
21 | other) binary messages. | |
22 | ||
23 | After upstream abondoned the project, th library was continuously | |
24 | bugfixed and improved in this module, with major focuses on security | |
25 | fixes, correctness and speed (that does not mean that this library is | |
26 | considered safe with untrusted data, but it surely is safer than the | |
27 | poriginal uudeview). | |
28 | ||
18 | 29 | Read the file doc/library.pdf from the distribution for in-depth |
19 | 30 | information about the C-library used in this interface, and the rest of |
20 | 31 | this document and especially the non-trivial decoder program at the end. |
106 | 117 | On my machine, a fairly complete decode with DBI backend needs about |
107 | 118 | 10MB RSS to decode 20000 files. |
108 | 119 | |
109 | Initialize | |
110 | Not normally necessary, (re-)initializes the library. | |
111 | ||
112 | 120 | CleanUp |
113 | Not normally necessary, could be called at the end to release memory | |
114 | before starting a new decoding round. | |
121 | Release memory, file items and clean up files. Should be called | |
122 | after a decoidng run, if you want to start a new one. | |
115 | 123 | |
116 | 124 | Setting and querying options |
117 | 125 | $option = GetOption OPT_xxx |
159 | 167 | iterate over all files by starting with zero and incrementing until |
160 | 168 | you hit "undef". |
161 | 169 | |
170 | This function has to walk the linear list of fils on each access, so | |
171 | if you want to iterate over all items, it is usually faster to use | |
172 | "GetFileList". | |
173 | ||
174 | @items = GetFileList | |
175 | Similar to "GetFileListItem", but returns all files in one go, which | |
176 | is very much faster for large number of items, and has no drawbacks | |
177 | when used for a small number of items. | |
178 | ||
162 | 179 | Decoding files |
163 | $retval = $item->rename($newname) | |
180 | $retval = $item->rename ($newname) | |
164 | 181 | Change the ondisk filename where the decoded file will be saved. |
165 | 182 | |
166 | 183 | $retval = $item->decode_temp |
170 | 187 | $retval = $item->remove_temp |
171 | 188 | Remove the temporarily decoded file again. |
172 | 189 | |
173 | $retval = $item->decode([$target_path]) | |
174 | Decode the file to it's destination, or the given target path. | |
175 | ||
176 | $retval = $item->info(callback-function) | |
190 | $retval = $item->decode ([$target_path]) | |
191 | Decode the file to its destination, or the given target path. | |
192 | ||
193 | $retval = $item->info (callback-function) | |
177 | 194 | |
178 | 195 | Querying (and setting) item attributes |
179 | 196 | $state = $item->state |
180 | $mode = $item->mode([newmode]) | |
197 | $mode = $item->mode ([newmode]) | |
181 | 198 | $uudet = $item->uudet |
182 | 199 | $size = $item->size |
183 | $filename = $item->filename([newfilename}) | |
200 | $filename = $item->filename ([newfilename}) | |
184 | 201 | $subfname = $item->subfname |
185 | 202 | $mimeid = $item->mimeid |
186 | 203 | $mimetype = $item->mimetype |
206 | 223 | Usually you are interested mostly the "sfname" and possibly the |
207 | 224 | "partno" and "filename" members. |
208 | 225 | |
209 | Functions below not documented and not very well tested | |
226 | Functions below are not documented and not very well tested - feedback welcome | |
210 | 227 | QuickDecode |
211 | 228 | EncodeMulti |
212 | 229 | EncodePartial |
262 | 279 | } |
263 | 280 | |
264 | 281 | LARGE EXAMPLE DECODER |
265 | This is the file "example-decoder" from the distribution, put here | |
266 | instead of more thorough documentation. | |
282 | The general workflow for decoding is like this: | |
283 | ||
284 | 1. Configure options with "SetOption" or "SetXXXCallback". | |
285 | 2. Load all source files with "LoadFile". | |
286 | 3. Optionally "Smerge". | |
287 | 4. Iterate over all "GetFileList" items (i.e. result files). | |
288 | 5. "CleanUp" to delete files and free items. | |
289 | ||
290 | What follows is the file "example-decoder" from the distribution that | |
291 | illustrates the above worklfow in a non-trivial example. | |
267 | 292 | |
268 | 293 | #!/usr/bin/perl |
269 | 294 | |
292 | 317 | SetOption OPT_IGNMODE, 1; |
293 | 318 | SetOption OPT_IGNMODE, 1; |
294 | 319 | SetOption OPT_VERBOSE, 1; |
320 | SetOption OPT_AUTOCHK, 0; | |
295 | 321 | |
296 | 322 | # show the three ways you can set callback functions. I normally |
297 | 323 | # prefer the one with the sub inplace. |
335 | 361 | }; |
336 | 362 | |
337 | 363 | # now read all files in the directory uusrc/* |
338 | for(<uusrc/*>) { | |
364 | for (<uusrc/*>) { | |
339 | 365 | my ($retval, $count) = LoadFile ($_, $_, 1); |
340 | 366 | print "file($_), status(", strerror $retval, ") parts($count)\n"; |
341 | 367 | } |
342 | 368 | |
369 | Smerge -1; | |
370 | ||
343 | 371 | SetOption OPT_SAVEPATH, "uudst/"; |
344 | 372 | |
345 | 373 | # now wade through all files and their source parts |
346 | $i = 0; | |
347 | while ($uu = GetFileListItem $i) { | |
348 | $i++; | |
349 | print "file nr. $i"; | |
350 | print " state ", $uu->state; | |
351 | print " mode ", $uu->mode; | |
352 | print " uudet ", strencoding $uu->uudet; | |
353 | print " size ", $uu->size; | |
354 | print " filename ", $uu->filename; | |
355 | print " subfname ", $uu->subfname; | |
356 | print " mimeid ", $uu->mimeid; | |
357 | print " mimetype ", $uu->mimetype; | |
358 | print "\n"; | |
374 | for my $uu (GetFileList) { | |
375 | print "file ", $uu->filename, "\n"; | |
376 | print " state ", $uu->state, "\n"; | |
377 | print " mode ", $uu->mode, "\n"; | |
378 | print " uudet ", strencoding $uu->uudet, "\n"; | |
379 | print " size ", $uu->size, "\n"; | |
380 | print " subfname ", $uu->subfname, "\n"; | |
381 | print " mimeid ", $uu->mimeid, "\n"; | |
382 | print " mimetype ", $uu->mimetype, "\n"; | |
359 | 383 | |
360 | 384 | # print additional info about all parts |
385 | print " parts"; | |
361 | 386 | for ($uu->parts) { |
362 | while (my ($k, $v) = each %$_) { | |
363 | print "$k > $v, "; | |
387 | for my $k (sort keys %$_) { | |
388 | print " $k=$_->{$k}"; | |
364 | 389 | } |
365 | 390 | print "\n"; |
366 | 391 | } |
367 | 392 | |
368 | print $uu->filename; | |
369 | ||
370 | 393 | $uu->remove_temp; |
371 | 394 | |
372 | if (my $err = $uu->decode ()) { | |
373 | print ", ", strerror $err, "\n"; | |
395 | if (my $err = $uu->decode) { | |
396 | print " ERROR ", strerror $err, "\n"; | |
374 | 397 | } else { |
375 | print ", saved as uudst/", $uu->filename, "\n"; | |
398 | print " successfully saved as uudst/", $uu->filename, "\n"; | |
376 | 399 | } |
377 | 400 | } |
378 | 401 | |
379 | 402 | print "cleanup...\n"; |
380 | 403 | |
381 | 404 | CleanUp; |
405 | ||
406 | PERLMULTICORE SUPPORT | |
407 | This module supports the perlmulticore standard (see | |
408 | <http://perlmulticore.schmorp.de/> for more info) for the following | |
409 | functions - generally these are functions accessing the disk and/or | |
410 | using considerable CPU time: | |
411 | ||
412 | LoadFile | |
413 | $item->decode | |
414 | $item->decode_temp | |
415 | $item->remove_temp | |
416 | $item->info | |
417 | ||
418 | The perl interpreter will be reacquired/released on every callback | |
419 | invocation, so for performance reasons, callbacks should be avoided if | |
420 | that is costly. | |
421 | ||
422 | Future versions might enable multicore support for more functions. | |
423 | ||
424 | BUGS AND LIMITATIONS | |
425 | The original uulib library this module uses was written at a time where | |
426 | main memory of measured in megabytes and buffer overflows as a security | |
427 | thign didn't exist. While a lot of security fixes have been applied over | |
428 | the years (includign some defense in depth mechanism that can shield | |
429 | against a lot of as-of-yet undetected bugs), using this library for | |
430 | security purposes requires care. | |
431 | ||
432 | Likewise, file sizes when the uulib library was written were tiny | |
433 | compared to today, so do not expect this library to handle files larger | |
434 | than 2GB. | |
435 | ||
436 | Lastly, this module uses a very "C-like" interface, which means it | |
437 | doesn't protect you from invalid points as you might expect from "more | |
438 | perlish" modules - for example, accessing a file item object after | |
439 | callinbg "CleanUp" will likely result in crashes, memory corruption, or | |
440 | worse. | |
382 | 441 | |
383 | 442 | AUTHOR |
384 | 443 | Marc Lehmann <schmorp@schmorp.de>, the original uulib library was |
386 | 445 | heavily bugfixed by Marc Lehmann. |
387 | 446 | |
388 | 447 | SEE ALSO |
389 | perl(1), uudeview homepage at http://www.uni-frankfurt.de/~fp/uudeview/. | |
390 | ||
448 | perl(1), uudeview homepage at <http://www.fpx.de/fp/Software/UUDeview/>. | |
449 |
0 | 0 | package Convert::UUlib; |
1 | 1 | |
2 | no warnings; | |
3 | use strict; | |
2 | use common::sense; | |
4 | 3 | |
5 | 4 | use Carp; |
6 | 5 | |
7 | 6 | require Exporter; |
8 | 7 | require DynaLoader; |
9 | 8 | |
10 | our $VERSION = 1.5; | |
9 | our $VERSION = 1.8; | |
11 | 10 | |
12 | 11 | our @ISA = qw(Exporter DynaLoader); |
13 | 12 | |
35 | 34 | our @_funcs = qw( |
36 | 35 | Initialize CleanUp GetOption SetOption strerror SetMsgCallback |
37 | 36 | SetBusyCallback SetFileCallback SetFNameFilter SetFileNameCallback |
38 | FNameFilter LoadFile GetFileListItem RenameFile DecodeToTemp | |
37 | FNameFilter LoadFile GetFileListItem GetFileList RenameFile DecodeToTemp | |
39 | 38 | RemoveTemp DecodeFile InfoFile Smerge QuickDecode EncodeMulti |
40 | 39 | EncodePartial EncodeToStream EncodeToFile E_PrepSingle |
41 | 40 | E_PrepPartial |
49 | 48 | |
50 | 49 | bootstrap Convert::UUlib $VERSION; |
51 | 50 | |
52 | Initialize(); | |
53 | ||
54 | # not when < 5.005_6x | |
55 | # END { CleanUp() } | |
56 | ||
57 | for (@_consts) { | |
58 | my $constant = constant($_); | |
59 | no strict 'refs'; | |
60 | *$_ = sub () { $constant }; | |
61 | } | |
51 | # dummy function for compatiiblity with pre-1.7 versions | |
52 | sub Initialize { } | |
62 | 53 | |
63 | 54 | # action code -> string mapping |
64 | 55 | sub straction($) { |
97 | 88 | |
98 | 89 | =head1 NAME |
99 | 90 | |
100 | Convert::UUlib - Perl interface to the uulib library (a.k.a. uudeview/uuenview). | |
91 | Convert::UUlib - decode uu/xx/b64/mime/yenc/etc-encoded data from a massive number of files | |
101 | 92 | |
102 | 93 | =head1 SYNOPSIS |
103 | 94 | |
106 | 97 | # read all the files named on the commandline and decode them |
107 | 98 | # into the CURRENT directory. See below for a longer example. |
108 | 99 | LoadFile $_ for @ARGV; |
109 | for (my $i = 0; my $uu = GetFileListItem $i; $i++) { | |
100 | ||
101 | for my $uu (GetFileList) { | |
110 | 102 | if ($uu->state & FILE_OK) { |
111 | 103 | $uu->decode; |
112 | 104 | print $uu->filename, "\n"; |
114 | 106 | } |
115 | 107 | |
116 | 108 | =head1 DESCRIPTION |
109 | ||
110 | This module started as an interface to the uulib/uudeview library by Frank | |
111 | Pilhofer that can be used to decode all kinds of usenet (and other) | |
112 | binary messages. | |
113 | ||
114 | After upstream abondoned the project, th library was continuously bugfixed | |
115 | and improved in this module, with major focuses on security fixes, | |
116 | correctness and speed (that does not mean that this library is considered | |
117 | safe with untrusted data, but it surely is safer than the poriginal | |
118 | uudeview). | |
117 | 119 | |
118 | 120 | Read the file doc/library.pdf from the distribution for in-depth |
119 | 121 | information about the C-library used in this interface, and the rest of |
215 | 217 | On my machine, a fairly complete decode with DBI backend needs about 10MB |
216 | 218 | RSS to decode 20000 files. |
217 | 219 | |
218 | =over 4 | |
219 | ||
220 | =item Initialize | |
221 | ||
222 | Not normally necessary, (re-)initializes the library. | |
220 | =over | |
223 | 221 | |
224 | 222 | =item CleanUp |
225 | 223 | |
226 | Not normally necessary, could be called at the end to release memory | |
227 | before starting a new decoding round. | |
224 | Release memory, file items and clean up files. Should be called after a | |
225 | decoidng run, if you want to start a new one. | |
228 | 226 | |
229 | 227 | =back |
230 | 228 | |
231 | 229 | =head2 Setting and querying options |
232 | 230 | |
233 | =over 4 | |
231 | =over | |
234 | 232 | |
235 | 233 | =item $option = GetOption OPT_xxx |
236 | 234 | |
242 | 240 | |
243 | 241 | =head2 Setting various callbacks |
244 | 242 | |
245 | =over 4 | |
243 | =over | |
246 | 244 | |
247 | 245 | =item SetMsgCallback [callback-function] |
248 | 246 | |
256 | 254 | |
257 | 255 | =head2 Call the currently selected FNameFilter |
258 | 256 | |
259 | =over 4 | |
257 | =over | |
260 | 258 | |
261 | 259 | =item $file = FNameFilter $file |
262 | 260 | |
264 | 262 | |
265 | 263 | =head2 Loading sourcefiles, optionally fuzzy merge and start decoding |
266 | 264 | |
267 | =over 4 | |
265 | =over | |
268 | 266 | |
269 | 267 | =item ($retval, $count) = LoadFile $fname, [$id, [$delflag, [$partno]]] |
270 | 268 | |
299 | 297 | iterate over all files by starting with zero and incrementing until you |
300 | 298 | hit C<undef>. |
301 | 299 | |
300 | This function has to walk the linear list of fils on each access, so | |
301 | if you want to iterate over all items, it is usually faster to use | |
302 | C<GetFileList>. | |
303 | ||
304 | =item @items = GetFileList | |
305 | ||
306 | Similar to C<GetFileListItem>, but returns all files in one go, which is | |
307 | very much faster for large number of items, and has no drawbacks when used | |
308 | for a small number of items. | |
309 | ||
302 | 310 | =back |
303 | 311 | |
304 | 312 | =head2 Decoding files |
305 | 313 | |
306 | =over 4 | |
307 | ||
308 | =item $retval = $item->rename($newname) | |
314 | =over | |
315 | ||
316 | =item $retval = $item->rename ($newname) | |
309 | 317 | |
310 | 318 | Change the ondisk filename where the decoded file will be saved. |
311 | 319 | |
318 | 326 | |
319 | 327 | Remove the temporarily decoded file again. |
320 | 328 | |
321 | =item $retval = $item->decode([$target_path]) | |
322 | ||
323 | Decode the file to it's destination, or the given target path. | |
324 | ||
325 | =item $retval = $item->info(callback-function) | |
329 | =item $retval = $item->decode ([$target_path]) | |
330 | ||
331 | Decode the file to its destination, or the given target path. | |
332 | ||
333 | =item $retval = $item->info (callback-function) | |
326 | 334 | |
327 | 335 | =back |
328 | 336 | |
329 | 337 | =head2 Querying (and setting) item attributes |
330 | 338 | |
331 | =over 4 | |
339 | =over | |
332 | 340 | |
333 | 341 | =item $state = $item->state |
334 | 342 | |
335 | =item $mode = $item->mode([newmode]) | |
343 | =item $mode = $item->mode ([newmode]) | |
336 | 344 | |
337 | 345 | =item $uudet = $item->uudet |
338 | 346 | |
339 | 347 | =item $size = $item->size |
340 | 348 | |
341 | =item $filename = $item->filename([newfilename}) | |
349 | =item $filename = $item->filename ([newfilename}) | |
342 | 350 | |
343 | 351 | =item $subfname = $item->subfname |
344 | 352 | |
352 | 360 | |
353 | 361 | =head2 Information about source parts |
354 | 362 | |
355 | =over 4 | |
363 | =over | |
356 | 364 | |
357 | 365 | =item $parts = $item->parts |
358 | 366 | |
376 | 384 | |
377 | 385 | =back |
378 | 386 | |
379 | =head2 Functions below not documented and not very well tested | |
387 | =head2 Functions below are not documented and not very well tested - feedback welcome | |
380 | 388 | |
381 | 389 | QuickDecode |
382 | 390 | EncodeMulti |
390 | 398 | |
391 | 399 | Functions found in this module but not documented in the uulib documentation: |
392 | 400 | |
393 | =over 4 | |
401 | =over | |
394 | 402 | |
395 | 403 | =item $msg = straction ACT_xxx |
396 | 404 | |
441 | 449 | |
442 | 450 | =head1 LARGE EXAMPLE DECODER |
443 | 451 | |
444 | This is the file C<example-decoder> from the distribution, put here | |
445 | instead of more thorough documentation. | |
452 | The general workflow for decoding is like this: | |
453 | ||
454 | =over | |
455 | ||
456 | =item 1. Configure options with C<SetOption> or C<SetXXXCallback>. | |
457 | ||
458 | =item 2. Load all source files with C<LoadFile>. | |
459 | ||
460 | =item 3. Optionally C<Smerge>. | |
461 | ||
462 | =item 4. Iterate over all C<GetFileList> items (i.e. result files). | |
463 | ||
464 | =item 5. C<CleanUp> to delete files and free items. | |
465 | ||
466 | =back | |
467 | ||
468 | What follows is the file C<example-decoder> from the distribution that | |
469 | illustrates the above worklfow in a non-trivial example. | |
446 | 470 | |
447 | 471 | #!/usr/bin/perl |
448 | 472 | |
471 | 495 | SetOption OPT_IGNMODE, 1; |
472 | 496 | SetOption OPT_IGNMODE, 1; |
473 | 497 | SetOption OPT_VERBOSE, 1; |
498 | SetOption OPT_AUTOCHK, 0; | |
474 | 499 | |
475 | 500 | # show the three ways you can set callback functions. I normally |
476 | 501 | # prefer the one with the sub inplace. |
514 | 539 | }; |
515 | 540 | |
516 | 541 | # now read all files in the directory uusrc/* |
517 | for(<uusrc/*>) { | |
542 | for (<uusrc/*>) { | |
518 | 543 | my ($retval, $count) = LoadFile ($_, $_, 1); |
519 | 544 | print "file($_), status(", strerror $retval, ") parts($count)\n"; |
520 | 545 | } |
521 | 546 | |
547 | Smerge -1; | |
548 | ||
522 | 549 | SetOption OPT_SAVEPATH, "uudst/"; |
523 | 550 | |
524 | 551 | # now wade through all files and their source parts |
525 | $i = 0; | |
526 | while ($uu = GetFileListItem $i) { | |
527 | $i++; | |
528 | print "file nr. $i"; | |
529 | print " state ", $uu->state; | |
530 | print " mode ", $uu->mode; | |
531 | print " uudet ", strencoding $uu->uudet; | |
532 | print " size ", $uu->size; | |
533 | print " filename ", $uu->filename; | |
534 | print " subfname ", $uu->subfname; | |
535 | print " mimeid ", $uu->mimeid; | |
536 | print " mimetype ", $uu->mimetype; | |
537 | print "\n"; | |
552 | for my $uu (GetFileList) { | |
553 | print "file ", $uu->filename, "\n"; | |
554 | print " state ", $uu->state, "\n"; | |
555 | print " mode ", $uu->mode, "\n"; | |
556 | print " uudet ", strencoding $uu->uudet, "\n"; | |
557 | print " size ", $uu->size, "\n"; | |
558 | print " subfname ", $uu->subfname, "\n"; | |
559 | print " mimeid ", $uu->mimeid, "\n"; | |
560 | print " mimetype ", $uu->mimetype, "\n"; | |
538 | 561 | |
539 | 562 | # print additional info about all parts |
563 | print " parts"; | |
540 | 564 | for ($uu->parts) { |
541 | while (my ($k, $v) = each %$_) { | |
542 | print "$k > $v, "; | |
565 | for my $k (sort keys %$_) { | |
566 | print " $k=$_->{$k}"; | |
543 | 567 | } |
544 | 568 | print "\n"; |
545 | 569 | } |
546 | 570 | |
547 | print $uu->filename; | |
548 | ||
549 | 571 | $uu->remove_temp; |
550 | 572 | |
551 | if (my $err = $uu->decode ()) { | |
552 | print ", ", strerror $err, "\n"; | |
573 | if (my $err = $uu->decode) { | |
574 | print " ERROR ", strerror $err, "\n"; | |
553 | 575 | } else { |
554 | print ", saved as uudst/", $uu->filename, "\n"; | |
576 | print " successfully saved as uudst/", $uu->filename, "\n"; | |
555 | 577 | } |
556 | 578 | } |
557 | 579 | |
558 | 580 | print "cleanup...\n"; |
559 | 581 | |
560 | 582 | CleanUp; |
583 | ||
584 | =head1 PERLMULTICORE SUPPORT | |
585 | ||
586 | This module supports the perlmulticore standard (see | |
587 | L<http://perlmulticore.schmorp.de/> for more info) for the following | |
588 | functions - generally these are functions accessing the disk and/or using | |
589 | considerable CPU time: | |
590 | ||
591 | LoadFile | |
592 | $item->decode | |
593 | $item->decode_temp | |
594 | $item->remove_temp | |
595 | $item->info | |
596 | ||
597 | The perl interpreter will be reacquired/released on every callback | |
598 | invocation, so for performance reasons, callbacks should be avoided if | |
599 | that is costly. | |
600 | ||
601 | Future versions might enable multicore support for more functions. | |
602 | ||
603 | =head1 BUGS AND LIMITATIONS | |
604 | ||
605 | The original uulib library this module uses was written at a time where | |
606 | main memory of measured in megabytes and buffer overflows as a security | |
607 | thign didn't exist. While a lot of security fixes have been applied over | |
608 | the years (includign some defense in depth mechanism that can shield | |
609 | against a lot of as-of-yet undetected bugs), using this library for | |
610 | security purposes requires care. | |
611 | ||
612 | Likewise, file sizes when the uulib library was written were tiny compared | |
613 | to today, so do not expect this library to handle files larger than 2GB. | |
614 | ||
615 | Lastly, this module uses a very "C-like" interface, which means it doesn't | |
616 | protect you from invalid points as you might expect from "more perlish" | |
617 | modules - for example, accessing a file item object after callinbg | |
618 | C<CleanUp> will likely result in crashes, memory corruption, or worse. | |
561 | 619 | |
562 | 620 | =head1 AUTHOR |
563 | 621 | |
567 | 625 | |
568 | 626 | =head1 SEE ALSO |
569 | 627 | |
570 | perl(1), uudeview homepage at http://www.uni-frankfurt.de/~fp/uudeview/. | |
628 | perl(1), uudeview homepage at L<http://www.fpx.de/fp/Software/UUDeview/>. | |
571 | 629 | |
572 | 630 | =cut |
631 |
1 | 1 | #include "perl.h" |
2 | 2 | #include "XSUB.h" |
3 | 3 | |
4 | #include "perlmulticore.h" | |
5 | ||
4 | 6 | #include "uulib/fptools.h" |
5 | 7 | #include "uulib/uudeview.h" |
6 | 8 | #include "uulib/uuint.h" |
7 | 9 | |
8 | static int | |
9 | not_here (char *s) | |
10 | { | |
11 | croak("%s not implemented", s); | |
12 | return -1; | |
13 | } | |
14 | ||
15 | static int | |
16 | constant (char *name) | |
17 | { | |
18 | errno = 0; | |
19 | switch (*name) | |
20 | { | |
21 | case 'A': | |
22 | if (strEQ(name, "ACT_COPYING")) return UUACT_COPYING; | |
23 | if (strEQ(name, "ACT_DECODING")) return UUACT_DECODING; | |
24 | if (strEQ(name, "ACT_ENCODING")) return UUACT_ENCODING; | |
25 | if (strEQ(name, "ACT_IDLE")) return UUACT_IDLE; | |
26 | if (strEQ(name, "ACT_SCANNING")) return UUACT_SCANNING; | |
27 | case 'F': | |
28 | if (strEQ(name, "FILE_DECODED")) return UUFILE_DECODED; | |
29 | if (strEQ(name, "FILE_ERROR")) return UUFILE_ERROR; | |
30 | if (strEQ(name, "FILE_MISPART")) return UUFILE_MISPART; | |
31 | if (strEQ(name, "FILE_NOBEGIN")) return UUFILE_NOBEGIN; | |
32 | if (strEQ(name, "FILE_NODATA")) return UUFILE_NODATA; | |
33 | if (strEQ(name, "FILE_NOEND")) return UUFILE_NOEND; | |
34 | if (strEQ(name, "FILE_OK")) return UUFILE_OK; | |
35 | if (strEQ(name, "FILE_READ")) return UUFILE_READ; | |
36 | if (strEQ(name, "FILE_TMPFILE")) return UUFILE_TMPFILE; | |
37 | break; | |
38 | case 'M': | |
39 | if (strEQ(name, "MSG_ERROR")) return UUMSG_ERROR; | |
40 | if (strEQ(name, "MSG_FATAL")) return UUMSG_FATAL; | |
41 | if (strEQ(name, "MSG_MESSAGE")) return UUMSG_MESSAGE; | |
42 | if (strEQ(name, "MSG_NOTE")) return UUMSG_NOTE; | |
43 | if (strEQ(name, "MSG_PANIC")) return UUMSG_PANIC; | |
44 | if (strEQ(name, "MSG_WARNING")) return UUMSG_WARNING; | |
45 | case 'O': | |
46 | if (strEQ(name, "OPT_VERSION")) return UUOPT_VERSION; | |
47 | if (strEQ(name, "OPT_FAST")) return UUOPT_FAST; | |
48 | if (strEQ(name, "OPT_DUMBNESS")) return UUOPT_DUMBNESS; | |
49 | if (strEQ(name, "OPT_BRACKPOL")) return UUOPT_BRACKPOL; | |
50 | if (strEQ(name, "OPT_VERBOSE")) return UUOPT_VERBOSE; | |
51 | if (strEQ(name, "OPT_DESPERATE")) return UUOPT_DESPERATE; | |
52 | if (strEQ(name, "OPT_IGNREPLY")) return UUOPT_IGNREPLY; | |
53 | if (strEQ(name, "OPT_OVERWRITE")) return UUOPT_OVERWRITE; | |
54 | if (strEQ(name, "OPT_SAVEPATH")) return UUOPT_SAVEPATH; | |
55 | if (strEQ(name, "OPT_IGNMODE")) return UUOPT_IGNMODE; | |
56 | if (strEQ(name, "OPT_DEBUG")) return UUOPT_DEBUG; | |
57 | if (strEQ(name, "OPT_ERRNO")) return UUOPT_ERRNO; | |
58 | if (strEQ(name, "OPT_PROGRESS")) return UUOPT_PROGRESS; | |
59 | if (strEQ(name, "OPT_USETEXT")) return UUOPT_USETEXT; | |
60 | if (strEQ(name, "OPT_PREAMB")) return UUOPT_PREAMB; | |
61 | if (strEQ(name, "OPT_TINYB64")) return UUOPT_TINYB64; | |
62 | if (strEQ(name, "OPT_ENCEXT")) return UUOPT_ENCEXT; | |
63 | if (strEQ(name, "OPT_REMOVE")) return UUOPT_REMOVE; | |
64 | if (strEQ(name, "OPT_MOREMIME")) return UUOPT_MOREMIME; | |
65 | if (strEQ(name, "OPT_DOTDOT")) return UUOPT_DOTDOT; | |
66 | if (strEQ(name, "OPT_RBUF")) return UUOPT_RBUF; | |
67 | if (strEQ(name, "OPT_WBUF")) return UUOPT_WBUF; | |
68 | if (strEQ(name, "OPT_AUTOCHECK")) return UUOPT_AUTOCHECK; | |
69 | case 'R': | |
70 | if (strEQ(name, "RET_CANCEL")) return UURET_CANCEL; | |
71 | if (strEQ(name, "RET_CONT")) return UURET_CONT; | |
72 | if (strEQ(name, "RET_EXISTS")) return UURET_EXISTS; | |
73 | if (strEQ(name, "RET_ILLVAL")) return UURET_ILLVAL; | |
74 | if (strEQ(name, "RET_IOERR")) return UURET_IOERR; | |
75 | if (strEQ(name, "RET_NODATA")) return UURET_NODATA; | |
76 | if (strEQ(name, "RET_NOEND")) return UURET_NOEND; | |
77 | if (strEQ(name, "RET_NOMEM")) return UURET_NOMEM; | |
78 | if (strEQ(name, "RET_OK")) return UURET_OK; | |
79 | if (strEQ(name, "RET_UNSUP")) return UURET_UNSUP; | |
80 | case 'B': | |
81 | if (strEQ(name, "B64_ENCODED")) return B64ENCODED; | |
82 | if (strEQ(name, "BH_ENCODED")) return BH_ENCODED; | |
83 | case 'P': | |
84 | if (strEQ(name, "PT_ENCODED")) return PT_ENCODED; | |
85 | case 'Q': | |
86 | if (strEQ(name, "QP_ENCODED")) return QP_ENCODED; | |
87 | case 'U': | |
88 | if (strEQ(name, "UU_ENCODED")) return UU_ENCODED; | |
89 | case 'X': | |
90 | if (strEQ(name, "XX_ENCODED")) return XX_ENCODED; | |
91 | case 'Y': | |
92 | if (strEQ(name, "YENC_ENCODED")) return YENC_ENCODED; | |
93 | } | |
94 | ||
95 | errno = EINVAL; | |
96 | return 0; | |
97 | } | |
10 | static int perlinterp_released; | |
11 | ||
12 | #define RELEASE do { perlinterp_released = 1; perlinterp_release (); } while (0) | |
13 | #define ACQUIRE do { perlinterp_acquire (); perlinterp_released = 0; } while (0) | |
14 | ||
15 | #define TEMP_ACQUIRE if (perlinterp_released) perlinterp_acquire (); | |
16 | #define TEMP_RELEASE if (perlinterp_released) perlinterp_release (); | |
98 | 17 | |
99 | 18 | static void |
100 | 19 | uu_msg_callback (void *cb, char *msg, int level) |
101 | 20 | { |
102 | dSP; | |
103 | ||
104 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); | |
105 | ||
106 | PUSHs (sv_2mortal (newSVpv (msg, 0))); | |
107 | PUSHs (sv_2mortal (newSViv (level))); | |
108 | ||
109 | PUTBACK; (void) perl_call_sv ((SV *)cb, G_VOID|G_DISCARD); SPAGAIN; | |
110 | PUTBACK; FREETMPS; LEAVE; | |
21 | TEMP_ACQUIRE { | |
22 | ||
23 | dSP; | |
24 | ||
25 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); | |
26 | ||
27 | PUSHs (sv_2mortal (newSVpv (msg, 0))); | |
28 | PUSHs (sv_2mortal (newSViv (level))); | |
29 | ||
30 | PUTBACK; (void) perl_call_sv ((SV *)cb, G_VOID|G_DISCARD); SPAGAIN; | |
31 | PUTBACK; FREETMPS; LEAVE; | |
32 | ||
33 | } TEMP_RELEASE; | |
111 | 34 | } |
112 | 35 | |
113 | 36 | static int |
114 | 37 | uu_busy_callback (void *cb, uuprogress *uup) |
115 | 38 | { |
116 | dSP; | |
117 | int count; | |
118 | 39 | int retval; |
119 | ||
120 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 6); | |
121 | ||
122 | PUSHs (sv_2mortal (newSViv (uup->action))); | |
123 | PUSHs (sv_2mortal (newSVpv (uup->curfile, 0))); | |
124 | PUSHs (sv_2mortal (newSViv (uup->partno))); | |
125 | PUSHs (sv_2mortal (newSViv (uup->numparts))); | |
126 | PUSHs (sv_2mortal (newSViv (uup->fsize))); | |
127 | PUSHs (sv_2mortal (newSViv (uup->percent))); | |
128 | ||
129 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
130 | ||
131 | if (count != 1) | |
132 | croak ("busycallback perl callback returned more than one argument"); | |
133 | ||
134 | retval = POPi; | |
135 | ||
136 | PUTBACK; FREETMPS; LEAVE; | |
40 | ||
41 | TEMP_ACQUIRE { | |
42 | ||
43 | dSP; | |
44 | int count; | |
45 | ||
46 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 6); | |
47 | ||
48 | PUSHs (sv_2mortal (newSViv (uup->action))); | |
49 | PUSHs (sv_2mortal (newSVpv (uup->curfile, 0))); | |
50 | PUSHs (sv_2mortal (newSViv (uup->partno))); | |
51 | PUSHs (sv_2mortal (newSViv (uup->numparts))); | |
52 | PUSHs (sv_2mortal (newSViv (uup->fsize))); | |
53 | PUSHs (sv_2mortal (newSViv (uup->percent))); | |
54 | ||
55 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
56 | ||
57 | if (count != 1) | |
58 | croak ("busycallback perl callback returned more than one argument"); | |
59 | ||
60 | retval = POPi; | |
61 | ||
62 | PUTBACK; FREETMPS; LEAVE; | |
63 | ||
64 | } TEMP_RELEASE; | |
137 | 65 | |
138 | 66 | return retval; |
139 | 67 | } |
141 | 69 | static char * |
142 | 70 | uu_fnamefilter_callback (void *cb, char *fname) |
143 | 71 | { |
144 | dSP; | |
145 | int count; | |
146 | 72 | static char *str; |
147 | ||
148 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 1); | |
149 | ||
150 | PUSHs (sv_2mortal (newSVpv (fname, 0))); | |
151 | ||
152 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
153 | ||
154 | if (count != 1) | |
155 | croak ("fnamefilter perl callback MUST return a single filename exactly"); | |
156 | ||
157 | _FP_free (str); str = _FP_strdup (SvPV_nolen (TOPs)); | |
158 | ||
159 | PUTBACK; FREETMPS; LEAVE; | |
73 | ||
74 | TEMP_ACQUIRE { | |
75 | ||
76 | dSP; | |
77 | int count; | |
78 | ||
79 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 1); | |
80 | ||
81 | PUSHs (sv_2mortal (newSVpv (fname, 0))); | |
82 | ||
83 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
84 | ||
85 | if (count != 1) | |
86 | croak ("fnamefilter perl callback MUST return a single filename exactly"); | |
87 | ||
88 | FP_free (str); str = FP_strdup (SvPV_nolen (TOPs)); | |
89 | ||
90 | PUTBACK; FREETMPS; LEAVE; | |
91 | ||
92 | } TEMP_RELEASE; | |
160 | 93 | |
161 | 94 | return str; |
162 | 95 | } |
164 | 97 | static int |
165 | 98 | uu_file_callback (void *cb, char *id, char *fname, int retrieve) |
166 | 99 | { |
167 | dSP; | |
168 | int count; | |
169 | 100 | int retval; |
170 | SV *xfname = newSVpv ("", 0); | |
171 | ||
172 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 3); | |
173 | ||
174 | PUSHs (sv_2mortal (newSVpv (id, 0))); | |
175 | PUSHs (sv_2mortal (xfname)); | |
176 | PUSHs (sv_2mortal (newSViv (retrieve))); | |
177 | ||
178 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
179 | ||
180 | if (count != 1) | |
181 | croak ("filecallback perl callback must return a single return status"); | |
182 | ||
183 | strcpy (fname, SvPV_nolen (xfname)); | |
184 | retval = POPi; | |
185 | ||
186 | PUTBACK; FREETMPS; LEAVE; | |
101 | ||
102 | TEMP_ACQUIRE { | |
103 | ||
104 | dSP; | |
105 | int count; | |
106 | SV *xfname = newSVpv ("", 0); | |
107 | ||
108 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 3); | |
109 | ||
110 | PUSHs (sv_2mortal (newSVpv (id, 0))); | |
111 | PUSHs (sv_2mortal (xfname)); | |
112 | PUSHs (sv_2mortal (newSViv (retrieve))); | |
113 | ||
114 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
115 | ||
116 | if (count != 1) | |
117 | croak ("filecallback perl callback must return a single return status"); | |
118 | ||
119 | strcpy (fname, SvPV_nolen (xfname)); | |
120 | retval = POPi; | |
121 | ||
122 | PUTBACK; FREETMPS; LEAVE; | |
123 | ||
124 | } TEMP_RELEASE; | |
187 | 125 | |
188 | 126 | return retval; |
189 | 127 | } |
191 | 129 | static char * |
192 | 130 | uu_filename_callback (void *cb, char *subject, char *filename) |
193 | 131 | { |
194 | dSP; | |
195 | int count; | |
196 | ||
197 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); | |
198 | ||
199 | PUSHs (sv_2mortal(newSVpv(subject, 0))); | |
200 | PUSHs (filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef); | |
201 | ||
202 | PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN; | |
203 | ||
204 | if (count > 1) | |
205 | croak ("filenamecallback perl callback must return nothing or a single filename"); | |
206 | ||
207 | if (count) | |
208 | { | |
209 | _FP_free (filename); | |
210 | ||
211 | filename = SvOK (TOPs) | |
212 | ? _FP_strdup (SvPV_nolen (TOPs)) | |
213 | : 0; | |
214 | } | |
215 | ||
216 | PUTBACK; FREETMPS; LEAVE; | |
132 | TEMP_ACQUIRE { | |
133 | ||
134 | dSP; | |
135 | int count; | |
136 | ||
137 | ENTER; SAVETMPS; PUSHMARK (SP); EXTEND (SP, 2); | |
138 | ||
139 | PUSHs (sv_2mortal(newSVpv(subject, 0))); | |
140 | PUSHs (filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef); | |
141 | ||
142 | PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN; | |
143 | ||
144 | if (count > 1) | |
145 | croak ("filenamecallback perl callback must return nothing or a single filename"); | |
146 | ||
147 | if (count) | |
148 | { | |
149 | FP_free (filename); | |
150 | ||
151 | filename = SvOK (TOPs) | |
152 | ? FP_strdup (SvPV_nolen (TOPs)) | |
153 | : 0; | |
154 | } | |
155 | ||
156 | PUTBACK; FREETMPS; LEAVE; | |
157 | ||
158 | } TEMP_RELEASE; | |
217 | 159 | |
218 | 160 | return filename; |
219 | 161 | } |
225 | 167 | static int |
226 | 168 | uu_info_file (void *cb, char *info) |
227 | 169 | { |
228 | dSP; | |
229 | int count; | |
230 | 170 | int retval; |
231 | ||
232 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); | |
233 | ||
234 | PUSHs(sv_2mortal(newSVpv(info,0))); | |
235 | ||
236 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
237 | ||
238 | if (count != 1) | |
239 | croak ("info_file perl callback returned more than one argument"); | |
240 | ||
241 | retval = POPi; | |
242 | ||
243 | PUTBACK; FREETMPS; LEAVE; | |
171 | ||
172 | TEMP_ACQUIRE { | |
173 | ||
174 | dSP; | |
175 | int count; | |
176 | ||
177 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,1); | |
178 | ||
179 | PUSHs(sv_2mortal(newSVpv(info,0))); | |
180 | ||
181 | PUTBACK; count = perl_call_sv ((SV *)cb, G_SCALAR); SPAGAIN; | |
182 | ||
183 | if (count != 1) | |
184 | croak ("info_file perl callback returned more than one argument"); | |
185 | ||
186 | retval = POPi; | |
187 | ||
188 | PUTBACK; FREETMPS; LEAVE; | |
189 | ||
190 | } TEMP_RELEASE; | |
244 | 191 | |
245 | 192 | return retval; |
246 | 193 | } |
259 | 206 | } |
260 | 207 | } |
261 | 208 | |
262 | static int uu_initialized; | |
209 | static void | |
210 | initialise (void) | |
211 | { | |
212 | int retval = UUInitialize (); | |
213 | ||
214 | if (retval != UURET_OK) | |
215 | croak ("unable to initialize uudeview library (%s)", UUstrerror (retval)); | |
216 | } | |
263 | 217 | |
264 | 218 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib PREFIX = UU |
265 | 219 | |
266 | 220 | PROTOTYPES: ENABLE |
267 | ||
268 | int | |
269 | constant (name) | |
270 | char * name | |
271 | ||
272 | ||
273 | void | |
274 | UUInitialize () | |
275 | CODE: | |
276 | if (!uu_initialized) | |
277 | { | |
278 | int retval; | |
279 | ||
280 | if ((retval = UUInitialize ()) != UURET_OK) | |
281 | croak ("unable to initialize uudeview library (%s)", UUstrerror (retval)); | |
282 | ||
283 | uu_initialized = 1; | |
284 | } | |
285 | 221 | |
286 | 222 | void |
287 | 223 | UUCleanUp () |
288 | 224 | CODE: |
289 | if (uu_initialized) | |
290 | UUCleanUp (); | |
291 | ||
292 | uu_initialized = 0; | |
225 | UUCleanUp (); | |
226 | initialise (); | |
293 | 227 | |
294 | 228 | SV * |
295 | 229 | UUGetOption (opt) |
377 | 311 | PPCODE: |
378 | 312 | { |
379 | 313 | int count; |
380 | ||
381 | XPUSHs (sv_2mortal (newSViv (UULoadFileWithPartNo (fname, id, delflag, partno, &count)))); | |
314 | IV ret; | |
315 | ||
316 | RELEASE; | |
317 | ret = UULoadFileWithPartNo (fname, id, delflag, partno, &count); | |
318 | ACQUIRE; | |
319 | ||
320 | XPUSHs (sv_2mortal (newSViv (ret))); | |
382 | 321 | if (GIMME_V == G_ARRAY) |
383 | 322 | XPUSHs (sv_2mortal (newSViv (count))); |
384 | 323 | } |
467 | 406 | UUGetFileListItem (num) |
468 | 407 | int num |
469 | 408 | |
409 | void | |
410 | GetFileList () | |
411 | PPCODE: | |
412 | { | |
413 | uulist *iter; | |
414 | ||
415 | for (iter = UUGlobalFileList; iter; iter = iter->NEXT) | |
416 | XPUSHs (sv_setref_pv (sv_newmortal (), "Convert::UUlib::Item", iter)); | |
417 | } | |
418 | ||
470 | 419 | MODULE = Convert::UUlib PACKAGE = Convert::UUlib::Item |
471 | 420 | |
472 | 421 | int |
482 | 431 | decode_temp (item) |
483 | 432 | uulist *item |
484 | 433 | CODE: |
434 | RELEASE; | |
485 | 435 | RETVAL = UUDecodeToTemp (item); |
436 | ACQUIRE; | |
486 | 437 | OUTPUT: |
487 | 438 | RETVAL |
488 | 439 | |
490 | 441 | remove_temp (item) |
491 | 442 | uulist *item |
492 | 443 | CODE: |
444 | RELEASE; | |
493 | 445 | RETVAL = UURemoveTemp (item); |
446 | ACQUIRE; | |
494 | 447 | OUTPUT: |
495 | 448 | RETVAL |
496 | 449 | |
499 | 452 | uulist *item |
500 | 453 | char * target |
501 | 454 | CODE: |
455 | RELEASE; | |
502 | 456 | RETVAL = UUDecodeFile (item, target); |
457 | ACQUIRE; | |
503 | 458 | OUTPUT: |
504 | 459 | RETVAL |
505 | 460 | |
508 | 463 | uulist *item |
509 | 464 | SV * func |
510 | 465 | CODE: |
511 | UUInfoFile (item,(void *)func, uu_info_file); | |
466 | RELEASE; | |
467 | UUInfoFile (item, (void *)func, uu_info_file); | |
468 | ACQUIRE; | |
512 | 469 | |
513 | 470 | short |
514 | 471 | state(li) |
552 | 509 | CODE: |
553 | 510 | if (newfilename) |
554 | 511 | { |
555 | _FP_free (li->filename); | |
556 | li->filename = _FP_strdup (newfilename); | |
512 | FP_free (li->filename); | |
513 | li->filename = FP_strdup (newfilename); | |
557 | 514 | } |
558 | 515 | RETVAL = li->filename; |
559 | 516 | OUTPUT: |
604 | 561 | { |
605 | 562 | HV *pi = newHV (); |
606 | 563 | |
607 | hv_store (pi, "partno" , 6, newSViv (p->partno) , 0); | |
608 | ||
609 | if (p->filename) | |
610 | hv_store (pi, "filename", 8, newSVpv (p->filename, 0) , 0); | |
611 | if(p->subfname) | |
612 | hv_store (pi, "subfname", 8, newSVpv (p->subfname, 0) , 0); | |
613 | if(p->mimeid) | |
614 | hv_store (pi, "mimeid" , 6, newSVpv (p->mimeid , 0) , 0); | |
615 | if(p->mimetype) | |
616 | hv_store (pi, "mimetype", 8, newSVpv (p->mimetype, 0) , 0); | |
617 | if (p->data->subject) | |
618 | hv_store (pi, "subject" , 7, newSVpv (p->data->subject,0), 0); | |
619 | if (p->data->origin) | |
620 | hv_store (pi, "origin" , 6, newSVpv (p->data->origin ,0), 0); | |
621 | if (p->data->sfname) | |
622 | hv_store (pi, "sfname" , 6, newSVpv (p->data->sfname ,0), 0); | |
564 | hv_store (pi, "partno" , 6, newSViv (p->partno) , 0); | |
565 | if (p->filename ) hv_store (pi, "filename", 8, newSVpv (p->filename, 0) , 0); | |
566 | if (p->subfname ) hv_store (pi, "subfname", 8, newSVpv (p->subfname, 0) , 0); | |
567 | if (p->mimeid ) hv_store (pi, "mimeid" , 6, newSVpv (p->mimeid , 0) , 0); | |
568 | if (p->mimetype ) hv_store (pi, "mimetype", 8, newSVpv (p->mimetype, 0) , 0); | |
569 | if (p->data->subject) hv_store (pi, "subject" , 7, newSVpv (p->data->subject,0), 0); | |
570 | if (p->data->origin ) hv_store (pi, "origin" , 6, newSVpv (p->data->origin ,0), 0); | |
571 | if (p->data->sfname ) hv_store (pi, "sfname" , 6, newSVpv (p->data->sfname ,0), 0); | |
623 | 572 | |
624 | 573 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)pi))); |
625 | 574 | |
628 | 577 | } |
629 | 578 | |
630 | 579 | BOOT: |
580 | { | |
581 | HV *stash = GvSTASH (CvGV (cv)); | |
582 | ||
583 | static const struct { | |
584 | const char *name; | |
585 | IV iv; | |
586 | } *civ, const_iv[] = { | |
587 | # define const_iv(name, value) { # name, (IV) value }, | |
588 | const_iv (ACT_COPYING , UUACT_COPYING) | |
589 | const_iv (ACT_DECODING , UUACT_DECODING) | |
590 | const_iv (ACT_ENCODING , UUACT_ENCODING) | |
591 | const_iv (ACT_IDLE , UUACT_IDLE) | |
592 | const_iv (ACT_SCANNING , UUACT_SCANNING) | |
593 | const_iv (FILE_DECODED , UUFILE_DECODED) | |
594 | const_iv (FILE_ERROR , UUFILE_ERROR) | |
595 | const_iv (FILE_MISPART , UUFILE_MISPART) | |
596 | const_iv (FILE_NOBEGIN , UUFILE_NOBEGIN) | |
597 | const_iv (FILE_NODATA , UUFILE_NODATA) | |
598 | const_iv (FILE_NOEND , UUFILE_NOEND) | |
599 | const_iv (FILE_OK , UUFILE_OK) | |
600 | const_iv (FILE_READ , UUFILE_READ) | |
601 | const_iv (FILE_TMPFILE , UUFILE_TMPFILE) | |
602 | const_iv (MSG_ERROR , UUMSG_ERROR) | |
603 | const_iv (MSG_FATAL , UUMSG_FATAL) | |
604 | const_iv (MSG_MESSAGE , UUMSG_MESSAGE) | |
605 | const_iv (MSG_NOTE , UUMSG_NOTE) | |
606 | const_iv (MSG_PANIC , UUMSG_PANIC) | |
607 | const_iv (MSG_WARNING , UUMSG_WARNING) | |
608 | const_iv (OPT_VERSION , UUOPT_VERSION) | |
609 | const_iv (OPT_FAST , UUOPT_FAST) | |
610 | const_iv (OPT_DUMBNESS , UUOPT_DUMBNESS) | |
611 | const_iv (OPT_BRACKPOL , UUOPT_BRACKPOL) | |
612 | const_iv (OPT_VERBOSE , UUOPT_VERBOSE) | |
613 | const_iv (OPT_DESPERATE, UUOPT_DESPERATE) | |
614 | const_iv (OPT_IGNREPLY , UUOPT_IGNREPLY) | |
615 | const_iv (OPT_OVERWRITE, UUOPT_OVERWRITE) | |
616 | const_iv (OPT_SAVEPATH , UUOPT_SAVEPATH) | |
617 | const_iv (OPT_IGNMODE , UUOPT_IGNMODE) | |
618 | const_iv (OPT_DEBUG , UUOPT_DEBUG) | |
619 | const_iv (OPT_ERRNO , UUOPT_ERRNO) | |
620 | const_iv (OPT_PROGRESS , UUOPT_PROGRESS) | |
621 | const_iv (OPT_USETEXT , UUOPT_USETEXT) | |
622 | const_iv (OPT_PREAMB , UUOPT_PREAMB) | |
623 | const_iv (OPT_TINYB64 , UUOPT_TINYB64) | |
624 | const_iv (OPT_ENCEXT , UUOPT_ENCEXT) | |
625 | const_iv (OPT_REMOVE , UUOPT_REMOVE) | |
626 | const_iv (OPT_MOREMIME , UUOPT_MOREMIME) | |
627 | const_iv (OPT_DOTDOT , UUOPT_DOTDOT) | |
628 | const_iv (OPT_RBUF , UUOPT_RBUF) | |
629 | const_iv (OPT_WBUF , UUOPT_WBUF) | |
630 | const_iv (OPT_AUTOCHECK, UUOPT_AUTOCHECK) | |
631 | const_iv (RET_CANCEL , UURET_CANCEL) | |
632 | const_iv (RET_CONT , UURET_CONT) | |
633 | const_iv (RET_EXISTS , UURET_EXISTS) | |
634 | const_iv (RET_ILLVAL , UURET_ILLVAL) | |
635 | const_iv (RET_IOERR , UURET_IOERR) | |
636 | const_iv (RET_NODATA , UURET_NODATA) | |
637 | const_iv (RET_NOEND , UURET_NOEND) | |
638 | const_iv (RET_NOMEM , UURET_NOMEM) | |
639 | const_iv (RET_OK , UURET_OK) | |
640 | const_iv (RET_UNSUP , UURET_UNSUP) | |
641 | const_iv (B64_ENCODED , B64ENCODED) | |
642 | const_iv (BH_ENCODED , BH_ENCODED) | |
643 | const_iv (PT_ENCODED , PT_ENCODED) | |
644 | const_iv (QP_ENCODED , QP_ENCODED) | |
645 | const_iv (UU_ENCODED , UU_ENCODED) | |
646 | const_iv (XX_ENCODED , XX_ENCODED) | |
647 | const_iv (YENC_ENCODED , YENC_ENCODED) | |
648 | }; | |
649 | ||
650 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) | |
651 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); | |
652 | ||
631 | 653 | uu_msg_sv = newSVsv (&PL_sv_undef); |
632 | 654 | uu_busy_sv = newSVsv (&PL_sv_undef); |
633 | 655 | uu_file_sv = newSVsv (&PL_sv_undef); |
634 | 656 | uu_fnamefilter_sv = newSVsv (&PL_sv_undef); |
635 | 657 | uu_filename_sv = newSVsv (&PL_sv_undef); |
636 | 658 | |
659 | initialise (); | |
660 | } | |
661 |
1 | 1 | |
2 | 2 | # decode all the files in the directory uusrc/ and copy |
3 | 3 | # the resulting files to uudst/ |
4 | ||
5 | #use Coro::Multicore; | |
6 | ||
7 | use strict; | |
4 | 8 | |
5 | 9 | use Convert::UUlib ':all'; |
6 | 10 | |
86 | 90 | SetOption OPT_SAVEPATH, "uudst/"; |
87 | 91 | |
88 | 92 | # now wade through all files and their source parts |
89 | $i = 0; | |
90 | while ($uu = GetFileListItem $i) { | |
91 | $i++; | |
92 | print "file nr. $i"; | |
93 | print " state ", $uu->state; | |
94 | print " mode ", $uu->mode; | |
95 | print " uudet ", strencoding $uu->uudet; | |
96 | print " size ", $uu->size; | |
97 | print " filename ", $uu->filename; | |
98 | print " subfname ", $uu->subfname; | |
99 | print " mimeid ", $uu->mimeid; | |
100 | print " mimetype ", $uu->mimetype; | |
101 | print "\n"; | |
93 | for my $uu (GetFileList) { | |
94 | print "file ", $uu->filename, "\n"; | |
95 | print " state ", $uu->state, "\n"; | |
96 | print " mode ", $uu->mode, "\n"; | |
97 | print " uudet ", strencoding $uu->uudet, "\n"; | |
98 | print " size ", $uu->size, "\n"; | |
99 | print " subfname ", $uu->subfname, "\n"; | |
100 | print " mimeid ", $uu->mimeid, "\n"; | |
101 | print " mimetype ", $uu->mimetype, "\n"; | |
102 | 102 | |
103 | 103 | # print additional info about all parts |
104 | print " parts"; | |
104 | 105 | for ($uu->parts) { |
105 | while (my ($k, $v) = each %$_) { | |
106 | print "$k > $v, "; | |
106 | for my $k (sort keys %$_) { | |
107 | print " $k=$_->{$k}"; | |
107 | 108 | } |
108 | 109 | print "\n"; |
109 | 110 | } |
110 | 111 | |
111 | print $uu->filename; | |
112 | ||
113 | 112 | $uu->remove_temp; |
114 | 113 | |
115 | print "<s", $uu->state, ">";#d# | |
116 | 114 | if (my $err = $uu->decode) { |
117 | print ", ", strerror $err, "\n"; | |
115 | print " ERROR ", strerror $err, "\n"; | |
118 | 116 | } else { |
119 | print ", saved as uudst/", $uu->filename, "\n"; | |
117 | print " successfully saved as uudst/", $uu->filename, "\n"; | |
120 | 118 | } |
121 | 119 | } |
122 | 120 |
0 | /* | |
1 | * Author: Marc A. Lehmann <xsthreadpool@schmorp.de> | |
2 | * License: public domain, or where this is not possible/at your option, | |
3 | * CC0 (https://creativecommons.org/publicdomain/zero/1.0/) | |
4 | * | |
5 | * Full documentation can be found at http://perlmulticore.schmorp.de/ | |
6 | * The newest version of this header can be downloaded from | |
7 | * http://perlmulticore.schmorp.de/perlmulticore.h | |
8 | */ | |
9 | ||
10 | #ifndef PERL_MULTICORE_H | |
11 | #define PERL_MULTICORE_H | |
12 | ||
13 | /* | |
14 | ||
15 | =head1 NAME | |
16 | ||
17 | perlmulticore.h - implements the Perl Multicore Specification | |
18 | ||
19 | =head1 SYNOPSIS | |
20 | ||
21 | #include "perlmulticore.h" | |
22 | ||
23 | // in your XS function: | |
24 | ||
25 | perlinterp_release (); | |
26 | do_the_C_thing (); | |
27 | perlinterp_acquire (); | |
28 | ||
29 | // optional, in BOOT section: | |
30 | ||
31 | perlmulticore_support (); | |
32 | ||
33 | =head1 DESCRIPTION | |
34 | ||
35 | This documentation is the abridged version of the full documention at | |
36 | L<http://perlmulticore.schmorp.de/>. It's recommended to go there instead | |
37 | of reading this document. | |
38 | ||
39 | This header file implements a very low overhead (both in code and runtime) | |
40 | mechanism for XS modules to allow re-use of the perl interpreter for other | |
41 | threads while doing some lengthy operation, such as cryptography, SQL | |
42 | queries, disk I/O and so on. | |
43 | ||
44 | The newest version of the header file itself, can be downloaded from | |
45 | L<http://perlmulticore.schmorp.de/perlmulticore.h>. | |
46 | ||
47 | =head1 HOW DO I USE THIS IN MY MODULES? | |
48 | ||
49 | The usage is very simple - you include this header file in your XS module. Then, before you | |
50 | do your lengthy operation, you release the perl interpreter: | |
51 | ||
52 | perlinterp_release (); | |
53 | ||
54 | And when you are done with your computation, you acquire it again: | |
55 | ||
56 | perlinterp_acquire (); | |
57 | ||
58 | And that's it. This doesn't load any modules and consists of only a few | |
59 | machine instructions when no module to take advantage of it is loaded. | |
60 | ||
61 | More documentation and examples can be found at the perl multicore site at | |
62 | L<http://perlmulticore.schmorp.de>. | |
63 | ||
64 | =head1 THE HARD AND FAST RULES | |
65 | ||
66 | As with everything, there are a number of rules to follow. | |
67 | ||
68 | =over 4 | |
69 | ||
70 | =item I<Never> touch any perl data structures after calling C<perlinterp_release>. | |
71 | ||
72 | Anything perl is completely off-limits after C<perlinterp_release>, until | |
73 | you call C<perlinterp_acquire>, after which you can access perl stuff | |
74 | again. | |
75 | ||
76 | That includes anything in the perl interpreter that you didn't prove to be | |
77 | safe, and didn't prove to be safe in older and future versions of perl: | |
78 | global variables, local perl scalars, even if you are sure nobody accesses | |
79 | them and you only try to "read" their value. | |
80 | ||
81 | =item I<Always> call C<perlinterp_release> and C<perlinterp_acquire> in pairs. | |
82 | ||
83 | For each C<perlinterp_release> call there must be a C<perlinterp_acquire> | |
84 | call. They don't have to be in the same function, and you can have | |
85 | multiple calls to them, as long as every C<perlinterp_release> call is | |
86 | followed by exactly one C<perlinterp_acquire> call at runtime. | |
87 | ||
88 | =item I<Never> nest calls to C<perlinterp_release> and C<perlinterp_acquire>. | |
89 | ||
90 | That simply means that after calling C<perlinterp_release>, you must | |
91 | call C<perlinterp_acquire> before calling C<perlinterp_release> | |
92 | again. Likewise, after C<perlinterp_acquire>, you can call | |
93 | C<perlinterp_release> but not another C<perlinterp_acquire>. | |
94 | ||
95 | =item I<Always> call C<perlinterp_release> first. | |
96 | ||
97 | You I<must not> call C<perlinterp_acquire> without having called | |
98 | C<perlinterp_release> before. | |
99 | ||
100 | =item I<Never> underestimate threads. | |
101 | ||
102 | While it's easy to add parallel execution ability to your XS module, it | |
103 | doesn't mean it is safe. After you release the perl interpreter, it's | |
104 | perfectly possible that it will call your XS function in another thread, | |
105 | even while your original function still executes. In other words: your C | |
106 | code must be thread safe, and if you use any library, that library must be | |
107 | thread-safe, too. | |
108 | ||
109 | Always assume that the code between C<perlinterp_release> and | |
110 | C<perlinterp_acquire> is executed in parallel on multiple CPUs at the same | |
111 | time. | |
112 | ||
113 | =back | |
114 | ||
115 | ||
116 | =head1 DISABLING PERL MULTICORE AT COMPILE TIME | |
117 | ||
118 | You can disable the complete perl multicore API by defining the | |
119 | symbol C<PERL_MULTICORE_DISABLE> to C<1> (e.g. by specifying | |
120 | F<-DPERL_MULTICORE_DISABLE> as compiler argument). | |
121 | ||
122 | This could be added to perl's C<CPPFLAGS> when configuring perl on | |
123 | platforms that do not support threading at all for example. | |
124 | ||
125 | ||
126 | =head1 ADVERTISING MULTICORE API SUPPORT | |
127 | ||
128 | To help users find out whether a particular build of your module is, in | |
129 | fact, multicore enabled, you can invoke the C<perlmulticore_support> | |
130 | macro in your C<BOOT:> section, e.g.: | |
131 | ||
132 | ||
133 | MODULE = My::Mod PACKAGE = My::Mod::Pkg | |
134 | ||
135 | BOOT: | |
136 | perlmulticore_support (); | |
137 | ||
138 | What this does is set the C<$My::Mod::PERLMULTICORE_SUPPORT> variable to | |
139 | the major API version * 1000 + minor version, for example, version C<1002> | |
140 | introduced this feature. | |
141 | ||
142 | For this to work, the C<cv> parameter passed to C<BOOT:> must still be | |
143 | in scope. To ensure this, either invoke the macro early in your C<BOOT:> | |
144 | section, or don't declare a local variable called C<cv>, either of which | |
145 | should be easy to do. | |
146 | ||
147 | Note that this is I<optional>, so you don't have to do that. | |
148 | ||
149 | ||
150 | =head1 AUTHOR | |
151 | ||
152 | Marc A. Lehmann <perlmulticore@schmorp.de> | |
153 | http://perlmulticore.schmorp.de/ | |
154 | ||
155 | =head1 LICENSE | |
156 | ||
157 | The F<perlmulticore.h> header file is put into the public | |
158 | domain. Where this is legally not possible, or at your | |
159 | option, it can be licensed under creativecommons CC0 | |
160 | license: L<https://creativecommons.org/publicdomain/zero/1.0/>. | |
161 | ||
162 | =cut | |
163 | ||
164 | */ | |
165 | ||
166 | /* version history | |
167 | * 1.1 (1001) 2015-07-03: initial release. | |
168 | * 1.2 (1002) 2019-03-03: introduce optional perlmulticore_support macro. | |
169 | */ | |
170 | #define PERL_MULTICORE_MAJOR 1 /* bumped on incompatible changes */ | |
171 | #define PERL_MULTICORE_MINOR 2 /* bumped on every change */ | |
172 | ||
173 | #if PERL_MULTICORE_DISABLE | |
174 | ||
175 | #define perlinterp_release() do { } while (0) | |
176 | #define perlinterp_acquire() do { } while (0) | |
177 | #define perlmulticore_support() do { } while (0) | |
178 | ||
179 | #else | |
180 | ||
181 | START_EXTERN_C | |
182 | ||
183 | /* this struct is shared between all modules, and currently */ | |
184 | /* contain only the two function pointers for release/acquire */ | |
185 | struct perl_multicore_api | |
186 | { | |
187 | void (*pmapi_release)(void); | |
188 | void (*pmapi_acquire)(void); | |
189 | }; | |
190 | ||
191 | static void perl_multicore_init (void); | |
192 | ||
193 | static const struct perl_multicore_api perl_multicore_api_init | |
194 | = { perl_multicore_init, 0 }; | |
195 | ||
196 | static struct perl_multicore_api *perl_multicore_api | |
197 | = (struct perl_multicore_api *)&perl_multicore_api_init; | |
198 | ||
199 | #define perlinterp_release() perl_multicore_api->pmapi_release () | |
200 | #define perlinterp_acquire() perl_multicore_api->pmapi_acquire () | |
201 | ||
202 | /* this is the release/acquire implementation used as fallback */ | |
203 | static void | |
204 | perl_multicore_nop (void) | |
205 | { | |
206 | } | |
207 | ||
208 | static const char perl_multicore_api_key[] = "perl_multicore_api"; | |
209 | ||
210 | /* this is the initial implementation of "release" - it initialises */ | |
211 | /* the api and then calls the real release function */ | |
212 | static void | |
213 | perl_multicore_init (void) | |
214 | { | |
215 | dTHX; | |
216 | ||
217 | /* check for existing API struct in PL_modglobal */ | |
218 | SV **api_svp = hv_fetch (PL_modglobal, perl_multicore_api_key, | |
219 | sizeof (perl_multicore_api_key) - 1, 1); | |
220 | ||
221 | if (SvPOKp (*api_svp)) | |
222 | perl_multicore_api = (struct perl_multicore_api *)SvPVX (*api_svp); /* we have one, use the existing one */ | |
223 | else | |
224 | { | |
225 | /* create a new one with a dummy nop implementation */ | |
226 | #ifdef NEWSV | |
227 | SV *api_sv = NEWSV (0, sizeof (*perl_multicore_api)); | |
228 | #else | |
229 | SV *api_sv = newSV ( sizeof (*perl_multicore_api)); | |
230 | #endif | |
231 | SvCUR_set (api_sv, sizeof (*perl_multicore_api)); | |
232 | SvPOK_only (api_sv); | |
233 | perl_multicore_api = (struct perl_multicore_api *)SvPVX (api_sv); | |
234 | perl_multicore_api->pmapi_release = | |
235 | perl_multicore_api->pmapi_acquire = perl_multicore_nop; | |
236 | *api_svp = api_sv; | |
237 | } | |
238 | ||
239 | /* call the real (or dummy) implementation now */ | |
240 | perlinterp_release (); | |
241 | } | |
242 | ||
243 | #define perlmulticore_support() \ | |
244 | sv_setiv (get_sv ( \ | |
245 | form ("%s::PERLMULTICORE_SUPPORT", HvNAME (GvSTASH (CvGV (cv)))), \ | |
246 | GV_ADD | GV_ADDMULTI), \ | |
247 | PERL_MULTICORE_MAJOR * 1000 + PERL_MULTICORE_MINOR); \ | |
248 | ||
249 | END_EXTERN_C | |
250 | ||
251 | #endif | |
252 | ||
253 | #endif | |
254 |
2 | 2 | INPUT |
3 | 3 | |
4 | 4 | T_UULIST |
5 | if (sv_derived_from($arg, \"Convert::UUlib::Item\")) { | |
6 | IV tmp = SvIV((SV*)SvRV($arg)); | |
7 | $var = ($type) tmp; | |
5 | if (sv_derived_from ($arg, \"Convert::UUlib::Item\")) { | |
6 | IV tmp = SvIV ((SV*)SvRV ($arg)); | |
7 | $var = ($type)tmp; | |
8 | 8 | } |
9 | 9 | else |
10 | croak(\"$var is not of type Convert::UUlib::Item\") | |
10 | croak (\"$var is not of type Convert::UUlib::Item\") | |
11 | 11 | |
12 | 12 | OUTPUT |
13 | 13 | |
14 | 14 | T_UULIST |
15 | sv_setref_pv($arg, \"Convert::UUlib::Item\", (void*)$var); | |
15 | sv_setref_pv ($arg, \"Convert::UUlib::Item\", (void*)$var); |
74 | 74 | .c.o: |
75 | 75 | $(CC) -c $(CFLAGS) $(VDEF) $< |
76 | 76 | |
77 | uuencode.o: uuencode.c uudeview.h uuint.h uustring.h fptools.h config.h | |
78 | uulib.o: uulib.c uudeview.h uuint.h uustring.h fptools.h config.h safealloc.c | |
79 | uunconc.o: uunconc.c uudeview.h uuint.h uustring.h fptools.h config.h | |
80 | uucheck.o: uucheck.c uudeview.h uuint.h uustring.h fptools.h config.h | |
81 | uuutil.o: uuutil.c uudeview.h uuint.h uustring.h fptools.h config.h | |
82 | uuscan.o: uuutil.c uudeview.h uuint.h uustring.h fptools.h config.h | |
83 | uustring.o: uustring.c uudeview.h uuint.h uustring.h config.h | |
84 | fptools.o: fptools.c fptools.h config.h | |
77 | uuencode.o: uuencode.c uudeview.h uuint.h uustring.h fptools.h config.h ecb.h | |
78 | uulib.o: uulib.c uudeview.h uuint.h uustring.h fptools.h config.h safealloc.c ecb.h | |
79 | uunconc.o: uunconc.c uudeview.h uuint.h uustring.h fptools.h config.h ecb.h | |
80 | uucheck.o: uucheck.c uudeview.h uuint.h uustring.h fptools.h config.h ecb.h | |
81 | uuutil.o: uuutil.c uudeview.h uuint.h uustring.h fptools.h config.h ecb.h | |
82 | uuscan.o: uuutil.c uudeview.h uuint.h uustring.h fptools.h config.h ecb.h | |
83 | uustring.o: uustring.c uudeview.h uuint.h uustring.h config.h ecb.h | |
84 | fptools.o: fptools.c fptools.h config.h ecb.h | |
85 | crc32.o: ecb.h | |
85 | 86 | |
86 | 87 | uustring.h: uustring.c |
87 | 88 | awk -f uustring.awk < uustring.c > uustring.h |
47 | 47 | #undef HAVE_MKSTEMP |
48 | 48 | |
49 | 49 | /* |
50 | * Replacement functions. | |
51 | * #define strerror _FP_strerror | |
52 | * #define tempnam _FP_tempnam | |
53 | * if you don't have these functions | |
54 | */ | |
55 | #undef strerror | |
56 | #undef tempnam | |
57 | ||
58 | /* | |
59 | 50 | * your mailing program. full path and the necessary parameters. |
60 | 51 | * the recepient address is added to the command line (with a leading |
61 | 52 | * space) without any further options |
62 | 53 | */ |
63 | 54 | #undef PROG_MAILER |
64 | 55 | |
65 | /* | |
56 | /* | |
66 | 57 | * define if the mailer needs to have the subject set on the command |
67 | 58 | * line with -s "Subject". Preferredly, we send the subject as a header. |
68 | 59 | */ |
69 | 60 | #undef MAILER_NEEDS_SUBJECT |
70 | 61 | |
71 | /* | |
62 | /* | |
72 | 63 | * define if posting is enabled. Do not edit. |
73 | 64 | */ |
74 | 65 | #undef HAVE_NEWS |
0 | /* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ | |
0 | /* config.h.in. Generated from configure.in by autoheader. */ | |
1 | 1 | |
2 | /* Define to `unsigned' if <sys/types.h> doesn't define. */ | |
3 | #undef size_t | |
4 | ||
5 | /* Define if you have the ANSI C header files. */ | |
6 | #undef STDC_HEADERS | |
7 | ||
8 | /* Define if you can safely include both <sys/time.h> and <time.h>. */ | |
9 | #undef TIME_WITH_SYS_TIME | |
2 | /* | |
3 | * needed for auto configuration | |
4 | * $Id$ | |
5 | */ | |
10 | 6 | |
11 | 7 | /* |
12 | 8 | * If your system is kinda special |
52 | 48 | #undef HAVE_MKSTEMP |
53 | 49 | |
54 | 50 | /* |
55 | * Replacement functions. | |
56 | * #define strerror _FP_strerror | |
57 | * #define tempnam _FP_tempnam | |
58 | * if you don't have these functions | |
51 | * your mailing program. full path and the necessary parameters. | |
52 | * the recepient address is added to the command line (with a leading | |
53 | * space) without any further options | |
59 | 54 | */ |
60 | #undef strerror | |
61 | #undef tempnam | |
55 | #undef PROG_MAILER | |
62 | 56 | |
63 | /* Define if you have the fgetc_unlocked function. */ | |
64 | #undef HAVE_FGETC_UNLOCKED | |
57 | /* | |
58 | * define if the mailer needs to have the subject set on the command | |
59 | * line with -s "Subject". Preferredly, we send the subject as a header. | |
60 | */ | |
61 | #undef MAILER_NEEDS_SUBJECT | |
65 | 62 | |
66 | /* Define if you have the gettimeofday function. */ | |
63 | /* | |
64 | * define if posting is enabled. Do not edit. | |
65 | */ | |
66 | #undef HAVE_NEWS | |
67 | ||
68 | /* | |
69 | * your local news posting program. full path and parameters, so that | |
70 | * the article and all its headers are read from stdin | |
71 | */ | |
72 | #undef PROG_INEWS | |
73 | ||
74 | ||
75 | /* Define to 1 if you have the `chmod' function. */ | |
76 | #undef HAVE_CHMOD | |
77 | ||
78 | /* Define to 1 if you have the <errno.h> header file. */ | |
79 | #undef HAVE_ERRNO_H | |
80 | ||
81 | /* Define to 1 if you have the <fcntl.h> header file. */ | |
82 | #undef HAVE_FCNTL_H | |
83 | ||
84 | /* Define to 1 if you have the `feof_unlocked' function. */ | |
85 | #undef HAVE_FEOF_UNLOCKED | |
86 | ||
87 | /* Define to 1 if you have the `ferror_unlocked' function. */ | |
88 | #undef HAVE_FERROR_UNLOCKED | |
89 | ||
90 | /* Define to 1 if you have the `flockfile' function. */ | |
91 | #undef HAVE_FLOCKFILE | |
92 | ||
93 | /* Define to 1 if you have the `getc_unlocked' function. */ | |
94 | #undef HAVE_GETC_UNLOCKED | |
95 | ||
96 | /* Define to 1 if you have the `gettimeofday' function. */ | |
67 | 97 | #undef HAVE_GETTIMEOFDAY |
68 | 98 | |
69 | /* Define if you have the strcasecmp function. */ | |
70 | #undef HAVE_STRCASECMP | |
99 | /* Define to 1 if you have the <inttypes.h> header file. */ | |
100 | #undef HAVE_INTTYPES_H | |
71 | 101 | |
72 | /* Define if you have the strcasestr function. */ | |
73 | #undef HAVE_STRCASESTR | |
74 | ||
75 | /* Define if you have the strncasecmp function. */ | |
76 | #undef HAVE_STRNCASECMP | |
77 | ||
78 | /* Define if you have the <errno.h> header file. */ | |
79 | #undef HAVE_ERRNO_H | |
80 | ||
81 | /* Define if you have the <fcntl.h> header file. */ | |
82 | #undef HAVE_FCNTL_H | |
83 | ||
84 | /* Define if you have the <io.h> header file. */ | |
102 | /* Define to 1 if you have the <io.h> header file. */ | |
85 | 103 | #undef HAVE_IO_H |
86 | 104 | |
87 | /* Define if you have the <malloc.h> header file. */ | |
105 | /* Define to 1 if you have the <malloc.h> header file. */ | |
88 | 106 | #undef HAVE_MALLOC_H |
89 | 107 | |
90 | /* Define if you have the <memory.h> header file. */ | |
108 | /* Define to 1 if you have the <memory.h> header file. */ | |
91 | 109 | #undef HAVE_MEMORY_H |
92 | 110 | |
93 | /* Define if you have the <stdarg.h> header file. */ | |
94 | #undef HAVE_STDARG_H | |
111 | /* Define to 1 if you have the `mkstemp' function. */ | |
112 | #undef HAVE_MKSTEMP | |
95 | 113 | |
96 | /* Define if you have the <sys/time.h> header file. */ | |
114 | /* Define to 1 if you have the <stdint.h> header file. */ | |
115 | #undef HAVE_STDINT_H | |
116 | ||
117 | /* Define to 1 if you have the <stdlib.h> header file. */ | |
118 | #undef HAVE_STDLIB_H | |
119 | ||
120 | /* Define to 1 if you have the <strings.h> header file. */ | |
121 | #undef HAVE_STRINGS_H | |
122 | ||
123 | /* Define to 1 if you have the <string.h> header file. */ | |
124 | #undef HAVE_STRING_H | |
125 | ||
126 | /* Define to 1 if you have the <sys/stat.h> header file. */ | |
127 | #undef HAVE_SYS_STAT_H | |
128 | ||
129 | /* Define to 1 if you have the <sys/time.h> header file. */ | |
97 | 130 | #undef HAVE_SYS_TIME_H |
98 | 131 | |
99 | /* Define if you have the <unistd.h> header file. */ | |
132 | /* Define to 1 if you have the <sys/types.h> header file. */ | |
133 | #undef HAVE_SYS_TYPES_H | |
134 | ||
135 | /* Define to 1 if you have the `tempnam' function. */ | |
136 | #undef HAVE_TEMPNAM | |
137 | ||
138 | /* Define to 1 if you have the `umask' function. */ | |
139 | #undef HAVE_UMASK | |
140 | ||
141 | /* Define to 1 if you have the <unistd.h> header file. */ | |
100 | 142 | #undef HAVE_UNISTD_H |
101 | 143 | |
102 | /* Define if you have the <varargs.h> header file. */ | |
103 | #undef HAVE_VARARGS_H | |
144 | /* Define to the address where bug reports for this package should be sent. */ | |
145 | #undef PACKAGE_BUGREPORT | |
146 | ||
147 | /* Define to the full name of this package. */ | |
148 | #undef PACKAGE_NAME | |
149 | ||
150 | /* Define to the full name and version of this package. */ | |
151 | #undef PACKAGE_STRING | |
152 | ||
153 | /* Define to the one symbol short name of this package. */ | |
154 | #undef PACKAGE_TARNAME | |
155 | ||
156 | /* Define to the home page for this package. */ | |
157 | #undef PACKAGE_URL | |
158 | ||
159 | /* Define to the version of this package. */ | |
160 | #undef PACKAGE_VERSION | |
161 | ||
162 | /* Define to 1 if you have the ANSI C header files. */ | |
163 | #undef STDC_HEADERS | |
164 | ||
165 | /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ | |
166 | #undef TIME_WITH_SYS_TIME | |
167 | ||
168 | /* Define to `unsigned int' if <sys/types.h> does not define. */ | |
169 | #undef size_t |
0 | 0 | #! /bin/sh |
1 | ||
2 | 1 | # Guess values for system-dependent variables and create Makefiles. |
3 | # Generated automatically using autoconf version 2.13 | |
4 | # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. | |
2 | # Generated by GNU Autoconf 2.69. | |
3 | # | |
4 | # | |
5 | # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. | |
6 | # | |
5 | 7 | # |
6 | 8 | # This configure script is free software; the Free Software Foundation |
7 | 9 | # gives unlimited permission to copy, distribute and modify it. |
8 | ||
9 | # Defaults: | |
10 | ac_help= | |
10 | ## -------------------- ## | |
11 | ## M4sh Initialization. ## | |
12 | ## -------------------- ## | |
13 | ||
14 | # Be more Bourne compatible | |
15 | DUALCASE=1; export DUALCASE # for MKS sh | |
16 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : | |
17 | emulate sh | |
18 | NULLCMD=: | |
19 | # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which | |
20 | # is contrary to our usage. Disable this feature. | |
21 | alias -g '${1+"$@"}'='"$@"' | |
22 | setopt NO_GLOB_SUBST | |
23 | else | |
24 | case `(set -o) 2>/dev/null` in #( | |
25 | *posix*) : | |
26 | set -o posix ;; #( | |
27 | *) : | |
28 | ;; | |
29 | esac | |
30 | fi | |
31 | ||
32 | ||
33 | as_nl=' | |
34 | ' | |
35 | export as_nl | |
36 | # Printing a long string crashes Solaris 7 /usr/bin/printf. | |
37 | as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' | |
38 | as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo | |
39 | as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo | |
40 | # Prefer a ksh shell builtin over an external printf program on Solaris, | |
41 | # but without wasting forks for bash or zsh. | |
42 | if test -z "$BASH_VERSION$ZSH_VERSION" \ | |
43 | && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then | |
44 | as_echo='print -r --' | |
45 | as_echo_n='print -rn --' | |
46 | elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then | |
47 | as_echo='printf %s\n' | |
48 | as_echo_n='printf %s' | |
49 | else | |
50 | if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then | |
51 | as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' | |
52 | as_echo_n='/usr/ucb/echo -n' | |
53 | else | |
54 | as_echo_body='eval expr "X$1" : "X\\(.*\\)"' | |
55 | as_echo_n_body='eval | |
56 | arg=$1; | |
57 | case $arg in #( | |
58 | *"$as_nl"*) | |
59 | expr "X$arg" : "X\\(.*\\)$as_nl"; | |
60 | arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; | |
61 | esac; | |
62 | expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" | |
63 | ' | |
64 | export as_echo_n_body | |
65 | as_echo_n='sh -c $as_echo_n_body as_echo' | |
66 | fi | |
67 | export as_echo_body | |
68 | as_echo='sh -c $as_echo_body as_echo' | |
69 | fi | |
70 | ||
71 | # The user is always right. | |
72 | if test "${PATH_SEPARATOR+set}" != set; then | |
73 | PATH_SEPARATOR=: | |
74 | (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { | |
75 | (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || | |
76 | PATH_SEPARATOR=';' | |
77 | } | |
78 | fi | |
79 | ||
80 | ||
81 | # IFS | |
82 | # We need space, tab and new line, in precisely that order. Quoting is | |
83 | # there to prevent editors from complaining about space-tab. | |
84 | # (If _AS_PATH_WALK were called with IFS unset, it would disable word | |
85 | # splitting by setting IFS to empty value.) | |
86 | IFS=" "" $as_nl" | |
87 | ||
88 | # Find who we are. Look in the path if we contain no directory separator. | |
89 | as_myself= | |
90 | case $0 in #(( | |
91 | *[\\/]* ) as_myself=$0 ;; | |
92 | *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
93 | for as_dir in $PATH | |
94 | do | |
95 | IFS=$as_save_IFS | |
96 | test -z "$as_dir" && as_dir=. | |
97 | test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break | |
98 | done | |
99 | IFS=$as_save_IFS | |
100 | ||
101 | ;; | |
102 | esac | |
103 | # We did not find ourselves, most probably we were run as `sh COMMAND' | |
104 | # in which case we are not to be found in the path. | |
105 | if test "x$as_myself" = x; then | |
106 | as_myself=$0 | |
107 | fi | |
108 | if test ! -f "$as_myself"; then | |
109 | $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 | |
110 | exit 1 | |
111 | fi | |
112 | ||
113 | # Unset variables that we do not need and which cause bugs (e.g. in | |
114 | # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" | |
115 | # suppresses any "Segmentation fault" message there. '((' could | |
116 | # trigger a bug in pdksh 5.2.14. | |
117 | for as_var in BASH_ENV ENV MAIL MAILPATH | |
118 | do eval test x\${$as_var+set} = xset \ | |
119 | && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : | |
120 | done | |
121 | PS1='$ ' | |
122 | PS2='> ' | |
123 | PS4='+ ' | |
124 | ||
125 | # NLS nuisances. | |
126 | LC_ALL=C | |
127 | export LC_ALL | |
128 | LANGUAGE=C | |
129 | export LANGUAGE | |
130 | ||
131 | # CDPATH. | |
132 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | |
133 | ||
134 | # Use a proper internal environment variable to ensure we don't fall | |
135 | # into an infinite loop, continuously re-executing ourselves. | |
136 | if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then | |
137 | _as_can_reexec=no; export _as_can_reexec; | |
138 | # We cannot yet assume a decent shell, so we have to provide a | |
139 | # neutralization value for shells without unset; and this also | |
140 | # works around shells that cannot unset nonexistent variables. | |
141 | # Preserve -v and -x to the replacement shell. | |
142 | BASH_ENV=/dev/null | |
143 | ENV=/dev/null | |
144 | (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV | |
145 | case $- in # (((( | |
146 | *v*x* | *x*v* ) as_opts=-vx ;; | |
147 | *v* ) as_opts=-v ;; | |
148 | *x* ) as_opts=-x ;; | |
149 | * ) as_opts= ;; | |
150 | esac | |
151 | exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} | |
152 | # Admittedly, this is quite paranoid, since all the known shells bail | |
153 | # out after a failed `exec'. | |
154 | $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 | |
155 | as_fn_exit 255 | |
156 | fi | |
157 | # We don't want this to propagate to other subprocesses. | |
158 | { _as_can_reexec=; unset _as_can_reexec;} | |
159 | if test "x$CONFIG_SHELL" = x; then | |
160 | as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : | |
161 | emulate sh | |
162 | NULLCMD=: | |
163 | # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which | |
164 | # is contrary to our usage. Disable this feature. | |
165 | alias -g '\${1+\"\$@\"}'='\"\$@\"' | |
166 | setopt NO_GLOB_SUBST | |
167 | else | |
168 | case \`(set -o) 2>/dev/null\` in #( | |
169 | *posix*) : | |
170 | set -o posix ;; #( | |
171 | *) : | |
172 | ;; | |
173 | esac | |
174 | fi | |
175 | " | |
176 | as_required="as_fn_return () { (exit \$1); } | |
177 | as_fn_success () { as_fn_return 0; } | |
178 | as_fn_failure () { as_fn_return 1; } | |
179 | as_fn_ret_success () { return 0; } | |
180 | as_fn_ret_failure () { return 1; } | |
181 | ||
182 | exitcode=0 | |
183 | as_fn_success || { exitcode=1; echo as_fn_success failed.; } | |
184 | as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } | |
185 | as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } | |
186 | as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } | |
187 | if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : | |
188 | ||
189 | else | |
190 | exitcode=1; echo positional parameters were not saved. | |
191 | fi | |
192 | test x\$exitcode = x0 || exit 1 | |
193 | test -x / || exit 1" | |
194 | as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO | |
195 | as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO | |
196 | eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && | |
197 | test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 | |
198 | test \$(( 1 + 1 )) = 2 || exit 1" | |
199 | if (eval "$as_required") 2>/dev/null; then : | |
200 | as_have_required=yes | |
201 | else | |
202 | as_have_required=no | |
203 | fi | |
204 | if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : | |
205 | ||
206 | else | |
207 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
208 | as_found=false | |
209 | for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH | |
210 | do | |
211 | IFS=$as_save_IFS | |
212 | test -z "$as_dir" && as_dir=. | |
213 | as_found=: | |
214 | case $as_dir in #( | |
215 | /*) | |
216 | for as_base in sh bash ksh sh5; do | |
217 | # Try only shells that exist, to save several forks. | |
218 | as_shell=$as_dir/$as_base | |
219 | if { test -f "$as_shell" || test -f "$as_shell.exe"; } && | |
220 | { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : | |
221 | CONFIG_SHELL=$as_shell as_have_required=yes | |
222 | if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : | |
223 | break 2 | |
224 | fi | |
225 | fi | |
226 | done;; | |
227 | esac | |
228 | as_found=false | |
229 | done | |
230 | $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && | |
231 | { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : | |
232 | CONFIG_SHELL=$SHELL as_have_required=yes | |
233 | fi; } | |
234 | IFS=$as_save_IFS | |
235 | ||
236 | ||
237 | if test "x$CONFIG_SHELL" != x; then : | |
238 | export CONFIG_SHELL | |
239 | # We cannot yet assume a decent shell, so we have to provide a | |
240 | # neutralization value for shells without unset; and this also | |
241 | # works around shells that cannot unset nonexistent variables. | |
242 | # Preserve -v and -x to the replacement shell. | |
243 | BASH_ENV=/dev/null | |
244 | ENV=/dev/null | |
245 | (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV | |
246 | case $- in # (((( | |
247 | *v*x* | *x*v* ) as_opts=-vx ;; | |
248 | *v* ) as_opts=-v ;; | |
249 | *x* ) as_opts=-x ;; | |
250 | * ) as_opts= ;; | |
251 | esac | |
252 | exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} | |
253 | # Admittedly, this is quite paranoid, since all the known shells bail | |
254 | # out after a failed `exec'. | |
255 | $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 | |
256 | exit 255 | |
257 | fi | |
258 | ||
259 | if test x$as_have_required = xno; then : | |
260 | $as_echo "$0: This script requires a shell more modern than all" | |
261 | $as_echo "$0: the shells that I found on your system." | |
262 | if test x${ZSH_VERSION+set} = xset ; then | |
263 | $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" | |
264 | $as_echo "$0: be upgraded to zsh 4.3.4 or later." | |
265 | else | |
266 | $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, | |
267 | $0: including any error possibly output before this | |
268 | $0: message. Then install a modern shell, or manually run | |
269 | $0: the script under such a shell if you do have one." | |
270 | fi | |
271 | exit 1 | |
272 | fi | |
273 | fi | |
274 | fi | |
275 | SHELL=${CONFIG_SHELL-/bin/sh} | |
276 | export SHELL | |
277 | # Unset more variables known to interfere with behavior of common tools. | |
278 | CLICOLOR_FORCE= GREP_OPTIONS= | |
279 | unset CLICOLOR_FORCE GREP_OPTIONS | |
280 | ||
281 | ## --------------------- ## | |
282 | ## M4sh Shell Functions. ## | |
283 | ## --------------------- ## | |
284 | # as_fn_unset VAR | |
285 | # --------------- | |
286 | # Portably unset VAR. | |
287 | as_fn_unset () | |
288 | { | |
289 | { eval $1=; unset $1;} | |
290 | } | |
291 | as_unset=as_fn_unset | |
292 | ||
293 | # as_fn_set_status STATUS | |
294 | # ----------------------- | |
295 | # Set $? to STATUS, without forking. | |
296 | as_fn_set_status () | |
297 | { | |
298 | return $1 | |
299 | } # as_fn_set_status | |
300 | ||
301 | # as_fn_exit STATUS | |
302 | # ----------------- | |
303 | # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. | |
304 | as_fn_exit () | |
305 | { | |
306 | set +e | |
307 | as_fn_set_status $1 | |
308 | exit $1 | |
309 | } # as_fn_exit | |
310 | ||
311 | # as_fn_mkdir_p | |
312 | # ------------- | |
313 | # Create "$as_dir" as a directory, including parents if necessary. | |
314 | as_fn_mkdir_p () | |
315 | { | |
316 | ||
317 | case $as_dir in #( | |
318 | -*) as_dir=./$as_dir;; | |
319 | esac | |
320 | test -d "$as_dir" || eval $as_mkdir_p || { | |
321 | as_dirs= | |
322 | while :; do | |
323 | case $as_dir in #( | |
324 | *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( | |
325 | *) as_qdir=$as_dir;; | |
326 | esac | |
327 | as_dirs="'$as_qdir' $as_dirs" | |
328 | as_dir=`$as_dirname -- "$as_dir" || | |
329 | $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ | |
330 | X"$as_dir" : 'X\(//\)[^/]' \| \ | |
331 | X"$as_dir" : 'X\(//\)$' \| \ | |
332 | X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || | |
333 | $as_echo X"$as_dir" | | |
334 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ | |
335 | s//\1/ | |
336 | q | |
337 | } | |
338 | /^X\(\/\/\)[^/].*/{ | |
339 | s//\1/ | |
340 | q | |
341 | } | |
342 | /^X\(\/\/\)$/{ | |
343 | s//\1/ | |
344 | q | |
345 | } | |
346 | /^X\(\/\).*/{ | |
347 | s//\1/ | |
348 | q | |
349 | } | |
350 | s/.*/./; q'` | |
351 | test -d "$as_dir" && break | |
352 | done | |
353 | test -z "$as_dirs" || eval "mkdir $as_dirs" | |
354 | } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" | |
355 | ||
356 | ||
357 | } # as_fn_mkdir_p | |
358 | ||
359 | # as_fn_executable_p FILE | |
360 | # ----------------------- | |
361 | # Test if FILE is an executable regular file. | |
362 | as_fn_executable_p () | |
363 | { | |
364 | test -f "$1" && test -x "$1" | |
365 | } # as_fn_executable_p | |
366 | # as_fn_append VAR VALUE | |
367 | # ---------------------- | |
368 | # Append the text in VALUE to the end of the definition contained in VAR. Take | |
369 | # advantage of any shell optimizations that allow amortized linear growth over | |
370 | # repeated appends, instead of the typical quadratic growth present in naive | |
371 | # implementations. | |
372 | if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : | |
373 | eval 'as_fn_append () | |
374 | { | |
375 | eval $1+=\$2 | |
376 | }' | |
377 | else | |
378 | as_fn_append () | |
379 | { | |
380 | eval $1=\$$1\$2 | |
381 | } | |
382 | fi # as_fn_append | |
383 | ||
384 | # as_fn_arith ARG... | |
385 | # ------------------ | |
386 | # Perform arithmetic evaluation on the ARGs, and store the result in the | |
387 | # global $as_val. Take advantage of shells that can avoid forks. The arguments | |
388 | # must be portable across $(()) and expr. | |
389 | if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : | |
390 | eval 'as_fn_arith () | |
391 | { | |
392 | as_val=$(( $* )) | |
393 | }' | |
394 | else | |
395 | as_fn_arith () | |
396 | { | |
397 | as_val=`expr "$@" || test $? -eq 1` | |
398 | } | |
399 | fi # as_fn_arith | |
400 | ||
401 | ||
402 | # as_fn_error STATUS ERROR [LINENO LOG_FD] | |
403 | # ---------------------------------------- | |
404 | # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are | |
405 | # provided, also output the error to LOG_FD, referencing LINENO. Then exit the | |
406 | # script with STATUS, using 1 if that was 0. | |
407 | as_fn_error () | |
408 | { | |
409 | as_status=$1; test $as_status -eq 0 && as_status=1 | |
410 | if test "$4"; then | |
411 | as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
412 | $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 | |
413 | fi | |
414 | $as_echo "$as_me: error: $2" >&2 | |
415 | as_fn_exit $as_status | |
416 | } # as_fn_error | |
417 | ||
418 | if expr a : '\(a\)' >/dev/null 2>&1 && | |
419 | test "X`expr 00001 : '.*\(...\)'`" = X001; then | |
420 | as_expr=expr | |
421 | else | |
422 | as_expr=false | |
423 | fi | |
424 | ||
425 | if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then | |
426 | as_basename=basename | |
427 | else | |
428 | as_basename=false | |
429 | fi | |
430 | ||
431 | if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then | |
432 | as_dirname=dirname | |
433 | else | |
434 | as_dirname=false | |
435 | fi | |
436 | ||
437 | as_me=`$as_basename -- "$0" || | |
438 | $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ | |
439 | X"$0" : 'X\(//\)$' \| \ | |
440 | X"$0" : 'X\(/\)' \| . 2>/dev/null || | |
441 | $as_echo X/"$0" | | |
442 | sed '/^.*\/\([^/][^/]*\)\/*$/{ | |
443 | s//\1/ | |
444 | q | |
445 | } | |
446 | /^X\/\(\/\/\)$/{ | |
447 | s//\1/ | |
448 | q | |
449 | } | |
450 | /^X\/\(\/\).*/{ | |
451 | s//\1/ | |
452 | q | |
453 | } | |
454 | s/.*/./; q'` | |
455 | ||
456 | # Avoid depending upon Character Ranges. | |
457 | as_cr_letters='abcdefghijklmnopqrstuvwxyz' | |
458 | as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
459 | as_cr_Letters=$as_cr_letters$as_cr_LETTERS | |
460 | as_cr_digits='0123456789' | |
461 | as_cr_alnum=$as_cr_Letters$as_cr_digits | |
462 | ||
463 | ||
464 | as_lineno_1=$LINENO as_lineno_1a=$LINENO | |
465 | as_lineno_2=$LINENO as_lineno_2a=$LINENO | |
466 | eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && | |
467 | test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { | |
468 | # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) | |
469 | sed -n ' | |
470 | p | |
471 | /[$]LINENO/= | |
472 | ' <$as_myself | | |
473 | sed ' | |
474 | s/[$]LINENO.*/&-/ | |
475 | t lineno | |
476 | b | |
477 | :lineno | |
478 | N | |
479 | :loop | |
480 | s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ | |
481 | t loop | |
482 | s/-\n.*// | |
483 | ' >$as_me.lineno && | |
484 | chmod +x "$as_me.lineno" || | |
485 | { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } | |
486 | ||
487 | # If we had to re-execute with $CONFIG_SHELL, we're ensured to have | |
488 | # already done that, so ensure we don't try to do so again and fall | |
489 | # in an infinite loop. This has already happened in practice. | |
490 | _as_can_reexec=no; export _as_can_reexec | |
491 | # Don't try to exec as it changes $[0], causing all sort of problems | |
492 | # (the dirname of $[0] is not the place where we might find the | |
493 | # original and so on. Autoconf is especially sensitive to this). | |
494 | . "./$as_me.lineno" | |
495 | # Exit status is that of the last command. | |
496 | exit | |
497 | } | |
498 | ||
499 | ECHO_C= ECHO_N= ECHO_T= | |
500 | case `echo -n x` in #((((( | |
501 | -n*) | |
502 | case `echo 'xy\c'` in | |
503 | *c*) ECHO_T=' ';; # ECHO_T is single tab character. | |
504 | xy) ECHO_C='\c';; | |
505 | *) echo `echo ksh88 bug on AIX 6.1` > /dev/null | |
506 | ECHO_T=' ';; | |
507 | esac;; | |
508 | *) | |
509 | ECHO_N='-n';; | |
510 | esac | |
511 | ||
512 | rm -f conf$$ conf$$.exe conf$$.file | |
513 | if test -d conf$$.dir; then | |
514 | rm -f conf$$.dir/conf$$.file | |
515 | else | |
516 | rm -f conf$$.dir | |
517 | mkdir conf$$.dir 2>/dev/null | |
518 | fi | |
519 | if (echo >conf$$.file) 2>/dev/null; then | |
520 | if ln -s conf$$.file conf$$ 2>/dev/null; then | |
521 | as_ln_s='ln -s' | |
522 | # ... but there are two gotchas: | |
523 | # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. | |
524 | # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. | |
525 | # In both cases, we have to default to `cp -pR'. | |
526 | ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || | |
527 | as_ln_s='cp -pR' | |
528 | elif ln conf$$.file conf$$ 2>/dev/null; then | |
529 | as_ln_s=ln | |
530 | else | |
531 | as_ln_s='cp -pR' | |
532 | fi | |
533 | else | |
534 | as_ln_s='cp -pR' | |
535 | fi | |
536 | rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file | |
537 | rmdir conf$$.dir 2>/dev/null | |
538 | ||
539 | if mkdir -p . 2>/dev/null; then | |
540 | as_mkdir_p='mkdir -p "$as_dir"' | |
541 | else | |
542 | test -d ./-p && rmdir ./-p | |
543 | as_mkdir_p=false | |
544 | fi | |
545 | ||
546 | as_test_x='test -x' | |
547 | as_executable_p=as_fn_executable_p | |
548 | ||
549 | # Sed expression to map a string onto a valid CPP name. | |
550 | as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" | |
551 | ||
552 | # Sed expression to map a string onto a valid variable name. | |
553 | as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" | |
554 | ||
555 | ||
556 | test -n "$DJDIR" || exec 7<&0 </dev/null | |
557 | exec 6>&1 | |
558 | ||
559 | # Name of the host. | |
560 | # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, | |
561 | # so uname gets run too. | |
562 | ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` | |
563 | ||
564 | # | |
565 | # Initializations. | |
566 | # | |
11 | 567 | ac_default_prefix=/usr/local |
12 | # Any additions from configure.in: | |
13 | ac_help="$ac_help | |
14 | " | |
15 | ac_help="$ac_help | |
16 | " | |
568 | ac_clean_files= | |
569 | ac_config_libobj_dir=. | |
570 | LIBOBJS= | |
571 | cross_compiling=no | |
572 | subdirs= | |
573 | MFLAGS= | |
574 | MAKEFLAGS= | |
575 | ||
576 | # Identity of this package. | |
577 | PACKAGE_NAME= | |
578 | PACKAGE_TARNAME= | |
579 | PACKAGE_VERSION= | |
580 | PACKAGE_STRING= | |
581 | PACKAGE_BUGREPORT= | |
582 | PACKAGE_URL= | |
583 | ||
584 | ac_unique_file="uulib.c" | |
585 | # Factoring default headers for most tests. | |
586 | ac_includes_default="\ | |
587 | #include <stdio.h> | |
588 | #ifdef HAVE_SYS_TYPES_H | |
589 | # include <sys/types.h> | |
590 | #endif | |
591 | #ifdef HAVE_SYS_STAT_H | |
592 | # include <sys/stat.h> | |
593 | #endif | |
594 | #ifdef STDC_HEADERS | |
595 | # include <stdlib.h> | |
596 | # include <stddef.h> | |
597 | #else | |
598 | # ifdef HAVE_STDLIB_H | |
599 | # include <stdlib.h> | |
600 | # endif | |
601 | #endif | |
602 | #ifdef HAVE_STRING_H | |
603 | # if !defined STDC_HEADERS && defined HAVE_MEMORY_H | |
604 | # include <memory.h> | |
605 | # endif | |
606 | # include <string.h> | |
607 | #endif | |
608 | #ifdef HAVE_STRINGS_H | |
609 | # include <strings.h> | |
610 | #endif | |
611 | #ifdef HAVE_INTTYPES_H | |
612 | # include <inttypes.h> | |
613 | #endif | |
614 | #ifdef HAVE_STDINT_H | |
615 | # include <stdint.h> | |
616 | #endif | |
617 | #ifdef HAVE_UNISTD_H | |
618 | # include <unistd.h> | |
619 | #endif" | |
620 | ||
621 | ac_subst_vars='LTLIBOBJS | |
622 | LIBOBJS | |
623 | PATCH | |
624 | VERSION | |
625 | EGREP | |
626 | GREP | |
627 | RANLIB | |
628 | SET_MAKE | |
629 | CPP | |
630 | OBJEXT | |
631 | EXEEXT | |
632 | ac_ct_CC | |
633 | CPPFLAGS | |
634 | LDFLAGS | |
635 | CFLAGS | |
636 | CC | |
637 | target_alias | |
638 | host_alias | |
639 | build_alias | |
640 | LIBS | |
641 | ECHO_T | |
642 | ECHO_N | |
643 | ECHO_C | |
644 | DEFS | |
645 | mandir | |
646 | localedir | |
647 | libdir | |
648 | psdir | |
649 | pdfdir | |
650 | dvidir | |
651 | htmldir | |
652 | infodir | |
653 | docdir | |
654 | oldincludedir | |
655 | includedir | |
656 | runstatedir | |
657 | localstatedir | |
658 | sharedstatedir | |
659 | sysconfdir | |
660 | datadir | |
661 | datarootdir | |
662 | libexecdir | |
663 | sbindir | |
664 | bindir | |
665 | program_transform_name | |
666 | prefix | |
667 | exec_prefix | |
668 | PACKAGE_URL | |
669 | PACKAGE_BUGREPORT | |
670 | PACKAGE_STRING | |
671 | PACKAGE_VERSION | |
672 | PACKAGE_TARNAME | |
673 | PACKAGE_NAME | |
674 | PATH_SEPARATOR | |
675 | SHELL' | |
676 | ac_subst_files='' | |
677 | ac_user_opts=' | |
678 | enable_option_checking | |
679 | with_cc | |
680 | with_cflags | |
681 | ' | |
682 | ac_precious_vars='build_alias | |
683 | host_alias | |
684 | target_alias | |
685 | CC | |
686 | CFLAGS | |
687 | LDFLAGS | |
688 | LIBS | |
689 | CPPFLAGS | |
690 | CPP' | |
691 | ||
17 | 692 | |
18 | 693 | # Initialize some variables set by options. |
694 | ac_init_help= | |
695 | ac_init_version=false | |
696 | ac_unrecognized_opts= | |
697 | ac_unrecognized_sep= | |
19 | 698 | # The variables have the same names as the options, with |
20 | 699 | # dashes changed to underlines. |
21 | build=NONE | |
22 | cache_file=./config.cache | |
700 | cache_file=/dev/null | |
23 | 701 | exec_prefix=NONE |
24 | host=NONE | |
25 | 702 | no_create= |
26 | nonopt=NONE | |
27 | 703 | no_recursion= |
28 | 704 | prefix=NONE |
29 | 705 | program_prefix=NONE |
32 | 708 | silent= |
33 | 709 | site= |
34 | 710 | srcdir= |
35 | target=NONE | |
36 | 711 | verbose= |
37 | 712 | x_includes=NONE |
38 | 713 | x_libraries=NONE |
714 | ||
715 | # Installation directory options. | |
716 | # These are left unexpanded so users can "make install exec_prefix=/foo" | |
717 | # and all the variables that are supposed to be based on exec_prefix | |
718 | # by default will actually change. | |
719 | # Use braces instead of parens because sh, perl, etc. also accept them. | |
720 | # (The list follows the same order as the GNU Coding Standards.) | |
39 | 721 | bindir='${exec_prefix}/bin' |
40 | 722 | sbindir='${exec_prefix}/sbin' |
41 | 723 | libexecdir='${exec_prefix}/libexec' |
42 | datadir='${prefix}/share' | |
724 | datarootdir='${prefix}/share' | |
725 | datadir='${datarootdir}' | |
43 | 726 | sysconfdir='${prefix}/etc' |
44 | 727 | sharedstatedir='${prefix}/com' |
45 | 728 | localstatedir='${prefix}/var' |
46 | libdir='${exec_prefix}/lib' | |
729 | runstatedir='${localstatedir}/run' | |
47 | 730 | includedir='${prefix}/include' |
48 | 731 | oldincludedir='/usr/include' |
49 | infodir='${prefix}/info' | |
50 | mandir='${prefix}/man' | |
51 | ||
52 | # Initialize some other variables. | |
53 | subdirs= | |
54 | MFLAGS= MAKEFLAGS= | |
55 | SHELL=${CONFIG_SHELL-/bin/sh} | |
56 | # Maximum number of lines to put in a shell here document. | |
57 | ac_max_here_lines=12 | |
732 | docdir='${datarootdir}/doc/${PACKAGE}' | |
733 | infodir='${datarootdir}/info' | |
734 | htmldir='${docdir}' | |
735 | dvidir='${docdir}' | |
736 | pdfdir='${docdir}' | |
737 | psdir='${docdir}' | |
738 | libdir='${exec_prefix}/lib' | |
739 | localedir='${datarootdir}/locale' | |
740 | mandir='${datarootdir}/man' | |
58 | 741 | |
59 | 742 | ac_prev= |
743 | ac_dashdash= | |
60 | 744 | for ac_option |
61 | 745 | do |
62 | ||
63 | 746 | # If the previous option needs an argument, assign it. |
64 | 747 | if test -n "$ac_prev"; then |
65 | eval "$ac_prev=\$ac_option" | |
748 | eval $ac_prev=\$ac_option | |
66 | 749 | ac_prev= |
67 | 750 | continue |
68 | 751 | fi |
69 | 752 | |
70 | case "$ac_option" in | |
71 | -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; | |
72 | *) ac_optarg= ;; | |
753 | case $ac_option in | |
754 | *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; | |
755 | *=) ac_optarg= ;; | |
756 | *) ac_optarg=yes ;; | |
73 | 757 | esac |
74 | 758 | |
75 | 759 | # Accept the important Cygnus configure options, so we can diagnose typos. |
76 | 760 | |
77 | case "$ac_option" in | |
761 | case $ac_dashdash$ac_option in | |
762 | --) | |
763 | ac_dashdash=yes ;; | |
78 | 764 | |
79 | 765 | -bindir | --bindir | --bindi | --bind | --bin | --bi) |
80 | 766 | ac_prev=bindir ;; |
81 | 767 | -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) |
82 | bindir="$ac_optarg" ;; | |
768 | bindir=$ac_optarg ;; | |
83 | 769 | |
84 | 770 | -build | --build | --buil | --bui | --bu) |
85 | ac_prev=build ;; | |
771 | ac_prev=build_alias ;; | |
86 | 772 | -build=* | --build=* | --buil=* | --bui=* | --bu=*) |
87 | build="$ac_optarg" ;; | |
773 | build_alias=$ac_optarg ;; | |
88 | 774 | |
89 | 775 | -cache-file | --cache-file | --cache-fil | --cache-fi \ |
90 | 776 | | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) |
91 | 777 | ac_prev=cache_file ;; |
92 | 778 | -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ |
93 | 779 | | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) |
94 | cache_file="$ac_optarg" ;; | |
95 | ||
96 | -datadir | --datadir | --datadi | --datad | --data | --dat | --da) | |
780 | cache_file=$ac_optarg ;; | |
781 | ||
782 | --config-cache | -C) | |
783 | cache_file=config.cache ;; | |
784 | ||
785 | -datadir | --datadir | --datadi | --datad) | |
97 | 786 | ac_prev=datadir ;; |
98 | -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | |
99 | | --da=*) | |
100 | datadir="$ac_optarg" ;; | |
787 | -datadir=* | --datadir=* | --datadi=* | --datad=*) | |
788 | datadir=$ac_optarg ;; | |
789 | ||
790 | -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | |
791 | | --dataroo | --dataro | --datar) | |
792 | ac_prev=datarootdir ;; | |
793 | -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | |
794 | | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) | |
795 | datarootdir=$ac_optarg ;; | |
101 | 796 | |
102 | 797 | -disable-* | --disable-*) |
103 | ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` | |
798 | ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` | |
104 | 799 | # Reject names that are not valid shell variable names. |
105 | if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then | |
106 | { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } | |
107 | fi | |
108 | ac_feature=`echo $ac_feature| sed 's/-/_/g'` | |
109 | eval "enable_${ac_feature}=no" ;; | |
800 | expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | |
801 | as_fn_error $? "invalid feature name: $ac_useropt" | |
802 | ac_useropt_orig=$ac_useropt | |
803 | ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` | |
804 | case $ac_user_opts in | |
805 | *" | |
806 | "enable_$ac_useropt" | |
807 | "*) ;; | |
808 | *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" | |
809 | ac_unrecognized_sep=', ';; | |
810 | esac | |
811 | eval enable_$ac_useropt=no ;; | |
812 | ||
813 | -docdir | --docdir | --docdi | --doc | --do) | |
814 | ac_prev=docdir ;; | |
815 | -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) | |
816 | docdir=$ac_optarg ;; | |
817 | ||
818 | -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) | |
819 | ac_prev=dvidir ;; | |
820 | -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) | |
821 | dvidir=$ac_optarg ;; | |
110 | 822 | |
111 | 823 | -enable-* | --enable-*) |
112 | ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` | |
824 | ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` | |
113 | 825 | # Reject names that are not valid shell variable names. |
114 | if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then | |
115 | { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } | |
116 | fi | |
117 | ac_feature=`echo $ac_feature| sed 's/-/_/g'` | |
118 | case "$ac_option" in | |
119 | *=*) ;; | |
120 | *) ac_optarg=yes ;; | |
826 | expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | |
827 | as_fn_error $? "invalid feature name: $ac_useropt" | |
828 | ac_useropt_orig=$ac_useropt | |
829 | ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` | |
830 | case $ac_user_opts in | |
831 | *" | |
832 | "enable_$ac_useropt" | |
833 | "*) ;; | |
834 | *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" | |
835 | ac_unrecognized_sep=', ';; | |
121 | 836 | esac |
122 | eval "enable_${ac_feature}='$ac_optarg'" ;; | |
837 | eval enable_$ac_useropt=\$ac_optarg ;; | |
123 | 838 | |
124 | 839 | -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ |
125 | 840 | | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ |
128 | 843 | -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ |
129 | 844 | | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ |
130 | 845 | | --exec=* | --exe=* | --ex=*) |
131 | exec_prefix="$ac_optarg" ;; | |
846 | exec_prefix=$ac_optarg ;; | |
132 | 847 | |
133 | 848 | -gas | --gas | --ga | --g) |
134 | 849 | # Obsolete; use --with-gas. |
135 | 850 | with_gas=yes ;; |
136 | 851 | |
137 | -help | --help | --hel | --he) | |
138 | # Omit some internal or obsolete options to make the list less imposing. | |
139 | # This message is too long to be a string in the A/UX 3.1 sh. | |
140 | cat << EOF | |
141 | Usage: configure [options] [host] | |
142 | Options: [defaults in brackets after descriptions] | |
143 | Configuration: | |
144 | --cache-file=FILE cache test results in FILE | |
145 | --help print this message | |
146 | --no-create do not create output files | |
147 | --quiet, --silent do not print \`checking...' messages | |
148 | --version print the version of autoconf that created configure | |
149 | Directory and file names: | |
150 | --prefix=PREFIX install architecture-independent files in PREFIX | |
151 | [$ac_default_prefix] | |
152 | --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX | |
153 | [same as prefix] | |
154 | --bindir=DIR user executables in DIR [EPREFIX/bin] | |
155 | --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] | |
156 | --libexecdir=DIR program executables in DIR [EPREFIX/libexec] | |
157 | --datadir=DIR read-only architecture-independent data in DIR | |
158 | [PREFIX/share] | |
159 | --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] | |
160 | --sharedstatedir=DIR modifiable architecture-independent data in DIR | |
161 | [PREFIX/com] | |
162 | --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] | |
163 | --libdir=DIR object code libraries in DIR [EPREFIX/lib] | |
164 | --includedir=DIR C header files in DIR [PREFIX/include] | |
165 | --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] | |
166 | --infodir=DIR info documentation in DIR [PREFIX/info] | |
167 | --mandir=DIR man documentation in DIR [PREFIX/man] | |
168 | --srcdir=DIR find the sources in DIR [configure dir or ..] | |
169 | --program-prefix=PREFIX prepend PREFIX to installed program names | |
170 | --program-suffix=SUFFIX append SUFFIX to installed program names | |
171 | --program-transform-name=PROGRAM | |
172 | run sed PROGRAM on installed program names | |
173 | EOF | |
174 | cat << EOF | |
175 | Host type: | |
176 | --build=BUILD configure for building on BUILD [BUILD=HOST] | |
177 | --host=HOST configure for HOST [guessed] | |
178 | --target=TARGET configure for TARGET [TARGET=HOST] | |
179 | Features and packages: | |
180 | --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) | |
181 | --enable-FEATURE[=ARG] include FEATURE [ARG=yes] | |
182 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] | |
183 | --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) | |
184 | --x-includes=DIR X include files are in DIR | |
185 | --x-libraries=DIR X library files are in DIR | |
186 | EOF | |
187 | if test -n "$ac_help"; then | |
188 | echo "--enable and --with options recognized:$ac_help" | |
189 | fi | |
190 | exit 0 ;; | |
852 | -help | --help | --hel | --he | -h) | |
853 | ac_init_help=long ;; | |
854 | -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) | |
855 | ac_init_help=recursive ;; | |
856 | -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) | |
857 | ac_init_help=short ;; | |
191 | 858 | |
192 | 859 | -host | --host | --hos | --ho) |
193 | ac_prev=host ;; | |
860 | ac_prev=host_alias ;; | |
194 | 861 | -host=* | --host=* | --hos=* | --ho=*) |
195 | host="$ac_optarg" ;; | |
862 | host_alias=$ac_optarg ;; | |
863 | ||
864 | -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) | |
865 | ac_prev=htmldir ;; | |
866 | -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | |
867 | | --ht=*) | |
868 | htmldir=$ac_optarg ;; | |
196 | 869 | |
197 | 870 | -includedir | --includedir | --includedi | --included | --include \ |
198 | 871 | | --includ | --inclu | --incl | --inc) |
199 | 872 | ac_prev=includedir ;; |
200 | 873 | -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ |
201 | 874 | | --includ=* | --inclu=* | --incl=* | --inc=*) |
202 | includedir="$ac_optarg" ;; | |
875 | includedir=$ac_optarg ;; | |
203 | 876 | |
204 | 877 | -infodir | --infodir | --infodi | --infod | --info | --inf) |
205 | 878 | ac_prev=infodir ;; |
206 | 879 | -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) |
207 | infodir="$ac_optarg" ;; | |
880 | infodir=$ac_optarg ;; | |
208 | 881 | |
209 | 882 | -libdir | --libdir | --libdi | --libd) |
210 | 883 | ac_prev=libdir ;; |
211 | 884 | -libdir=* | --libdir=* | --libdi=* | --libd=*) |
212 | libdir="$ac_optarg" ;; | |
885 | libdir=$ac_optarg ;; | |
213 | 886 | |
214 | 887 | -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ |
215 | 888 | | --libexe | --libex | --libe) |
216 | 889 | ac_prev=libexecdir ;; |
217 | 890 | -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ |
218 | 891 | | --libexe=* | --libex=* | --libe=*) |
219 | libexecdir="$ac_optarg" ;; | |
892 | libexecdir=$ac_optarg ;; | |
893 | ||
894 | -localedir | --localedir | --localedi | --localed | --locale) | |
895 | ac_prev=localedir ;; | |
896 | -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) | |
897 | localedir=$ac_optarg ;; | |
220 | 898 | |
221 | 899 | -localstatedir | --localstatedir | --localstatedi | --localstated \ |
222 | | --localstate | --localstat | --localsta | --localst \ | |
223 | | --locals | --local | --loca | --loc | --lo) | |
900 | | --localstate | --localstat | --localsta | --localst | --locals) | |
224 | 901 | ac_prev=localstatedir ;; |
225 | 902 | -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ |
226 | | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | |
227 | | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) | |
228 | localstatedir="$ac_optarg" ;; | |
903 | | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) | |
904 | localstatedir=$ac_optarg ;; | |
229 | 905 | |
230 | 906 | -mandir | --mandir | --mandi | --mand | --man | --ma | --m) |
231 | 907 | ac_prev=mandir ;; |
232 | 908 | -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) |
233 | mandir="$ac_optarg" ;; | |
909 | mandir=$ac_optarg ;; | |
234 | 910 | |
235 | 911 | -nfp | --nfp | --nf) |
236 | 912 | # Obsolete; use --without-fp. |
237 | 913 | with_fp=no ;; |
238 | 914 | |
239 | 915 | -no-create | --no-create | --no-creat | --no-crea | --no-cre \ |
240 | | --no-cr | --no-c) | |
916 | | --no-cr | --no-c | -n) | |
241 | 917 | no_create=yes ;; |
242 | 918 | |
243 | 919 | -no-recursion | --no-recursion | --no-recursio | --no-recursi \ |
251 | 927 | -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ |
252 | 928 | | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ |
253 | 929 | | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) |
254 | oldincludedir="$ac_optarg" ;; | |
930 | oldincludedir=$ac_optarg ;; | |
255 | 931 | |
256 | 932 | -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) |
257 | 933 | ac_prev=prefix ;; |
258 | 934 | -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) |
259 | prefix="$ac_optarg" ;; | |
935 | prefix=$ac_optarg ;; | |
260 | 936 | |
261 | 937 | -program-prefix | --program-prefix | --program-prefi | --program-pref \ |
262 | 938 | | --program-pre | --program-pr | --program-p) |
263 | 939 | ac_prev=program_prefix ;; |
264 | 940 | -program-prefix=* | --program-prefix=* | --program-prefi=* \ |
265 | 941 | | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) |
266 | program_prefix="$ac_optarg" ;; | |
942 | program_prefix=$ac_optarg ;; | |
267 | 943 | |
268 | 944 | -program-suffix | --program-suffix | --program-suffi | --program-suff \ |
269 | 945 | | --program-suf | --program-su | --program-s) |
270 | 946 | ac_prev=program_suffix ;; |
271 | 947 | -program-suffix=* | --program-suffix=* | --program-suffi=* \ |
272 | 948 | | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) |
273 | program_suffix="$ac_optarg" ;; | |
949 | program_suffix=$ac_optarg ;; | |
274 | 950 | |
275 | 951 | -program-transform-name | --program-transform-name \ |
276 | 952 | | --program-transform-nam | --program-transform-na \ |
287 | 963 | | --program-transfo=* | --program-transf=* \ |
288 | 964 | | --program-trans=* | --program-tran=* \ |
289 | 965 | | --progr-tra=* | --program-tr=* | --program-t=*) |
290 | program_transform_name="$ac_optarg" ;; | |
966 | program_transform_name=$ac_optarg ;; | |
967 | ||
968 | -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) | |
969 | ac_prev=pdfdir ;; | |
970 | -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) | |
971 | pdfdir=$ac_optarg ;; | |
972 | ||
973 | -psdir | --psdir | --psdi | --psd | --ps) | |
974 | ac_prev=psdir ;; | |
975 | -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) | |
976 | psdir=$ac_optarg ;; | |
291 | 977 | |
292 | 978 | -q | -quiet | --quiet | --quie | --qui | --qu | --q \ |
293 | 979 | | -silent | --silent | --silen | --sile | --sil) |
294 | 980 | silent=yes ;; |
981 | ||
982 | -runstatedir | --runstatedir | --runstatedi | --runstated \ | |
983 | | --runstate | --runstat | --runsta | --runst | --runs \ | |
984 | | --run | --ru | --r) | |
985 | ac_prev=runstatedir ;; | |
986 | -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | |
987 | | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | |
988 | | --run=* | --ru=* | --r=*) | |
989 | runstatedir=$ac_optarg ;; | |
295 | 990 | |
296 | 991 | -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) |
297 | 992 | ac_prev=sbindir ;; |
298 | 993 | -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ |
299 | 994 | | --sbi=* | --sb=*) |
300 | sbindir="$ac_optarg" ;; | |
995 | sbindir=$ac_optarg ;; | |
301 | 996 | |
302 | 997 | -sharedstatedir | --sharedstatedir | --sharedstatedi \ |
303 | 998 | | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ |
308 | 1003 | | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ |
309 | 1004 | | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ |
310 | 1005 | | --sha=* | --sh=*) |
311 | sharedstatedir="$ac_optarg" ;; | |
1006 | sharedstatedir=$ac_optarg ;; | |
312 | 1007 | |
313 | 1008 | -site | --site | --sit) |
314 | 1009 | ac_prev=site ;; |
315 | 1010 | -site=* | --site=* | --sit=*) |
316 | site="$ac_optarg" ;; | |
1011 | site=$ac_optarg ;; | |
317 | 1012 | |
318 | 1013 | -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) |
319 | 1014 | ac_prev=srcdir ;; |
320 | 1015 | -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) |
321 | srcdir="$ac_optarg" ;; | |
1016 | srcdir=$ac_optarg ;; | |
322 | 1017 | |
323 | 1018 | -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ |
324 | 1019 | | --syscon | --sysco | --sysc | --sys | --sy) |
325 | 1020 | ac_prev=sysconfdir ;; |
326 | 1021 | -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ |
327 | 1022 | | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) |
328 | sysconfdir="$ac_optarg" ;; | |
1023 | sysconfdir=$ac_optarg ;; | |
329 | 1024 | |
330 | 1025 | -target | --target | --targe | --targ | --tar | --ta | --t) |
331 | ac_prev=target ;; | |
1026 | ac_prev=target_alias ;; | |
332 | 1027 | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) |
333 | target="$ac_optarg" ;; | |
1028 | target_alias=$ac_optarg ;; | |
334 | 1029 | |
335 | 1030 | -v | -verbose | --verbose | --verbos | --verbo | --verb) |
336 | 1031 | verbose=yes ;; |
337 | 1032 | |
338 | -version | --version | --versio | --versi | --vers) | |
339 | echo "configure generated by autoconf version 2.13" | |
340 | exit 0 ;; | |
1033 | -version | --version | --versio | --versi | --vers | -V) | |
1034 | ac_init_version=: ;; | |
341 | 1035 | |
342 | 1036 | -with-* | --with-*) |
343 | ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` | |
1037 | ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` | |
344 | 1038 | # Reject names that are not valid shell variable names. |
345 | if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then | |
346 | { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } | |
347 | fi | |
348 | ac_package=`echo $ac_package| sed 's/-/_/g'` | |
349 | case "$ac_option" in | |
350 | *=*) ;; | |
351 | *) ac_optarg=yes ;; | |
1039 | expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | |
1040 | as_fn_error $? "invalid package name: $ac_useropt" | |
1041 | ac_useropt_orig=$ac_useropt | |
1042 | ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` | |
1043 | case $ac_user_opts in | |
1044 | *" | |
1045 | "with_$ac_useropt" | |
1046 | "*) ;; | |
1047 | *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" | |
1048 | ac_unrecognized_sep=', ';; | |
352 | 1049 | esac |
353 | eval "with_${ac_package}='$ac_optarg'" ;; | |
1050 | eval with_$ac_useropt=\$ac_optarg ;; | |
354 | 1051 | |
355 | 1052 | -without-* | --without-*) |
356 | ac_package=`echo $ac_option|sed -e 's/-*without-//'` | |
1053 | ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` | |
357 | 1054 | # Reject names that are not valid shell variable names. |
358 | if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then | |
359 | { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } | |
360 | fi | |
361 | ac_package=`echo $ac_package| sed 's/-/_/g'` | |
362 | eval "with_${ac_package}=no" ;; | |
1055 | expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && | |
1056 | as_fn_error $? "invalid package name: $ac_useropt" | |
1057 | ac_useropt_orig=$ac_useropt | |
1058 | ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` | |
1059 | case $ac_user_opts in | |
1060 | *" | |
1061 | "with_$ac_useropt" | |
1062 | "*) ;; | |
1063 | *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" | |
1064 | ac_unrecognized_sep=', ';; | |
1065 | esac | |
1066 | eval with_$ac_useropt=no ;; | |
363 | 1067 | |
364 | 1068 | --x) |
365 | 1069 | # Obsolete; use --with-x. |
370 | 1074 | ac_prev=x_includes ;; |
371 | 1075 | -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ |
372 | 1076 | | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) |
373 | x_includes="$ac_optarg" ;; | |
1077 | x_includes=$ac_optarg ;; | |
374 | 1078 | |
375 | 1079 | -x-libraries | --x-libraries | --x-librarie | --x-librari \ |
376 | 1080 | | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) |
377 | 1081 | ac_prev=x_libraries ;; |
378 | 1082 | -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ |
379 | 1083 | | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) |
380 | x_libraries="$ac_optarg" ;; | |
381 | ||
382 | -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } | |
1084 | x_libraries=$ac_optarg ;; | |
1085 | ||
1086 | -*) as_fn_error $? "unrecognized option: \`$ac_option' | |
1087 | Try \`$0 --help' for more information" | |
383 | 1088 | ;; |
384 | 1089 | |
1090 | *=*) | |
1091 | ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` | |
1092 | # Reject names that are not valid shell variable names. | |
1093 | case $ac_envvar in #( | |
1094 | '' | [0-9]* | *[!_$as_cr_alnum]* ) | |
1095 | as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; | |
1096 | esac | |
1097 | eval $ac_envvar=\$ac_optarg | |
1098 | export $ac_envvar ;; | |
1099 | ||
385 | 1100 | *) |
386 | if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then | |
387 | echo "configure: warning: $ac_option: invalid host type" 1>&2 | |
388 | fi | |
389 | if test "x$nonopt" != xNONE; then | |
390 | { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } | |
391 | fi | |
392 | nonopt="$ac_option" | |
1101 | # FIXME: should be removed in autoconf 3.0. | |
1102 | $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 | |
1103 | expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && | |
1104 | $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 | |
1105 | : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" | |
393 | 1106 | ;; |
394 | 1107 | |
395 | 1108 | esac |
396 | 1109 | done |
397 | 1110 | |
398 | 1111 | if test -n "$ac_prev"; then |
399 | { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } | |
400 | fi | |
401 | ||
402 | trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 | |
403 | ||
404 | # File descriptor usage: | |
405 | # 0 standard input | |
406 | # 1 file creation | |
407 | # 2 errors and warnings | |
408 | # 3 some systems may open it to /dev/tty | |
409 | # 4 used on the Kubota Titan | |
410 | # 6 checking for... messages and results | |
411 | # 5 compiler messages saved in config.log | |
412 | if test "$silent" = yes; then | |
413 | exec 6>/dev/null | |
414 | else | |
415 | exec 6>&1 | |
416 | fi | |
417 | exec 5>./config.log | |
418 | ||
419 | echo "\ | |
420 | This file contains any messages produced by compilers while | |
421 | running configure, to aid debugging if configure makes a mistake. | |
422 | " 1>&5 | |
423 | ||
424 | # Strip out --no-create and --no-recursion so they do not pile up. | |
425 | # Also quote any args containing shell metacharacters. | |
426 | ac_configure_args= | |
427 | for ac_arg | |
1112 | ac_option=--`echo $ac_prev | sed 's/_/-/g'` | |
1113 | as_fn_error $? "missing argument to $ac_option" | |
1114 | fi | |
1115 | ||
1116 | if test -n "$ac_unrecognized_opts"; then | |
1117 | case $enable_option_checking in | |
1118 | no) ;; | |
1119 | fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; | |
1120 | *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; | |
1121 | esac | |
1122 | fi | |
1123 | ||
1124 | # Check all directory arguments for consistency. | |
1125 | for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ | |
1126 | datadir sysconfdir sharedstatedir localstatedir includedir \ | |
1127 | oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ | |
1128 | libdir localedir mandir runstatedir | |
428 | 1129 | do |
429 | case "$ac_arg" in | |
430 | -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | |
431 | | --no-cr | --no-c) ;; | |
432 | -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | |
433 | | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; | |
434 | *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) | |
435 | ac_configure_args="$ac_configure_args '$ac_arg'" ;; | |
436 | *) ac_configure_args="$ac_configure_args $ac_arg" ;; | |
1130 | eval ac_val=\$$ac_var | |
1131 | # Remove trailing slashes. | |
1132 | case $ac_val in | |
1133 | */ ) | |
1134 | ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` | |
1135 | eval $ac_var=\$ac_val;; | |
437 | 1136 | esac |
1137 | # Be sure to have absolute directory names. | |
1138 | case $ac_val in | |
1139 | [\\/$]* | ?:[\\/]* ) continue;; | |
1140 | NONE | '' ) case $ac_var in *prefix ) continue;; esac;; | |
1141 | esac | |
1142 | as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" | |
438 | 1143 | done |
439 | 1144 | |
440 | # NLS nuisances. | |
441 | # Only set these to C if already set. These must not be set unconditionally | |
442 | # because not all systems understand e.g. LANG=C (notably SCO). | |
443 | # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! | |
444 | # Non-C LC_CTYPE values break the ctype check. | |
445 | if test "${LANG+set}" = set; then LANG=C; export LANG; fi | |
446 | if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi | |
447 | if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi | |
448 | if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi | |
449 | ||
450 | # confdefs.h avoids OS command line length limits that DEFS can exceed. | |
451 | rm -rf conftest* confdefs.h | |
452 | # AIX cpp loses on an empty file, so make sure it contains at least a newline. | |
453 | echo > confdefs.h | |
454 | ||
455 | # A filename unique to this package, relative to the directory that | |
456 | # configure is in, which we can look for to find out if srcdir is correct. | |
457 | ac_unique_file=uulib.c | |
1145 | # There might be people who depend on the old broken behavior: `$host' | |
1146 | # used to hold the argument of --host etc. | |
1147 | # FIXME: To remove some day. | |
1148 | build=$build_alias | |
1149 | host=$host_alias | |
1150 | target=$target_alias | |
1151 | ||
1152 | # FIXME: To remove some day. | |
1153 | if test "x$host_alias" != x; then | |
1154 | if test "x$build_alias" = x; then | |
1155 | cross_compiling=maybe | |
1156 | elif test "x$build_alias" != "x$host_alias"; then | |
1157 | cross_compiling=yes | |
1158 | fi | |
1159 | fi | |
1160 | ||
1161 | ac_tool_prefix= | |
1162 | test -n "$host_alias" && ac_tool_prefix=$host_alias- | |
1163 | ||
1164 | test "$silent" = yes && exec 6>/dev/null | |
1165 | ||
1166 | ||
1167 | ac_pwd=`pwd` && test -n "$ac_pwd" && | |
1168 | ac_ls_di=`ls -di .` && | |
1169 | ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || | |
1170 | as_fn_error $? "working directory cannot be determined" | |
1171 | test "X$ac_ls_di" = "X$ac_pwd_ls_di" || | |
1172 | as_fn_error $? "pwd does not report name of working directory" | |
1173 | ||
458 | 1174 | |
459 | 1175 | # Find the source files, if location was not specified. |
460 | 1176 | if test -z "$srcdir"; then |
461 | 1177 | ac_srcdir_defaulted=yes |
462 | # Try the directory containing this script, then its parent. | |
463 | ac_prog=$0 | |
464 | ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` | |
465 | test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. | |
1178 | # Try the directory containing this script, then the parent directory. | |
1179 | ac_confdir=`$as_dirname -- "$as_myself" || | |
1180 | $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ | |
1181 | X"$as_myself" : 'X\(//\)[^/]' \| \ | |
1182 | X"$as_myself" : 'X\(//\)$' \| \ | |
1183 | X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || | |
1184 | $as_echo X"$as_myself" | | |
1185 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ | |
1186 | s//\1/ | |
1187 | q | |
1188 | } | |
1189 | /^X\(\/\/\)[^/].*/{ | |
1190 | s//\1/ | |
1191 | q | |
1192 | } | |
1193 | /^X\(\/\/\)$/{ | |
1194 | s//\1/ | |
1195 | q | |
1196 | } | |
1197 | /^X\(\/\).*/{ | |
1198 | s//\1/ | |
1199 | q | |
1200 | } | |
1201 | s/.*/./; q'` | |
466 | 1202 | srcdir=$ac_confdir |
467 | if test ! -r $srcdir/$ac_unique_file; then | |
1203 | if test ! -r "$srcdir/$ac_unique_file"; then | |
468 | 1204 | srcdir=.. |
469 | 1205 | fi |
470 | 1206 | else |
471 | 1207 | ac_srcdir_defaulted=no |
472 | 1208 | fi |
473 | if test ! -r $srcdir/$ac_unique_file; then | |
474 | if test "$ac_srcdir_defaulted" = yes; then | |
475 | { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } | |
476 | else | |
477 | { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } | |
1209 | if test ! -r "$srcdir/$ac_unique_file"; then | |
1210 | test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." | |
1211 | as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" | |
1212 | fi | |
1213 | ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" | |
1214 | ac_abs_confdir=`( | |
1215 | cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" | |
1216 | pwd)` | |
1217 | # When building in place, set srcdir=. | |
1218 | if test "$ac_abs_confdir" = "$ac_pwd"; then | |
1219 | srcdir=. | |
1220 | fi | |
1221 | # Remove unnecessary trailing slashes from srcdir. | |
1222 | # Double slashes in file names in object file debugging info | |
1223 | # mess up M-x gdb in Emacs. | |
1224 | case $srcdir in | |
1225 | */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; | |
1226 | esac | |
1227 | for ac_var in $ac_precious_vars; do | |
1228 | eval ac_env_${ac_var}_set=\${${ac_var}+set} | |
1229 | eval ac_env_${ac_var}_value=\$${ac_var} | |
1230 | eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} | |
1231 | eval ac_cv_env_${ac_var}_value=\$${ac_var} | |
1232 | done | |
1233 | ||
1234 | # | |
1235 | # Report the --help message. | |
1236 | # | |
1237 | if test "$ac_init_help" = "long"; then | |
1238 | # Omit some internal or obsolete options to make the list less imposing. | |
1239 | # This message is too long to be a string in the A/UX 3.1 sh. | |
1240 | cat <<_ACEOF | |
1241 | \`configure' configures this package to adapt to many kinds of systems. | |
1242 | ||
1243 | Usage: $0 [OPTION]... [VAR=VALUE]... | |
1244 | ||
1245 | To assign environment variables (e.g., CC, CFLAGS...), specify them as | |
1246 | VAR=VALUE. See below for descriptions of some of the useful variables. | |
1247 | ||
1248 | Defaults for the options are specified in brackets. | |
1249 | ||
1250 | Configuration: | |
1251 | -h, --help display this help and exit | |
1252 | --help=short display options specific to this package | |
1253 | --help=recursive display the short help of all the included packages | |
1254 | -V, --version display version information and exit | |
1255 | -q, --quiet, --silent do not print \`checking ...' messages | |
1256 | --cache-file=FILE cache test results in FILE [disabled] | |
1257 | -C, --config-cache alias for \`--cache-file=config.cache' | |
1258 | -n, --no-create do not create output files | |
1259 | --srcdir=DIR find the sources in DIR [configure dir or \`..'] | |
1260 | ||
1261 | Installation directories: | |
1262 | --prefix=PREFIX install architecture-independent files in PREFIX | |
1263 | [$ac_default_prefix] | |
1264 | --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX | |
1265 | [PREFIX] | |
1266 | ||
1267 | By default, \`make install' will install all the files in | |
1268 | \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify | |
1269 | an installation prefix other than \`$ac_default_prefix' using \`--prefix', | |
1270 | for instance \`--prefix=\$HOME'. | |
1271 | ||
1272 | For better control, use the options below. | |
1273 | ||
1274 | Fine tuning of the installation directories: | |
1275 | --bindir=DIR user executables [EPREFIX/bin] | |
1276 | --sbindir=DIR system admin executables [EPREFIX/sbin] | |
1277 | --libexecdir=DIR program executables [EPREFIX/libexec] | |
1278 | --sysconfdir=DIR read-only single-machine data [PREFIX/etc] | |
1279 | --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] | |
1280 | --localstatedir=DIR modifiable single-machine data [PREFIX/var] | |
1281 | --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] | |
1282 | --libdir=DIR object code libraries [EPREFIX/lib] | |
1283 | --includedir=DIR C header files [PREFIX/include] | |
1284 | --oldincludedir=DIR C header files for non-gcc [/usr/include] | |
1285 | --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] | |
1286 | --datadir=DIR read-only architecture-independent data [DATAROOTDIR] | |
1287 | --infodir=DIR info documentation [DATAROOTDIR/info] | |
1288 | --localedir=DIR locale-dependent data [DATAROOTDIR/locale] | |
1289 | --mandir=DIR man documentation [DATAROOTDIR/man] | |
1290 | --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] | |
1291 | --htmldir=DIR html documentation [DOCDIR] | |
1292 | --dvidir=DIR dvi documentation [DOCDIR] | |
1293 | --pdfdir=DIR pdf documentation [DOCDIR] | |
1294 | --psdir=DIR ps documentation [DOCDIR] | |
1295 | _ACEOF | |
1296 | ||
1297 | cat <<\_ACEOF | |
1298 | _ACEOF | |
1299 | fi | |
1300 | ||
1301 | if test -n "$ac_init_help"; then | |
1302 | ||
1303 | cat <<\_ACEOF | |
1304 | ||
1305 | Optional Packages: | |
1306 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] | |
1307 | --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) | |
1308 | ||
1309 | ||
1310 | Some influential environment variables: | |
1311 | CC C compiler command | |
1312 | CFLAGS C compiler flags | |
1313 | LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a | |
1314 | nonstandard directory <lib dir> | |
1315 | LIBS libraries to pass to the linker, e.g. -l<library> | |
1316 | CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if | |
1317 | you have headers in a nonstandard directory <include dir> | |
1318 | CPP C preprocessor | |
1319 | ||
1320 | Use these variables to override the choices made by `configure' or to help | |
1321 | it to find libraries and programs with nonstandard names/locations. | |
1322 | ||
1323 | Report bugs to the package provider. | |
1324 | _ACEOF | |
1325 | ac_status=$? | |
1326 | fi | |
1327 | ||
1328 | if test "$ac_init_help" = "recursive"; then | |
1329 | # If there are subdirs, report their specific --help. | |
1330 | for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue | |
1331 | test -d "$ac_dir" || | |
1332 | { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || | |
1333 | continue | |
1334 | ac_builddir=. | |
1335 | ||
1336 | case "$ac_dir" in | |
1337 | .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; | |
1338 | *) | |
1339 | ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` | |
1340 | # A ".." for each directory in $ac_dir_suffix. | |
1341 | ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` | |
1342 | case $ac_top_builddir_sub in | |
1343 | "") ac_top_builddir_sub=. ac_top_build_prefix= ;; | |
1344 | *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; | |
1345 | esac ;; | |
1346 | esac | |
1347 | ac_abs_top_builddir=$ac_pwd | |
1348 | ac_abs_builddir=$ac_pwd$ac_dir_suffix | |
1349 | # for backward compatibility: | |
1350 | ac_top_builddir=$ac_top_build_prefix | |
1351 | ||
1352 | case $srcdir in | |
1353 | .) # We are building in place. | |
1354 | ac_srcdir=. | |
1355 | ac_top_srcdir=$ac_top_builddir_sub | |
1356 | ac_abs_top_srcdir=$ac_pwd ;; | |
1357 | [\\/]* | ?:[\\/]* ) # Absolute name. | |
1358 | ac_srcdir=$srcdir$ac_dir_suffix; | |
1359 | ac_top_srcdir=$srcdir | |
1360 | ac_abs_top_srcdir=$srcdir ;; | |
1361 | *) # Relative name. | |
1362 | ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix | |
1363 | ac_top_srcdir=$ac_top_build_prefix$srcdir | |
1364 | ac_abs_top_srcdir=$ac_pwd/$srcdir ;; | |
1365 | esac | |
1366 | ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix | |
1367 | ||
1368 | cd "$ac_dir" || { ac_status=$?; continue; } | |
1369 | # Check for guested configure. | |
1370 | if test -f "$ac_srcdir/configure.gnu"; then | |
1371 | echo && | |
1372 | $SHELL "$ac_srcdir/configure.gnu" --help=recursive | |
1373 | elif test -f "$ac_srcdir/configure"; then | |
1374 | echo && | |
1375 | $SHELL "$ac_srcdir/configure" --help=recursive | |
1376 | else | |
1377 | $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 | |
1378 | fi || ac_status=$? | |
1379 | cd "$ac_pwd" || { ac_status=$?; break; } | |
1380 | done | |
1381 | fi | |
1382 | ||
1383 | test -n "$ac_init_help" && exit $ac_status | |
1384 | if $ac_init_version; then | |
1385 | cat <<\_ACEOF | |
1386 | configure | |
1387 | generated by GNU Autoconf 2.69 | |
1388 | ||
1389 | Copyright (C) 2012 Free Software Foundation, Inc. | |
1390 | This configure script is free software; the Free Software Foundation | |
1391 | gives unlimited permission to copy, distribute and modify it. | |
1392 | _ACEOF | |
1393 | exit | |
1394 | fi | |
1395 | ||
1396 | ## ------------------------ ## | |
1397 | ## Autoconf initialization. ## | |
1398 | ## ------------------------ ## | |
1399 | ||
1400 | # ac_fn_c_try_compile LINENO | |
1401 | # -------------------------- | |
1402 | # Try to compile conftest.$ac_ext, and return whether this succeeded. | |
1403 | ac_fn_c_try_compile () | |
1404 | { | |
1405 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1406 | rm -f conftest.$ac_objext | |
1407 | if { { ac_try="$ac_compile" | |
1408 | case "(($ac_try" in | |
1409 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
1410 | *) ac_try_echo=$ac_try;; | |
1411 | esac | |
1412 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
1413 | $as_echo "$ac_try_echo"; } >&5 | |
1414 | (eval "$ac_compile") 2>conftest.err | |
1415 | ac_status=$? | |
1416 | if test -s conftest.err; then | |
1417 | grep -v '^ *+' conftest.err >conftest.er1 | |
1418 | cat conftest.er1 >&5 | |
1419 | mv -f conftest.er1 conftest.err | |
478 | 1420 | fi |
479 | fi | |
480 | srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` | |
481 | ||
482 | # Prefer explicitly selected file to automatically selected ones. | |
483 | if test -z "$CONFIG_SITE"; then | |
484 | if test "x$prefix" != xNONE; then | |
485 | CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" | |
486 | else | |
487 | CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" | |
1421 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
1422 | test $ac_status = 0; } && { | |
1423 | test -z "$ac_c_werror_flag" || | |
1424 | test ! -s conftest.err | |
1425 | } && test -s conftest.$ac_objext; then : | |
1426 | ac_retval=0 | |
1427 | else | |
1428 | $as_echo "$as_me: failed program was:" >&5 | |
1429 | sed 's/^/| /' conftest.$ac_ext >&5 | |
1430 | ||
1431 | ac_retval=1 | |
1432 | fi | |
1433 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1434 | as_fn_set_status $ac_retval | |
1435 | ||
1436 | } # ac_fn_c_try_compile | |
1437 | ||
1438 | # ac_fn_c_try_cpp LINENO | |
1439 | # ---------------------- | |
1440 | # Try to preprocess conftest.$ac_ext, and return whether this succeeded. | |
1441 | ac_fn_c_try_cpp () | |
1442 | { | |
1443 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1444 | if { { ac_try="$ac_cpp conftest.$ac_ext" | |
1445 | case "(($ac_try" in | |
1446 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
1447 | *) ac_try_echo=$ac_try;; | |
1448 | esac | |
1449 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
1450 | $as_echo "$ac_try_echo"; } >&5 | |
1451 | (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err | |
1452 | ac_status=$? | |
1453 | if test -s conftest.err; then | |
1454 | grep -v '^ *+' conftest.err >conftest.er1 | |
1455 | cat conftest.er1 >&5 | |
1456 | mv -f conftest.er1 conftest.err | |
488 | 1457 | fi |
489 | fi | |
490 | for ac_site_file in $CONFIG_SITE; do | |
491 | if test -r "$ac_site_file"; then | |
492 | echo "loading site script $ac_site_file" | |
493 | . "$ac_site_file" | |
1458 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
1459 | test $ac_status = 0; } > conftest.i && { | |
1460 | test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || | |
1461 | test ! -s conftest.err | |
1462 | }; then : | |
1463 | ac_retval=0 | |
1464 | else | |
1465 | $as_echo "$as_me: failed program was:" >&5 | |
1466 | sed 's/^/| /' conftest.$ac_ext >&5 | |
1467 | ||
1468 | ac_retval=1 | |
1469 | fi | |
1470 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1471 | as_fn_set_status $ac_retval | |
1472 | ||
1473 | } # ac_fn_c_try_cpp | |
1474 | ||
1475 | # ac_fn_c_try_run LINENO | |
1476 | # ---------------------- | |
1477 | # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes | |
1478 | # that executables *can* be run. | |
1479 | ac_fn_c_try_run () | |
1480 | { | |
1481 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1482 | if { { ac_try="$ac_link" | |
1483 | case "(($ac_try" in | |
1484 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
1485 | *) ac_try_echo=$ac_try;; | |
1486 | esac | |
1487 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
1488 | $as_echo "$ac_try_echo"; } >&5 | |
1489 | (eval "$ac_link") 2>&5 | |
1490 | ac_status=$? | |
1491 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
1492 | test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' | |
1493 | { { case "(($ac_try" in | |
1494 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
1495 | *) ac_try_echo=$ac_try;; | |
1496 | esac | |
1497 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
1498 | $as_echo "$ac_try_echo"; } >&5 | |
1499 | (eval "$ac_try") 2>&5 | |
1500 | ac_status=$? | |
1501 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
1502 | test $ac_status = 0; }; }; then : | |
1503 | ac_retval=0 | |
1504 | else | |
1505 | $as_echo "$as_me: program exited with status $ac_status" >&5 | |
1506 | $as_echo "$as_me: failed program was:" >&5 | |
1507 | sed 's/^/| /' conftest.$ac_ext >&5 | |
1508 | ||
1509 | ac_retval=$ac_status | |
1510 | fi | |
1511 | rm -rf conftest.dSYM conftest_ipa8_conftest.oo | |
1512 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1513 | as_fn_set_status $ac_retval | |
1514 | ||
1515 | } # ac_fn_c_try_run | |
1516 | ||
1517 | # ac_fn_c_check_type LINENO TYPE VAR INCLUDES | |
1518 | # ------------------------------------------- | |
1519 | # Tests whether TYPE exists after having included INCLUDES, setting cache | |
1520 | # variable VAR accordingly. | |
1521 | ac_fn_c_check_type () | |
1522 | { | |
1523 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1524 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 | |
1525 | $as_echo_n "checking for $2... " >&6; } | |
1526 | if eval \${$3+:} false; then : | |
1527 | $as_echo_n "(cached) " >&6 | |
1528 | else | |
1529 | eval "$3=no" | |
1530 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
1531 | /* end confdefs.h. */ | |
1532 | $4 | |
1533 | int | |
1534 | main () | |
1535 | { | |
1536 | if (sizeof ($2)) | |
1537 | return 0; | |
1538 | ; | |
1539 | return 0; | |
1540 | } | |
1541 | _ACEOF | |
1542 | if ac_fn_c_try_compile "$LINENO"; then : | |
1543 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
1544 | /* end confdefs.h. */ | |
1545 | $4 | |
1546 | int | |
1547 | main () | |
1548 | { | |
1549 | if (sizeof (($2))) | |
1550 | return 0; | |
1551 | ; | |
1552 | return 0; | |
1553 | } | |
1554 | _ACEOF | |
1555 | if ac_fn_c_try_compile "$LINENO"; then : | |
1556 | ||
1557 | else | |
1558 | eval "$3=yes" | |
1559 | fi | |
1560 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
1561 | fi | |
1562 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
1563 | fi | |
1564 | eval ac_res=\$$3 | |
1565 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
1566 | $as_echo "$ac_res" >&6; } | |
1567 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1568 | ||
1569 | } # ac_fn_c_check_type | |
1570 | ||
1571 | # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES | |
1572 | # ------------------------------------------------------- | |
1573 | # Tests whether HEADER exists and can be compiled using the include files in | |
1574 | # INCLUDES, setting the cache variable VAR accordingly. | |
1575 | ac_fn_c_check_header_compile () | |
1576 | { | |
1577 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1578 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 | |
1579 | $as_echo_n "checking for $2... " >&6; } | |
1580 | if eval \${$3+:} false; then : | |
1581 | $as_echo_n "(cached) " >&6 | |
1582 | else | |
1583 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
1584 | /* end confdefs.h. */ | |
1585 | $4 | |
1586 | #include <$2> | |
1587 | _ACEOF | |
1588 | if ac_fn_c_try_compile "$LINENO"; then : | |
1589 | eval "$3=yes" | |
1590 | else | |
1591 | eval "$3=no" | |
1592 | fi | |
1593 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
1594 | fi | |
1595 | eval ac_res=\$$3 | |
1596 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
1597 | $as_echo "$ac_res" >&6; } | |
1598 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1599 | ||
1600 | } # ac_fn_c_check_header_compile | |
1601 | ||
1602 | # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES | |
1603 | # ------------------------------------------------------- | |
1604 | # Tests whether HEADER exists, giving a warning if it cannot be compiled using | |
1605 | # the include files in INCLUDES and setting the cache variable VAR | |
1606 | # accordingly. | |
1607 | ac_fn_c_check_header_mongrel () | |
1608 | { | |
1609 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1610 | if eval \${$3+:} false; then : | |
1611 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 | |
1612 | $as_echo_n "checking for $2... " >&6; } | |
1613 | if eval \${$3+:} false; then : | |
1614 | $as_echo_n "(cached) " >&6 | |
1615 | fi | |
1616 | eval ac_res=\$$3 | |
1617 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
1618 | $as_echo "$ac_res" >&6; } | |
1619 | else | |
1620 | # Is the header compilable? | |
1621 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 | |
1622 | $as_echo_n "checking $2 usability... " >&6; } | |
1623 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
1624 | /* end confdefs.h. */ | |
1625 | $4 | |
1626 | #include <$2> | |
1627 | _ACEOF | |
1628 | if ac_fn_c_try_compile "$LINENO"; then : | |
1629 | ac_header_compiler=yes | |
1630 | else | |
1631 | ac_header_compiler=no | |
1632 | fi | |
1633 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
1634 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 | |
1635 | $as_echo "$ac_header_compiler" >&6; } | |
1636 | ||
1637 | # Is the header present? | |
1638 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 | |
1639 | $as_echo_n "checking $2 presence... " >&6; } | |
1640 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
1641 | /* end confdefs.h. */ | |
1642 | #include <$2> | |
1643 | _ACEOF | |
1644 | if ac_fn_c_try_cpp "$LINENO"; then : | |
1645 | ac_header_preproc=yes | |
1646 | else | |
1647 | ac_header_preproc=no | |
1648 | fi | |
1649 | rm -f conftest.err conftest.i conftest.$ac_ext | |
1650 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 | |
1651 | $as_echo "$ac_header_preproc" >&6; } | |
1652 | ||
1653 | # So? What about this header? | |
1654 | case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( | |
1655 | yes:no: ) | |
1656 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 | |
1657 | $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} | |
1658 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 | |
1659 | $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} | |
1660 | ;; | |
1661 | no:yes:* ) | |
1662 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 | |
1663 | $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} | |
1664 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 | |
1665 | $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} | |
1666 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 | |
1667 | $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} | |
1668 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 | |
1669 | $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} | |
1670 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 | |
1671 | $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} | |
1672 | ;; | |
1673 | esac | |
1674 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 | |
1675 | $as_echo_n "checking for $2... " >&6; } | |
1676 | if eval \${$3+:} false; then : | |
1677 | $as_echo_n "(cached) " >&6 | |
1678 | else | |
1679 | eval "$3=\$ac_header_compiler" | |
1680 | fi | |
1681 | eval ac_res=\$$3 | |
1682 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
1683 | $as_echo "$ac_res" >&6; } | |
1684 | fi | |
1685 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1686 | ||
1687 | } # ac_fn_c_check_header_mongrel | |
1688 | ||
1689 | # ac_fn_c_try_link LINENO | |
1690 | # ----------------------- | |
1691 | # Try to link conftest.$ac_ext, and return whether this succeeded. | |
1692 | ac_fn_c_try_link () | |
1693 | { | |
1694 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1695 | rm -f conftest.$ac_objext conftest$ac_exeext | |
1696 | if { { ac_try="$ac_link" | |
1697 | case "(($ac_try" in | |
1698 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
1699 | *) ac_try_echo=$ac_try;; | |
1700 | esac | |
1701 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
1702 | $as_echo "$ac_try_echo"; } >&5 | |
1703 | (eval "$ac_link") 2>conftest.err | |
1704 | ac_status=$? | |
1705 | if test -s conftest.err; then | |
1706 | grep -v '^ *+' conftest.err >conftest.er1 | |
1707 | cat conftest.er1 >&5 | |
1708 | mv -f conftest.er1 conftest.err | |
1709 | fi | |
1710 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
1711 | test $ac_status = 0; } && { | |
1712 | test -z "$ac_c_werror_flag" || | |
1713 | test ! -s conftest.err | |
1714 | } && test -s conftest$ac_exeext && { | |
1715 | test "$cross_compiling" = yes || | |
1716 | test -x conftest$ac_exeext | |
1717 | }; then : | |
1718 | ac_retval=0 | |
1719 | else | |
1720 | $as_echo "$as_me: failed program was:" >&5 | |
1721 | sed 's/^/| /' conftest.$ac_ext >&5 | |
1722 | ||
1723 | ac_retval=1 | |
1724 | fi | |
1725 | # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information | |
1726 | # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would | |
1727 | # interfere with the next link command; also delete a directory that is | |
1728 | # left behind by Apple's compiler. We do this before executing the actions. | |
1729 | rm -rf conftest.dSYM conftest_ipa8_conftest.oo | |
1730 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1731 | as_fn_set_status $ac_retval | |
1732 | ||
1733 | } # ac_fn_c_try_link | |
1734 | ||
1735 | # ac_fn_c_check_func LINENO FUNC VAR | |
1736 | # ---------------------------------- | |
1737 | # Tests whether FUNC exists, setting the cache variable VAR accordingly | |
1738 | ac_fn_c_check_func () | |
1739 | { | |
1740 | as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
1741 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 | |
1742 | $as_echo_n "checking for $2... " >&6; } | |
1743 | if eval \${$3+:} false; then : | |
1744 | $as_echo_n "(cached) " >&6 | |
1745 | else | |
1746 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
1747 | /* end confdefs.h. */ | |
1748 | /* Define $2 to an innocuous variant, in case <limits.h> declares $2. | |
1749 | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | |
1750 | #define $2 innocuous_$2 | |
1751 | ||
1752 | /* System header to define __stub macros and hopefully few prototypes, | |
1753 | which can conflict with char $2 (); below. | |
1754 | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | |
1755 | <limits.h> exists even on freestanding compilers. */ | |
1756 | ||
1757 | #ifdef __STDC__ | |
1758 | # include <limits.h> | |
1759 | #else | |
1760 | # include <assert.h> | |
1761 | #endif | |
1762 | ||
1763 | #undef $2 | |
1764 | ||
1765 | /* Override any GCC internal prototype to avoid an error. | |
1766 | Use char because int might match the return type of a GCC | |
1767 | builtin and then its argument prototype would still apply. */ | |
1768 | #ifdef __cplusplus | |
1769 | extern "C" | |
1770 | #endif | |
1771 | char $2 (); | |
1772 | /* The GNU C library defines this for functions which it implements | |
1773 | to always fail with ENOSYS. Some functions are actually named | |
1774 | something starting with __ and the normal name is an alias. */ | |
1775 | #if defined __stub_$2 || defined __stub___$2 | |
1776 | choke me | |
1777 | #endif | |
1778 | ||
1779 | int | |
1780 | main () | |
1781 | { | |
1782 | return $2 (); | |
1783 | ; | |
1784 | return 0; | |
1785 | } | |
1786 | _ACEOF | |
1787 | if ac_fn_c_try_link "$LINENO"; then : | |
1788 | eval "$3=yes" | |
1789 | else | |
1790 | eval "$3=no" | |
1791 | fi | |
1792 | rm -f core conftest.err conftest.$ac_objext \ | |
1793 | conftest$ac_exeext conftest.$ac_ext | |
1794 | fi | |
1795 | eval ac_res=\$$3 | |
1796 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
1797 | $as_echo "$ac_res" >&6; } | |
1798 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno | |
1799 | ||
1800 | } # ac_fn_c_check_func | |
1801 | cat >config.log <<_ACEOF | |
1802 | This file contains any messages produced by compilers while | |
1803 | running configure, to aid debugging if configure makes a mistake. | |
1804 | ||
1805 | It was created by $as_me, which was | |
1806 | generated by GNU Autoconf 2.69. Invocation command line was | |
1807 | ||
1808 | $ $0 $@ | |
1809 | ||
1810 | _ACEOF | |
1811 | exec 5>>config.log | |
1812 | { | |
1813 | cat <<_ASUNAME | |
1814 | ## --------- ## | |
1815 | ## Platform. ## | |
1816 | ## --------- ## | |
1817 | ||
1818 | hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` | |
1819 | uname -m = `(uname -m) 2>/dev/null || echo unknown` | |
1820 | uname -r = `(uname -r) 2>/dev/null || echo unknown` | |
1821 | uname -s = `(uname -s) 2>/dev/null || echo unknown` | |
1822 | uname -v = `(uname -v) 2>/dev/null || echo unknown` | |
1823 | ||
1824 | /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` | |
1825 | /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` | |
1826 | ||
1827 | /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` | |
1828 | /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` | |
1829 | /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` | |
1830 | /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` | |
1831 | /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` | |
1832 | /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` | |
1833 | /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` | |
1834 | ||
1835 | _ASUNAME | |
1836 | ||
1837 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
1838 | for as_dir in $PATH | |
1839 | do | |
1840 | IFS=$as_save_IFS | |
1841 | test -z "$as_dir" && as_dir=. | |
1842 | $as_echo "PATH: $as_dir" | |
1843 | done | |
1844 | IFS=$as_save_IFS | |
1845 | ||
1846 | } >&5 | |
1847 | ||
1848 | cat >&5 <<_ACEOF | |
1849 | ||
1850 | ||
1851 | ## ----------- ## | |
1852 | ## Core tests. ## | |
1853 | ## ----------- ## | |
1854 | ||
1855 | _ACEOF | |
1856 | ||
1857 | ||
1858 | # Keep a trace of the command line. | |
1859 | # Strip out --no-create and --no-recursion so they do not pile up. | |
1860 | # Strip out --silent because we don't want to record it for future runs. | |
1861 | # Also quote any args containing shell meta-characters. | |
1862 | # Make two passes to allow for proper duplicate-argument suppression. | |
1863 | ac_configure_args= | |
1864 | ac_configure_args0= | |
1865 | ac_configure_args1= | |
1866 | ac_must_keep_next=false | |
1867 | for ac_pass in 1 2 | |
1868 | do | |
1869 | for ac_arg | |
1870 | do | |
1871 | case $ac_arg in | |
1872 | -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; | |
1873 | -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | |
1874 | | -silent | --silent | --silen | --sile | --sil) | |
1875 | continue ;; | |
1876 | *\'*) | |
1877 | ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; | |
1878 | esac | |
1879 | case $ac_pass in | |
1880 | 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; | |
1881 | 2) | |
1882 | as_fn_append ac_configure_args1 " '$ac_arg'" | |
1883 | if test $ac_must_keep_next = true; then | |
1884 | ac_must_keep_next=false # Got value, back to normal. | |
1885 | else | |
1886 | case $ac_arg in | |
1887 | *=* | --config-cache | -C | -disable-* | --disable-* \ | |
1888 | | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | |
1889 | | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | |
1890 | | -with-* | --with-* | -without-* | --without-* | --x) | |
1891 | case "$ac_configure_args0 " in | |
1892 | "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; | |
1893 | esac | |
1894 | ;; | |
1895 | -* ) ac_must_keep_next=true ;; | |
1896 | esac | |
1897 | fi | |
1898 | as_fn_append ac_configure_args " '$ac_arg'" | |
1899 | ;; | |
1900 | esac | |
1901 | done | |
1902 | done | |
1903 | { ac_configure_args0=; unset ac_configure_args0;} | |
1904 | { ac_configure_args1=; unset ac_configure_args1;} | |
1905 | ||
1906 | # When interrupted or exit'd, cleanup temporary files, and complete | |
1907 | # config.log. We remove comments because anyway the quotes in there | |
1908 | # would cause problems or look ugly. | |
1909 | # WARNING: Use '\'' to represent an apostrophe within the trap. | |
1910 | # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. | |
1911 | trap 'exit_status=$? | |
1912 | # Save into config.log some information that might help in debugging. | |
1913 | { | |
1914 | echo | |
1915 | ||
1916 | $as_echo "## ---------------- ## | |
1917 | ## Cache variables. ## | |
1918 | ## ---------------- ##" | |
1919 | echo | |
1920 | # The following way of writing the cache mishandles newlines in values, | |
1921 | ( | |
1922 | for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do | |
1923 | eval ac_val=\$$ac_var | |
1924 | case $ac_val in #( | |
1925 | *${as_nl}*) | |
1926 | case $ac_var in #( | |
1927 | *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 | |
1928 | $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; | |
1929 | esac | |
1930 | case $ac_var in #( | |
1931 | _ | IFS | as_nl) ;; #( | |
1932 | BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( | |
1933 | *) { eval $ac_var=; unset $ac_var;} ;; | |
1934 | esac ;; | |
1935 | esac | |
1936 | done | |
1937 | (set) 2>&1 | | |
1938 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( | |
1939 | *${as_nl}ac_space=\ *) | |
1940 | sed -n \ | |
1941 | "s/'\''/'\''\\\\'\'''\''/g; | |
1942 | s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" | |
1943 | ;; #( | |
1944 | *) | |
1945 | sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" | |
1946 | ;; | |
1947 | esac | | |
1948 | sort | |
1949 | ) | |
1950 | echo | |
1951 | ||
1952 | $as_echo "## ----------------- ## | |
1953 | ## Output variables. ## | |
1954 | ## ----------------- ##" | |
1955 | echo | |
1956 | for ac_var in $ac_subst_vars | |
1957 | do | |
1958 | eval ac_val=\$$ac_var | |
1959 | case $ac_val in | |
1960 | *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; | |
1961 | esac | |
1962 | $as_echo "$ac_var='\''$ac_val'\''" | |
1963 | done | sort | |
1964 | echo | |
1965 | ||
1966 | if test -n "$ac_subst_files"; then | |
1967 | $as_echo "## ------------------- ## | |
1968 | ## File substitutions. ## | |
1969 | ## ------------------- ##" | |
1970 | echo | |
1971 | for ac_var in $ac_subst_files | |
1972 | do | |
1973 | eval ac_val=\$$ac_var | |
1974 | case $ac_val in | |
1975 | *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; | |
1976 | esac | |
1977 | $as_echo "$ac_var='\''$ac_val'\''" | |
1978 | done | sort | |
1979 | echo | |
1980 | fi | |
1981 | ||
1982 | if test -s confdefs.h; then | |
1983 | $as_echo "## ----------- ## | |
1984 | ## confdefs.h. ## | |
1985 | ## ----------- ##" | |
1986 | echo | |
1987 | cat confdefs.h | |
1988 | echo | |
1989 | fi | |
1990 | test "$ac_signal" != 0 && | |
1991 | $as_echo "$as_me: caught signal $ac_signal" | |
1992 | $as_echo "$as_me: exit $exit_status" | |
1993 | } >&5 | |
1994 | rm -f core *.core core.conftest.* && | |
1995 | rm -f -r conftest* confdefs* conf$$* $ac_clean_files && | |
1996 | exit $exit_status | |
1997 | ' 0 | |
1998 | for ac_signal in 1 2 13 15; do | |
1999 | trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal | |
2000 | done | |
2001 | ac_signal=0 | |
2002 | ||
2003 | # confdefs.h avoids OS command line length limits that DEFS can exceed. | |
2004 | rm -f -r conftest* confdefs.h | |
2005 | ||
2006 | $as_echo "/* confdefs.h */" > confdefs.h | |
2007 | ||
2008 | # Predefined preprocessor variables. | |
2009 | ||
2010 | cat >>confdefs.h <<_ACEOF | |
2011 | #define PACKAGE_NAME "$PACKAGE_NAME" | |
2012 | _ACEOF | |
2013 | ||
2014 | cat >>confdefs.h <<_ACEOF | |
2015 | #define PACKAGE_TARNAME "$PACKAGE_TARNAME" | |
2016 | _ACEOF | |
2017 | ||
2018 | cat >>confdefs.h <<_ACEOF | |
2019 | #define PACKAGE_VERSION "$PACKAGE_VERSION" | |
2020 | _ACEOF | |
2021 | ||
2022 | cat >>confdefs.h <<_ACEOF | |
2023 | #define PACKAGE_STRING "$PACKAGE_STRING" | |
2024 | _ACEOF | |
2025 | ||
2026 | cat >>confdefs.h <<_ACEOF | |
2027 | #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" | |
2028 | _ACEOF | |
2029 | ||
2030 | cat >>confdefs.h <<_ACEOF | |
2031 | #define PACKAGE_URL "$PACKAGE_URL" | |
2032 | _ACEOF | |
2033 | ||
2034 | ||
2035 | # Let the site file select an alternate cache file if it wants to. | |
2036 | # Prefer an explicitly selected file to automatically selected ones. | |
2037 | ac_site_file1=NONE | |
2038 | ac_site_file2=NONE | |
2039 | if test -n "$CONFIG_SITE"; then | |
2040 | # We do not want a PATH search for config.site. | |
2041 | case $CONFIG_SITE in #(( | |
2042 | -*) ac_site_file1=./$CONFIG_SITE;; | |
2043 | */*) ac_site_file1=$CONFIG_SITE;; | |
2044 | *) ac_site_file1=./$CONFIG_SITE;; | |
2045 | esac | |
2046 | elif test "x$prefix" != xNONE; then | |
2047 | ac_site_file1=$prefix/share/config.site | |
2048 | ac_site_file2=$prefix/etc/config.site | |
2049 | else | |
2050 | ac_site_file1=$ac_default_prefix/share/config.site | |
2051 | ac_site_file2=$ac_default_prefix/etc/config.site | |
2052 | fi | |
2053 | for ac_site_file in "$ac_site_file1" "$ac_site_file2" | |
2054 | do | |
2055 | test "x$ac_site_file" = xNONE && continue | |
2056 | if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then | |
2057 | { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 | |
2058 | $as_echo "$as_me: loading site script $ac_site_file" >&6;} | |
2059 | sed 's/^/| /' "$ac_site_file" >&5 | |
2060 | . "$ac_site_file" \ | |
2061 | || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
2062 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
2063 | as_fn_error $? "failed to load site script $ac_site_file | |
2064 | See \`config.log' for more details" "$LINENO" 5; } | |
494 | 2065 | fi |
495 | 2066 | done |
496 | 2067 | |
497 | 2068 | if test -r "$cache_file"; then |
498 | echo "loading cache $cache_file" | |
499 | . $cache_file | |
500 | else | |
501 | echo "creating cache $cache_file" | |
502 | > $cache_file | |
503 | fi | |
2069 | # Some versions of bash will fail to source /dev/null (special files | |
2070 | # actually), so we avoid doing that. DJGPP emulates it as a regular file. | |
2071 | if test /dev/null != "$cache_file" && test -f "$cache_file"; then | |
2072 | { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 | |
2073 | $as_echo "$as_me: loading cache $cache_file" >&6;} | |
2074 | case $cache_file in | |
2075 | [\\/]* | ?:[\\/]* ) . "$cache_file";; | |
2076 | *) . "./$cache_file";; | |
2077 | esac | |
2078 | fi | |
2079 | else | |
2080 | { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 | |
2081 | $as_echo "$as_me: creating cache $cache_file" >&6;} | |
2082 | >$cache_file | |
2083 | fi | |
2084 | ||
2085 | # Check that the precious variables saved in the cache have kept the same | |
2086 | # value. | |
2087 | ac_cache_corrupted=false | |
2088 | for ac_var in $ac_precious_vars; do | |
2089 | eval ac_old_set=\$ac_cv_env_${ac_var}_set | |
2090 | eval ac_new_set=\$ac_env_${ac_var}_set | |
2091 | eval ac_old_val=\$ac_cv_env_${ac_var}_value | |
2092 | eval ac_new_val=\$ac_env_${ac_var}_value | |
2093 | case $ac_old_set,$ac_new_set in | |
2094 | set,) | |
2095 | { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 | |
2096 | $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} | |
2097 | ac_cache_corrupted=: ;; | |
2098 | ,set) | |
2099 | { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 | |
2100 | $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} | |
2101 | ac_cache_corrupted=: ;; | |
2102 | ,);; | |
2103 | *) | |
2104 | if test "x$ac_old_val" != "x$ac_new_val"; then | |
2105 | # differences in whitespace do not lead to failure. | |
2106 | ac_old_val_w=`echo x $ac_old_val` | |
2107 | ac_new_val_w=`echo x $ac_new_val` | |
2108 | if test "$ac_old_val_w" != "$ac_new_val_w"; then | |
2109 | { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 | |
2110 | $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} | |
2111 | ac_cache_corrupted=: | |
2112 | else | |
2113 | { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 | |
2114 | $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} | |
2115 | eval $ac_var=\$ac_old_val | |
2116 | fi | |
2117 | { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 | |
2118 | $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} | |
2119 | { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 | |
2120 | $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} | |
2121 | fi;; | |
2122 | esac | |
2123 | # Pass precious variables to config.status. | |
2124 | if test "$ac_new_set" = set; then | |
2125 | case $ac_new_val in | |
2126 | *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; | |
2127 | *) ac_arg=$ac_var=$ac_new_val ;; | |
2128 | esac | |
2129 | case " $ac_configure_args " in | |
2130 | *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. | |
2131 | *) as_fn_append ac_configure_args " '$ac_arg'" ;; | |
2132 | esac | |
2133 | fi | |
2134 | done | |
2135 | if $ac_cache_corrupted; then | |
2136 | { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
2137 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
2138 | { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 | |
2139 | $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} | |
2140 | as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 | |
2141 | fi | |
2142 | ## -------------------- ## | |
2143 | ## Main body of script. ## | |
2144 | ## -------------------- ## | |
504 | 2145 | |
505 | 2146 | ac_ext=c |
506 | # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. | |
507 | 2147 | ac_cpp='$CPP $CPPFLAGS' |
508 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' | |
509 | ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
510 | cross_compiling=$ac_cv_prog_cc_cross | |
511 | ||
512 | ac_exeext= | |
513 | ac_objext=o | |
514 | if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then | |
515 | # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. | |
516 | if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then | |
517 | ac_n= ac_c=' | |
518 | ' ac_t=' ' | |
519 | else | |
520 | ac_n=-n ac_c= ac_t= | |
521 | fi | |
522 | else | |
523 | ac_n= ac_c='\c' ac_t= | |
524 | fi | |
525 | ||
526 | ||
527 | ||
2148 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
2149 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
2150 | ac_compiler_gnu=$ac_cv_c_compiler_gnu | |
2151 | ||
2152 | ||
2153 | ||
2154 | ac_config_headers="$ac_config_headers config.h" | |
528 | 2155 | |
529 | 2156 | |
530 | 2157 | # |
533 | 2160 | VERSION=0.5 |
534 | 2161 | PATCH=20 |
535 | 2162 | |
536 | # Check whether --with-cc or --without-cc was given. | |
537 | if test "${with_cc+set}" = set; then | |
538 | withval="$with_cc" | |
539 | CC=$with_cc | |
540 | fi | |
541 | ||
542 | # Check whether --with-cflags or --without-cflags was given. | |
543 | if test "${with_cflags+set}" = set; then | |
544 | withval="$with_cflags" | |
545 | CFLAGS=$with_cflags | |
546 | fi | |
547 | ||
548 | ||
549 | # Extract the first word of "gcc", so it can be a program name with args. | |
550 | set dummy gcc; ac_word=$2 | |
551 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 | |
552 | echo "configure:554: checking for $ac_word" >&5 | |
553 | if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then | |
554 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2163 | ||
2164 | # Check whether --with-cc was given. | |
2165 | if test "${with_cc+set}" = set; then : | |
2166 | withval=$with_cc; CC=$with_cc | |
2167 | fi | |
2168 | ||
2169 | ||
2170 | # Check whether --with-cflags was given. | |
2171 | if test "${with_cflags+set}" = set; then : | |
2172 | withval=$with_cflags; CFLAGS=$with_cflags | |
2173 | fi | |
2174 | ||
2175 | ||
2176 | ac_ext=c | |
2177 | ac_cpp='$CPP $CPPFLAGS' | |
2178 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
2179 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
2180 | ac_compiler_gnu=$ac_cv_c_compiler_gnu | |
2181 | if test -n "$ac_tool_prefix"; then | |
2182 | # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. | |
2183 | set dummy ${ac_tool_prefix}gcc; ac_word=$2 | |
2184 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
2185 | $as_echo_n "checking for $ac_word... " >&6; } | |
2186 | if ${ac_cv_prog_CC+:} false; then : | |
2187 | $as_echo_n "(cached) " >&6 | |
555 | 2188 | else |
556 | 2189 | if test -n "$CC"; then |
557 | 2190 | ac_cv_prog_CC="$CC" # Let the user override the test. |
558 | 2191 | else |
559 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
560 | ac_dummy="$PATH" | |
561 | for ac_dir in $ac_dummy; do | |
562 | test -z "$ac_dir" && ac_dir=. | |
563 | if test -f $ac_dir/$ac_word; then | |
564 | ac_cv_prog_CC="gcc" | |
565 | break | |
566 | fi | |
2192 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
2193 | for as_dir in $PATH | |
2194 | do | |
2195 | IFS=$as_save_IFS | |
2196 | test -z "$as_dir" && as_dir=. | |
2197 | for ac_exec_ext in '' $ac_executable_extensions; do | |
2198 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2199 | ac_cv_prog_CC="${ac_tool_prefix}gcc" | |
2200 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
2201 | break 2 | |
2202 | fi | |
2203 | done | |
567 | 2204 | done |
568 | IFS="$ac_save_ifs" | |
569 | fi | |
570 | fi | |
571 | CC="$ac_cv_prog_CC" | |
2205 | IFS=$as_save_IFS | |
2206 | ||
2207 | fi | |
2208 | fi | |
2209 | CC=$ac_cv_prog_CC | |
572 | 2210 | if test -n "$CC"; then |
573 | echo "$ac_t""$CC" 1>&6 | |
574 | else | |
575 | echo "$ac_t""no" 1>&6 | |
576 | fi | |
577 | ||
2211 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 | |
2212 | $as_echo "$CC" >&6; } | |
2213 | else | |
2214 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
2215 | $as_echo "no" >&6; } | |
2216 | fi | |
2217 | ||
2218 | ||
2219 | fi | |
2220 | if test -z "$ac_cv_prog_CC"; then | |
2221 | ac_ct_CC=$CC | |
2222 | # Extract the first word of "gcc", so it can be a program name with args. | |
2223 | set dummy gcc; ac_word=$2 | |
2224 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
2225 | $as_echo_n "checking for $ac_word... " >&6; } | |
2226 | if ${ac_cv_prog_ac_ct_CC+:} false; then : | |
2227 | $as_echo_n "(cached) " >&6 | |
2228 | else | |
2229 | if test -n "$ac_ct_CC"; then | |
2230 | ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. | |
2231 | else | |
2232 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
2233 | for as_dir in $PATH | |
2234 | do | |
2235 | IFS=$as_save_IFS | |
2236 | test -z "$as_dir" && as_dir=. | |
2237 | for ac_exec_ext in '' $ac_executable_extensions; do | |
2238 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2239 | ac_cv_prog_ac_ct_CC="gcc" | |
2240 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
2241 | break 2 | |
2242 | fi | |
2243 | done | |
2244 | done | |
2245 | IFS=$as_save_IFS | |
2246 | ||
2247 | fi | |
2248 | fi | |
2249 | ac_ct_CC=$ac_cv_prog_ac_ct_CC | |
2250 | if test -n "$ac_ct_CC"; then | |
2251 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 | |
2252 | $as_echo "$ac_ct_CC" >&6; } | |
2253 | else | |
2254 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
2255 | $as_echo "no" >&6; } | |
2256 | fi | |
2257 | ||
2258 | if test "x$ac_ct_CC" = x; then | |
2259 | CC="" | |
2260 | else | |
2261 | case $cross_compiling:$ac_tool_warned in | |
2262 | yes:) | |
2263 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 | |
2264 | $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} | |
2265 | ac_tool_warned=yes ;; | |
2266 | esac | |
2267 | CC=$ac_ct_CC | |
2268 | fi | |
2269 | else | |
2270 | CC="$ac_cv_prog_CC" | |
2271 | fi | |
2272 | ||
2273 | if test -z "$CC"; then | |
2274 | if test -n "$ac_tool_prefix"; then | |
2275 | # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. | |
2276 | set dummy ${ac_tool_prefix}cc; ac_word=$2 | |
2277 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
2278 | $as_echo_n "checking for $ac_word... " >&6; } | |
2279 | if ${ac_cv_prog_CC+:} false; then : | |
2280 | $as_echo_n "(cached) " >&6 | |
2281 | else | |
2282 | if test -n "$CC"; then | |
2283 | ac_cv_prog_CC="$CC" # Let the user override the test. | |
2284 | else | |
2285 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
2286 | for as_dir in $PATH | |
2287 | do | |
2288 | IFS=$as_save_IFS | |
2289 | test -z "$as_dir" && as_dir=. | |
2290 | for ac_exec_ext in '' $ac_executable_extensions; do | |
2291 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2292 | ac_cv_prog_CC="${ac_tool_prefix}cc" | |
2293 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
2294 | break 2 | |
2295 | fi | |
2296 | done | |
2297 | done | |
2298 | IFS=$as_save_IFS | |
2299 | ||
2300 | fi | |
2301 | fi | |
2302 | CC=$ac_cv_prog_CC | |
2303 | if test -n "$CC"; then | |
2304 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 | |
2305 | $as_echo "$CC" >&6; } | |
2306 | else | |
2307 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
2308 | $as_echo "no" >&6; } | |
2309 | fi | |
2310 | ||
2311 | ||
2312 | fi | |
2313 | fi | |
578 | 2314 | if test -z "$CC"; then |
579 | 2315 | # Extract the first word of "cc", so it can be a program name with args. |
580 | 2316 | set dummy cc; ac_word=$2 |
581 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 | |
582 | echo "configure:584: checking for $ac_word" >&5 | |
583 | if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then | |
584 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2317 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
2318 | $as_echo_n "checking for $ac_word... " >&6; } | |
2319 | if ${ac_cv_prog_CC+:} false; then : | |
2320 | $as_echo_n "(cached) " >&6 | |
585 | 2321 | else |
586 | 2322 | if test -n "$CC"; then |
587 | 2323 | ac_cv_prog_CC="$CC" # Let the user override the test. |
588 | 2324 | else |
589 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
590 | 2325 | ac_prog_rejected=no |
591 | ac_dummy="$PATH" | |
592 | for ac_dir in $ac_dummy; do | |
593 | test -z "$ac_dir" && ac_dir=. | |
594 | if test -f $ac_dir/$ac_word; then | |
595 | if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then | |
596 | ac_prog_rejected=yes | |
597 | continue | |
598 | fi | |
599 | ac_cv_prog_CC="cc" | |
600 | break | |
601 | fi | |
2326 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
2327 | for as_dir in $PATH | |
2328 | do | |
2329 | IFS=$as_save_IFS | |
2330 | test -z "$as_dir" && as_dir=. | |
2331 | for ac_exec_ext in '' $ac_executable_extensions; do | |
2332 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2333 | if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then | |
2334 | ac_prog_rejected=yes | |
2335 | continue | |
2336 | fi | |
2337 | ac_cv_prog_CC="cc" | |
2338 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
2339 | break 2 | |
2340 | fi | |
2341 | done | |
602 | 2342 | done |
603 | IFS="$ac_save_ifs" | |
2343 | IFS=$as_save_IFS | |
2344 | ||
604 | 2345 | if test $ac_prog_rejected = yes; then |
605 | 2346 | # We found a bogon in the path, so make sure we never use it. |
606 | 2347 | set dummy $ac_cv_prog_CC |
607 | 2348 | shift |
608 | if test $# -gt 0; then | |
2349 | if test $# != 0; then | |
609 | 2350 | # We chose a different compiler from the bogus one. |
610 | 2351 | # However, it has the same basename, so the bogon will be chosen |
611 | 2352 | # first if we set CC to just the basename; use the full file name. |
612 | 2353 | shift |
613 | set dummy "$ac_dir/$ac_word" "$@" | |
614 | shift | |
615 | ac_cv_prog_CC="$@" | |
2354 | ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" | |
616 | 2355 | fi |
617 | 2356 | fi |
618 | 2357 | fi |
619 | 2358 | fi |
620 | CC="$ac_cv_prog_CC" | |
2359 | CC=$ac_cv_prog_CC | |
621 | 2360 | if test -n "$CC"; then |
622 | echo "$ac_t""$CC" 1>&6 | |
623 | else | |
624 | echo "$ac_t""no" 1>&6 | |
625 | fi | |
626 | ||
627 | if test -z "$CC"; then | |
628 | case "`uname -s`" in | |
629 | *win32* | *WIN32*) | |
630 | # Extract the first word of "cl", so it can be a program name with args. | |
631 | set dummy cl; ac_word=$2 | |
632 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 | |
633 | echo "configure:635: checking for $ac_word" >&5 | |
634 | if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then | |
635 | echo $ac_n "(cached) $ac_c" 1>&6 | |
2361 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 | |
2362 | $as_echo "$CC" >&6; } | |
2363 | else | |
2364 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
2365 | $as_echo "no" >&6; } | |
2366 | fi | |
2367 | ||
2368 | ||
2369 | fi | |
2370 | if test -z "$CC"; then | |
2371 | if test -n "$ac_tool_prefix"; then | |
2372 | for ac_prog in cl.exe | |
2373 | do | |
2374 | # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. | |
2375 | set dummy $ac_tool_prefix$ac_prog; ac_word=$2 | |
2376 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
2377 | $as_echo_n "checking for $ac_word... " >&6; } | |
2378 | if ${ac_cv_prog_CC+:} false; then : | |
2379 | $as_echo_n "(cached) " >&6 | |
636 | 2380 | else |
637 | 2381 | if test -n "$CC"; then |
638 | 2382 | ac_cv_prog_CC="$CC" # Let the user override the test. |
639 | 2383 | else |
640 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
641 | ac_dummy="$PATH" | |
642 | for ac_dir in $ac_dummy; do | |
643 | test -z "$ac_dir" && ac_dir=. | |
644 | if test -f $ac_dir/$ac_word; then | |
645 | ac_cv_prog_CC="cl" | |
646 | break | |
2384 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
2385 | for as_dir in $PATH | |
2386 | do | |
2387 | IFS=$as_save_IFS | |
2388 | test -z "$as_dir" && as_dir=. | |
2389 | for ac_exec_ext in '' $ac_executable_extensions; do | |
2390 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2391 | ac_cv_prog_CC="$ac_tool_prefix$ac_prog" | |
2392 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
2393 | break 2 | |
2394 | fi | |
2395 | done | |
2396 | done | |
2397 | IFS=$as_save_IFS | |
2398 | ||
2399 | fi | |
2400 | fi | |
2401 | CC=$ac_cv_prog_CC | |
2402 | if test -n "$CC"; then | |
2403 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 | |
2404 | $as_echo "$CC" >&6; } | |
2405 | else | |
2406 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
2407 | $as_echo "no" >&6; } | |
2408 | fi | |
2409 | ||
2410 | ||
2411 | test -n "$CC" && break | |
2412 | done | |
2413 | fi | |
2414 | if test -z "$CC"; then | |
2415 | ac_ct_CC=$CC | |
2416 | for ac_prog in cl.exe | |
2417 | do | |
2418 | # Extract the first word of "$ac_prog", so it can be a program name with args. | |
2419 | set dummy $ac_prog; ac_word=$2 | |
2420 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
2421 | $as_echo_n "checking for $ac_word... " >&6; } | |
2422 | if ${ac_cv_prog_ac_ct_CC+:} false; then : | |
2423 | $as_echo_n "(cached) " >&6 | |
2424 | else | |
2425 | if test -n "$ac_ct_CC"; then | |
2426 | ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. | |
2427 | else | |
2428 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
2429 | for as_dir in $PATH | |
2430 | do | |
2431 | IFS=$as_save_IFS | |
2432 | test -z "$as_dir" && as_dir=. | |
2433 | for ac_exec_ext in '' $ac_executable_extensions; do | |
2434 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2435 | ac_cv_prog_ac_ct_CC="$ac_prog" | |
2436 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
2437 | break 2 | |
2438 | fi | |
2439 | done | |
2440 | done | |
2441 | IFS=$as_save_IFS | |
2442 | ||
2443 | fi | |
2444 | fi | |
2445 | ac_ct_CC=$ac_cv_prog_ac_ct_CC | |
2446 | if test -n "$ac_ct_CC"; then | |
2447 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 | |
2448 | $as_echo "$ac_ct_CC" >&6; } | |
2449 | else | |
2450 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
2451 | $as_echo "no" >&6; } | |
2452 | fi | |
2453 | ||
2454 | ||
2455 | test -n "$ac_ct_CC" && break | |
2456 | done | |
2457 | ||
2458 | if test "x$ac_ct_CC" = x; then | |
2459 | CC="" | |
2460 | else | |
2461 | case $cross_compiling:$ac_tool_warned in | |
2462 | yes:) | |
2463 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 | |
2464 | $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} | |
2465 | ac_tool_warned=yes ;; | |
2466 | esac | |
2467 | CC=$ac_ct_CC | |
2468 | fi | |
2469 | fi | |
2470 | ||
2471 | fi | |
2472 | ||
2473 | ||
2474 | test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
2475 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
2476 | as_fn_error $? "no acceptable C compiler found in \$PATH | |
2477 | See \`config.log' for more details" "$LINENO" 5; } | |
2478 | ||
2479 | # Provide some information about the compiler. | |
2480 | $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 | |
2481 | set X $ac_compile | |
2482 | ac_compiler=$2 | |
2483 | for ac_option in --version -v -V -qversion; do | |
2484 | { { ac_try="$ac_compiler $ac_option >&5" | |
2485 | case "(($ac_try" in | |
2486 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
2487 | *) ac_try_echo=$ac_try;; | |
2488 | esac | |
2489 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
2490 | $as_echo "$ac_try_echo"; } >&5 | |
2491 | (eval "$ac_compiler $ac_option >&5") 2>conftest.err | |
2492 | ac_status=$? | |
2493 | if test -s conftest.err; then | |
2494 | sed '10a\ | |
2495 | ... rest of stderr output deleted ... | |
2496 | 10q' conftest.err >conftest.er1 | |
2497 | cat conftest.er1 >&5 | |
2498 | fi | |
2499 | rm -f conftest.er1 conftest.err | |
2500 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
2501 | test $ac_status = 0; } | |
2502 | done | |
2503 | ||
2504 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2505 | /* end confdefs.h. */ | |
2506 | ||
2507 | int | |
2508 | main () | |
2509 | { | |
2510 | ||
2511 | ; | |
2512 | return 0; | |
2513 | } | |
2514 | _ACEOF | |
2515 | ac_clean_files_save=$ac_clean_files | |
2516 | ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" | |
2517 | # Try to create an executable without -o first, disregard a.out. | |
2518 | # It will help us diagnose broken compilers, and finding out an intuition | |
2519 | # of exeext. | |
2520 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 | |
2521 | $as_echo_n "checking whether the C compiler works... " >&6; } | |
2522 | ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` | |
2523 | ||
2524 | # The possible output files: | |
2525 | ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" | |
2526 | ||
2527 | ac_rmfiles= | |
2528 | for ac_file in $ac_files | |
2529 | do | |
2530 | case $ac_file in | |
2531 | *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; | |
2532 | * ) ac_rmfiles="$ac_rmfiles $ac_file";; | |
2533 | esac | |
2534 | done | |
2535 | rm -f $ac_rmfiles | |
2536 | ||
2537 | if { { ac_try="$ac_link_default" | |
2538 | case "(($ac_try" in | |
2539 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
2540 | *) ac_try_echo=$ac_try;; | |
2541 | esac | |
2542 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
2543 | $as_echo "$ac_try_echo"; } >&5 | |
2544 | (eval "$ac_link_default") 2>&5 | |
2545 | ac_status=$? | |
2546 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
2547 | test $ac_status = 0; }; then : | |
2548 | # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. | |
2549 | # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' | |
2550 | # in a Makefile. We should not override ac_cv_exeext if it was cached, | |
2551 | # so that the user can short-circuit this test for compilers unknown to | |
2552 | # Autoconf. | |
2553 | for ac_file in $ac_files '' | |
2554 | do | |
2555 | test -f "$ac_file" || continue | |
2556 | case $ac_file in | |
2557 | *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) | |
2558 | ;; | |
2559 | [ab].out ) | |
2560 | # We found the default executable, but exeext='' is most | |
2561 | # certainly right. | |
2562 | break;; | |
2563 | *.* ) | |
2564 | if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; | |
2565 | then :; else | |
2566 | ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` | |
2567 | fi | |
2568 | # We set ac_cv_exeext here because the later test for it is not | |
2569 | # safe: cross compilers may not add the suffix if given an `-o' | |
2570 | # argument, so we may need to know it at that point already. | |
2571 | # Even if this section looks crufty: it has the advantage of | |
2572 | # actually working. | |
2573 | break;; | |
2574 | * ) | |
2575 | break;; | |
2576 | esac | |
2577 | done | |
2578 | test "$ac_cv_exeext" = no && ac_cv_exeext= | |
2579 | ||
2580 | else | |
2581 | ac_file='' | |
2582 | fi | |
2583 | if test -z "$ac_file"; then : | |
2584 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
2585 | $as_echo "no" >&6; } | |
2586 | $as_echo "$as_me: failed program was:" >&5 | |
2587 | sed 's/^/| /' conftest.$ac_ext >&5 | |
2588 | ||
2589 | { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
2590 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
2591 | as_fn_error 77 "C compiler cannot create executables | |
2592 | See \`config.log' for more details" "$LINENO" 5; } | |
2593 | else | |
2594 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
2595 | $as_echo "yes" >&6; } | |
2596 | fi | |
2597 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 | |
2598 | $as_echo_n "checking for C compiler default output file name... " >&6; } | |
2599 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 | |
2600 | $as_echo "$ac_file" >&6; } | |
2601 | ac_exeext=$ac_cv_exeext | |
2602 | ||
2603 | rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out | |
2604 | ac_clean_files=$ac_clean_files_save | |
2605 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 | |
2606 | $as_echo_n "checking for suffix of executables... " >&6; } | |
2607 | if { { ac_try="$ac_link" | |
2608 | case "(($ac_try" in | |
2609 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
2610 | *) ac_try_echo=$ac_try;; | |
2611 | esac | |
2612 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
2613 | $as_echo "$ac_try_echo"; } >&5 | |
2614 | (eval "$ac_link") 2>&5 | |
2615 | ac_status=$? | |
2616 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
2617 | test $ac_status = 0; }; then : | |
2618 | # If both `conftest.exe' and `conftest' are `present' (well, observable) | |
2619 | # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will | |
2620 | # work properly (i.e., refer to `conftest.exe'), while it won't with | |
2621 | # `rm'. | |
2622 | for ac_file in conftest.exe conftest conftest.*; do | |
2623 | test -f "$ac_file" || continue | |
2624 | case $ac_file in | |
2625 | *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; | |
2626 | *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` | |
2627 | break;; | |
2628 | * ) break;; | |
2629 | esac | |
2630 | done | |
2631 | else | |
2632 | { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
2633 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
2634 | as_fn_error $? "cannot compute suffix of executables: cannot compile and link | |
2635 | See \`config.log' for more details" "$LINENO" 5; } | |
2636 | fi | |
2637 | rm -f conftest conftest$ac_cv_exeext | |
2638 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 | |
2639 | $as_echo "$ac_cv_exeext" >&6; } | |
2640 | ||
2641 | rm -f conftest.$ac_ext | |
2642 | EXEEXT=$ac_cv_exeext | |
2643 | ac_exeext=$EXEEXT | |
2644 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2645 | /* end confdefs.h. */ | |
2646 | #include <stdio.h> | |
2647 | int | |
2648 | main () | |
2649 | { | |
2650 | FILE *f = fopen ("conftest.out", "w"); | |
2651 | return ferror (f) || fclose (f) != 0; | |
2652 | ||
2653 | ; | |
2654 | return 0; | |
2655 | } | |
2656 | _ACEOF | |
2657 | ac_clean_files="$ac_clean_files conftest.out" | |
2658 | # Check that the compiler produces executables we can run. If not, either | |
2659 | # the compiler is broken, or we cross compile. | |
2660 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 | |
2661 | $as_echo_n "checking whether we are cross compiling... " >&6; } | |
2662 | if test "$cross_compiling" != yes; then | |
2663 | { { ac_try="$ac_link" | |
2664 | case "(($ac_try" in | |
2665 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
2666 | *) ac_try_echo=$ac_try;; | |
2667 | esac | |
2668 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
2669 | $as_echo "$ac_try_echo"; } >&5 | |
2670 | (eval "$ac_link") 2>&5 | |
2671 | ac_status=$? | |
2672 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
2673 | test $ac_status = 0; } | |
2674 | if { ac_try='./conftest$ac_cv_exeext' | |
2675 | { { case "(($ac_try" in | |
2676 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
2677 | *) ac_try_echo=$ac_try;; | |
2678 | esac | |
2679 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
2680 | $as_echo "$ac_try_echo"; } >&5 | |
2681 | (eval "$ac_try") 2>&5 | |
2682 | ac_status=$? | |
2683 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
2684 | test $ac_status = 0; }; }; then | |
2685 | cross_compiling=no | |
2686 | else | |
2687 | if test "$cross_compiling" = maybe; then | |
2688 | cross_compiling=yes | |
2689 | else | |
2690 | { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
2691 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
2692 | as_fn_error $? "cannot run C compiled programs. | |
2693 | If you meant to cross compile, use \`--host'. | |
2694 | See \`config.log' for more details" "$LINENO" 5; } | |
647 | 2695 | fi |
648 | done | |
649 | IFS="$ac_save_ifs" | |
650 | fi | |
651 | fi | |
652 | CC="$ac_cv_prog_CC" | |
653 | if test -n "$CC"; then | |
654 | echo "$ac_t""$CC" 1>&6 | |
655 | else | |
656 | echo "$ac_t""no" 1>&6 | |
657 | fi | |
658 | ;; | |
659 | esac | |
660 | 2696 | fi |
661 | test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } | |
662 | fi | |
663 | ||
664 | echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 | |
665 | echo "configure:667: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 | |
666 | ||
667 | ac_ext=c | |
668 | # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. | |
669 | ac_cpp='$CPP $CPPFLAGS' | |
670 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' | |
671 | ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
672 | cross_compiling=$ac_cv_prog_cc_cross | |
673 | ||
674 | cat > conftest.$ac_ext << EOF | |
675 | ||
676 | #line 678 "configure" | |
677 | #include "confdefs.h" | |
678 | ||
679 | main(){return(0);} | |
680 | EOF | |
681 | if { (eval echo configure:683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
682 | ac_cv_prog_cc_works=yes | |
683 | # If we can't run a trivial program, we are probably using a cross compiler. | |
684 | if (./conftest; exit) 2>/dev/null; then | |
685 | ac_cv_prog_cc_cross=no | |
686 | else | |
687 | ac_cv_prog_cc_cross=yes | |
688 | fi | |
689 | else | |
690 | echo "configure: failed program was:" >&5 | |
691 | cat conftest.$ac_ext >&5 | |
692 | ac_cv_prog_cc_works=no | |
693 | fi | |
694 | rm -fr conftest* | |
695 | ac_ext=c | |
696 | # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. | |
697 | ac_cpp='$CPP $CPPFLAGS' | |
698 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' | |
699 | ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' | |
700 | cross_compiling=$ac_cv_prog_cc_cross | |
701 | ||
702 | echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 | |
703 | if test $ac_cv_prog_cc_works = no; then | |
704 | { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } | |
705 | fi | |
706 | echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 | |
707 | echo "configure:709: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 | |
708 | echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 | |
709 | cross_compiling=$ac_cv_prog_cc_cross | |
710 | ||
711 | echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 | |
712 | echo "configure:714: checking whether we are using GNU C" >&5 | |
713 | if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then | |
714 | echo $ac_n "(cached) $ac_c" 1>&6 | |
715 | else | |
716 | cat > conftest.c <<EOF | |
717 | #ifdef __GNUC__ | |
718 | yes; | |
2697 | fi | |
2698 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 | |
2699 | $as_echo "$cross_compiling" >&6; } | |
2700 | ||
2701 | rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out | |
2702 | ac_clean_files=$ac_clean_files_save | |
2703 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 | |
2704 | $as_echo_n "checking for suffix of object files... " >&6; } | |
2705 | if ${ac_cv_objext+:} false; then : | |
2706 | $as_echo_n "(cached) " >&6 | |
2707 | else | |
2708 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2709 | /* end confdefs.h. */ | |
2710 | ||
2711 | int | |
2712 | main () | |
2713 | { | |
2714 | ||
2715 | ; | |
2716 | return 0; | |
2717 | } | |
2718 | _ACEOF | |
2719 | rm -f conftest.o conftest.obj | |
2720 | if { { ac_try="$ac_compile" | |
2721 | case "(($ac_try" in | |
2722 | *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; | |
2723 | *) ac_try_echo=$ac_try;; | |
2724 | esac | |
2725 | eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" | |
2726 | $as_echo "$ac_try_echo"; } >&5 | |
2727 | (eval "$ac_compile") 2>&5 | |
2728 | ac_status=$? | |
2729 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
2730 | test $ac_status = 0; }; then : | |
2731 | for ac_file in conftest.o conftest.obj conftest.*; do | |
2732 | test -f "$ac_file" || continue; | |
2733 | case $ac_file in | |
2734 | *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; | |
2735 | *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` | |
2736 | break;; | |
2737 | esac | |
2738 | done | |
2739 | else | |
2740 | $as_echo "$as_me: failed program was:" >&5 | |
2741 | sed 's/^/| /' conftest.$ac_ext >&5 | |
2742 | ||
2743 | { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
2744 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
2745 | as_fn_error $? "cannot compute suffix of object files: cannot compile | |
2746 | See \`config.log' for more details" "$LINENO" 5; } | |
2747 | fi | |
2748 | rm -f conftest.$ac_cv_objext conftest.$ac_ext | |
2749 | fi | |
2750 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 | |
2751 | $as_echo "$ac_cv_objext" >&6; } | |
2752 | OBJEXT=$ac_cv_objext | |
2753 | ac_objext=$OBJEXT | |
2754 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 | |
2755 | $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } | |
2756 | if ${ac_cv_c_compiler_gnu+:} false; then : | |
2757 | $as_echo_n "(cached) " >&6 | |
2758 | else | |
2759 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2760 | /* end confdefs.h. */ | |
2761 | ||
2762 | int | |
2763 | main () | |
2764 | { | |
2765 | #ifndef __GNUC__ | |
2766 | choke me | |
719 | 2767 | #endif |
720 | EOF | |
721 | if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:723: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then | |
722 | ac_cv_prog_gcc=yes | |
723 | else | |
724 | ac_cv_prog_gcc=no | |
725 | fi | |
726 | fi | |
727 | ||
728 | echo "$ac_t""$ac_cv_prog_gcc" 1>&6 | |
729 | ||
730 | if test $ac_cv_prog_gcc = yes; then | |
2768 | ||
2769 | ; | |
2770 | return 0; | |
2771 | } | |
2772 | _ACEOF | |
2773 | if ac_fn_c_try_compile "$LINENO"; then : | |
2774 | ac_compiler_gnu=yes | |
2775 | else | |
2776 | ac_compiler_gnu=no | |
2777 | fi | |
2778 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
2779 | ac_cv_c_compiler_gnu=$ac_compiler_gnu | |
2780 | ||
2781 | fi | |
2782 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 | |
2783 | $as_echo "$ac_cv_c_compiler_gnu" >&6; } | |
2784 | if test $ac_compiler_gnu = yes; then | |
731 | 2785 | GCC=yes |
732 | 2786 | else |
733 | 2787 | GCC= |
734 | 2788 | fi |
735 | ||
736 | ac_test_CFLAGS="${CFLAGS+set}" | |
737 | ac_save_CFLAGS="$CFLAGS" | |
738 | CFLAGS= | |
739 | echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 | |
740 | echo "configure:742: checking whether ${CC-cc} accepts -g" >&5 | |
741 | if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then | |
742 | echo $ac_n "(cached) $ac_c" 1>&6 | |
743 | else | |
744 | echo 'void f(){}' > conftest.c | |
745 | if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then | |
2789 | ac_test_CFLAGS=${CFLAGS+set} | |
2790 | ac_save_CFLAGS=$CFLAGS | |
2791 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 | |
2792 | $as_echo_n "checking whether $CC accepts -g... " >&6; } | |
2793 | if ${ac_cv_prog_cc_g+:} false; then : | |
2794 | $as_echo_n "(cached) " >&6 | |
2795 | else | |
2796 | ac_save_c_werror_flag=$ac_c_werror_flag | |
2797 | ac_c_werror_flag=yes | |
2798 | ac_cv_prog_cc_g=no | |
2799 | CFLAGS="-g" | |
2800 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2801 | /* end confdefs.h. */ | |
2802 | ||
2803 | int | |
2804 | main () | |
2805 | { | |
2806 | ||
2807 | ; | |
2808 | return 0; | |
2809 | } | |
2810 | _ACEOF | |
2811 | if ac_fn_c_try_compile "$LINENO"; then : | |
746 | 2812 | ac_cv_prog_cc_g=yes |
747 | 2813 | else |
748 | ac_cv_prog_cc_g=no | |
749 | fi | |
750 | rm -f conftest* | |
751 | ||
752 | fi | |
753 | ||
754 | echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 | |
2814 | CFLAGS="" | |
2815 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2816 | /* end confdefs.h. */ | |
2817 | ||
2818 | int | |
2819 | main () | |
2820 | { | |
2821 | ||
2822 | ; | |
2823 | return 0; | |
2824 | } | |
2825 | _ACEOF | |
2826 | if ac_fn_c_try_compile "$LINENO"; then : | |
2827 | ||
2828 | else | |
2829 | ac_c_werror_flag=$ac_save_c_werror_flag | |
2830 | CFLAGS="-g" | |
2831 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2832 | /* end confdefs.h. */ | |
2833 | ||
2834 | int | |
2835 | main () | |
2836 | { | |
2837 | ||
2838 | ; | |
2839 | return 0; | |
2840 | } | |
2841 | _ACEOF | |
2842 | if ac_fn_c_try_compile "$LINENO"; then : | |
2843 | ac_cv_prog_cc_g=yes | |
2844 | fi | |
2845 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
2846 | fi | |
2847 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
2848 | fi | |
2849 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
2850 | ac_c_werror_flag=$ac_save_c_werror_flag | |
2851 | fi | |
2852 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 | |
2853 | $as_echo "$ac_cv_prog_cc_g" >&6; } | |
755 | 2854 | if test "$ac_test_CFLAGS" = set; then |
756 | CFLAGS="$ac_save_CFLAGS" | |
2855 | CFLAGS=$ac_save_CFLAGS | |
757 | 2856 | elif test $ac_cv_prog_cc_g = yes; then |
758 | 2857 | if test "$GCC" = yes; then |
759 | 2858 | CFLAGS="-g -O2" |
767 | 2866 | CFLAGS= |
768 | 2867 | fi |
769 | 2868 | fi |
770 | ||
771 | echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 | |
772 | echo "configure:774: checking how to run the C preprocessor" >&5 | |
2869 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 | |
2870 | $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } | |
2871 | if ${ac_cv_prog_cc_c89+:} false; then : | |
2872 | $as_echo_n "(cached) " >&6 | |
2873 | else | |
2874 | ac_cv_prog_cc_c89=no | |
2875 | ac_save_CC=$CC | |
2876 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2877 | /* end confdefs.h. */ | |
2878 | #include <stdarg.h> | |
2879 | #include <stdio.h> | |
2880 | struct stat; | |
2881 | /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ | |
2882 | struct buf { int x; }; | |
2883 | FILE * (*rcsopen) (struct buf *, struct stat *, int); | |
2884 | static char *e (p, i) | |
2885 | char **p; | |
2886 | int i; | |
2887 | { | |
2888 | return p[i]; | |
2889 | } | |
2890 | static char *f (char * (*g) (char **, int), char **p, ...) | |
2891 | { | |
2892 | char *s; | |
2893 | va_list v; | |
2894 | va_start (v,p); | |
2895 | s = g (p, va_arg (v,int)); | |
2896 | va_end (v); | |
2897 | return s; | |
2898 | } | |
2899 | ||
2900 | /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has | |
2901 | function prototypes and stuff, but not '\xHH' hex character constants. | |
2902 | These don't provoke an error unfortunately, instead are silently treated | |
2903 | as 'x'. The following induces an error, until -std is added to get | |
2904 | proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an | |
2905 | array size at least. It's necessary to write '\x00'==0 to get something | |
2906 | that's true only with -std. */ | |
2907 | int osf4_cc_array ['\x00' == 0 ? 1 : -1]; | |
2908 | ||
2909 | /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters | |
2910 | inside strings and character constants. */ | |
2911 | #define FOO(x) 'x' | |
2912 | int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; | |
2913 | ||
2914 | int test (int i, double x); | |
2915 | struct s1 {int (*f) (int a);}; | |
2916 | struct s2 {int (*f) (double a);}; | |
2917 | int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); | |
2918 | int argc; | |
2919 | char **argv; | |
2920 | int | |
2921 | main () | |
2922 | { | |
2923 | return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; | |
2924 | ; | |
2925 | return 0; | |
2926 | } | |
2927 | _ACEOF | |
2928 | for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ | |
2929 | -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" | |
2930 | do | |
2931 | CC="$ac_save_CC $ac_arg" | |
2932 | if ac_fn_c_try_compile "$LINENO"; then : | |
2933 | ac_cv_prog_cc_c89=$ac_arg | |
2934 | fi | |
2935 | rm -f core conftest.err conftest.$ac_objext | |
2936 | test "x$ac_cv_prog_cc_c89" != "xno" && break | |
2937 | done | |
2938 | rm -f conftest.$ac_ext | |
2939 | CC=$ac_save_CC | |
2940 | ||
2941 | fi | |
2942 | # AC_CACHE_VAL | |
2943 | case "x$ac_cv_prog_cc_c89" in | |
2944 | x) | |
2945 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 | |
2946 | $as_echo "none needed" >&6; } ;; | |
2947 | xno) | |
2948 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 | |
2949 | $as_echo "unsupported" >&6; } ;; | |
2950 | *) | |
2951 | CC="$CC $ac_cv_prog_cc_c89" | |
2952 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 | |
2953 | $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; | |
2954 | esac | |
2955 | if test "x$ac_cv_prog_cc_c89" != xno; then : | |
2956 | ||
2957 | fi | |
2958 | ||
2959 | ac_ext=c | |
2960 | ac_cpp='$CPP $CPPFLAGS' | |
2961 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
2962 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
2963 | ac_compiler_gnu=$ac_cv_c_compiler_gnu | |
2964 | ||
2965 | ac_ext=c | |
2966 | ac_cpp='$CPP $CPPFLAGS' | |
2967 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
2968 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
2969 | ac_compiler_gnu=$ac_cv_c_compiler_gnu | |
2970 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 | |
2971 | $as_echo_n "checking how to run the C preprocessor... " >&6; } | |
773 | 2972 | # On Suns, sometimes $CPP names a directory. |
774 | 2973 | if test -n "$CPP" && test -d "$CPP"; then |
775 | 2974 | CPP= |
776 | 2975 | fi |
777 | 2976 | if test -z "$CPP"; then |
778 | if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then | |
779 | echo $ac_n "(cached) $ac_c" 1>&6 | |
780 | else | |
781 | # This must be in double quotes, not single quotes, because CPP may get | |
782 | # substituted into the Makefile and "${CC-cc}" will confuse make. | |
783 | CPP="${CC-cc} -E" | |
2977 | if ${ac_cv_prog_CPP+:} false; then : | |
2978 | $as_echo_n "(cached) " >&6 | |
2979 | else | |
2980 | # Double quotes because CPP needs to be expanded | |
2981 | for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" | |
2982 | do | |
2983 | ac_preproc_ok=false | |
2984 | for ac_c_preproc_warn_flag in '' yes | |
2985 | do | |
2986 | # Use a header file that comes with gcc, so configuring glibc | |
2987 | # with a fresh cross-compiler works. | |
2988 | # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | |
2989 | # <limits.h> exists even on freestanding compilers. | |
784 | 2990 | # On the NeXT, cc -E runs the code through the compiler's parser, |
785 | # not just through cpp. | |
786 | cat > conftest.$ac_ext <<EOF | |
787 | #line 789 "configure" | |
788 | #include "confdefs.h" | |
789 | #include <assert.h> | |
790 | Syntax Error | |
791 | EOF | |
792 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
793 | { (eval echo configure:795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
794 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
795 | if test -z "$ac_err"; then | |
796 | : | |
797 | else | |
798 | echo "$ac_err" >&5 | |
799 | echo "configure: failed program was:" >&5 | |
800 | cat conftest.$ac_ext >&5 | |
801 | rm -rf conftest* | |
802 | CPP="${CC-cc} -E -traditional-cpp" | |
803 | cat > conftest.$ac_ext <<EOF | |
804 | #line 806 "configure" | |
805 | #include "confdefs.h" | |
806 | #include <assert.h> | |
807 | Syntax Error | |
808 | EOF | |
809 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
810 | { (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
811 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
812 | if test -z "$ac_err"; then | |
813 | : | |
814 | else | |
815 | echo "$ac_err" >&5 | |
816 | echo "configure: failed program was:" >&5 | |
817 | cat conftest.$ac_ext >&5 | |
818 | rm -rf conftest* | |
819 | CPP="${CC-cc} -nologo -E" | |
820 | cat > conftest.$ac_ext <<EOF | |
821 | #line 823 "configure" | |
822 | #include "confdefs.h" | |
823 | #include <assert.h> | |
824 | Syntax Error | |
825 | EOF | |
826 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
827 | { (eval echo configure:829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
828 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
829 | if test -z "$ac_err"; then | |
830 | : | |
831 | else | |
832 | echo "$ac_err" >&5 | |
833 | echo "configure: failed program was:" >&5 | |
834 | cat conftest.$ac_ext >&5 | |
835 | rm -rf conftest* | |
836 | CPP=/lib/cpp | |
837 | fi | |
838 | rm -f conftest* | |
839 | fi | |
840 | rm -f conftest* | |
841 | fi | |
842 | rm -f conftest* | |
843 | ac_cv_prog_CPP="$CPP" | |
844 | fi | |
845 | CPP="$ac_cv_prog_CPP" | |
846 | else | |
847 | ac_cv_prog_CPP="$CPP" | |
848 | fi | |
849 | echo "$ac_t""$CPP" 1>&6 | |
850 | ||
851 | ||
852 | echo $ac_n "checking if the compiler supports function prototypes""... $ac_c" 1>&6 | |
853 | echo "configure:855: checking if the compiler supports function prototypes" >&5 | |
854 | cat > conftest.$ac_ext <<EOF | |
855 | #line 857 "configure" | |
856 | #include "confdefs.h" | |
857 | ||
858 | int main() { | |
859 | extern void exit(int status); | |
860 | ; return 0; } | |
861 | EOF | |
862 | if { (eval echo configure:864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then | |
863 | rm -rf conftest* | |
864 | wi_cv_prototypes=yes | |
865 | cat >> confdefs.h <<\EOF | |
866 | #define PROTOTYPES 1 | |
867 | EOF | |
868 | ||
869 | else | |
870 | echo "configure: failed program was:" >&5 | |
871 | cat conftest.$ac_ext >&5 | |
872 | rm -rf conftest* | |
873 | wi_cv_prototypes=no | |
874 | fi | |
875 | rm -f conftest* | |
876 | echo "$ac_t""$wi_cv_prototypes" 1>&6 | |
877 | ||
878 | echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 | |
879 | echo "configure:881: checking whether ${MAKE-make} sets \${MAKE}" >&5 | |
880 | set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` | |
881 | if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then | |
882 | echo $ac_n "(cached) $ac_c" 1>&6 | |
883 | else | |
884 | cat > conftestmake <<\EOF | |
2991 | # not just through cpp. "Syntax error" is here to catch this case. | |
2992 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
2993 | /* end confdefs.h. */ | |
2994 | #ifdef __STDC__ | |
2995 | # include <limits.h> | |
2996 | #else | |
2997 | # include <assert.h> | |
2998 | #endif | |
2999 | Syntax error | |
3000 | _ACEOF | |
3001 | if ac_fn_c_try_cpp "$LINENO"; then : | |
3002 | ||
3003 | else | |
3004 | # Broken: fails on valid input. | |
3005 | continue | |
3006 | fi | |
3007 | rm -f conftest.err conftest.i conftest.$ac_ext | |
3008 | ||
3009 | # OK, works on sane cases. Now check whether nonexistent headers | |
3010 | # can be detected and how. | |
3011 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3012 | /* end confdefs.h. */ | |
3013 | #include <ac_nonexistent.h> | |
3014 | _ACEOF | |
3015 | if ac_fn_c_try_cpp "$LINENO"; then : | |
3016 | # Broken: success on invalid input. | |
3017 | continue | |
3018 | else | |
3019 | # Passes both tests. | |
3020 | ac_preproc_ok=: | |
3021 | break | |
3022 | fi | |
3023 | rm -f conftest.err conftest.i conftest.$ac_ext | |
3024 | ||
3025 | done | |
3026 | # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. | |
3027 | rm -f conftest.i conftest.err conftest.$ac_ext | |
3028 | if $ac_preproc_ok; then : | |
3029 | break | |
3030 | fi | |
3031 | ||
3032 | done | |
3033 | ac_cv_prog_CPP=$CPP | |
3034 | ||
3035 | fi | |
3036 | CPP=$ac_cv_prog_CPP | |
3037 | else | |
3038 | ac_cv_prog_CPP=$CPP | |
3039 | fi | |
3040 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 | |
3041 | $as_echo "$CPP" >&6; } | |
3042 | ac_preproc_ok=false | |
3043 | for ac_c_preproc_warn_flag in '' yes | |
3044 | do | |
3045 | # Use a header file that comes with gcc, so configuring glibc | |
3046 | # with a fresh cross-compiler works. | |
3047 | # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | |
3048 | # <limits.h> exists even on freestanding compilers. | |
3049 | # On the NeXT, cc -E runs the code through the compiler's parser, | |
3050 | # not just through cpp. "Syntax error" is here to catch this case. | |
3051 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3052 | /* end confdefs.h. */ | |
3053 | #ifdef __STDC__ | |
3054 | # include <limits.h> | |
3055 | #else | |
3056 | # include <assert.h> | |
3057 | #endif | |
3058 | Syntax error | |
3059 | _ACEOF | |
3060 | if ac_fn_c_try_cpp "$LINENO"; then : | |
3061 | ||
3062 | else | |
3063 | # Broken: fails on valid input. | |
3064 | continue | |
3065 | fi | |
3066 | rm -f conftest.err conftest.i conftest.$ac_ext | |
3067 | ||
3068 | # OK, works on sane cases. Now check whether nonexistent headers | |
3069 | # can be detected and how. | |
3070 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3071 | /* end confdefs.h. */ | |
3072 | #include <ac_nonexistent.h> | |
3073 | _ACEOF | |
3074 | if ac_fn_c_try_cpp "$LINENO"; then : | |
3075 | # Broken: success on invalid input. | |
3076 | continue | |
3077 | else | |
3078 | # Passes both tests. | |
3079 | ac_preproc_ok=: | |
3080 | break | |
3081 | fi | |
3082 | rm -f conftest.err conftest.i conftest.$ac_ext | |
3083 | ||
3084 | done | |
3085 | # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. | |
3086 | rm -f conftest.i conftest.err conftest.$ac_ext | |
3087 | if $ac_preproc_ok; then : | |
3088 | ||
3089 | else | |
3090 | { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
3091 | $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
3092 | as_fn_error $? "C preprocessor \"$CPP\" fails sanity check | |
3093 | See \`config.log' for more details" "$LINENO" 5; } | |
3094 | fi | |
3095 | ||
3096 | ac_ext=c | |
3097 | ac_cpp='$CPP $CPPFLAGS' | |
3098 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
3099 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
3100 | ac_compiler_gnu=$ac_cv_c_compiler_gnu | |
3101 | ||
3102 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 | |
3103 | $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } | |
3104 | set x ${MAKE-make} | |
3105 | ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` | |
3106 | if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : | |
3107 | $as_echo_n "(cached) " >&6 | |
3108 | else | |
3109 | cat >conftest.make <<\_ACEOF | |
3110 | SHELL = /bin/sh | |
885 | 3111 | all: |
886 | @echo 'ac_maketemp="${MAKE}"' | |
887 | EOF | |
888 | # GNU make sometimes prints "make[1]: Entering...", which would confuse us. | |
889 | eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` | |
890 | if test -n "$ac_maketemp"; then | |
891 | eval ac_cv_prog_make_${ac_make}_set=yes | |
892 | else | |
893 | eval ac_cv_prog_make_${ac_make}_set=no | |
894 | fi | |
895 | rm -f conftestmake | |
896 | fi | |
897 | if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then | |
898 | echo "$ac_t""yes" 1>&6 | |
3112 | @echo '@@@%%%=$(MAKE)=@@@%%%' | |
3113 | _ACEOF | |
3114 | # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. | |
3115 | case `${MAKE-make} -f conftest.make 2>/dev/null` in | |
3116 | *@@@%%%=?*=@@@%%%*) | |
3117 | eval ac_cv_prog_make_${ac_make}_set=yes;; | |
3118 | *) | |
3119 | eval ac_cv_prog_make_${ac_make}_set=no;; | |
3120 | esac | |
3121 | rm -f conftest.make | |
3122 | fi | |
3123 | if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then | |
3124 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
3125 | $as_echo "yes" >&6; } | |
899 | 3126 | SET_MAKE= |
900 | 3127 | else |
901 | echo "$ac_t""no" 1>&6 | |
3128 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
3129 | $as_echo "no" >&6; } | |
902 | 3130 | SET_MAKE="MAKE=${MAKE-make}" |
903 | 3131 | fi |
904 | 3132 | |
905 | # Extract the first word of "ranlib", so it can be a program name with args. | |
906 | set dummy ranlib; ac_word=$2 | |
907 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 | |
908 | echo "configure:910: checking for $ac_word" >&5 | |
909 | if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then | |
910 | echo $ac_n "(cached) $ac_c" 1>&6 | |
3133 | if test -n "$ac_tool_prefix"; then | |
3134 | # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. | |
3135 | set dummy ${ac_tool_prefix}ranlib; ac_word=$2 | |
3136 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
3137 | $as_echo_n "checking for $ac_word... " >&6; } | |
3138 | if ${ac_cv_prog_RANLIB+:} false; then : | |
3139 | $as_echo_n "(cached) " >&6 | |
911 | 3140 | else |
912 | 3141 | if test -n "$RANLIB"; then |
913 | 3142 | ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. |
914 | 3143 | else |
915 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
916 | ac_dummy="$PATH" | |
917 | for ac_dir in $ac_dummy; do | |
918 | test -z "$ac_dir" && ac_dir=. | |
919 | if test -f $ac_dir/$ac_word; then | |
920 | ac_cv_prog_RANLIB="ranlib" | |
921 | break | |
922 | fi | |
3144 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
3145 | for as_dir in $PATH | |
3146 | do | |
3147 | IFS=$as_save_IFS | |
3148 | test -z "$as_dir" && as_dir=. | |
3149 | for ac_exec_ext in '' $ac_executable_extensions; do | |
3150 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3151 | ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" | |
3152 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
3153 | break 2 | |
3154 | fi | |
3155 | done | |
923 | 3156 | done |
924 | IFS="$ac_save_ifs" | |
925 | test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" | |
926 | fi | |
927 | fi | |
928 | RANLIB="$ac_cv_prog_RANLIB" | |
3157 | IFS=$as_save_IFS | |
3158 | ||
3159 | fi | |
3160 | fi | |
3161 | RANLIB=$ac_cv_prog_RANLIB | |
929 | 3162 | if test -n "$RANLIB"; then |
930 | echo "$ac_t""$RANLIB" 1>&6 | |
931 | else | |
932 | echo "$ac_t""no" 1>&6 | |
933 | fi | |
934 | ||
935 | ||
936 | if test "$wi_cv_prototypes" = no ; then | |
937 | echo "configure: warning: Your compiler does not support function prototyping and" 1>&2 | |
938 | echo "configure: warning: is not able to properly compile this package. What a pity." 1>&2 | |
939 | echo "configure: warning: Get gcc, or any compiler that supports function prototypes." 1>&2 | |
940 | exit 1 | |
941 | fi | |
3163 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 | |
3164 | $as_echo "$RANLIB" >&6; } | |
3165 | else | |
3166 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
3167 | $as_echo "no" >&6; } | |
3168 | fi | |
3169 | ||
3170 | ||
3171 | fi | |
3172 | if test -z "$ac_cv_prog_RANLIB"; then | |
3173 | ac_ct_RANLIB=$RANLIB | |
3174 | # Extract the first word of "ranlib", so it can be a program name with args. | |
3175 | set dummy ranlib; ac_word=$2 | |
3176 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
3177 | $as_echo_n "checking for $ac_word... " >&6; } | |
3178 | if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : | |
3179 | $as_echo_n "(cached) " >&6 | |
3180 | else | |
3181 | if test -n "$ac_ct_RANLIB"; then | |
3182 | ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. | |
3183 | else | |
3184 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
3185 | for as_dir in $PATH | |
3186 | do | |
3187 | IFS=$as_save_IFS | |
3188 | test -z "$as_dir" && as_dir=. | |
3189 | for ac_exec_ext in '' $ac_executable_extensions; do | |
3190 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3191 | ac_cv_prog_ac_ct_RANLIB="ranlib" | |
3192 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
3193 | break 2 | |
3194 | fi | |
3195 | done | |
3196 | done | |
3197 | IFS=$as_save_IFS | |
3198 | ||
3199 | fi | |
3200 | fi | |
3201 | ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB | |
3202 | if test -n "$ac_ct_RANLIB"; then | |
3203 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 | |
3204 | $as_echo "$ac_ct_RANLIB" >&6; } | |
3205 | else | |
3206 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
3207 | $as_echo "no" >&6; } | |
3208 | fi | |
3209 | ||
3210 | if test "x$ac_ct_RANLIB" = x; then | |
3211 | RANLIB=":" | |
3212 | else | |
3213 | case $cross_compiling:$ac_tool_warned in | |
3214 | yes:) | |
3215 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 | |
3216 | $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} | |
3217 | ac_tool_warned=yes ;; | |
3218 | esac | |
3219 | RANLIB=$ac_ct_RANLIB | |
3220 | fi | |
3221 | else | |
3222 | RANLIB="$ac_cv_prog_RANLIB" | |
3223 | fi | |
3224 | ||
942 | 3225 | |
943 | 3226 | # |
944 | 3227 | # Checks for header files and library functions |
945 | 3228 | # |
946 | 3229 | |
947 | echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 | |
948 | echo "configure:950: checking for ANSI C header files" >&5 | |
949 | if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then | |
950 | echo $ac_n "(cached) $ac_c" 1>&6 | |
951 | else | |
952 | cat > conftest.$ac_ext <<EOF | |
953 | #line 955 "configure" | |
954 | #include "confdefs.h" | |
3230 | ||
3231 | ||
3232 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 | |
3233 | $as_echo_n "checking for grep that handles long lines and -e... " >&6; } | |
3234 | if ${ac_cv_path_GREP+:} false; then : | |
3235 | $as_echo_n "(cached) " >&6 | |
3236 | else | |
3237 | if test -z "$GREP"; then | |
3238 | ac_path_GREP_found=false | |
3239 | # Loop through the user's path and test for each of PROGNAME-LIST | |
3240 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
3241 | for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin | |
3242 | do | |
3243 | IFS=$as_save_IFS | |
3244 | test -z "$as_dir" && as_dir=. | |
3245 | for ac_prog in grep ggrep; do | |
3246 | for ac_exec_ext in '' $ac_executable_extensions; do | |
3247 | ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" | |
3248 | as_fn_executable_p "$ac_path_GREP" || continue | |
3249 | # Check for GNU ac_path_GREP and select it if it is found. | |
3250 | # Check for GNU $ac_path_GREP | |
3251 | case `"$ac_path_GREP" --version 2>&1` in | |
3252 | *GNU*) | |
3253 | ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; | |
3254 | *) | |
3255 | ac_count=0 | |
3256 | $as_echo_n 0123456789 >"conftest.in" | |
3257 | while : | |
3258 | do | |
3259 | cat "conftest.in" "conftest.in" >"conftest.tmp" | |
3260 | mv "conftest.tmp" "conftest.in" | |
3261 | cp "conftest.in" "conftest.nl" | |
3262 | $as_echo 'GREP' >> "conftest.nl" | |
3263 | "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break | |
3264 | diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break | |
3265 | as_fn_arith $ac_count + 1 && ac_count=$as_val | |
3266 | if test $ac_count -gt ${ac_path_GREP_max-0}; then | |
3267 | # Best one so far, save it but keep looking for a better one | |
3268 | ac_cv_path_GREP="$ac_path_GREP" | |
3269 | ac_path_GREP_max=$ac_count | |
3270 | fi | |
3271 | # 10*(2^10) chars as input seems more than enough | |
3272 | test $ac_count -gt 10 && break | |
3273 | done | |
3274 | rm -f conftest.in conftest.tmp conftest.nl conftest.out;; | |
3275 | esac | |
3276 | ||
3277 | $ac_path_GREP_found && break 3 | |
3278 | done | |
3279 | done | |
3280 | done | |
3281 | IFS=$as_save_IFS | |
3282 | if test -z "$ac_cv_path_GREP"; then | |
3283 | as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 | |
3284 | fi | |
3285 | else | |
3286 | ac_cv_path_GREP=$GREP | |
3287 | fi | |
3288 | ||
3289 | fi | |
3290 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 | |
3291 | $as_echo "$ac_cv_path_GREP" >&6; } | |
3292 | GREP="$ac_cv_path_GREP" | |
3293 | ||
3294 | ||
3295 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 | |
3296 | $as_echo_n "checking for egrep... " >&6; } | |
3297 | if ${ac_cv_path_EGREP+:} false; then : | |
3298 | $as_echo_n "(cached) " >&6 | |
3299 | else | |
3300 | if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 | |
3301 | then ac_cv_path_EGREP="$GREP -E" | |
3302 | else | |
3303 | if test -z "$EGREP"; then | |
3304 | ac_path_EGREP_found=false | |
3305 | # Loop through the user's path and test for each of PROGNAME-LIST | |
3306 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
3307 | for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin | |
3308 | do | |
3309 | IFS=$as_save_IFS | |
3310 | test -z "$as_dir" && as_dir=. | |
3311 | for ac_prog in egrep; do | |
3312 | for ac_exec_ext in '' $ac_executable_extensions; do | |
3313 | ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" | |
3314 | as_fn_executable_p "$ac_path_EGREP" || continue | |
3315 | # Check for GNU ac_path_EGREP and select it if it is found. | |
3316 | # Check for GNU $ac_path_EGREP | |
3317 | case `"$ac_path_EGREP" --version 2>&1` in | |
3318 | *GNU*) | |
3319 | ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; | |
3320 | *) | |
3321 | ac_count=0 | |
3322 | $as_echo_n 0123456789 >"conftest.in" | |
3323 | while : | |
3324 | do | |
3325 | cat "conftest.in" "conftest.in" >"conftest.tmp" | |
3326 | mv "conftest.tmp" "conftest.in" | |
3327 | cp "conftest.in" "conftest.nl" | |
3328 | $as_echo 'EGREP' >> "conftest.nl" | |
3329 | "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break | |
3330 | diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break | |
3331 | as_fn_arith $ac_count + 1 && ac_count=$as_val | |
3332 | if test $ac_count -gt ${ac_path_EGREP_max-0}; then | |
3333 | # Best one so far, save it but keep looking for a better one | |
3334 | ac_cv_path_EGREP="$ac_path_EGREP" | |
3335 | ac_path_EGREP_max=$ac_count | |
3336 | fi | |
3337 | # 10*(2^10) chars as input seems more than enough | |
3338 | test $ac_count -gt 10 && break | |
3339 | done | |
3340 | rm -f conftest.in conftest.tmp conftest.nl conftest.out;; | |
3341 | esac | |
3342 | ||
3343 | $ac_path_EGREP_found && break 3 | |
3344 | done | |
3345 | done | |
3346 | done | |
3347 | IFS=$as_save_IFS | |
3348 | if test -z "$ac_cv_path_EGREP"; then | |
3349 | as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 | |
3350 | fi | |
3351 | else | |
3352 | ac_cv_path_EGREP=$EGREP | |
3353 | fi | |
3354 | ||
3355 | fi | |
3356 | fi | |
3357 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 | |
3358 | $as_echo "$ac_cv_path_EGREP" >&6; } | |
3359 | EGREP="$ac_cv_path_EGREP" | |
3360 | ||
3361 | ||
3362 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 | |
3363 | $as_echo_n "checking for ANSI C header files... " >&6; } | |
3364 | if ${ac_cv_header_stdc+:} false; then : | |
3365 | $as_echo_n "(cached) " >&6 | |
3366 | else | |
3367 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3368 | /* end confdefs.h. */ | |
955 | 3369 | #include <stdlib.h> |
956 | 3370 | #include <stdarg.h> |
957 | 3371 | #include <string.h> |
958 | 3372 | #include <float.h> |
959 | EOF | |
960 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
961 | { (eval echo configure:963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
962 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
963 | if test -z "$ac_err"; then | |
964 | rm -rf conftest* | |
3373 | ||
3374 | int | |
3375 | main () | |
3376 | { | |
3377 | ||
3378 | ; | |
3379 | return 0; | |
3380 | } | |
3381 | _ACEOF | |
3382 | if ac_fn_c_try_compile "$LINENO"; then : | |
965 | 3383 | ac_cv_header_stdc=yes |
966 | 3384 | else |
967 | echo "$ac_err" >&5 | |
968 | echo "configure: failed program was:" >&5 | |
969 | cat conftest.$ac_ext >&5 | |
970 | rm -rf conftest* | |
971 | 3385 | ac_cv_header_stdc=no |
972 | 3386 | fi |
973 | rm -f conftest* | |
3387 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
974 | 3388 | |
975 | 3389 | if test $ac_cv_header_stdc = yes; then |
976 | 3390 | # SunOS 4.x string.h does not declare mem*, contrary to ANSI. |
977 | cat > conftest.$ac_ext <<EOF | |
978 | #line 980 "configure" | |
979 | #include "confdefs.h" | |
3391 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3392 | /* end confdefs.h. */ | |
980 | 3393 | #include <string.h> |
981 | EOF | |
3394 | ||
3395 | _ACEOF | |
982 | 3396 | if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | |
983 | egrep "memchr" >/dev/null 2>&1; then | |
984 | : | |
985 | else | |
986 | rm -rf conftest* | |
3397 | $EGREP "memchr" >/dev/null 2>&1; then : | |
3398 | ||
3399 | else | |
987 | 3400 | ac_cv_header_stdc=no |
988 | 3401 | fi |
989 | 3402 | rm -f conftest* |
992 | 3405 | |
993 | 3406 | if test $ac_cv_header_stdc = yes; then |
994 | 3407 | # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. |
995 | cat > conftest.$ac_ext <<EOF | |
996 | #line 998 "configure" | |
997 | #include "confdefs.h" | |
3408 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3409 | /* end confdefs.h. */ | |
998 | 3410 | #include <stdlib.h> |
999 | EOF | |
3411 | ||
3412 | _ACEOF | |
1000 | 3413 | if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | |
1001 | egrep "free" >/dev/null 2>&1; then | |
1002 | : | |
1003 | else | |
1004 | rm -rf conftest* | |
3414 | $EGREP "free" >/dev/null 2>&1; then : | |
3415 | ||
3416 | else | |
1005 | 3417 | ac_cv_header_stdc=no |
1006 | 3418 | fi |
1007 | 3419 | rm -f conftest* |
1010 | 3422 | |
1011 | 3423 | if test $ac_cv_header_stdc = yes; then |
1012 | 3424 | # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. |
1013 | if test "$cross_compiling" = yes; then | |
3425 | if test "$cross_compiling" = yes; then : | |
1014 | 3426 | : |
1015 | 3427 | else |
1016 | cat > conftest.$ac_ext <<EOF | |
1017 | #line 1019 "configure" | |
1018 | #include "confdefs.h" | |
3428 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3429 | /* end confdefs.h. */ | |
1019 | 3430 | #include <ctype.h> |
1020 | #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') | |
1021 | #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) | |
3431 | #include <stdlib.h> | |
3432 | #if ((' ' & 0x0FF) == 0x020) | |
3433 | # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') | |
3434 | # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) | |
3435 | #else | |
3436 | # define ISLOWER(c) \ | |
3437 | (('a' <= (c) && (c) <= 'i') \ | |
3438 | || ('j' <= (c) && (c) <= 'r') \ | |
3439 | || ('s' <= (c) && (c) <= 'z')) | |
3440 | # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) | |
3441 | #endif | |
3442 | ||
1022 | 3443 | #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) |
1023 | int main () { int i; for (i = 0; i < 256; i++) | |
1024 | if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); | |
1025 | exit (0); } | |
1026 | ||
1027 | EOF | |
1028 | if { (eval echo configure:1030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null | |
1029 | then | |
1030 | : | |
1031 | else | |
1032 | echo "configure: failed program was:" >&5 | |
1033 | cat conftest.$ac_ext >&5 | |
1034 | rm -fr conftest* | |
3444 | int | |
3445 | main () | |
3446 | { | |
3447 | int i; | |
3448 | for (i = 0; i < 256; i++) | |
3449 | if (XOR (islower (i), ISLOWER (i)) | |
3450 | || toupper (i) != TOUPPER (i)) | |
3451 | return 2; | |
3452 | return 0; | |
3453 | } | |
3454 | _ACEOF | |
3455 | if ac_fn_c_try_run "$LINENO"; then : | |
3456 | ||
3457 | else | |
1035 | 3458 | ac_cv_header_stdc=no |
1036 | 3459 | fi |
1037 | rm -fr conftest* | |
1038 | fi | |
1039 | ||
1040 | fi | |
1041 | fi | |
1042 | ||
1043 | echo "$ac_t""$ac_cv_header_stdc" 1>&6 | |
3460 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | |
3461 | conftest.$ac_objext conftest.beam conftest.$ac_ext | |
3462 | fi | |
3463 | ||
3464 | fi | |
3465 | fi | |
3466 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 | |
3467 | $as_echo "$ac_cv_header_stdc" >&6; } | |
1044 | 3468 | if test $ac_cv_header_stdc = yes; then |
1045 | cat >> confdefs.h <<\EOF | |
1046 | #define STDC_HEADERS 1 | |
1047 | EOF | |
1048 | ||
1049 | fi | |
1050 | ||
1051 | echo $ac_n "checking for size_t""... $ac_c" 1>&6 | |
1052 | echo "configure:1054: checking for size_t" >&5 | |
1053 | if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then | |
1054 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1055 | else | |
1056 | cat > conftest.$ac_ext <<EOF | |
1057 | #line 1059 "configure" | |
1058 | #include "confdefs.h" | |
1059 | #include <sys/types.h> | |
1060 | #if STDC_HEADERS | |
1061 | #include <stdlib.h> | |
1062 | #include <stddef.h> | |
1063 | #endif | |
1064 | EOF | |
1065 | if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | | |
1066 | egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then | |
1067 | rm -rf conftest* | |
1068 | ac_cv_type_size_t=yes | |
1069 | else | |
1070 | rm -rf conftest* | |
1071 | ac_cv_type_size_t=no | |
1072 | fi | |
1073 | rm -f conftest* | |
1074 | ||
1075 | fi | |
1076 | echo "$ac_t""$ac_cv_type_size_t" 1>&6 | |
1077 | if test $ac_cv_type_size_t = no; then | |
1078 | cat >> confdefs.h <<\EOF | |
1079 | #define size_t unsigned | |
1080 | EOF | |
1081 | ||
1082 | fi | |
1083 | ||
1084 | echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 | |
1085 | echo "configure:1087: checking whether time.h and sys/time.h may both be included" >&5 | |
1086 | if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then | |
1087 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1088 | else | |
1089 | cat > conftest.$ac_ext <<EOF | |
1090 | #line 1092 "configure" | |
1091 | #include "confdefs.h" | |
3469 | ||
3470 | $as_echo "#define STDC_HEADERS 1" >>confdefs.h | |
3471 | ||
3472 | fi | |
3473 | ||
3474 | # On IRIX 5.3, sys/types and inttypes.h are conflicting. | |
3475 | for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ | |
3476 | inttypes.h stdint.h unistd.h | |
3477 | do : | |
3478 | as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` | |
3479 | ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default | |
3480 | " | |
3481 | if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : | |
3482 | cat >>confdefs.h <<_ACEOF | |
3483 | #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 | |
3484 | _ACEOF | |
3485 | ||
3486 | fi | |
3487 | ||
3488 | done | |
3489 | ||
3490 | ||
3491 | ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" | |
3492 | if test "x$ac_cv_type_size_t" = xyes; then : | |
3493 | ||
3494 | else | |
3495 | ||
3496 | cat >>confdefs.h <<_ACEOF | |
3497 | #define size_t unsigned int | |
3498 | _ACEOF | |
3499 | ||
3500 | fi | |
3501 | ||
3502 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 | |
3503 | $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } | |
3504 | if ${ac_cv_header_time+:} false; then : | |
3505 | $as_echo_n "(cached) " >&6 | |
3506 | else | |
3507 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3508 | /* end confdefs.h. */ | |
1092 | 3509 | #include <sys/types.h> |
1093 | 3510 | #include <sys/time.h> |
1094 | 3511 | #include <time.h> |
1095 | int main() { | |
1096 | struct tm *tp; | |
1097 | ; return 0; } | |
1098 | EOF | |
1099 | if { (eval echo configure:1101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then | |
1100 | rm -rf conftest* | |
3512 | ||
3513 | int | |
3514 | main () | |
3515 | { | |
3516 | if ((struct tm *) 0) | |
3517 | return 0; | |
3518 | ; | |
3519 | return 0; | |
3520 | } | |
3521 | _ACEOF | |
3522 | if ac_fn_c_try_compile "$LINENO"; then : | |
1101 | 3523 | ac_cv_header_time=yes |
1102 | 3524 | else |
1103 | echo "configure: failed program was:" >&5 | |
1104 | cat conftest.$ac_ext >&5 | |
1105 | rm -rf conftest* | |
1106 | 3525 | ac_cv_header_time=no |
1107 | 3526 | fi |
1108 | rm -f conftest* | |
1109 | fi | |
1110 | ||
1111 | echo "$ac_t""$ac_cv_header_time" 1>&6 | |
3527 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
3528 | fi | |
3529 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 | |
3530 | $as_echo "$ac_cv_header_time" >&6; } | |
1112 | 3531 | if test $ac_cv_header_time = yes; then |
1113 | cat >> confdefs.h <<\EOF | |
1114 | #define TIME_WITH_SYS_TIME 1 | |
1115 | EOF | |
1116 | ||
1117 | fi | |
1118 | ||
1119 | for ac_hdr in fcntl.h unistd.h memory.h malloc.h errno.h | |
1120 | do | |
1121 | ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` | |
1122 | echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 | |
1123 | echo "configure:1125: checking for $ac_hdr" >&5 | |
1124 | if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then | |
1125 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1126 | else | |
1127 | cat > conftest.$ac_ext <<EOF | |
1128 | #line 1130 "configure" | |
1129 | #include "confdefs.h" | |
1130 | #include <$ac_hdr> | |
1131 | EOF | |
1132 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
1133 | { (eval echo configure:1135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1134 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1135 | if test -z "$ac_err"; then | |
1136 | rm -rf conftest* | |
1137 | eval "ac_cv_header_$ac_safe=yes" | |
1138 | else | |
1139 | echo "$ac_err" >&5 | |
1140 | echo "configure: failed program was:" >&5 | |
1141 | cat conftest.$ac_ext >&5 | |
1142 | rm -rf conftest* | |
1143 | eval "ac_cv_header_$ac_safe=no" | |
1144 | fi | |
1145 | rm -f conftest* | |
1146 | fi | |
1147 | if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then | |
1148 | echo "$ac_t""yes" 1>&6 | |
1149 | ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` | |
1150 | cat >> confdefs.h <<EOF | |
1151 | #define $ac_tr_hdr 1 | |
1152 | EOF | |
1153 | ||
1154 | else | |
1155 | echo "$ac_t""no" 1>&6 | |
1156 | fi | |
3532 | ||
3533 | $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h | |
3534 | ||
3535 | fi | |
3536 | ||
3537 | for ac_header in fcntl.h unistd.h memory.h malloc.h errno.h | |
3538 | do : | |
3539 | as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` | |
3540 | ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" | |
3541 | if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : | |
3542 | cat >>confdefs.h <<_ACEOF | |
3543 | #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 | |
3544 | _ACEOF | |
3545 | ||
3546 | fi | |
3547 | ||
1157 | 3548 | done |
1158 | 3549 | |
1159 | for ac_hdr in io.h sys/time.h | |
1160 | do | |
1161 | ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` | |
1162 | echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 | |
1163 | echo "configure:1165: checking for $ac_hdr" >&5 | |
1164 | if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then | |
1165 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1166 | else | |
1167 | cat > conftest.$ac_ext <<EOF | |
1168 | #line 1170 "configure" | |
1169 | #include "confdefs.h" | |
1170 | #include <$ac_hdr> | |
1171 | EOF | |
1172 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
1173 | { (eval echo configure:1175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1174 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1175 | if test -z "$ac_err"; then | |
1176 | rm -rf conftest* | |
1177 | eval "ac_cv_header_$ac_safe=yes" | |
1178 | else | |
1179 | echo "$ac_err" >&5 | |
1180 | echo "configure: failed program was:" >&5 | |
1181 | cat conftest.$ac_ext >&5 | |
1182 | rm -rf conftest* | |
1183 | eval "ac_cv_header_$ac_safe=no" | |
1184 | fi | |
1185 | rm -f conftest* | |
1186 | fi | |
1187 | if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then | |
1188 | echo "$ac_t""yes" 1>&6 | |
1189 | ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` | |
1190 | cat >> confdefs.h <<EOF | |
1191 | #define $ac_tr_hdr 1 | |
1192 | EOF | |
1193 | ||
1194 | else | |
1195 | echo "$ac_t""no" 1>&6 | |
1196 | fi | |
3550 | for ac_header in io.h sys/time.h | |
3551 | do : | |
3552 | as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` | |
3553 | ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" | |
3554 | if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : | |
3555 | cat >>confdefs.h <<_ACEOF | |
3556 | #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 | |
3557 | _ACEOF | |
3558 | ||
3559 | fi | |
3560 | ||
1197 | 3561 | done |
1198 | 3562 | |
1199 | 3563 | |
1200 | 3564 | CFLAGS="$CFLAGS -D_GNU_SOURCE" |
1201 | for ac_func in gettimeofday fgetc_unlocked | |
1202 | do | |
1203 | echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 | |
1204 | echo "configure:1206: checking for $ac_func" >&5 | |
1205 | if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then | |
1206 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1207 | else | |
1208 | cat > conftest.$ac_ext <<EOF | |
1209 | #line 1211 "configure" | |
1210 | #include "confdefs.h" | |
1211 | /* System header to define __stub macros and hopefully few prototypes, | |
1212 | which can conflict with char $ac_func(); below. */ | |
1213 | #include <assert.h> | |
1214 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1215 | /* We use char because int might match the return type of a gcc2 | |
1216 | builtin and then its argument prototype would still apply. */ | |
1217 | char $ac_func(); | |
1218 | ||
1219 | int main() { | |
1220 | ||
1221 | /* The GNU C library defines this for functions which it implements | |
1222 | to always fail with ENOSYS. Some functions are actually named | |
1223 | something starting with __ and the normal name is an alias. */ | |
1224 | #if defined (__stub_$ac_func) || defined (__stub___$ac_func) | |
1225 | choke me | |
1226 | #else | |
1227 | $ac_func(); | |
1228 | #endif | |
1229 | ||
1230 | ; return 0; } | |
1231 | EOF | |
1232 | if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1233 | rm -rf conftest* | |
1234 | eval "ac_cv_func_$ac_func=yes" | |
1235 | else | |
1236 | echo "configure: failed program was:" >&5 | |
1237 | cat conftest.$ac_ext >&5 | |
1238 | rm -rf conftest* | |
1239 | eval "ac_cv_func_$ac_func=no" | |
1240 | fi | |
1241 | rm -f conftest* | |
1242 | fi | |
1243 | ||
1244 | if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then | |
1245 | echo "$ac_t""yes" 1>&6 | |
1246 | ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` | |
1247 | cat >> confdefs.h <<EOF | |
1248 | #define $ac_tr_func 1 | |
1249 | EOF | |
1250 | ||
1251 | else | |
1252 | echo "$ac_t""no" 1>&6 | |
3565 | for ac_func in tempnam gettimeofday flockfile getc_unlocked feof_unlocked ferror_unlocked | |
3566 | do : | |
3567 | as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` | |
3568 | ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" | |
3569 | if eval test \"x\$"$as_ac_var"\" = x"yes"; then : | |
3570 | cat >>confdefs.h <<_ACEOF | |
3571 | #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 | |
3572 | _ACEOF | |
3573 | ||
1253 | 3574 | fi |
1254 | 3575 | done |
1255 | 3576 | |
1256 | 3577 | |
1257 | echo $ac_n "checking for tempnam""... $ac_c" 1>&6 | |
1258 | echo "configure:1260: checking for tempnam" >&5 | |
1259 | if eval "test \"`echo '$''{'ac_cv_func_tempnam'+set}'`\" = set"; then | |
1260 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1261 | else | |
1262 | cat > conftest.$ac_ext <<EOF | |
1263 | #line 1265 "configure" | |
1264 | #include "confdefs.h" | |
1265 | /* System header to define __stub macros and hopefully few prototypes, | |
1266 | which can conflict with char tempnam(); below. */ | |
1267 | #include <assert.h> | |
1268 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1269 | /* We use char because int might match the return type of a gcc2 | |
1270 | builtin and then its argument prototype would still apply. */ | |
1271 | char tempnam(); | |
1272 | ||
1273 | int main() { | |
1274 | ||
1275 | /* The GNU C library defines this for functions which it implements | |
1276 | to always fail with ENOSYS. Some functions are actually named | |
1277 | something starting with __ and the normal name is an alias. */ | |
1278 | #if defined (__stub_tempnam) || defined (__stub___tempnam) | |
1279 | choke me | |
1280 | #else | |
1281 | tempnam(); | |
1282 | #endif | |
1283 | ||
1284 | ; return 0; } | |
1285 | EOF | |
1286 | if { (eval echo configure:1288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1287 | rm -rf conftest* | |
1288 | eval "ac_cv_func_tempnam=yes" | |
1289 | else | |
1290 | echo "configure: failed program was:" >&5 | |
1291 | cat conftest.$ac_ext >&5 | |
1292 | rm -rf conftest* | |
1293 | eval "ac_cv_func_tempnam=no" | |
1294 | fi | |
1295 | rm -f conftest* | |
1296 | fi | |
1297 | ||
1298 | if eval "test \"`echo '$ac_cv_func_'tempnam`\" = yes"; then | |
1299 | echo "$ac_t""yes" 1>&6 | |
1300 | : | |
1301 | else | |
1302 | echo "$ac_t""no" 1>&6 | |
1303 | cat >> confdefs.h <<\EOF | |
1304 | #define tempnam FP_tempnam | |
1305 | EOF | |
1306 | ||
1307 | fi | |
1308 | ||
1309 | ||
1310 | echo $ac_n "checking for chmod""... $ac_c" 1>&6 | |
1311 | echo "configure:1313: checking for chmod" >&5 | |
1312 | if eval "test \"`echo '$''{'ac_cv_func_chmod'+set}'`\" = set"; then | |
1313 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1314 | else | |
1315 | cat > conftest.$ac_ext <<EOF | |
1316 | #line 1318 "configure" | |
1317 | #include "confdefs.h" | |
1318 | /* System header to define __stub macros and hopefully few prototypes, | |
1319 | which can conflict with char chmod(); below. */ | |
1320 | #include <assert.h> | |
1321 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1322 | /* We use char because int might match the return type of a gcc2 | |
1323 | builtin and then its argument prototype would still apply. */ | |
1324 | char chmod(); | |
1325 | ||
1326 | int main() { | |
1327 | ||
1328 | /* The GNU C library defines this for functions which it implements | |
1329 | to always fail with ENOSYS. Some functions are actually named | |
1330 | something starting with __ and the normal name is an alias. */ | |
1331 | #if defined (__stub_chmod) || defined (__stub___chmod) | |
1332 | choke me | |
1333 | #else | |
1334 | chmod(); | |
1335 | #endif | |
1336 | ||
1337 | ; return 0; } | |
1338 | EOF | |
1339 | if { (eval echo configure:1341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1340 | rm -rf conftest* | |
1341 | eval "ac_cv_func_chmod=yes" | |
1342 | else | |
1343 | echo "configure: failed program was:" >&5 | |
1344 | cat conftest.$ac_ext >&5 | |
1345 | rm -rf conftest* | |
1346 | eval "ac_cv_func_chmod=no" | |
1347 | fi | |
1348 | rm -f conftest* | |
1349 | fi | |
1350 | ||
1351 | if eval "test \"`echo '$ac_cv_func_'chmod`\" = yes"; then | |
1352 | echo "$ac_t""yes" 1>&6 | |
1353 | cat >> confdefs.h <<\EOF | |
1354 | #define HAVE_CHMOD 1 | |
1355 | EOF | |
1356 | ||
1357 | else | |
1358 | echo "$ac_t""no" 1>&6 | |
1359 | fi | |
1360 | ||
1361 | echo $ac_n "checking for umask""... $ac_c" 1>&6 | |
1362 | echo "configure:1364: checking for umask" >&5 | |
1363 | if eval "test \"`echo '$''{'ac_cv_func_umask'+set}'`\" = set"; then | |
1364 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1365 | else | |
1366 | cat > conftest.$ac_ext <<EOF | |
1367 | #line 1369 "configure" | |
1368 | #include "confdefs.h" | |
1369 | /* System header to define __stub macros and hopefully few prototypes, | |
1370 | which can conflict with char umask(); below. */ | |
1371 | #include <assert.h> | |
1372 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1373 | /* We use char because int might match the return type of a gcc2 | |
1374 | builtin and then its argument prototype would still apply. */ | |
1375 | char umask(); | |
1376 | ||
1377 | int main() { | |
1378 | ||
1379 | /* The GNU C library defines this for functions which it implements | |
1380 | to always fail with ENOSYS. Some functions are actually named | |
1381 | something starting with __ and the normal name is an alias. */ | |
1382 | #if defined (__stub_umask) || defined (__stub___umask) | |
1383 | choke me | |
1384 | #else | |
1385 | umask(); | |
1386 | #endif | |
1387 | ||
1388 | ; return 0; } | |
1389 | EOF | |
1390 | if { (eval echo configure:1392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1391 | rm -rf conftest* | |
1392 | eval "ac_cv_func_umask=yes" | |
1393 | else | |
1394 | echo "configure: failed program was:" >&5 | |
1395 | cat conftest.$ac_ext >&5 | |
1396 | rm -rf conftest* | |
1397 | eval "ac_cv_func_umask=no" | |
1398 | fi | |
1399 | rm -f conftest* | |
1400 | fi | |
1401 | ||
1402 | if eval "test \"`echo '$ac_cv_func_'umask`\" = yes"; then | |
1403 | echo "$ac_t""yes" 1>&6 | |
1404 | cat >> confdefs.h <<\EOF | |
1405 | #define HAVE_UMASK 1 | |
1406 | EOF | |
1407 | ||
1408 | else | |
1409 | echo "$ac_t""no" 1>&6 | |
1410 | fi | |
1411 | ||
1412 | echo $ac_n "checking for mkstemp""... $ac_c" 1>&6 | |
1413 | echo "configure:1415: checking for mkstemp" >&5 | |
1414 | if eval "test \"`echo '$''{'ac_cv_func_mkstemp'+set}'`\" = set"; then | |
1415 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1416 | else | |
1417 | cat > conftest.$ac_ext <<EOF | |
1418 | #line 1420 "configure" | |
1419 | #include "confdefs.h" | |
1420 | /* System header to define __stub macros and hopefully few prototypes, | |
1421 | which can conflict with char mkstemp(); below. */ | |
1422 | #include <assert.h> | |
1423 | /* Override any gcc2 internal prototype to avoid an error. */ | |
1424 | /* We use char because int might match the return type of a gcc2 | |
1425 | builtin and then its argument prototype would still apply. */ | |
1426 | char mkstemp(); | |
1427 | ||
1428 | int main() { | |
1429 | ||
1430 | /* The GNU C library defines this for functions which it implements | |
1431 | to always fail with ENOSYS. Some functions are actually named | |
1432 | something starting with __ and the normal name is an alias. */ | |
1433 | #if defined (__stub_mkstemp) || defined (__stub___mkstemp) | |
1434 | choke me | |
1435 | #else | |
1436 | mkstemp(); | |
1437 | #endif | |
1438 | ||
1439 | ; return 0; } | |
1440 | EOF | |
1441 | if { (eval echo configure:1443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1442 | rm -rf conftest* | |
1443 | eval "ac_cv_func_mkstemp=yes" | |
1444 | else | |
1445 | echo "configure: failed program was:" >&5 | |
1446 | cat conftest.$ac_ext >&5 | |
1447 | rm -rf conftest* | |
1448 | eval "ac_cv_func_mkstemp=no" | |
1449 | fi | |
1450 | rm -f conftest* | |
1451 | fi | |
1452 | ||
1453 | if eval "test \"`echo '$ac_cv_func_'mkstemp`\" = yes"; then | |
1454 | echo "$ac_t""yes" 1>&6 | |
1455 | cat >> confdefs.h <<\EOF | |
1456 | #define HAVE_MKSTEMP 1 | |
1457 | EOF | |
1458 | ||
1459 | else | |
1460 | echo "$ac_t""no" 1>&6 | |
1461 | fi | |
1462 | ||
1463 | ||
1464 | # | |
1465 | # strerror might be internally defined. this would cause a | |
1466 | # CHECK_FUNCS(strerror) to fail because it'd be called with | |
1467 | # zero arguments. So use our own code. | |
1468 | # | |
1469 | echo $ac_n "checking for strerror""... $ac_c" 1>&6 | |
1470 | echo "configure:1472: checking for strerror" >&5 | |
1471 | cat > conftest.$ac_ext <<EOF | |
1472 | #line 1474 "configure" | |
1473 | #include "confdefs.h" | |
1474 | ||
1475 | char *blubb() { return (char *) strerror (42); } | |
1476 | ||
1477 | int main() { | |
1478 | ||
1479 | (void) blubb(); | |
1480 | ||
1481 | ; return 0; } | |
1482 | EOF | |
1483 | if { (eval echo configure:1485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1484 | rm -rf conftest* | |
1485 | have_strerror=yes | |
1486 | else | |
1487 | echo "configure: failed program was:" >&5 | |
1488 | cat conftest.$ac_ext >&5 | |
1489 | rm -rf conftest* | |
1490 | cat >> confdefs.h <<\EOF | |
1491 | #define strerror FP_strerror | |
1492 | EOF | |
1493 | ||
1494 | have_strerror=no | |
1495 | fi | |
1496 | rm -f conftest* | |
1497 | echo "$ac_t""$have_strerror" 1>&6 | |
1498 | ||
1499 | echo $ac_n "checking for stdin""... $ac_c" 1>&6 | |
1500 | echo "configure:1502: checking for stdin" >&5 | |
1501 | cat > conftest.$ac_ext <<EOF | |
1502 | #line 1504 "configure" | |
1503 | #include "confdefs.h" | |
1504 | ||
1505 | #include <stdio.h> | |
1506 | char *blubb() { FILE *in, *out; in=stdin; out=stdout; return (char*)0; } | |
1507 | ||
1508 | int main() { | |
1509 | ||
1510 | (void) blubb(); | |
1511 | ||
1512 | ; return 0; } | |
1513 | EOF | |
1514 | if { (eval echo configure:1516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then | |
1515 | rm -rf conftest* | |
1516 | have_stdio=yes | |
1517 | else | |
1518 | echo "configure: failed program was:" >&5 | |
1519 | cat conftest.$ac_ext >&5 | |
1520 | rm -rf conftest* | |
1521 | cat >> confdefs.h <<\EOF | |
1522 | #define HAVE_STDIO 1 | |
1523 | EOF | |
1524 | ||
1525 | have_stdio=no | |
1526 | fi | |
1527 | rm -f conftest* | |
1528 | echo "$ac_t""$have_stdio" 1>&6 | |
1529 | ||
1530 | if test "$ac_cv_header_stdc" = "no" ; then | |
1531 | for ac_hdr in stdarg.h varargs.h | |
1532 | do | |
1533 | ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` | |
1534 | echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 | |
1535 | echo "configure:1537: checking for $ac_hdr" >&5 | |
1536 | if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then | |
1537 | echo $ac_n "(cached) $ac_c" 1>&6 | |
1538 | else | |
1539 | cat > conftest.$ac_ext <<EOF | |
1540 | #line 1542 "configure" | |
1541 | #include "confdefs.h" | |
1542 | #include <$ac_hdr> | |
1543 | EOF | |
1544 | ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" | |
1545 | { (eval echo configure:1547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | |
1546 | ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` | |
1547 | if test -z "$ac_err"; then | |
1548 | rm -rf conftest* | |
1549 | eval "ac_cv_header_$ac_safe=yes" | |
1550 | else | |
1551 | echo "$ac_err" >&5 | |
1552 | echo "configure: failed program was:" >&5 | |
1553 | cat conftest.$ac_ext >&5 | |
1554 | rm -rf conftest* | |
1555 | eval "ac_cv_header_$ac_safe=no" | |
1556 | fi | |
1557 | rm -f conftest* | |
1558 | fi | |
1559 | if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then | |
1560 | echo "$ac_t""yes" 1>&6 | |
1561 | ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` | |
1562 | cat >> confdefs.h <<EOF | |
1563 | #define $ac_tr_hdr 1 | |
1564 | EOF | |
1565 | ||
1566 | else | |
1567 | echo "$ac_t""no" 1>&6 | |
3578 | for ac_func in chmod umask mkstemp | |
3579 | do : | |
3580 | as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` | |
3581 | ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" | |
3582 | if eval test \"x\$"$as_ac_var"\" = x"yes"; then : | |
3583 | cat >>confdefs.h <<_ACEOF | |
3584 | #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 | |
3585 | _ACEOF | |
3586 | ||
1568 | 3587 | fi |
1569 | 3588 | done |
1570 | 3589 | |
1571 | if test "$ac_cv_header_stdarg_h" = "no" ; then | |
1572 | if test "$ac_cv_header_varargs_h" = "no" ; then | |
1573 | { echo "configure: error: neither stdarg.h nor varargs.h present" 1>&2; exit 1; } | |
1574 | fi | |
1575 | fi | |
1576 | fi | |
1577 | ||
1578 | # | |
1579 | # Check whether this is a DOS-Based system. Another bogus test. | |
1580 | # Don't even bother to print a message. This code is needed so | |
1581 | # that autoheader includes the #undef into the final config.h | |
1582 | # and we can change the definition by hand on a really DOS | |
1583 | # system (where ./configure doesn't work anyway ...) | |
1584 | # | |
1585 | ||
1586 | if false ; then | |
1587 | cat >> confdefs.h <<\EOF | |
1588 | #define SYSTEM_DOS 1 | |
1589 | EOF | |
1590 | ||
1591 | cat >> confdefs.h <<\EOF | |
1592 | #define SYSTEM_QUICKWIN 1 | |
1593 | EOF | |
1594 | ||
1595 | cat >> confdefs.h <<\EOF | |
1596 | #define SYSTEM_WINDLL 1 | |
1597 | EOF | |
1598 | ||
1599 | cat >> confdefs.h <<\EOF | |
1600 | #define SYSTEM_OS2 1 | |
1601 | EOF | |
1602 | ||
1603 | fi | |
1604 | 3590 | |
1605 | 3591 | # |
1606 | 3592 | # On some systems (so far, OS2 and WINDOWS), functions that are exported |
1607 | 3593 | # from a DLL must be declared specifically. |
1608 | 3594 | # |
1609 | 3595 | |
1610 | cat >> confdefs.h <<EOF | |
1611 | #define UUEXPORT | |
1612 | EOF | |
1613 | ||
1614 | cat >> confdefs.h <<EOF | |
1615 | #define TOOLEXPORT | |
1616 | EOF | |
3596 | cat >>confdefs.h <<_ACEOF | |
3597 | #define UUEXPORT /**/ | |
3598 | _ACEOF | |
3599 | ||
3600 | cat >>confdefs.h <<_ACEOF | |
3601 | #define TOOLEXPORT /**/ | |
3602 | _ACEOF | |
1617 | 3603 | |
1618 | 3604 | |
1619 | 3605 | # |
1620 | 3606 | # set version number |
1621 | 3607 | # |
1622 | echo $ac_n "checking version number""... $ac_c" 1>&6 | |
1623 | echo "configure:1625: checking version number" >&5 | |
3608 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking version number" >&5 | |
3609 | $as_echo_n "checking version number... " >&6; } | |
1624 | 3610 | version_number="$VERSION"pl"$PATCH" |
1625 | echo "$ac_t""$version_number" 1>&6 | |
3611 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_number" >&5 | |
3612 | $as_echo "$version_number" >&6; } | |
1626 | 3613 | |
1627 | 3614 | |
1628 | 3615 | |
1630 | 3617 | # done |
1631 | 3618 | # |
1632 | 3619 | |
1633 | trap '' 1 2 15 | |
1634 | cat > confcache <<\EOF | |
3620 | ac_config_files="$ac_config_files Makefile" | |
3621 | ||
3622 | cat >confcache <<\_ACEOF | |
1635 | 3623 | # This file is a shell script that caches the results of configure |
1636 | 3624 | # tests run on this system so they can be shared between configure |
1637 | # scripts and configure runs. It is not useful on other systems. | |
1638 | # If it contains results you don't want to keep, you may remove or edit it. | |
3625 | # scripts and configure runs, see configure's option --config-cache. | |
3626 | # It is not useful on other systems. If it contains results you don't | |
3627 | # want to keep, you may remove or edit it. | |
1639 | 3628 | # |
1640 | # By default, configure uses ./config.cache as the cache file, | |
1641 | # creating it if it does not exist already. You can give configure | |
1642 | # the --cache-file=FILE option to use a different cache file; that is | |
1643 | # what configure does when it calls configure scripts in | |
1644 | # subdirectories, so they share the cache. | |
1645 | # Giving --cache-file=/dev/null disables caching, for debugging configure. | |
1646 | # config.status only pays attention to the cache file if you give it the | |
1647 | # --recheck option to rerun configure. | |
3629 | # config.status only pays attention to the cache file if you give it | |
3630 | # the --recheck option to rerun configure. | |
1648 | 3631 | # |
1649 | EOF | |
3632 | # `ac_cv_env_foo' variables (set or unset) will be overridden when | |
3633 | # loading this file, other *unset* `ac_cv_foo' will be assigned the | |
3634 | # following values. | |
3635 | ||
3636 | _ACEOF | |
3637 | ||
1650 | 3638 | # The following way of writing the cache mishandles newlines in values, |
1651 | 3639 | # but we know of no workaround that is simple, portable, and efficient. |
1652 | # So, don't put newlines in cache variables' values. | |
3640 | # So, we kill variables containing newlines. | |
1653 | 3641 | # Ultrix sh set writes to stderr and can't be redirected directly, |
1654 | 3642 | # and sets the high bit in the cache file unless we assign to the vars. |
1655 | (set) 2>&1 | | |
1656 | case `(ac_space=' '; set | grep ac_space) 2>&1` in | |
1657 | *ac_space=\ *) | |
1658 | # `set' does not quote correctly, so add quotes (double-quote substitution | |
1659 | # turns \\\\ into \\, and sed turns \\ into \). | |
1660 | sed -n \ | |
1661 | -e "s/'/'\\\\''/g" \ | |
1662 | -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" | |
1663 | ;; | |
1664 | *) | |
1665 | # `set' quotes correctly as required by POSIX, so do not add quotes. | |
1666 | sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' | |
1667 | ;; | |
1668 | esac >> confcache | |
1669 | if cmp -s $cache_file confcache; then | |
1670 | : | |
1671 | else | |
1672 | if test -w $cache_file; then | |
1673 | echo "updating cache $cache_file" | |
1674 | cat confcache > $cache_file | |
3643 | ( | |
3644 | for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do | |
3645 | eval ac_val=\$$ac_var | |
3646 | case $ac_val in #( | |
3647 | *${as_nl}*) | |
3648 | case $ac_var in #( | |
3649 | *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 | |
3650 | $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; | |
3651 | esac | |
3652 | case $ac_var in #( | |
3653 | _ | IFS | as_nl) ;; #( | |
3654 | BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( | |
3655 | *) { eval $ac_var=; unset $ac_var;} ;; | |
3656 | esac ;; | |
3657 | esac | |
3658 | done | |
3659 | ||
3660 | (set) 2>&1 | | |
3661 | case $as_nl`(ac_space=' '; set) 2>&1` in #( | |
3662 | *${as_nl}ac_space=\ *) | |
3663 | # `set' does not quote correctly, so add quotes: double-quote | |
3664 | # substitution turns \\\\ into \\, and sed turns \\ into \. | |
3665 | sed -n \ | |
3666 | "s/'/'\\\\''/g; | |
3667 | s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" | |
3668 | ;; #( | |
3669 | *) | |
3670 | # `set' quotes correctly as required by POSIX, so do not add quotes. | |
3671 | sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" | |
3672 | ;; | |
3673 | esac | | |
3674 | sort | |
3675 | ) | | |
3676 | sed ' | |
3677 | /^ac_cv_env_/b end | |
3678 | t clear | |
3679 | :clear | |
3680 | s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ | |
3681 | t end | |
3682 | s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ | |
3683 | :end' >>confcache | |
3684 | if diff "$cache_file" confcache >/dev/null 2>&1; then :; else | |
3685 | if test -w "$cache_file"; then | |
3686 | if test "x$cache_file" != "x/dev/null"; then | |
3687 | { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 | |
3688 | $as_echo "$as_me: updating cache $cache_file" >&6;} | |
3689 | if test ! -f "$cache_file" || test -h "$cache_file"; then | |
3690 | cat confcache >"$cache_file" | |
3691 | else | |
3692 | case $cache_file in #( | |
3693 | */* | ?:*) | |
3694 | mv -f confcache "$cache_file"$$ && | |
3695 | mv -f "$cache_file"$$ "$cache_file" ;; #( | |
3696 | *) | |
3697 | mv -f confcache "$cache_file" ;; | |
3698 | esac | |
3699 | fi | |
3700 | fi | |
1675 | 3701 | else |
1676 | echo "not updating unwritable cache $cache_file" | |
3702 | { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 | |
3703 | $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} | |
1677 | 3704 | fi |
1678 | 3705 | fi |
1679 | 3706 | rm -f confcache |
1680 | ||
1681 | trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 | |
1682 | 3707 | |
1683 | 3708 | test "x$prefix" = xNONE && prefix=$ac_default_prefix |
1684 | 3709 | # Let make expand exec_prefix. |
1685 | 3710 | test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' |
1686 | 3711 | |
1687 | # Any assignment to VPATH causes Sun make to only execute | |
1688 | # the first set of double-colon rules, so remove it if not needed. | |
1689 | # If there is a colon in the path, we need to keep it. | |
1690 | if test "x$srcdir" = x.; then | |
1691 | ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' | |
1692 | fi | |
1693 | ||
1694 | trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 | |
1695 | ||
1696 | 3712 | DEFS=-DHAVE_CONFIG_H |
1697 | 3713 | |
1698 | # Without the "./", some shells look in PATH for config.status. | |
1699 | : ${CONFIG_STATUS=./config.status} | |
1700 | ||
1701 | echo creating $CONFIG_STATUS | |
1702 | rm -f $CONFIG_STATUS | |
1703 | cat > $CONFIG_STATUS <<EOF | |
1704 | #! /bin/sh | |
1705 | # Generated automatically by configure. | |
3714 | ac_libobjs= | |
3715 | ac_ltlibobjs= | |
3716 | U= | |
3717 | for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue | |
3718 | # 1. Remove the extension, and $U if already installed. | |
3719 | ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' | |
3720 | ac_i=`$as_echo "$ac_i" | sed "$ac_script"` | |
3721 | # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR | |
3722 | # will be set to the directory where LIBOBJS objects are built. | |
3723 | as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" | |
3724 | as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' | |
3725 | done | |
3726 | LIBOBJS=$ac_libobjs | |
3727 | ||
3728 | LTLIBOBJS=$ac_ltlibobjs | |
3729 | ||
3730 | ||
3731 | ||
3732 | : "${CONFIG_STATUS=./config.status}" | |
3733 | ac_write_fail=0 | |
3734 | ac_clean_files_save=$ac_clean_files | |
3735 | ac_clean_files="$ac_clean_files $CONFIG_STATUS" | |
3736 | { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 | |
3737 | $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} | |
3738 | as_write_fail=0 | |
3739 | cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 | |
3740 | #! $SHELL | |
3741 | # Generated by $as_me. | |
1706 | 3742 | # Run this file to recreate the current configuration. |
1707 | # This directory was configured as follows, | |
1708 | # on host `(hostname || uname -n) 2>/dev/null | sed 1q`: | |
1709 | # | |
1710 | # $0 $ac_configure_args | |
1711 | # | |
1712 | 3743 | # Compiler output produced by configure, useful for debugging |
1713 | # configure, is in ./config.log if it exists. | |
1714 | ||
1715 | ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" | |
1716 | for ac_option | |
3744 | # configure, is in config.log if it exists. | |
3745 | ||
3746 | debug=false | |
3747 | ac_cs_recheck=false | |
3748 | ac_cs_silent=false | |
3749 | ||
3750 | SHELL=\${CONFIG_SHELL-$SHELL} | |
3751 | export SHELL | |
3752 | _ASEOF | |
3753 | cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 | |
3754 | ## -------------------- ## | |
3755 | ## M4sh Initialization. ## | |
3756 | ## -------------------- ## | |
3757 | ||
3758 | # Be more Bourne compatible | |
3759 | DUALCASE=1; export DUALCASE # for MKS sh | |
3760 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : | |
3761 | emulate sh | |
3762 | NULLCMD=: | |
3763 | # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which | |
3764 | # is contrary to our usage. Disable this feature. | |
3765 | alias -g '${1+"$@"}'='"$@"' | |
3766 | setopt NO_GLOB_SUBST | |
3767 | else | |
3768 | case `(set -o) 2>/dev/null` in #( | |
3769 | *posix*) : | |
3770 | set -o posix ;; #( | |
3771 | *) : | |
3772 | ;; | |
3773 | esac | |
3774 | fi | |
3775 | ||
3776 | ||
3777 | as_nl=' | |
3778 | ' | |
3779 | export as_nl | |
3780 | # Printing a long string crashes Solaris 7 /usr/bin/printf. | |
3781 | as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' | |
3782 | as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo | |
3783 | as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo | |
3784 | # Prefer a ksh shell builtin over an external printf program on Solaris, | |
3785 | # but without wasting forks for bash or zsh. | |
3786 | if test -z "$BASH_VERSION$ZSH_VERSION" \ | |
3787 | && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then | |
3788 | as_echo='print -r --' | |
3789 | as_echo_n='print -rn --' | |
3790 | elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then | |
3791 | as_echo='printf %s\n' | |
3792 | as_echo_n='printf %s' | |
3793 | else | |
3794 | if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then | |
3795 | as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' | |
3796 | as_echo_n='/usr/ucb/echo -n' | |
3797 | else | |
3798 | as_echo_body='eval expr "X$1" : "X\\(.*\\)"' | |
3799 | as_echo_n_body='eval | |
3800 | arg=$1; | |
3801 | case $arg in #( | |
3802 | *"$as_nl"*) | |
3803 | expr "X$arg" : "X\\(.*\\)$as_nl"; | |
3804 | arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; | |
3805 | esac; | |
3806 | expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" | |
3807 | ' | |
3808 | export as_echo_n_body | |
3809 | as_echo_n='sh -c $as_echo_n_body as_echo' | |
3810 | fi | |
3811 | export as_echo_body | |
3812 | as_echo='sh -c $as_echo_body as_echo' | |
3813 | fi | |
3814 | ||
3815 | # The user is always right. | |
3816 | if test "${PATH_SEPARATOR+set}" != set; then | |
3817 | PATH_SEPARATOR=: | |
3818 | (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { | |
3819 | (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || | |
3820 | PATH_SEPARATOR=';' | |
3821 | } | |
3822 | fi | |
3823 | ||
3824 | ||
3825 | # IFS | |
3826 | # We need space, tab and new line, in precisely that order. Quoting is | |
3827 | # there to prevent editors from complaining about space-tab. | |
3828 | # (If _AS_PATH_WALK were called with IFS unset, it would disable word | |
3829 | # splitting by setting IFS to empty value.) | |
3830 | IFS=" "" $as_nl" | |
3831 | ||
3832 | # Find who we are. Look in the path if we contain no directory separator. | |
3833 | as_myself= | |
3834 | case $0 in #(( | |
3835 | *[\\/]* ) as_myself=$0 ;; | |
3836 | *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
3837 | for as_dir in $PATH | |
1717 | 3838 | do |
1718 | case "\$ac_option" in | |
3839 | IFS=$as_save_IFS | |
3840 | test -z "$as_dir" && as_dir=. | |
3841 | test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break | |
3842 | done | |
3843 | IFS=$as_save_IFS | |
3844 | ||
3845 | ;; | |
3846 | esac | |
3847 | # We did not find ourselves, most probably we were run as `sh COMMAND' | |
3848 | # in which case we are not to be found in the path. | |
3849 | if test "x$as_myself" = x; then | |
3850 | as_myself=$0 | |
3851 | fi | |
3852 | if test ! -f "$as_myself"; then | |
3853 | $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 | |
3854 | exit 1 | |
3855 | fi | |
3856 | ||
3857 | # Unset variables that we do not need and which cause bugs (e.g. in | |
3858 | # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" | |
3859 | # suppresses any "Segmentation fault" message there. '((' could | |
3860 | # trigger a bug in pdksh 5.2.14. | |
3861 | for as_var in BASH_ENV ENV MAIL MAILPATH | |
3862 | do eval test x\${$as_var+set} = xset \ | |
3863 | && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : | |
3864 | done | |
3865 | PS1='$ ' | |
3866 | PS2='> ' | |
3867 | PS4='+ ' | |
3868 | ||
3869 | # NLS nuisances. | |
3870 | LC_ALL=C | |
3871 | export LC_ALL | |
3872 | LANGUAGE=C | |
3873 | export LANGUAGE | |
3874 | ||
3875 | # CDPATH. | |
3876 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | |
3877 | ||
3878 | ||
3879 | # as_fn_error STATUS ERROR [LINENO LOG_FD] | |
3880 | # ---------------------------------------- | |
3881 | # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are | |
3882 | # provided, also output the error to LOG_FD, referencing LINENO. Then exit the | |
3883 | # script with STATUS, using 1 if that was 0. | |
3884 | as_fn_error () | |
3885 | { | |
3886 | as_status=$1; test $as_status -eq 0 && as_status=1 | |
3887 | if test "$4"; then | |
3888 | as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack | |
3889 | $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 | |
3890 | fi | |
3891 | $as_echo "$as_me: error: $2" >&2 | |
3892 | as_fn_exit $as_status | |
3893 | } # as_fn_error | |
3894 | ||
3895 | ||
3896 | # as_fn_set_status STATUS | |
3897 | # ----------------------- | |
3898 | # Set $? to STATUS, without forking. | |
3899 | as_fn_set_status () | |
3900 | { | |
3901 | return $1 | |
3902 | } # as_fn_set_status | |
3903 | ||
3904 | # as_fn_exit STATUS | |
3905 | # ----------------- | |
3906 | # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. | |
3907 | as_fn_exit () | |
3908 | { | |
3909 | set +e | |
3910 | as_fn_set_status $1 | |
3911 | exit $1 | |
3912 | } # as_fn_exit | |
3913 | ||
3914 | # as_fn_unset VAR | |
3915 | # --------------- | |
3916 | # Portably unset VAR. | |
3917 | as_fn_unset () | |
3918 | { | |
3919 | { eval $1=; unset $1;} | |
3920 | } | |
3921 | as_unset=as_fn_unset | |
3922 | # as_fn_append VAR VALUE | |
3923 | # ---------------------- | |
3924 | # Append the text in VALUE to the end of the definition contained in VAR. Take | |
3925 | # advantage of any shell optimizations that allow amortized linear growth over | |
3926 | # repeated appends, instead of the typical quadratic growth present in naive | |
3927 | # implementations. | |
3928 | if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : | |
3929 | eval 'as_fn_append () | |
3930 | { | |
3931 | eval $1+=\$2 | |
3932 | }' | |
3933 | else | |
3934 | as_fn_append () | |
3935 | { | |
3936 | eval $1=\$$1\$2 | |
3937 | } | |
3938 | fi # as_fn_append | |
3939 | ||
3940 | # as_fn_arith ARG... | |
3941 | # ------------------ | |
3942 | # Perform arithmetic evaluation on the ARGs, and store the result in the | |
3943 | # global $as_val. Take advantage of shells that can avoid forks. The arguments | |
3944 | # must be portable across $(()) and expr. | |
3945 | if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : | |
3946 | eval 'as_fn_arith () | |
3947 | { | |
3948 | as_val=$(( $* )) | |
3949 | }' | |
3950 | else | |
3951 | as_fn_arith () | |
3952 | { | |
3953 | as_val=`expr "$@" || test $? -eq 1` | |
3954 | } | |
3955 | fi # as_fn_arith | |
3956 | ||
3957 | ||
3958 | if expr a : '\(a\)' >/dev/null 2>&1 && | |
3959 | test "X`expr 00001 : '.*\(...\)'`" = X001; then | |
3960 | as_expr=expr | |
3961 | else | |
3962 | as_expr=false | |
3963 | fi | |
3964 | ||
3965 | if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then | |
3966 | as_basename=basename | |
3967 | else | |
3968 | as_basename=false | |
3969 | fi | |
3970 | ||
3971 | if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then | |
3972 | as_dirname=dirname | |
3973 | else | |
3974 | as_dirname=false | |
3975 | fi | |
3976 | ||
3977 | as_me=`$as_basename -- "$0" || | |
3978 | $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ | |
3979 | X"$0" : 'X\(//\)$' \| \ | |
3980 | X"$0" : 'X\(/\)' \| . 2>/dev/null || | |
3981 | $as_echo X/"$0" | | |
3982 | sed '/^.*\/\([^/][^/]*\)\/*$/{ | |
3983 | s//\1/ | |
3984 | q | |
3985 | } | |
3986 | /^X\/\(\/\/\)$/{ | |
3987 | s//\1/ | |
3988 | q | |
3989 | } | |
3990 | /^X\/\(\/\).*/{ | |
3991 | s//\1/ | |
3992 | q | |
3993 | } | |
3994 | s/.*/./; q'` | |
3995 | ||
3996 | # Avoid depending upon Character Ranges. | |
3997 | as_cr_letters='abcdefghijklmnopqrstuvwxyz' | |
3998 | as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
3999 | as_cr_Letters=$as_cr_letters$as_cr_LETTERS | |
4000 | as_cr_digits='0123456789' | |
4001 | as_cr_alnum=$as_cr_Letters$as_cr_digits | |
4002 | ||
4003 | ECHO_C= ECHO_N= ECHO_T= | |
4004 | case `echo -n x` in #((((( | |
4005 | -n*) | |
4006 | case `echo 'xy\c'` in | |
4007 | *c*) ECHO_T=' ';; # ECHO_T is single tab character. | |
4008 | xy) ECHO_C='\c';; | |
4009 | *) echo `echo ksh88 bug on AIX 6.1` > /dev/null | |
4010 | ECHO_T=' ';; | |
4011 | esac;; | |
4012 | *) | |
4013 | ECHO_N='-n';; | |
4014 | esac | |
4015 | ||
4016 | rm -f conf$$ conf$$.exe conf$$.file | |
4017 | if test -d conf$$.dir; then | |
4018 | rm -f conf$$.dir/conf$$.file | |
4019 | else | |
4020 | rm -f conf$$.dir | |
4021 | mkdir conf$$.dir 2>/dev/null | |
4022 | fi | |
4023 | if (echo >conf$$.file) 2>/dev/null; then | |
4024 | if ln -s conf$$.file conf$$ 2>/dev/null; then | |
4025 | as_ln_s='ln -s' | |
4026 | # ... but there are two gotchas: | |
4027 | # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. | |
4028 | # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. | |
4029 | # In both cases, we have to default to `cp -pR'. | |
4030 | ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || | |
4031 | as_ln_s='cp -pR' | |
4032 | elif ln conf$$.file conf$$ 2>/dev/null; then | |
4033 | as_ln_s=ln | |
4034 | else | |
4035 | as_ln_s='cp -pR' | |
4036 | fi | |
4037 | else | |
4038 | as_ln_s='cp -pR' | |
4039 | fi | |
4040 | rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file | |
4041 | rmdir conf$$.dir 2>/dev/null | |
4042 | ||
4043 | ||
4044 | # as_fn_mkdir_p | |
4045 | # ------------- | |
4046 | # Create "$as_dir" as a directory, including parents if necessary. | |
4047 | as_fn_mkdir_p () | |
4048 | { | |
4049 | ||
4050 | case $as_dir in #( | |
4051 | -*) as_dir=./$as_dir;; | |
4052 | esac | |
4053 | test -d "$as_dir" || eval $as_mkdir_p || { | |
4054 | as_dirs= | |
4055 | while :; do | |
4056 | case $as_dir in #( | |
4057 | *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( | |
4058 | *) as_qdir=$as_dir;; | |
4059 | esac | |
4060 | as_dirs="'$as_qdir' $as_dirs" | |
4061 | as_dir=`$as_dirname -- "$as_dir" || | |
4062 | $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ | |
4063 | X"$as_dir" : 'X\(//\)[^/]' \| \ | |
4064 | X"$as_dir" : 'X\(//\)$' \| \ | |
4065 | X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || | |
4066 | $as_echo X"$as_dir" | | |
4067 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ | |
4068 | s//\1/ | |
4069 | q | |
4070 | } | |
4071 | /^X\(\/\/\)[^/].*/{ | |
4072 | s//\1/ | |
4073 | q | |
4074 | } | |
4075 | /^X\(\/\/\)$/{ | |
4076 | s//\1/ | |
4077 | q | |
4078 | } | |
4079 | /^X\(\/\).*/{ | |
4080 | s//\1/ | |
4081 | q | |
4082 | } | |
4083 | s/.*/./; q'` | |
4084 | test -d "$as_dir" && break | |
4085 | done | |
4086 | test -z "$as_dirs" || eval "mkdir $as_dirs" | |
4087 | } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" | |
4088 | ||
4089 | ||
4090 | } # as_fn_mkdir_p | |
4091 | if mkdir -p . 2>/dev/null; then | |
4092 | as_mkdir_p='mkdir -p "$as_dir"' | |
4093 | else | |
4094 | test -d ./-p && rmdir ./-p | |
4095 | as_mkdir_p=false | |
4096 | fi | |
4097 | ||
4098 | ||
4099 | # as_fn_executable_p FILE | |
4100 | # ----------------------- | |
4101 | # Test if FILE is an executable regular file. | |
4102 | as_fn_executable_p () | |
4103 | { | |
4104 | test -f "$1" && test -x "$1" | |
4105 | } # as_fn_executable_p | |
4106 | as_test_x='test -x' | |
4107 | as_executable_p=as_fn_executable_p | |
4108 | ||
4109 | # Sed expression to map a string onto a valid CPP name. | |
4110 | as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" | |
4111 | ||
4112 | # Sed expression to map a string onto a valid variable name. | |
4113 | as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" | |
4114 | ||
4115 | ||
4116 | exec 6>&1 | |
4117 | ## ----------------------------------- ## | |
4118 | ## Main body of $CONFIG_STATUS script. ## | |
4119 | ## ----------------------------------- ## | |
4120 | _ASEOF | |
4121 | test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 | |
4122 | ||
4123 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4124 | # Save the log message, to keep $0 and so on meaningful, and to | |
4125 | # report actual input values of CONFIG_FILES etc. instead of their | |
4126 | # values after options handling. | |
4127 | ac_log=" | |
4128 | This file was extended by $as_me, which was | |
4129 | generated by GNU Autoconf 2.69. Invocation command line was | |
4130 | ||
4131 | CONFIG_FILES = $CONFIG_FILES | |
4132 | CONFIG_HEADERS = $CONFIG_HEADERS | |
4133 | CONFIG_LINKS = $CONFIG_LINKS | |
4134 | CONFIG_COMMANDS = $CONFIG_COMMANDS | |
4135 | $ $0 $@ | |
4136 | ||
4137 | on `(hostname || uname -n) 2>/dev/null | sed 1q` | |
4138 | " | |
4139 | ||
4140 | _ACEOF | |
4141 | ||
4142 | case $ac_config_files in *" | |
4143 | "*) set x $ac_config_files; shift; ac_config_files=$*;; | |
4144 | esac | |
4145 | ||
4146 | case $ac_config_headers in *" | |
4147 | "*) set x $ac_config_headers; shift; ac_config_headers=$*;; | |
4148 | esac | |
4149 | ||
4150 | ||
4151 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4152 | # Files that config.status was made for. | |
4153 | config_files="$ac_config_files" | |
4154 | config_headers="$ac_config_headers" | |
4155 | ||
4156 | _ACEOF | |
4157 | ||
4158 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4159 | ac_cs_usage="\ | |
4160 | \`$as_me' instantiates files and other configuration actions | |
4161 | from templates according to the current configuration. Unless the files | |
4162 | and actions are specified as TAGs, all are instantiated by default. | |
4163 | ||
4164 | Usage: $0 [OPTION]... [TAG]... | |
4165 | ||
4166 | -h, --help print this help, then exit | |
4167 | -V, --version print version number and configuration settings, then exit | |
4168 | --config print configuration, then exit | |
4169 | -q, --quiet, --silent | |
4170 | do not print progress messages | |
4171 | -d, --debug don't remove temporary files | |
4172 | --recheck update $as_me by reconfiguring in the same conditions | |
4173 | --file=FILE[:TEMPLATE] | |
4174 | instantiate the configuration file FILE | |
4175 | --header=FILE[:TEMPLATE] | |
4176 | instantiate the configuration header FILE | |
4177 | ||
4178 | Configuration files: | |
4179 | $config_files | |
4180 | ||
4181 | Configuration headers: | |
4182 | $config_headers | |
4183 | ||
4184 | Report bugs to the package provider." | |
4185 | ||
4186 | _ACEOF | |
4187 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4188 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" | |
4189 | ac_cs_version="\\ | |
4190 | config.status | |
4191 | configured by $0, generated by GNU Autoconf 2.69, | |
4192 | with options \\"\$ac_cs_config\\" | |
4193 | ||
4194 | Copyright (C) 2012 Free Software Foundation, Inc. | |
4195 | This config.status script is free software; the Free Software Foundation | |
4196 | gives unlimited permission to copy, distribute and modify it." | |
4197 | ||
4198 | ac_pwd='$ac_pwd' | |
4199 | srcdir='$srcdir' | |
4200 | test -n "\$AWK" || AWK=awk | |
4201 | _ACEOF | |
4202 | ||
4203 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4204 | # The default lists apply if the user does not specify any file. | |
4205 | ac_need_defaults=: | |
4206 | while test $# != 0 | |
4207 | do | |
4208 | case $1 in | |
4209 | --*=?*) | |
4210 | ac_option=`expr "X$1" : 'X\([^=]*\)='` | |
4211 | ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` | |
4212 | ac_shift=: | |
4213 | ;; | |
4214 | --*=) | |
4215 | ac_option=`expr "X$1" : 'X\([^=]*\)='` | |
4216 | ac_optarg= | |
4217 | ac_shift=: | |
4218 | ;; | |
4219 | *) | |
4220 | ac_option=$1 | |
4221 | ac_optarg=$2 | |
4222 | ac_shift=shift | |
4223 | ;; | |
4224 | esac | |
4225 | ||
4226 | case $ac_option in | |
4227 | # Handling of the options. | |
1719 | 4228 | -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) |
1720 | echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" | |
1721 | exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; | |
1722 | -version | --version | --versio | --versi | --vers | --ver | --ve | --v) | |
1723 | echo "$CONFIG_STATUS generated by autoconf version 2.13" | |
1724 | exit 0 ;; | |
1725 | -help | --help | --hel | --he | --h) | |
1726 | echo "\$ac_cs_usage"; exit 0 ;; | |
1727 | *) echo "\$ac_cs_usage"; exit 1 ;; | |
4229 | ac_cs_recheck=: ;; | |
4230 | --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) | |
4231 | $as_echo "$ac_cs_version"; exit ;; | |
4232 | --config | --confi | --conf | --con | --co | --c ) | |
4233 | $as_echo "$ac_cs_config"; exit ;; | |
4234 | --debug | --debu | --deb | --de | --d | -d ) | |
4235 | debug=: ;; | |
4236 | --file | --fil | --fi | --f ) | |
4237 | $ac_shift | |
4238 | case $ac_optarg in | |
4239 | *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; | |
4240 | '') as_fn_error $? "missing file argument" ;; | |
4241 | esac | |
4242 | as_fn_append CONFIG_FILES " '$ac_optarg'" | |
4243 | ac_need_defaults=false;; | |
4244 | --header | --heade | --head | --hea ) | |
4245 | $ac_shift | |
4246 | case $ac_optarg in | |
4247 | *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; | |
4248 | esac | |
4249 | as_fn_append CONFIG_HEADERS " '$ac_optarg'" | |
4250 | ac_need_defaults=false;; | |
4251 | --he | --h) | |
4252 | # Conflict between --help and --header | |
4253 | as_fn_error $? "ambiguous option: \`$1' | |
4254 | Try \`$0 --help' for more information.";; | |
4255 | --help | --hel | -h ) | |
4256 | $as_echo "$ac_cs_usage"; exit ;; | |
4257 | -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | |
4258 | | -silent | --silent | --silen | --sile | --sil | --si | --s) | |
4259 | ac_cs_silent=: ;; | |
4260 | ||
4261 | # This is an error. | |
4262 | -*) as_fn_error $? "unrecognized option: \`$1' | |
4263 | Try \`$0 --help' for more information." ;; | |
4264 | ||
4265 | *) as_fn_append ac_config_targets " $1" | |
4266 | ac_need_defaults=false ;; | |
4267 | ||
4268 | esac | |
4269 | shift | |
4270 | done | |
4271 | ||
4272 | ac_configure_extra_args= | |
4273 | ||
4274 | if $ac_cs_silent; then | |
4275 | exec 6>/dev/null | |
4276 | ac_configure_extra_args="$ac_configure_extra_args --silent" | |
4277 | fi | |
4278 | ||
4279 | _ACEOF | |
4280 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4281 | if \$ac_cs_recheck; then | |
4282 | set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion | |
4283 | shift | |
4284 | \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 | |
4285 | CONFIG_SHELL='$SHELL' | |
4286 | export CONFIG_SHELL | |
4287 | exec "\$@" | |
4288 | fi | |
4289 | ||
4290 | _ACEOF | |
4291 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4292 | exec 5>>config.log | |
4293 | { | |
4294 | echo | |
4295 | sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX | |
4296 | ## Running $as_me. ## | |
4297 | _ASBOX | |
4298 | $as_echo "$ac_log" | |
4299 | } >&5 | |
4300 | ||
4301 | _ACEOF | |
4302 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4303 | _ACEOF | |
4304 | ||
4305 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4306 | ||
4307 | # Handling of arguments. | |
4308 | for ac_config_target in $ac_config_targets | |
4309 | do | |
4310 | case $ac_config_target in | |
4311 | "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; | |
4312 | "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; | |
4313 | ||
4314 | *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; | |
1728 | 4315 | esac |
1729 | 4316 | done |
1730 | 4317 | |
1731 | ac_given_srcdir=$srcdir | |
1732 | ||
1733 | trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 | |
1734 | EOF | |
1735 | cat >> $CONFIG_STATUS <<EOF | |
1736 | ||
1737 | # Protect against being on the right side of a sed subst in config.status. | |
1738 | sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; | |
1739 | s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF | |
1740 | $ac_vpsub | |
1741 | $extrasub | |
1742 | s%@SHELL@%$SHELL%g | |
1743 | s%@CFLAGS@%$CFLAGS%g | |
1744 | s%@CPPFLAGS@%$CPPFLAGS%g | |
1745 | s%@CXXFLAGS@%$CXXFLAGS%g | |
1746 | s%@FFLAGS@%$FFLAGS%g | |
1747 | s%@DEFS@%$DEFS%g | |
1748 | s%@LDFLAGS@%$LDFLAGS%g | |
1749 | s%@LIBS@%$LIBS%g | |
1750 | s%@exec_prefix@%$exec_prefix%g | |
1751 | s%@prefix@%$prefix%g | |
1752 | s%@program_transform_name@%$program_transform_name%g | |
1753 | s%@bindir@%$bindir%g | |
1754 | s%@sbindir@%$sbindir%g | |
1755 | s%@libexecdir@%$libexecdir%g | |
1756 | s%@datadir@%$datadir%g | |
1757 | s%@sysconfdir@%$sysconfdir%g | |
1758 | s%@sharedstatedir@%$sharedstatedir%g | |
1759 | s%@localstatedir@%$localstatedir%g | |
1760 | s%@libdir@%$libdir%g | |
1761 | s%@includedir@%$includedir%g | |
1762 | s%@oldincludedir@%$oldincludedir%g | |
1763 | s%@infodir@%$infodir%g | |
1764 | s%@mandir@%$mandir%g | |
1765 | s%@CC@%$CC%g | |
1766 | s%@CPP@%$CPP%g | |
1767 | s%@SET_MAKE@%$SET_MAKE%g | |
1768 | s%@RANLIB@%$RANLIB%g | |
1769 | s%@VERSION@%$VERSION%g | |
1770 | s%@PATCH@%$PATCH%g | |
1771 | ||
1772 | CEOF | |
1773 | EOF | |
1774 | ||
1775 | cat >> $CONFIG_STATUS <<\EOF | |
1776 | ||
1777 | # Split the substitutions into bite-sized pieces for seds with | |
1778 | # small command number limits, like on Digital OSF/1 and HP-UX. | |
1779 | ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. | |
1780 | ac_file=1 # Number of current file. | |
1781 | ac_beg=1 # First line for current file. | |
1782 | ac_end=$ac_max_sed_cmds # Line after last line for current file. | |
1783 | ac_more_lines=: | |
1784 | ac_sed_cmds="" | |
1785 | while $ac_more_lines; do | |
1786 | if test $ac_beg -gt 1; then | |
1787 | sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file | |
4318 | ||
4319 | # If the user did not use the arguments to specify the items to instantiate, | |
4320 | # then the envvar interface is used. Set only those that are not. | |
4321 | # We use the long form for the default assignment because of an extremely | |
4322 | # bizarre bug on SunOS 4.1.3. | |
4323 | if $ac_need_defaults; then | |
4324 | test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files | |
4325 | test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers | |
4326 | fi | |
4327 | ||
4328 | # Have a temporary directory for convenience. Make it in the build tree | |
4329 | # simply because there is no reason against having it here, and in addition, | |
4330 | # creating and moving files from /tmp can sometimes cause problems. | |
4331 | # Hook for its removal unless debugging. | |
4332 | # Note that there is a small window in which the directory will not be cleaned: | |
4333 | # after its creation but before its name has been assigned to `$tmp'. | |
4334 | $debug || | |
4335 | { | |
4336 | tmp= ac_tmp= | |
4337 | trap 'exit_status=$? | |
4338 | : "${ac_tmp:=$tmp}" | |
4339 | { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status | |
4340 | ' 0 | |
4341 | trap 'as_fn_exit 1' 1 2 13 15 | |
4342 | } | |
4343 | # Create a (secure) tmp directory for tmp files. | |
4344 | ||
4345 | { | |
4346 | tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && | |
4347 | test -d "$tmp" | |
4348 | } || | |
4349 | { | |
4350 | tmp=./conf$$-$RANDOM | |
4351 | (umask 077 && mkdir "$tmp") | |
4352 | } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 | |
4353 | ac_tmp=$tmp | |
4354 | ||
4355 | # Set up the scripts for CONFIG_FILES section. | |
4356 | # No need to generate them if there are no CONFIG_FILES. | |
4357 | # This happens for instance with `./config.status config.h'. | |
4358 | if test -n "$CONFIG_FILES"; then | |
4359 | ||
4360 | ||
4361 | ac_cr=`echo X | tr X '\015'` | |
4362 | # On cygwin, bash can eat \r inside `` if the user requested igncr. | |
4363 | # But we know of no other shell where ac_cr would be empty at this | |
4364 | # point, so we can use a bashism as a fallback. | |
4365 | if test "x$ac_cr" = x; then | |
4366 | eval ac_cr=\$\'\\r\' | |
4367 | fi | |
4368 | ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` | |
4369 | if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then | |
4370 | ac_cs_awk_cr='\\r' | |
4371 | else | |
4372 | ac_cs_awk_cr=$ac_cr | |
4373 | fi | |
4374 | ||
4375 | echo 'BEGIN {' >"$ac_tmp/subs1.awk" && | |
4376 | _ACEOF | |
4377 | ||
4378 | ||
4379 | { | |
4380 | echo "cat >conf$$subs.awk <<_ACEOF" && | |
4381 | echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && | |
4382 | echo "_ACEOF" | |
4383 | } >conf$$subs.sh || | |
4384 | as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 | |
4385 | ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` | |
4386 | ac_delim='%!_!# ' | |
4387 | for ac_last_try in false false false false false :; do | |
4388 | . ./conf$$subs.sh || | |
4389 | as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 | |
4390 | ||
4391 | ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` | |
4392 | if test $ac_delim_n = $ac_delim_num; then | |
4393 | break | |
4394 | elif $ac_last_try; then | |
4395 | as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 | |
1788 | 4396 | else |
1789 | sed "${ac_end}q" conftest.subs > conftest.s$ac_file | |
1790 | fi | |
1791 | if test ! -s conftest.s$ac_file; then | |
1792 | ac_more_lines=false | |
1793 | rm -f conftest.s$ac_file | |
1794 | else | |
1795 | if test -z "$ac_sed_cmds"; then | |
1796 | ac_sed_cmds="sed -f conftest.s$ac_file" | |
1797 | else | |
1798 | ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" | |
1799 | fi | |
1800 | ac_file=`expr $ac_file + 1` | |
1801 | ac_beg=$ac_end | |
1802 | ac_end=`expr $ac_end + $ac_max_sed_cmds` | |
4397 | ac_delim="$ac_delim!$ac_delim _$ac_delim!! " | |
1803 | 4398 | fi |
1804 | 4399 | done |
1805 | if test -z "$ac_sed_cmds"; then | |
1806 | ac_sed_cmds=cat | |
1807 | fi | |
1808 | EOF | |
1809 | ||
1810 | cat >> $CONFIG_STATUS <<EOF | |
1811 | ||
1812 | CONFIG_FILES=\${CONFIG_FILES-"Makefile"} | |
1813 | EOF | |
1814 | cat >> $CONFIG_STATUS <<\EOF | |
1815 | for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then | |
1816 | # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". | |
1817 | case "$ac_file" in | |
1818 | *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` | |
1819 | ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | |
1820 | *) ac_file_in="${ac_file}.in" ;; | |
4400 | rm -f conf$$subs.sh | |
4401 | ||
4402 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4403 | cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && | |
4404 | _ACEOF | |
4405 | sed -n ' | |
4406 | h | |
4407 | s/^/S["/; s/!.*/"]=/ | |
4408 | p | |
4409 | g | |
4410 | s/^[^!]*!// | |
4411 | :repl | |
4412 | t repl | |
4413 | s/'"$ac_delim"'$// | |
4414 | t delim | |
4415 | :nl | |
4416 | h | |
4417 | s/\(.\{148\}\)..*/\1/ | |
4418 | t more1 | |
4419 | s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ | |
4420 | p | |
4421 | n | |
4422 | b repl | |
4423 | :more1 | |
4424 | s/["\\]/\\&/g; s/^/"/; s/$/"\\/ | |
4425 | p | |
4426 | g | |
4427 | s/.\{148\}// | |
4428 | t nl | |
4429 | :delim | |
4430 | h | |
4431 | s/\(.\{148\}\)..*/\1/ | |
4432 | t more2 | |
4433 | s/["\\]/\\&/g; s/^/"/; s/$/"/ | |
4434 | p | |
4435 | b | |
4436 | :more2 | |
4437 | s/["\\]/\\&/g; s/^/"/; s/$/"\\/ | |
4438 | p | |
4439 | g | |
4440 | s/.\{148\}// | |
4441 | t delim | |
4442 | ' <conf$$subs.awk | sed ' | |
4443 | /^[^""]/{ | |
4444 | N | |
4445 | s/\n// | |
4446 | } | |
4447 | ' >>$CONFIG_STATUS || ac_write_fail=1 | |
4448 | rm -f conf$$subs.awk | |
4449 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4450 | _ACAWK | |
4451 | cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && | |
4452 | for (key in S) S_is_set[key] = 1 | |
4453 | FS = "" | |
4454 | ||
4455 | } | |
4456 | { | |
4457 | line = $ 0 | |
4458 | nfields = split(line, field, "@") | |
4459 | substed = 0 | |
4460 | len = length(field[1]) | |
4461 | for (i = 2; i < nfields; i++) { | |
4462 | key = field[i] | |
4463 | keylen = length(key) | |
4464 | if (S_is_set[key]) { | |
4465 | value = S[key] | |
4466 | line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) | |
4467 | len += length(value) + length(field[++i]) | |
4468 | substed = 1 | |
4469 | } else | |
4470 | len += 1 + keylen | |
4471 | } | |
4472 | ||
4473 | print line | |
4474 | } | |
4475 | ||
4476 | _ACAWK | |
4477 | _ACEOF | |
4478 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4479 | if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then | |
4480 | sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" | |
4481 | else | |
4482 | cat | |
4483 | fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ | |
4484 | || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 | |
4485 | _ACEOF | |
4486 | ||
4487 | # VPATH may cause trouble with some makes, so we remove sole $(srcdir), | |
4488 | # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and | |
4489 | # trailing colons and then remove the whole line if VPATH becomes empty | |
4490 | # (actually we leave an empty line to preserve line numbers). | |
4491 | if test "x$srcdir" = x.; then | |
4492 | ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ | |
4493 | h | |
4494 | s/// | |
4495 | s/^/:/ | |
4496 | s/[ ]*$/:/ | |
4497 | s/:\$(srcdir):/:/g | |
4498 | s/:\${srcdir}:/:/g | |
4499 | s/:@srcdir@:/:/g | |
4500 | s/^:*// | |
4501 | s/:*$// | |
4502 | x | |
4503 | s/\(=[ ]*\).*/\1/ | |
4504 | G | |
4505 | s/\n// | |
4506 | s/^[^=]*=[ ]*$// | |
4507 | }' | |
4508 | fi | |
4509 | ||
4510 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4511 | fi # test -n "$CONFIG_FILES" | |
4512 | ||
4513 | # Set up the scripts for CONFIG_HEADERS section. | |
4514 | # No need to generate them if there are no CONFIG_HEADERS. | |
4515 | # This happens for instance with `./config.status Makefile'. | |
4516 | if test -n "$CONFIG_HEADERS"; then | |
4517 | cat >"$ac_tmp/defines.awk" <<\_ACAWK || | |
4518 | BEGIN { | |
4519 | _ACEOF | |
4520 | ||
4521 | # Transform confdefs.h into an awk script `defines.awk', embedded as | |
4522 | # here-document in config.status, that substitutes the proper values into | |
4523 | # config.h.in to produce config.h. | |
4524 | ||
4525 | # Create a delimiter string that does not exist in confdefs.h, to ease | |
4526 | # handling of long lines. | |
4527 | ac_delim='%!_!# ' | |
4528 | for ac_last_try in false false :; do | |
4529 | ac_tt=`sed -n "/$ac_delim/p" confdefs.h` | |
4530 | if test -z "$ac_tt"; then | |
4531 | break | |
4532 | elif $ac_last_try; then | |
4533 | as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 | |
4534 | else | |
4535 | ac_delim="$ac_delim!$ac_delim _$ac_delim!! " | |
4536 | fi | |
4537 | done | |
4538 | ||
4539 | # For the awk script, D is an array of macro values keyed by name, | |
4540 | # likewise P contains macro parameters if any. Preserve backslash | |
4541 | # newline sequences. | |
4542 | ||
4543 | ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* | |
4544 | sed -n ' | |
4545 | s/.\{148\}/&'"$ac_delim"'/g | |
4546 | t rset | |
4547 | :rset | |
4548 | s/^[ ]*#[ ]*define[ ][ ]*/ / | |
4549 | t def | |
4550 | d | |
4551 | :def | |
4552 | s/\\$// | |
4553 | t bsnl | |
4554 | s/["\\]/\\&/g | |
4555 | s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ | |
4556 | D["\1"]=" \3"/p | |
4557 | s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p | |
4558 | d | |
4559 | :bsnl | |
4560 | s/["\\]/\\&/g | |
4561 | s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ | |
4562 | D["\1"]=" \3\\\\\\n"\\/p | |
4563 | t cont | |
4564 | s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p | |
4565 | t cont | |
4566 | d | |
4567 | :cont | |
4568 | n | |
4569 | s/.\{148\}/&'"$ac_delim"'/g | |
4570 | t clear | |
4571 | :clear | |
4572 | s/\\$// | |
4573 | t bsnlc | |
4574 | s/["\\]/\\&/g; s/^/"/; s/$/"/p | |
4575 | d | |
4576 | :bsnlc | |
4577 | s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p | |
4578 | b cont | |
4579 | ' <confdefs.h | sed ' | |
4580 | s/'"$ac_delim"'/"\\\ | |
4581 | "/g' >>$CONFIG_STATUS || ac_write_fail=1 | |
4582 | ||
4583 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4584 | for (key in D) D_is_set[key] = 1 | |
4585 | FS = "" | |
4586 | } | |
4587 | /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { | |
4588 | line = \$ 0 | |
4589 | split(line, arg, " ") | |
4590 | if (arg[1] == "#") { | |
4591 | defundef = arg[2] | |
4592 | mac1 = arg[3] | |
4593 | } else { | |
4594 | defundef = substr(arg[1], 2) | |
4595 | mac1 = arg[2] | |
4596 | } | |
4597 | split(mac1, mac2, "(") #) | |
4598 | macro = mac2[1] | |
4599 | prefix = substr(line, 1, index(line, defundef) - 1) | |
4600 | if (D_is_set[macro]) { | |
4601 | # Preserve the white space surrounding the "#". | |
4602 | print prefix "define", macro P[macro] D[macro] | |
4603 | next | |
4604 | } else { | |
4605 | # Replace #undef with comments. This is necessary, for example, | |
4606 | # in the case of _POSIX_SOURCE, which is predefined and required | |
4607 | # on some systems where configure will not decide to define it. | |
4608 | if (defundef == "undef") { | |
4609 | print "/*", prefix defundef, macro, "*/" | |
4610 | next | |
4611 | } | |
4612 | } | |
4613 | } | |
4614 | { print } | |
4615 | _ACAWK | |
4616 | _ACEOF | |
4617 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4618 | as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 | |
4619 | fi # test -n "$CONFIG_HEADERS" | |
4620 | ||
4621 | ||
4622 | eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " | |
4623 | shift | |
4624 | for ac_tag | |
4625 | do | |
4626 | case $ac_tag in | |
4627 | :[FHLC]) ac_mode=$ac_tag; continue;; | |
1821 | 4628 | esac |
1822 | ||
1823 | # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. | |
1824 | ||
1825 | # Remove last slash and all that follows it. Not all systems have dirname. | |
1826 | ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` | |
1827 | if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then | |
1828 | # The file is in a subdirectory. | |
1829 | test ! -d "$ac_dir" && mkdir "$ac_dir" | |
1830 | ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" | |
1831 | # A "../" for each directory in $ac_dir_suffix. | |
1832 | ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` | |
4629 | case $ac_mode$ac_tag in | |
4630 | :[FHL]*:*);; | |
4631 | :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; | |
4632 | :[FH]-) ac_tag=-:-;; | |
4633 | :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; | |
4634 | esac | |
4635 | ac_save_IFS=$IFS | |
4636 | IFS=: | |
4637 | set x $ac_tag | |
4638 | IFS=$ac_save_IFS | |
4639 | shift | |
4640 | ac_file=$1 | |
4641 | shift | |
4642 | ||
4643 | case $ac_mode in | |
4644 | :L) ac_source=$1;; | |
4645 | :[FH]) | |
4646 | ac_file_inputs= | |
4647 | for ac_f | |
4648 | do | |
4649 | case $ac_f in | |
4650 | -) ac_f="$ac_tmp/stdin";; | |
4651 | *) # Look for the file first in the build tree, then in the source tree | |
4652 | # (if the path is not absolute). The absolute path cannot be DOS-style, | |
4653 | # because $ac_f cannot contain `:'. | |
4654 | test -f "$ac_f" || | |
4655 | case $ac_f in | |
4656 | [\\/$]*) false;; | |
4657 | *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; | |
4658 | esac || | |
4659 | as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; | |
4660 | esac | |
4661 | case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac | |
4662 | as_fn_append ac_file_inputs " '$ac_f'" | |
4663 | done | |
4664 | ||
4665 | # Let's still pretend it is `configure' which instantiates (i.e., don't | |
4666 | # use $as_me), people would be surprised to read: | |
4667 | # /* config.h. Generated by config.status. */ | |
4668 | configure_input='Generated from '` | |
4669 | $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' | |
4670 | `' by configure.' | |
4671 | if test x"$ac_file" != x-; then | |
4672 | configure_input="$ac_file. $configure_input" | |
4673 | { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 | |
4674 | $as_echo "$as_me: creating $ac_file" >&6;} | |
4675 | fi | |
4676 | # Neutralize special characters interpreted by sed in replacement strings. | |
4677 | case $configure_input in #( | |
4678 | *\&* | *\|* | *\\* ) | |
4679 | ac_sed_conf_input=`$as_echo "$configure_input" | | |
4680 | sed 's/[\\\\&|]/\\\\&/g'`;; #( | |
4681 | *) ac_sed_conf_input=$configure_input;; | |
4682 | esac | |
4683 | ||
4684 | case $ac_tag in | |
4685 | *:-:* | *:-) cat >"$ac_tmp/stdin" \ | |
4686 | || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; | |
4687 | esac | |
4688 | ;; | |
4689 | esac | |
4690 | ||
4691 | ac_dir=`$as_dirname -- "$ac_file" || | |
4692 | $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ | |
4693 | X"$ac_file" : 'X\(//\)[^/]' \| \ | |
4694 | X"$ac_file" : 'X\(//\)$' \| \ | |
4695 | X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || | |
4696 | $as_echo X"$ac_file" | | |
4697 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ | |
4698 | s//\1/ | |
4699 | q | |
4700 | } | |
4701 | /^X\(\/\/\)[^/].*/{ | |
4702 | s//\1/ | |
4703 | q | |
4704 | } | |
4705 | /^X\(\/\/\)$/{ | |
4706 | s//\1/ | |
4707 | q | |
4708 | } | |
4709 | /^X\(\/\).*/{ | |
4710 | s//\1/ | |
4711 | q | |
4712 | } | |
4713 | s/.*/./; q'` | |
4714 | as_dir="$ac_dir"; as_fn_mkdir_p | |
4715 | ac_builddir=. | |
4716 | ||
4717 | case "$ac_dir" in | |
4718 | .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; | |
4719 | *) | |
4720 | ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` | |
4721 | # A ".." for each directory in $ac_dir_suffix. | |
4722 | ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` | |
4723 | case $ac_top_builddir_sub in | |
4724 | "") ac_top_builddir_sub=. ac_top_build_prefix= ;; | |
4725 | *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; | |
4726 | esac ;; | |
4727 | esac | |
4728 | ac_abs_top_builddir=$ac_pwd | |
4729 | ac_abs_builddir=$ac_pwd$ac_dir_suffix | |
4730 | # for backward compatibility: | |
4731 | ac_top_builddir=$ac_top_build_prefix | |
4732 | ||
4733 | case $srcdir in | |
4734 | .) # We are building in place. | |
4735 | ac_srcdir=. | |
4736 | ac_top_srcdir=$ac_top_builddir_sub | |
4737 | ac_abs_top_srcdir=$ac_pwd ;; | |
4738 | [\\/]* | ?:[\\/]* ) # Absolute name. | |
4739 | ac_srcdir=$srcdir$ac_dir_suffix; | |
4740 | ac_top_srcdir=$srcdir | |
4741 | ac_abs_top_srcdir=$srcdir ;; | |
4742 | *) # Relative name. | |
4743 | ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix | |
4744 | ac_top_srcdir=$ac_top_build_prefix$srcdir | |
4745 | ac_abs_top_srcdir=$ac_pwd/$srcdir ;; | |
4746 | esac | |
4747 | ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix | |
4748 | ||
4749 | ||
4750 | case $ac_mode in | |
4751 | :F) | |
4752 | # | |
4753 | # CONFIG_FILE | |
4754 | # | |
4755 | ||
4756 | _ACEOF | |
4757 | ||
4758 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4759 | # If the template does not know about datarootdir, expand it. | |
4760 | # FIXME: This hack should be removed a few years after 2.60. | |
4761 | ac_datarootdir_hack=; ac_datarootdir_seen= | |
4762 | ac_sed_dataroot=' | |
4763 | /datarootdir/ { | |
4764 | p | |
4765 | q | |
4766 | } | |
4767 | /@datadir@/p | |
4768 | /@docdir@/p | |
4769 | /@infodir@/p | |
4770 | /@localedir@/p | |
4771 | /@mandir@/p' | |
4772 | case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in | |
4773 | *datarootdir*) ac_datarootdir_seen=yes;; | |
4774 | *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) | |
4775 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 | |
4776 | $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} | |
4777 | _ACEOF | |
4778 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4779 | ac_datarootdir_hack=' | |
4780 | s&@datadir@&$datadir&g | |
4781 | s&@docdir@&$docdir&g | |
4782 | s&@infodir@&$infodir&g | |
4783 | s&@localedir@&$localedir&g | |
4784 | s&@mandir@&$mandir&g | |
4785 | s&\\\${datarootdir}&$datarootdir&g' ;; | |
4786 | esac | |
4787 | _ACEOF | |
4788 | ||
4789 | # Neutralize VPATH when `$srcdir' = `.'. | |
4790 | # Shell code in configure.ac might set extrasub. | |
4791 | # FIXME: do we really want to maintain this feature? | |
4792 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 | |
4793 | ac_sed_extra="$ac_vpsub | |
4794 | $extrasub | |
4795 | _ACEOF | |
4796 | cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | |
4797 | :t | |
4798 | /@[a-zA-Z_][a-zA-Z_0-9]*@/!b | |
4799 | s|@configure_input@|$ac_sed_conf_input|;t t | |
4800 | s&@top_builddir@&$ac_top_builddir_sub&;t t | |
4801 | s&@top_build_prefix@&$ac_top_build_prefix&;t t | |
4802 | s&@srcdir@&$ac_srcdir&;t t | |
4803 | s&@abs_srcdir@&$ac_abs_srcdir&;t t | |
4804 | s&@top_srcdir@&$ac_top_srcdir&;t t | |
4805 | s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t | |
4806 | s&@builddir@&$ac_builddir&;t t | |
4807 | s&@abs_builddir@&$ac_abs_builddir&;t t | |
4808 | s&@abs_top_builddir@&$ac_abs_top_builddir&;t t | |
4809 | $ac_datarootdir_hack | |
4810 | " | |
4811 | eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ | |
4812 | >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 | |
4813 | ||
4814 | test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && | |
4815 | { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && | |
4816 | { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ | |
4817 | "$ac_tmp/out"`; test -z "$ac_out"; } && | |
4818 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' | |
4819 | which seems to be undefined. Please make sure it is defined" >&5 | |
4820 | $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' | |
4821 | which seems to be undefined. Please make sure it is defined" >&2;} | |
4822 | ||
4823 | rm -f "$ac_tmp/stdin" | |
4824 | case $ac_file in | |
4825 | -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; | |
4826 | *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; | |
4827 | esac \ | |
4828 | || as_fn_error $? "could not create $ac_file" "$LINENO" 5 | |
4829 | ;; | |
4830 | :H) | |
4831 | # | |
4832 | # CONFIG_HEADER | |
4833 | # | |
4834 | if test x"$ac_file" != x-; then | |
4835 | { | |
4836 | $as_echo "/* $configure_input */" \ | |
4837 | && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" | |
4838 | } >"$ac_tmp/config.h" \ | |
4839 | || as_fn_error $? "could not create $ac_file" "$LINENO" 5 | |
4840 | if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then | |
4841 | { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 | |
4842 | $as_echo "$as_me: $ac_file is unchanged" >&6;} | |
4843 | else | |
4844 | rm -f "$ac_file" | |
4845 | mv "$ac_tmp/config.h" "$ac_file" \ | |
4846 | || as_fn_error $? "could not create $ac_file" "$LINENO" 5 | |
4847 | fi | |
1833 | 4848 | else |
1834 | ac_dir_suffix= ac_dots= | |
4849 | $as_echo "/* $configure_input */" \ | |
4850 | && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ | |
4851 | || as_fn_error $? "could not create -" "$LINENO" 5 | |
1835 | 4852 | fi |
1836 | ||
1837 | case "$ac_given_srcdir" in | |
1838 | .) srcdir=. | |
1839 | if test -z "$ac_dots"; then top_srcdir=. | |
1840 | else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; | |
1841 | /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; | |
1842 | *) # Relative path. | |
1843 | srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" | |
1844 | top_srcdir="$ac_dots$ac_given_srcdir" ;; | |
4853 | ;; | |
4854 | ||
4855 | ||
1845 | 4856 | esac |
1846 | 4857 | |
1847 | ||
1848 | echo creating "$ac_file" | |
1849 | rm -f "$ac_file" | |
1850 | configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." | |
1851 | case "$ac_file" in | |
1852 | *Makefile*) ac_comsub="1i\\ | |
1853 | # $configure_input" ;; | |
1854 | *) ac_comsub= ;; | |
1855 | esac | |
1856 | ||
1857 | ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` | |
1858 | sed -e "$ac_comsub | |
1859 | s%@configure_input@%$configure_input%g | |
1860 | s%@srcdir@%$srcdir%g | |
1861 | s%@top_srcdir@%$top_srcdir%g | |
1862 | " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file | |
1863 | fi; done | |
1864 | rm -f conftest.s* | |
1865 | ||
1866 | # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where | |
1867 | # NAME is the cpp macro being defined and VALUE is the value it is being given. | |
1868 | # | |
1869 | # ac_d sets the value in "#define NAME VALUE" lines. | |
1870 | ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' | |
1871 | ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' | |
1872 | ac_dC='\3' | |
1873 | ac_dD='%g' | |
1874 | # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". | |
1875 | ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' | |
1876 | ac_uB='\([ ]\)%\1#\2define\3' | |
1877 | ac_uC=' ' | |
1878 | ac_uD='\4%g' | |
1879 | # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". | |
1880 | ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' | |
1881 | ac_eB='$%\1#\2define\3' | |
1882 | ac_eC=' ' | |
1883 | ac_eD='%g' | |
1884 | ||
1885 | if test "${CONFIG_HEADERS+set}" != set; then | |
1886 | EOF | |
1887 | cat >> $CONFIG_STATUS <<EOF | |
1888 | CONFIG_HEADERS="config.h" | |
1889 | EOF | |
1890 | cat >> $CONFIG_STATUS <<\EOF | |
1891 | fi | |
1892 | for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then | |
1893 | # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". | |
1894 | case "$ac_file" in | |
1895 | *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` | |
1896 | ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | |
1897 | *) ac_file_in="${ac_file}.in" ;; | |
1898 | esac | |
1899 | ||
1900 | echo creating $ac_file | |
1901 | ||
1902 | rm -f conftest.frag conftest.in conftest.out | |
1903 | ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` | |
1904 | cat $ac_file_inputs > conftest.in | |
1905 | ||
1906 | EOF | |
1907 | ||
1908 | # Transform confdefs.h into a sed script conftest.vals that substitutes | |
1909 | # the proper values into config.h.in to produce config.h. And first: | |
1910 | # Protect against being on the right side of a sed subst in config.status. | |
1911 | # Protect against being in an unquoted here document in config.status. | |
1912 | rm -f conftest.vals | |
1913 | cat > conftest.hdr <<\EOF | |
1914 | s/[\\&%]/\\&/g | |
1915 | s%[\\$`]%\\&%g | |
1916 | s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp | |
1917 | s%ac_d%ac_u%gp | |
1918 | s%ac_u%ac_e%gp | |
1919 | EOF | |
1920 | sed -n -f conftest.hdr confdefs.h > conftest.vals | |
1921 | rm -f conftest.hdr | |
1922 | ||
1923 | # This sed command replaces #undef with comments. This is necessary, for | |
1924 | # example, in the case of _POSIX_SOURCE, which is predefined and required | |
1925 | # on some systems where configure will not decide to define it. | |
1926 | cat >> conftest.vals <<\EOF | |
1927 | s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% | |
1928 | EOF | |
1929 | ||
1930 | # Break up conftest.vals because some shells have a limit on | |
1931 | # the size of here documents, and old seds have small limits too. | |
1932 | ||
1933 | rm -f conftest.tail | |
1934 | while : | |
1935 | do | |
1936 | ac_lines=`grep -c . conftest.vals` | |
1937 | # grep -c gives empty output for an empty file on some AIX systems. | |
1938 | if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi | |
1939 | # Write a limited-size here document to conftest.frag. | |
1940 | echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS | |
1941 | sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS | |
1942 | echo 'CEOF | |
1943 | sed -f conftest.frag conftest.in > conftest.out | |
1944 | rm -f conftest.in | |
1945 | mv conftest.out conftest.in | |
1946 | ' >> $CONFIG_STATUS | |
1947 | sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail | |
1948 | rm -f conftest.vals | |
1949 | mv conftest.tail conftest.vals | |
1950 | done | |
1951 | rm -f conftest.vals | |
1952 | ||
1953 | cat >> $CONFIG_STATUS <<\EOF | |
1954 | rm -f conftest.frag conftest.h | |
1955 | echo "/* $ac_file. Generated automatically by configure. */" > conftest.h | |
1956 | cat conftest.in >> conftest.h | |
1957 | rm -f conftest.in | |
1958 | if cmp -s $ac_file conftest.h 2>/dev/null; then | |
1959 | echo "$ac_file is unchanged" | |
1960 | rm -f conftest.h | |
1961 | else | |
1962 | # Remove last slash and all that follows it. Not all systems have dirname. | |
1963 | ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` | |
1964 | if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then | |
1965 | # The file is in a subdirectory. | |
1966 | test ! -d "$ac_dir" && mkdir "$ac_dir" | |
1967 | fi | |
1968 | rm -f $ac_file | |
1969 | mv conftest.h $ac_file | |
1970 | fi | |
1971 | fi; done | |
1972 | ||
1973 | EOF | |
1974 | cat >> $CONFIG_STATUS <<EOF | |
1975 | ||
1976 | EOF | |
1977 | cat >> $CONFIG_STATUS <<\EOF | |
1978 | ||
1979 | exit 0 | |
1980 | EOF | |
1981 | chmod +x $CONFIG_STATUS | |
1982 | rm -fr confdefs* $ac_clean_files | |
1983 | test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 | |
1984 | ||
1985 | ||
4858 | done # for ac_tag | |
4859 | ||
4860 | ||
4861 | as_fn_exit 0 | |
4862 | _ACEOF | |
4863 | ac_clean_files=$ac_clean_files_save | |
4864 | ||
4865 | test $ac_write_fail = 0 || | |
4866 | as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 | |
4867 | ||
4868 | ||
4869 | # configure is writing to config.log, and then calls config.status. | |
4870 | # config.status does its own redirection, appending to config.log. | |
4871 | # Unfortunately, on DOS this fails, as config.log is still kept open | |
4872 | # by configure, so config.status won't be able to write to it; its | |
4873 | # output is simply discarded. So we exec the FD to /dev/null, | |
4874 | # effectively closing config.log, so it can be properly (re)opened and | |
4875 | # appended to by config.status. When coming back to configure, we | |
4876 | # need to make the FD available again. | |
4877 | if test "$no_create" != yes; then | |
4878 | ac_cs_success=: | |
4879 | ac_config_status_args= | |
4880 | test "$silent" = yes && | |
4881 | ac_config_status_args="$ac_config_status_args --quiet" | |
4882 | exec 5>/dev/null | |
4883 | $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false | |
4884 | exec 5>>config.log | |
4885 | # Use ||, not &&, to avoid exiting from the if with $? = 1, which | |
4886 | # would make configure fail if this is the last instruction. | |
4887 | $ac_cs_success || as_fn_exit 1 | |
4888 | fi | |
4889 | if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then | |
4890 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 | |
4891 | $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} | |
4892 | fi | |
4893 | ||
4894 |
20 | 20 | |
21 | 21 | AC_PROG_CC |
22 | 22 | AC_PROG_CPP |
23 | wi_PROTOTYPES | |
24 | 23 | AC_PROG_MAKE_SET |
25 | 24 | AC_PROG_RANLIB |
26 | ||
27 | if test "$wi_cv_prototypes" = no ; then | |
28 | AC_WARN([Your compiler does not support function prototyping and]) | |
29 | AC_WARN([is not able to properly compile this package. What a pity.]) | |
30 | AC_WARN([Get gcc, or any compiler that supports function prototypes.]) | |
31 | exit 1 | |
32 | fi | |
33 | 25 | |
34 | 26 | # |
35 | 27 | # Checks for header files and library functions |
42 | 34 | AC_CHECK_HEADERS(io.h sys/time.h) |
43 | 35 | |
44 | 36 | CFLAGS="$CFLAGS -D_GNU_SOURCE" |
45 | AC_CHECK_FUNCS(gettimeofday fgetc_unlocked) | |
37 | AC_CHECK_FUNCS(tempnam gettimeofday flockfile getc_unlocked feof_unlocked ferror_unlocked) | |
46 | 38 | dnl AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr) |
47 | 39 | |
48 | AC_CHECK_FUNC(tempnam,,AC_DEFINE(tempnam,FP_tempnam)) | |
49 | ||
50 | AC_CHECK_FUNC(chmod,AC_DEFINE(HAVE_CHMOD)) | |
51 | AC_CHECK_FUNC(umask,AC_DEFINE(HAVE_UMASK)) | |
52 | AC_CHECK_FUNC(mkstemp,AC_DEFINE(HAVE_MKSTEMP)) | |
53 | ||
54 | # | |
55 | # strerror might be internally defined. this would cause a | |
56 | # CHECK_FUNCS(strerror) to fail because it'd be called with | |
57 | # zero arguments. So use our own code. | |
58 | # | |
59 | AC_MSG_CHECKING([for strerror]) | |
60 | AC_TRY_LINK([ | |
61 | char *blubb() { return (char *) strerror (42); } | |
62 | ],[ | |
63 | (void) blubb(); | |
64 | ],have_strerror=yes,AC_DEFINE(strerror,FP_strerror) | |
65 | have_strerror=no) | |
66 | AC_MSG_RESULT($have_strerror) | |
67 | ||
68 | AC_MSG_CHECKING([for stdin]) | |
69 | AC_TRY_LINK([ | |
70 | #include <stdio.h> | |
71 | char *blubb() { FILE *in, *out; in=stdin; out=stdout; return (char*)0; } | |
72 | ],[ | |
73 | (void) blubb(); | |
74 | ],have_stdio=yes,AC_DEFINE(HAVE_STDIO) | |
75 | have_stdio=no) | |
76 | AC_MSG_RESULT($have_stdio) | |
77 | ||
78 | if test "$ac_cv_header_stdc" = "no" ; then | |
79 | AC_CHECK_HEADERS(stdarg.h varargs.h) | |
80 | if test "$ac_cv_header_stdarg_h" = "no" ; then | |
81 | if test "$ac_cv_header_varargs_h" = "no" ; then | |
82 | AC_MSG_ERROR([neither stdarg.h nor varargs.h present]) | |
83 | fi | |
84 | fi | |
85 | fi | |
86 | ||
87 | # | |
88 | # Check whether this is a DOS-Based system. Another bogus test. | |
89 | # Don't even bother to print a message. This code is needed so | |
90 | # that autoheader includes the #undef into the final config.h | |
91 | # and we can change the definition by hand on a really DOS | |
92 | # system (where ./configure doesn't work anyway ...) | |
93 | # | |
94 | ||
95 | if false ; then | |
96 | AC_DEFINE(SYSTEM_DOS) | |
97 | AC_DEFINE(SYSTEM_QUICKWIN) | |
98 | AC_DEFINE(SYSTEM_WINDLL) | |
99 | AC_DEFINE(SYSTEM_OS2) | |
100 | fi | |
40 | AC_CHECK_FUNCS(chmod umask mkstemp) | |
101 | 41 | |
102 | 42 | # |
103 | 43 | # On some systems (so far, OS2 and WINDOWS), functions that are exported |
0 | /* crc32.c -- compute the CRC-32 of a data stream | |
1 | Copyright (C) 1995-1998 Mark Adler | |
2 | ||
3 | This software is provided 'as-is', without any express or implied | |
4 | warranty. In no event will the authors be held liable for any damages | |
5 | arising from the use of this software. | |
6 | ||
7 | Permission is granted to anyone to use this software for any purpose, | |
8 | including commercial applications, and to alter it and redistribute it | |
9 | freely, subject to the following restrictions: | |
10 | ||
11 | 1. The origin of this software must not be misrepresented; you must not | |
12 | claim that you wrote the original software. If you use this software | |
13 | in a product, an acknowledgment in the product documentation would be | |
14 | appreciated but is not required. | |
15 | 2. Altered source versions must be plainly marked as such, and must not be | |
16 | misrepresented as being the original software. | |
17 | 3. This notice may not be removed or altered from any source distribution. | |
18 | ||
19 | Jean-loup Gailly Mark Adler | |
20 | jloup@gzip.org madler@alumni.caltech.edu | |
21 | */ | |
22 | ||
23 | #include <crc32.h> | |
24 | ||
25 | /* ======================================================================== | |
26 | * Table of CRC-32's of all single-byte values (made by make_crc_table) | |
0 | /* | |
1 | * crc32.c | |
2 | * | |
3 | * Copyright (c) 2011-2015 Stephan Brumme. All rights reserved. | |
4 | * Slicing-by-16 contributed by Bulat Ziganshin | |
5 | * | |
6 | * This software is provided 'as-is', without any express or implied warranty. | |
7 | * In no event will the author be held liable for any damages arising from the | |
8 | * of this software. | |
9 | * | |
10 | * Permission is granted to anyone to use this software for any purpose, | |
11 | * including commercial applications, and to alter it and redistribute it | |
12 | * freely, subject to the following restrictions: | |
13 | * | |
14 | * 1. The origin of this software must not be misrepresented; you must not | |
15 | * claim that you wrote the original software. | |
16 | * 2. If you use this software in a product, an acknowledgment in the product | |
17 | * documentation would be appreciated but is not required. | |
18 | * 3. Altered source versions must be plainly marked as such, and must not be | |
19 | * misrepresented as being the original software. | |
20 | * | |
21 | * Taken from http://create.stephan-brumme.com/crc32/ and adapted for Cyrus | |
22 | * by Robert Norris <robn@fastmail.com> | |
23 | * Adapted for libecb and uulib, added crc32_combine: | |
24 | * Marc Alexander Lehmann <schmorp@schmorp.de> | |
27 | 25 | */ |
28 | static const crc32_t crc_table[256] = { | |
29 | 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, | |
30 | 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, | |
31 | 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, | |
32 | 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, | |
33 | 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, | |
34 | 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, | |
35 | 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, | |
36 | 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, | |
37 | 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, | |
38 | 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, | |
39 | 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, | |
40 | 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, | |
41 | 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, | |
42 | 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, | |
43 | 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, | |
44 | 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, | |
45 | 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, | |
46 | 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, | |
47 | 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, | |
48 | 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, | |
49 | 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, | |
50 | 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, | |
51 | 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, | |
52 | 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, | |
53 | 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, | |
54 | 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, | |
55 | 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, | |
56 | 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, | |
57 | 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, | |
58 | 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, | |
59 | 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, | |
60 | 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, | |
61 | 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, | |
62 | 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, | |
63 | 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, | |
64 | 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, | |
65 | 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, | |
66 | 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, | |
67 | 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, | |
68 | 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, | |
69 | 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, | |
70 | 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, | |
71 | 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, | |
72 | 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, | |
73 | 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, | |
74 | 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, | |
75 | 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, | |
76 | 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, | |
77 | 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, | |
78 | 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, | |
79 | 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, | |
80 | 0x2d02ef8dL | |
26 | ||
27 | #include "crc32.h" | |
28 | ||
29 | #include "ecb.h" | |
30 | ||
31 | #define Polynomial 0xedb88320 | |
32 | ||
33 | static const uint32_t crc32_lookup[16][256] = | |
34 | { | |
35 | /* same algorithm as crc32_bitwise | |
36 | ||
37 | for (int i = 0; i <= 0xFF; i++) | |
38 | { | |
39 | uint32_t crc = i; | |
40 | for (int j = 0; j < 8; j++) | |
41 | crc = (crc >> 1) ^ ((crc & 1) * Polynomial); | |
42 | crc32_lookup[0][i] = crc; | |
43 | } | |
44 | ||
45 | ... and the following slicing-by-8 algorithm (from Intel): | |
46 | http://www.intel.com/technology/comms/perfnet/download/CRC_generators.pdf | |
47 | http://sourceforge.net/projects/slicing-by-8/ | |
48 | for (int slice = 1; slice < 16; slice++) | |
49 | crc32_lookup[slice][i] = (crc32_lookup[slice - 1][i] >> 8) ^ crc32_lookup[0][crc32_lookup[slice - 1][i] & 0xFF]; | |
50 | */ | |
51 | { | |
52 | /* note: the first number of every second row corresponds to the half-byte look-up table ! */ | |
53 | 0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3, | |
54 | 0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91, | |
55 | 0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7, | |
56 | 0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5, | |
57 | 0x3B6E20C8,0x4C69105E,0xD56041E4,0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B, | |
58 | 0x35B5A8FA,0x42B2986C,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59, | |
59 | 0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F, | |
60 | 0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D, | |
61 | 0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0xE8B8D433, | |
62 | 0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x086D3D2D,0x91646C97,0xE6635C01, | |
63 | 0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457, | |
64 | 0x65B0D9C6,0x12B7E950,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65, | |
65 | 0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB, | |
66 | 0x4369E96A,0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9, | |
67 | 0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0xCE61E49F, | |
68 | 0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81,0xB7BD5C3B,0xC0BA6CAD, | |
69 | 0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683, | |
70 | 0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1, | |
71 | 0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7, | |
72 | 0xFED41B76,0x89D32BE0,0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5, | |
73 | 0xD6D6A3E8,0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B, | |
74 | 0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF,0x4669BE79, | |
75 | 0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703,0x220216B9,0x5505262F, | |
76 | 0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D, | |
77 | 0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9,0xEB0E363F,0x72076785,0x05005713, | |
78 | 0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21, | |
79 | 0x86D3D2D4,0xF1D4E242,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777, | |
80 | 0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45, | |
81 | 0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D,0x3E6E77DB, | |
82 | 0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0x30B5FFE9, | |
83 | 0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0xCDD70693,0x54DE5729,0x23D967BF, | |
84 | 0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D, | |
85 | }, | |
86 | ||
87 | /* beyond this point only relevant for Slicing-by-4, Slicing-by-8 and Slicing-by-16 */ | |
88 | { | |
89 | 0x00000000,0x191B3141,0x32366282,0x2B2D53C3,0x646CC504,0x7D77F445,0x565AA786,0x4F4196C7, | |
90 | 0xC8D98A08,0xD1C2BB49,0xFAEFE88A,0xE3F4D9CB,0xACB54F0C,0xB5AE7E4D,0x9E832D8E,0x87981CCF, | |
91 | 0x4AC21251,0x53D92310,0x78F470D3,0x61EF4192,0x2EAED755,0x37B5E614,0x1C98B5D7,0x05838496, | |
92 | 0x821B9859,0x9B00A918,0xB02DFADB,0xA936CB9A,0xE6775D5D,0xFF6C6C1C,0xD4413FDF,0xCD5A0E9E, | |
93 | 0x958424A2,0x8C9F15E3,0xA7B24620,0xBEA97761,0xF1E8E1A6,0xE8F3D0E7,0xC3DE8324,0xDAC5B265, | |
94 | 0x5D5DAEAA,0x44469FEB,0x6F6BCC28,0x7670FD69,0x39316BAE,0x202A5AEF,0x0B07092C,0x121C386D, | |
95 | 0xDF4636F3,0xC65D07B2,0xED705471,0xF46B6530,0xBB2AF3F7,0xA231C2B6,0x891C9175,0x9007A034, | |
96 | 0x179FBCFB,0x0E848DBA,0x25A9DE79,0x3CB2EF38,0x73F379FF,0x6AE848BE,0x41C51B7D,0x58DE2A3C, | |
97 | 0xF0794F05,0xE9627E44,0xC24F2D87,0xDB541CC6,0x94158A01,0x8D0EBB40,0xA623E883,0xBF38D9C2, | |
98 | 0x38A0C50D,0x21BBF44C,0x0A96A78F,0x138D96CE,0x5CCC0009,0x45D73148,0x6EFA628B,0x77E153CA, | |
99 | 0xBABB5D54,0xA3A06C15,0x888D3FD6,0x91960E97,0xDED79850,0xC7CCA911,0xECE1FAD2,0xF5FACB93, | |
100 | 0x7262D75C,0x6B79E61D,0x4054B5DE,0x594F849F,0x160E1258,0x0F152319,0x243870DA,0x3D23419B, | |
101 | 0x65FD6BA7,0x7CE65AE6,0x57CB0925,0x4ED03864,0x0191AEA3,0x188A9FE2,0x33A7CC21,0x2ABCFD60, | |
102 | 0xAD24E1AF,0xB43FD0EE,0x9F12832D,0x8609B26C,0xC94824AB,0xD05315EA,0xFB7E4629,0xE2657768, | |
103 | 0x2F3F79F6,0x362448B7,0x1D091B74,0x04122A35,0x4B53BCF2,0x52488DB3,0x7965DE70,0x607EEF31, | |
104 | 0xE7E6F3FE,0xFEFDC2BF,0xD5D0917C,0xCCCBA03D,0x838A36FA,0x9A9107BB,0xB1BC5478,0xA8A76539, | |
105 | 0x3B83984B,0x2298A90A,0x09B5FAC9,0x10AECB88,0x5FEF5D4F,0x46F46C0E,0x6DD93FCD,0x74C20E8C, | |
106 | 0xF35A1243,0xEA412302,0xC16C70C1,0xD8774180,0x9736D747,0x8E2DE606,0xA500B5C5,0xBC1B8484, | |
107 | 0x71418A1A,0x685ABB5B,0x4377E898,0x5A6CD9D9,0x152D4F1E,0x0C367E5F,0x271B2D9C,0x3E001CDD, | |
108 | 0xB9980012,0xA0833153,0x8BAE6290,0x92B553D1,0xDDF4C516,0xC4EFF457,0xEFC2A794,0xF6D996D5, | |
109 | 0xAE07BCE9,0xB71C8DA8,0x9C31DE6B,0x852AEF2A,0xCA6B79ED,0xD37048AC,0xF85D1B6F,0xE1462A2E, | |
110 | 0x66DE36E1,0x7FC507A0,0x54E85463,0x4DF36522,0x02B2F3E5,0x1BA9C2A4,0x30849167,0x299FA026, | |
111 | 0xE4C5AEB8,0xFDDE9FF9,0xD6F3CC3A,0xCFE8FD7B,0x80A96BBC,0x99B25AFD,0xB29F093E,0xAB84387F, | |
112 | 0x2C1C24B0,0x350715F1,0x1E2A4632,0x07317773,0x4870E1B4,0x516BD0F5,0x7A468336,0x635DB277, | |
113 | 0xCBFAD74E,0xD2E1E60F,0xF9CCB5CC,0xE0D7848D,0xAF96124A,0xB68D230B,0x9DA070C8,0x84BB4189, | |
114 | 0x03235D46,0x1A386C07,0x31153FC4,0x280E0E85,0x674F9842,0x7E54A903,0x5579FAC0,0x4C62CB81, | |
115 | 0x8138C51F,0x9823F45E,0xB30EA79D,0xAA1596DC,0xE554001B,0xFC4F315A,0xD7626299,0xCE7953D8, | |
116 | 0x49E14F17,0x50FA7E56,0x7BD72D95,0x62CC1CD4,0x2D8D8A13,0x3496BB52,0x1FBBE891,0x06A0D9D0, | |
117 | 0x5E7EF3EC,0x4765C2AD,0x6C48916E,0x7553A02F,0x3A1236E8,0x230907A9,0x0824546A,0x113F652B, | |
118 | 0x96A779E4,0x8FBC48A5,0xA4911B66,0xBD8A2A27,0xF2CBBCE0,0xEBD08DA1,0xC0FDDE62,0xD9E6EF23, | |
119 | 0x14BCE1BD,0x0DA7D0FC,0x268A833F,0x3F91B27E,0x70D024B9,0x69CB15F8,0x42E6463B,0x5BFD777A, | |
120 | 0xDC656BB5,0xC57E5AF4,0xEE530937,0xF7483876,0xB809AEB1,0xA1129FF0,0x8A3FCC33,0x9324FD72, | |
121 | }, | |
122 | ||
123 | { | |
124 | 0x00000000,0x01C26A37,0x0384D46E,0x0246BE59,0x0709A8DC,0x06CBC2EB,0x048D7CB2,0x054F1685, | |
125 | 0x0E1351B8,0x0FD13B8F,0x0D9785D6,0x0C55EFE1,0x091AF964,0x08D89353,0x0A9E2D0A,0x0B5C473D, | |
126 | 0x1C26A370,0x1DE4C947,0x1FA2771E,0x1E601D29,0x1B2F0BAC,0x1AED619B,0x18ABDFC2,0x1969B5F5, | |
127 | 0x1235F2C8,0x13F798FF,0x11B126A6,0x10734C91,0x153C5A14,0x14FE3023,0x16B88E7A,0x177AE44D, | |
128 | 0x384D46E0,0x398F2CD7,0x3BC9928E,0x3A0BF8B9,0x3F44EE3C,0x3E86840B,0x3CC03A52,0x3D025065, | |
129 | 0x365E1758,0x379C7D6F,0x35DAC336,0x3418A901,0x3157BF84,0x3095D5B3,0x32D36BEA,0x331101DD, | |
130 | 0x246BE590,0x25A98FA7,0x27EF31FE,0x262D5BC9,0x23624D4C,0x22A0277B,0x20E69922,0x2124F315, | |
131 | 0x2A78B428,0x2BBADE1F,0x29FC6046,0x283E0A71,0x2D711CF4,0x2CB376C3,0x2EF5C89A,0x2F37A2AD, | |
132 | 0x709A8DC0,0x7158E7F7,0x731E59AE,0x72DC3399,0x7793251C,0x76514F2B,0x7417F172,0x75D59B45, | |
133 | 0x7E89DC78,0x7F4BB64F,0x7D0D0816,0x7CCF6221,0x798074A4,0x78421E93,0x7A04A0CA,0x7BC6CAFD, | |
134 | 0x6CBC2EB0,0x6D7E4487,0x6F38FADE,0x6EFA90E9,0x6BB5866C,0x6A77EC5B,0x68315202,0x69F33835, | |
135 | 0x62AF7F08,0x636D153F,0x612BAB66,0x60E9C151,0x65A6D7D4,0x6464BDE3,0x662203BA,0x67E0698D, | |
136 | 0x48D7CB20,0x4915A117,0x4B531F4E,0x4A917579,0x4FDE63FC,0x4E1C09CB,0x4C5AB792,0x4D98DDA5, | |
137 | 0x46C49A98,0x4706F0AF,0x45404EF6,0x448224C1,0x41CD3244,0x400F5873,0x4249E62A,0x438B8C1D, | |
138 | 0x54F16850,0x55330267,0x5775BC3E,0x56B7D609,0x53F8C08C,0x523AAABB,0x507C14E2,0x51BE7ED5, | |
139 | 0x5AE239E8,0x5B2053DF,0x5966ED86,0x58A487B1,0x5DEB9134,0x5C29FB03,0x5E6F455A,0x5FAD2F6D, | |
140 | 0xE1351B80,0xE0F771B7,0xE2B1CFEE,0xE373A5D9,0xE63CB35C,0xE7FED96B,0xE5B86732,0xE47A0D05, | |
141 | 0xEF264A38,0xEEE4200F,0xECA29E56,0xED60F461,0xE82FE2E4,0xE9ED88D3,0xEBAB368A,0xEA695CBD, | |
142 | 0xFD13B8F0,0xFCD1D2C7,0xFE976C9E,0xFF5506A9,0xFA1A102C,0xFBD87A1B,0xF99EC442,0xF85CAE75, | |
143 | 0xF300E948,0xF2C2837F,0xF0843D26,0xF1465711,0xF4094194,0xF5CB2BA3,0xF78D95FA,0xF64FFFCD, | |
144 | 0xD9785D60,0xD8BA3757,0xDAFC890E,0xDB3EE339,0xDE71F5BC,0xDFB39F8B,0xDDF521D2,0xDC374BE5, | |
145 | 0xD76B0CD8,0xD6A966EF,0xD4EFD8B6,0xD52DB281,0xD062A404,0xD1A0CE33,0xD3E6706A,0xD2241A5D, | |
146 | 0xC55EFE10,0xC49C9427,0xC6DA2A7E,0xC7184049,0xC25756CC,0xC3953CFB,0xC1D382A2,0xC011E895, | |
147 | 0xCB4DAFA8,0xCA8FC59F,0xC8C97BC6,0xC90B11F1,0xCC440774,0xCD866D43,0xCFC0D31A,0xCE02B92D, | |
148 | 0x91AF9640,0x906DFC77,0x922B422E,0x93E92819,0x96A63E9C,0x976454AB,0x9522EAF2,0x94E080C5, | |
149 | 0x9FBCC7F8,0x9E7EADCF,0x9C381396,0x9DFA79A1,0x98B56F24,0x99770513,0x9B31BB4A,0x9AF3D17D, | |
150 | 0x8D893530,0x8C4B5F07,0x8E0DE15E,0x8FCF8B69,0x8A809DEC,0x8B42F7DB,0x89044982,0x88C623B5, | |
151 | 0x839A6488,0x82580EBF,0x801EB0E6,0x81DCDAD1,0x8493CC54,0x8551A663,0x8717183A,0x86D5720D, | |
152 | 0xA9E2D0A0,0xA820BA97,0xAA6604CE,0xABA46EF9,0xAEEB787C,0xAF29124B,0xAD6FAC12,0xACADC625, | |
153 | 0xA7F18118,0xA633EB2F,0xA4755576,0xA5B73F41,0xA0F829C4,0xA13A43F3,0xA37CFDAA,0xA2BE979D, | |
154 | 0xB5C473D0,0xB40619E7,0xB640A7BE,0xB782CD89,0xB2CDDB0C,0xB30FB13B,0xB1490F62,0xB08B6555, | |
155 | 0xBBD72268,0xBA15485F,0xB853F606,0xB9919C31,0xBCDE8AB4,0xBD1CE083,0xBF5A5EDA,0xBE9834ED, | |
156 | }, | |
157 | ||
158 | { | |
159 | 0x00000000,0xB8BC6765,0xAA09C88B,0x12B5AFEE,0x8F629757,0x37DEF032,0x256B5FDC,0x9DD738B9, | |
160 | 0xC5B428EF,0x7D084F8A,0x6FBDE064,0xD7018701,0x4AD6BFB8,0xF26AD8DD,0xE0DF7733,0x58631056, | |
161 | 0x5019579F,0xE8A530FA,0xFA109F14,0x42ACF871,0xDF7BC0C8,0x67C7A7AD,0x75720843,0xCDCE6F26, | |
162 | 0x95AD7F70,0x2D111815,0x3FA4B7FB,0x8718D09E,0x1ACFE827,0xA2738F42,0xB0C620AC,0x087A47C9, | |
163 | 0xA032AF3E,0x188EC85B,0x0A3B67B5,0xB28700D0,0x2F503869,0x97EC5F0C,0x8559F0E2,0x3DE59787, | |
164 | 0x658687D1,0xDD3AE0B4,0xCF8F4F5A,0x7733283F,0xEAE41086,0x525877E3,0x40EDD80D,0xF851BF68, | |
165 | 0xF02BF8A1,0x48979FC4,0x5A22302A,0xE29E574F,0x7F496FF6,0xC7F50893,0xD540A77D,0x6DFCC018, | |
166 | 0x359FD04E,0x8D23B72B,0x9F9618C5,0x272A7FA0,0xBAFD4719,0x0241207C,0x10F48F92,0xA848E8F7, | |
167 | 0x9B14583D,0x23A83F58,0x311D90B6,0x89A1F7D3,0x1476CF6A,0xACCAA80F,0xBE7F07E1,0x06C36084, | |
168 | 0x5EA070D2,0xE61C17B7,0xF4A9B859,0x4C15DF3C,0xD1C2E785,0x697E80E0,0x7BCB2F0E,0xC377486B, | |
169 | 0xCB0D0FA2,0x73B168C7,0x6104C729,0xD9B8A04C,0x446F98F5,0xFCD3FF90,0xEE66507E,0x56DA371B, | |
170 | 0x0EB9274D,0xB6054028,0xA4B0EFC6,0x1C0C88A3,0x81DBB01A,0x3967D77F,0x2BD27891,0x936E1FF4, | |
171 | 0x3B26F703,0x839A9066,0x912F3F88,0x299358ED,0xB4446054,0x0CF80731,0x1E4DA8DF,0xA6F1CFBA, | |
172 | 0xFE92DFEC,0x462EB889,0x549B1767,0xEC277002,0x71F048BB,0xC94C2FDE,0xDBF98030,0x6345E755, | |
173 | 0x6B3FA09C,0xD383C7F9,0xC1366817,0x798A0F72,0xE45D37CB,0x5CE150AE,0x4E54FF40,0xF6E89825, | |
174 | 0xAE8B8873,0x1637EF16,0x048240F8,0xBC3E279D,0x21E91F24,0x99557841,0x8BE0D7AF,0x335CB0CA, | |
175 | 0xED59B63B,0x55E5D15E,0x47507EB0,0xFFEC19D5,0x623B216C,0xDA874609,0xC832E9E7,0x708E8E82, | |
176 | 0x28ED9ED4,0x9051F9B1,0x82E4565F,0x3A58313A,0xA78F0983,0x1F336EE6,0x0D86C108,0xB53AA66D, | |
177 | 0xBD40E1A4,0x05FC86C1,0x1749292F,0xAFF54E4A,0x322276F3,0x8A9E1196,0x982BBE78,0x2097D91D, | |
178 | 0x78F4C94B,0xC048AE2E,0xD2FD01C0,0x6A4166A5,0xF7965E1C,0x4F2A3979,0x5D9F9697,0xE523F1F2, | |
179 | 0x4D6B1905,0xF5D77E60,0xE762D18E,0x5FDEB6EB,0xC2098E52,0x7AB5E937,0x680046D9,0xD0BC21BC, | |
180 | 0x88DF31EA,0x3063568F,0x22D6F961,0x9A6A9E04,0x07BDA6BD,0xBF01C1D8,0xADB46E36,0x15080953, | |
181 | 0x1D724E9A,0xA5CE29FF,0xB77B8611,0x0FC7E174,0x9210D9CD,0x2AACBEA8,0x38191146,0x80A57623, | |
182 | 0xD8C66675,0x607A0110,0x72CFAEFE,0xCA73C99B,0x57A4F122,0xEF189647,0xFDAD39A9,0x45115ECC, | |
183 | 0x764DEE06,0xCEF18963,0xDC44268D,0x64F841E8,0xF92F7951,0x41931E34,0x5326B1DA,0xEB9AD6BF, | |
184 | 0xB3F9C6E9,0x0B45A18C,0x19F00E62,0xA14C6907,0x3C9B51BE,0x842736DB,0x96929935,0x2E2EFE50, | |
185 | 0x2654B999,0x9EE8DEFC,0x8C5D7112,0x34E11677,0xA9362ECE,0x118A49AB,0x033FE645,0xBB838120, | |
186 | 0xE3E09176,0x5B5CF613,0x49E959FD,0xF1553E98,0x6C820621,0xD43E6144,0xC68BCEAA,0x7E37A9CF, | |
187 | 0xD67F4138,0x6EC3265D,0x7C7689B3,0xC4CAEED6,0x591DD66F,0xE1A1B10A,0xF3141EE4,0x4BA87981, | |
188 | 0x13CB69D7,0xAB770EB2,0xB9C2A15C,0x017EC639,0x9CA9FE80,0x241599E5,0x36A0360B,0x8E1C516E, | |
189 | 0x866616A7,0x3EDA71C2,0x2C6FDE2C,0x94D3B949,0x090481F0,0xB1B8E695,0xA30D497B,0x1BB12E1E, | |
190 | 0x43D23E48,0xFB6E592D,0xE9DBF6C3,0x516791A6,0xCCB0A91F,0x740CCE7A,0x66B96194,0xDE0506F1, | |
191 | }, | |
192 | ||
193 | /* beyond this point only relevant for Slicing-by-8 and Slicing-by-16 */ | |
194 | { | |
195 | 0x00000000,0x3D6029B0,0x7AC05360,0x47A07AD0,0xF580A6C0,0xC8E08F70,0x8F40F5A0,0xB220DC10, | |
196 | 0x30704BC1,0x0D106271,0x4AB018A1,0x77D03111,0xC5F0ED01,0xF890C4B1,0xBF30BE61,0x825097D1, | |
197 | 0x60E09782,0x5D80BE32,0x1A20C4E2,0x2740ED52,0x95603142,0xA80018F2,0xEFA06222,0xD2C04B92, | |
198 | 0x5090DC43,0x6DF0F5F3,0x2A508F23,0x1730A693,0xA5107A83,0x98705333,0xDFD029E3,0xE2B00053, | |
199 | 0xC1C12F04,0xFCA106B4,0xBB017C64,0x866155D4,0x344189C4,0x0921A074,0x4E81DAA4,0x73E1F314, | |
200 | 0xF1B164C5,0xCCD14D75,0x8B7137A5,0xB6111E15,0x0431C205,0x3951EBB5,0x7EF19165,0x4391B8D5, | |
201 | 0xA121B886,0x9C419136,0xDBE1EBE6,0xE681C256,0x54A11E46,0x69C137F6,0x2E614D26,0x13016496, | |
202 | 0x9151F347,0xAC31DAF7,0xEB91A027,0xD6F18997,0x64D15587,0x59B17C37,0x1E1106E7,0x23712F57, | |
203 | 0x58F35849,0x659371F9,0x22330B29,0x1F532299,0xAD73FE89,0x9013D739,0xD7B3ADE9,0xEAD38459, | |
204 | 0x68831388,0x55E33A38,0x124340E8,0x2F236958,0x9D03B548,0xA0639CF8,0xE7C3E628,0xDAA3CF98, | |
205 | 0x3813CFCB,0x0573E67B,0x42D39CAB,0x7FB3B51B,0xCD93690B,0xF0F340BB,0xB7533A6B,0x8A3313DB, | |
206 | 0x0863840A,0x3503ADBA,0x72A3D76A,0x4FC3FEDA,0xFDE322CA,0xC0830B7A,0x872371AA,0xBA43581A, | |
207 | 0x9932774D,0xA4525EFD,0xE3F2242D,0xDE920D9D,0x6CB2D18D,0x51D2F83D,0x167282ED,0x2B12AB5D, | |
208 | 0xA9423C8C,0x9422153C,0xD3826FEC,0xEEE2465C,0x5CC29A4C,0x61A2B3FC,0x2602C92C,0x1B62E09C, | |
209 | 0xF9D2E0CF,0xC4B2C97F,0x8312B3AF,0xBE729A1F,0x0C52460F,0x31326FBF,0x7692156F,0x4BF23CDF, | |
210 | 0xC9A2AB0E,0xF4C282BE,0xB362F86E,0x8E02D1DE,0x3C220DCE,0x0142247E,0x46E25EAE,0x7B82771E, | |
211 | 0xB1E6B092,0x8C869922,0xCB26E3F2,0xF646CA42,0x44661652,0x79063FE2,0x3EA64532,0x03C66C82, | |
212 | 0x8196FB53,0xBCF6D2E3,0xFB56A833,0xC6368183,0x74165D93,0x49767423,0x0ED60EF3,0x33B62743, | |
213 | 0xD1062710,0xEC660EA0,0xABC67470,0x96A65DC0,0x248681D0,0x19E6A860,0x5E46D2B0,0x6326FB00, | |
214 | 0xE1766CD1,0xDC164561,0x9BB63FB1,0xA6D61601,0x14F6CA11,0x2996E3A1,0x6E369971,0x5356B0C1, | |
215 | 0x70279F96,0x4D47B626,0x0AE7CCF6,0x3787E546,0x85A73956,0xB8C710E6,0xFF676A36,0xC2074386, | |
216 | 0x4057D457,0x7D37FDE7,0x3A978737,0x07F7AE87,0xB5D77297,0x88B75B27,0xCF1721F7,0xF2770847, | |
217 | 0x10C70814,0x2DA721A4,0x6A075B74,0x576772C4,0xE547AED4,0xD8278764,0x9F87FDB4,0xA2E7D404, | |
218 | 0x20B743D5,0x1DD76A65,0x5A7710B5,0x67173905,0xD537E515,0xE857CCA5,0xAFF7B675,0x92979FC5, | |
219 | 0xE915E8DB,0xD475C16B,0x93D5BBBB,0xAEB5920B,0x1C954E1B,0x21F567AB,0x66551D7B,0x5B3534CB, | |
220 | 0xD965A31A,0xE4058AAA,0xA3A5F07A,0x9EC5D9CA,0x2CE505DA,0x11852C6A,0x562556BA,0x6B457F0A, | |
221 | 0x89F57F59,0xB49556E9,0xF3352C39,0xCE550589,0x7C75D999,0x4115F029,0x06B58AF9,0x3BD5A349, | |
222 | 0xB9853498,0x84E51D28,0xC34567F8,0xFE254E48,0x4C059258,0x7165BBE8,0x36C5C138,0x0BA5E888, | |
223 | 0x28D4C7DF,0x15B4EE6F,0x521494BF,0x6F74BD0F,0xDD54611F,0xE03448AF,0xA794327F,0x9AF41BCF, | |
224 | 0x18A48C1E,0x25C4A5AE,0x6264DF7E,0x5F04F6CE,0xED242ADE,0xD044036E,0x97E479BE,0xAA84500E, | |
225 | 0x4834505D,0x755479ED,0x32F4033D,0x0F942A8D,0xBDB4F69D,0x80D4DF2D,0xC774A5FD,0xFA148C4D, | |
226 | 0x78441B9C,0x4524322C,0x028448FC,0x3FE4614C,0x8DC4BD5C,0xB0A494EC,0xF704EE3C,0xCA64C78C, | |
227 | }, | |
228 | ||
229 | { | |
230 | 0x00000000,0xCB5CD3A5,0x4DC8A10B,0x869472AE,0x9B914216,0x50CD91B3,0xD659E31D,0x1D0530B8, | |
231 | 0xEC53826D,0x270F51C8,0xA19B2366,0x6AC7F0C3,0x77C2C07B,0xBC9E13DE,0x3A0A6170,0xF156B2D5, | |
232 | 0x03D6029B,0xC88AD13E,0x4E1EA390,0x85427035,0x9847408D,0x531B9328,0xD58FE186,0x1ED33223, | |
233 | 0xEF8580F6,0x24D95353,0xA24D21FD,0x6911F258,0x7414C2E0,0xBF481145,0x39DC63EB,0xF280B04E, | |
234 | 0x07AC0536,0xCCF0D693,0x4A64A43D,0x81387798,0x9C3D4720,0x57619485,0xD1F5E62B,0x1AA9358E, | |
235 | 0xEBFF875B,0x20A354FE,0xA6372650,0x6D6BF5F5,0x706EC54D,0xBB3216E8,0x3DA66446,0xF6FAB7E3, | |
236 | 0x047A07AD,0xCF26D408,0x49B2A6A6,0x82EE7503,0x9FEB45BB,0x54B7961E,0xD223E4B0,0x197F3715, | |
237 | 0xE82985C0,0x23755665,0xA5E124CB,0x6EBDF76E,0x73B8C7D6,0xB8E41473,0x3E7066DD,0xF52CB578, | |
238 | 0x0F580A6C,0xC404D9C9,0x4290AB67,0x89CC78C2,0x94C9487A,0x5F959BDF,0xD901E971,0x125D3AD4, | |
239 | 0xE30B8801,0x28575BA4,0xAEC3290A,0x659FFAAF,0x789ACA17,0xB3C619B2,0x35526B1C,0xFE0EB8B9, | |
240 | 0x0C8E08F7,0xC7D2DB52,0x4146A9FC,0x8A1A7A59,0x971F4AE1,0x5C439944,0xDAD7EBEA,0x118B384F, | |
241 | 0xE0DD8A9A,0x2B81593F,0xAD152B91,0x6649F834,0x7B4CC88C,0xB0101B29,0x36846987,0xFDD8BA22, | |
242 | 0x08F40F5A,0xC3A8DCFF,0x453CAE51,0x8E607DF4,0x93654D4C,0x58399EE9,0xDEADEC47,0x15F13FE2, | |
243 | 0xE4A78D37,0x2FFB5E92,0xA96F2C3C,0x6233FF99,0x7F36CF21,0xB46A1C84,0x32FE6E2A,0xF9A2BD8F, | |
244 | 0x0B220DC1,0xC07EDE64,0x46EAACCA,0x8DB67F6F,0x90B34FD7,0x5BEF9C72,0xDD7BEEDC,0x16273D79, | |
245 | 0xE7718FAC,0x2C2D5C09,0xAAB92EA7,0x61E5FD02,0x7CE0CDBA,0xB7BC1E1F,0x31286CB1,0xFA74BF14, | |
246 | 0x1EB014D8,0xD5ECC77D,0x5378B5D3,0x98246676,0x852156CE,0x4E7D856B,0xC8E9F7C5,0x03B52460, | |
247 | 0xF2E396B5,0x39BF4510,0xBF2B37BE,0x7477E41B,0x6972D4A3,0xA22E0706,0x24BA75A8,0xEFE6A60D, | |
248 | 0x1D661643,0xD63AC5E6,0x50AEB748,0x9BF264ED,0x86F75455,0x4DAB87F0,0xCB3FF55E,0x006326FB, | |
249 | 0xF135942E,0x3A69478B,0xBCFD3525,0x77A1E680,0x6AA4D638,0xA1F8059D,0x276C7733,0xEC30A496, | |
250 | 0x191C11EE,0xD240C24B,0x54D4B0E5,0x9F886340,0x828D53F8,0x49D1805D,0xCF45F2F3,0x04192156, | |
251 | 0xF54F9383,0x3E134026,0xB8873288,0x73DBE12D,0x6EDED195,0xA5820230,0x2316709E,0xE84AA33B, | |
252 | 0x1ACA1375,0xD196C0D0,0x5702B27E,0x9C5E61DB,0x815B5163,0x4A0782C6,0xCC93F068,0x07CF23CD, | |
253 | 0xF6999118,0x3DC542BD,0xBB513013,0x700DE3B6,0x6D08D30E,0xA65400AB,0x20C07205,0xEB9CA1A0, | |
254 | 0x11E81EB4,0xDAB4CD11,0x5C20BFBF,0x977C6C1A,0x8A795CA2,0x41258F07,0xC7B1FDA9,0x0CED2E0C, | |
255 | 0xFDBB9CD9,0x36E74F7C,0xB0733DD2,0x7B2FEE77,0x662ADECF,0xAD760D6A,0x2BE27FC4,0xE0BEAC61, | |
256 | 0x123E1C2F,0xD962CF8A,0x5FF6BD24,0x94AA6E81,0x89AF5E39,0x42F38D9C,0xC467FF32,0x0F3B2C97, | |
257 | 0xFE6D9E42,0x35314DE7,0xB3A53F49,0x78F9ECEC,0x65FCDC54,0xAEA00FF1,0x28347D5F,0xE368AEFA, | |
258 | 0x16441B82,0xDD18C827,0x5B8CBA89,0x90D0692C,0x8DD55994,0x46898A31,0xC01DF89F,0x0B412B3A, | |
259 | 0xFA1799EF,0x314B4A4A,0xB7DF38E4,0x7C83EB41,0x6186DBF9,0xAADA085C,0x2C4E7AF2,0xE712A957, | |
260 | 0x15921919,0xDECECABC,0x585AB812,0x93066BB7,0x8E035B0F,0x455F88AA,0xC3CBFA04,0x089729A1, | |
261 | 0xF9C19B74,0x329D48D1,0xB4093A7F,0x7F55E9DA,0x6250D962,0xA90C0AC7,0x2F987869,0xE4C4ABCC, | |
262 | }, | |
263 | ||
264 | { | |
265 | 0x00000000,0xA6770BB4,0x979F1129,0x31E81A9D,0xF44F2413,0x52382FA7,0x63D0353A,0xC5A73E8E, | |
266 | 0x33EF4E67,0x959845D3,0xA4705F4E,0x020754FA,0xC7A06A74,0x61D761C0,0x503F7B5D,0xF64870E9, | |
267 | 0x67DE9CCE,0xC1A9977A,0xF0418DE7,0x56368653,0x9391B8DD,0x35E6B369,0x040EA9F4,0xA279A240, | |
268 | 0x5431D2A9,0xF246D91D,0xC3AEC380,0x65D9C834,0xA07EF6BA,0x0609FD0E,0x37E1E793,0x9196EC27, | |
269 | 0xCFBD399C,0x69CA3228,0x582228B5,0xFE552301,0x3BF21D8F,0x9D85163B,0xAC6D0CA6,0x0A1A0712, | |
270 | 0xFC5277FB,0x5A257C4F,0x6BCD66D2,0xCDBA6D66,0x081D53E8,0xAE6A585C,0x9F8242C1,0x39F54975, | |
271 | 0xA863A552,0x0E14AEE6,0x3FFCB47B,0x998BBFCF,0x5C2C8141,0xFA5B8AF5,0xCBB39068,0x6DC49BDC, | |
272 | 0x9B8CEB35,0x3DFBE081,0x0C13FA1C,0xAA64F1A8,0x6FC3CF26,0xC9B4C492,0xF85CDE0F,0x5E2BD5BB, | |
273 | 0x440B7579,0xE27C7ECD,0xD3946450,0x75E36FE4,0xB044516A,0x16335ADE,0x27DB4043,0x81AC4BF7, | |
274 | 0x77E43B1E,0xD19330AA,0xE07B2A37,0x460C2183,0x83AB1F0D,0x25DC14B9,0x14340E24,0xB2430590, | |
275 | 0x23D5E9B7,0x85A2E203,0xB44AF89E,0x123DF32A,0xD79ACDA4,0x71EDC610,0x4005DC8D,0xE672D739, | |
276 | 0x103AA7D0,0xB64DAC64,0x87A5B6F9,0x21D2BD4D,0xE47583C3,0x42028877,0x73EA92EA,0xD59D995E, | |
277 | 0x8BB64CE5,0x2DC14751,0x1C295DCC,0xBA5E5678,0x7FF968F6,0xD98E6342,0xE86679DF,0x4E11726B, | |
278 | 0xB8590282,0x1E2E0936,0x2FC613AB,0x89B1181F,0x4C162691,0xEA612D25,0xDB8937B8,0x7DFE3C0C, | |
279 | 0xEC68D02B,0x4A1FDB9F,0x7BF7C102,0xDD80CAB6,0x1827F438,0xBE50FF8C,0x8FB8E511,0x29CFEEA5, | |
280 | 0xDF879E4C,0x79F095F8,0x48188F65,0xEE6F84D1,0x2BC8BA5F,0x8DBFB1EB,0xBC57AB76,0x1A20A0C2, | |
281 | 0x8816EAF2,0x2E61E146,0x1F89FBDB,0xB9FEF06F,0x7C59CEE1,0xDA2EC555,0xEBC6DFC8,0x4DB1D47C, | |
282 | 0xBBF9A495,0x1D8EAF21,0x2C66B5BC,0x8A11BE08,0x4FB68086,0xE9C18B32,0xD82991AF,0x7E5E9A1B, | |
283 | 0xEFC8763C,0x49BF7D88,0x78576715,0xDE206CA1,0x1B87522F,0xBDF0599B,0x8C184306,0x2A6F48B2, | |
284 | 0xDC27385B,0x7A5033EF,0x4BB82972,0xEDCF22C6,0x28681C48,0x8E1F17FC,0xBFF70D61,0x198006D5, | |
285 | 0x47ABD36E,0xE1DCD8DA,0xD034C247,0x7643C9F3,0xB3E4F77D,0x1593FCC9,0x247BE654,0x820CEDE0, | |
286 | 0x74449D09,0xD23396BD,0xE3DB8C20,0x45AC8794,0x800BB91A,0x267CB2AE,0x1794A833,0xB1E3A387, | |
287 | 0x20754FA0,0x86024414,0xB7EA5E89,0x119D553D,0xD43A6BB3,0x724D6007,0x43A57A9A,0xE5D2712E, | |
288 | 0x139A01C7,0xB5ED0A73,0x840510EE,0x22721B5A,0xE7D525D4,0x41A22E60,0x704A34FD,0xD63D3F49, | |
289 | 0xCC1D9F8B,0x6A6A943F,0x5B828EA2,0xFDF58516,0x3852BB98,0x9E25B02C,0xAFCDAAB1,0x09BAA105, | |
290 | 0xFFF2D1EC,0x5985DA58,0x686DC0C5,0xCE1ACB71,0x0BBDF5FF,0xADCAFE4B,0x9C22E4D6,0x3A55EF62, | |
291 | 0xABC30345,0x0DB408F1,0x3C5C126C,0x9A2B19D8,0x5F8C2756,0xF9FB2CE2,0xC813367F,0x6E643DCB, | |
292 | 0x982C4D22,0x3E5B4696,0x0FB35C0B,0xA9C457BF,0x6C636931,0xCA146285,0xFBFC7818,0x5D8B73AC, | |
293 | 0x03A0A617,0xA5D7ADA3,0x943FB73E,0x3248BC8A,0xF7EF8204,0x519889B0,0x6070932D,0xC6079899, | |
294 | 0x304FE870,0x9638E3C4,0xA7D0F959,0x01A7F2ED,0xC400CC63,0x6277C7D7,0x539FDD4A,0xF5E8D6FE, | |
295 | 0x647E3AD9,0xC209316D,0xF3E12BF0,0x55962044,0x90311ECA,0x3646157E,0x07AE0FE3,0xA1D90457, | |
296 | 0x579174BE,0xF1E67F0A,0xC00E6597,0x66796E23,0xA3DE50AD,0x05A95B19,0x34414184,0x92364A30, | |
297 | }, | |
298 | ||
299 | { | |
300 | 0x00000000,0xCCAA009E,0x4225077D,0x8E8F07E3,0x844A0EFA,0x48E00E64,0xC66F0987,0x0AC50919, | |
301 | 0xD3E51BB5,0x1F4F1B2B,0x91C01CC8,0x5D6A1C56,0x57AF154F,0x9B0515D1,0x158A1232,0xD92012AC, | |
302 | 0x7CBB312B,0xB01131B5,0x3E9E3656,0xF23436C8,0xF8F13FD1,0x345B3F4F,0xBAD438AC,0x767E3832, | |
303 | 0xAF5E2A9E,0x63F42A00,0xED7B2DE3,0x21D12D7D,0x2B142464,0xE7BE24FA,0x69312319,0xA59B2387, | |
304 | 0xF9766256,0x35DC62C8,0xBB53652B,0x77F965B5,0x7D3C6CAC,0xB1966C32,0x3F196BD1,0xF3B36B4F, | |
305 | 0x2A9379E3,0xE639797D,0x68B67E9E,0xA41C7E00,0xAED97719,0x62737787,0xECFC7064,0x205670FA, | |
306 | 0x85CD537D,0x496753E3,0xC7E85400,0x0B42549E,0x01875D87,0xCD2D5D19,0x43A25AFA,0x8F085A64, | |
307 | 0x562848C8,0x9A824856,0x140D4FB5,0xD8A74F2B,0xD2624632,0x1EC846AC,0x9047414F,0x5CED41D1, | |
308 | 0x299DC2ED,0xE537C273,0x6BB8C590,0xA712C50E,0xADD7CC17,0x617DCC89,0xEFF2CB6A,0x2358CBF4, | |
309 | 0xFA78D958,0x36D2D9C6,0xB85DDE25,0x74F7DEBB,0x7E32D7A2,0xB298D73C,0x3C17D0DF,0xF0BDD041, | |
310 | 0x5526F3C6,0x998CF358,0x1703F4BB,0xDBA9F425,0xD16CFD3C,0x1DC6FDA2,0x9349FA41,0x5FE3FADF, | |
311 | 0x86C3E873,0x4A69E8ED,0xC4E6EF0E,0x084CEF90,0x0289E689,0xCE23E617,0x40ACE1F4,0x8C06E16A, | |
312 | 0xD0EBA0BB,0x1C41A025,0x92CEA7C6,0x5E64A758,0x54A1AE41,0x980BAEDF,0x1684A93C,0xDA2EA9A2, | |
313 | 0x030EBB0E,0xCFA4BB90,0x412BBC73,0x8D81BCED,0x8744B5F4,0x4BEEB56A,0xC561B289,0x09CBB217, | |
314 | 0xAC509190,0x60FA910E,0xEE7596ED,0x22DF9673,0x281A9F6A,0xE4B09FF4,0x6A3F9817,0xA6959889, | |
315 | 0x7FB58A25,0xB31F8ABB,0x3D908D58,0xF13A8DC6,0xFBFF84DF,0x37558441,0xB9DA83A2,0x7570833C, | |
316 | 0x533B85DA,0x9F918544,0x111E82A7,0xDDB48239,0xD7718B20,0x1BDB8BBE,0x95548C5D,0x59FE8CC3, | |
317 | 0x80DE9E6F,0x4C749EF1,0xC2FB9912,0x0E51998C,0x04949095,0xC83E900B,0x46B197E8,0x8A1B9776, | |
318 | 0x2F80B4F1,0xE32AB46F,0x6DA5B38C,0xA10FB312,0xABCABA0B,0x6760BA95,0xE9EFBD76,0x2545BDE8, | |
319 | 0xFC65AF44,0x30CFAFDA,0xBE40A839,0x72EAA8A7,0x782FA1BE,0xB485A120,0x3A0AA6C3,0xF6A0A65D, | |
320 | 0xAA4DE78C,0x66E7E712,0xE868E0F1,0x24C2E06F,0x2E07E976,0xE2ADE9E8,0x6C22EE0B,0xA088EE95, | |
321 | 0x79A8FC39,0xB502FCA7,0x3B8DFB44,0xF727FBDA,0xFDE2F2C3,0x3148F25D,0xBFC7F5BE,0x736DF520, | |
322 | 0xD6F6D6A7,0x1A5CD639,0x94D3D1DA,0x5879D144,0x52BCD85D,0x9E16D8C3,0x1099DF20,0xDC33DFBE, | |
323 | 0x0513CD12,0xC9B9CD8C,0x4736CA6F,0x8B9CCAF1,0x8159C3E8,0x4DF3C376,0xC37CC495,0x0FD6C40B, | |
324 | 0x7AA64737,0xB60C47A9,0x3883404A,0xF42940D4,0xFEEC49CD,0x32464953,0xBCC94EB0,0x70634E2E, | |
325 | 0xA9435C82,0x65E95C1C,0xEB665BFF,0x27CC5B61,0x2D095278,0xE1A352E6,0x6F2C5505,0xA386559B, | |
326 | 0x061D761C,0xCAB77682,0x44387161,0x889271FF,0x825778E6,0x4EFD7878,0xC0727F9B,0x0CD87F05, | |
327 | 0xD5F86DA9,0x19526D37,0x97DD6AD4,0x5B776A4A,0x51B26353,0x9D1863CD,0x1397642E,0xDF3D64B0, | |
328 | 0x83D02561,0x4F7A25FF,0xC1F5221C,0x0D5F2282,0x079A2B9B,0xCB302B05,0x45BF2CE6,0x89152C78, | |
329 | 0x50353ED4,0x9C9F3E4A,0x121039A9,0xDEBA3937,0xD47F302E,0x18D530B0,0x965A3753,0x5AF037CD, | |
330 | 0xFF6B144A,0x33C114D4,0xBD4E1337,0x71E413A9,0x7B211AB0,0xB78B1A2E,0x39041DCD,0xF5AE1D53, | |
331 | 0x2C8E0FFF,0xE0240F61,0x6EAB0882,0xA201081C,0xA8C40105,0x646E019B,0xEAE10678,0x264B06E6, | |
332 | }, | |
333 | ||
334 | /* beyond this point only relevant for Slicing-by-16 */ | |
335 | { | |
336 | 0x00000000,0x177B1443,0x2EF62886,0x398D3CC5,0x5DEC510C,0x4A97454F,0x731A798A,0x64616DC9, | |
337 | 0xBBD8A218,0xACA3B65B,0x952E8A9E,0x82559EDD,0xE634F314,0xF14FE757,0xC8C2DB92,0xDFB9CFD1, | |
338 | 0xACC04271,0xBBBB5632,0x82366AF7,0x954D7EB4,0xF12C137D,0xE657073E,0xDFDA3BFB,0xC8A12FB8, | |
339 | 0x1718E069,0x0063F42A,0x39EEC8EF,0x2E95DCAC,0x4AF4B165,0x5D8FA526,0x640299E3,0x73798DA0, | |
340 | 0x82F182A3,0x958A96E0,0xAC07AA25,0xBB7CBE66,0xDF1DD3AF,0xC866C7EC,0xF1EBFB29,0xE690EF6A, | |
341 | 0x392920BB,0x2E5234F8,0x17DF083D,0x00A41C7E,0x64C571B7,0x73BE65F4,0x4A335931,0x5D484D72, | |
342 | 0x2E31C0D2,0x394AD491,0x00C7E854,0x17BCFC17,0x73DD91DE,0x64A6859D,0x5D2BB958,0x4A50AD1B, | |
343 | 0x95E962CA,0x82927689,0xBB1F4A4C,0xAC645E0F,0xC80533C6,0xDF7E2785,0xE6F31B40,0xF1880F03, | |
344 | 0xDE920307,0xC9E91744,0xF0642B81,0xE71F3FC2,0x837E520B,0x94054648,0xAD887A8D,0xBAF36ECE, | |
345 | 0x654AA11F,0x7231B55C,0x4BBC8999,0x5CC79DDA,0x38A6F013,0x2FDDE450,0x1650D895,0x012BCCD6, | |
346 | 0x72524176,0x65295535,0x5CA469F0,0x4BDF7DB3,0x2FBE107A,0x38C50439,0x014838FC,0x16332CBF, | |
347 | 0xC98AE36E,0xDEF1F72D,0xE77CCBE8,0xF007DFAB,0x9466B262,0x831DA621,0xBA909AE4,0xADEB8EA7, | |
348 | 0x5C6381A4,0x4B1895E7,0x7295A922,0x65EEBD61,0x018FD0A8,0x16F4C4EB,0x2F79F82E,0x3802EC6D, | |
349 | 0xE7BB23BC,0xF0C037FF,0xC94D0B3A,0xDE361F79,0xBA5772B0,0xAD2C66F3,0x94A15A36,0x83DA4E75, | |
350 | 0xF0A3C3D5,0xE7D8D796,0xDE55EB53,0xC92EFF10,0xAD4F92D9,0xBA34869A,0x83B9BA5F,0x94C2AE1C, | |
351 | 0x4B7B61CD,0x5C00758E,0x658D494B,0x72F65D08,0x169730C1,0x01EC2482,0x38611847,0x2F1A0C04, | |
352 | 0x6655004F,0x712E140C,0x48A328C9,0x5FD83C8A,0x3BB95143,0x2CC24500,0x154F79C5,0x02346D86, | |
353 | 0xDD8DA257,0xCAF6B614,0xF37B8AD1,0xE4009E92,0x8061F35B,0x971AE718,0xAE97DBDD,0xB9ECCF9E, | |
354 | 0xCA95423E,0xDDEE567D,0xE4636AB8,0xF3187EFB,0x97791332,0x80020771,0xB98F3BB4,0xAEF42FF7, | |
355 | 0x714DE026,0x6636F465,0x5FBBC8A0,0x48C0DCE3,0x2CA1B12A,0x3BDAA569,0x025799AC,0x152C8DEF, | |
356 | 0xE4A482EC,0xF3DF96AF,0xCA52AA6A,0xDD29BE29,0xB948D3E0,0xAE33C7A3,0x97BEFB66,0x80C5EF25, | |
357 | 0x5F7C20F4,0x480734B7,0x718A0872,0x66F11C31,0x029071F8,0x15EB65BB,0x2C66597E,0x3B1D4D3D, | |
358 | 0x4864C09D,0x5F1FD4DE,0x6692E81B,0x71E9FC58,0x15889191,0x02F385D2,0x3B7EB917,0x2C05AD54, | |
359 | 0xF3BC6285,0xE4C776C6,0xDD4A4A03,0xCA315E40,0xAE503389,0xB92B27CA,0x80A61B0F,0x97DD0F4C, | |
360 | 0xB8C70348,0xAFBC170B,0x96312BCE,0x814A3F8D,0xE52B5244,0xF2504607,0xCBDD7AC2,0xDCA66E81, | |
361 | 0x031FA150,0x1464B513,0x2DE989D6,0x3A929D95,0x5EF3F05C,0x4988E41F,0x7005D8DA,0x677ECC99, | |
362 | 0x14074139,0x037C557A,0x3AF169BF,0x2D8A7DFC,0x49EB1035,0x5E900476,0x671D38B3,0x70662CF0, | |
363 | 0xAFDFE321,0xB8A4F762,0x8129CBA7,0x9652DFE4,0xF233B22D,0xE548A66E,0xDCC59AAB,0xCBBE8EE8, | |
364 | 0x3A3681EB,0x2D4D95A8,0x14C0A96D,0x03BBBD2E,0x67DAD0E7,0x70A1C4A4,0x492CF861,0x5E57EC22, | |
365 | 0x81EE23F3,0x969537B0,0xAF180B75,0xB8631F36,0xDC0272FF,0xCB7966BC,0xF2F45A79,0xE58F4E3A, | |
366 | 0x96F6C39A,0x818DD7D9,0xB800EB1C,0xAF7BFF5F,0xCB1A9296,0xDC6186D5,0xE5ECBA10,0xF297AE53, | |
367 | 0x2D2E6182,0x3A5575C1,0x03D84904,0x14A35D47,0x70C2308E,0x67B924CD,0x5E341808,0x494F0C4B, | |
368 | }, | |
369 | ||
370 | { | |
371 | 0x00000000,0xEFC26B3E,0x04F5D03D,0xEB37BB03,0x09EBA07A,0xE629CB44,0x0D1E7047,0xE2DC1B79, | |
372 | 0x13D740F4,0xFC152BCA,0x172290C9,0xF8E0FBF7,0x1A3CE08E,0xF5FE8BB0,0x1EC930B3,0xF10B5B8D, | |
373 | 0x27AE81E8,0xC86CEAD6,0x235B51D5,0xCC993AEB,0x2E452192,0xC1874AAC,0x2AB0F1AF,0xC5729A91, | |
374 | 0x3479C11C,0xDBBBAA22,0x308C1121,0xDF4E7A1F,0x3D926166,0xD2500A58,0x3967B15B,0xD6A5DA65, | |
375 | 0x4F5D03D0,0xA09F68EE,0x4BA8D3ED,0xA46AB8D3,0x46B6A3AA,0xA974C894,0x42437397,0xAD8118A9, | |
376 | 0x5C8A4324,0xB348281A,0x587F9319,0xB7BDF827,0x5561E35E,0xBAA38860,0x51943363,0xBE56585D, | |
377 | 0x68F38238,0x8731E906,0x6C065205,0x83C4393B,0x61182242,0x8EDA497C,0x65EDF27F,0x8A2F9941, | |
378 | 0x7B24C2CC,0x94E6A9F2,0x7FD112F1,0x901379CF,0x72CF62B6,0x9D0D0988,0x763AB28B,0x99F8D9B5, | |
379 | 0x9EBA07A0,0x71786C9E,0x9A4FD79D,0x758DBCA3,0x9751A7DA,0x7893CCE4,0x93A477E7,0x7C661CD9, | |
380 | 0x8D6D4754,0x62AF2C6A,0x89989769,0x665AFC57,0x8486E72E,0x6B448C10,0x80733713,0x6FB15C2D, | |
381 | 0xB9148648,0x56D6ED76,0xBDE15675,0x52233D4B,0xB0FF2632,0x5F3D4D0C,0xB40AF60F,0x5BC89D31, | |
382 | 0xAAC3C6BC,0x4501AD82,0xAE361681,0x41F47DBF,0xA32866C6,0x4CEA0DF8,0xA7DDB6FB,0x481FDDC5, | |
383 | 0xD1E70470,0x3E256F4E,0xD512D44D,0x3AD0BF73,0xD80CA40A,0x37CECF34,0xDCF97437,0x333B1F09, | |
384 | 0xC2304484,0x2DF22FBA,0xC6C594B9,0x2907FF87,0xCBDBE4FE,0x24198FC0,0xCF2E34C3,0x20EC5FFD, | |
385 | 0xF6498598,0x198BEEA6,0xF2BC55A5,0x1D7E3E9B,0xFFA225E2,0x10604EDC,0xFB57F5DF,0x14959EE1, | |
386 | 0xE59EC56C,0x0A5CAE52,0xE16B1551,0x0EA97E6F,0xEC756516,0x03B70E28,0xE880B52B,0x0742DE15, | |
387 | 0xE6050901,0x09C7623F,0xE2F0D93C,0x0D32B202,0xEFEEA97B,0x002CC245,0xEB1B7946,0x04D91278, | |
388 | 0xF5D249F5,0x1A1022CB,0xF12799C8,0x1EE5F2F6,0xFC39E98F,0x13FB82B1,0xF8CC39B2,0x170E528C, | |
389 | 0xC1AB88E9,0x2E69E3D7,0xC55E58D4,0x2A9C33EA,0xC8402893,0x278243AD,0xCCB5F8AE,0x23779390, | |
390 | 0xD27CC81D,0x3DBEA323,0xD6891820,0x394B731E,0xDB976867,0x34550359,0xDF62B85A,0x30A0D364, | |
391 | 0xA9580AD1,0x469A61EF,0xADADDAEC,0x426FB1D2,0xA0B3AAAB,0x4F71C195,0xA4467A96,0x4B8411A8, | |
392 | 0xBA8F4A25,0x554D211B,0xBE7A9A18,0x51B8F126,0xB364EA5F,0x5CA68161,0xB7913A62,0x5853515C, | |
393 | 0x8EF68B39,0x6134E007,0x8A035B04,0x65C1303A,0x871D2B43,0x68DF407D,0x83E8FB7E,0x6C2A9040, | |
394 | 0x9D21CBCD,0x72E3A0F3,0x99D41BF0,0x761670CE,0x94CA6BB7,0x7B080089,0x903FBB8A,0x7FFDD0B4, | |
395 | 0x78BF0EA1,0x977D659F,0x7C4ADE9C,0x9388B5A2,0x7154AEDB,0x9E96C5E5,0x75A17EE6,0x9A6315D8, | |
396 | 0x6B684E55,0x84AA256B,0x6F9D9E68,0x805FF556,0x6283EE2F,0x8D418511,0x66763E12,0x89B4552C, | |
397 | 0x5F118F49,0xB0D3E477,0x5BE45F74,0xB426344A,0x56FA2F33,0xB938440D,0x520FFF0E,0xBDCD9430, | |
398 | 0x4CC6CFBD,0xA304A483,0x48331F80,0xA7F174BE,0x452D6FC7,0xAAEF04F9,0x41D8BFFA,0xAE1AD4C4, | |
399 | 0x37E20D71,0xD820664F,0x3317DD4C,0xDCD5B672,0x3E09AD0B,0xD1CBC635,0x3AFC7D36,0xD53E1608, | |
400 | 0x24354D85,0xCBF726BB,0x20C09DB8,0xCF02F686,0x2DDEEDFF,0xC21C86C1,0x292B3DC2,0xC6E956FC, | |
401 | 0x104C8C99,0xFF8EE7A7,0x14B95CA4,0xFB7B379A,0x19A72CE3,0xF66547DD,0x1D52FCDE,0xF29097E0, | |
402 | 0x039BCC6D,0xEC59A753,0x076E1C50,0xE8AC776E,0x0A706C17,0xE5B20729,0x0E85BC2A,0xE147D714, | |
403 | }, | |
404 | ||
405 | { | |
406 | 0x00000000,0xC18EDFC0,0x586CB9C1,0x99E26601,0xB0D97382,0x7157AC42,0xE8B5CA43,0x293B1583, | |
407 | 0xBAC3E145,0x7B4D3E85,0xE2AF5884,0x23218744,0x0A1A92C7,0xCB944D07,0x52762B06,0x93F8F4C6, | |
408 | 0xAEF6C4CB,0x6F781B0B,0xF69A7D0A,0x3714A2CA,0x1E2FB749,0xDFA16889,0x46430E88,0x87CDD148, | |
409 | 0x1435258E,0xD5BBFA4E,0x4C599C4F,0x8DD7438F,0xA4EC560C,0x656289CC,0xFC80EFCD,0x3D0E300D, | |
410 | 0x869C8FD7,0x47125017,0xDEF03616,0x1F7EE9D6,0x3645FC55,0xF7CB2395,0x6E294594,0xAFA79A54, | |
411 | 0x3C5F6E92,0xFDD1B152,0x6433D753,0xA5BD0893,0x8C861D10,0x4D08C2D0,0xD4EAA4D1,0x15647B11, | |
412 | 0x286A4B1C,0xE9E494DC,0x7006F2DD,0xB1882D1D,0x98B3389E,0x593DE75E,0xC0DF815F,0x01515E9F, | |
413 | 0x92A9AA59,0x53277599,0xCAC51398,0x0B4BCC58,0x2270D9DB,0xE3FE061B,0x7A1C601A,0xBB92BFDA, | |
414 | 0xD64819EF,0x17C6C62F,0x8E24A02E,0x4FAA7FEE,0x66916A6D,0xA71FB5AD,0x3EFDD3AC,0xFF730C6C, | |
415 | 0x6C8BF8AA,0xAD05276A,0x34E7416B,0xF5699EAB,0xDC528B28,0x1DDC54E8,0x843E32E9,0x45B0ED29, | |
416 | 0x78BEDD24,0xB93002E4,0x20D264E5,0xE15CBB25,0xC867AEA6,0x09E97166,0x900B1767,0x5185C8A7, | |
417 | 0xC27D3C61,0x03F3E3A1,0x9A1185A0,0x5B9F5A60,0x72A44FE3,0xB32A9023,0x2AC8F622,0xEB4629E2, | |
418 | 0x50D49638,0x915A49F8,0x08B82FF9,0xC936F039,0xE00DE5BA,0x21833A7A,0xB8615C7B,0x79EF83BB, | |
419 | 0xEA17777D,0x2B99A8BD,0xB27BCEBC,0x73F5117C,0x5ACE04FF,0x9B40DB3F,0x02A2BD3E,0xC32C62FE, | |
420 | 0xFE2252F3,0x3FAC8D33,0xA64EEB32,0x67C034F2,0x4EFB2171,0x8F75FEB1,0x169798B0,0xD7194770, | |
421 | 0x44E1B3B6,0x856F6C76,0x1C8D0A77,0xDD03D5B7,0xF438C034,0x35B61FF4,0xAC5479F5,0x6DDAA635, | |
422 | 0x77E1359F,0xB66FEA5F,0x2F8D8C5E,0xEE03539E,0xC738461D,0x06B699DD,0x9F54FFDC,0x5EDA201C, | |
423 | 0xCD22D4DA,0x0CAC0B1A,0x954E6D1B,0x54C0B2DB,0x7DFBA758,0xBC757898,0x25971E99,0xE419C159, | |
424 | 0xD917F154,0x18992E94,0x817B4895,0x40F59755,0x69CE82D6,0xA8405D16,0x31A23B17,0xF02CE4D7, | |
425 | 0x63D41011,0xA25ACFD1,0x3BB8A9D0,0xFA367610,0xD30D6393,0x1283BC53,0x8B61DA52,0x4AEF0592, | |
426 | 0xF17DBA48,0x30F36588,0xA9110389,0x689FDC49,0x41A4C9CA,0x802A160A,0x19C8700B,0xD846AFCB, | |
427 | 0x4BBE5B0D,0x8A3084CD,0x13D2E2CC,0xD25C3D0C,0xFB67288F,0x3AE9F74F,0xA30B914E,0x62854E8E, | |
428 | 0x5F8B7E83,0x9E05A143,0x07E7C742,0xC6691882,0xEF520D01,0x2EDCD2C1,0xB73EB4C0,0x76B06B00, | |
429 | 0xE5489FC6,0x24C64006,0xBD242607,0x7CAAF9C7,0x5591EC44,0x941F3384,0x0DFD5585,0xCC738A45, | |
430 | 0xA1A92C70,0x6027F3B0,0xF9C595B1,0x384B4A71,0x11705FF2,0xD0FE8032,0x491CE633,0x889239F3, | |
431 | 0x1B6ACD35,0xDAE412F5,0x430674F4,0x8288AB34,0xABB3BEB7,0x6A3D6177,0xF3DF0776,0x3251D8B6, | |
432 | 0x0F5FE8BB,0xCED1377B,0x5733517A,0x96BD8EBA,0xBF869B39,0x7E0844F9,0xE7EA22F8,0x2664FD38, | |
433 | 0xB59C09FE,0x7412D63E,0xEDF0B03F,0x2C7E6FFF,0x05457A7C,0xC4CBA5BC,0x5D29C3BD,0x9CA71C7D, | |
434 | 0x2735A3A7,0xE6BB7C67,0x7F591A66,0xBED7C5A6,0x97ECD025,0x56620FE5,0xCF8069E4,0x0E0EB624, | |
435 | 0x9DF642E2,0x5C789D22,0xC59AFB23,0x041424E3,0x2D2F3160,0xECA1EEA0,0x754388A1,0xB4CD5761, | |
436 | 0x89C3676C,0x484DB8AC,0xD1AFDEAD,0x1021016D,0x391A14EE,0xF894CB2E,0x6176AD2F,0xA0F872EF, | |
437 | 0x33008629,0xF28E59E9,0x6B6C3FE8,0xAAE2E028,0x83D9F5AB,0x42572A6B,0xDBB54C6A,0x1A3B93AA, | |
438 | }, | |
439 | ||
440 | { | |
441 | 0x00000000,0x9BA54C6F,0xEC3B9E9F,0x779ED2F0,0x03063B7F,0x98A37710,0xEF3DA5E0,0x7498E98F, | |
442 | 0x060C76FE,0x9DA93A91,0xEA37E861,0x7192A40E,0x050A4D81,0x9EAF01EE,0xE931D31E,0x72949F71, | |
443 | 0x0C18EDFC,0x97BDA193,0xE0237363,0x7B863F0C,0x0F1ED683,0x94BB9AEC,0xE325481C,0x78800473, | |
444 | 0x0A149B02,0x91B1D76D,0xE62F059D,0x7D8A49F2,0x0912A07D,0x92B7EC12,0xE5293EE2,0x7E8C728D, | |
445 | 0x1831DBF8,0x83949797,0xF40A4567,0x6FAF0908,0x1B37E087,0x8092ACE8,0xF70C7E18,0x6CA93277, | |
446 | 0x1E3DAD06,0x8598E169,0xF2063399,0x69A37FF6,0x1D3B9679,0x869EDA16,0xF10008E6,0x6AA54489, | |
447 | 0x14293604,0x8F8C7A6B,0xF812A89B,0x63B7E4F4,0x172F0D7B,0x8C8A4114,0xFB1493E4,0x60B1DF8B, | |
448 | 0x122540FA,0x89800C95,0xFE1EDE65,0x65BB920A,0x11237B85,0x8A8637EA,0xFD18E51A,0x66BDA975, | |
449 | 0x3063B7F0,0xABC6FB9F,0xDC58296F,0x47FD6500,0x33658C8F,0xA8C0C0E0,0xDF5E1210,0x44FB5E7F, | |
450 | 0x366FC10E,0xADCA8D61,0xDA545F91,0x41F113FE,0x3569FA71,0xAECCB61E,0xD95264EE,0x42F72881, | |
451 | 0x3C7B5A0C,0xA7DE1663,0xD040C493,0x4BE588FC,0x3F7D6173,0xA4D82D1C,0xD346FFEC,0x48E3B383, | |
452 | 0x3A772CF2,0xA1D2609D,0xD64CB26D,0x4DE9FE02,0x3971178D,0xA2D45BE2,0xD54A8912,0x4EEFC57D, | |
453 | 0x28526C08,0xB3F72067,0xC469F297,0x5FCCBEF8,0x2B545777,0xB0F11B18,0xC76FC9E8,0x5CCA8587, | |
454 | 0x2E5E1AF6,0xB5FB5699,0xC2658469,0x59C0C806,0x2D582189,0xB6FD6DE6,0xC163BF16,0x5AC6F379, | |
455 | 0x244A81F4,0xBFEFCD9B,0xC8711F6B,0x53D45304,0x274CBA8B,0xBCE9F6E4,0xCB772414,0x50D2687B, | |
456 | 0x2246F70A,0xB9E3BB65,0xCE7D6995,0x55D825FA,0x2140CC75,0xBAE5801A,0xCD7B52EA,0x56DE1E85, | |
457 | 0x60C76FE0,0xFB62238F,0x8CFCF17F,0x1759BD10,0x63C1549F,0xF86418F0,0x8FFACA00,0x145F866F, | |
458 | 0x66CB191E,0xFD6E5571,0x8AF08781,0x1155CBEE,0x65CD2261,0xFE686E0E,0x89F6BCFE,0x1253F091, | |
459 | 0x6CDF821C,0xF77ACE73,0x80E41C83,0x1B4150EC,0x6FD9B963,0xF47CF50C,0x83E227FC,0x18476B93, | |
460 | 0x6AD3F4E2,0xF176B88D,0x86E86A7D,0x1D4D2612,0x69D5CF9D,0xF27083F2,0x85EE5102,0x1E4B1D6D, | |
461 | 0x78F6B418,0xE353F877,0x94CD2A87,0x0F6866E8,0x7BF08F67,0xE055C308,0x97CB11F8,0x0C6E5D97, | |
462 | 0x7EFAC2E6,0xE55F8E89,0x92C15C79,0x09641016,0x7DFCF999,0xE659B5F6,0x91C76706,0x0A622B69, | |
463 | 0x74EE59E4,0xEF4B158B,0x98D5C77B,0x03708B14,0x77E8629B,0xEC4D2EF4,0x9BD3FC04,0x0076B06B, | |
464 | 0x72E22F1A,0xE9476375,0x9ED9B185,0x057CFDEA,0x71E41465,0xEA41580A,0x9DDF8AFA,0x067AC695, | |
465 | 0x50A4D810,0xCB01947F,0xBC9F468F,0x273A0AE0,0x53A2E36F,0xC807AF00,0xBF997DF0,0x243C319F, | |
466 | 0x56A8AEEE,0xCD0DE281,0xBA933071,0x21367C1E,0x55AE9591,0xCE0BD9FE,0xB9950B0E,0x22304761, | |
467 | 0x5CBC35EC,0xC7197983,0xB087AB73,0x2B22E71C,0x5FBA0E93,0xC41F42FC,0xB381900C,0x2824DC63, | |
468 | 0x5AB04312,0xC1150F7D,0xB68BDD8D,0x2D2E91E2,0x59B6786D,0xC2133402,0xB58DE6F2,0x2E28AA9D, | |
469 | 0x489503E8,0xD3304F87,0xA4AE9D77,0x3F0BD118,0x4B933897,0xD03674F8,0xA7A8A608,0x3C0DEA67, | |
470 | 0x4E997516,0xD53C3979,0xA2A2EB89,0x3907A7E6,0x4D9F4E69,0xD63A0206,0xA1A4D0F6,0x3A019C99, | |
471 | 0x448DEE14,0xDF28A27B,0xA8B6708B,0x33133CE4,0x478BD56B,0xDC2E9904,0xABB04BF4,0x3015079B, | |
472 | 0x428198EA,0xD924D485,0xAEBA0675,0x351F4A1A,0x4187A395,0xDA22EFFA,0xADBC3D0A,0x36197165, | |
473 | }, | |
474 | ||
475 | { | |
476 | 0x00000000,0xDD96D985,0x605CB54B,0xBDCA6CCE,0xC0B96A96,0x1D2FB313,0xA0E5DFDD,0x7D730658, | |
477 | 0x5A03D36D,0x87950AE8,0x3A5F6626,0xE7C9BFA3,0x9ABAB9FB,0x472C607E,0xFAE60CB0,0x2770D535, | |
478 | 0xB407A6DA,0x69917F5F,0xD45B1391,0x09CDCA14,0x74BECC4C,0xA92815C9,0x14E27907,0xC974A082, | |
479 | 0xEE0475B7,0x3392AC32,0x8E58C0FC,0x53CE1979,0x2EBD1F21,0xF32BC6A4,0x4EE1AA6A,0x937773EF, | |
480 | 0xB37E4BF5,0x6EE89270,0xD322FEBE,0x0EB4273B,0x73C72163,0xAE51F8E6,0x139B9428,0xCE0D4DAD, | |
481 | 0xE97D9898,0x34EB411D,0x89212DD3,0x54B7F456,0x29C4F20E,0xF4522B8B,0x49984745,0x940E9EC0, | |
482 | 0x0779ED2F,0xDAEF34AA,0x67255864,0xBAB381E1,0xC7C087B9,0x1A565E3C,0xA79C32F2,0x7A0AEB77, | |
483 | 0x5D7A3E42,0x80ECE7C7,0x3D268B09,0xE0B0528C,0x9DC354D4,0x40558D51,0xFD9FE19F,0x2009381A, | |
484 | 0xBD8D91AB,0x601B482E,0xDDD124E0,0x0047FD65,0x7D34FB3D,0xA0A222B8,0x1D684E76,0xC0FE97F3, | |
485 | 0xE78E42C6,0x3A189B43,0x87D2F78D,0x5A442E08,0x27372850,0xFAA1F1D5,0x476B9D1B,0x9AFD449E, | |
486 | 0x098A3771,0xD41CEEF4,0x69D6823A,0xB4405BBF,0xC9335DE7,0x14A58462,0xA96FE8AC,0x74F93129, | |
487 | 0x5389E41C,0x8E1F3D99,0x33D55157,0xEE4388D2,0x93308E8A,0x4EA6570F,0xF36C3BC1,0x2EFAE244, | |
488 | 0x0EF3DA5E,0xD36503DB,0x6EAF6F15,0xB339B690,0xCE4AB0C8,0x13DC694D,0xAE160583,0x7380DC06, | |
489 | 0x54F00933,0x8966D0B6,0x34ACBC78,0xE93A65FD,0x944963A5,0x49DFBA20,0xF415D6EE,0x29830F6B, | |
490 | 0xBAF47C84,0x6762A501,0xDAA8C9CF,0x073E104A,0x7A4D1612,0xA7DBCF97,0x1A11A359,0xC7877ADC, | |
491 | 0xE0F7AFE9,0x3D61766C,0x80AB1AA2,0x5D3DC327,0x204EC57F,0xFDD81CFA,0x40127034,0x9D84A9B1, | |
492 | 0xA06A2517,0x7DFCFC92,0xC036905C,0x1DA049D9,0x60D34F81,0xBD459604,0x008FFACA,0xDD19234F, | |
493 | 0xFA69F67A,0x27FF2FFF,0x9A354331,0x47A39AB4,0x3AD09CEC,0xE7464569,0x5A8C29A7,0x871AF022, | |
494 | 0x146D83CD,0xC9FB5A48,0x74313686,0xA9A7EF03,0xD4D4E95B,0x094230DE,0xB4885C10,0x691E8595, | |
495 | 0x4E6E50A0,0x93F88925,0x2E32E5EB,0xF3A43C6E,0x8ED73A36,0x5341E3B3,0xEE8B8F7D,0x331D56F8, | |
496 | 0x13146EE2,0xCE82B767,0x7348DBA9,0xAEDE022C,0xD3AD0474,0x0E3BDDF1,0xB3F1B13F,0x6E6768BA, | |
497 | 0x4917BD8F,0x9481640A,0x294B08C4,0xF4DDD141,0x89AED719,0x54380E9C,0xE9F26252,0x3464BBD7, | |
498 | 0xA713C838,0x7A8511BD,0xC74F7D73,0x1AD9A4F6,0x67AAA2AE,0xBA3C7B2B,0x07F617E5,0xDA60CE60, | |
499 | 0xFD101B55,0x2086C2D0,0x9D4CAE1E,0x40DA779B,0x3DA971C3,0xE03FA846,0x5DF5C488,0x80631D0D, | |
500 | 0x1DE7B4BC,0xC0716D39,0x7DBB01F7,0xA02DD872,0xDD5EDE2A,0x00C807AF,0xBD026B61,0x6094B2E4, | |
501 | 0x47E467D1,0x9A72BE54,0x27B8D29A,0xFA2E0B1F,0x875D0D47,0x5ACBD4C2,0xE701B80C,0x3A976189, | |
502 | 0xA9E01266,0x7476CBE3,0xC9BCA72D,0x142A7EA8,0x695978F0,0xB4CFA175,0x0905CDBB,0xD493143E, | |
503 | 0xF3E3C10B,0x2E75188E,0x93BF7440,0x4E29ADC5,0x335AAB9D,0xEECC7218,0x53061ED6,0x8E90C753, | |
504 | 0xAE99FF49,0x730F26CC,0xCEC54A02,0x13539387,0x6E2095DF,0xB3B64C5A,0x0E7C2094,0xD3EAF911, | |
505 | 0xF49A2C24,0x290CF5A1,0x94C6996F,0x495040EA,0x342346B2,0xE9B59F37,0x547FF3F9,0x89E92A7C, | |
506 | 0x1A9E5993,0xC7088016,0x7AC2ECD8,0xA754355D,0xDA273305,0x07B1EA80,0xBA7B864E,0x67ED5FCB, | |
507 | 0x409D8AFE,0x9D0B537B,0x20C13FB5,0xFD57E630,0x8024E068,0x5DB239ED,0xE0785523,0x3DEE8CA6, | |
508 | }, | |
509 | ||
510 | { | |
511 | 0x00000000,0x9D0FE176,0xE16EC4AD,0x7C6125DB,0x19AC8F1B,0x84A36E6D,0xF8C24BB6,0x65CDAAC0, | |
512 | 0x33591E36,0xAE56FF40,0xD237DA9B,0x4F383BED,0x2AF5912D,0xB7FA705B,0xCB9B5580,0x5694B4F6, | |
513 | 0x66B23C6C,0xFBBDDD1A,0x87DCF8C1,0x1AD319B7,0x7F1EB377,0xE2115201,0x9E7077DA,0x037F96AC, | |
514 | 0x55EB225A,0xC8E4C32C,0xB485E6F7,0x298A0781,0x4C47AD41,0xD1484C37,0xAD2969EC,0x3026889A, | |
515 | 0xCD6478D8,0x506B99AE,0x2C0ABC75,0xB1055D03,0xD4C8F7C3,0x49C716B5,0x35A6336E,0xA8A9D218, | |
516 | 0xFE3D66EE,0x63328798,0x1F53A243,0x825C4335,0xE791E9F5,0x7A9E0883,0x06FF2D58,0x9BF0CC2E, | |
517 | 0xABD644B4,0x36D9A5C2,0x4AB88019,0xD7B7616F,0xB27ACBAF,0x2F752AD9,0x53140F02,0xCE1BEE74, | |
518 | 0x988F5A82,0x0580BBF4,0x79E19E2F,0xE4EE7F59,0x8123D599,0x1C2C34EF,0x604D1134,0xFD42F042, | |
519 | 0x41B9F7F1,0xDCB61687,0xA0D7335C,0x3DD8D22A,0x581578EA,0xC51A999C,0xB97BBC47,0x24745D31, | |
520 | 0x72E0E9C7,0xEFEF08B1,0x938E2D6A,0x0E81CC1C,0x6B4C66DC,0xF64387AA,0x8A22A271,0x172D4307, | |
521 | 0x270BCB9D,0xBA042AEB,0xC6650F30,0x5B6AEE46,0x3EA74486,0xA3A8A5F0,0xDFC9802B,0x42C6615D, | |
522 | 0x1452D5AB,0x895D34DD,0xF53C1106,0x6833F070,0x0DFE5AB0,0x90F1BBC6,0xEC909E1D,0x719F7F6B, | |
523 | 0x8CDD8F29,0x11D26E5F,0x6DB34B84,0xF0BCAAF2,0x95710032,0x087EE144,0x741FC49F,0xE91025E9, | |
524 | 0xBF84911F,0x228B7069,0x5EEA55B2,0xC3E5B4C4,0xA6281E04,0x3B27FF72,0x4746DAA9,0xDA493BDF, | |
525 | 0xEA6FB345,0x77605233,0x0B0177E8,0x960E969E,0xF3C33C5E,0x6ECCDD28,0x12ADF8F3,0x8FA21985, | |
526 | 0xD936AD73,0x44394C05,0x385869DE,0xA55788A8,0xC09A2268,0x5D95C31E,0x21F4E6C5,0xBCFB07B3, | |
527 | 0x8373EFE2,0x1E7C0E94,0x621D2B4F,0xFF12CA39,0x9ADF60F9,0x07D0818F,0x7BB1A454,0xE6BE4522, | |
528 | 0xB02AF1D4,0x2D2510A2,0x51443579,0xCC4BD40F,0xA9867ECF,0x34899FB9,0x48E8BA62,0xD5E75B14, | |
529 | 0xE5C1D38E,0x78CE32F8,0x04AF1723,0x99A0F655,0xFC6D5C95,0x6162BDE3,0x1D039838,0x800C794E, | |
530 | 0xD698CDB8,0x4B972CCE,0x37F60915,0xAAF9E863,0xCF3442A3,0x523BA3D5,0x2E5A860E,0xB3556778, | |
531 | 0x4E17973A,0xD318764C,0xAF795397,0x3276B2E1,0x57BB1821,0xCAB4F957,0xB6D5DC8C,0x2BDA3DFA, | |
532 | 0x7D4E890C,0xE041687A,0x9C204DA1,0x012FACD7,0x64E20617,0xF9EDE761,0x858CC2BA,0x188323CC, | |
533 | 0x28A5AB56,0xB5AA4A20,0xC9CB6FFB,0x54C48E8D,0x3109244D,0xAC06C53B,0xD067E0E0,0x4D680196, | |
534 | 0x1BFCB560,0x86F35416,0xFA9271CD,0x679D90BB,0x02503A7B,0x9F5FDB0D,0xE33EFED6,0x7E311FA0, | |
535 | 0xC2CA1813,0x5FC5F965,0x23A4DCBE,0xBEAB3DC8,0xDB669708,0x4669767E,0x3A0853A5,0xA707B2D3, | |
536 | 0xF1930625,0x6C9CE753,0x10FDC288,0x8DF223FE,0xE83F893E,0x75306848,0x09514D93,0x945EACE5, | |
537 | 0xA478247F,0x3977C509,0x4516E0D2,0xD81901A4,0xBDD4AB64,0x20DB4A12,0x5CBA6FC9,0xC1B58EBF, | |
538 | 0x97213A49,0x0A2EDB3F,0x764FFEE4,0xEB401F92,0x8E8DB552,0x13825424,0x6FE371FF,0xF2EC9089, | |
539 | 0x0FAE60CB,0x92A181BD,0xEEC0A466,0x73CF4510,0x1602EFD0,0x8B0D0EA6,0xF76C2B7D,0x6A63CA0B, | |
540 | 0x3CF77EFD,0xA1F89F8B,0xDD99BA50,0x40965B26,0x255BF1E6,0xB8541090,0xC435354B,0x593AD43D, | |
541 | 0x691C5CA7,0xF413BDD1,0x8872980A,0x157D797C,0x70B0D3BC,0xEDBF32CA,0x91DE1711,0x0CD1F667, | |
542 | 0x5A454291,0xC74AA3E7,0xBB2B863C,0x2624674A,0x43E9CD8A,0xDEE62CFC,0xA2870927,0x3F88E851, | |
543 | }, | |
544 | ||
545 | { | |
546 | 0x00000000,0xB9FBDBE8,0xA886B191,0x117D6A79,0x8A7C6563,0x3387BE8B,0x22FAD4F2,0x9B010F1A, | |
547 | 0xCF89CC87,0x7672176F,0x670F7D16,0xDEF4A6FE,0x45F5A9E4,0xFC0E720C,0xED731875,0x5488C39D, | |
548 | 0x44629F4F,0xFD9944A7,0xECE42EDE,0x551FF536,0xCE1EFA2C,0x77E521C4,0x66984BBD,0xDF639055, | |
549 | 0x8BEB53C8,0x32108820,0x236DE259,0x9A9639B1,0x019736AB,0xB86CED43,0xA911873A,0x10EA5CD2, | |
550 | 0x88C53E9E,0x313EE576,0x20438F0F,0x99B854E7,0x02B95BFD,0xBB428015,0xAA3FEA6C,0x13C43184, | |
551 | 0x474CF219,0xFEB729F1,0xEFCA4388,0x56319860,0xCD30977A,0x74CB4C92,0x65B626EB,0xDC4DFD03, | |
552 | 0xCCA7A1D1,0x755C7A39,0x64211040,0xDDDACBA8,0x46DBC4B2,0xFF201F5A,0xEE5D7523,0x57A6AECB, | |
553 | 0x032E6D56,0xBAD5B6BE,0xABA8DCC7,0x1253072F,0x89520835,0x30A9D3DD,0x21D4B9A4,0x982F624C, | |
554 | 0xCAFB7B7D,0x7300A095,0x627DCAEC,0xDB861104,0x40871E1E,0xF97CC5F6,0xE801AF8F,0x51FA7467, | |
555 | 0x0572B7FA,0xBC896C12,0xADF4066B,0x140FDD83,0x8F0ED299,0x36F50971,0x27886308,0x9E73B8E0, | |
556 | 0x8E99E432,0x37623FDA,0x261F55A3,0x9FE48E4B,0x04E58151,0xBD1E5AB9,0xAC6330C0,0x1598EB28, | |
557 | 0x411028B5,0xF8EBF35D,0xE9969924,0x506D42CC,0xCB6C4DD6,0x7297963E,0x63EAFC47,0xDA1127AF, | |
558 | 0x423E45E3,0xFBC59E0B,0xEAB8F472,0x53432F9A,0xC8422080,0x71B9FB68,0x60C49111,0xD93F4AF9, | |
559 | 0x8DB78964,0x344C528C,0x253138F5,0x9CCAE31D,0x07CBEC07,0xBE3037EF,0xAF4D5D96,0x16B6867E, | |
560 | 0x065CDAAC,0xBFA70144,0xAEDA6B3D,0x1721B0D5,0x8C20BFCF,0x35DB6427,0x24A60E5E,0x9D5DD5B6, | |
561 | 0xC9D5162B,0x702ECDC3,0x6153A7BA,0xD8A87C52,0x43A97348,0xFA52A8A0,0xEB2FC2D9,0x52D41931, | |
562 | 0x4E87F0BB,0xF77C2B53,0xE601412A,0x5FFA9AC2,0xC4FB95D8,0x7D004E30,0x6C7D2449,0xD586FFA1, | |
563 | 0x810E3C3C,0x38F5E7D4,0x29888DAD,0x90735645,0x0B72595F,0xB28982B7,0xA3F4E8CE,0x1A0F3326, | |
564 | 0x0AE56FF4,0xB31EB41C,0xA263DE65,0x1B98058D,0x80990A97,0x3962D17F,0x281FBB06,0x91E460EE, | |
565 | 0xC56CA373,0x7C97789B,0x6DEA12E2,0xD411C90A,0x4F10C610,0xF6EB1DF8,0xE7967781,0x5E6DAC69, | |
566 | 0xC642CE25,0x7FB915CD,0x6EC47FB4,0xD73FA45C,0x4C3EAB46,0xF5C570AE,0xE4B81AD7,0x5D43C13F, | |
567 | 0x09CB02A2,0xB030D94A,0xA14DB333,0x18B668DB,0x83B767C1,0x3A4CBC29,0x2B31D650,0x92CA0DB8, | |
568 | 0x8220516A,0x3BDB8A82,0x2AA6E0FB,0x935D3B13,0x085C3409,0xB1A7EFE1,0xA0DA8598,0x19215E70, | |
569 | 0x4DA99DED,0xF4524605,0xE52F2C7C,0x5CD4F794,0xC7D5F88E,0x7E2E2366,0x6F53491F,0xD6A892F7, | |
570 | 0x847C8BC6,0x3D87502E,0x2CFA3A57,0x9501E1BF,0x0E00EEA5,0xB7FB354D,0xA6865F34,0x1F7D84DC, | |
571 | 0x4BF54741,0xF20E9CA9,0xE373F6D0,0x5A882D38,0xC1892222,0x7872F9CA,0x690F93B3,0xD0F4485B, | |
572 | 0xC01E1489,0x79E5CF61,0x6898A518,0xD1637EF0,0x4A6271EA,0xF399AA02,0xE2E4C07B,0x5B1F1B93, | |
573 | 0x0F97D80E,0xB66C03E6,0xA711699F,0x1EEAB277,0x85EBBD6D,0x3C106685,0x2D6D0CFC,0x9496D714, | |
574 | 0x0CB9B558,0xB5426EB0,0xA43F04C9,0x1DC4DF21,0x86C5D03B,0x3F3E0BD3,0x2E4361AA,0x97B8BA42, | |
575 | 0xC33079DF,0x7ACBA237,0x6BB6C84E,0xD24D13A6,0x494C1CBC,0xF0B7C754,0xE1CAAD2D,0x583176C5, | |
576 | 0x48DB2A17,0xF120F1FF,0xE05D9B86,0x59A6406E,0xC2A74F74,0x7B5C949C,0x6A21FEE5,0xD3DA250D, | |
577 | 0x8752E690,0x3EA93D78,0x2FD45701,0x962F8CE9,0x0D2E83F3,0xB4D5581B,0xA5A83262,0x1C53E98A, | |
578 | }, | |
579 | ||
580 | { | |
581 | 0x00000000,0xAE689191,0x87A02563,0x29C8B4F2,0xD4314C87,0x7A59DD16,0x539169E4,0xFDF9F875, | |
582 | 0x73139F4F,0xDD7B0EDE,0xF4B3BA2C,0x5ADB2BBD,0xA722D3C8,0x094A4259,0x2082F6AB,0x8EEA673A, | |
583 | 0xE6273E9E,0x484FAF0F,0x61871BFD,0xCFEF8A6C,0x32167219,0x9C7EE388,0xB5B6577A,0x1BDEC6EB, | |
584 | 0x9534A1D1,0x3B5C3040,0x129484B2,0xBCFC1523,0x4105ED56,0xEF6D7CC7,0xC6A5C835,0x68CD59A4, | |
585 | 0x173F7B7D,0xB957EAEC,0x909F5E1E,0x3EF7CF8F,0xC30E37FA,0x6D66A66B,0x44AE1299,0xEAC68308, | |
586 | 0x642CE432,0xCA4475A3,0xE38CC151,0x4DE450C0,0xB01DA8B5,0x1E753924,0x37BD8DD6,0x99D51C47, | |
587 | 0xF11845E3,0x5F70D472,0x76B86080,0xD8D0F111,0x25290964,0x8B4198F5,0xA2892C07,0x0CE1BD96, | |
588 | 0x820BDAAC,0x2C634B3D,0x05ABFFCF,0xABC36E5E,0x563A962B,0xF85207BA,0xD19AB348,0x7FF222D9, | |
589 | 0x2E7EF6FA,0x8016676B,0xA9DED399,0x07B64208,0xFA4FBA7D,0x54272BEC,0x7DEF9F1E,0xD3870E8F, | |
590 | 0x5D6D69B5,0xF305F824,0xDACD4CD6,0x74A5DD47,0x895C2532,0x2734B4A3,0x0EFC0051,0xA09491C0, | |
591 | 0xC859C864,0x663159F5,0x4FF9ED07,0xE1917C96,0x1C6884E3,0xB2001572,0x9BC8A180,0x35A03011, | |
592 | 0xBB4A572B,0x1522C6BA,0x3CEA7248,0x9282E3D9,0x6F7B1BAC,0xC1138A3D,0xE8DB3ECF,0x46B3AF5E, | |
593 | 0x39418D87,0x97291C16,0xBEE1A8E4,0x10893975,0xED70C100,0x43185091,0x6AD0E463,0xC4B875F2, | |
594 | 0x4A5212C8,0xE43A8359,0xCDF237AB,0x639AA63A,0x9E635E4F,0x300BCFDE,0x19C37B2C,0xB7ABEABD, | |
595 | 0xDF66B319,0x710E2288,0x58C6967A,0xF6AE07EB,0x0B57FF9E,0xA53F6E0F,0x8CF7DAFD,0x229F4B6C, | |
596 | 0xAC752C56,0x021DBDC7,0x2BD50935,0x85BD98A4,0x784460D1,0xD62CF140,0xFFE445B2,0x518CD423, | |
597 | 0x5CFDEDF4,0xF2957C65,0xDB5DC897,0x75355906,0x88CCA173,0x26A430E2,0x0F6C8410,0xA1041581, | |
598 | 0x2FEE72BB,0x8186E32A,0xA84E57D8,0x0626C649,0xFBDF3E3C,0x55B7AFAD,0x7C7F1B5F,0xD2178ACE, | |
599 | 0xBADAD36A,0x14B242FB,0x3D7AF609,0x93126798,0x6EEB9FED,0xC0830E7C,0xE94BBA8E,0x47232B1F, | |
600 | 0xC9C94C25,0x67A1DDB4,0x4E696946,0xE001F8D7,0x1DF800A2,0xB3909133,0x9A5825C1,0x3430B450, | |
601 | 0x4BC29689,0xE5AA0718,0xCC62B3EA,0x620A227B,0x9FF3DA0E,0x319B4B9F,0x1853FF6D,0xB63B6EFC, | |
602 | 0x38D109C6,0x96B99857,0xBF712CA5,0x1119BD34,0xECE04541,0x4288D4D0,0x6B406022,0xC528F1B3, | |
603 | 0xADE5A817,0x038D3986,0x2A458D74,0x842D1CE5,0x79D4E490,0xD7BC7501,0xFE74C1F3,0x501C5062, | |
604 | 0xDEF63758,0x709EA6C9,0x5956123B,0xF73E83AA,0x0AC77BDF,0xA4AFEA4E,0x8D675EBC,0x230FCF2D, | |
605 | 0x72831B0E,0xDCEB8A9F,0xF5233E6D,0x5B4BAFFC,0xA6B25789,0x08DAC618,0x211272EA,0x8F7AE37B, | |
606 | 0x01908441,0xAFF815D0,0x8630A122,0x285830B3,0xD5A1C8C6,0x7BC95957,0x5201EDA5,0xFC697C34, | |
607 | 0x94A42590,0x3ACCB401,0x130400F3,0xBD6C9162,0x40956917,0xEEFDF886,0xC7354C74,0x695DDDE5, | |
608 | 0xE7B7BADF,0x49DF2B4E,0x60179FBC,0xCE7F0E2D,0x3386F658,0x9DEE67C9,0xB426D33B,0x1A4E42AA, | |
609 | 0x65BC6073,0xCBD4F1E2,0xE21C4510,0x4C74D481,0xB18D2CF4,0x1FE5BD65,0x362D0997,0x98459806, | |
610 | 0x16AFFF3C,0xB8C76EAD,0x910FDA5F,0x3F674BCE,0xC29EB3BB,0x6CF6222A,0x453E96D8,0xEB560749, | |
611 | 0x839B5EED,0x2DF3CF7C,0x043B7B8E,0xAA53EA1F,0x57AA126A,0xF9C283FB,0xD00A3709,0x7E62A698, | |
612 | 0xF088C1A2,0x5EE05033,0x7728E4C1,0xD9407550,0x24B98D25,0x8AD11CB4,0xA319A846,0x0D7139D7, | |
613 | } | |
81 | 614 | }; |
82 | 615 | |
83 | /* ========================================================================= */ | |
84 | #define DO1(buf) crc = crc_table[(crc ^ (*buf++)) & 0xff] ^ (crc >> 8); | |
85 | #define DO2(buf) DO1(buf); DO1(buf); | |
86 | #define DO4(buf) DO2(buf); DO2(buf); | |
87 | #define DO8(buf) DO4(buf); DO4(buf); | |
88 | ||
89 | /* ========================================================================= */ | |
90 | crc32_t crc32(crc32_t crc, const unsigned char *buf, unsigned int len) | |
616 | /* compute CRC32 (Slicing-by-16 algorithm) */ | |
617 | crc32_t uu_crc32(crc32_t prev, const void *data, unsigned int len) | |
91 | 618 | { |
92 | if (buf == Z_NULL) return 0L; | |
93 | crc = crc ^ 0xffffffffL; | |
94 | while (len >= 8) | |
95 | { | |
96 | DO8(buf); | |
97 | len -= 8; | |
619 | uint32_t crc = ~prev; | |
620 | const uint32_t* current = (const uint32_t*) data; | |
621 | ||
622 | /* enabling optimization (at least -O2) automatically unrolls the inner for-loop */ | |
623 | const size_t unroll = 1; | |
624 | const size_t bytes_at_once = 16 * unroll; | |
625 | ||
626 | while (len >= bytes_at_once) { | |
627 | size_t unrolling; | |
628 | for (unrolling = 0; unrolling < unroll; unrolling++) { | |
629 | if (ecb_little_endian ()) | |
630 | { | |
631 | uint32_t one = *current++ ^ crc; | |
632 | uint32_t two = *current++; | |
633 | uint32_t three = *current++; | |
634 | uint32_t four = *current++; | |
635 | crc = crc32_lookup[ 0][(four >> 24) & 0xFF] ^ | |
636 | crc32_lookup[ 1][(four >> 16) & 0xFF] ^ | |
637 | crc32_lookup[ 2][(four >> 8) & 0xFF] ^ | |
638 | crc32_lookup[ 3][ four & 0xFF] ^ | |
639 | crc32_lookup[ 4][(three >> 24) & 0xFF] ^ | |
640 | crc32_lookup[ 5][(three >> 16) & 0xFF] ^ | |
641 | crc32_lookup[ 6][(three >> 8) & 0xFF] ^ | |
642 | crc32_lookup[ 7][ three & 0xFF] ^ | |
643 | crc32_lookup[ 8][(two >> 24) & 0xFF] ^ | |
644 | crc32_lookup[ 9][(two >> 16) & 0xFF] ^ | |
645 | crc32_lookup[10][(two >> 8) & 0xFF] ^ | |
646 | crc32_lookup[11][ two & 0xFF] ^ | |
647 | crc32_lookup[12][(one >> 24) & 0xFF] ^ | |
648 | crc32_lookup[13][(one >> 16) & 0xFF] ^ | |
649 | crc32_lookup[14][(one >> 8) & 0xFF] ^ | |
650 | crc32_lookup[15][ one & 0xFF]; | |
651 | } | |
652 | else | |
653 | { | |
654 | uint32_t one = *current++ ^ ecb_bswap32(crc); | |
655 | uint32_t two = *current++; | |
656 | uint32_t three = *current++; | |
657 | uint32_t four = *current++; | |
658 | crc = crc32_lookup[ 0][ four & 0xFF] ^ | |
659 | crc32_lookup[ 1][(four >> 8) & 0xFF] ^ | |
660 | crc32_lookup[ 2][(four >> 16) & 0xFF] ^ | |
661 | crc32_lookup[ 3][(four >> 24) & 0xFF] ^ | |
662 | crc32_lookup[ 4][ three & 0xFF] ^ | |
663 | crc32_lookup[ 5][(three >> 8) & 0xFF] ^ | |
664 | crc32_lookup[ 6][(three >> 16) & 0xFF] ^ | |
665 | crc32_lookup[ 7][(three >> 24) & 0xFF] ^ | |
666 | crc32_lookup[ 8][ two & 0xFF] ^ | |
667 | crc32_lookup[ 9][(two >> 8) & 0xFF] ^ | |
668 | crc32_lookup[10][(two >> 16) & 0xFF] ^ | |
669 | crc32_lookup[11][(two >> 24) & 0xFF] ^ | |
670 | crc32_lookup[12][ one & 0xFF] ^ | |
671 | crc32_lookup[13][(one >> 8) & 0xFF] ^ | |
672 | crc32_lookup[14][(one >> 16) & 0xFF] ^ | |
673 | crc32_lookup[15][(one >> 24) & 0xFF]; | |
674 | } | |
675 | } | |
676 | ||
677 | len -= bytes_at_once; | |
98 | 678 | } |
99 | if (len) do { | |
100 | DO1(buf); | |
101 | } while (--len); | |
102 | return crc ^ 0xffffffffL; | |
679 | ||
680 | const uint8_t* current_char = (const uint8_t*) current; | |
681 | /* remaining 1 to 15 bytes (standard algorithm) */ | |
682 | while (len-- != 0) | |
683 | crc = (crc >> 8) ^ crc32_lookup[0][(crc & 0xFF) ^ *current_char++]; | |
684 | ||
685 | return ~crc; | |
103 | 686 | } |
687 | ||
688 | /* merge two CRC32 such that result = crc32(dataB, lengthB, crc32(dataA, lengthA)) */ | |
689 | uint32_t uu_crc32_combine(uint32_t crcA, uint32_t crcB, size_t lengthB) | |
690 | { | |
691 | int i; | |
692 | /* | |
693 | * based on Mark Adler's crc_combine from | |
694 | * https://github.com/madler/pigz/blob/master/pigz.c | |
695 | ||
696 | * main idea: | |
697 | * - if you have two equally-sized blocks A and B, | |
698 | * then you can create a block C = A ^ B | |
699 | * which has the property crc(C) = crc(A) ^ crc(B) | |
700 | * - if you append length(B) zeros to A and call it A' (think of it as AAAA000) | |
701 | * and prepend length(A) zeros to B and call it B' (think of it as 0000BBB) | |
702 | * then exists a C' = A' ^ B' | |
703 | * - remember: if you XOR someting with zero, it remains unchanged: X ^ 0 = X | |
704 | * - that means C' = A concat B so that crc(A concat B) = crc(C') = crc(A') ^ crc(B') | |
705 | * - the trick is to compute crc(A') based on crc(A) | |
706 | * and crc(B') based on crc(B) | |
707 | * - since B' starts with many zeros, the crc of those initial zeros is still zero | |
708 | * - that means crc(B') = crc(B) | |
709 | * - unfortunately the trailing zeros of A' change the crc, so usually crc(A') != crc(A) | |
710 | * - the following code is a fast algorithm to compute crc(A') | |
711 | * - starting with crc(A) and appending length(B) zeros, needing just log2(length(B)) iterations | |
712 | * - the details are explained by the original author at | |
713 | * https://stackoverflow.com/questions/23122312/crc-calculation-of-a-mostly-static-data-stream/23126768 | |
714 | * | |
715 | * notes: | |
716 | * - I squeezed everything into one function to keep global namespace clean (original code two helper functions) | |
717 | * - most original comments are still in place, I added comments where these helper functions where made inline code | |
718 | * - performance-wise there isn't any differenze to the original zlib/pigz code | |
719 | */ | |
720 | ||
721 | /* degenerated case */ | |
722 | if (lengthB == 0) | |
723 | return crcA; | |
724 | ||
725 | /* CRC32 => 32 bits */ | |
726 | const uint32_t CrcBits = 32; | |
727 | ||
728 | uint32_t odd [CrcBits]; /* odd-power-of-two zeros operator */ | |
729 | uint32_t even[CrcBits]; /* even-power-of-two zeros operator */ | |
730 | ||
731 | /* put operator for one zero bit in odd */ | |
732 | odd[0] = Polynomial; | |
733 | for (i = 1; i < CrcBits; i++) | |
734 | odd[i] = 1 << (i - 1); | |
735 | ||
736 | /* put operator for two zero bits in even */ | |
737 | /* same as gf2_matrix_square(even, odd); */ | |
738 | for (i = 0; i < CrcBits; i++) | |
739 | { | |
740 | int j; | |
741 | uint32_t vec = odd[i]; | |
742 | even[i] = 0; | |
743 | for (j = 0; vec != 0; j++, vec >>= 1) | |
744 | if (vec & 1) | |
745 | even[i] ^= odd[j]; | |
746 | } | |
747 | /* put operator for four zero bits in odd */ | |
748 | /* same as gf2_matrix_square(odd, even); */ | |
749 | for (i = 0; i < CrcBits; i++) | |
750 | { | |
751 | int j; | |
752 | uint32_t vec = even[i]; | |
753 | odd[i] = 0; | |
754 | for (j = 0; vec != 0; j++, vec >>= 1) | |
755 | if (vec & 1) | |
756 | odd[i] ^= even[j]; | |
757 | } | |
758 | ||
759 | /* the following loop becomes much shorter if I keep swapping even and odd */ | |
760 | uint32_t* a = even; | |
761 | uint32_t* b = odd; | |
762 | /* apply secondLength zeros to firstCrc32 */ | |
763 | for (; lengthB > 0; lengthB >>= 1) | |
764 | { | |
765 | /* same as gf2_matrix_square(a, b); */ | |
766 | for (i = 0; i < CrcBits; i++) | |
767 | { | |
768 | int j; | |
769 | uint32_t vec = b[i]; | |
770 | a[i] = 0; | |
771 | for (j = 0; vec != 0; j++, vec >>= 1) | |
772 | if (vec & 1) | |
773 | a[i] ^= b[j]; | |
774 | } | |
775 | ||
776 | /* apply zeros operator for this bit */ | |
777 | if (lengthB & 1) | |
778 | { | |
779 | /* same as firstCrc32 = gf2_matrix_times(a, firstCrc32); */ | |
780 | uint32_t sum = 0; | |
781 | for (i = 0; crcA != 0; i++, crcA >>= 1) | |
782 | if (crcA & 1) | |
783 | sum ^= a[i]; | |
784 | crcA = sum; | |
785 | } | |
786 | ||
787 | /* switch even and odd */ | |
788 | uint32_t* t = a; a = b; b = t; | |
789 | } | |
790 | ||
791 | /* return combined crc */ | |
792 | return crcA ^ crcB; | |
793 | } | |
794 |
8 | 8 | #endif |
9 | 9 | #endif |
10 | 10 | |
11 | #include "ecb.h" | |
12 | ||
11 | 13 | #ifdef __cplusplus |
12 | 14 | extern "C" { |
13 | 15 | #endif |
14 | 16 | |
15 | typedef unsigned int crc32_t; | |
16 | #define Z_NULL 0 | |
17 | typedef uint32_t crc32_t; | |
17 | 18 | |
18 | #define crc32 uulib_crc32 | |
19 | #define CRC32_INIT ((crc32_t)0) | |
19 | 20 | |
20 | crc32_t crc32 _ANSI_ARGS_((crc32_t crc, const unsigned char *buf, unsigned int len)); | |
21 | crc32_t uu_crc32 _ANSI_ARGS_((crc32_t prev, const void *data, unsigned int len)); | |
21 | 22 | /* |
22 | 23 | Update a running crc with the bytes buf[0..len-1] and return the updated |
23 | 24 | crc. If buf is NULL, this function returns the required initial value |
25 | 26 | within this function so it shouldn't be done by the application. |
26 | 27 | Usage example: |
27 | 28 | |
28 | uLong crc = crc32(0L, Z_NULL, 0); | |
29 | uLong crc = CRC32_INIT; | |
29 | 30 | |
30 | 31 | while (read_buffer(buffer, length) != EOF) { |
31 | 32 | crc = crc32(crc, buffer, length); |
33 | 34 | if (crc != original_crc) error(); |
34 | 35 | */ |
35 | 36 | |
37 | uint32_t uu_crc32_combine(uint32_t crcA, uint32_t crcB, size_t lengthB); | |
38 | ||
36 | 39 | #ifdef __cplusplus |
37 | 40 | } |
38 | 41 | #endif |
0 | /* | |
1 | * libecb - http://software.schmorp.de/pkg/libecb | |
2 | * | |
3 | * Copyright (©) 2009-2015,2018-2020 Marc Alexander Lehmann <libecb@schmorp.de> | |
4 | * Copyright (©) 2011 Emanuele Giaquinta | |
5 | * All rights reserved. | |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without modifica- | |
8 | * tion, are permitted provided that the following conditions are met: | |
9 | * | |
10 | * 1. Redistributions of source code must retain the above copyright notice, | |
11 | * this list of conditions and the following disclaimer. | |
12 | * | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | |
16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- | |
19 | * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
20 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- | |
21 | * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
23 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- | |
25 | * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
26 | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | * | |
28 | * Alternatively, the contents of this file may be used under the terms of | |
29 | * the GNU General Public License ("GPL") version 2 or any later version, | |
30 | * in which case the provisions of the GPL are applicable instead of | |
31 | * the above. If you wish to allow the use of your version of this file | |
32 | * only under the terms of the GPL and not to allow others to use your | |
33 | * version of this file under the BSD license, indicate your decision | |
34 | * by deleting the provisions above and replace them with the notice | |
35 | * and other provisions required by the GPL. If you do not delete the | |
36 | * provisions above, a recipient may use your version of this file under | |
37 | * either the BSD or the GPL. | |
38 | */ | |
39 | ||
40 | #ifndef ECB_H | |
41 | #define ECB_H | |
42 | ||
43 | /* 16 bits major, 16 bits minor */ | |
44 | #define ECB_VERSION 0x00010008 | |
45 | ||
46 | #include <string.h> /* for memcpy */ | |
47 | ||
48 | #if defined (_WIN32) && !defined (__MINGW32__) | |
49 | typedef signed char int8_t; | |
50 | typedef unsigned char uint8_t; | |
51 | typedef signed char int_fast8_t; | |
52 | typedef unsigned char uint_fast8_t; | |
53 | typedef signed short int16_t; | |
54 | typedef unsigned short uint16_t; | |
55 | typedef signed int int_fast16_t; | |
56 | typedef unsigned int uint_fast16_t; | |
57 | typedef signed int int32_t; | |
58 | typedef unsigned int uint32_t; | |
59 | typedef signed int int_fast32_t; | |
60 | typedef unsigned int uint_fast32_t; | |
61 | #if __GNUC__ | |
62 | typedef signed long long int64_t; | |
63 | typedef unsigned long long uint64_t; | |
64 | #else /* _MSC_VER || __BORLANDC__ */ | |
65 | typedef signed __int64 int64_t; | |
66 | typedef unsigned __int64 uint64_t; | |
67 | #endif | |
68 | typedef int64_t int_fast64_t; | |
69 | typedef uint64_t uint_fast64_t; | |
70 | #ifdef _WIN64 | |
71 | #define ECB_PTRSIZE 8 | |
72 | typedef uint64_t uintptr_t; | |
73 | typedef int64_t intptr_t; | |
74 | #else | |
75 | #define ECB_PTRSIZE 4 | |
76 | typedef uint32_t uintptr_t; | |
77 | typedef int32_t intptr_t; | |
78 | #endif | |
79 | #else | |
80 | #include <inttypes.h> | |
81 | #if (defined INTPTR_MAX ? INTPTR_MAX : ULONG_MAX) > 0xffffffffU | |
82 | #define ECB_PTRSIZE 8 | |
83 | #else | |
84 | #define ECB_PTRSIZE 4 | |
85 | #endif | |
86 | #endif | |
87 | ||
88 | #define ECB_GCC_AMD64 (__amd64 || __amd64__ || __x86_64 || __x86_64__) | |
89 | #define ECB_MSVC_AMD64 (_M_AMD64 || _M_X64) | |
90 | ||
91 | #ifndef ECB_OPTIMIZE_SIZE | |
92 | #if __OPTIMIZE_SIZE__ | |
93 | #define ECB_OPTIMIZE_SIZE 1 | |
94 | #else | |
95 | #define ECB_OPTIMIZE_SIZE 0 | |
96 | #endif | |
97 | #endif | |
98 | ||
99 | /* work around x32 idiocy by defining proper macros */ | |
100 | #if ECB_GCC_AMD64 || ECB_MSVC_AMD64 | |
101 | #if _ILP32 | |
102 | #define ECB_AMD64_X32 1 | |
103 | #else | |
104 | #define ECB_AMD64 1 | |
105 | #endif | |
106 | #endif | |
107 | ||
108 | /* many compilers define _GNUC_ to some versions but then only implement | |
109 | * what their idiot authors think are the "more important" extensions, | |
110 | * causing enormous grief in return for some better fake benchmark numbers. | |
111 | * or so. | |
112 | * we try to detect these and simply assume they are not gcc - if they have | |
113 | * an issue with that they should have done it right in the first place. | |
114 | */ | |
115 | #if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || defined __SUNPRO_C || defined __SUNPRO_CC || defined __llvm__ || defined __clang__ | |
116 | #define ECB_GCC_VERSION(major,minor) 0 | |
117 | #else | |
118 | #define ECB_GCC_VERSION(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) | |
119 | #endif | |
120 | ||
121 | #define ECB_CLANG_VERSION(major,minor) (__clang_major__ > (major) || (__clang_major__ == (major) && __clang_minor__ >= (minor))) | |
122 | ||
123 | #if __clang__ && defined __has_builtin | |
124 | #define ECB_CLANG_BUILTIN(x) __has_builtin (x) | |
125 | #else | |
126 | #define ECB_CLANG_BUILTIN(x) 0 | |
127 | #endif | |
128 | ||
129 | #if __clang__ && defined __has_extension | |
130 | #define ECB_CLANG_EXTENSION(x) __has_extension (x) | |
131 | #else | |
132 | #define ECB_CLANG_EXTENSION(x) 0 | |
133 | #endif | |
134 | ||
135 | #define ECB_CPP (__cplusplus+0) | |
136 | #define ECB_CPP11 (__cplusplus >= 201103L) | |
137 | #define ECB_CPP14 (__cplusplus >= 201402L) | |
138 | #define ECB_CPP17 (__cplusplus >= 201703L) | |
139 | ||
140 | #if ECB_CPP | |
141 | #define ECB_C 0 | |
142 | #define ECB_STDC_VERSION 0 | |
143 | #else | |
144 | #define ECB_C 1 | |
145 | #define ECB_STDC_VERSION __STDC_VERSION__ | |
146 | #endif | |
147 | ||
148 | #define ECB_C99 (ECB_STDC_VERSION >= 199901L) | |
149 | #define ECB_C11 (ECB_STDC_VERSION >= 201112L) | |
150 | #define ECB_C17 (ECB_STDC_VERSION >= 201710L) | |
151 | ||
152 | #if ECB_CPP | |
153 | #define ECB_EXTERN_C extern "C" | |
154 | #define ECB_EXTERN_C_BEG ECB_EXTERN_C { | |
155 | #define ECB_EXTERN_C_END } | |
156 | #else | |
157 | #define ECB_EXTERN_C extern | |
158 | #define ECB_EXTERN_C_BEG | |
159 | #define ECB_EXTERN_C_END | |
160 | #endif | |
161 | ||
162 | /*****************************************************************************/ | |
163 | ||
164 | /* ECB_NO_THREADS - ecb is not used by multiple threads, ever */ | |
165 | /* ECB_NO_SMP - ecb might be used in multiple threads, but only on a single cpu */ | |
166 | ||
167 | #if ECB_NO_THREADS | |
168 | #define ECB_NO_SMP 1 | |
169 | #endif | |
170 | ||
171 | #if ECB_NO_SMP | |
172 | #define ECB_MEMORY_FENCE do { } while (0) | |
173 | #endif | |
174 | ||
175 | /* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/compiler_ref/compiler_builtins.html */ | |
176 | #if __xlC__ && ECB_CPP | |
177 | #include <builtins.h> | |
178 | #endif | |
179 | ||
180 | #if 1400 <= _MSC_VER | |
181 | #include <intrin.h> /* fence functions _ReadBarrier, also bit search functions _BitScanReverse */ | |
182 | #endif | |
183 | ||
184 | #ifndef ECB_MEMORY_FENCE | |
185 | #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 | |
186 | #define ECB_MEMORY_FENCE_RELAXED __asm__ __volatile__ ("" : : : "memory") | |
187 | #if __i386 || __i386__ | |
188 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") | |
189 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") | |
190 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory") | |
191 | #elif ECB_GCC_AMD64 | |
192 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") | |
193 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") | |
194 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("" : : : "memory") | |
195 | #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ | |
196 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") | |
197 | #elif defined __ARM_ARCH_2__ \ | |
198 | || defined __ARM_ARCH_3__ || defined __ARM_ARCH_3M__ \ | |
199 | || defined __ARM_ARCH_4__ || defined __ARM_ARCH_4T__ \ | |
200 | || defined __ARM_ARCH_5__ || defined __ARM_ARCH_5E__ \ | |
201 | || defined __ARM_ARCH_5T__ || defined __ARM_ARCH_5TE__ \ | |
202 | || defined __ARM_ARCH_5TEJ__ | |
203 | /* should not need any, unless running old code on newer cpu - arm doesn't support that */ | |
204 | #elif defined __ARM_ARCH_6__ || defined __ARM_ARCH_6J__ \ | |
205 | || defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6ZK__ \ | |
206 | || defined __ARM_ARCH_6T2__ | |
207 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,5" : : "r" (0) : "memory") | |
208 | #elif defined __ARM_ARCH_7__ || defined __ARM_ARCH_7A__ \ | |
209 | || defined __ARM_ARCH_7R__ || defined __ARM_ARCH_7M__ | |
210 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb" : : : "memory") | |
211 | #elif __aarch64__ | |
212 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb ish" : : : "memory") | |
213 | #elif (__sparc || __sparc__) && !(__sparc_v8__ || defined __sparcv8) | |
214 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad" : : : "memory") | |
215 | #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") | |
216 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") | |
217 | #elif defined __s390__ || defined __s390x__ | |
218 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory") | |
219 | #elif defined __mips__ | |
220 | /* GNU/Linux emulates sync on mips1 architectures, so we force its use */ | |
221 | /* anybody else who still uses mips1 is supposed to send in their version, with detection code. */ | |
222 | #define ECB_MEMORY_FENCE __asm__ __volatile__ (".set mips2; sync; .set mips0" : : : "memory") | |
223 | #elif defined __alpha__ | |
224 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mb" : : : "memory") | |
225 | #elif defined __hppa__ | |
226 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("" : : : "memory") | |
227 | #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") | |
228 | #elif defined __ia64__ | |
229 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mf" : : : "memory") | |
230 | #elif defined __m68k__ | |
231 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("" : : : "memory") | |
232 | #elif defined __m88k__ | |
233 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("tb1 0,%%r0,128" : : : "memory") | |
234 | #elif defined __sh__ | |
235 | #define ECB_MEMORY_FENCE __asm__ __volatile__ ("" : : : "memory") | |
236 | #endif | |
237 | #endif | |
238 | #endif | |
239 | ||
240 | #ifndef ECB_MEMORY_FENCE | |
241 | #if ECB_GCC_VERSION(4,7) | |
242 | /* see comment below (stdatomic.h) about the C11 memory model. */ | |
243 | #define ECB_MEMORY_FENCE __atomic_thread_fence (__ATOMIC_SEQ_CST) | |
244 | #define ECB_MEMORY_FENCE_ACQUIRE __atomic_thread_fence (__ATOMIC_ACQUIRE) | |
245 | #define ECB_MEMORY_FENCE_RELEASE __atomic_thread_fence (__ATOMIC_RELEASE) | |
246 | #define ECB_MEMORY_FENCE_RELAXED __atomic_thread_fence (__ATOMIC_RELAXED) | |
247 | ||
248 | #elif ECB_CLANG_EXTENSION(c_atomic) | |
249 | /* see comment below (stdatomic.h) about the C11 memory model. */ | |
250 | #define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST) | |
251 | #define ECB_MEMORY_FENCE_ACQUIRE __c11_atomic_thread_fence (__ATOMIC_ACQUIRE) | |
252 | #define ECB_MEMORY_FENCE_RELEASE __c11_atomic_thread_fence (__ATOMIC_RELEASE) | |
253 | #define ECB_MEMORY_FENCE_RELAXED __c11_atomic_thread_fence (__ATOMIC_RELAXED) | |
254 | ||
255 | #elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__ | |
256 | #define ECB_MEMORY_FENCE __sync_synchronize () | |
257 | #elif _MSC_VER >= 1500 /* VC++ 2008 */ | |
258 | /* apparently, microsoft broke all the memory barrier stuff in Visual Studio 2008... */ | |
259 | #pragma intrinsic(_ReadBarrier,_WriteBarrier,_ReadWriteBarrier) | |
260 | #define ECB_MEMORY_FENCE _ReadWriteBarrier (); MemoryBarrier() | |
261 | #define ECB_MEMORY_FENCE_ACQUIRE _ReadWriteBarrier (); MemoryBarrier() /* according to msdn, _ReadBarrier is not a load fence */ | |
262 | #define ECB_MEMORY_FENCE_RELEASE _WriteBarrier (); MemoryBarrier() | |
263 | #elif _MSC_VER >= 1400 /* VC++ 2005 */ | |
264 | #pragma intrinsic(_ReadBarrier,_WriteBarrier,_ReadWriteBarrier) | |
265 | #define ECB_MEMORY_FENCE _ReadWriteBarrier () | |
266 | #define ECB_MEMORY_FENCE_ACQUIRE _ReadWriteBarrier () /* according to msdn, _ReadBarrier is not a load fence */ | |
267 | #define ECB_MEMORY_FENCE_RELEASE _WriteBarrier () | |
268 | #elif defined _WIN32 | |
269 | #include <WinNT.h> | |
270 | #define ECB_MEMORY_FENCE MemoryBarrier () /* actually just xchg on x86... scary */ | |
271 | #elif __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 | |
272 | #include <mbarrier.h> | |
273 | #define ECB_MEMORY_FENCE __machine_rw_barrier () | |
274 | #define ECB_MEMORY_FENCE_ACQUIRE __machine_acq_barrier () | |
275 | #define ECB_MEMORY_FENCE_RELEASE __machine_rel_barrier () | |
276 | #define ECB_MEMORY_FENCE_RELAXED __compiler_barrier () | |
277 | #elif __xlC__ | |
278 | #define ECB_MEMORY_FENCE __sync () | |
279 | #endif | |
280 | #endif | |
281 | ||
282 | #ifndef ECB_MEMORY_FENCE | |
283 | #if ECB_C11 && !defined __STDC_NO_ATOMICS__ | |
284 | /* we assume that these memory fences work on all variables/all memory accesses, */ | |
285 | /* not just C11 atomics and atomic accesses */ | |
286 | #include <stdatomic.h> | |
287 | #define ECB_MEMORY_FENCE atomic_thread_fence (memory_order_seq_cst) | |
288 | #define ECB_MEMORY_FENCE_ACQUIRE atomic_thread_fence (memory_order_acquire) | |
289 | #define ECB_MEMORY_FENCE_RELEASE atomic_thread_fence (memory_order_release) | |
290 | #endif | |
291 | #endif | |
292 | ||
293 | #ifndef ECB_MEMORY_FENCE | |
294 | #if !ECB_AVOID_PTHREADS | |
295 | /* | |
296 | * if you get undefined symbol references to pthread_mutex_lock, | |
297 | * or failure to find pthread.h, then you should implement | |
298 | * the ECB_MEMORY_FENCE operations for your cpu/compiler | |
299 | * OR provide pthread.h and link against the posix thread library | |
300 | * of your system. | |
301 | */ | |
302 | #include <pthread.h> | |
303 | #define ECB_NEEDS_PTHREADS 1 | |
304 | #define ECB_MEMORY_FENCE_NEEDS_PTHREADS 1 | |
305 | ||
306 | static pthread_mutex_t ecb_mf_lock = PTHREAD_MUTEX_INITIALIZER; | |
307 | #define ECB_MEMORY_FENCE do { pthread_mutex_lock (&ecb_mf_lock); pthread_mutex_unlock (&ecb_mf_lock); } while (0) | |
308 | #endif | |
309 | #endif | |
310 | ||
311 | #if !defined ECB_MEMORY_FENCE_ACQUIRE && defined ECB_MEMORY_FENCE | |
312 | #define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE | |
313 | #endif | |
314 | ||
315 | #if !defined ECB_MEMORY_FENCE_RELEASE && defined ECB_MEMORY_FENCE | |
316 | #define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE | |
317 | #endif | |
318 | ||
319 | #if !defined ECB_MEMORY_FENCE_RELAXED && defined ECB_MEMORY_FENCE | |
320 | #define ECB_MEMORY_FENCE_RELAXED ECB_MEMORY_FENCE /* very heavy-handed */ | |
321 | #endif | |
322 | ||
323 | /*****************************************************************************/ | |
324 | ||
325 | #if ECB_CPP | |
326 | #define ecb_inline static inline | |
327 | #elif ECB_GCC_VERSION(2,5) | |
328 | #define ecb_inline static __inline__ | |
329 | #elif ECB_C99 | |
330 | #define ecb_inline static inline | |
331 | #else | |
332 | #define ecb_inline static | |
333 | #endif | |
334 | ||
335 | #if ECB_GCC_VERSION(3,3) | |
336 | #define ecb_restrict __restrict__ | |
337 | #elif ECB_C99 | |
338 | #define ecb_restrict restrict | |
339 | #else | |
340 | #define ecb_restrict | |
341 | #endif | |
342 | ||
343 | typedef int ecb_bool; | |
344 | ||
345 | #define ECB_CONCAT_(a, b) a ## b | |
346 | #define ECB_CONCAT(a, b) ECB_CONCAT_(a, b) | |
347 | #define ECB_STRINGIFY_(a) # a | |
348 | #define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) | |
349 | #define ECB_STRINGIFY_EXPR(expr) ((expr), ECB_STRINGIFY_ (expr)) | |
350 | ||
351 | #define ecb_function_ ecb_inline | |
352 | ||
353 | #if ECB_GCC_VERSION(3,1) || ECB_CLANG_VERSION(2,8) | |
354 | #define ecb_attribute(attrlist) __attribute__ (attrlist) | |
355 | #else | |
356 | #define ecb_attribute(attrlist) | |
357 | #endif | |
358 | ||
359 | #if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_constant_p) | |
360 | #define ecb_is_constant(expr) __builtin_constant_p (expr) | |
361 | #else | |
362 | /* possible C11 impl for integral types | |
363 | typedef struct ecb_is_constant_struct ecb_is_constant_struct; | |
364 | #define ecb_is_constant(expr) _Generic ((1 ? (struct ecb_is_constant_struct *)0 : (void *)((expr) - (expr)), ecb_is_constant_struct *: 0, default: 1)) */ | |
365 | ||
366 | #define ecb_is_constant(expr) 0 | |
367 | #endif | |
368 | ||
369 | #if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_expect) | |
370 | #define ecb_expect(expr,value) __builtin_expect ((expr),(value)) | |
371 | #else | |
372 | #define ecb_expect(expr,value) (expr) | |
373 | #endif | |
374 | ||
375 | #if ECB_GCC_VERSION(3,1) || ECB_CLANG_BUILTIN(__builtin_prefetch) | |
376 | #define ecb_prefetch(addr,rw,locality) __builtin_prefetch (addr, rw, locality) | |
377 | #else | |
378 | #define ecb_prefetch(addr,rw,locality) | |
379 | #endif | |
380 | ||
381 | /* no emulation for ecb_decltype */ | |
382 | #if ECB_CPP11 | |
383 | // older implementations might have problems with decltype(x)::type, work around it | |
384 | template<class T> struct ecb_decltype_t { typedef T type; }; | |
385 | #define ecb_decltype(x) ecb_decltype_t<decltype (x)>::type | |
386 | #elif ECB_GCC_VERSION(3,0) || ECB_CLANG_VERSION(2,8) | |
387 | #define ecb_decltype(x) __typeof__ (x) | |
388 | #endif | |
389 | ||
390 | #if _MSC_VER >= 1300 | |
391 | #define ecb_deprecated __declspec (deprecated) | |
392 | #else | |
393 | #define ecb_deprecated ecb_attribute ((__deprecated__)) | |
394 | #endif | |
395 | ||
396 | #if _MSC_VER >= 1500 | |
397 | #define ecb_deprecated_message(msg) __declspec (deprecated (msg)) | |
398 | #elif ECB_GCC_VERSION(4,5) | |
399 | #define ecb_deprecated_message(msg) ecb_attribute ((__deprecated__ (msg)) | |
400 | #else | |
401 | #define ecb_deprecated_message(msg) ecb_deprecated | |
402 | #endif | |
403 | ||
404 | #if _MSC_VER >= 1400 | |
405 | #define ecb_noinline __declspec (noinline) | |
406 | #else | |
407 | #define ecb_noinline ecb_attribute ((__noinline__)) | |
408 | #endif | |
409 | ||
410 | #define ecb_unused ecb_attribute ((__unused__)) | |
411 | #define ecb_const ecb_attribute ((__const__)) | |
412 | #define ecb_pure ecb_attribute ((__pure__)) | |
413 | ||
414 | #if ECB_C11 || __IBMC_NORETURN | |
415 | /* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/language_ref/noreturn.html */ | |
416 | #define ecb_noreturn _Noreturn | |
417 | #elif ECB_CPP11 | |
418 | #define ecb_noreturn [[noreturn]] | |
419 | #elif _MSC_VER >= 1200 | |
420 | /* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx */ | |
421 | #define ecb_noreturn __declspec (noreturn) | |
422 | #else | |
423 | #define ecb_noreturn ecb_attribute ((__noreturn__)) | |
424 | #endif | |
425 | ||
426 | #if ECB_GCC_VERSION(4,3) | |
427 | #define ecb_artificial ecb_attribute ((__artificial__)) | |
428 | #define ecb_hot ecb_attribute ((__hot__)) | |
429 | #define ecb_cold ecb_attribute ((__cold__)) | |
430 | #else | |
431 | #define ecb_artificial | |
432 | #define ecb_hot | |
433 | #define ecb_cold | |
434 | #endif | |
435 | ||
436 | /* put around conditional expressions if you are very sure that the */ | |
437 | /* expression is mostly true or mostly false. note that these return */ | |
438 | /* booleans, not the expression. */ | |
439 | #define ecb_expect_false(expr) ecb_expect (!!(expr), 0) | |
440 | #define ecb_expect_true(expr) ecb_expect (!!(expr), 1) | |
441 | /* for compatibility to the rest of the world */ | |
442 | #define ecb_likely(expr) ecb_expect_true (expr) | |
443 | #define ecb_unlikely(expr) ecb_expect_false (expr) | |
444 | ||
445 | /* count trailing zero bits and count # of one bits */ | |
446 | #if ECB_GCC_VERSION(3,4) \ | |
447 | || (ECB_CLANG_BUILTIN(__builtin_clz) && ECB_CLANG_BUILTIN(__builtin_clzll) \ | |
448 | && ECB_CLANG_BUILTIN(__builtin_ctz) && ECB_CLANG_BUILTIN(__builtin_ctzll) \ | |
449 | && ECB_CLANG_BUILTIN(__builtin_popcount)) | |
450 | /* we assume int == 32 bit, long == 32 or 64 bit and long long == 64 bit */ | |
451 | #define ecb_ld32(x) (__builtin_clz (x) ^ 31) | |
452 | #define ecb_ld64(x) (__builtin_clzll (x) ^ 63) | |
453 | #define ecb_ctz32(x) __builtin_ctz (x) | |
454 | #define ecb_ctz64(x) __builtin_ctzll (x) | |
455 | #define ecb_popcount32(x) __builtin_popcount (x) | |
456 | /* no popcountll */ | |
457 | #else | |
458 | ecb_function_ ecb_const int ecb_ctz32 (uint32_t x); | |
459 | ecb_function_ ecb_const int | |
460 | ecb_ctz32 (uint32_t x) | |
461 | { | |
462 | #if 1400 <= _MSC_VER && (_M_IX86 || _M_X64 || _M_IA64 || _M_ARM) | |
463 | unsigned long r; | |
464 | _BitScanForward (&r, x); | |
465 | return (int)r; | |
466 | #else | |
467 | int r = 0; | |
468 | ||
469 | x &= ~x + 1; /* this isolates the lowest bit */ | |
470 | ||
471 | #if ECB_branchless_on_i386 | |
472 | r += !!(x & 0xaaaaaaaa) << 0; | |
473 | r += !!(x & 0xcccccccc) << 1; | |
474 | r += !!(x & 0xf0f0f0f0) << 2; | |
475 | r += !!(x & 0xff00ff00) << 3; | |
476 | r += !!(x & 0xffff0000) << 4; | |
477 | #else | |
478 | if (x & 0xaaaaaaaa) r += 1; | |
479 | if (x & 0xcccccccc) r += 2; | |
480 | if (x & 0xf0f0f0f0) r += 4; | |
481 | if (x & 0xff00ff00) r += 8; | |
482 | if (x & 0xffff0000) r += 16; | |
483 | #endif | |
484 | ||
485 | return r; | |
486 | #endif | |
487 | } | |
488 | ||
489 | ecb_function_ ecb_const int ecb_ctz64 (uint64_t x); | |
490 | ecb_function_ ecb_const int | |
491 | ecb_ctz64 (uint64_t x) | |
492 | { | |
493 | #if 1400 <= _MSC_VER && (_M_X64 || _M_IA64 || _M_ARM) | |
494 | unsigned long r; | |
495 | _BitScanForward64 (&r, x); | |
496 | return (int)r; | |
497 | #else | |
498 | int shift = x & 0xffffffff ? 0 : 32; | |
499 | return ecb_ctz32 (x >> shift) + shift; | |
500 | #endif | |
501 | } | |
502 | ||
503 | ecb_function_ ecb_const int ecb_popcount32 (uint32_t x); | |
504 | ecb_function_ ecb_const int | |
505 | ecb_popcount32 (uint32_t x) | |
506 | { | |
507 | x -= (x >> 1) & 0x55555555; | |
508 | x = ((x >> 2) & 0x33333333) + (x & 0x33333333); | |
509 | x = ((x >> 4) + x) & 0x0f0f0f0f; | |
510 | x *= 0x01010101; | |
511 | ||
512 | return x >> 24; | |
513 | } | |
514 | ||
515 | ecb_function_ ecb_const int ecb_ld32 (uint32_t x); | |
516 | ecb_function_ ecb_const int ecb_ld32 (uint32_t x) | |
517 | { | |
518 | #if 1400 <= _MSC_VER && (_M_IX86 || _M_X64 || _M_IA64 || _M_ARM) | |
519 | unsigned long r; | |
520 | _BitScanReverse (&r, x); | |
521 | return (int)r; | |
522 | #else | |
523 | int r = 0; | |
524 | ||
525 | if (x >> 16) { x >>= 16; r += 16; } | |
526 | if (x >> 8) { x >>= 8; r += 8; } | |
527 | if (x >> 4) { x >>= 4; r += 4; } | |
528 | if (x >> 2) { x >>= 2; r += 2; } | |
529 | if (x >> 1) { r += 1; } | |
530 | ||
531 | return r; | |
532 | #endif | |
533 | } | |
534 | ||
535 | ecb_function_ ecb_const int ecb_ld64 (uint64_t x); | |
536 | ecb_function_ ecb_const int ecb_ld64 (uint64_t x) | |
537 | { | |
538 | #if 1400 <= _MSC_VER && (_M_X64 || _M_IA64 || _M_ARM) | |
539 | unsigned long r; | |
540 | _BitScanReverse64 (&r, x); | |
541 | return (int)r; | |
542 | #else | |
543 | int r = 0; | |
544 | ||
545 | if (x >> 32) { x >>= 32; r += 32; } | |
546 | ||
547 | return r + ecb_ld32 (x); | |
548 | #endif | |
549 | } | |
550 | #endif | |
551 | ||
552 | ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x); | |
553 | ecb_function_ ecb_const ecb_bool ecb_is_pot32 (uint32_t x) { return !(x & (x - 1)); } | |
554 | ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x); | |
555 | ecb_function_ ecb_const ecb_bool ecb_is_pot64 (uint64_t x) { return !(x & (x - 1)); } | |
556 | ||
557 | ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x); | |
558 | ecb_function_ ecb_const uint8_t ecb_bitrev8 (uint8_t x) | |
559 | { | |
560 | return ( (x * 0x0802U & 0x22110U) | |
561 | | (x * 0x8020U & 0x88440U)) * 0x10101U >> 16; | |
562 | } | |
563 | ||
564 | ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x); | |
565 | ecb_function_ ecb_const uint16_t ecb_bitrev16 (uint16_t x) | |
566 | { | |
567 | x = ((x >> 1) & 0x5555) | ((x & 0x5555) << 1); | |
568 | x = ((x >> 2) & 0x3333) | ((x & 0x3333) << 2); | |
569 | x = ((x >> 4) & 0x0f0f) | ((x & 0x0f0f) << 4); | |
570 | x = ( x >> 8 ) | ( x << 8); | |
571 | ||
572 | return x; | |
573 | } | |
574 | ||
575 | ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x); | |
576 | ecb_function_ ecb_const uint32_t ecb_bitrev32 (uint32_t x) | |
577 | { | |
578 | x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1); | |
579 | x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2); | |
580 | x = ((x >> 4) & 0x0f0f0f0f) | ((x & 0x0f0f0f0f) << 4); | |
581 | x = ((x >> 8) & 0x00ff00ff) | ((x & 0x00ff00ff) << 8); | |
582 | x = ( x >> 16 ) | ( x << 16); | |
583 | ||
584 | return x; | |
585 | } | |
586 | ||
587 | /* popcount64 is only available on 64 bit cpus as gcc builtin */ | |
588 | /* so for this version we are lazy */ | |
589 | ecb_function_ ecb_const int ecb_popcount64 (uint64_t x); | |
590 | ecb_function_ ecb_const int | |
591 | ecb_popcount64 (uint64_t x) | |
592 | { | |
593 | return ecb_popcount32 (x) + ecb_popcount32 (x >> 32); | |
594 | } | |
595 | ||
596 | ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count); | |
597 | ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count); | |
598 | ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count); | |
599 | ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count); | |
600 | ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count); | |
601 | ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count); | |
602 | ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count); | |
603 | ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count); | |
604 | ||
605 | ecb_inline ecb_const uint8_t ecb_rotl8 (uint8_t x, unsigned int count) { return (x >> ( 8 - count)) | (x << count); } | |
606 | ecb_inline ecb_const uint8_t ecb_rotr8 (uint8_t x, unsigned int count) { return (x << ( 8 - count)) | (x >> count); } | |
607 | ecb_inline ecb_const uint16_t ecb_rotl16 (uint16_t x, unsigned int count) { return (x >> (16 - count)) | (x << count); } | |
608 | ecb_inline ecb_const uint16_t ecb_rotr16 (uint16_t x, unsigned int count) { return (x << (16 - count)) | (x >> count); } | |
609 | ecb_inline ecb_const uint32_t ecb_rotl32 (uint32_t x, unsigned int count) { return (x >> (32 - count)) | (x << count); } | |
610 | ecb_inline ecb_const uint32_t ecb_rotr32 (uint32_t x, unsigned int count) { return (x << (32 - count)) | (x >> count); } | |
611 | ecb_inline ecb_const uint64_t ecb_rotl64 (uint64_t x, unsigned int count) { return (x >> (64 - count)) | (x << count); } | |
612 | ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); } | |
613 | ||
614 | #if ECB_CPP | |
615 | ||
616 | inline uint8_t ecb_ctz (uint8_t v) { return ecb_ctz32 (v); } | |
617 | inline uint16_t ecb_ctz (uint16_t v) { return ecb_ctz32 (v); } | |
618 | inline uint32_t ecb_ctz (uint32_t v) { return ecb_ctz32 (v); } | |
619 | inline uint64_t ecb_ctz (uint64_t v) { return ecb_ctz64 (v); } | |
620 | ||
621 | inline bool ecb_is_pot (uint8_t v) { return ecb_is_pot32 (v); } | |
622 | inline bool ecb_is_pot (uint16_t v) { return ecb_is_pot32 (v); } | |
623 | inline bool ecb_is_pot (uint32_t v) { return ecb_is_pot32 (v); } | |
624 | inline bool ecb_is_pot (uint64_t v) { return ecb_is_pot64 (v); } | |
625 | ||
626 | inline int ecb_ld (uint8_t v) { return ecb_ld32 (v); } | |
627 | inline int ecb_ld (uint16_t v) { return ecb_ld32 (v); } | |
628 | inline int ecb_ld (uint32_t v) { return ecb_ld32 (v); } | |
629 | inline int ecb_ld (uint64_t v) { return ecb_ld64 (v); } | |
630 | ||
631 | inline int ecb_popcount (uint8_t v) { return ecb_popcount32 (v); } | |
632 | inline int ecb_popcount (uint16_t v) { return ecb_popcount32 (v); } | |
633 | inline int ecb_popcount (uint32_t v) { return ecb_popcount32 (v); } | |
634 | inline int ecb_popcount (uint64_t v) { return ecb_popcount64 (v); } | |
635 | ||
636 | inline uint8_t ecb_bitrev (uint8_t v) { return ecb_bitrev8 (v); } | |
637 | inline uint16_t ecb_bitrev (uint16_t v) { return ecb_bitrev16 (v); } | |
638 | inline uint32_t ecb_bitrev (uint32_t v) { return ecb_bitrev32 (v); } | |
639 | ||
640 | inline uint8_t ecb_rotl (uint8_t v, unsigned int count) { return ecb_rotl8 (v, count); } | |
641 | inline uint16_t ecb_rotl (uint16_t v, unsigned int count) { return ecb_rotl16 (v, count); } | |
642 | inline uint32_t ecb_rotl (uint32_t v, unsigned int count) { return ecb_rotl32 (v, count); } | |
643 | inline uint64_t ecb_rotl (uint64_t v, unsigned int count) { return ecb_rotl64 (v, count); } | |
644 | ||
645 | inline uint8_t ecb_rotr (uint8_t v, unsigned int count) { return ecb_rotr8 (v, count); } | |
646 | inline uint16_t ecb_rotr (uint16_t v, unsigned int count) { return ecb_rotr16 (v, count); } | |
647 | inline uint32_t ecb_rotr (uint32_t v, unsigned int count) { return ecb_rotr32 (v, count); } | |
648 | inline uint64_t ecb_rotr (uint64_t v, unsigned int count) { return ecb_rotr64 (v, count); } | |
649 | ||
650 | #endif | |
651 | ||
652 | #if ECB_GCC_VERSION(4,3) || (ECB_CLANG_BUILTIN(__builtin_bswap32) && ECB_CLANG_BUILTIN(__builtin_bswap64)) | |
653 | #if ECB_GCC_VERSION(4,8) || ECB_CLANG_BUILTIN(__builtin_bswap16) | |
654 | #define ecb_bswap16(x) __builtin_bswap16 (x) | |
655 | #else | |
656 | #define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16) | |
657 | #endif | |
658 | #define ecb_bswap32(x) __builtin_bswap32 (x) | |
659 | #define ecb_bswap64(x) __builtin_bswap64 (x) | |
660 | #elif _MSC_VER | |
661 | #include <stdlib.h> | |
662 | #define ecb_bswap16(x) ((uint16_t)_byteswap_ushort ((uint16_t)(x))) | |
663 | #define ecb_bswap32(x) ((uint32_t)_byteswap_ulong ((uint32_t)(x))) | |
664 | #define ecb_bswap64(x) ((uint64_t)_byteswap_uint64 ((uint64_t)(x))) | |
665 | #else | |
666 | ecb_function_ ecb_const uint16_t ecb_bswap16 (uint16_t x); | |
667 | ecb_function_ ecb_const uint16_t | |
668 | ecb_bswap16 (uint16_t x) | |
669 | { | |
670 | return ecb_rotl16 (x, 8); | |
671 | } | |
672 | ||
673 | ecb_function_ ecb_const uint32_t ecb_bswap32 (uint32_t x); | |
674 | ecb_function_ ecb_const uint32_t | |
675 | ecb_bswap32 (uint32_t x) | |
676 | { | |
677 | return (((uint32_t)ecb_bswap16 (x)) << 16) | ecb_bswap16 (x >> 16); | |
678 | } | |
679 | ||
680 | ecb_function_ ecb_const uint64_t ecb_bswap64 (uint64_t x); | |
681 | ecb_function_ ecb_const uint64_t | |
682 | ecb_bswap64 (uint64_t x) | |
683 | { | |
684 | return (((uint64_t)ecb_bswap32 (x)) << 32) | ecb_bswap32 (x >> 32); | |
685 | } | |
686 | #endif | |
687 | ||
688 | #if ECB_GCC_VERSION(4,5) || ECB_CLANG_BUILTIN(__builtin_unreachable) | |
689 | #define ecb_unreachable() __builtin_unreachable () | |
690 | #else | |
691 | /* this seems to work fine, but gcc always emits a warning for it :/ */ | |
692 | ecb_inline ecb_noreturn void ecb_unreachable (void); | |
693 | ecb_inline ecb_noreturn void ecb_unreachable (void) { } | |
694 | #endif | |
695 | ||
696 | /* try to tell the compiler that some condition is definitely true */ | |
697 | #define ecb_assume(cond) if (!(cond)) ecb_unreachable (); else 0 | |
698 | ||
699 | ecb_inline ecb_const uint32_t ecb_byteorder_helper (void); | |
700 | ecb_inline ecb_const uint32_t | |
701 | ecb_byteorder_helper (void) | |
702 | { | |
703 | /* the union code still generates code under pressure in gcc, */ | |
704 | /* but less than using pointers, and always seems to */ | |
705 | /* successfully return a constant. */ | |
706 | /* the reason why we have this horrible preprocessor mess */ | |
707 | /* is to avoid it in all cases, at least on common architectures */ | |
708 | /* or when using a recent enough gcc version (>= 4.6) */ | |
709 | #if (defined __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \ | |
710 | || ((__i386 || __i386__ || _M_IX86 || ECB_GCC_AMD64 || ECB_MSVC_AMD64) && !__VOS__) | |
711 | #define ECB_LITTLE_ENDIAN 1 | |
712 | return 0x44332211; | |
713 | #elif (defined __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) \ | |
714 | || ((__AARCH64EB__ || __MIPSEB__ || __ARMEB__) && !__VOS__) | |
715 | #define ECB_BIG_ENDIAN 1 | |
716 | return 0x11223344; | |
717 | #else | |
718 | union | |
719 | { | |
720 | uint8_t c[4]; | |
721 | uint32_t u; | |
722 | } u = { 0x11, 0x22, 0x33, 0x44 }; | |
723 | return u.u; | |
724 | #endif | |
725 | } | |
726 | ||
727 | ecb_inline ecb_const ecb_bool ecb_big_endian (void); | |
728 | ecb_inline ecb_const ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11223344; } | |
729 | ecb_inline ecb_const ecb_bool ecb_little_endian (void); | |
730 | ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44332211; } | |
731 | ||
732 | /*****************************************************************************/ | |
733 | /* unaligned load/store */ | |
734 | ||
735 | ecb_inline uint_fast16_t ecb_be_u16_to_host (uint_fast16_t v) { return ecb_little_endian () ? ecb_bswap16 (v) : v; } | |
736 | ecb_inline uint_fast32_t ecb_be_u32_to_host (uint_fast32_t v) { return ecb_little_endian () ? ecb_bswap32 (v) : v; } | |
737 | ecb_inline uint_fast64_t ecb_be_u64_to_host (uint_fast64_t v) { return ecb_little_endian () ? ecb_bswap64 (v) : v; } | |
738 | ||
739 | ecb_inline uint_fast16_t ecb_le_u16_to_host (uint_fast16_t v) { return ecb_big_endian () ? ecb_bswap16 (v) : v; } | |
740 | ecb_inline uint_fast32_t ecb_le_u32_to_host (uint_fast32_t v) { return ecb_big_endian () ? ecb_bswap32 (v) : v; } | |
741 | ecb_inline uint_fast64_t ecb_le_u64_to_host (uint_fast64_t v) { return ecb_big_endian () ? ecb_bswap64 (v) : v; } | |
742 | ||
743 | ecb_inline uint_fast16_t ecb_peek_u16_u (const void *ptr) { uint16_t v; memcpy (&v, ptr, sizeof (v)); return v; } | |
744 | ecb_inline uint_fast32_t ecb_peek_u32_u (const void *ptr) { uint32_t v; memcpy (&v, ptr, sizeof (v)); return v; } | |
745 | ecb_inline uint_fast64_t ecb_peek_u64_u (const void *ptr) { uint64_t v; memcpy (&v, ptr, sizeof (v)); return v; } | |
746 | ||
747 | ecb_inline uint_fast16_t ecb_peek_be_u16_u (const void *ptr) { return ecb_be_u16_to_host (ecb_peek_u16_u (ptr)); } | |
748 | ecb_inline uint_fast32_t ecb_peek_be_u32_u (const void *ptr) { return ecb_be_u32_to_host (ecb_peek_u32_u (ptr)); } | |
749 | ecb_inline uint_fast64_t ecb_peek_be_u64_u (const void *ptr) { return ecb_be_u64_to_host (ecb_peek_u64_u (ptr)); } | |
750 | ||
751 | ecb_inline uint_fast16_t ecb_peek_le_u16_u (const void *ptr) { return ecb_le_u16_to_host (ecb_peek_u16_u (ptr)); } | |
752 | ecb_inline uint_fast32_t ecb_peek_le_u32_u (const void *ptr) { return ecb_le_u32_to_host (ecb_peek_u32_u (ptr)); } | |
753 | ecb_inline uint_fast64_t ecb_peek_le_u64_u (const void *ptr) { return ecb_le_u64_to_host (ecb_peek_u64_u (ptr)); } | |
754 | ||
755 | ecb_inline uint_fast16_t ecb_host_to_be_u16 (uint_fast16_t v) { return ecb_little_endian () ? ecb_bswap16 (v) : v; } | |
756 | ecb_inline uint_fast32_t ecb_host_to_be_u32 (uint_fast32_t v) { return ecb_little_endian () ? ecb_bswap32 (v) : v; } | |
757 | ecb_inline uint_fast64_t ecb_host_to_be_u64 (uint_fast64_t v) { return ecb_little_endian () ? ecb_bswap64 (v) : v; } | |
758 | ||
759 | ecb_inline uint_fast16_t ecb_host_to_le_u16 (uint_fast16_t v) { return ecb_big_endian () ? ecb_bswap16 (v) : v; } | |
760 | ecb_inline uint_fast32_t ecb_host_to_le_u32 (uint_fast32_t v) { return ecb_big_endian () ? ecb_bswap32 (v) : v; } | |
761 | ecb_inline uint_fast64_t ecb_host_to_le_u64 (uint_fast64_t v) { return ecb_big_endian () ? ecb_bswap64 (v) : v; } | |
762 | ||
763 | ecb_inline void ecb_poke_u16_u (void *ptr, uint16_t v) { memcpy (ptr, &v, sizeof (v)); } | |
764 | ecb_inline void ecb_poke_u32_u (void *ptr, uint32_t v) { memcpy (ptr, &v, sizeof (v)); } | |
765 | ecb_inline void ecb_poke_u64_u (void *ptr, uint64_t v) { memcpy (ptr, &v, sizeof (v)); } | |
766 | ||
767 | ecb_inline void ecb_poke_be_u16_u (void *ptr, uint_fast16_t v) { ecb_poke_u16_u (ptr, ecb_host_to_be_u16 (v)); } | |
768 | ecb_inline void ecb_poke_be_u32_u (void *ptr, uint_fast32_t v) { ecb_poke_u32_u (ptr, ecb_host_to_be_u32 (v)); } | |
769 | ecb_inline void ecb_poke_be_u64_u (void *ptr, uint_fast64_t v) { ecb_poke_u64_u (ptr, ecb_host_to_be_u64 (v)); } | |
770 | ||
771 | ecb_inline void ecb_poke_le_u16_u (void *ptr, uint_fast16_t v) { ecb_poke_u16_u (ptr, ecb_host_to_le_u16 (v)); } | |
772 | ecb_inline void ecb_poke_le_u32_u (void *ptr, uint_fast32_t v) { ecb_poke_u32_u (ptr, ecb_host_to_le_u32 (v)); } | |
773 | ecb_inline void ecb_poke_le_u64_u (void *ptr, uint_fast64_t v) { ecb_poke_u64_u (ptr, ecb_host_to_le_u64 (v)); } | |
774 | ||
775 | #if ECB_CPP | |
776 | ||
777 | inline uint8_t ecb_bswap (uint8_t v) { return v; } | |
778 | inline uint16_t ecb_bswap (uint16_t v) { return ecb_bswap16 (v); } | |
779 | inline uint32_t ecb_bswap (uint32_t v) { return ecb_bswap32 (v); } | |
780 | inline uint64_t ecb_bswap (uint64_t v) { return ecb_bswap64 (v); } | |
781 | ||
782 | template<typename T> inline T ecb_be_to_host (T v) { return ecb_little_endian () ? ecb_bswap (v) : v; } | |
783 | template<typename T> inline T ecb_le_to_host (T v) { return ecb_big_endian () ? ecb_bswap (v) : v; } | |
784 | template<typename T> inline T ecb_peek (const void *ptr) { return *(const T *)ptr; } | |
785 | template<typename T> inline T ecb_peek_be (const void *ptr) { return ecb_be_to_host (ecb_peek <T> (ptr)); } | |
786 | template<typename T> inline T ecb_peek_le (const void *ptr) { return ecb_le_to_host (ecb_peek <T> (ptr)); } | |
787 | template<typename T> inline T ecb_peek_u (const void *ptr) { T v; memcpy (&v, ptr, sizeof (v)); return v; } | |
788 | template<typename T> inline T ecb_peek_be_u (const void *ptr) { return ecb_be_to_host (ecb_peek_u<T> (ptr)); } | |
789 | template<typename T> inline T ecb_peek_le_u (const void *ptr) { return ecb_le_to_host (ecb_peek_u<T> (ptr)); } | |
790 | ||
791 | template<typename T> inline T ecb_host_to_be (T v) { return ecb_little_endian () ? ecb_bswap (v) : v; } | |
792 | template<typename T> inline T ecb_host_to_le (T v) { return ecb_big_endian () ? ecb_bswap (v) : v; } | |
793 | template<typename T> inline void ecb_poke (void *ptr, T v) { *(T *)ptr = v; } | |
794 | template<typename T> inline void ecb_poke_be (void *ptr, T v) { return ecb_poke <T> (ptr, ecb_host_to_be (v)); } | |
795 | template<typename T> inline void ecb_poke_le (void *ptr, T v) { return ecb_poke <T> (ptr, ecb_host_to_le (v)); } | |
796 | template<typename T> inline void ecb_poke_u (void *ptr, T v) { memcpy (ptr, &v, sizeof (v)); } | |
797 | template<typename T> inline void ecb_poke_be_u (void *ptr, T v) { return ecb_poke_u<T> (ptr, ecb_host_to_be (v)); } | |
798 | template<typename T> inline void ecb_poke_le_u (void *ptr, T v) { return ecb_poke_u<T> (ptr, ecb_host_to_le (v)); } | |
799 | ||
800 | #endif | |
801 | ||
802 | /*****************************************************************************/ | |
803 | ||
804 | #if ECB_GCC_VERSION(3,0) || ECB_C99 | |
805 | #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0)) | |
806 | #else | |
807 | #define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n))) | |
808 | #endif | |
809 | ||
810 | #if ECB_CPP | |
811 | template<typename T> | |
812 | static inline T ecb_div_rd (T val, T div) | |
813 | { | |
814 | return val < 0 ? - ((-val + div - 1) / div) : (val ) / div; | |
815 | } | |
816 | template<typename T> | |
817 | static inline T ecb_div_ru (T val, T div) | |
818 | { | |
819 | return val < 0 ? - ((-val ) / div) : (val + div - 1) / div; | |
820 | } | |
821 | #else | |
822 | #define ecb_div_rd(val,div) ((val) < 0 ? - ((-(val) + (div) - 1) / (div)) : ((val) ) / (div)) | |
823 | #define ecb_div_ru(val,div) ((val) < 0 ? - ((-(val) ) / (div)) : ((val) + (div) - 1) / (div)) | |
824 | #endif | |
825 | ||
826 | #if ecb_cplusplus_does_not_suck | |
827 | /* does not work for local types (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm) */ | |
828 | template<typename T, int N> | |
829 | static inline int ecb_array_length (const T (&arr)[N]) | |
830 | { | |
831 | return N; | |
832 | } | |
833 | #else | |
834 | #define ecb_array_length(name) (sizeof (name) / sizeof (name [0])) | |
835 | #endif | |
836 | ||
837 | /*****************************************************************************/ | |
838 | ||
839 | ecb_function_ ecb_const uint32_t ecb_binary16_to_binary32 (uint32_t x); | |
840 | ecb_function_ ecb_const uint32_t | |
841 | ecb_binary16_to_binary32 (uint32_t x) | |
842 | { | |
843 | unsigned int s = (x & 0x8000) << (31 - 15); | |
844 | int e = (x >> 10) & 0x001f; | |
845 | unsigned int m = x & 0x03ff; | |
846 | ||
847 | if (ecb_expect_false (e == 31)) | |
848 | /* infinity or NaN */ | |
849 | e = 255 - (127 - 15); | |
850 | else if (ecb_expect_false (!e)) | |
851 | { | |
852 | if (ecb_expect_true (!m)) | |
853 | /* zero, handled by code below by forcing e to 0 */ | |
854 | e = 0 - (127 - 15); | |
855 | else | |
856 | { | |
857 | /* subnormal, renormalise */ | |
858 | unsigned int s = 10 - ecb_ld32 (m); | |
859 | ||
860 | m = (m << s) & 0x3ff; /* mask implicit bit */ | |
861 | e -= s - 1; | |
862 | } | |
863 | } | |
864 | ||
865 | /* e and m now are normalised, or zero, (or inf or nan) */ | |
866 | e += 127 - 15; | |
867 | ||
868 | return s | (e << 23) | (m << (23 - 10)); | |
869 | } | |
870 | ||
871 | ecb_function_ ecb_const uint16_t ecb_binary32_to_binary16 (uint32_t x); | |
872 | ecb_function_ ecb_const uint16_t | |
873 | ecb_binary32_to_binary16 (uint32_t x) | |
874 | { | |
875 | unsigned int s = (x >> 16) & 0x00008000; /* sign bit, the easy part */ | |
876 | unsigned int e = ((x >> 23) & 0x000000ff) - (127 - 15); /* the desired exponent */ | |
877 | unsigned int m = x & 0x007fffff; | |
878 | ||
879 | x &= 0x7fffffff; | |
880 | ||
881 | /* if it's within range of binary16 normals, use fast path */ | |
882 | if (ecb_expect_true (0x38800000 <= x && x <= 0x477fefff)) | |
883 | { | |
884 | /* mantissa round-to-even */ | |
885 | m += 0x00000fff + ((m >> (23 - 10)) & 1); | |
886 | ||
887 | /* handle overflow */ | |
888 | if (ecb_expect_false (m >= 0x00800000)) | |
889 | { | |
890 | m >>= 1; | |
891 | e += 1; | |
892 | } | |
893 | ||
894 | return s | (e << 10) | (m >> (23 - 10)); | |
895 | } | |
896 | ||
897 | /* handle large numbers and infinity */ | |
898 | if (ecb_expect_true (0x477fefff < x && x <= 0x7f800000)) | |
899 | return s | 0x7c00; | |
900 | ||
901 | /* handle zero, subnormals and small numbers */ | |
902 | if (ecb_expect_true (x < 0x38800000)) | |
903 | { | |
904 | /* zero */ | |
905 | if (ecb_expect_true (!x)) | |
906 | return s; | |
907 | ||
908 | /* handle subnormals */ | |
909 | ||
910 | /* too small, will be zero */ | |
911 | if (e < (14 - 24)) /* might not be sharp, but is good enough */ | |
912 | return s; | |
913 | ||
914 | m |= 0x00800000; /* make implicit bit explicit */ | |
915 | ||
916 | /* very tricky - we need to round to the nearest e (+10) bit value */ | |
917 | { | |
918 | unsigned int bits = 14 - e; | |
919 | unsigned int half = (1 << (bits - 1)) - 1; | |
920 | unsigned int even = (m >> bits) & 1; | |
921 | ||
922 | /* if this overflows, we will end up with a normalised number */ | |
923 | m = (m + half + even) >> bits; | |
924 | } | |
925 | ||
926 | return s | m; | |
927 | } | |
928 | ||
929 | /* handle NaNs, preserve leftmost nan bits, but make sure we don't turn them into infinities */ | |
930 | m >>= 13; | |
931 | ||
932 | return s | 0x7c00 | m | !m; | |
933 | } | |
934 | ||
935 | /*******************************************************************************/ | |
936 | /* floating point stuff, can be disabled by defining ECB_NO_LIBM */ | |
937 | ||
938 | /* basically, everything uses "ieee pure-endian" floating point numbers */ | |
939 | /* the only noteworthy exception is ancient armle, which uses order 43218765 */ | |
940 | #if 0 \ | |
941 | || __i386 || __i386__ \ | |
942 | || ECB_GCC_AMD64 \ | |
943 | || __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \ | |
944 | || defined __s390__ || defined __s390x__ \ | |
945 | || defined __mips__ \ | |
946 | || defined __alpha__ \ | |
947 | || defined __hppa__ \ | |
948 | || defined __ia64__ \ | |
949 | || defined __m68k__ \ | |
950 | || defined __m88k__ \ | |
951 | || defined __sh__ \ | |
952 | || defined _M_IX86 || defined ECB_MSVC_AMD64 || defined _M_IA64 \ | |
953 | || (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \ | |
954 | || defined __aarch64__ | |
955 | #define ECB_STDFP 1 | |
956 | #else | |
957 | #define ECB_STDFP 0 | |
958 | #endif | |
959 | ||
960 | #ifndef ECB_NO_LIBM | |
961 | ||
962 | #include <math.h> /* for frexp*, ldexp*, INFINITY, NAN */ | |
963 | ||
964 | /* only the oldest of old doesn't have this one. solaris. */ | |
965 | #ifdef INFINITY | |
966 | #define ECB_INFINITY INFINITY | |
967 | #else | |
968 | #define ECB_INFINITY HUGE_VAL | |
969 | #endif | |
970 | ||
971 | #ifdef NAN | |
972 | #define ECB_NAN NAN | |
973 | #else | |
974 | #define ECB_NAN ECB_INFINITY | |
975 | #endif | |
976 | ||
977 | #if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L | |
978 | #define ecb_ldexpf(x,e) ldexpf ((x), (e)) | |
979 | #define ecb_frexpf(x,e) frexpf ((x), (e)) | |
980 | #else | |
981 | #define ecb_ldexpf(x,e) (float) ldexp ((double) (x), (e)) | |
982 | #define ecb_frexpf(x,e) (float) frexp ((double) (x), (e)) | |
983 | #endif | |
984 | ||
985 | /* convert a float to ieee single/binary32 */ | |
986 | ecb_function_ ecb_const uint32_t ecb_float_to_binary32 (float x); | |
987 | ecb_function_ ecb_const uint32_t | |
988 | ecb_float_to_binary32 (float x) | |
989 | { | |
990 | uint32_t r; | |
991 | ||
992 | #if ECB_STDFP | |
993 | memcpy (&r, &x, 4); | |
994 | #else | |
995 | /* slow emulation, works for anything but -0 */ | |
996 | uint32_t m; | |
997 | int e; | |
998 | ||
999 | if (x == 0e0f ) return 0x00000000U; | |
1000 | if (x > +3.40282346638528860e+38f) return 0x7f800000U; | |
1001 | if (x < -3.40282346638528860e+38f) return 0xff800000U; | |
1002 | if (x != x ) return 0x7fbfffffU; | |
1003 | ||
1004 | m = ecb_frexpf (x, &e) * 0x1000000U; | |
1005 | ||
1006 | r = m & 0x80000000U; | |
1007 | ||
1008 | if (r) | |
1009 | m = -m; | |
1010 | ||
1011 | if (e <= -126) | |
1012 | { | |
1013 | m &= 0xffffffU; | |
1014 | m >>= (-125 - e); | |
1015 | e = -126; | |
1016 | } | |
1017 | ||
1018 | r |= (e + 126) << 23; | |
1019 | r |= m & 0x7fffffU; | |
1020 | #endif | |
1021 | ||
1022 | return r; | |
1023 | } | |
1024 | ||
1025 | /* converts an ieee single/binary32 to a float */ | |
1026 | ecb_function_ ecb_const float ecb_binary32_to_float (uint32_t x); | |
1027 | ecb_function_ ecb_const float | |
1028 | ecb_binary32_to_float (uint32_t x) | |
1029 | { | |
1030 | float r; | |
1031 | ||
1032 | #if ECB_STDFP | |
1033 | memcpy (&r, &x, 4); | |
1034 | #else | |
1035 | /* emulation, only works for normals and subnormals and +0 */ | |
1036 | int neg = x >> 31; | |
1037 | int e = (x >> 23) & 0xffU; | |
1038 | ||
1039 | x &= 0x7fffffU; | |
1040 | ||
1041 | if (e) | |
1042 | x |= 0x800000U; | |
1043 | else | |
1044 | e = 1; | |
1045 | ||
1046 | /* we distrust ldexpf a bit and do the 2**-24 scaling by an extra multiply */ | |
1047 | r = ecb_ldexpf (x * (0.5f / 0x800000U), e - 126); | |
1048 | ||
1049 | r = neg ? -r : r; | |
1050 | #endif | |
1051 | ||
1052 | return r; | |
1053 | } | |
1054 | ||
1055 | /* convert a double to ieee double/binary64 */ | |
1056 | ecb_function_ ecb_const uint64_t ecb_double_to_binary64 (double x); | |
1057 | ecb_function_ ecb_const uint64_t | |
1058 | ecb_double_to_binary64 (double x) | |
1059 | { | |
1060 | uint64_t r; | |
1061 | ||
1062 | #if ECB_STDFP | |
1063 | memcpy (&r, &x, 8); | |
1064 | #else | |
1065 | /* slow emulation, works for anything but -0 */ | |
1066 | uint64_t m; | |
1067 | int e; | |
1068 | ||
1069 | if (x == 0e0 ) return 0x0000000000000000U; | |
1070 | if (x > +1.79769313486231470e+308) return 0x7ff0000000000000U; | |
1071 | if (x < -1.79769313486231470e+308) return 0xfff0000000000000U; | |
1072 | if (x != x ) return 0X7ff7ffffffffffffU; | |
1073 | ||
1074 | m = frexp (x, &e) * 0x20000000000000U; | |
1075 | ||
1076 | r = m & 0x8000000000000000;; | |
1077 | ||
1078 | if (r) | |
1079 | m = -m; | |
1080 | ||
1081 | if (e <= -1022) | |
1082 | { | |
1083 | m &= 0x1fffffffffffffU; | |
1084 | m >>= (-1021 - e); | |
1085 | e = -1022; | |
1086 | } | |
1087 | ||
1088 | r |= ((uint64_t)(e + 1022)) << 52; | |
1089 | r |= m & 0xfffffffffffffU; | |
1090 | #endif | |
1091 | ||
1092 | return r; | |
1093 | } | |
1094 | ||
1095 | /* converts an ieee double/binary64 to a double */ | |
1096 | ecb_function_ ecb_const double ecb_binary64_to_double (uint64_t x); | |
1097 | ecb_function_ ecb_const double | |
1098 | ecb_binary64_to_double (uint64_t x) | |
1099 | { | |
1100 | double r; | |
1101 | ||
1102 | #if ECB_STDFP | |
1103 | memcpy (&r, &x, 8); | |
1104 | #else | |
1105 | /* emulation, only works for normals and subnormals and +0 */ | |
1106 | int neg = x >> 63; | |
1107 | int e = (x >> 52) & 0x7ffU; | |
1108 | ||
1109 | x &= 0xfffffffffffffU; | |
1110 | ||
1111 | if (e) | |
1112 | x |= 0x10000000000000U; | |
1113 | else | |
1114 | e = 1; | |
1115 | ||
1116 | /* we distrust ldexp a bit and do the 2**-53 scaling by an extra multiply */ | |
1117 | r = ldexp (x * (0.5 / 0x10000000000000U), e - 1022); | |
1118 | ||
1119 | r = neg ? -r : r; | |
1120 | #endif | |
1121 | ||
1122 | return r; | |
1123 | } | |
1124 | ||
1125 | /* convert a float to ieee half/binary16 */ | |
1126 | ecb_function_ ecb_const uint16_t ecb_float_to_binary16 (float x); | |
1127 | ecb_function_ ecb_const uint16_t | |
1128 | ecb_float_to_binary16 (float x) | |
1129 | { | |
1130 | return ecb_binary32_to_binary16 (ecb_float_to_binary32 (x)); | |
1131 | } | |
1132 | ||
1133 | /* convert an ieee half/binary16 to float */ | |
1134 | ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x); | |
1135 | ecb_function_ ecb_const float | |
1136 | ecb_binary16_to_float (uint16_t x) | |
1137 | { | |
1138 | return ecb_binary32_to_float (ecb_binary16_to_binary32 (x)); | |
1139 | } | |
1140 | ||
1141 | #endif | |
1142 | ||
1143 | #endif | |
1144 |
21 | 21 | * should behave exactly as their counterparts. There are also extensions |
22 | 22 | * that aren't portable at all (like strirstr etc.). |
23 | 23 | * The proper behaviour in a configure script is as follows: |
24 | * AC_CHECK_FUNC(strrchr,AC_DEFINE(strrchr,_FP_strrchr)) | |
24 | * AC_CHECK_FUNC(strrchr,AC_DEFINE(strrchr,FP_strrchr)) | |
25 | 25 | * This way, the (probably less efficient) replacements will only be used |
26 | 26 | * where it is not provided by the default libraries. Be aware that this |
27 | 27 | * does not work with replacements that just shadow wrong behaviour (like |
28 | * _FP_free) or provide extended functionality (FP_gets). | |
28 | * FP_free) or provide extended functionality (FP_gets). | |
29 | 29 | * The above is not used in the uuenview/uudeview configuration script, |
30 | 30 | * since both only use the replacement functions in non-performance-cri- |
31 | * tical sections (except for _FP_tempnam and FP_strerror, where some | |
31 | * tical sections (except for FP_tempnam and FP_strerror, where some | |
32 | 32 | * functionality of the original would be lost). |
33 | 33 | */ |
34 | 34 | |
72 | 72 | */ |
73 | 73 | |
74 | 74 | void TOOLEXPORT |
75 | _FP_free (void *ptr) | |
75 | FP_free (void *ptr) | |
76 | 76 | { |
77 | 77 | if (ptr) free (ptr); |
78 | 78 | } |
82 | 82 | */ |
83 | 83 | |
84 | 84 | char * TOOLEXPORT |
85 | _FP_strdup (char *string) | |
85 | FP_strdup (char *string) | |
86 | 86 | { |
87 | 87 | char *result; |
88 | 88 | |
103 | 103 | */ |
104 | 104 | |
105 | 105 | char * TOOLEXPORT |
106 | _FP_strncpy (char *dest, char *src, int length) | |
106 | FP_strncpy (char *dest, char *src, int length) | |
107 | 107 | { |
108 | 108 | char *odest=dest; |
109 | 109 | if (src == NULL || dest == NULL || length-- <= 0) |
121 | 121 | */ |
122 | 122 | |
123 | 123 | void * TOOLEXPORT |
124 | _FP_memdup (void *ptr, int len) | |
124 | FP_memdup (const void *ptr, int len) | |
125 | 125 | { |
126 | 126 | void *result; |
127 | 127 | |
141 | 141 | |
142 | 142 | #ifndef FP_stricmp |
143 | 143 | int TOOLEXPORT |
144 | _FP_stricmp (char *str1, char *str2) | |
144 | FP_stricmp (const char *str1, const char *str2) | |
145 | 145 | { |
146 | 146 | if (str1==NULL || str2==NULL) |
147 | 147 | return -1; |
158 | 158 | |
159 | 159 | #ifndef FP_strnicmp |
160 | 160 | int TOOLEXPORT |
161 | _FP_strnicmp (char *str1, char *str2, int count) | |
162 | { | |
163 | if (str1==NULL || str2==NULL) | |
161 | FP_strnicmp (const char *str1, const char *str2, int count) | |
162 | { | |
163 | int d; | |
164 | ||
165 | if (!str1 || !str2) | |
164 | 166 | return -1; |
165 | 167 | |
166 | while (*str1 && count) { | |
167 | if (tolower(*str1) != tolower(*str2)) | |
168 | break; | |
168 | while (count--) { | |
169 | if (!*str1) | |
170 | return -1; | |
171 | ||
172 | d = tolower (*str1) - tolower (*str2); | |
173 | if (d) | |
174 | return d; | |
175 | ||
169 | 176 | str1++; |
170 | 177 | str2++; |
171 | count--; | |
172 | } | |
173 | return count ? (tolower (*str1) - tolower (*str2)) : 0; | |
174 | } | |
175 | #endif | |
176 | ||
177 | char * TOOLEXPORT | |
178 | _FP_strpbrk (char *str, char *accept) | |
178 | } | |
179 | ||
180 | return 0; | |
181 | } | |
182 | #endif | |
183 | ||
184 | int TOOLEXPORT | |
185 | FP_strnicmp_fast (const char *str1, const char *str2, int count) | |
186 | { | |
187 | if (!str1 || !str2) | |
188 | return -1; | |
189 | ||
190 | while (count--) { | |
191 | if (!*str1) | |
192 | return -1; | |
193 | ||
194 | if ((*str1 ^ *str2) & 0xdf) | |
195 | return (*str1 & 0xdf) - (*str2 & 0xdf); | |
196 | ||
197 | str1++; | |
198 | str2++; | |
199 | } | |
200 | ||
201 | return 0; | |
202 | } | |
203 | ||
204 | char * TOOLEXPORT | |
205 | FP_strpbrk (char *str, char *accept) | |
179 | 206 | { |
180 | 207 | char *ptr; |
181 | 208 | |
197 | 224 | */ |
198 | 225 | |
199 | 226 | char * TOOLEXPORT |
200 | _FP_strtok (char *str1, char *str2) | |
227 | FP_strtok (char *str1, char *str2) | |
201 | 228 | { |
202 | 229 | static char *optr; |
203 | 230 | char *ptr; |
235 | 262 | |
236 | 263 | #ifndef FP_stristr |
237 | 264 | char * TOOLEXPORT |
238 | _FP_stristr (char *str1, char *str2) | |
265 | FP_stristr (char *str1, char *str2) | |
239 | 266 | { |
240 | 267 | char *ptr1, *ptr2; |
241 | 268 | |
263 | 290 | */ |
264 | 291 | |
265 | 292 | char * TOOLEXPORT |
266 | _FP_strrstr (char *ptr, char *str) | |
267 | { | |
268 | char *found=NULL, *new, *iter=ptr; | |
293 | FP_strrstr (const char *ptr, const char *str) | |
294 | { | |
295 | const char *found=NULL, *new, *iter=ptr; | |
269 | 296 | |
270 | 297 | if (ptr==NULL || str==NULL) |
271 | 298 | return NULL; |
272 | 299 | |
300 | if (*str == '\0') | |
301 | return (char *)ptr; | |
302 | ||
303 | while ((new = FP_strstr (iter, str)) != NULL) { | |
304 | found = new; | |
305 | iter = new + 1; | |
306 | } | |
307 | ||
308 | return (char *)found; | |
309 | } | |
310 | ||
311 | char * TOOLEXPORT | |
312 | FP_strirstr (char *ptr, char *str) | |
313 | { | |
314 | char *found=NULL, *iter=ptr, *new; | |
315 | ||
316 | if (ptr==NULL || str==NULL) | |
317 | return NULL; | |
273 | 318 | if (*str == '\0') |
274 | 319 | return ptr; |
275 | 320 | |
276 | while ((new = _FP_strstr (iter, str)) != NULL) { | |
321 | while ((new = FP_stristr (iter, str)) != NULL) { | |
277 | 322 | found = new; |
278 | 323 | iter = new + 1; |
279 | 324 | } |
280 | 325 | return found; |
281 | 326 | } |
282 | 327 | |
283 | char * TOOLEXPORT | |
284 | _FP_strirstr (char *ptr, char *str) | |
285 | { | |
286 | char *found=NULL, *iter=ptr, *new; | |
287 | ||
288 | if (ptr==NULL || str==NULL) | |
289 | return NULL; | |
290 | if (*str == '\0') | |
291 | return ptr; | |
292 | ||
293 | while ((new = _FP_stristr (iter, str)) != NULL) { | |
294 | found = new; | |
295 | iter = new + 1; | |
296 | } | |
297 | return found; | |
298 | } | |
299 | ||
300 | 328 | /* |
301 | 329 | * convert whole string to case |
302 | 330 | */ |
303 | 331 | |
304 | 332 | char * TOOLEXPORT |
305 | _FP_stoupper (char *input) | |
333 | FP_stoupper (char *input) | |
306 | 334 | { |
307 | 335 | char *iter = input; |
308 | 336 | |
317 | 345 | } |
318 | 346 | |
319 | 347 | char * TOOLEXPORT |
320 | _FP_stolower (char *input) | |
348 | FP_stolower (char *input) | |
321 | 349 | { |
322 | 350 | char *iter = input; |
323 | 351 | |
336 | 364 | */ |
337 | 365 | |
338 | 366 | int TOOLEXPORT |
339 | _FP_strmatch (char *string, char *pattern) | |
367 | FP_strmatch (char *string, char *pattern) | |
340 | 368 | { |
341 | 369 | char *p1 = string, *p2 = pattern; |
342 | 370 | |
366 | 394 | } |
367 | 395 | |
368 | 396 | char * TOOLEXPORT |
369 | _FP_strrchr (char *string, int tc) | |
370 | { | |
371 | char *ptr; | |
397 | FP_strrchr (const char *string, int tc) | |
398 | { | |
399 | const char *ptr; | |
372 | 400 | |
373 | 401 | if (string == NULL || !*string) |
374 | 402 | return NULL; |
379 | 407 | ptr--; |
380 | 408 | |
381 | 409 | if (*ptr == tc) |
382 | return ptr; | |
410 | return (char *)ptr; | |
383 | 411 | |
384 | 412 | return NULL; |
385 | 413 | } |
390 | 418 | */ |
391 | 419 | |
392 | 420 | char * TOOLEXPORT |
393 | _FP_cutdir (char *filename) | |
421 | FP_cutdir (char *filename) | |
394 | 422 | { |
395 | 423 | char *ptr; |
396 | 424 | |
397 | 425 | if (filename == NULL) |
398 | 426 | return NULL; |
399 | 427 | |
400 | if ((ptr = _FP_strrchr (filename, '/')) != NULL) | |
428 | if ((ptr = FP_strrchr (filename, '/')) != NULL) | |
401 | 429 | ptr++; |
402 | else if ((ptr = _FP_strrchr (filename, '\\')) != NULL) | |
430 | else if ((ptr = FP_strrchr (filename, '\\')) != NULL) | |
403 | 431 | ptr++; |
404 | 432 | else |
405 | 433 | ptr = filename; |
412 | 440 | * properly: LF (Unix), CRLF (DOS) and CR (Mac). |
413 | 441 | */ |
414 | 442 | /* (schmorp) the buffer is always written to, and no LF is stored at the end */ |
415 | char * TOOLEXPORT | |
416 | _FP_fgets (char *buf, int n, FILE *stream) | |
417 | { | |
418 | static char format[64]; | |
419 | static int format_n = 0; | |
420 | char *cp = buf; | |
421 | int res; | |
422 | int c; | |
443 | /* also, if the buffer is too short, the remaining line is skipped */ | |
444 | ecb_hot char * TOOLEXPORT | |
445 | FP_fgets (char *buf, int n, FILE *stream) | |
446 | { | |
447 | char *ptr = buf; | |
448 | char *end = buf + n - 1; | |
423 | 449 | |
424 | 450 | /* shield against buffer overflows caused by "255 - bytes_left"-kind of bugs when bytes_left > 255 */ |
425 | 451 | if (n <= 0) |
426 | return NULL; | |
427 | ||
428 | if (format_n != n) | |
429 | { | |
430 | sprintf (format, "%%%d[^\015\012]", n - 1); | |
431 | format_n = n; | |
432 | } | |
433 | ||
434 | *buf = 0; /* fscanf return s0 on empty lines */ | |
435 | res = fscanf (stream, format, buf); | |
436 | ||
437 | if (res == EOF) | |
438 | return 0; /* an error occured */ | |
439 | ||
440 | /* skip line endings */ | |
452 | return 0; | |
453 | ||
441 | 454 | for (;;) |
442 | 455 | { |
443 | c = _FP_fgetc (stream); | |
444 | ||
445 | if (c == '\012') /* LF */ | |
446 | return buf; | |
447 | else if (c == '\015') /* CR */ | |
456 | int c = FP_getc (stream); | |
457 | ||
458 | if (ecb_expect_false (c <= '\015')) /* EOF is < 0x20, too */ | |
448 | 459 | { |
449 | c = _FP_fgetc (stream); | |
450 | if (c != '\012') /* CR LF? */ | |
451 | ungetc (c, stream); | |
452 | ||
453 | return buf; | |
460 | /* ctlchar */ | |
461 | ||
462 | if (c == '\012') | |
463 | /* LF, nothing following */ | |
464 | break; | |
465 | else if (c == '\015') | |
466 | { | |
467 | /* CR, possibly CRLF, skip following LF */ | |
468 | c = FP_getc (stream); | |
469 | ||
470 | if (c != '\012') /* CR LF? */ | |
471 | ungetc (c, stream); | |
472 | ||
473 | break; | |
474 | } | |
475 | else if (c == EOF) | |
476 | { | |
477 | *ptr = 0; | |
478 | return 0; | |
479 | } | |
454 | 480 | } |
455 | else if (c == EOF) | |
456 | return 0; /* error */ | |
457 | ||
458 | /* skip remaining line */ | |
481 | ||
482 | *ptr = c; | |
483 | ptr += ptr < end; /* this is hopefully branch-free, and fast */ | |
459 | 484 | } |
460 | } | |
461 | ||
462 | /* | |
463 | * A replacement strerror function that just returns the error code | |
464 | */ | |
465 | ||
466 | char * TOOLEXPORT | |
467 | _FP_strerror (int errcode) | |
468 | { | |
469 | static char number[8]; | |
470 | ||
471 | sprintf (number, "%03d", errcode); | |
472 | ||
473 | return number; | |
474 | } | |
475 | #ifndef HAVE_MKSTEMP | |
476 | /* | |
477 | * tempnam is not ANSI, but tmpnam is. Ignore the prefix here. | |
478 | */ | |
479 | ||
480 | char * TOOLEXPORT | |
481 | _FP_tempnam (char *dir, char *pfx) | |
482 | { | |
483 | return _FP_strdup (tmpnam (NULL)); | |
484 | } | |
485 | #endif /* HAVE_MKSTEMP */ | |
485 | ||
486 | *ptr = 0; | |
487 | return buf; | |
488 | } | |
489 |
16 | 16 | #define FPTOOLS_H__ |
17 | 17 | |
18 | 18 | #include <string.h> |
19 | #include <stdint.h> | |
19 | 20 | |
20 | 21 | typedef signed char schar; |
21 | 22 | typedef unsigned char uchar; |
23 | ||
24 | #include "ecb.h" | |
22 | 25 | |
23 | 26 | #ifndef TOOLEXPORT |
24 | 27 | #define TOOLEXPORT |
28 | 31 | extern "C" { |
29 | 32 | #endif |
30 | 33 | |
31 | #define _FP_free FP_free | |
32 | #define _FP_strdup FP_strdup | |
33 | #define _FP_strncpy FP_strncpy | |
34 | #define _FP_memdup FP_memdup | |
35 | #define _FP_stricmp FP_stricmp | |
36 | #define _FP_strnicmp FP_strnicmp | |
37 | #define _FP_strrstr FP_strrstr | |
38 | #define _FP_stoupper FP_stoupper | |
39 | #define _FP_stolower FP_stolower | |
40 | #define _FP_strmatch FP_strmatch | |
41 | #define _FP_strstr FP_strstr | |
42 | #define _FP_stristr FP_stristr | |
43 | #define _FP_strirstr FP_strirstr | |
44 | #define _FP_strrchr FP_strrchr | |
45 | #define _FP_fgets FP_fgets | |
46 | #define _FP_strpbrk FP_strpbrk | |
47 | #define _FP_strtok FP_strtok | |
48 | #define _FP_cutdir FP_cutdir | |
49 | #define _FP_strerror FP_strerror | |
50 | #define _FP_tempnam FP_tempnam | |
51 | #define _FP_fgetc FP_fgetc | |
34 | #if HAVE_GETC_UNLOCKED | |
35 | # define FP_getc(s) getc_unlocked (s) | |
36 | #else | |
37 | # define FP_getc(s) getc (s) | |
38 | #endif | |
52 | 39 | |
53 | #if HAVE_FGETC_UNLOCKED | |
54 | # define FP_fgetc(s) fgetc_unlocked (s) | |
40 | #if HAVE_FEOF_UNLOCKED | |
41 | # define FP_feof(s) feof_unlocked (s) | |
55 | 42 | #else |
56 | # define FP_fgetc(s) fgetc (s) | |
43 | # define FP_feof(s) feof (s) | |
44 | #endif | |
45 | ||
46 | #if HAVE_FERROR_UNLOCKED | |
47 | # define FP_ferror(s) ferror_unlocked (s) | |
48 | #else | |
49 | # define FP_ferror(s) ferror (s) | |
50 | #endif | |
51 | ||
52 | #if HAVE_FLOCKFILE | |
53 | # define FP_flockfile(s) flockfile (s) | |
54 | #else | |
55 | # define FP_flockfile(s) ((void *)0) | |
57 | 56 | #endif |
58 | 57 | |
59 | 58 | #define FP_strstr(a,b) strstr (a, b) |
59 | #define FP_strerror(a) strerror (a) | |
60 | 60 | |
61 | void TOOLEXPORT _FP_free (void *); | |
62 | char * TOOLEXPORT _FP_strdup (char *); | |
63 | char * TOOLEXPORT _FP_strncpy (char *, char *, int); | |
64 | void * TOOLEXPORT _FP_memdup (void *, int); | |
65 | int TOOLEXPORT _FP_stricmp (char *, char *); | |
66 | int TOOLEXPORT _FP_strnicmp (char *, char *, int); | |
67 | char * TOOLEXPORT _FP_strrstr (char *, char *); | |
68 | char * TOOLEXPORT _FP_stoupper (char *); | |
69 | char * TOOLEXPORT _FP_stolower (char *); | |
70 | int TOOLEXPORT _FP_strmatch (char *, char *); | |
71 | char * TOOLEXPORT _FP_stristr (char *, char *); | |
72 | char * TOOLEXPORT _FP_strirstr (char *, char *); | |
73 | char * TOOLEXPORT _FP_strrchr (char *, int); | |
74 | char * TOOLEXPORT _FP_fgets (char *, int, FILE *); | |
75 | char * TOOLEXPORT _FP_strpbrk (char *, char *); | |
76 | char * TOOLEXPORT _FP_strtok (char *, char *); | |
77 | char * TOOLEXPORT _FP_cutdir (char *); | |
78 | char * TOOLEXPORT _FP_strerror (int); | |
79 | #ifndef HAVE_MKSTEMP | |
80 | char * TOOLEXPORT _FP_tempnam (char *, char *); | |
81 | #endif /* HAVE_MKSTEMP */ | |
61 | void TOOLEXPORT FP_free (void *); | |
62 | char * TOOLEXPORT FP_strdup (char *); | |
63 | char * TOOLEXPORT FP_strncpy (char *, char *, int); | |
64 | void * TOOLEXPORT FP_memdup (const void *, int); | |
65 | int TOOLEXPORT FP_stricmp (const char *, const char *); | |
66 | int TOOLEXPORT FP_strnicmp (const char *, const char *, int); | |
67 | char * TOOLEXPORT FP_strrstr (const char *, const char *); | |
68 | char * TOOLEXPORT FP_stoupper (char *); | |
69 | char * TOOLEXPORT FP_stolower (char *); | |
70 | int TOOLEXPORT FP_strmatch (char *, char *); | |
71 | char * TOOLEXPORT FP_stristr (char *, char *); | |
72 | char * TOOLEXPORT FP_strirstr (char *, char *); | |
73 | char * TOOLEXPORT FP_strrchr (const char *, int); | |
74 | char * TOOLEXPORT FP_fgets (char *, int, FILE *); | |
75 | char * TOOLEXPORT FP_strpbrk (char *, char *); | |
76 | char * TOOLEXPORT FP_strtok (char *, char *); | |
77 | char * TOOLEXPORT FP_cutdir (char *); | |
78 | ||
79 | /* like stgricmp, but only works when one of the strings is printable ascii */ | |
80 | /* not containing any of these characters: @`[\]^:_{|}~ */ | |
81 | int TOOLEXPORT FP_strnicmp_fast (const char *, const char *, int); | |
82 | 82 | |
83 | 83 | #if 0 /* API differs too much between systems to make those replacements */ |
84 | 84 | #if HAVE_STRCASECMP |
94 | 94 | #endif |
95 | 95 | #endif |
96 | 96 | |
97 | /* this hashes in the final 0 octet to avoid a branch - might or might not be worth it */ | |
98 | /* this also means that this function distinguishes between NULL and "" */ | |
99 | static uint32_t | |
100 | fnv1a (const char *str) | |
101 | { | |
102 | uint32_t hash = 0x811C9DC5, c; | |
103 | ||
104 | if (str) | |
105 | for (;;) | |
106 | { | |
107 | c = *str++; | |
108 | hash = (hash ^ c) * 16777619; | |
109 | if (!c) | |
110 | break; | |
111 | } | |
112 | ||
113 | return hash; | |
114 | } | |
115 | ||
97 | 116 | #ifdef __cplusplus |
98 | 117 | } |
99 | 118 | #endif |
96 | 96 | |
97 | 97 | /* |
98 | 98 | * Extract a filename from the subject line. We need anything to identify |
99 | * the name of the program for sorting. If a nice filename cannot be found, | |
99 | * the name of the program for sorting. If a nice filename cannot be found, | |
100 | 100 | * the subject line itself is used |
101 | 101 | * ptonum is, if not NULL, a pointer to the part number in the subject line, |
102 | 102 | * so that it won't be used as filename. |
132 | 132 | * a file named "Repost" :-) |
133 | 133 | **/ |
134 | 134 | |
135 | if (_FP_strnicmp (subject, "repost", 6) == 0) | |
135 | if (FP_strnicmp (subject, "repost", 6) == 0) | |
136 | 136 | subject += 6; |
137 | if (_FP_strnicmp (subject, "re:", 3) == 0) | |
137 | if (FP_strnicmp (subject, "re:", 3) == 0) | |
138 | 138 | subject += 3; |
139 | 139 | |
140 | 140 | while (*subject == ' ' || *subject == ':') subject++; |
141 | 141 | |
142 | part = _FP_stristr (subject, "part"); | |
142 | part = FP_stristr (subject, "part"); | |
143 | 143 | if (part == subject) { |
144 | 144 | subject += 4; |
145 | 145 | while (*subject == ' ') subject++; |
161 | 161 | while (isspace (*iter)) |
162 | 162 | iter++; |
163 | 163 | count = length = alflag = 0; |
164 | while (iter[count] && | |
164 | while (iter[count] && | |
165 | 165 | (isalnum (iter[count]) || strchr (fnchars, iter[count])!=NULL)) { |
166 | 166 | if (isalpha (iter[count])) |
167 | 167 | alflag++; |
221 | 221 | while (*ptr && *ptr != 0x0a && *ptr != 0x0d) { |
222 | 222 | iter = ptr; |
223 | 223 | count = length = alflag = 0; |
224 | ||
225 | if (_FP_strnicmp (ptr, "ftp", 3) == 0) { | |
224 | ||
225 | if (FP_strnicmp (ptr, "ftp", 3) == 0) { | |
226 | 226 | /* hey, that's an ftp address */ |
227 | 227 | while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.') |
228 | 228 | ptr++; |
229 | 229 | continue; |
230 | 230 | } |
231 | ||
231 | ||
232 | 232 | while ((isalnum(*iter)||strchr(fnchars, *iter)!=NULL|| |
233 | 233 | *iter=='/') && *iter && iter != ptonum && *iter != '.') { |
234 | 234 | if (isalpha (*iter)) |
235 | 235 | alflag = 1; |
236 | ||
236 | ||
237 | 237 | count++; iter++; |
238 | 238 | } |
239 | 239 | if (*iter == '\0' || iter == ptonum) { |
261 | 261 | continue; |
262 | 262 | } |
263 | 263 | |
264 | if (_FP_strnicmp (iter, "edu", 3) == 0 || | |
265 | _FP_strnicmp (iter, "gov", 3) == 0) { | |
264 | if (FP_strnicmp (iter, "edu", 3) == 0 || | |
265 | FP_strnicmp (iter, "gov", 3) == 0) { | |
266 | 266 | /* hey, that's an ftp address */ |
267 | 267 | while (isalpha (*iter) || isdigit (*iter) || *iter == '.') |
268 | 268 | iter++; |
270 | 270 | length = 0; |
271 | 271 | continue; |
272 | 272 | } |
273 | ||
273 | ||
274 | 274 | length += count + 1; |
275 | 275 | count = 0; |
276 | ||
276 | ||
277 | 277 | while ((isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL|| |
278 | 278 | iter[count]=='/') && iter[count] && iter[count] != '.') |
279 | 279 | count++; |
280 | ||
280 | ||
281 | 281 | if (iter[count]==':' && iter[count+1]=='/') { |
282 | 282 | /* looks like stuff from a mail server */ |
283 | 283 | ptr = iter + 1; |
284 | 284 | length = 0; |
285 | 285 | continue; |
286 | 286 | } |
287 | ||
287 | ||
288 | 288 | if (count > 8 || iter == ptonum) { |
289 | 289 | ptr = iter; |
290 | 290 | length = 0; |
295 | 295 | length += count; |
296 | 296 | break; |
297 | 297 | } |
298 | ||
298 | ||
299 | 299 | while (iter[count] && |
300 | 300 | (isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL|| |
301 | 301 | iter[count]=='/')) |
302 | 302 | count++; |
303 | ||
303 | ||
304 | 304 | if (iter[count]==':' && iter[count+1]=='/') { |
305 | 305 | /* looks like stuff from a mail server */ |
306 | 306 | ptr = iter + 1; |
307 | 307 | length = 0; |
308 | 308 | continue; |
309 | 309 | } |
310 | ||
310 | ||
311 | 311 | if (count < 12 && iter != ptonum) { |
312 | 312 | length += count; |
313 | 313 | break; |
325 | 325 | ptr++; |
326 | 326 | |
327 | 327 | while ((isalnum(ptr[length])||strchr(fnchars,ptr[length])!=NULL|| |
328 | ptr[length] == '/') && | |
328 | ptr[length] == '/') && | |
329 | 329 | ptr[length] && ptr+length!=part && ptr+length!=ptonum) |
330 | 330 | length++; |
331 | 331 | |
362 | 362 | uustring (S_OUT_OF_MEMORY), length+1); |
363 | 363 | return NULL; |
364 | 364 | } |
365 | ||
365 | ||
366 | 366 | memcpy (result, ptr, length); |
367 | 367 | result[length] = '\0'; |
368 | ||
368 | ||
369 | 369 | return uu_FileNameCallback ? uu_FileNameCallback(uu_FNCBArg, subject, result) : result; |
370 | 370 | } |
371 | 371 | |
425 | 425 | } |
426 | 426 | while (isdigit (iter[count])) |
427 | 427 | count++; |
428 | ||
428 | ||
429 | 429 | if (iter[count] == '\0') { |
430 | 430 | iter += count; |
431 | 431 | break; |
443 | 443 | |
444 | 444 | while (iter[count] == ' ' || iter[count] == '#' || |
445 | 445 | iter[count] == '/' || iter[count] == '\\') count++; |
446 | ||
447 | if (_FP_strnicmp (iter + count, "of", 2) == 0) | |
446 | ||
447 | if (FP_strnicmp (iter + count, "of", 2) == 0) | |
448 | 448 | count += 2; |
449 | ||
449 | ||
450 | 450 | while (iter[count] == ' ') count++; |
451 | 451 | while (isdigit (iter[count])) count++; |
452 | 452 | while (iter[count] == ' ') count++; |
453 | ||
453 | ||
454 | 454 | if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { |
455 | 455 | *where = iter; |
456 | 456 | bdel[0] = brackchr[uu_bracket_policy][bpc+1]; |
471 | 471 | */ |
472 | 472 | |
473 | 473 | if (length == 0) { |
474 | if ((iter = _FP_stristr (subject, "part ")) != NULL) { | |
474 | if ((iter = FP_stristr (subject, "part ")) != NULL) { | |
475 | 475 | iter += 5; |
476 | 476 | |
477 | 477 | while (isspace (*iter) || *iter == '.' || *iter == '-') |
481 | 481 | length++; |
482 | 482 | |
483 | 483 | if (length == 0) { |
484 | if (_FP_strnicmp (iter, "one", 3) == 0) length = 1; | |
485 | else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2; | |
486 | else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3; | |
487 | else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4; | |
488 | else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5; | |
489 | else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6; | |
490 | else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7; | |
491 | else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8; | |
492 | else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9; | |
493 | else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10; | |
484 | if (FP_strnicmp (iter, "one", 3) == 0) length = 1; | |
485 | else if (FP_strnicmp (iter, "two", 3) == 0) length = 2; | |
486 | else if (FP_strnicmp (iter, "three", 5) == 0) length = 3; | |
487 | else if (FP_strnicmp (iter, "four", 4) == 0) length = 4; | |
488 | else if (FP_strnicmp (iter, "five", 4) == 0) length = 5; | |
489 | else if (FP_strnicmp (iter, "six", 3) == 0) length = 6; | |
490 | else if (FP_strnicmp (iter, "seven", 5) == 0) length = 7; | |
491 | else if (FP_strnicmp (iter, "eight", 5) == 0) length = 8; | |
492 | else if (FP_strnicmp (iter, "nine", 4) == 0) length = 9; | |
493 | else if (FP_strnicmp (iter, "ten", 3) == 0) length = 10; | |
494 | 494 | |
495 | 495 | if (length && (*whend = strchr (iter, ' '))) { |
496 | 496 | *where = iter; |
511 | 511 | */ |
512 | 512 | |
513 | 513 | if (length == 0) { |
514 | if ((iter = _FP_stristr (subject, "part")) != NULL) { | |
514 | if ((iter = FP_stristr (subject, "part")) != NULL) { | |
515 | 515 | iter += 4; |
516 | 516 | |
517 | 517 | while (isspace (*iter) || *iter == '.' || *iter == '-') |
521 | 521 | length++; |
522 | 522 | |
523 | 523 | if (length == 0) { |
524 | if (_FP_strnicmp (iter, "one", 3) == 0) length = 1; | |
525 | else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2; | |
526 | else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3; | |
527 | else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4; | |
528 | else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5; | |
529 | else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6; | |
530 | else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7; | |
531 | else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8; | |
532 | else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9; | |
533 | else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10; | |
524 | if (FP_strnicmp (iter, "one", 3) == 0) length = 1; | |
525 | else if (FP_strnicmp (iter, "two", 3) == 0) length = 2; | |
526 | else if (FP_strnicmp (iter, "three", 5) == 0) length = 3; | |
527 | else if (FP_strnicmp (iter, "four", 4) == 0) length = 4; | |
528 | else if (FP_strnicmp (iter, "five", 4) == 0) length = 5; | |
529 | else if (FP_strnicmp (iter, "six", 3) == 0) length = 6; | |
530 | else if (FP_strnicmp (iter, "seven", 5) == 0) length = 7; | |
531 | else if (FP_strnicmp (iter, "eight", 5) == 0) length = 8; | |
532 | else if (FP_strnicmp (iter, "nine", 4) == 0) length = 9; | |
533 | else if (FP_strnicmp (iter, "ten", 3) == 0) length = 10; | |
534 | 534 | |
535 | 535 | if (length && (*whend = strchr (iter, ' '))) { |
536 | 536 | *where = iter; |
551 | 551 | */ |
552 | 552 | |
553 | 553 | if (length == 0) { |
554 | if ((iter = _FP_strirstr (subject, "of")) != NULL) { | |
554 | if ((iter = FP_strirstr (subject, "of")) != NULL) { | |
555 | 555 | while (iter>subject && isspace (*(iter-1))) |
556 | 556 | iter--; |
557 | 557 | if (isdigit(*(iter-1))) { |
609 | 609 | if (length == 0) { |
610 | 610 | count = strlen(subject) - 1; |
611 | 611 | ptr = subject; |
612 | ||
612 | ||
613 | 613 | while (count > 0) { |
614 | 614 | if (!isdigit(ptr[count])||isalpha(ptr[count+1])||ptr[count+1] == '.') { |
615 | 615 | count--; |
620 | 620 | while (count >= 0 && isdigit (ptr[count])) { |
621 | 621 | count--; length++; |
622 | 622 | } |
623 | if (count>=0 && ((isalpha (ptr[count]) && | |
623 | if (count>=0 && ((isalpha (ptr[count]) && | |
624 | 624 | (ptr[count] != 's' || ptr[count+1] != 't') && |
625 | (ptr[count] != 'n' || ptr[count+1] != 'd')) || | |
626 | ptr[count] == '/' || ptr[count] == '.' || | |
625 | (ptr[count] != 'n' || ptr[count+1] != 'd')) || | |
626 | ptr[count] == '/' || ptr[count] == '.' || | |
627 | 627 | ptr[count] == '-' || ptr[count] == '_')) { |
628 | 628 | length = 0; |
629 | 629 | continue; |
650 | 650 | /* |
651 | 651 | * some people use the strangest things, including spelling mistakes :-) |
652 | 652 | */ |
653 | if ((iter = _FP_stristr (subject, "first")) != NULL) length = 1; | |
654 | else if ((iter = _FP_stristr (subject, "second")) != NULL) length = 2; | |
655 | else if ((iter = _FP_stristr (subject, "third")) != NULL) length = 3; | |
656 | else if ((iter = _FP_stristr (subject, "forth")) != NULL) length = 4; | |
657 | else if ((iter = _FP_stristr (subject, "fourth")) != NULL) length = 4; | |
658 | else if ((iter = _FP_stristr (subject, "fifth")) != NULL) length = 5; | |
659 | else if ((iter = _FP_stristr (subject, "sixth")) != NULL) length = 6; | |
660 | else if ((iter = _FP_stristr (subject, "seventh")) != NULL) length = 7; | |
661 | else if ((iter = _FP_stristr (subject, "eigth")) != NULL) length = 8; | |
662 | else if ((iter = _FP_stristr (subject, "eighth")) != NULL) length = 8; | |
663 | else if ((iter = _FP_stristr (subject, "nineth")) != NULL) length = 9; | |
664 | else if ((iter = _FP_stristr (subject, "ninth")) != NULL) length = 9; | |
665 | else if ((iter = _FP_stristr (subject, "tenth")) != NULL) length = 10; | |
653 | if ((iter = FP_stristr (subject, "first")) != NULL) length = 1; | |
654 | else if ((iter = FP_stristr (subject, "second")) != NULL) length = 2; | |
655 | else if ((iter = FP_stristr (subject, "third")) != NULL) length = 3; | |
656 | else if ((iter = FP_stristr (subject, "forth")) != NULL) length = 4; | |
657 | else if ((iter = FP_stristr (subject, "fourth")) != NULL) length = 4; | |
658 | else if ((iter = FP_stristr (subject, "fifth")) != NULL) length = 5; | |
659 | else if ((iter = FP_stristr (subject, "sixth")) != NULL) length = 6; | |
660 | else if ((iter = FP_stristr (subject, "seventh")) != NULL) length = 7; | |
661 | else if ((iter = FP_stristr (subject, "eigth")) != NULL) length = 8; | |
662 | else if ((iter = FP_stristr (subject, "eighth")) != NULL) length = 8; | |
663 | else if ((iter = FP_stristr (subject, "nineth")) != NULL) length = 9; | |
664 | else if ((iter = FP_stristr (subject, "ninth")) != NULL) length = 9; | |
665 | else if ((iter = FP_stristr (subject, "tenth")) != NULL) length = 10; | |
666 | 666 | else iter = NULL; |
667 | 667 | |
668 | 668 | if (length && iter && (*whend = strchr (iter, ' '))) { |
679 | 679 | *where = iter; |
680 | 680 | |
681 | 681 | if (delim && delim[0]) { |
682 | if ((*whend=_FP_stristr (iter, delim)) != NULL && (*whend - *where) < 12) { | |
682 | if ((*whend=FP_stristr (iter, delim)) != NULL && (*whend - *where) < 12) { | |
683 | 683 | ptr = (*whend += strlen (delim)); |
684 | 684 | |
685 | 685 | while (*ptr == ' ') |
735 | 735 | } |
736 | 736 | |
737 | 737 | if (data->filename != NULL) { |
738 | if ((result->filename = _FP_strdup (data->filename)) == NULL) { | |
738 | if ((result->filename = FP_strdup (data->filename)) == NULL) { | |
739 | 739 | UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, |
740 | 740 | uustring (S_OUT_OF_MEMORY), |
741 | 741 | strlen (data->filename)+1); |
753 | 753 | result->subfname = NULL; |
754 | 754 | |
755 | 755 | result->yefilesize = data->yefilesize; |
756 | result->mimeid = _FP_strdup (data->mimeid); | |
757 | result->mimetype = _FP_strdup (data->mimetype); | |
758 | ||
759 | if (result->partno == -1 && | |
756 | result->mimeid = FP_strdup (data->mimeid); | |
757 | result->mimetype = FP_strdup (data->mimetype); | |
758 | ||
759 | if (result->partno == -1 && | |
760 | 760 | (data->uudet == PT_ENCODED || data->uudet == QP_ENCODED)) |
761 | 761 | result->partno = 1; |
762 | 762 | |
766 | 766 | */ |
767 | 767 | if (result->filename == NULL) { |
768 | 768 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
769 | result->filename = _FP_strdup (temp); | |
769 | result->filename = FP_strdup (temp); | |
770 | 770 | } |
771 | 771 | if (result->subfname == NULL) |
772 | result->subfname = _FP_strdup (result->filename); | |
773 | ||
774 | if (result->filename == NULL || | |
772 | result->subfname = FP_strdup (result->filename); | |
773 | ||
774 | if (result->filename == NULL || | |
775 | 775 | result->subfname == NULL) { |
776 | 776 | UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, |
777 | 777 | uustring (S_OUT_OF_MEMORY), |
785 | 785 | result->partno = 1; |
786 | 786 | } |
787 | 787 | else if (result->subfname == NULL && data->uudet && |
788 | (data->begin || result->partno == 1 || | |
789 | (!uu_dumbness && result->partno == -1 && | |
788 | (data->begin || result->partno == 1 || | |
789 | (!uu_dumbness && result->partno == -1 && | |
790 | 790 | (data->subject != NULL || result->filename != NULL)))) { |
791 | 791 | /* |
792 | 792 | * If it's the first part of something and has some valid data, but |
796 | 796 | * in this case, it really _should_ have a filename somewhere |
797 | 797 | */ |
798 | 798 | if (result->filename != NULL && *result->filename) |
799 | result->subfname = _FP_strdup (result->filename); | |
799 | result->subfname = FP_strdup (result->filename); | |
800 | 800 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
801 | 801 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
802 | result->subfname = _FP_strdup (temp); | |
802 | result->subfname = FP_strdup (temp); | |
803 | 803 | } |
804 | 804 | /* |
805 | 805 | * in case the strdup failed |
824 | 824 | lastvalid = 1; |
825 | 825 | lastenc = data->uudet; |
826 | 826 | lastpart = result->partno = 1; |
827 | _FP_strncpy (uucheck_lastname, result->subfname, 256); | |
827 | FP_strncpy (uucheck_lastname, result->subfname, 256); | |
828 | 828 | } |
829 | 829 | else |
830 | 830 | result->partno = 1; |
836 | 836 | * under the same id. |
837 | 837 | */ |
838 | 838 | if (result->filename) |
839 | result->subfname = _FP_strdup (result->filename); | |
839 | result->subfname = FP_strdup (result->filename); | |
840 | 840 | else |
841 | result->subfname = _FP_strdup (result->mimeid); | |
841 | result->subfname = FP_strdup (result->mimeid); | |
842 | 842 | } |
843 | 843 | else if (result->subfname == NULL && data->uudet) { |
844 | 844 | /* |
850 | 850 | * Assume it's the first part. I wonder why it's got no part number? |
851 | 851 | */ |
852 | 852 | if (result->filename != NULL && *result->filename) |
853 | result->subfname = _FP_strdup (result->filename); | |
853 | result->subfname = FP_strdup (result->filename); | |
854 | 854 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
855 | 855 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
856 | result->subfname = _FP_strdup (temp); | |
856 | result->subfname = FP_strdup (temp); | |
857 | 857 | } |
858 | 858 | if (result->subfname == NULL) { |
859 | 859 | UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, |
867 | 867 | lastvalid = 0; |
868 | 868 | } |
869 | 869 | else if (lastvalid && data->uudet == lastenc && result->partno == -1) { |
870 | result->subfname = _FP_strdup (uucheck_lastname); | |
870 | result->subfname = FP_strdup (uucheck_lastname); | |
871 | 871 | result->partno = ++lastpart; |
872 | 872 | |
873 | 873 | /* |
877 | 877 | lastvalid = 0; |
878 | 878 | } |
879 | 879 | else if (data->partno != -1 && result->filename) { |
880 | result->subfname = _FP_strdup (result->filename); | |
881 | } | |
882 | else { | |
883 | /* | |
880 | result->subfname = FP_strdup (result->filename); | |
881 | } | |
882 | else { | |
883 | /* | |
884 | 884 | * it's got no info, it's got no begin, and we don't know anything |
885 | 885 | * about this part. Let's forget all about it. |
886 | 886 | */ |
916 | 916 | |
917 | 917 | if (result->partno == -1 && data->begin) { |
918 | 918 | /* |
919 | * hmm, this is reason enough to initialize lastvalid, at least | |
919 | * hmm, this is reason enough to initialize lastvalid, at least | |
920 | 920 | * if we have no end |
921 | 921 | */ |
922 | 922 | if (!data->end) { |
923 | _FP_strncpy (uucheck_lastname, result->subfname, 256); | |
923 | FP_strncpy (uucheck_lastname, result->subfname, 256); | |
924 | 924 | result->partno = lastpart = 1; |
925 | 925 | lastenc = data->uudet; |
926 | 926 | lastvalid = 1; |
929 | 929 | result->partno = 1; |
930 | 930 | } |
931 | 931 | else if (result->partno == -1 && data->uudet) { |
932 | if (lastvalid && _FP_stricmp (uucheck_lastname, result->subfname) == 0) { | |
932 | if (lastvalid && FP_stricmp (uucheck_lastname, result->subfname) == 0) { | |
933 | 933 | /* |
934 | 934 | * if the subject filename is the same as last time, use part no |
935 | 935 | * of lastvalid. If at end, invalidate lastvalid |
969 | 969 | skipcheck: |
970 | 970 | |
971 | 971 | if (result->filename) { |
972 | if (*(ptr = _FP_cutdir (result->filename))) { | |
973 | p2 = _FP_strdup (ptr); | |
974 | _FP_free (result->filename); | |
972 | if (*(ptr = FP_cutdir (result->filename))) { | |
973 | p2 = FP_strdup (ptr); | |
974 | FP_free (result->filename); | |
975 | 975 | result->filename = p2; |
976 | 976 | } |
977 | 977 | } |
988 | 988 | * Insert one part of a file into the global list |
989 | 989 | **/ |
990 | 990 | |
991 | int | |
991 | ecb_hot int | |
992 | 992 | UUInsertPartToList (uufile *data) |
993 | 993 | { |
994 | 994 | uulist *iter = UUGlobalFileList, *unew; |
995 | 995 | uufile *fiter, *last; |
996 | 996 | |
997 | uint32_t mimeid_hash = fnv1a (data->mimeid); | |
998 | uint32_t filename_hash = fnv1a (data->filename); | |
999 | ||
1000 | /* cache locally so the compiler has it easier to reason */ | |
1001 | fileread *data_data = data->data; | |
1002 | ||
997 | 1003 | /* |
998 | * Part belongs together, if | |
999 | * (1) The MIME-IDs match, or | |
1000 | * (2) The file name received from the subject lines match, and | |
1004 | * Part belongs together, if either | |
1005 | * (1) The file name received from the subject lines match, and | |
1001 | 1006 | * (a) Not both parts have a begin line |
1002 | 1007 | * (b) Not both parts have an end line |
1003 | 1008 | * (c) Both parts don't have different MIME-IDs |
1004 | 1009 | * (d) Both parts don't encode different files |
1005 | 1010 | * (e) The other part wants to stay alone (FL_SINGLE) |
1006 | 1011 | * (g) The yencode file size matches. |
1012 | * (2) The MIME-IDs match | |
1007 | 1013 | */ |
1014 | ||
1015 | /* TODO: use two hash tables, keyed on filename and mimeid */ | |
1016 | /* unfortunately, its not so easy, as lots of code inserts in interesting ways, */ | |
1017 | /* so I tried to conventionally speed up the search by replacing strcmp with */ | |
1018 | /* hash comparisons, reordering and prefetching struct members and so on */ | |
1008 | 1019 | |
1009 | 1020 | /* |
1010 | 1021 | * check if this part wants to be left alone. If so, don't bother |
1011 | 1022 | * to do all the checks |
1012 | 1023 | */ |
1024 | if (data_data->flags & FL_SINGLE) | |
1025 | goto newpart; | |
1013 | 1026 | |
1014 | 1027 | while (iter) { |
1015 | if (data->data->flags & FL_SINGLE) { | |
1016 | /* this space intentionally left blank */ | |
1017 | } | |
1018 | else if ((data->mimeid && iter->mimeid && strcmp (data->mimeid, iter->mimeid) == 0) | |
1019 | || | |
1020 | ( | |
1021 | 1 | |
1022 | && !(iter->thisfile && iter->thisfile->yefilesize != data->yefilesize) | |
1023 | && !(iter->begin && data->data->begin) | |
1024 | && !(iter->end && data->data->end) | |
1025 | && !(iter->flags & FL_SINGLE) | |
1026 | && !(data->filename && iter->filename && strcmp (data->filename, iter->filename) != 0) | |
1027 | && _FP_stricmp (data->subfname, iter->subfname) == 0 | |
1028 | && !(data->mimeid && iter->mimeid && strcmp (data->mimeid, iter->mimeid) != 0) | |
1029 | ) | |
1030 | ) { | |
1028 | ecb_prefetch (iter->NEXT, 0, 1); | |
1029 | if ( | |
1030 | ( | |
1031 | 1 | |
1032 | && filename_hash == iter->filename_hash | |
1033 | && (data->filename && iter->filename && strcmp (data->filename, iter->filename) == 0) | |
1034 | && !(iter->begin && data_data->begin) | |
1035 | && !(iter->end && data_data->end) | |
1036 | && !(iter->flags & FL_SINGLE) | |
1037 | && !(iter->thisfile && iter->thisfile->yefilesize != data->yefilesize) | |
1038 | && FP_stricmp (data->subfname, iter->subfname) == 0 | |
1039 | && mimeid_hash == iter->mimeid_hash | |
1040 | && !(data->mimeid && iter->mimeid && strcmp (data->mimeid, iter->mimeid) != 0) | |
1041 | ) | |
1042 | || (mimeid_hash == iter->mimeid_hash && data->mimeid && iter->mimeid && strcmp (data->mimeid, iter->mimeid) == 0) | |
1043 | ) { | |
1031 | 1044 | |
1032 | 1045 | /* |
1033 | 1046 | * Don't insert a part that is already there. |
1047 | 1060 | } |
1048 | 1061 | |
1049 | 1062 | if (iter->filename == NULL && data->filename != NULL) { |
1050 | if ((iter->filename = _FP_strdup (data->filename)) == NULL) | |
1063 | if ((iter->filename = FP_strdup (data->filename)) == NULL) | |
1051 | 1064 | return UURET_NOMEM; |
1052 | 1065 | } |
1053 | 1066 | |
1056 | 1069 | * file was really XX |
1057 | 1070 | */ |
1058 | 1071 | |
1059 | if (data->data->uudet == B64ENCODED && | |
1072 | if (data_data->uudet == B64ENCODED && | |
1060 | 1073 | iter->uudet == XX_ENCODED && iter->begin) { |
1061 | data->data->uudet = XX_ENCODED; | |
1062 | } | |
1063 | else if (data->data->uudet == XX_ENCODED && data->data->begin && | |
1074 | data_data->uudet = XX_ENCODED; | |
1075 | } | |
1076 | else if (data_data->uudet == XX_ENCODED && data_data->begin && | |
1064 | 1077 | iter->uudet == B64ENCODED) { |
1065 | 1078 | iter->uudet = XX_ENCODED; |
1066 | 1079 | |
1075 | 1088 | * If this is from a Message/Partial, we believe only the |
1076 | 1089 | * iter->uudet from the first part |
1077 | 1090 | */ |
1078 | if (data->data->flags & FL_PARTIAL) { | |
1091 | if (data_data->flags & FL_PARTIAL) { | |
1079 | 1092 | if (data->partno == 1) { |
1080 | iter->uudet = data->data->uudet; | |
1081 | iter->flags = data->data->flags; | |
1093 | iter->uudet = data_data->uudet; | |
1094 | iter->flags = data_data->flags; | |
1082 | 1095 | } |
1083 | 1096 | } |
1084 | 1097 | else { |
1085 | if (data->data->uudet) iter->uudet = data->data->uudet; | |
1086 | if (data->data->flags) iter->flags = data->data->flags; | |
1087 | } | |
1088 | ||
1089 | if (iter->mode == 0 && data->data->mode != 0) | |
1090 | iter->mode = data->data->mode; | |
1091 | if (data->data->begin) iter->begin = (data->partno)?data->partno:1; | |
1092 | if (data->data->end) iter->end = (data->partno)?data->partno:1; | |
1098 | if (data_data->uudet) iter->uudet = data_data->uudet; | |
1099 | if (data_data->flags) iter->flags = data_data->flags; | |
1100 | } | |
1101 | ||
1102 | if (iter->mode == 0 && data_data->mode != 0) | |
1103 | iter->mode = data_data->mode; | |
1104 | ||
1105 | if (data_data->begin) iter->begin = data->partno ? data->partno : 1; | |
1106 | if (data_data->end) iter->end = data->partno ? data->partno : 1; | |
1093 | 1107 | |
1094 | 1108 | if (data->mimetype) { |
1095 | _FP_free (iter->mimetype); | |
1096 | iter->mimetype = _FP_strdup (data->mimetype); | |
1109 | FP_free (iter->mimetype); | |
1110 | iter->mimetype = FP_strdup (data->mimetype); | |
1097 | 1111 | } |
1098 | 1112 | |
1099 | 1113 | /* |
1122 | 1136 | if (data->partno == fiter->partno) { |
1123 | 1137 | if (fiter->data->subject == NULL) |
1124 | 1138 | return UURET_NODATA; |
1125 | else if (_FP_stristr (fiter->data->subject, "repost") != NULL && | |
1126 | _FP_stristr (data->data->subject, "repost") == NULL) | |
1139 | else if (FP_stristr (fiter->data->subject, "repost") != NULL && | |
1140 | FP_stristr (data_data->subject, "repost") == NULL) | |
1127 | 1141 | return UURET_NODATA; |
1128 | else if (fiter->data->uudet && !data->data->uudet) | |
1142 | else if (fiter->data->uudet && !data_data->uudet) | |
1129 | 1143 | return UURET_NODATA; |
1130 | 1144 | else { |
1131 | 1145 | /* |
1148 | 1162 | * if at the end of the part list, add it |
1149 | 1163 | */ |
1150 | 1164 | |
1151 | if (fiter->NEXT == NULL || | |
1165 | if (fiter->NEXT == NULL || | |
1152 | 1166 | (data->partno != -1 && data->partno < fiter->NEXT->partno)) { |
1153 | 1167 | data->NEXT = fiter->NEXT; |
1154 | 1168 | fiter->NEXT = data; |
1158 | 1172 | |
1159 | 1173 | return UURET_OK; |
1160 | 1174 | } |
1175 | ||
1161 | 1176 | last = fiter; |
1162 | 1177 | fiter = fiter->NEXT; |
1163 | 1178 | } |
1164 | ||
1179 | ||
1165 | 1180 | return UURET_OK; /* Shouldn't get here */ |
1166 | 1181 | } |
1182 | ||
1167 | 1183 | goahead: |
1168 | /* | |
1169 | * we need iter below | |
1170 | */ | |
1171 | if (iter->NEXT == NULL) | |
1184 | iter = iter->NEXT; | |
1185 | ||
1186 | if (!iter) | |
1172 | 1187 | break; |
1173 | ||
1174 | iter = iter->NEXT; | |
1175 | } | |
1188 | } | |
1189 | ||
1190 | newpart: | |
1176 | 1191 | /* |
1177 | 1192 | * handle new entry |
1178 | 1193 | */ |
1184 | 1199 | * had a 'begin', it'd have got a part number assigned by |
1185 | 1200 | * UUPreProcessPart(). |
1186 | 1201 | */ |
1187 | if (data->data->uudet == B64ENCODED || data->data->uudet == BH_ENCODED) | |
1202 | if (data_data->uudet == B64ENCODED || data_data->uudet == BH_ENCODED) | |
1188 | 1203 | data->partno = 1; |
1189 | 1204 | else |
1190 | 1205 | return UURET_NODATA; |
1191 | 1206 | } |
1192 | 1207 | |
1193 | if ((unew = (uulist *) malloc (sizeof (uulist))) == NULL) { | |
1208 | if ((unew = (uulist *)malloc (sizeof (uulist))) == NULL) { | |
1194 | 1209 | return UURET_NOMEM; |
1195 | 1210 | } |
1196 | 1211 | |
1197 | 1212 | { |
1198 | static uulist uulist_new; | |
1213 | const uulist uulist_new = { 0 }; | |
1199 | 1214 | *unew = uulist_new; /* zero-initialise the structure */ |
1200 | 1215 | } |
1201 | 1216 | |
1202 | if ((unew->subfname = _FP_strdup (data->subfname)) == NULL) { | |
1203 | _FP_free (unew); | |
1217 | if ((unew->subfname = FP_strdup (data->subfname)) == NULL) { | |
1218 | FP_free (unew); | |
1204 | 1219 | return UURET_NOMEM; |
1205 | 1220 | } |
1206 | 1221 | |
1222 | unew->filename_hash = filename_hash; | |
1207 | 1223 | if (data->filename != NULL) { |
1208 | if ((unew->filename = _FP_strdup (data->filename)) == NULL) { | |
1209 | _FP_free (unew->subfname); | |
1210 | _FP_free (unew); | |
1224 | if ((unew->filename = FP_strdup (data->filename)) == NULL) { | |
1225 | FP_free (unew->subfname); | |
1226 | FP_free (unew); | |
1211 | 1227 | return UURET_NOMEM; |
1212 | 1228 | } |
1213 | 1229 | } |
1214 | 1230 | else |
1215 | 1231 | unew->filename = NULL; |
1216 | 1232 | |
1233 | unew->mimeid_hash = mimeid_hash; | |
1217 | 1234 | if (data->mimeid != NULL) { |
1218 | if ((unew->mimeid = _FP_strdup (data->mimeid)) == NULL) { | |
1219 | _FP_free (unew->subfname); | |
1220 | _FP_free (unew->filename); | |
1221 | _FP_free (unew); | |
1235 | if ((unew->mimeid = FP_strdup (data->mimeid)) == NULL) { | |
1236 | FP_free (unew->subfname); | |
1237 | FP_free (unew->filename); | |
1238 | FP_free (unew); | |
1222 | 1239 | return UURET_NOMEM; |
1223 | 1240 | } |
1224 | 1241 | } |
1226 | 1243 | unew->mimeid = NULL; |
1227 | 1244 | |
1228 | 1245 | if (data->mimetype != NULL) { |
1229 | if ((unew->mimetype = _FP_strdup (data->mimetype)) == NULL) { | |
1230 | _FP_free (unew->mimeid); | |
1231 | _FP_free (unew->subfname); | |
1232 | _FP_free (unew->filename); | |
1233 | _FP_free (unew); | |
1246 | if ((unew->mimetype = FP_strdup (data->mimetype)) == NULL) { | |
1247 | FP_free (unew->mimeid); | |
1248 | FP_free (unew->subfname); | |
1249 | FP_free (unew->filename); | |
1250 | FP_free (unew); | |
1234 | 1251 | return UURET_NOMEM; |
1235 | 1252 | } |
1236 | 1253 | } |
1239 | 1256 | |
1240 | 1257 | unew->state = UUFILE_READ; |
1241 | 1258 | unew->thisfile = data; |
1242 | unew->mode = data->data->mode; | |
1243 | unew->uudet = data->data->uudet; | |
1244 | unew->flags = data->data->flags; | |
1245 | unew->begin = data->data->begin ? (data->partno ? data->partno : 1) : 0; | |
1246 | unew->end = data->data->end ? (data->partno ? data->partno : 1) : 0; | |
1247 | ||
1248 | if (iter == NULL) | |
1249 | UUGlobalFileList = unew; | |
1250 | else | |
1251 | iter->NEXT = unew; | |
1259 | unew->mode = data_data->mode; | |
1260 | unew->uudet = data_data->uudet; | |
1261 | unew->flags = data_data->flags; | |
1262 | unew->begin = data_data->begin ? (data->partno ? data->partno : 1) : 0; | |
1263 | unew->end = data_data->end ? (data->partno ? data->partno : 1) : 0; | |
1264 | ||
1265 | /* insert at the beginning, as parts often show up in bursts */ | |
1266 | unew->NEXT = UUGlobalFileList; | |
1267 | UUGlobalFileList = unew; | |
1252 | 1268 | |
1253 | 1269 | return UURET_OK; |
1254 | 1270 | } |
1276 | 1292 | continue; |
1277 | 1293 | } |
1278 | 1294 | else if ((liter->uudet == QP_ENCODED || |
1279 | liter->uudet == PT_ENCODED) && | |
1295 | liter->uudet == PT_ENCODED) && | |
1280 | 1296 | (liter->flags & FL_SINGLE)) { |
1281 | 1297 | if ((liter->flags&FL_PROPER)==0) |
1282 | 1298 | liter->size = -1; |
1347 | 1363 | |
1348 | 1364 | if (fiter->data->begin) flag |= 1; |
1349 | 1365 | if (fiter->data->end) flag |= 2; |
1350 | if (fiter->data->uudet) flag |= 4; | |
1366 | if (fiter->data->uudet) flag |= 4; | |
1351 | 1367 | |
1352 | 1368 | /* |
1353 | 1369 | * guess size of part |
1368 | 1384 | thesize += fiter->data->length; |
1369 | 1385 | break; |
1370 | 1386 | } |
1371 | ||
1387 | ||
1372 | 1388 | fiter = fiter->NEXT; |
1373 | 1389 | |
1374 | 1390 | while (fiter != NULL) { |
1376 | 1392 | misparts[miscount++] = count; |
1377 | 1393 | |
1378 | 1394 | part = fiter->partno; |
1379 | ||
1395 | ||
1380 | 1396 | if (havecount < MAXPLIST) |
1381 | 1397 | haveparts[havecount++] = part; |
1382 | 1398 | |
1402 | 1418 | |
1403 | 1419 | if (fiter->data->end) |
1404 | 1420 | break; |
1405 | ||
1421 | ||
1406 | 1422 | fiter = fiter->NEXT; |
1407 | 1423 | } |
1408 | 1424 | |
1411 | 1427 | * encoded, there's a begin line and encoded data, assume it's |
1412 | 1428 | * there. |
1413 | 1429 | */ |
1414 | ||
1430 | ||
1415 | 1431 | if (uu_fast_scanning && (flag & 0x01) && (flag & 0x04) && |
1416 | 1432 | (liter->uudet == UU_ENCODED || liter->uudet == XX_ENCODED)) |
1417 | 1433 | flag |= 2; |
1420 | 1436 | * Set the parts we have and/or missing |
1421 | 1437 | */ |
1422 | 1438 | |
1423 | _FP_free (liter->haveparts); | |
1424 | _FP_free (liter->misparts); | |
1439 | FP_free (liter->haveparts); | |
1440 | FP_free (liter->misparts); | |
1425 | 1441 | |
1426 | 1442 | liter->haveparts = NULL; |
1427 | 1443 | liter->misparts = NULL; |
1428 | ||
1444 | ||
1429 | 1445 | if (havecount) { |
1430 | 1446 | if ((liter->haveparts=(int*)malloc((havecount+1)*sizeof(int)))!=NULL) { |
1431 | 1447 | memcpy (liter->haveparts, haveparts, havecount*sizeof(int)); |
1432 | 1448 | liter->haveparts[havecount] = 0; |
1433 | 1449 | } |
1434 | 1450 | } |
1435 | ||
1451 | ||
1436 | 1452 | if (miscount) { |
1437 | 1453 | if ((liter->misparts=(int*)malloc((miscount+1)*sizeof(int)))!=NULL) { |
1438 | 1454 | memcpy (liter->misparts, misparts, miscount*sizeof(int)); |
1448 | 1464 | if ((flag & 1) == 0) liter->state |= UUFILE_NOBEGIN; |
1449 | 1465 | if ((flag & 2) == 0) liter->state |= UUFILE_NOEND; |
1450 | 1466 | if ((flag & 4) == 0) liter->state |= UUFILE_NODATA; |
1451 | ||
1467 | ||
1452 | 1468 | if ((flag & 7) == 7 && miscount==0) { |
1453 | 1469 | liter->state = UUFILE_OK; |
1454 | 1470 | } |
1458 | 1474 | else |
1459 | 1475 | liter->size = thesize; |
1460 | 1476 | |
1461 | if (liter->state==UUFILE_OK && | |
1477 | if (liter->state==UUFILE_OK && | |
1462 | 1478 | (liter->filename==NULL || liter->filename[0]=='\0')) { |
1463 | 1479 | /* |
1464 | 1480 | * Emergency backup if the file does not have a filename |
1465 | 1481 | */ |
1466 | _FP_free (liter->filename); | |
1482 | FP_free (liter->filename); | |
1467 | 1483 | if (liter->subfname && liter->subfname[0] && |
1468 | _FP_strpbrk (liter->subfname, "()[];: ") == NULL) | |
1469 | liter->filename = _FP_strdup (liter->subfname); | |
1484 | FP_strpbrk (liter->subfname, "()[];: ") == NULL) | |
1485 | liter->filename = FP_strdup (liter->subfname); | |
1470 | 1486 | else { |
1471 | 1487 | sprintf (uucheck_tempname, "%s.%03d", nofname, ++nofnum); |
1472 | liter->filename = _FP_strdup (uucheck_tempname); | |
1488 | liter->filename = FP_strdup (uucheck_tempname); | |
1473 | 1489 | } |
1474 | 1490 | } |
1475 | 1491 | liter = liter->NEXT; |
15 | 15 | |
16 | 16 | #ifndef __UUDEVIEW_H__ |
17 | 17 | #define __UUDEVIEW_H__ |
18 | ||
19 | #include <stdint.h> | |
18 | 20 | |
19 | 21 | /* |
20 | 22 | * This include file features all the definitions that should |
135 | 137 | */ |
136 | 138 | |
137 | 139 | typedef struct _uulist { |
138 | short state; /* Status as described by the macros above */ | |
139 | short mode; /* file mode as found on begin line */ | |
140 | struct _uulist *NEXT; /* next item of the list */ | |
141 | struct _uulist *PREV; /* previous item of the list */ | |
142 | ||
143 | uint8_t state; /* Status as described by the macros above */ | |
144 | uint8_t flags; /* flags, especially for single-part files */ | |
145 | uint8_t uudet; /* Encoding type (see macros above) */ | |
140 | 146 | |
141 | 147 | int begin; /* part number where begin was detected */ |
142 | 148 | int end; /* part number where end was detected */ |
143 | 149 | |
144 | short uudet; /* Encoding type (see macros above) */ | |
145 | int flags; /* flags, especially for single-part files */ | |
146 | ||
147 | long size; /* approximate size of resulting file */ | |
150 | uint32_t filename_hash; /* hash of filename for faster comparisons */ | |
151 | uint32_t mimeid_hash; /* hash of filename for faster comparisons */ | |
152 | uint16_t mode; /* file mode as found on begin line */ | |
153 | ||
148 | 154 | char *filename; /* malloc'ed file name */ |
149 | 155 | char *subfname; /* malloc'ed ID from subject line */ |
150 | 156 | char *mimeid; /* malloc'ed MIME-ID, if available */ |
151 | 157 | char *mimetype; /* malloc'ed Content-Type, if available */ |
152 | 158 | |
153 | 159 | char *binfile; /* name of temp file, if already decoded */ |
160 | long size; /* approximate size of resulting file */ | |
154 | 161 | |
155 | 162 | struct _uufile *thisfile; /* linked list of this file's parts */ |
156 | 163 | |
157 | 164 | int *haveparts; /* the parts we have (max. 256 are listed) */ |
158 | 165 | int *misparts; /* list of missing parts (max. 256) */ |
159 | ||
160 | struct _uulist *NEXT; /* next item of the list */ | |
161 | struct _uulist *PREV; /* previous item of the list */ | |
162 | 166 | } uulist; |
163 | 167 | |
164 | 168 | /* |
175 | 179 | long foffset; /* file offset -- internal use only */ |
176 | 180 | long totsize; /* file total size -- internal use only */ |
177 | 181 | } uuprogress; |
178 | ||
182 | ||
179 | 183 | |
180 | 184 | /* |
181 | 185 | * Externally visible Functions |
194 | 198 | int UUEXPORT UUSetOption _ANSI_ARGS_((int, int, char *)); |
195 | 199 | char * UUEXPORT UUstrerror _ANSI_ARGS_((int)); |
196 | 200 | int UUEXPORT UUSetMsgCallback _ANSI_ARGS_((void *, |
197 | void (*) (void *, | |
201 | void (*) (void *, | |
198 | 202 | char *, |
199 | 203 | int))); |
200 | 204 | int UUEXPORT UUSetBusyCallback _ANSI_ARGS_((void *, |
219 | 223 | int UUEXPORT UURemoveTemp _ANSI_ARGS_((uulist *)); |
220 | 224 | int UUEXPORT UUDecodeFile _ANSI_ARGS_((uulist *, char *)); |
221 | 225 | int UUEXPORT UUInfoFile _ANSI_ARGS_((uulist *, void *, |
222 | int (*) (void *, | |
226 | int (*) (void *, | |
223 | 227 | char *))); |
224 | 228 | int UUEXPORT UUSmerge _ANSI_ARGS_((int)); |
225 | 229 | int UUEXPORT UUCleanUp _ANSI_ARGS_((void)); |
134 | 134 | 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', |
135 | 135 | 'X', 'Y', 'Z', '[', '\\',']', '^', '_' |
136 | 136 | }; |
137 | ||
137 | ||
138 | 138 | |
139 | 139 | unsigned char B64EncodeTable[64] = { |
140 | 140 | 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', |
161 | 161 | unsigned char BHEncodeTable[64] = { |
162 | 162 | '!', '"', '#', '$', '%', '&', '\'', '(', |
163 | 163 | ')', '*', '+', ',', '-', '0', '1', '2', |
164 | '3', '4', '5', '6', '8', '9', '@', 'A', | |
165 | 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', | |
166 | 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', | |
167 | 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '[', | |
168 | '`', 'a', 'b', 'c', 'd', 'e', 'f', 'h', | |
164 | '3', '4', '5', '6', '8', '9', '@', 'A', | |
165 | 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', | |
166 | 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', | |
167 | 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '[', | |
168 | '`', 'a', 'b', 'c', 'd', 'e', 'f', 'h', | |
169 | 169 | 'i', 'j', 'k', 'l', 'm', 'p', 'q', 'r' |
170 | 170 | }; |
171 | 171 | |
241 | 241 | * Encode one part of the data stream |
242 | 242 | */ |
243 | 243 | |
244 | static int | |
244 | static int | |
245 | 245 | UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc32_t *crc, crc32_t *pcrc) |
246 | 246 | { |
247 | 247 | uchar *itemp = (uchar *) uuestr_itemp; |
265 | 265 | */ |
266 | 266 | |
267 | 267 | if (encoding == PT_ENCODED || encoding == QP_ENCODED) { |
268 | while (!feof (infile) && (linperfile <= 0 || line < linperfile)) { | |
269 | if (_FP_fgets (itemp, 255, infile) == NULL) { | |
268 | while (!FP_feof (infile) && (linperfile <= 0 || line < linperfile)) { | |
269 | if (FP_fgets (itemp, 255, infile) == NULL) { | |
270 | 270 | break; |
271 | 271 | } |
272 | 272 | |
279 | 279 | /* |
280 | 280 | * Busy Callback |
281 | 281 | */ |
282 | ||
282 | ||
283 | 283 | if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) { |
284 | 284 | UUMessage (uuencode_id, __LINE__, UUMSG_NOTE, |
285 | 285 | uustring (S_ENCODE_CANCEL)); |
385 | 385 | |
386 | 386 | *optr++ = '='; |
387 | 387 | llen++; |
388 | ||
388 | ||
389 | 389 | if (fwrite (otemp, 1, llen, outfile) != llen || |
390 | 390 | fwrite ((char *) eolstring, 1, |
391 | 391 | strlen(eolstring), outfile) != strlen (eolstring)) { |
392 | 392 | return UURET_IOERR; |
393 | 393 | } |
394 | ||
394 | ||
395 | 395 | optr = otemp; |
396 | 396 | llen = 0; |
397 | 397 | } |
412 | 412 | llen = 0; |
413 | 413 | optr = otemp; |
414 | 414 | |
415 | while (!feof (infile) && (linperfile <= 0 || line < linperfile)) { | |
415 | while (!FP_feof (infile) && (linperfile <= 0 || line < linperfile)) { | |
416 | 416 | if ((count = fread (itemp, 1, 128, infile)) != 128) { |
417 | 417 | if (count == 0) { |
418 | 418 | break; |
423 | 423 | } |
424 | 424 | |
425 | 425 | if (pcrc) |
426 | *pcrc = crc32(*pcrc, itemp, count); | |
426 | *pcrc = uu_crc32(*pcrc, itemp, count); | |
427 | 427 | if (crc) |
428 | *crc = crc32(*crc, itemp, count); | |
428 | *crc = uu_crc32(*crc, itemp, count); | |
429 | 429 | |
430 | 430 | line++; |
431 | 431 | |
432 | 432 | /* |
433 | 433 | * Busy Callback |
434 | 434 | */ |
435 | ||
435 | ||
436 | 436 | if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) { |
437 | 437 | UUMessage (uuencode_id, __LINE__, UUMSG_NOTE, |
438 | 438 | uustring (S_ENCODE_CANCEL)); |
513 | 513 | return UURET_ILLVAL; |
514 | 514 | } |
515 | 515 | |
516 | while (!feof (infile) && (linperfile <= 0 || line < linperfile)) { | |
516 | while (!FP_feof (infile) && (linperfile <= 0 || line < linperfile)) { | |
517 | 517 | if ((count = fread (itemp, 1, bpl[encoding], infile)) != bpl[encoding]) { |
518 | 518 | if (count == 0) |
519 | 519 | break; |
562 | 562 | if (encoding == B64ENCODED) { |
563 | 563 | if (count - index == 2) { |
564 | 564 | *optr++ = table[itemp[index] >> 2]; |
565 | *optr++ = table[((itemp[index ] & 0x03) << 4) | | |
565 | *optr++ = table[((itemp[index ] & 0x03) << 4) | | |
566 | 566 | ((itemp[index+1] & 0xf0) >> 4)]; |
567 | 567 | *optr++ = table[((itemp[index+1] & 0x0f) << 2)]; |
568 | 568 | *optr++ = '='; |
578 | 578 | else if (encoding == UU_ENCODED || encoding == XX_ENCODED) { |
579 | 579 | if (count - index == 2) { |
580 | 580 | *optr++ = table[itemp[index] >> 2]; |
581 | *optr++ = table[((itemp[index ] & 0x03) << 4) | | |
581 | *optr++ = table[((itemp[index ] & 0x03) << 4) | | |
582 | 582 | ( itemp[index+1] >> 4)]; |
583 | 583 | *optr++ = table[((itemp[index+1] & 0x0f) << 2)]; |
584 | 584 | *optr++ = table[0]; |
629 | 629 | crc32_t crc; |
630 | 630 | crc32_t *crcptr=NULL; |
631 | 631 | |
632 | if (outfile==NULL || | |
632 | if (outfile==NULL || | |
633 | 633 | (infile == NULL && infname==NULL) || |
634 | 634 | (outfname==NULL && infname==NULL) || |
635 | 635 | (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& |
672 | 672 | if (progress.fsize < 0) |
673 | 673 | progress.fsize = -1; |
674 | 674 | |
675 | _FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
675 | FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
676 | 676 | |
677 | 677 | progress.partno = 1; |
678 | 678 | progress.numparts = 1; |
687 | 687 | */ |
688 | 688 | |
689 | 689 | if (mimetype == NULL) { |
690 | if ((ptr = _FP_strrchr ((outfname)?outfname:infname, '.'))) { | |
691 | while (miter->extension && _FP_stricmp (ptr+1, miter->extension) != 0) | |
690 | if ((ptr = FP_strrchr ((outfname)?outfname:infname, '.'))) { | |
691 | while (miter->extension && FP_stricmp (ptr+1, miter->extension) != 0) | |
692 | 692 | miter++; |
693 | 693 | mimetype = miter->mimetype; |
694 | 694 | } |
716 | 716 | if (encoding == UU_ENCODED || encoding == XX_ENCODED) { |
717 | 717 | fprintf (outfile, "begin %o %s%s", |
718 | 718 | (themode) ? themode : 0644, |
719 | UUFNameFilter ((outfname)?outfname:infname), | |
719 | UUFNameFilter ((outfname)?outfname:infname), | |
720 | 720 | eolstring); |
721 | 721 | } |
722 | 722 | else if (encoding == YENC_ENCODED) { |
723 | crc = crc32(0L, Z_NULL, 0); | |
723 | crc = CRC32_INIT; | |
724 | 724 | crcptr = &crc; |
725 | 725 | if (progress.fsize == -1) { |
726 | 726 | fprintf (outfile, "=ybegin line=128 name=%s%s", |
727 | UUFNameFilter ((outfname)?outfname:infname), | |
727 | UUFNameFilter ((outfname)?outfname:infname), | |
728 | 728 | eolstring); |
729 | 729 | } |
730 | 730 | else { |
731 | 731 | fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", |
732 | 732 | progress.fsize, |
733 | UUFNameFilter ((outfname)?outfname:infname), | |
733 | UUFNameFilter ((outfname)?outfname:infname), | |
734 | 734 | eolstring); |
735 | 735 | } |
736 | 736 | } |
747 | 747 | } |
748 | 748 | |
749 | 749 | if (encoding == UU_ENCODED || encoding == XX_ENCODED) { |
750 | fprintf (outfile, "%c%s", | |
751 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
750 | fprintf (outfile, "%c%s", | |
751 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
752 | 752 | eolstring); |
753 | 753 | fprintf (outfile, "end%s", eolstring); |
754 | 754 | } |
755 | 755 | else if (encoding == YENC_ENCODED) { |
756 | 756 | if (progress.fsize == -1) { |
757 | 757 | fprintf (outfile, "=yend crc32=%08lx%s", |
758 | crc, | |
758 | (long)crc, | |
759 | 759 | eolstring); |
760 | 760 | } |
761 | 761 | else { |
762 | 762 | fprintf (outfile, "=yend size=%ld crc32=%08lx%s", |
763 | 763 | progress.fsize, |
764 | crc, | |
764 | (long)crc, | |
765 | 765 | eolstring); |
766 | 766 | } |
767 | 767 | } |
831 | 831 | } |
832 | 832 | if (linperfile <= 0) |
833 | 833 | numparts = 1; |
834 | else | |
834 | else | |
835 | 835 | numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ |
836 | 836 | (linperfile*bpl[encoding])); |
837 | 837 | |
859 | 859 | theifile = infile; |
860 | 860 | } |
861 | 861 | |
862 | _FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
862 | FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
863 | 863 | |
864 | 864 | progress.totsize = (thesize>=0) ? thesize : -1; |
865 | 865 | progress.partno = 1; |
874 | 874 | */ |
875 | 875 | |
876 | 876 | if (mimetype == NULL) { |
877 | if ((ptr = _FP_strrchr ((outfname)?outfname:infname, '.'))) { | |
878 | while (miter->extension && _FP_stricmp (ptr+1, miter->extension) != 0) | |
877 | if ((ptr = FP_strrchr ((outfname)?outfname:infname, '.'))) { | |
878 | while (miter->extension && FP_stricmp (ptr+1, miter->extension) != 0) | |
879 | 879 | miter++; |
880 | 880 | mimetype = miter->mimetype; |
881 | 881 | } |
901 | 901 | } |
902 | 902 | |
903 | 903 | fprintf (outfile, "%s", eolstring); |
904 | ||
904 | ||
905 | 905 | /* |
906 | 906 | * for the first part of UU or XX messages, print a begin line |
907 | 907 | */ |
913 | 913 | } |
914 | 914 | } |
915 | 915 | if (encoding == YENC_ENCODED) { |
916 | pcrc = crc32(0L, Z_NULL, 0); | |
916 | pcrc = CRC32_INIT; | |
917 | 917 | pcrcptr = &pcrc; |
918 | 918 | if (numparts != 1) { |
919 | 919 | if (progress.totsize == -1) { |
920 | 920 | fprintf (outfile, "=ybegin part=%d line=128 name=%s%s", |
921 | 921 | partno, |
922 | UUFNameFilter ((outfname)?outfname:infname), | |
922 | UUFNameFilter ((outfname)?outfname:infname), | |
923 | 923 | eolstring); |
924 | 924 | } |
925 | 925 | else { |
926 | 926 | fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s", |
927 | 927 | partno, |
928 | 928 | progress.totsize, |
929 | UUFNameFilter ((outfname)?outfname:infname), | |
929 | UUFNameFilter ((outfname)?outfname:infname), | |
930 | 930 | eolstring); |
931 | 931 | } |
932 | 932 | |
940 | 940 | else { |
941 | 941 | if (progress.totsize == -1) { |
942 | 942 | fprintf (outfile, "=ybegin line=128 name=%s%s", |
943 | UUFNameFilter ((outfname)?outfname:infname), | |
943 | UUFNameFilter ((outfname)?outfname:infname), | |
944 | 944 | eolstring); |
945 | 945 | } |
946 | 946 | else { |
947 | 947 | fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", |
948 | 948 | progress.totsize, |
949 | UUFNameFilter ((outfname)?outfname:infname), | |
949 | UUFNameFilter ((outfname)?outfname:infname), | |
950 | 950 | eolstring); |
951 | 951 | } |
952 | 952 | } |
988 | 988 | * print end line |
989 | 989 | */ |
990 | 990 | |
991 | if (feof (theifile) && | |
991 | if (FP_feof (theifile) && | |
992 | 992 | (encoding == UU_ENCODED || encoding == XX_ENCODED)) { |
993 | fprintf (outfile, "%c%s", | |
994 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
993 | fprintf (outfile, "%c%s", | |
994 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
995 | 995 | eolstring); |
996 | 996 | fprintf (outfile, "end%s", eolstring); |
997 | 997 | } |
1002 | 1002 | ? linperfile * 128 |
1003 | 1003 | : (progress.totsize - (partno - 1) * linperfile * 128), |
1004 | 1004 | partno, |
1005 | pcrc); | |
1005 | (long)pcrc); | |
1006 | 1006 | } |
1007 | 1007 | else { |
1008 | 1008 | fprintf (outfile, "=yend size=%ld", |
1009 | 1009 | progress.totsize); |
1010 | 1010 | } |
1011 | if (feof (theifile)) | |
1012 | fprintf (outfile, " crc32=%08lx", *crcptr); | |
1011 | if (FP_feof (theifile)) | |
1012 | fprintf (outfile, " crc32=%08lx", (long)*crcptr); | |
1013 | 1013 | fprintf (outfile, "%s", eolstring); |
1014 | 1014 | } |
1015 | 1015 | |
1027 | 1027 | fclose (theifile); |
1028 | 1028 | return res; |
1029 | 1029 | } |
1030 | if (feof (theifile)) { | |
1030 | if (FP_feof (theifile)) { | |
1031 | 1031 | progress.action = 0; |
1032 | 1032 | fclose (theifile); |
1033 | 1033 | return UURET_OK; |
1102 | 1102 | if (progress.fsize < 0) |
1103 | 1103 | progress.fsize = -1; |
1104 | 1104 | |
1105 | _FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
1105 | FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
1106 | 1106 | |
1107 | 1107 | progress.partno = 1; |
1108 | 1108 | progress.numparts = 1; |
1113 | 1113 | if (encoding == UU_ENCODED || encoding == XX_ENCODED) { |
1114 | 1114 | fprintf (outfile, "begin %o %s%s", |
1115 | 1115 | (themode) ? themode : 0644, |
1116 | UUFNameFilter ((outfname)?outfname:infname), | |
1116 | UUFNameFilter ((outfname)?outfname:infname), | |
1117 | 1117 | eolstring); |
1118 | 1118 | } |
1119 | 1119 | else if (encoding == YENC_ENCODED) { |
1120 | crc = crc32(0L, Z_NULL, 0); | |
1120 | crc = CRC32_INIT; | |
1121 | 1121 | crcptr = &crc; |
1122 | 1122 | if (progress.fsize == -1) { |
1123 | 1123 | fprintf (outfile, "=ybegin line=128 name=%s%s", |
1124 | UUFNameFilter ((outfname)?outfname:infname), | |
1124 | UUFNameFilter ((outfname)?outfname:infname), | |
1125 | 1125 | eolstring); |
1126 | 1126 | } |
1127 | 1127 | else { |
1128 | 1128 | fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", |
1129 | 1129 | progress.fsize, |
1130 | UUFNameFilter ((outfname)?outfname:infname), | |
1130 | UUFNameFilter ((outfname)?outfname:infname), | |
1131 | 1131 | eolstring); |
1132 | 1132 | } |
1133 | 1133 | } |
1136 | 1136 | if (res != UURET_CANCEL) { |
1137 | 1137 | UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, |
1138 | 1138 | uustring (S_ERR_ENCODING), |
1139 | UUFNameFilter ((infname)?infname:outfname), | |
1139 | UUFNameFilter ((infname)?infname:outfname), | |
1140 | 1140 | (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); |
1141 | 1141 | } |
1142 | 1142 | progress.action = 0; |
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | if (encoding == UU_ENCODED || encoding == XX_ENCODED) { |
1147 | fprintf (outfile, "%c%s", | |
1148 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
1147 | fprintf (outfile, "%c%s", | |
1148 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
1149 | 1149 | eolstring); |
1150 | 1150 | fprintf (outfile, "end%s", eolstring); |
1151 | 1151 | } |
1152 | 1152 | else if (encoding == YENC_ENCODED) { |
1153 | 1153 | if (progress.fsize == -1) { |
1154 | 1154 | fprintf (outfile, "=yend crc32=%08lx%s", |
1155 | crc, | |
1155 | (long)crc, | |
1156 | 1156 | eolstring); |
1157 | 1157 | } |
1158 | 1158 | else { |
1159 | 1159 | fprintf (outfile, "=yend size=%ld crc32=%08lx%s", |
1160 | 1160 | progress.fsize, |
1161 | crc, | |
1161 | (long)crc, | |
1162 | 1162 | eolstring); |
1163 | 1163 | } |
1164 | 1164 | } |
1213 | 1213 | sprintf (oname, "%s", diskname); |
1214 | 1214 | } |
1215 | 1215 | else { |
1216 | len = ((uusavepath)?strlen(uusavepath):0) + strlen (diskname) | |
1216 | len = ((uusavepath)?strlen(uusavepath):0) + strlen (diskname) | |
1217 | 1217 | + ((uuencodeext)?strlen(uuencodeext):0) + 5; |
1218 | 1218 | |
1219 | 1219 | if ((oname = malloc (len)) == NULL) { |
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | else { |
1228 | len = ((uusavepath) ? strlen (uusavepath) : 0) + | |
1228 | len = ((uusavepath) ? strlen (uusavepath) : 0) + | |
1229 | 1229 | strlen(UUFNameFilter(infname)) + |
1230 | 1230 | ((uuencodeext)?strlen(uuencodeext):0) + 5; |
1231 | 1231 | |
1235 | 1235 | return UURET_NOMEM; |
1236 | 1236 | } |
1237 | 1237 | optr = UUFNameFilter (infname); |
1238 | sprintf (oname, "%s%s", | |
1238 | sprintf (oname, "%s%s", | |
1239 | 1239 | (uusavepath)?uusavepath:"", |
1240 | 1240 | (*optr=='.')?optr+1:optr); |
1241 | 1241 | } |
1245 | 1245 | * there. |
1246 | 1246 | */ |
1247 | 1247 | |
1248 | optr = _FP_strrchr (oname, '.'); | |
1248 | optr = FP_strrchr (oname, '.'); | |
1249 | 1249 | if (optr==NULL || strchr (optr, '/')!=NULL || strchr (optr, '\\')!=NULL) { |
1250 | 1250 | optr = oname + strlen (oname); |
1251 | 1251 | *optr++ = '.'; |
1264 | 1264 | UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, |
1265 | 1265 | uustring (S_NOT_STAT_FILE), |
1266 | 1266 | infname, strerror (uu_errno=errno)); |
1267 | _FP_free (oname); | |
1267 | FP_free (oname); | |
1268 | 1268 | return UURET_IOERR; |
1269 | 1269 | } |
1270 | 1270 | if ((theifile = fopen (infname, "rb")) == NULL) { |
1271 | 1271 | UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, |
1272 | 1272 | uustring (S_NOT_OPEN_FILE), |
1273 | 1273 | infname, strerror (uu_errno=errno)); |
1274 | _FP_free (oname); | |
1274 | FP_free (oname); | |
1275 | 1275 | return UURET_IOERR; |
1276 | 1276 | } |
1277 | 1277 | if (linperfile <= 0) |
1278 | 1278 | numparts = 1; |
1279 | else | |
1279 | else | |
1280 | 1280 | numparts = (int) (((long)finfo.st_size + (linperfile*bpl[encoding]-1)) / |
1281 | 1281 | (linperfile*bpl[encoding])); |
1282 | 1282 | |
1303 | 1303 | theifile = infile; |
1304 | 1304 | } |
1305 | 1305 | |
1306 | _FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
1306 | FP_strncpy (progress.curfile, (outfname)?outfname:infname, 256); | |
1307 | 1307 | |
1308 | 1308 | progress.totsize = (progress.totsize<0) ? -1 : progress.totsize; |
1309 | 1309 | progress.numparts = numparts; |
1310 | 1310 | |
1311 | for (part=1; !feof (theifile); part++) { | |
1311 | for (part=1; !FP_feof (theifile); part++) { | |
1312 | 1312 | /* |
1313 | 1313 | * Attach extension |
1314 | 1314 | */ |
1315 | 1315 | if (progress.numparts==1 && progress.totsize!=-1 && uuencodeext!=NULL) |
1316 | 1316 | strcpy (optr, uuencodeext); |
1317 | else | |
1317 | else | |
1318 | 1318 | sprintf (optr, "%03d", part); |
1319 | 1319 | |
1320 | 1320 | /* |
1381 | 1381 | if (part==1 && (encoding == UU_ENCODED || encoding == XX_ENCODED)) { |
1382 | 1382 | fprintf (outfile, "begin %o %s%s", |
1383 | 1383 | (filemode)?filemode : 0644, |
1384 | UUFNameFilter ((outfname)?outfname:infname), | |
1384 | UUFNameFilter ((outfname)?outfname:infname), | |
1385 | 1385 | eolstring); |
1386 | 1386 | } |
1387 | 1387 | else if (encoding == YENC_ENCODED) { |
1388 | 1388 | if (!crcptr) { |
1389 | crc = crc32(0L, Z_NULL, 0); | |
1389 | crc = CRC32_INIT; | |
1390 | 1390 | crcptr = &crc; |
1391 | 1391 | } |
1392 | pcrc = crc32(0L, Z_NULL, 0); | |
1392 | pcrc = CRC32_INIT; | |
1393 | 1393 | pcrcptr = &pcrc; |
1394 | 1394 | if (numparts != 1) { |
1395 | 1395 | if (progress.totsize == -1) { |
1396 | 1396 | fprintf (outfile, "=ybegin part=%d line=128 name=%s%s", |
1397 | 1397 | part, |
1398 | UUFNameFilter ((outfname)?outfname:infname), | |
1398 | UUFNameFilter ((outfname)?outfname:infname), | |
1399 | 1399 | eolstring); |
1400 | 1400 | } |
1401 | 1401 | else { |
1402 | 1402 | fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s", |
1403 | 1403 | part, |
1404 | 1404 | progress.totsize, |
1405 | UUFNameFilter ((outfname)?outfname:infname), | |
1405 | UUFNameFilter ((outfname)?outfname:infname), | |
1406 | 1406 | eolstring); |
1407 | 1407 | } |
1408 | 1408 | |
1409 | 1409 | fprintf (outfile, "=ypart begin=%ld end=%ld%s", |
1410 | 1410 | (part-1)*linperfile*128+1, |
1411 | (part*linperfile*128) < progress.totsize ? | |
1411 | (part*linperfile*128) < progress.totsize ? | |
1412 | 1412 | (part*linperfile*128) : progress.totsize, |
1413 | 1413 | eolstring); |
1414 | 1414 | } |
1415 | 1415 | else { |
1416 | 1416 | if (progress.totsize == -1) { |
1417 | 1417 | fprintf (outfile, "=ybegin line=128 name=%s%s", |
1418 | UUFNameFilter ((outfname)?outfname:infname), | |
1418 | UUFNameFilter ((outfname)?outfname:infname), | |
1419 | 1419 | eolstring); |
1420 | 1420 | } |
1421 | 1421 | else { |
1422 | 1422 | fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", |
1423 | 1423 | progress.totsize, |
1424 | UUFNameFilter ((outfname)?outfname:infname), | |
1424 | UUFNameFilter ((outfname)?outfname:infname), | |
1425 | 1425 | eolstring); |
1426 | 1426 | } |
1427 | 1427 | } |
1432 | 1432 | if (res != UURET_CANCEL) { |
1433 | 1433 | UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, |
1434 | 1434 | uustring (S_ERR_ENCODING), |
1435 | UUFNameFilter ((infname)?infname:outfname), | |
1435 | UUFNameFilter ((infname)?infname:outfname), | |
1436 | 1436 | (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); |
1437 | 1437 | } |
1438 | 1438 | if (infile==NULL) fclose (theifile); |
1439 | 1439 | progress.action = 0; |
1440 | 1440 | fclose (outfile); |
1441 | 1441 | unlink (oname); |
1442 | _FP_free (oname); | |
1442 | FP_free (oname); | |
1443 | 1443 | return res; |
1444 | 1444 | } |
1445 | 1445 | |
1446 | if (feof (theifile) && | |
1446 | if (FP_feof (theifile) && | |
1447 | 1447 | (encoding == UU_ENCODED || encoding == XX_ENCODED)) { |
1448 | fprintf (outfile, "%c%s", | |
1449 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
1448 | fprintf (outfile, "%c%s", | |
1449 | (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], | |
1450 | 1450 | eolstring); |
1451 | 1451 | fprintf (outfile, "end%s", eolstring); |
1452 | 1452 | } |
1453 | 1453 | else if (encoding == YENC_ENCODED) { |
1454 | 1454 | if (numparts != 1) { |
1455 | 1455 | fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx", |
1456 | (part*linperfile*128) < progress.totsize ? | |
1456 | (part*linperfile*128) < progress.totsize ? | |
1457 | 1457 | linperfile*128 : (progress.totsize-(part-1)*linperfile*128), |
1458 | 1458 | part, |
1459 | pcrc); | |
1459 | (long)pcrc); | |
1460 | 1460 | } |
1461 | 1461 | else { |
1462 | 1462 | fprintf (outfile, "=yend size=%ld", |
1463 | 1463 | progress.totsize); |
1464 | 1464 | } |
1465 | if (feof (theifile)) | |
1466 | fprintf (outfile, " crc32=%08lx", crc); | |
1465 | if (FP_feof (theifile)) | |
1466 | fprintf (outfile, " crc32=%08lx", (long)crc); | |
1467 | 1467 | fprintf (outfile, "%s", eolstring); |
1468 | 1468 | } |
1469 | 1469 | |
1477 | 1477 | |
1478 | 1478 | if (infile==NULL) fclose (theifile); |
1479 | 1479 | progress.action = 0; |
1480 | _FP_free (oname); | |
1480 | FP_free (oname); | |
1481 | 1481 | return UURET_OK; |
1482 | 1482 | } |
1483 | 1483 | |
1526 | 1526 | oname = UUFNameFilter ((outfname)?outfname:infname); |
1527 | 1527 | len = ((subject)?strlen(subject):0) + strlen(oname) + 40; |
1528 | 1528 | |
1529 | if ((ptr = _FP_strrchr (oname, '.'))) { | |
1530 | while (miter->extension && _FP_stricmp (ptr+1, miter->extension) != 0) | |
1529 | if ((ptr = FP_strrchr (oname, '.'))) { | |
1530 | while (miter->extension && FP_stricmp (ptr+1, miter->extension) != 0) | |
1531 | 1531 | miter++; |
1532 | 1532 | mimetype = miter->mimetype; |
1533 | 1533 | } |
1586 | 1586 | |
1587 | 1587 | res = UUEncodeToStream (outfile, infile, infname, encoding, |
1588 | 1588 | outfname, filemode); |
1589 | ||
1590 | _FP_free (subline); | |
1589 | ||
1590 | FP_free (subline); | |
1591 | 1591 | return res; |
1592 | 1592 | } |
1593 | 1593 | |
1658 | 1658 | } |
1659 | 1659 | if (linperfile <= 0) |
1660 | 1660 | numparts = 1; |
1661 | else | |
1661 | else | |
1662 | 1662 | numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ |
1663 | 1663 | (linperfile*bpl[encoding])); |
1664 | 1664 | |
1728 | 1728 | |
1729 | 1729 | if (encoding == YENC_ENCODED) { |
1730 | 1730 | if (partno == 1) |
1731 | crc = crc32(0L, Z_NULL, 0); | |
1731 | crc = CRC32_INIT; | |
1732 | 1732 | crcptr = &crc; |
1733 | 1733 | if (subject) |
1734 | 1734 | sprintf (subline, "- %s - %s (%03d/%03d)", oname, subject, |
1739 | 1739 | } |
1740 | 1740 | else { |
1741 | 1741 | if (subject) |
1742 | sprintf (subline, "%s (%03d/%03d) - [ %s ]", | |
1742 | sprintf (subline, "%s (%03d/%03d) - [ %s ]", | |
1743 | 1743 | subject, partno, numparts, oname); |
1744 | 1744 | else |
1745 | 1745 | sprintf (subline, "[ %s ] (%03d/%03d)", |
1769 | 1769 | fprintf (outfile, "\tid=\"%s\"%s", |
1770 | 1770 | mimeid, eolstring); |
1771 | 1771 | } |
1772 | ||
1772 | ||
1773 | 1773 | fprintf (outfile, "%s", eolstring); |
1774 | 1774 | |
1775 | 1775 | res = UUEncodePartial (outfile, theifile, |
1777 | 1777 | (outfname)?outfname:infname, NULL, |
1778 | 1778 | themode, partno, linperfile, crcptr); |
1779 | 1779 | |
1780 | _FP_free (subline); | |
1780 | FP_free (subline); | |
1781 | 1781 | |
1782 | 1782 | if (infile==NULL) { |
1783 | 1783 | if (res != UURET_OK) { |
1784 | 1784 | fclose (theifile); |
1785 | 1785 | return res; |
1786 | 1786 | } |
1787 | if (feof (theifile)) { | |
1787 | if (FP_feof (theifile)) { | |
1788 | 1788 | fclose (theifile); |
1789 | 1789 | return UURET_OK; |
1790 | 1790 | } |
68 | 68 | |
69 | 69 | #define UUPERCENT(a,b) ((int) ((unsigned long)(a) / \ |
70 | 70 | (((unsigned long)(b)/100)+1))) |
71 | ||
71 | ||
72 | 72 | /* |
73 | 73 | * Make the Busy Callback easier. The macro returns true if the BusyCallback |
74 | 74 | * wants us to terminate. |
141 | 141 | char *origin; /* Whole 'From:' line */ |
142 | 142 | char *mimeid; /* the ID for Mime-encoded files */ |
143 | 143 | char *mimetype; /* Content-Type */ |
144 | int mode; /* Mode of File (from 'begin') */ | |
145 | 144 | int begin; /* begin detected */ |
146 | 145 | int end; /* end detected */ |
147 | int flags; /* associated flags */ | |
148 | 146 | long yefilesize; /* the yencode file size, or 0 */ |
149 | 147 | |
150 | int uudet; /* valid encoded data. value indicates encoding */ | |
148 | uint16_t mode; /* Mode of File (from 'begin') */ | |
149 | uint8_t flags; /* associated flags */ | |
150 | uint8_t uudet; /* valid encoded data. value indicates encoding */ | |
151 | 151 | int partno; /* Mime-files have a part number within */ |
152 | 152 | int maxpno; /* ... plus the total number of parts */ |
153 | 153 | |
164 | 164 | **/ |
165 | 165 | |
166 | 166 | typedef struct _uufile { |
167 | struct _uufile *NEXT; | |
167 | 168 | char *filename; |
168 | 169 | char *subfname; |
169 | 170 | char *mimeid; |
170 | 171 | char *mimetype; |
171 | int partno; | |
172 | 172 | fileread *data; |
173 | 173 | long yefilesize; |
174 | struct _uufile *NEXT; | |
174 | int partno; | |
175 | 175 | } uufile; |
176 | 176 | |
177 | 177 | extern void *uu_MsgCBArg; |
301 | 301 | |
302 | 302 | int UUbhdecomp (char *, char *, |
303 | 303 | char *, int *, |
304 | size_t, size_t, | |
304 | size_t, size_t, | |
305 | 305 | size_t *); |
306 | 306 | size_t UUbhwrite (char *, size_t, size_t, FILE *); |
307 | 307 |
85 | 85 | char * uulib_id = "$Id$"; |
86 | 86 | |
87 | 87 | #ifdef SYSTEM_WINDLL |
88 | BOOL _export WINAPI | |
88 | BOOL _export WINAPI | |
89 | 89 | DllEntryPoint (HINSTANCE hInstance, DWORD seginfo, |
90 | 90 | LPVOID lpCmdLine) |
91 | 91 | { |
437 | 437 | result = 0; |
438 | 438 | break; |
439 | 439 | case UUOPT_VERSION: |
440 | _FP_strncpy (cvalue, uulibversion, clength); | |
440 | FP_strncpy (cvalue, uulibversion, clength); | |
441 | 441 | result = 0; |
442 | 442 | break; |
443 | 443 | case UUOPT_FAST: |
477 | 477 | result = uu_overwrite; |
478 | 478 | break; |
479 | 479 | case UUOPT_SAVEPATH: |
480 | _FP_strncpy (cvalue, uusavepath, clength); | |
480 | FP_strncpy (cvalue, uusavepath, clength); | |
481 | 481 | result = 0; |
482 | 482 | break; |
483 | 483 | case UUOPT_PROGRESS: |
505 | 505 | result = uu_tinyb64; |
506 | 506 | break; |
507 | 507 | case UUOPT_ENCEXT: |
508 | _FP_strncpy (cvalue, uuencodeext, clength); | |
508 | FP_strncpy (cvalue, uuencodeext, clength); | |
509 | 509 | result = 0; |
510 | 510 | break; |
511 | 511 | case UUOPT_REMOVE: |
565 | 565 | uu_overwrite = ivalue; |
566 | 566 | break; |
567 | 567 | case UUOPT_SAVEPATH: |
568 | _FP_free (uusavepath); | |
569 | uusavepath = _FP_strdup (cvalue); | |
568 | FP_free (uusavepath); | |
569 | uusavepath = FP_strdup (cvalue); | |
570 | 570 | break; |
571 | 571 | case UUOPT_IGNMODE: |
572 | 572 | uu_ignmode = ivalue; |
581 | 581 | uu_tinyb64 = ivalue; |
582 | 582 | break; |
583 | 583 | case UUOPT_ENCEXT: |
584 | _FP_free (uuencodeext); | |
585 | uuencodeext = _FP_strdup (cvalue); | |
584 | FP_free (uuencodeext); | |
585 | uuencodeext = FP_strdup (cvalue); | |
586 | 586 | break; |
587 | 587 | case UUOPT_REMOVE: |
588 | 588 | uu_remove_input = ivalue; |
613 | 613 | */ |
614 | 614 | |
615 | 615 | int UUEXPORT |
616 | UUSetMsgCallback (void *opaque, | |
616 | UUSetMsgCallback (void *opaque, | |
617 | 617 | void (*func) (void *, char *, int)) |
618 | 618 | { |
619 | 619 | uu_MsgCallback = func; |
721 | 721 | int _count; |
722 | 722 | if (!partcount) |
723 | 723 | partcount = &_count; |
724 | ||
724 | ||
725 | 725 | *partcount = 0; |
726 | 726 | |
727 | 727 | if ((datei = fopen (filename, "rb")) == NULL) { |
731 | 731 | return UURET_IOERR; |
732 | 732 | } |
733 | 733 | UUSETBUF (datei, datei_buf, uu_rbuf); |
734 | FP_flockfile (datei); | |
734 | 735 | |
735 | 736 | if (fstat (fileno(datei), &finfo) == -1) { |
736 | 737 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
750 | 751 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
751 | 752 | uustring (S_OUT_OF_MEMORY), sizeof (itbd)); |
752 | 753 | } |
753 | else if ((killem->fname = _FP_strdup (filename)) == NULL) { | |
754 | else if ((killem->fname = FP_strdup (filename)) == NULL) { | |
754 | 755 | UUMessage (uulib_id, __LINE__, UUMSG_WARNING, |
755 | 756 | uustring (S_OUT_OF_MEMORY), strlen(filename)+1); |
756 | _FP_free (killem); | |
757 | FP_free (killem); | |
757 | 758 | } |
758 | 759 | else { |
759 | 760 | killem->NEXT = ftodel; |
767 | 768 | progress.fsize = (long) ((finfo.st_size>0)?finfo.st_size:-1); |
768 | 769 | progress.percent = 0; |
769 | 770 | progress.foffset = 0; |
770 | _FP_strncpy (progress.curfile, | |
771 | FP_strncpy (progress.curfile, | |
771 | 772 | (strlen(filename)>255)? |
772 | 773 | (filename+strlen(filename)-255):filename, |
773 | 774 | 256); |
776 | 777 | if (fileid == NULL) |
777 | 778 | fileid = filename; |
778 | 779 | |
779 | while (!feof (datei) && !ferror (datei)) { | |
780 | /* | |
780 | while (!FP_feof (datei) && !ferror (datei)) { | |
781 | /* | |
781 | 782 | * Peek file, or some systems won't detect EOF |
782 | 783 | */ |
783 | res = _FP_fgetc (datei); | |
784 | if (feof (datei) || ferror (datei)) | |
784 | res = FP_getc (datei); | |
785 | if (FP_feof (datei) || ferror (datei)) | |
785 | 786 | break; |
786 | 787 | else |
787 | 788 | ungetc (res, datei); |
788 | ||
789 | ||
789 | 790 | if ((loaded = ScanPart (datei, fileid, &sr)) == NULL) { |
790 | 791 | if (sr != UURET_NODATA && sr != UURET_OK && sr != UURET_CONT) { |
791 | 792 | UUkillfread (loaded); |
838 | 839 | if (uu_fast_scanning && sr != UURET_CONT) break; |
839 | 840 | continue; |
840 | 841 | } |
841 | ||
842 | ||
842 | 843 | if ((fload = UUPreProcessPart (loaded, &res)) == NULL) { |
843 | 844 | /* |
844 | 845 | * no useful data found |
868 | 869 | (loaded->end) ? "end" : "", |
869 | 870 | codenames[loaded->uudet]); |
870 | 871 | } |
871 | ||
872 | ||
872 | 873 | if ((res = UUInsertPartToList (fload))) { |
873 | 874 | /* |
874 | 875 | * couldn't use the data |
967 | 968 | return UURET_IOERR; |
968 | 969 | } |
969 | 970 | UUSETBUF (source, source_buf, uu_rbuf); |
971 | FP_flockfile (source); | |
970 | 972 | |
971 | 973 | /* |
972 | 974 | * for system security, strip setuid/setgid bits from mode |
981 | 983 | |
982 | 984 | /* |
983 | 985 | * Determine the name of the target file according to the rules: |
984 | * | |
986 | * | |
985 | 987 | * IF (destname!=NULL) THEN filename=destname; |
986 | 988 | * ELSE |
987 | 989 | * filename = thefile->filename |
1038 | 1040 | } |
1039 | 1041 | |
1040 | 1042 | progress.action = 0; |
1041 | _FP_strncpy (progress.curfile, | |
1043 | FP_strncpy (progress.curfile, | |
1042 | 1044 | (strlen(uugen_fnbuffer)>255)? |
1043 | 1045 | (uugen_fnbuffer+strlen(uugen_fnbuffer)-255):uugen_fnbuffer, |
1044 | 1046 | 256); |
1072 | 1074 | return UURET_IOERR; |
1073 | 1075 | } |
1074 | 1076 | UUSETBUF (target, target_buf, uu_wbuf); |
1075 | ||
1076 | while (!feof (source)) { | |
1077 | FP_flockfile (target); | |
1078 | ||
1079 | while (!FP_feof (source)) { | |
1077 | 1080 | |
1078 | 1081 | if (UUBUSYPOLL(ftell(source),progress.fsize)) { |
1079 | 1082 | UUMessage (uulib_id, __LINE__, UUMSG_NOTE, |
1088 | 1091 | |
1089 | 1092 | bytes = fread (uugen_inbuffer, 1, 1024, source); |
1090 | 1093 | |
1091 | if (ferror (source) || (bytes == 0 && !feof (source))) { | |
1094 | if (ferror (source) || (bytes == 0 && !FP_feof (source))) { | |
1092 | 1095 | progress.action = 0; |
1093 | 1096 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1094 | 1097 | uustring (S_READ_ERROR), |
1138 | 1141 | } |
1139 | 1142 | |
1140 | 1143 | skip_copy: |
1141 | _FP_free (thefile->binfile); | |
1144 | FP_free (thefile->binfile); | |
1142 | 1145 | thefile->binfile = NULL; |
1143 | 1146 | thefile->state &= ~UUFILE_TMPFILE; |
1144 | 1147 | thefile->state |= UUFILE_DECODED; |
1165 | 1168 | */ |
1166 | 1169 | |
1167 | 1170 | if (uu_FileCallback) { |
1168 | if ((res = (*uu_FileCallback) (uu_FileCBArg, | |
1171 | if ((res = (*uu_FileCallback) (uu_FileCBArg, | |
1169 | 1172 | thefile->thisfile->data->sfname, |
1170 | 1173 | uugen_fnbuffer, |
1171 | 1174 | 1)) != UURET_OK) |
1182 | 1185 | else { |
1183 | 1186 | if ((inpfile = fopen (thefile->thisfile->data->sfname, "rb")) == NULL) { |
1184 | 1187 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1185 | uustring (S_NOT_OPEN_FILE), | |
1188 | uustring (S_NOT_OPEN_FILE), | |
1186 | 1189 | thefile->thisfile->data->sfname, |
1187 | 1190 | strerror (uu_errno=errno)); |
1188 | 1191 | return UURET_IOERR; |
1189 | 1192 | } |
1190 | _FP_strncpy (uugen_fnbuffer, thefile->thisfile->data->sfname, 1024); | |
1193 | FP_strncpy (uugen_fnbuffer, thefile->thisfile->data->sfname, 1024); | |
1191 | 1194 | } |
1192 | 1195 | |
1193 | 1196 | /* |
1197 | 1200 | fseek (inpfile, thefile->thisfile->data->startpos, SEEK_SET); |
1198 | 1201 | maxpos = thefile->thisfile->data->startpos + thefile->thisfile->data->length; |
1199 | 1202 | |
1200 | while (!feof (inpfile) && | |
1203 | while (!FP_feof (inpfile) && | |
1201 | 1204 | (uu_fast_scanning || ftell(inpfile) < maxpos)) { |
1202 | if (_FP_fgets (uugen_inbuffer, 511, inpfile) == NULL) | |
1205 | if (FP_fgets (uugen_inbuffer, 511, inpfile) == NULL) | |
1203 | 1206 | break; |
1204 | 1207 | uugen_inbuffer[511] = '\0'; |
1205 | 1208 | |
1233 | 1236 | fclose (inpfile); |
1234 | 1237 | |
1235 | 1238 | if (uu_FileCallback) |
1236 | (*uu_FileCallback) (uu_FileCBArg, | |
1239 | (*uu_FileCallback) (uu_FileCBArg, | |
1237 | 1240 | thefile->thisfile->data->sfname, |
1238 | 1241 | uugen_fnbuffer, 0); |
1239 | 1242 | |
1242 | 1245 | |
1243 | 1246 | return UURET_OK; |
1244 | 1247 | } |
1245 | ||
1248 | ||
1246 | 1249 | int UUEXPORT |
1247 | 1250 | UURenameFile (uulist *thefile, char *newname) |
1248 | 1251 | { |
1253 | 1256 | |
1254 | 1257 | oldname = thefile->filename; |
1255 | 1258 | |
1256 | if ((thefile->filename = _FP_strdup (newname)) == NULL) { | |
1259 | if ((thefile->filename = FP_strdup (newname)) == NULL) { | |
1257 | 1260 | UUMessage (uulib_id, __LINE__, UUMSG_ERROR, |
1258 | 1261 | uustring (S_NOT_RENAME), |
1259 | 1262 | oldname, newname); |
1260 | 1263 | thefile->filename = oldname; |
1261 | 1264 | return UURET_NOMEM; |
1262 | 1265 | } |
1263 | _FP_free (oldname); | |
1266 | FP_free (oldname); | |
1264 | 1267 | return UURET_OK; |
1265 | 1268 | } |
1266 | 1269 | |
1277 | 1280 | thefile->binfile, |
1278 | 1281 | strerror (uu_errno = errno)); |
1279 | 1282 | } |
1280 | _FP_free (thefile->binfile); | |
1283 | FP_free (thefile->binfile); | |
1281 | 1284 | thefile->binfile = NULL; |
1282 | 1285 | thefile->state &= ~UUFILE_TMPFILE; |
1283 | 1286 | } |
1302 | 1305 | uustring (S_TMP_NOT_REMOVED), |
1303 | 1306 | iter->fname, strerror (uu_errno = errno)); |
1304 | 1307 | } |
1305 | _FP_free (iter->fname); | |
1308 | FP_free (iter->fname); | |
1306 | 1309 | ptr = iter; |
1307 | 1310 | iter = iter->NEXT; |
1308 | _FP_free (ptr); | |
1311 | FP_free (ptr); | |
1309 | 1312 | } |
1310 | 1313 | |
1311 | 1314 | ftodel = NULL; |
1337 | 1340 | UUkilllist (UUGlobalFileList); |
1338 | 1341 | UUGlobalFileList = NULL; |
1339 | 1342 | |
1340 | _FP_free (uusavepath); | |
1341 | _FP_free (uuencodeext); | |
1342 | _FP_free (sstate.source); | |
1343 | FP_free (uusavepath); | |
1344 | FP_free (uuencodeext); | |
1345 | FP_free (sstate.source); | |
1343 | 1346 | |
1344 | 1347 | uusavepath = NULL; |
1345 | 1348 | uuencodeext = NULL; |
1352 | 1355 | while (mssdepth) { |
1353 | 1356 | mssdepth--; |
1354 | 1357 | UUkillheaders (&(multistack[mssdepth].envelope)); |
1355 | _FP_free (multistack[mssdepth].source); | |
1358 | FP_free (multistack[mssdepth].source); | |
1356 | 1359 | } |
1357 | 1360 | |
1358 | 1361 | /* |
195 | 195 | if (string==NULL || (len=strlen(string))<3) |
196 | 196 | return 0; |
197 | 197 | |
198 | if ((ptr = _FP_stristr (string, "<a href=")) != NULL) { | |
199 | if (_FP_stristr (string, "</a>") > ptr) | |
198 | if ((ptr = FP_stristr (string, "<a href=")) != NULL) { | |
199 | if (FP_stristr (string, "</a>") > ptr) | |
200 | 200 | return 2; |
201 | 201 | } |
202 | 202 | |
206 | 206 | if (*--ptr == ' ') ptr--; |
207 | 207 | ptr--; |
208 | 208 | |
209 | if (_FP_strnicmp (ptr, "<a", 2) == 0) | |
209 | if (FP_strnicmp (ptr, "<a", 2) == 0) | |
210 | 210 | return 1; |
211 | 211 | |
212 | 212 | return 0; |
216 | 216 | * Try to repair a Netscape-corrupted line of data. |
217 | 217 | * This must only be called on corrupted lines, since non-Netscape |
218 | 218 | * data may even _get_ corrupted by this procedure. |
219 | * | |
219 | * | |
220 | 220 | * Some checks are included multiply to speed up the procedure. For |
221 | 221 | * example: (*p1!='<' || strnicmp(p1,"</a>",4)). If the first expression |
222 | 222 | * becomes true, the costly function isn't called :-) |
240 | 240 | */ |
241 | 241 | while (*p1) { |
242 | 242 | if (*p1 == '&') { |
243 | if (_FP_strnicmp (p1, "&", 5) == 0) { p1+=5; *p2++='&'; res=1; } | |
244 | else if (_FP_strnicmp (p1, "<", 4) == 0) { p1+=4; *p2++='<'; res=1; } | |
245 | else if (_FP_strnicmp (p1, ">", 4) == 0) { p1+=4; *p2++='>'; res=1; } | |
243 | if (FP_strnicmp (p1, "&", 5) == 0) { p1+=5; *p2++='&'; res=1; } | |
244 | else if (FP_strnicmp (p1, "<", 4) == 0) { p1+=4; *p2++='<'; res=1; } | |
245 | else if (FP_strnicmp (p1, ">", 4) == 0) { p1+=4; *p2++='>'; res=1; } | |
246 | 246 | else *p2++ = *p1++; |
247 | 247 | res = 1; |
248 | 248 | } |
256 | 256 | |
257 | 257 | while (*p1) { |
258 | 258 | if (*p1 == '<') { |
259 | if ((_FP_strnicmp (p1, "<ahref=", 7) == 0 || | |
260 | _FP_strnicmp (p1, "<a href=",8) == 0) && | |
261 | (_FP_strstr (p1, "</a>") != 0 || _FP_strstr (p1, "</A>") != 0)) { | |
259 | if ((FP_strnicmp (p1, "<ahref=", 7) == 0 || | |
260 | FP_strnicmp (p1, "<a href=",8) == 0) && | |
261 | (FP_strstr (p1, "</a>") != 0 || FP_strstr (p1, "</A>") != 0)) { | |
262 | 262 | while (*p1 && *p1!='>') p1++; |
263 | 263 | if (*p1=='\0' || *(p1+1)!='<') return 0; |
264 | 264 | p1++; |
265 | while (*p1 && (*p1!='<' || _FP_strnicmp(p1,"</a>",4)!=0)) { | |
265 | while (*p1 && (*p1!='<' || FP_strnicmp(p1,"</a>",4)!=0)) { | |
266 | 266 | *p2++ = *p1++; |
267 | 267 | } |
268 | if (_FP_strnicmp(p1,"</a>",4) != 0) | |
268 | if (FP_strnicmp(p1,"</a>",4) != 0) | |
269 | 269 | return 0; |
270 | 270 | p1+=4; |
271 | 271 | res=1; |
299 | 299 | return 0; /* bad string */ |
300 | 300 | } |
301 | 301 | |
302 | while (*s) { | |
303 | s++; | |
304 | len++; | |
305 | i++; | |
306 | } | |
307 | ||
308 | if (i == 0) | |
309 | return 0; | |
302 | if (encoding == YENC_ENCODED) | |
303 | return YENC_ENCODED; | |
304 | ||
305 | i = strlen (s); | |
310 | 306 | |
311 | 307 | switch (encoding) { |
312 | 308 | case UU_ENCODED: |
317 | 313 | goto _t_B64; |
318 | 314 | case BH_ENCODED: |
319 | 315 | goto _t_Binhex; |
320 | case YENC_ENCODED: | |
321 | return YENC_ENCODED; | |
322 | 316 | } |
323 | 317 | |
324 | 318 | _t_Binhex: /* Binhex Test */ |
541 | 535 | if (strlen (line) > 250) |
542 | 536 | break; |
543 | 537 | ptr = line + strlen (line); |
544 | if (_FP_fgets (ptr, 299-(ptr-line), datei) == NULL) | |
538 | if (FP_fgets (ptr, 299-(ptr-line), datei) == NULL) | |
545 | 539 | break; |
546 | 540 | } |
547 | 541 | else { /* don't need next line to repair */ |
608 | 602 | */ |
609 | 603 | z1 = z2 = z3 = z4 = 0; |
610 | 604 | |
611 | if (method == UU_ENCODED || method == XX_ENCODED) { | |
605 | if (method == YENC_ENCODED) { | |
606 | while (*s) { | |
607 | if (ecb_expect_false (*s == '=')) { | |
608 | if (*++s != '\0') { | |
609 | d[count++] = (char) ((int) *s - 64 - 42); | |
610 | s++; | |
611 | } | |
612 | } | |
613 | #if 0 /* FP_fgets never leaves CR or LF in the buffer, so skip this */ | |
614 | else if (ecb_expect_false (*s == '\n' || *s == '\r')) { | |
615 | s++; /* ignore */ | |
616 | } | |
617 | #endif | |
618 | else { | |
619 | d[count++] = (char) ((int) *s++ - 42); | |
620 | } | |
621 | } | |
622 | } | |
623 | else if (method == UU_ENCODED || method == XX_ENCODED) { | |
612 | 624 | if (method == UU_ENCODED) |
613 | 625 | table = UUxlat; |
614 | 626 | else |
624 | 636 | |
625 | 637 | if(i-- > 0) |
626 | 638 | d[count++] = c; |
627 | ||
639 | ||
628 | 640 | cc <<= 4; |
629 | 641 | c = table[ACAST(*s++)]; |
630 | 642 | cc |= (c >> 2); |
631 | ||
643 | ||
632 | 644 | if(i-- > 0) |
633 | 645 | d[count++] = cc; |
634 | ||
646 | ||
635 | 647 | c <<= 6; |
636 | 648 | c |= table[ACAST(*s++)]; |
637 | ||
649 | ||
638 | 650 | if(i-- > 0) |
639 | 651 | d[count++] = c; |
640 | ||
652 | ||
641 | 653 | j -= 4; |
642 | 654 | } |
643 | 655 | } |
704 | 716 | } |
705 | 717 | while (BHxlat[ACAST(*s)] != -1) |
706 | 718 | uuncdl_fulline[leftover++] = *s++; |
707 | } | |
708 | else if (method == YENC_ENCODED) { | |
709 | while (*s) { | |
710 | if (*s == '=') { | |
711 | if (*++s != '\0') { | |
712 | d[count++] = (char) ((int) *s - 64 - 42); | |
713 | s++; | |
714 | } | |
715 | } | |
716 | else if (*s == '\n' || *s == '\r') { | |
717 | s++; /* ignore */ | |
718 | } | |
719 | else { | |
720 | d[count++] = (char) ((int) *s++ - 42); | |
721 | } | |
722 | } | |
723 | 719 | } |
724 | 720 | |
725 | 721 | return count; |
739 | 735 | |
740 | 736 | uulboundary = -1; |
741 | 737 | |
742 | while (!feof (datain) && | |
738 | while (!FP_feof (datain) && | |
743 | 739 | (ftell(datain)<maxpos || flags&FL_TOEND || |
744 | 740 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
745 | if (_FP_fgets (line, 1023, datain) == NULL) | |
741 | if (FP_fgets (line, 1023, datain) == NULL) | |
746 | 742 | break; |
747 | 743 | if (ferror (datain)) { |
748 | 744 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
814 | 810 | * So if the part ends here, don't print a line break" |
815 | 811 | */ |
816 | 812 | /* something is broken here now, but it was broken before */ |
817 | if (!feof (datain) && | |
813 | if (!FP_feof (datain) && | |
818 | 814 | (ftell(datain)<maxpos || flags&FL_TOEND || |
819 | 815 | (!(flags&FL_PROPER) && uu_fast_scanning))) |
820 | 816 | fprintf (dataout, "%s\n", p1); |
839 | 835 | |
840 | 836 | uulboundary = -1; |
841 | 837 | |
842 | while (!feof (datain) && | |
838 | while (!FP_feof (datain) && | |
843 | 839 | (ftell(datain)<maxpos || flags&FL_TOEND || |
844 | 840 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
845 | if (_FP_fgets (line, 1023, datain) == NULL) | |
841 | if (FP_fgets (line, 1023, datain) == NULL) | |
846 | 842 | break; |
847 | 843 | if (ferror (datain)) { |
848 | 844 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
960 | 956 | int warning=0, vlc=0, lc[2], hadct=0; |
961 | 957 | int tc=0, tf=0, vflag, haddata=0, haddh=0; |
962 | 958 | long yefilesize=0, yepartends=0, yenotlastpart=0; |
963 | crc32_t yepartcrc=crc32(0L, Z_NULL, 0); | |
964 | static crc32_t yefilecrc=0; | |
959 | crc32_t yepartcrc=CRC32_INIT; | |
960 | static crc32_t yefilecrc; | |
965 | 961 | static int bhflag=0; |
966 | 962 | size_t count=0; |
967 | 963 | size_t yepartsize=0; |
968 | 964 | char *ptr; |
969 | 965 | |
970 | 966 | if (datain == NULL || dataout == NULL) { |
971 | yefilecrc = crc32(0L, Z_NULL, 0); | |
967 | yefilecrc = CRC32_INIT; | |
972 | 968 | bhflag = 0; |
973 | 969 | return UURET_OK; |
974 | 970 | } |
993 | 989 | *state = BEGIN; |
994 | 990 | } |
995 | 991 | |
996 | while (!feof (datain) && *state != DONE && | |
992 | while (!FP_feof (datain) && *state != DONE && | |
997 | 993 | (ftell(datain)<maxpos || flags&FL_TOEND || maxpos==-1 || |
998 | 994 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
999 | if (_FP_fgets ((line = uugen_fnbuffer), 1200 - 5, datain) == NULL) | |
995 | if (FP_fgets ((line = uugen_fnbuffer), 1200 - 5, datain) == NULL) | |
1000 | 996 | break; |
1001 | 997 | |
1002 | 998 | /* optionally skip .. */ |
1027 | 1023 | vlc = 0; |
1028 | 1024 | continue; |
1029 | 1025 | } |
1030 | ||
1026 | ||
1031 | 1027 | /* |
1032 | 1028 | * Busy Polls |
1033 | 1029 | */ |
1060 | 1056 | |
1061 | 1057 | if ((flags&FL_PROPER) == 0) { |
1062 | 1058 | if (strncmp (line, "BEGIN", 5) == 0 && |
1063 | _FP_strstr (line, "CUT HERE") && !tf) { /* I hate these lines */ | |
1059 | FP_strstr (line, "CUT HERE") && !tf) { /* I hate these lines */ | |
1064 | 1060 | tc = tf = vlc = 0; |
1065 | 1061 | continue; |
1066 | 1062 | } |
1076 | 1072 | haddh = 1; |
1077 | 1073 | continue; |
1078 | 1074 | } |
1079 | if (_FP_strnicmp (line, "Content-Type", 12) == 0) | |
1075 | if (FP_strnicmp (line, "Content-Type", 12) == 0) | |
1080 | 1076 | hadct = 1; |
1081 | 1077 | } |
1082 | 1078 | |
1083 | 1079 | if (*state == BEGIN) { |
1084 | 1080 | if ((method == UU_ENCODED || method == XX_ENCODED) && |
1085 | 1081 | (strncmp (line, "begin ", 6) == 0 || |
1086 | _FP_strnicmp (line, "<pre>begin ", 11) == 0)) { /* for LYNX */ | |
1082 | FP_strnicmp (line, "<pre>begin ", 11) == 0)) { /* for LYNX */ | |
1087 | 1083 | *state = DATA; |
1088 | 1084 | continue; |
1089 | 1085 | } |
1097 | 1093 | } |
1098 | 1094 | else if (method == YENC_ENCODED && |
1099 | 1095 | strncmp (line, "=ybegin ", 8) == 0 && |
1100 | _FP_strstr (line, " name=") != NULL) { | |
1096 | FP_strstr (line, " name=") != NULL) { | |
1101 | 1097 | *state = DATA; |
1102 | 1098 | |
1103 | if ((ptr = _FP_strstr (line, " size=")) != NULL) { | |
1099 | if ((ptr = FP_strstr (line, " size=")) != NULL) { | |
1104 | 1100 | ptr += 6; |
1105 | 1101 | yefilesize = atoi (ptr); |
1106 | 1102 | } |
1108 | 1104 | yefilesize = -1; |
1109 | 1105 | } |
1110 | 1106 | |
1111 | if ((ptr =_FP_strstr (line, " part="))) { | |
1107 | if ((ptr =FP_strstr (line, " part="))) { | |
1112 | 1108 | int partno = atoi (ptr + 6); |
1113 | ||
1114 | if ((ptr = _FP_strstr (line, " total="))) | |
1109 | ||
1110 | if ((ptr = FP_strstr (line, " total="))) | |
1115 | 1111 | yenotlastpart = atoi (ptr + 7) != partno; |
1116 | 1112 | |
1117 | if (_FP_fgets (line, 1200 - 5, datain) == NULL) { | |
1113 | if (FP_fgets (line, 1200 - 5, datain) == NULL) { | |
1118 | 1114 | break; |
1119 | 1115 | } |
1120 | 1116 | |
1121 | if ((ptr = _FP_strstr (line, " end=")) == NULL) { | |
1117 | if ((ptr = FP_strstr (line, " end=")) == NULL) { | |
1122 | 1118 | break; |
1123 | 1119 | } |
1124 | 1120 | |
1130 | 1126 | else { |
1131 | 1127 | continue; |
1132 | 1128 | } |
1133 | ||
1129 | ||
1134 | 1130 | tc = tf = vlc = 0; |
1135 | 1131 | lc[0] = lc[1] = 0; |
1136 | 1132 | } |
1144 | 1140 | |
1145 | 1141 | if (*state == DATA && method == YENC_ENCODED && |
1146 | 1142 | strncmp (line, "=yend ", 6) == 0) { |
1147 | if ((ptr = _FP_strstr (line, " pcrc32=")) != NULL) { | |
1143 | int lastpart = !yenotlastpart && (yepartends == 0 || yepartends >= yefilesize); | |
1144 | yefilecrc = uu_crc32_combine(yefilecrc, yepartcrc, yepartsize); | |
1145 | if ((ptr = FP_strstr (line, " pcrc32=")) != NULL) { | |
1148 | 1146 | crc32_t pcrc32 = strtoul (ptr + 8, NULL, 16); |
1149 | 1147 | if (pcrc32 != yepartcrc) { |
1150 | 1148 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, |
1151 | 1149 | uustring (S_PCRC_MISMATCH), progress.curfile, progress.partno); |
1152 | 1150 | } |
1153 | } | |
1154 | if ((ptr = _FP_strstr (line, " crc32=")) != NULL) | |
1151 | } else if ((ptr = FP_strstr (line, " pcrc=")) != NULL) { | |
1152 | crc32_t pcrc32 = strtoul (ptr + 6, NULL, 16); | |
1153 | if (pcrc32 != yepartcrc) { | |
1154 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, | |
1155 | uustring (S_PCRC_MISMATCH), progress.curfile, progress.partno); | |
1156 | } | |
1157 | } | |
1158 | if (lastpart && (ptr = FP_strstr (line, " crc32=")) != NULL) | |
1155 | 1159 | { |
1156 | 1160 | crc32_t fcrc32 = strtoul (ptr + 7, NULL, 16); |
1157 | 1161 | if (fcrc32 != yefilecrc) { |
1159 | 1163 | uustring (S_CRC_MISMATCH), progress.curfile); |
1160 | 1164 | } |
1161 | 1165 | } |
1162 | if ((ptr = _FP_strstr (line, " size=")) != NULL) | |
1166 | if ((ptr = FP_strstr (line, " size=")) != NULL) | |
1163 | 1167 | { |
1164 | 1168 | size_t size = atol(ptr + 6); |
1165 | 1169 | if (size != yepartsize && yefilesize != -1) { |
1173 | 1177 | yepartsize, size); |
1174 | 1178 | } |
1175 | 1179 | } |
1176 | if (!yenotlastpart && (yepartends == 0 || yepartends >= yefilesize)) { | |
1180 | if (lastpart) { | |
1177 | 1181 | *state = DONE; |
1178 | 1182 | } |
1179 | 1183 | break; |
1201 | 1205 | if (tf) { |
1202 | 1206 | count = UUDecodeLine (line, oline, method); |
1203 | 1207 | if (method == YENC_ENCODED) { |
1204 | yepartcrc = crc32(yepartcrc, oline, count); | |
1205 | yefilecrc = crc32(yefilecrc, oline, count); | |
1208 | yepartcrc = uu_crc32(yepartcrc, oline, count); | |
1206 | 1209 | yepartsize += count; |
1207 | 1210 | } |
1208 | 1211 | vlc++; lc[1]++; |
1230 | 1233 | lc[1] = 3; |
1231 | 1234 | } |
1232 | 1235 | else { |
1233 | _FP_strncpy (save[tc++], line, 1200); | |
1236 | FP_strncpy (save[tc++], line, 1200); | |
1234 | 1237 | } |
1235 | 1238 | |
1236 | 1239 | if (method == UU_ENCODED) |
1275 | 1278 | if (*state == DONE || |
1276 | 1279 | (*state == DATA && method == B64ENCODED && |
1277 | 1280 | vflag == B64ENCODED && (flags&FL_PROPER || haddh))) { |
1278 | for (tf=0; tf<tc; tf++) | |
1281 | for (tf=0; tf<tc; tf++) | |
1279 | 1282 | count += UUDecodeLine (save[tf], oline + count, method); |
1280 | 1283 | if (count) { |
1281 | 1284 | if (method == BH_ENCODED) { |
1347 | 1350 | |
1348 | 1351 | if (!data->binfile) { |
1349 | 1352 | #else |
1350 | if ((data->binfile = tempnam (NULL, "uu")) == NULL) { | |
1353 | if ((data->binfile = tmpnam (NULL)) == NULL) { | |
1351 | 1354 | #endif /* HAVE_MKSTEMP */ |
1352 | 1355 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1353 | 1356 | uustring (S_NO_TEMP_NAME)); |
1359 | 1362 | strcat(data->binfile, "/"); |
1360 | 1363 | strcat(data->binfile, tmpprefix); |
1361 | 1364 | |
1362 | if ((tmpfd = mkstemp(data->binfile)) == -1 || | |
1365 | if ((tmpfd = mkstemp(data->binfile)) == -1 || | |
1363 | 1366 | (dataout = fdopen(tmpfd, mode)) == NULL) { |
1364 | 1367 | #else |
1365 | 1368 | if ((dataout = fopen (data->binfile, mode)) == NULL) { |
1377 | 1380 | close(tmpfd); |
1378 | 1381 | } |
1379 | 1382 | #endif /* HAVE_MKSTEMP */ |
1380 | _FP_free (data->binfile); | |
1383 | FP_free (data->binfile); | |
1381 | 1384 | data->binfile = NULL; |
1382 | 1385 | uu_errno = errno; |
1383 | 1386 | return UURET_IOERR; |
1384 | 1387 | } |
1385 | 1388 | UUSETBUF (dataout, dataout_buf, uu_wbuf); |
1389 | FP_flockfile (dataout); | |
1386 | 1390 | |
1387 | 1391 | /* |
1388 | 1392 | * we don't have begin lines in Base64 or plain text files. |
1408 | 1412 | */ |
1409 | 1413 | progress.action = 0; |
1410 | 1414 | if (data->filename != NULL) { |
1411 | _FP_strncpy (progress.curfile, | |
1415 | FP_strncpy (progress.curfile, | |
1412 | 1416 | (strlen(data->filename)>255)? |
1413 | 1417 | (data->filename+strlen(data->filename)-255):data->filename, |
1414 | 1418 | 256); |
1415 | 1419 | } |
1416 | 1420 | else { |
1417 | _FP_strncpy (progress.curfile, | |
1421 | FP_strncpy (progress.curfile, | |
1418 | 1422 | (strlen(data->binfile)>255)? |
1419 | 1423 | (data->binfile+strlen(data->binfile)-255):data->binfile, |
1420 | 1424 | 256); |
1430 | 1434 | progress.numparts = (iter->partno)?iter->partno:1; |
1431 | 1435 | iter = iter->NEXT; |
1432 | 1436 | } |
1433 | ||
1437 | ||
1434 | 1438 | /* |
1435 | 1439 | * let's rock! |
1436 | 1440 | */ |
1473 | 1477 | res = UURET_IOERR; |
1474 | 1478 | break; |
1475 | 1479 | } |
1476 | _FP_strncpy (uugen_fnbuffer, iter->data->sfname, 1024); | |
1480 | FP_strncpy (uugen_fnbuffer, iter->data->sfname, 1024); | |
1477 | 1481 | } |
1478 | 1482 | UUSETBUF (datain, datain_buf, uu_rbuf); |
1483 | FP_flockfile (datain); | |
1479 | 1484 | |
1480 | 1485 | progress.partno = part; |
1481 | 1486 | progress.fsize = (iter->data->length)?iter->data->length:-1; |
1498 | 1503 | iter = iter->NEXT; |
1499 | 1504 | } |
1500 | 1505 | |
1501 | if (state == DATA && | |
1506 | if (state == DATA && | |
1502 | 1507 | (data->uudet == B64ENCODED || data->uudet == QP_ENCODED || |
1503 | 1508 | data->uudet == PT_ENCODED)) |
1504 | 1509 | state = DONE; /* assume we're done */ |
1513 | 1518 | |
1514 | 1519 | if (res != UURET_OK || (state != DONE && !uu_desperate)) { |
1515 | 1520 | unlink (data->binfile); |
1516 | _FP_free (data->binfile); | |
1521 | FP_free (data->binfile); | |
1517 | 1522 | data->binfile = NULL; |
1518 | 1523 | data->state &= ~UUFILE_TMPFILE; |
1519 | 1524 | data->state |= UUFILE_ERROR; |
1536 | 1541 | |
1537 | 1542 | if (data->uudet == BH_ENCODED && data->binfile) { |
1538 | 1543 | #ifdef HAVE_MKSTEMP |
1539 | ntmp = malloc(strlen(tmpdir)+strlen(tmpprefix)+2); | |
1540 | ||
1541 | if (ntmp == NULL) { | |
1544 | ntmp = malloc(strlen(tmpdir)+strlen(tmpprefix)+2); | |
1542 | 1545 | #else |
1543 | if ((ntmp = tempnam (NULL, "uu")) == NULL) { | |
1546 | ntmp = tempnam (NULL); | |
1544 | 1547 | #endif /* HAVE_MKSTEMP */ |
1548 | if (ntmp == NULL) { | |
1545 | 1549 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1546 | 1550 | uustring (S_NO_TEMP_NAME)); |
1547 | 1551 | progress.action = 0; |
1556 | 1560 | return UURET_IOERR; |
1557 | 1561 | } |
1558 | 1562 | UUSETBUF (datain, datain_buf, uu_rbuf); |
1563 | FP_flockfile (datain); | |
1559 | 1564 | |
1560 | 1565 | #ifdef HAVE_MKSTEMP |
1561 | 1566 | strcpy(ntmp, tmpdir); |
1562 | 1567 | strcat(ntmp, "/"); |
1563 | strcat(ntmp, tmpprefix); | |
1568 | strcat(ntmp, tmpprefix); | |
1564 | 1569 | if ((tmpfd = mkstemp(ntmp)) == -1 || |
1565 | 1570 | (dataout = fdopen(tmpfd, "wb")) == NULL) { |
1566 | 1571 | #else |
1582 | 1587 | return UURET_IOERR; |
1583 | 1588 | } |
1584 | 1589 | UUSETBUF (dataout, dataout_buf, uu_wbuf); |
1590 | FP_flockfile (dataout); | |
1585 | 1591 | |
1586 | 1592 | /* |
1587 | 1593 | * read fork lengths. remember they're in Motorola format |
1588 | 1594 | */ |
1589 | r[0] = _FP_fgetc (datain); | |
1595 | r[0] = FP_getc (datain); | |
1590 | 1596 | hb = (int) r[0] + 22; |
1591 | 1597 | fseek (datain, (int) r[0] + 12, SEEK_SET); |
1592 | 1598 | fread (r, 1, 8, datain); |
1632 | 1638 | * copy the chosen fork |
1633 | 1639 | */ |
1634 | 1640 | |
1635 | while (!feof (datain) && numbytes) { | |
1641 | while (!FP_feof (datain) && numbytes) { | |
1636 | 1642 | if (UUBUSYPOLL(ftell(datain)-progress.foffset,progress.fsize)) { |
1637 | 1643 | UUMessage (uunconc_id, __LINE__, UUMSG_NOTE, |
1638 | 1644 | uustring (S_DECODE_CANCEL)); |
1648 | 1654 | bytes = fread (uugen_inbuffer, 1, |
1649 | 1655 | (size_t) ((numbytes>1024)?1024:numbytes), datain); |
1650 | 1656 | |
1651 | if (ferror (datain) || (bytes == 0 && !feof (datain))) { | |
1657 | if (ferror (datain) || (bytes == 0 && !FP_feof (datain))) { | |
1652 | 1658 | progress.action = 0; |
1653 | 1659 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1654 | 1660 | uustring (S_SOURCE_READ_ERR), |
1734 | 1740 | memset (&myenv, 0, sizeof (headers)); |
1735 | 1741 | UUScanHeader (datain, &myenv); |
1736 | 1742 | |
1737 | if (_FP_stristr (myenv.ctenc, "uu") != NULL) | |
1743 | if (FP_stristr (myenv.ctenc, "uu") != NULL) | |
1738 | 1744 | encoding = UU_ENCODED; |
1739 | else if (_FP_stristr (myenv.ctenc, "xx") != NULL) | |
1745 | else if (FP_stristr (myenv.ctenc, "xx") != NULL) | |
1740 | 1746 | encoding = XX_ENCODED; |
1741 | else if (_FP_stricmp (myenv.ctenc, "base64") == 0) | |
1747 | else if (FP_stricmp (myenv.ctenc, "base64") == 0) | |
1742 | 1748 | encoding = B64ENCODED; |
1743 | else if (_FP_stricmp (myenv.ctenc, "quoted-printable") == 0) | |
1749 | else if (FP_stricmp (myenv.ctenc, "quoted-printable") == 0) | |
1744 | 1750 | encoding = QP_ENCODED; |
1745 | 1751 | else |
1746 | 1752 | encoding = PT_ENCODED; |
16 | 16 | /* |
17 | 17 | * These are very central functions of UUDeview. Here, we scan a file |
18 | 18 | * and decide whether it contains encoded data or not. ScanPart() must |
19 | * be called repeatedly on the same file until feof(file). Each time, | |
19 | * be called repeatedly on the same file until FP_feof(file). Each time, | |
20 | 20 | * it returns information about the next part found within. |
21 | 21 | */ |
22 | 22 | |
66 | 66 | * to scan the bodies from partial multipart messages. |
67 | 67 | */ |
68 | 68 | |
69 | #define LSTR(s) { sizeof (s) - 1, s } | |
69 | #define LSTR(s) { (s), sizeof (s) - 1 } | |
70 | 70 | |
71 | 71 | struct lstr { |
72 | const char *str; | |
72 | 73 | int len; |
73 | const char *str; | |
74 | 74 | }; |
75 | 75 | |
76 | 76 | #define MAX_KNOWNHEADERLEN 28 /* max. length of a known header */ |
77 | 77 | |
78 | static struct lstr knownheaders[] = { | |
78 | static const struct lstr knownheaders[] = { | |
79 | 79 | /* "From " handled in IsKnownHeader */ |
80 | 80 | |
81 | 81 | /* knownmsgheaders */ |
85 | 85 | LSTR ("Resent-To"), LSTR ("Cc"), LSTR ("Bcc"), LSTR ("Resent-bcc"), |
86 | 86 | LSTR ("Message-ID"), LSTR ("Resent-Message-Id"), LSTR ("In-Reply-To"), |
87 | 87 | LSTR ("References"), LSTR ("Keywords"), LSTR ("Subject"), LSTR ("Comments"), |
88 | ||
88 | ||
89 | 89 | LSTR ("Delivery-Date"), LSTR ("Posted-Date"), LSTR ("Received-Date"), |
90 | LSTR ("Precedence"), | |
90 | LSTR ("Precedence"), | |
91 | 91 | |
92 | 92 | LSTR ("Path"), LSTR ("Newsgroups"), LSTR ("Organization"), LSTR ("Lines"), |
93 | 93 | LSTR ("NNTP-Posting-Host"), |
94 | 94 | |
95 | 95 | /* knownminehaders */ |
96 | 96 | LSTR ("Mime-Version"), LSTR ("Content-Transfer-Encoding"), |
97 | LSTR ("Content-Type"), LSTR ("Content-Disposition"), | |
97 | LSTR ("Content-Type"), LSTR ("Content-Disposition"), | |
98 | 98 | LSTR ("Content-Description"), LSTR ("Content-Length") |
99 | 99 | }; |
100 | 100 | |
181 | 181 | ScanHeaderLine (FILE *datei, char *initial) |
182 | 182 | { |
183 | 183 | char *ptr=uuscan_shlline; |
184 | char *ptr2, *p1, *p2, *p3; | |
184 | char *ptr2, *p2, *p3; | |
185 | 185 | int llength, c; |
186 | 186 | long curpos; |
187 | 187 | |
188 | 188 | if (initial) { |
189 | _FP_strncpy (uuscan_shlline, initial, 1024); | |
189 | FP_strncpy (uuscan_shlline, initial, 1024); | |
190 | 190 | } else { |
191 | 191 | /* read first line */ |
192 | if (feof (datei) || ferror (datei)) | |
192 | if (FP_feof (datei) || ferror (datei)) | |
193 | 193 | return NULL; |
194 | if (_FP_fgets (uuscan_shlline, 1024, datei) == NULL) | |
194 | if (FP_fgets (uuscan_shlline, 1024, datei) == NULL) | |
195 | 195 | return NULL; |
196 | 196 | } |
197 | 197 | |
205 | 205 | if (llength == 0) |
206 | 206 | return uuscan_shlline; |
207 | 207 | |
208 | while (!feof (datei)) { | |
209 | c = _FP_fgetc (datei); | |
208 | while (!FP_feof (datei)) { | |
209 | c = FP_getc (datei); | |
210 | 210 | if (c == EOF) |
211 | 211 | break; |
212 | 212 | |
216 | 216 | break; |
217 | 217 | } |
218 | 218 | |
219 | while (!feof (datei) && (c == ' ' || c == '\t')) | |
220 | c = _FP_fgetc (datei); | |
221 | ||
222 | if (!feof (datei)) | |
219 | while (!FP_feof (datei) && (c == ' ' || c == '\t')) | |
220 | c = FP_getc (datei); | |
221 | ||
222 | if (!FP_feof (datei)) | |
223 | 223 | ungetc (c, datei); /* push back for fgets() */ |
224 | 224 | else |
225 | 225 | break; |
226 | 226 | |
227 | 227 | /* read next line */ |
228 | 228 | curpos = ftell (datei); |
229 | if (_FP_fgets (uugen_inbuffer, 1024, datei) == NULL) | |
229 | if (FP_fgets (uugen_inbuffer, 1024, datei) == NULL) | |
230 | 230 | break; |
231 | 231 | |
232 | 232 | if (IsLineEmpty (uugen_inbuffer)) { /* oops */ |
234 | 234 | break; |
235 | 235 | } |
236 | 236 | |
237 | _FP_strncpy (ptr, uugen_inbuffer, 1024-llength); | |
237 | FP_strncpy (ptr, uugen_inbuffer, 1024-llength); | |
238 | 238 | |
239 | 239 | c = strlen (ptr); |
240 | 240 | |
268 | 268 | |
269 | 269 | if (*ptr == '=' && *(ptr+1) == '?') { |
270 | 270 | /* |
271 | * Let p1 point to the charset, look for next question mark | |
271 | * Let p2 point to the charset, look for next question mark | |
272 | 272 | */ |
273 | 273 | |
274 | p1 = p2 = ptr+2; | |
274 | p2 = ptr+2; | |
275 | 275 | |
276 | 276 | while (*p2 && *p2 != '?') { |
277 | 277 | p2++; |
409 | 409 | if (line == NULL) |
410 | 410 | return theheaders; |
411 | 411 | |
412 | if (_FP_strnicmp (line, "From:", 5) == 0) { | |
412 | if (FP_strnicmp_fast (line, "From:", 5) == 0) { | |
413 | 413 | if (theheaders->from) return theheaders; |
414 | 414 | variable = &theheaders->from; |
415 | 415 | value = line+5; |
416 | 416 | delimit = 0; |
417 | 417 | } |
418 | else if (_FP_strnicmp (line, "Subject:", 8) == 0) { | |
418 | else if (FP_strnicmp_fast (line, "Subject:", 8) == 0) { | |
419 | 419 | if (theheaders->subject) return theheaders; |
420 | 420 | variable = &theheaders->subject; |
421 | 421 | value = line+8; |
422 | 422 | delimit = 0; |
423 | 423 | } |
424 | else if (_FP_strnicmp (line, "To:", 3) == 0) { | |
424 | else if (FP_strnicmp_fast (line, "To:", 3) == 0) { | |
425 | 425 | if (theheaders->rcpt) return theheaders; |
426 | 426 | variable = &theheaders->rcpt; |
427 | 427 | value = line+3; |
428 | 428 | delimit = 0; |
429 | 429 | } |
430 | else if (_FP_strnicmp (line, "Date:", 5) == 0) { | |
430 | else if (FP_strnicmp_fast (line, "Date:", 5) == 0) { | |
431 | 431 | if (theheaders->date) return theheaders; |
432 | 432 | variable = &theheaders->date; |
433 | 433 | value = line+5; |
434 | 434 | delimit = 0; |
435 | 435 | } |
436 | else if (_FP_strnicmp (line, "Mime-Version:", 13) == 0) { | |
436 | else if (FP_strnicmp_fast (line, "Mime-Version:", 13) == 0) { | |
437 | 437 | if (theheaders->mimevers) return theheaders; |
438 | 438 | variable = &theheaders->mimevers; |
439 | 439 | value = line+13; |
440 | 440 | delimit = 0; |
441 | 441 | } |
442 | else if (_FP_strnicmp (line, "Content-Type:", 13) == 0) { | |
442 | else if (FP_strnicmp_fast (line, "Content-Type:", 13) == 0) { | |
443 | 443 | if (theheaders->ctype) return theheaders; |
444 | 444 | variable = &theheaders->ctype; |
445 | 445 | value = line+13; |
446 | 446 | delimit = ';'; |
447 | 447 | |
448 | 448 | /* we can probably extract more information */ |
449 | if ((ptr = _FP_stristr (line, "boundary")) != NULL) { | |
449 | if ((ptr = FP_stristr (line, "boundary")) != NULL) { | |
450 | 450 | if ((thenew = ParseValue (ptr))) { |
451 | 451 | if (theheaders->boundary) free (theheaders->boundary); |
452 | theheaders->boundary = _FP_strdup (thenew); | |
453 | } | |
454 | } | |
455 | if ((ptr = _FP_stristr (line, "name")) != NULL) { | |
452 | theheaders->boundary = FP_strdup (thenew); | |
453 | } | |
454 | } | |
455 | if ((ptr = FP_stristr (line, "name")) != NULL) { | |
456 | 456 | if ((thenew = ParseValue (ptr))) { |
457 | 457 | if (theheaders->fname) free (theheaders->fname); |
458 | theheaders->fname = _FP_strdup (thenew); | |
459 | } | |
460 | } | |
461 | if ((ptr = _FP_stristr (line, "id")) != NULL) { | |
458 | theheaders->fname = FP_strdup (thenew); | |
459 | } | |
460 | } | |
461 | if ((ptr = FP_stristr (line, "id")) != NULL) { | |
462 | 462 | if ((thenew = ParseValue (ptr))) { |
463 | 463 | if (theheaders->mimeid) free (theheaders->mimeid); |
464 | theheaders->mimeid = _FP_strdup (thenew); | |
465 | } | |
466 | } | |
467 | if ((ptr = _FP_stristr (line, "number")) != NULL) { | |
464 | theheaders->mimeid = FP_strdup (thenew); | |
465 | } | |
466 | } | |
467 | if ((ptr = FP_stristr (line, "number")) != NULL) { | |
468 | 468 | if ((thenew = ParseValue (ptr))) { |
469 | 469 | theheaders->partno = atoi (thenew); |
470 | 470 | } |
471 | 471 | } |
472 | if ((ptr = _FP_stristr (line, "total")) != NULL) { | |
472 | if ((ptr = FP_stristr (line, "total")) != NULL) { | |
473 | 473 | if ((thenew = ParseValue (ptr))) { |
474 | 474 | theheaders->numparts = atoi (thenew); |
475 | 475 | } |
476 | 476 | } |
477 | 477 | } |
478 | else if (_FP_strnicmp (line, "Content-Transfer-Encoding:", 26) == 0) { | |
478 | else if (FP_strnicmp_fast (line, "Content-Transfer-Encoding:", 26) == 0) { | |
479 | 479 | if (theheaders->ctenc) return theheaders; |
480 | 480 | variable = &theheaders->ctenc; |
481 | 481 | value = line+26; |
482 | 482 | delimit = ';'; |
483 | 483 | } |
484 | else if (_FP_strnicmp (line, "Content-Disposition:", 20) == 0) { | |
484 | else if (FP_strnicmp_fast (line, "Content-Disposition:", 20) == 0) { | |
485 | 485 | /* |
486 | 486 | * Some encoders mention the original filename as parameter to |
487 | 487 | * Content-Type, others as parameter to Content-Disposition. We |
488 | 488 | * do prefer the first solution, but accept this situation, too. |
489 | 489 | * TODO: Read RFC1806 |
490 | 490 | */ |
491 | if ((ptr = _FP_stristr (line, "name")) != NULL) { | |
491 | if ((ptr = FP_stristr (line, "name")) != NULL) { | |
492 | 492 | if (theheaders->fname == NULL && (thenew=ParseValue(ptr)) != NULL) { |
493 | theheaders->fname = _FP_strdup (thenew); | |
493 | theheaders->fname = FP_strdup (thenew); | |
494 | 494 | } |
495 | 495 | } |
496 | 496 | variable = NULL; |
521 | 521 | } |
522 | 522 | *ptr = '\0'; |
523 | 523 | |
524 | if ((*variable = _FP_strdup (uuscan_phtext)) == NULL) | |
524 | if ((*variable = FP_strdup (uuscan_phtext)) == NULL) | |
525 | 525 | return NULL; |
526 | 526 | } |
527 | 527 | |
553 | 553 | len = sep - line; /* length of part before ':' */ |
554 | 554 | |
555 | 555 | for (i = 0; i < sizeof (knownheaders) / sizeof (knownheaders [0]); ++i) |
556 | if (len == knownheaders [i].len && _FP_strnicmp (line, knownheaders [i].str, len) == 0) | |
556 | if (len == knownheaders [i].len && FP_strnicmp_fast (line, knownheaders [i].str, len) == 0) | |
557 | 557 | return 1; |
558 | 558 | |
559 | 559 | return 0; |
568 | 568 | { |
569 | 569 | char *ptr; |
570 | 570 | |
571 | while (!feof (datei)) { | |
571 | while (!FP_feof (datei)) { | |
572 | 572 | if ((ptr = ScanHeaderLine (datei, NULL)) == NULL) |
573 | 573 | break; |
574 | 574 | if (*ptr == '\0') |
591 | 591 | * MIME handling. |
592 | 592 | */ |
593 | 593 | |
594 | static int | |
594 | ecb_hot static int | |
595 | 595 | ScanData (FILE *datei, char *fname, int *errcode, |
596 | 596 | char *boundary, int ismime, int checkheaders, |
597 | 597 | fileread *result) |
612 | 612 | (void) UUDecodeLine (NULL, NULL, 0); /* init */ |
613 | 613 | bhdsp = bhds2; |
614 | 614 | |
615 | if (datei == NULL || feof (datei)) | |
615 | if (datei == NULL || FP_feof (datei)) | |
616 | 616 | return -1; |
617 | 617 | |
618 | 618 | result->startpos = ftell (datei); |
628 | 628 | if (boundary) |
629 | 629 | blen = strlen (boundary); |
630 | 630 | |
631 | while (!feof (datei)) { | |
631 | while (!FP_feof (datei)) { | |
632 | 632 | oldposition = ftell (datei); |
633 | if (_FP_fgets (line, 1024, datei) == NULL) | |
633 | if (FP_fgets (line, 1024, datei) == NULL) | |
634 | 634 | break; |
635 | 635 | if (ferror (datei)) |
636 | 636 | break; |
696 | 696 | dontcare=0; |
697 | 697 | } |
698 | 698 | |
699 | if (boundary != NULL && | |
699 | if (boundary != NULL && | |
700 | 700 | line[0] == '-' && line[1] == '-' && |
701 | 701 | strncmp (line+2, boundary, blen) == 0) { |
702 | 702 | fseek (datei, oldposition, SEEK_SET); |
703 | 703 | break; |
704 | 704 | } |
705 | 705 | if (boundary != NULL && line[0] == 'C' && line[1] == 'o' && |
706 | _FP_strnicmp (line, "Content-Type:", 13) == 0) { | |
706 | FP_strnicmp_fast (line, "Content-Type:", 13) == 0) { | |
707 | 707 | ptr = ScanHeaderLine (datei, line); |
708 | p2 = (ptr)?_FP_stristr(ptr,"boundary"):NULL; | |
708 | p2 = (ptr)?FP_stristr(ptr,"boundary"):NULL; | |
709 | 709 | p3 = (p2)?ParseValue(p2):NULL; |
710 | 710 | |
711 | 711 | if (p3 && strcmp (p3, boundary) == 0) { |
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
720 | if (strncmp (line, "begin ", 6) == 0 || | |
721 | _FP_strnicmp (line, "<pre>begin ", 11) == 0) { | |
720 | if (strncmp (line, "begin ", 6) == 0 || | |
721 | FP_strnicmp_fast (line, "<pre>begin ", 11) == 0) { | |
722 | 722 | if ((result->begin || result->end || |
723 | 723 | result->uudet == B64ENCODED || |
724 | 724 | result->uudet == BH_ENCODED) && !uu_more_mime) { |
725 | 725 | fseek (datei, oldposition, SEEK_SET); |
726 | 726 | break; |
727 | 727 | } |
728 | ||
728 | ||
729 | 729 | if (*line == '<') |
730 | 730 | ptr = line + 10; |
731 | 731 | else |
732 | 732 | ptr = line + 5; |
733 | 733 | |
734 | 734 | while (*ptr == ' ') ptr++; |
735 | while (isdigit (*ptr)) | |
735 | while (isdigit (*ptr)) | |
736 | 736 | result->mode = result->mode * 8 + *ptr++ - '0'; |
737 | 737 | while (*ptr == ' ') ptr++; |
738 | 738 | |
739 | 739 | /* |
740 | 740 | * We may have picked up a filename from a uuenview-style header |
741 | 741 | */ |
742 | _FP_free (result->filename); | |
743 | result->filename = _FP_strdup (ptr); | |
742 | FP_free (result->filename); | |
743 | result->filename = FP_strdup (ptr); | |
744 | 744 | result->begin = 1; |
745 | 745 | |
746 | 746 | while (isspace (result->filename[strlen(result->filename)-1])) |
769 | 769 | * Detect a UUDeview-Style header |
770 | 770 | */ |
771 | 771 | |
772 | if (_FP_strnicmp (line, "_=_ Part ", 9) == 0 && | |
772 | if (FP_strnicmp_fast (line, "_=_ Part ", 9) == 0 && | |
773 | 773 | result->uudet != YENC_ENCODED) { |
774 | 774 | if (result->uudet) { |
775 | 775 | fseek (datei, oldposition, SEEK_SET); |
776 | 776 | break; |
777 | 777 | } |
778 | 778 | result->partno = atoi (line + 8); |
779 | if ((ptr = _FP_stristr (line, "of file ")) != NULL) { | |
779 | if ((ptr = FP_stristr (line, "of file ")) != NULL) { | |
780 | 780 | ptr += 8; |
781 | 781 | while (isspace (*ptr)) ptr++; |
782 | 782 | p2 = ptr; |
783 | while (isalnum(*p2) || | |
783 | while (isalnum(*p2) || | |
784 | 784 | *p2 == '.' || *p2=='_' || *p2 == '-' || |
785 | 785 | *p2 == '!' || *p2=='@' || *p2 == '$') |
786 | 786 | p2++; |
787 | 787 | c = *p2; *p2 = '\0'; |
788 | 788 | if (p2 != ptr && result->filename == NULL) |
789 | result->filename = _FP_strdup (ptr); | |
789 | result->filename = FP_strdup (ptr); | |
790 | 790 | else if (p2 - ptr > 5 && strchr (ptr, '.') != NULL) { |
791 | 791 | /* |
792 | 792 | * This file name looks good, too. Let's use it |
793 | 793 | */ |
794 | _FP_free (result->filename); | |
795 | result->filename = _FP_strdup (ptr); | |
794 | FP_free (result->filename); | |
795 | result->filename = FP_strdup (ptr); | |
796 | 796 | } |
797 | 797 | *p2 = c; |
798 | 798 | } |
804 | 804 | */ |
805 | 805 | if (boundary == NULL && !ismime && !uu_more_mime && |
806 | 806 | result->uudet != YENC_ENCODED) { |
807 | if (_FP_strnicmp (line, "Content-Type", 12) == 0 || | |
808 | _FP_strnicmp (line, "X-Orcl-Content-Type", 19) == 0) { | |
807 | if (FP_strnicmp_fast (line, "Content-Type", 12) == 0 || | |
808 | FP_strnicmp_fast (line, "X-Orcl-Content-Type", 19) == 0) { | |
809 | 809 | /* |
810 | 810 | * We use Content-Type to mark a new attachment and split the file. |
811 | 811 | * However, we do not split if we haven't found anything encoded yet. |
816 | 816 | } |
817 | 817 | if ((ptr = strchr (line, ':')) != NULL) { |
818 | 818 | ptr++; |
819 | while (isspace (*ptr)) ptr++; p2 = ptr; | |
820 | while (!isspace (*p2) && *p2 != ';') p2++; | |
819 | while (isspace (*ptr)) ptr++; | |
820 | p2 = ptr; | |
821 | while (*p2 && !isspace (*p2) && *p2 != ';') p2++; | |
821 | 822 | c = *p2; *p2 = '\0'; |
822 | 823 | if (p2 != ptr) { |
823 | _FP_free (result->mimetype); | |
824 | result->mimetype = _FP_strdup (ptr); | |
824 | FP_free (result->mimetype); | |
825 | result->mimetype = FP_strdup (ptr); | |
825 | 826 | } |
826 | 827 | *p2 = c; |
827 | 828 | } |
828 | 829 | ctline=0; |
829 | 830 | hadct=1; |
830 | 831 | } |
831 | if ((ptr = _FP_stristr (line, "number=")) && ctline<4) { | |
832 | if ((ptr = FP_stristr (line, "number=")) && ctline<4) { | |
832 | 833 | ptr += 7; if (*ptr == '"') ptr++; |
833 | 834 | result->partno = atoi (ptr); |
834 | 835 | } |
835 | if ((ptr = _FP_stristr (line, "total=")) && ctline<4) { | |
836 | if ((ptr = FP_stristr (line, "total=")) && ctline<4) { | |
836 | 837 | ptr += 6; if (*ptr == '"') ptr++; |
837 | 838 | result->maxpno = atoi (ptr); |
838 | 839 | } |
839 | if ((ptr = _FP_stristr (line, "name=")) && ctline<4) { | |
840 | if ((ptr = FP_stristr (line, "name=")) && ctline<4) { | |
840 | 841 | ptr += 5; |
841 | 842 | while (isspace (*ptr)) ptr++; |
842 | 843 | if (*ptr == '"' && *(ptr+1) && (p2 = strchr (ptr+2, '"')) != NULL) { |
843 | 844 | c = *p2; *p2 = '\0'; |
844 | _FP_free (result->filename); | |
845 | result->filename = _FP_strdup (ptr+1); | |
845 | FP_free (result->filename); | |
846 | result->filename = FP_strdup (ptr+1); | |
846 | 847 | *p2 = c; |
847 | 848 | } |
848 | 849 | else if (*ptr=='\''&&*(ptr+1)&&(p2 = strchr(ptr+2, '\'')) != NULL) { |
849 | 850 | c = *p2; *p2 = '\0'; |
850 | _FP_free (result->filename); | |
851 | result->filename = _FP_strdup (ptr+1); | |
851 | FP_free (result->filename); | |
852 | result->filename = FP_strdup (ptr+1); | |
852 | 853 | *p2 = c; |
853 | 854 | } |
854 | 855 | else { |
855 | 856 | p2 = ptr; |
856 | while (isalnum(*p2) || | |
857 | while (isalnum(*p2) || | |
857 | 858 | *p2 == '.' || *p2=='_' || *p2 == '-' || |
858 | 859 | *p2 == '!' || *p2=='@' || *p2 == '$') |
859 | 860 | p2++; |
860 | 861 | c = *p2; *p2 = '\0'; |
861 | 862 | if (p2 != ptr && result->filename == NULL) |
862 | result->filename = _FP_strdup (ptr); | |
863 | result->filename = FP_strdup (ptr); | |
863 | 864 | else if (p2 - ptr > 5 && strchr (ptr, '.') != NULL) { |
864 | 865 | /* |
865 | 866 | * This file name looks good, too. Let's use it |
866 | 867 | */ |
867 | _FP_free (result->filename); | |
868 | result->filename = _FP_strdup (ptr); | |
868 | FP_free (result->filename); | |
869 | result->filename = FP_strdup (ptr); | |
869 | 870 | } |
870 | 871 | *p2 = c; |
871 | 872 | } |
872 | 873 | } |
873 | if ((ptr = _FP_stristr (line, "id=")) && ctline<4) { | |
874 | if ((ptr = FP_stristr (line, "id=")) && ctline<4) { | |
874 | 875 | p2 = ptr += 3; |
875 | 876 | if (*p2 == '"') { |
876 | 877 | p2 = strchr (++ptr, '"'); |
882 | 883 | if (p2 && *p2 && p2!=ptr) { |
883 | 884 | c = *p2; *p2 = '\0'; |
884 | 885 | if (result->mimeid) |
885 | _FP_free (result->mimeid); | |
886 | result->mimeid = _FP_strdup (ptr); | |
886 | FP_free (result->mimeid); | |
887 | result->mimeid = FP_strdup (ptr); | |
887 | 888 | *p2 = c; |
888 | 889 | } |
889 | 890 | } |
890 | ||
891 | /* | |
891 | ||
892 | /* | |
892 | 893 | * Handling for very short Base64 files. |
893 | 894 | */ |
894 | 895 | if (uu_tinyb64 && !ismime && !uu_more_mime) { |
914 | 915 | |
915 | 916 | if (boundary == NULL && !ismime && !uu_more_mime && dflag <= 1 && |
916 | 917 | line[0] == '-' && line[1] == '-' && strlen(line+2)>10 && |
917 | (((ptr = _FP_strrstr (line+2, "--")) == NULL) || | |
918 | (((ptr = FP_strrstr (line+2, "--")) == NULL) || | |
918 | 919 | ptr[2]) && |
919 | _FP_strstr (line+2, "_=_") != NULL) { | |
920 | FP_strstr (line+2, "_=_") != NULL) { | |
920 | 921 | |
921 | 922 | long oldposition = ftell (datei); /* refresh oldpositition so the comment below becomes true */ |
922 | ||
923 | if (_FP_fgets (line, 1024, datei) == NULL) { | |
923 | ||
924 | if (FP_fgets (line, 1024, datei) == NULL) { | |
924 | 925 | break; |
925 | 926 | } |
926 | if (_FP_strnicmp (line, "Content-", 8) == 0) { | |
927 | if (FP_strnicmp_fast (line, "Content-", 8) == 0) { | |
927 | 928 | /* |
928 | 929 | * Okay, let's do it. This breaks out of ScanData. ScanPart will |
929 | 930 | * recognize the boundary on the next call and use it. |
938 | 939 | */ |
939 | 940 | |
940 | 941 | if (strncmp (line, "=ybegin ", 8) == 0 && |
941 | _FP_strstr (line, " name=") != NULL) { | |
942 | FP_strstr (line, " name=") != NULL) { | |
942 | 943 | if ((result->begin || result->end || result->uudet) && !uu_more_mime) { |
943 | 944 | fseek (datei, oldposition, SEEK_SET); |
944 | 945 | break; |
947 | 948 | /* |
948 | 949 | * name continues to the end of the line |
949 | 950 | */ |
950 | ||
951 | ptr = _FP_strstr (line, " name=") + 6; | |
951 | ||
952 | ptr = FP_strstr (line, " name=") + 6; | |
952 | 953 | |
953 | 954 | /* newsbin pro 5.0 (at least) is braindamaged enough to put (null) here */ |
954 | 955 | /* create something sensible, trust a windows program to fuck it up */ |
955 | 956 | if (strncmp (ptr, "(null)", 6)) |
956 | 957 | { |
957 | _FP_free (result->filename); | |
958 | result->filename = _FP_strdup (ptr); | |
958 | FP_free (result->filename); | |
959 | result->filename = FP_strdup (ptr); | |
959 | 960 | |
960 | 961 | while (isspace (result->filename[strlen(result->filename)-1])) |
961 | 962 | result->filename[strlen(result->filename)-1] = '\0'; |
965 | 966 | * Determine size |
966 | 967 | */ |
967 | 968 | |
968 | if ((ptr = _FP_strstr (line, " size=")) != NULL) { | |
969 | if ((ptr = FP_strstr (line, " size=")) != NULL) { | |
969 | 970 | ptr += 6; |
970 | 971 | result->yefilesize = atoi (ptr); |
971 | 972 | } |
977 | 978 | * check for multipart file and read =ypart line |
978 | 979 | */ |
979 | 980 | |
980 | if ((ptr = _FP_strstr (line, " part=")) != NULL) { | |
981 | if ((ptr = FP_strstr (line, " part=")) != NULL) { | |
981 | 982 | result->partno = atoi (ptr + 6); |
982 | 983 | |
983 | 984 | if (result->partno == 1) { |
984 | 985 | result->begin = 1; |
985 | 986 | } |
986 | 987 | |
987 | if ((ptr = _FP_strstr (line, " total="))) | |
988 | if ((ptr = FP_strstr (line, " total="))) | |
988 | 989 | result->maxpno = atoi (ptr + 7); |
989 | 990 | |
990 | if (_FP_fgets (line, 1024, datei) == NULL) { | |
991 | if (FP_fgets (line, 1024, datei) == NULL) { | |
991 | 992 | break; |
992 | 993 | } |
993 | 994 | |
995 | 996 | break; |
996 | 997 | } |
997 | 998 | |
998 | if ((ptr = _FP_strstr (line, " end=")) == NULL) { | |
999 | if ((ptr = FP_strstr (line, " end=")) == NULL) { | |
999 | 1000 | break; |
1000 | 1001 | } |
1001 | ||
1002 | ||
1002 | 1003 | yepartends = atoi (ptr + 5); |
1003 | 1004 | } |
1004 | 1005 | else { |
1111 | 1112 | result->filename==NULL) { |
1112 | 1113 | memcpy (bhds1, bhds2+1, (int) bhds2[0]); |
1113 | 1114 | bhds1[(int)bhds2[0]]='\0'; |
1114 | result->filename = _FP_strdup (bhds1); | |
1115 | result->filename = FP_strdup (bhds1); | |
1115 | 1116 | bhnf = 1; |
1116 | 1117 | } |
1117 | 1118 | else if (bhdsp-bhds2 >= 256 && bhds2[0]>0) { |
1118 | 1119 | memcpy (bhds1, bhds2+1, 255); |
1119 | 1120 | bhds1[255] = '\0'; |
1120 | result->filename = _FP_strdup (bhds1); | |
1121 | result->filename = FP_strdup (bhds1); | |
1121 | 1122 | bhnf = 1; |
1122 | 1123 | } |
1123 | 1124 | else if (bhds2[0] <= 0) |
1196 | 1197 | |
1197 | 1198 | hcount = lcount = 0; |
1198 | 1199 | |
1199 | while (!feof (datei)) { | |
1200 | while (!FP_feof (datei)) { | |
1200 | 1201 | /* |
1201 | 1202 | * Make Busy Polls |
1202 | 1203 | */ |
1208 | 1209 | } |
1209 | 1210 | |
1210 | 1211 | oldposition = ftell (datei); |
1211 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1212 | if (FP_fgets (line, 1024, datei) == NULL) | |
1212 | 1213 | break; |
1213 | 1214 | if (ferror (datei)) |
1214 | 1215 | break; |
1295 | 1296 | |
1296 | 1297 | continue; |
1297 | 1298 | } |
1298 | ||
1299 | ||
1299 | 1300 | /* |
1300 | 1301 | * Select the encoding with the best "history" |
1301 | 1302 | */ |
1374 | 1375 | /* |
1375 | 1376 | * End of scanning loop |
1376 | 1377 | */ |
1377 | } /* while (!feof (datei)) */ | |
1378 | ||
1379 | if (feof (datei)) | |
1378 | } /* while (!FP_feof (datei)) */ | |
1379 | ||
1380 | if (FP_feof (datei)) | |
1380 | 1381 | oldposition = ftell (datei); |
1381 | 1382 | |
1382 | 1383 | if (dflag && encoding == B64ENCODED && haddh) |
1445 | 1446 | return 2; |
1446 | 1447 | else if (boundary && p3 && |
1447 | 1448 | line[0] == 'C' && line[1] == 'o' && |
1448 | _FP_strnicmp (line, "Content-Type:", 13) == 0 && | |
1449 | FP_strnicmp_fast (line, "Content-Type:", 13) == 0 && | |
1449 | 1450 | strcmp (p3, boundary) == 0) |
1450 | 1451 | return 2; |
1451 | 1452 | else if (IsKnownHeader (line)) |
1469 | 1470 | char *ptr1, *ptr2; |
1470 | 1471 | |
1471 | 1472 | (void) UUDecodeLine (NULL, NULL, 0); /* init */ |
1472 | if (datei == NULL || feof (datei)) { | |
1473 | if (datei == NULL || FP_feof (datei)) { | |
1473 | 1474 | *errcode = UURET_OK; |
1474 | 1475 | return NULL; |
1475 | 1476 | } |
1495 | 1496 | while (mssdepth) { |
1496 | 1497 | mssdepth--; |
1497 | 1498 | UUkillheaders (&(multistack[mssdepth].envelope)); |
1498 | _FP_free (multistack[mssdepth].source); | |
1499 | FP_free (multistack[mssdepth].source); | |
1499 | 1500 | } |
1500 | 1501 | |
1501 | 1502 | UUkillheaders (&sstate.envelope); |
1502 | 1503 | memset (&sstate.envelope, 0, sizeof (headers)); |
1503 | 1504 | |
1504 | _FP_free (sstate.source); | |
1505 | if ((sstate.source = _FP_strdup (fname)) == NULL) { | |
1505 | FP_free (sstate.source); | |
1506 | if ((sstate.source = FP_strdup (fname)) == NULL) { | |
1506 | 1507 | *errcode = UURET_NOMEM; |
1507 | _FP_free (result); | |
1508 | FP_free (result); | |
1508 | 1509 | return NULL; |
1509 | 1510 | } |
1510 | 1511 | |
1511 | 1512 | /* ignore empty lines at the beginning of a file */ |
1512 | 1513 | preheaders = ftell (datei); |
1513 | while (!feof (datei)) { | |
1514 | while (!FP_feof (datei)) { | |
1514 | 1515 | if (UUBUSYPOLL(preheaders,progress.fsize)) SPCANCEL(); |
1515 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1516 | if (FP_fgets (line, 1024, datei) == NULL) | |
1516 | 1517 | break; |
1517 | 1518 | if (!IsLineEmpty (line)) { |
1518 | 1519 | fseek (datei, preheaders, SEEK_SET); |
1522 | 1523 | } |
1523 | 1524 | } |
1524 | 1525 | |
1525 | if (ferror(datei) || feof(datei)) { | |
1526 | _FP_free (result); | |
1526 | if (ferror(datei) || FP_feof(datei)) { | |
1527 | FP_free (result); | |
1527 | 1528 | return NULL; |
1528 | 1529 | } |
1529 | 1530 | |
1545 | 1546 | while (mssdepth) { |
1546 | 1547 | mssdepth--; |
1547 | 1548 | UUkillheaders (&(multistack[mssdepth].envelope)); |
1548 | _FP_free (multistack[mssdepth].source); | |
1549 | FP_free (multistack[mssdepth].source); | |
1549 | 1550 | } |
1550 | 1551 | |
1551 | 1552 | prevpos = ftell (datei); |
1552 | if (_FP_fgets (line, 1024, datei) == NULL) { | |
1553 | _FP_free (result); | |
1553 | if (FP_fgets (line, 1024, datei) == NULL) { | |
1554 | FP_free (result); | |
1554 | 1555 | return NULL; |
1555 | 1556 | } |
1556 | 1557 | |
1562 | 1563 | * false detection errors |
1563 | 1564 | */ |
1564 | 1565 | |
1565 | if (!feof (datei) && line[0] == '-' && line[1] == '-' && line[2]) { | |
1566 | if (!FP_feof (datei) && line[0] == '-' && line[1] == '-' && line[2]) { | |
1566 | 1567 | sstate.ismime = 1; |
1567 | sstate.envelope.mimevers = _FP_strdup ("1.0"); | |
1568 | sstate.envelope.boundary = _FP_strdup (line+2); | |
1569 | sstate.envelope.ctype = _FP_strdup ("multipart/mixed"); | |
1568 | sstate.envelope.mimevers = FP_strdup ("1.0"); | |
1569 | sstate.envelope.boundary = FP_strdup (line+2); | |
1570 | sstate.envelope.ctype = FP_strdup ("multipart/mixed"); | |
1570 | 1571 | sstate.mimestate = MS_SUBPART; |
1571 | 1572 | |
1572 | 1573 | *errcode = UURET_CONT; |
1573 | _FP_free (result); | |
1574 | FP_free (result); | |
1574 | 1575 | return NULL; |
1575 | 1576 | } |
1576 | 1577 | |
1578 | 1579 | * Normal behavior: look for a RFC 822 header |
1579 | 1580 | */ |
1580 | 1581 | |
1581 | while (!feof (datei) && !IsLineEmpty (line)) { | |
1582 | while (!FP_feof (datei) && !IsLineEmpty (line)) { | |
1582 | 1583 | if (IsKnownHeader (line)) |
1583 | 1584 | hcount++; |
1584 | 1585 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
1586 | 1587 | ptr1 = ScanHeaderLine (datei, line); |
1587 | 1588 | if (ParseHeader (&sstate.envelope, ptr1) == NULL) { |
1588 | 1589 | *errcode = UURET_NOMEM; |
1589 | _FP_free (result); | |
1590 | FP_free (result); | |
1590 | 1591 | return NULL; |
1591 | 1592 | } |
1592 | 1593 | } |
1601 | 1602 | break; |
1602 | 1603 | } |
1603 | 1604 | |
1604 | if (_FP_fgets (line, 1024, datei) == NULL) { | |
1605 | if (FP_fgets (line, 1024, datei) == NULL) { | |
1605 | 1606 | /* If we are at eof without finding headers, there probably isn't */ |
1606 | 1607 | if (hcount < hlcount.afternl) |
1607 | 1608 | fseek (datei, prevpos, SEEK_SET); |
1612 | 1613 | /* skip empty lines */ |
1613 | 1614 | prevpos = ftell (datei); |
1614 | 1615 | if (IsLineEmpty (line)) { |
1615 | while (!feof (datei)) { | |
1616 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1616 | while (!FP_feof (datei)) { | |
1617 | if (FP_fgets (line, 1024, datei) == NULL) | |
1617 | 1618 | break; |
1618 | 1619 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
1619 | 1620 | if (!IsLineEmpty (line)) { |
1637 | 1638 | /* |
1638 | 1639 | * see above |
1639 | 1640 | */ |
1640 | _FP_fgets (line, 1024, datei); | |
1641 | ||
1642 | while (!feof (datei) && !IsLineEmpty (line)) { | |
1641 | FP_fgets (line, 1024, datei); | |
1642 | ||
1643 | while (!FP_feof (datei) && !IsLineEmpty (line)) { | |
1643 | 1644 | if (IsKnownHeader (line)) |
1644 | 1645 | hcount++; |
1645 | 1646 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
1646 | 1647 | ptr1 = ScanHeaderLine (datei, line); |
1647 | 1648 | if (ParseHeader (&sstate.envelope, ptr1) == NULL) { |
1648 | 1649 | *errcode = UURET_NOMEM; |
1649 | _FP_free (result); | |
1650 | FP_free (result); | |
1650 | 1651 | return NULL; |
1651 | 1652 | } |
1652 | 1653 | |
1653 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1654 | if (FP_fgets (line, 1024, datei) == NULL) | |
1654 | 1655 | break; |
1655 | 1656 | } |
1656 | 1657 | /* skip empty lines */ |
1657 | 1658 | prevpos = ftell (datei); |
1658 | while (!feof (datei)) { | |
1659 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1659 | while (!FP_feof (datei)) { | |
1660 | if (FP_fgets (line, 1024, datei) == NULL) | |
1660 | 1661 | break; |
1661 | 1662 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
1662 | 1663 | if (!IsLineEmpty (line)) { |
1675 | 1676 | * headers, don't be too picky about it. |
1676 | 1677 | */ |
1677 | 1678 | if (sstate.envelope.ctype && sstate.envelope.mimevers==NULL && |
1678 | _FP_stristr (sstate.envelope.ctype, "multipart") != NULL && | |
1679 | FP_stristr (sstate.envelope.ctype, "multipart") != NULL && | |
1679 | 1680 | sstate.envelope.boundary != NULL) { |
1680 | sstate.envelope.mimevers = _FP_strdup ("1.0"); | |
1681 | sstate.envelope.mimevers = FP_strdup ("1.0"); | |
1681 | 1682 | hcount = hlcount.afternl; |
1682 | 1683 | } |
1683 | 1684 | else if (sstate.envelope.mimevers==NULL && sstate.envelope.ctype && |
1684 | 1685 | sstate.envelope.fname && sstate.envelope.ctenc) { |
1685 | sstate.envelope.mimevers = _FP_strdup ("1.0"); | |
1686 | sstate.envelope.mimevers = FP_strdup ("1.0"); | |
1686 | 1687 | hcount = hlcount.afternl; |
1687 | 1688 | } |
1688 | 1689 | |
1689 | 1690 | if (sstate.envelope.mimevers != NULL) { |
1690 | 1691 | /* this is a MIME file. check the Content-Type */ |
1691 | 1692 | sstate.ismime = 1; |
1692 | if (_FP_stristr (sstate.envelope.ctype, "multipart") != NULL) { | |
1693 | if (FP_stristr (sstate.envelope.ctype, "multipart") != NULL) { | |
1693 | 1694 | if (sstate.envelope.boundary == NULL) { |
1694 | 1695 | UUMessage (uuscan_id, __LINE__, UUMSG_WARNING, |
1695 | 1696 | uustring (S_MIME_NO_BOUNDARY)); |
1696 | 1697 | sstate.mimestate = MS_BODY; |
1697 | _FP_free (sstate.envelope.ctype); | |
1698 | sstate.envelope.ctype = _FP_strdup ("text/plain"); | |
1698 | FP_free (sstate.envelope.ctype); | |
1699 | sstate.envelope.ctype = FP_strdup ("text/plain"); | |
1699 | 1700 | } |
1700 | 1701 | else { |
1701 | 1702 | sstate.mimestate = MS_PREAMBLE; |
1713 | 1714 | } |
1714 | 1715 | } |
1715 | 1716 | |
1716 | if (feof (datei) || ferror (datei)) { /* oops */ | |
1717 | _FP_free (result); | |
1717 | if (FP_feof (datei) || ferror (datei)) { /* oops */ | |
1718 | FP_free (result); | |
1718 | 1719 | return NULL; |
1719 | 1720 | } |
1720 | 1721 | |
1734 | 1735 | |
1735 | 1736 | blen = strlen (sstate.envelope.boundary); |
1736 | 1737 | lcount = 0; |
1737 | ||
1738 | while (!feof (datei)) { | |
1739 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1738 | ||
1739 | while (!FP_feof (datei)) { | |
1740 | if (FP_fgets (line, 1024, datei) == NULL) | |
1740 | 1741 | break; |
1741 | 1742 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
1742 | 1743 | if (line[0] == '-' && line[1] == '-' && |
1747 | 1748 | |
1748 | 1749 | prevpos = ftell (datei); |
1749 | 1750 | } |
1750 | if (feof (datei) || ferror (datei)) { | |
1751 | if (FP_feof (datei) || ferror (datei)) { | |
1751 | 1752 | UUMessage (uuscan_id, __LINE__, UUMSG_WARNING, |
1752 | 1753 | uustring (S_MIME_B_NOT_FOUND)); |
1753 | 1754 | /* |
1761 | 1762 | *errcode = UURET_CONT; |
1762 | 1763 | fseek (datei, preheaders, SEEK_SET); |
1763 | 1764 | } |
1764 | _FP_free (result); | |
1765 | FP_free (result); | |
1765 | 1766 | return NULL; |
1766 | 1767 | } |
1767 | 1768 | if (line[0] == '-' && line[1] == '-' && |
1789 | 1790 | *errcode = UURET_CONT; |
1790 | 1791 | fseek (datei, preheaders, SEEK_SET); |
1791 | 1792 | } |
1792 | _FP_free (result); | |
1793 | FP_free (result); | |
1793 | 1794 | return NULL; |
1794 | 1795 | } |
1795 | 1796 | /* produce result if uu_usepreamble is set */ |
1796 | 1797 | if (uu_usepreamble && lcount) { |
1797 | 1798 | sprintf (line, "%04d.txt", ++mimseqno); |
1798 | result->subject = _FP_strdup (sstate.envelope.subject); | |
1799 | result->filename = _FP_strdup (line); | |
1800 | result->origin = _FP_strdup (sstate.envelope.from); | |
1801 | result->mimeid = _FP_strdup (sstate.envelope.mimeid); | |
1802 | result->mimetype = _FP_strdup ("text/plain"); | |
1799 | result->subject = FP_strdup (sstate.envelope.subject); | |
1800 | result->filename = FP_strdup (line); | |
1801 | result->origin = FP_strdup (sstate.envelope.from); | |
1802 | result->mimeid = FP_strdup (sstate.envelope.mimeid); | |
1803 | result->mimetype = FP_strdup ("text/plain"); | |
1803 | 1804 | result->mode = 0644; |
1804 | 1805 | result->uudet = PT_ENCODED; /* plain text */ |
1805 | result->sfname = _FP_strdup (fname); | |
1806 | result->sfname = FP_strdup (fname); | |
1806 | 1807 | result->flags = FL_SINGLE | FL_PROPER; |
1807 | 1808 | /* result->startpos set from above */ |
1808 | 1809 | result->length = prevpos - result->startpos; |
1823 | 1824 | *errcode = UURET_CONT; |
1824 | 1825 | |
1825 | 1826 | /* otherwise, just return NULL */ |
1826 | _FP_free (result); | |
1827 | FP_free (result); | |
1827 | 1828 | return NULL; |
1828 | 1829 | } |
1829 | 1830 | |
1859 | 1860 | /* |
1860 | 1861 | * check if the epilogue is empty |
1861 | 1862 | */ |
1862 | while (!feof (datei) && !ferror (datei) && lcount<10 && res==0) { | |
1863 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1863 | while (!FP_feof (datei) && !ferror (datei) && lcount<10 && res==0) { | |
1864 | if (FP_fgets (line, 1024, datei) == NULL) | |
1864 | 1865 | break; |
1865 | 1866 | if (!IsLineEmpty (line)) |
1866 | 1867 | res++; |
1868 | 1869 | } |
1869 | 1870 | if (uu_usepreamble && res) { |
1870 | 1871 | sprintf (line, "%04d.txt", ++mimseqno); |
1871 | result->subject = _FP_strdup (sstate.envelope.subject); | |
1872 | result->filename = _FP_strdup (line); | |
1873 | result->origin = _FP_strdup (sstate.envelope.from); | |
1874 | result->mimeid = _FP_strdup (sstate.envelope.mimeid); | |
1875 | result->mimetype = _FP_strdup ("text/plain"); | |
1872 | result->subject = FP_strdup (sstate.envelope.subject); | |
1873 | result->filename = FP_strdup (line); | |
1874 | result->origin = FP_strdup (sstate.envelope.from); | |
1875 | result->mimeid = FP_strdup (sstate.envelope.mimeid); | |
1876 | result->mimetype = FP_strdup ("text/plain"); | |
1876 | 1877 | result->mode = 0644; |
1877 | 1878 | result->uudet = PT_ENCODED; /* plain text */ |
1878 | result->sfname = _FP_strdup (fname); | |
1879 | result->sfname = FP_strdup (fname); | |
1879 | 1880 | result->flags = FL_SINGLE | FL_PROPER | FL_TOEND; |
1880 | 1881 | result->partno = 1; |
1881 | 1882 | /* result->startpos set from above */ |
1888 | 1889 | |
1889 | 1890 | return result; |
1890 | 1891 | } |
1891 | _FP_free (result); | |
1892 | FP_free (result); | |
1892 | 1893 | return NULL; |
1893 | 1894 | } |
1894 | 1895 | |
1895 | 1896 | if (mssdepth > 0) |
1896 | 1897 | blen = strlen (multistack[mssdepth-1].envelope.boundary); |
1897 | 1898 | |
1898 | while (!feof (datei)) { | |
1899 | if (_FP_fgets (line, 1024, datei) == NULL) | |
1899 | while (!FP_feof (datei)) { | |
1900 | if (FP_fgets (line, 1024, datei) == NULL) | |
1900 | 1901 | break; |
1901 | 1902 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
1902 | 1903 | /* check for parent boundary */ |
1912 | 1913 | preheaders = prevpos; |
1913 | 1914 | lcount = 0; |
1914 | 1915 | } |
1915 | hcount++; | |
1916 | hcount++; | |
1916 | 1917 | lcount++; |
1917 | 1918 | |
1918 | 1919 | if (hcount >= hlcount.restart) { |
1933 | 1934 | |
1934 | 1935 | /* check for begin and encoded data only at outermost level */ |
1935 | 1936 | if (mssdepth == 0 && !uu_more_mime) { |
1936 | if (strncmp (line, "begin ", 6) == 0 || | |
1937 | _FP_strnicmp (line, "<pre>begin ", 11) == 0) { | |
1937 | if (strncmp (line, "begin ", 6) == 0 || | |
1938 | FP_strnicmp_fast (line, "<pre>begin ", 11) == 0) { | |
1938 | 1939 | preenc = prevpos; |
1939 | 1940 | begflag = 1; |
1940 | 1941 | } |
1976 | 1977 | /* restore previous state */ |
1977 | 1978 | mssdepth--; |
1978 | 1979 | UUkillheaders (&sstate.envelope); |
1979 | _FP_free (sstate.source); | |
1980 | FP_free (sstate.source); | |
1980 | 1981 | memcpy (&sstate, &(multistack[mssdepth]), sizeof (scanstate)); |
1981 | 1982 | |
1982 | 1983 | ptr1 = line + 2 + strlen (sstate.envelope.boundary); |
2003 | 2004 | while (mssdepth) { |
2004 | 2005 | mssdepth--; |
2005 | 2006 | UUkillheaders (&(multistack[mssdepth].envelope)); |
2006 | _FP_free (multistack[mssdepth].source); | |
2007 | FP_free (multistack[mssdepth].source); | |
2007 | 2008 | } |
2008 | 2009 | |
2009 | 2010 | if (!uu_fast_scanning) { |
2010 | 2011 | *errcode = UURET_CONT; |
2011 | 2012 | fseek (datei, preheaders, SEEK_SET); |
2012 | 2013 | } |
2013 | _FP_free (result); | |
2014 | FP_free (result); | |
2014 | 2015 | return NULL; |
2015 | 2016 | } |
2016 | 2017 | else if (IsKnownHeader (line)) { |
2033 | 2034 | /* produce result if uu_usepreamble is set */ |
2034 | 2035 | if (uu_usepreamble && res) { |
2035 | 2036 | sprintf (line, "%04d.txt", ++mimseqno); |
2036 | result->subject = _FP_strdup (sstate.envelope.subject); | |
2037 | result->filename = _FP_strdup (line); | |
2038 | result->origin = _FP_strdup (sstate.envelope.from); | |
2039 | result->mimeid = _FP_strdup (sstate.envelope.mimeid); | |
2040 | result->mimetype = _FP_strdup ("text/plain"); | |
2037 | result->subject = FP_strdup (sstate.envelope.subject); | |
2038 | result->filename = FP_strdup (line); | |
2039 | result->origin = FP_strdup (sstate.envelope.from); | |
2040 | result->mimeid = FP_strdup (sstate.envelope.mimeid); | |
2041 | result->mimetype = FP_strdup ("text/plain"); | |
2041 | 2042 | result->mode = 0644; |
2042 | 2043 | result->uudet = PT_ENCODED; /* plain text */ |
2043 | result->sfname = _FP_strdup (fname); | |
2044 | result->sfname = FP_strdup (fname); | |
2044 | 2045 | result->flags = FL_SINGLE | FL_PROPER; |
2045 | 2046 | result->partno = 1; |
2046 | 2047 | /* result->startpos set from above */ |
2054 | 2055 | return result; |
2055 | 2056 | } |
2056 | 2057 | /* otherwise, just return NULL */ |
2057 | _FP_free (result); | |
2058 | FP_free (result); | |
2058 | 2059 | return NULL; |
2059 | 2060 | } |
2060 | 2061 | |
2066 | 2067 | * stack and dive into the new environment, starting with another |
2067 | 2068 | * preamble. |
2068 | 2069 | */ |
2069 | ||
2070 | ||
2070 | 2071 | if (sstate.ismime && sstate.mimestate == MS_SUBPART) { |
2071 | 2072 | memset (&localenv, 0, sizeof (headers)); |
2072 | 2073 | result->startpos = ftell (datei); |
2078 | 2079 | * Duplicate some data from outer envelope |
2079 | 2080 | */ |
2080 | 2081 | |
2081 | localenv.mimevers = _FP_strdup (sstate.envelope.mimevers); | |
2082 | localenv.from = _FP_strdup (sstate.envelope.from); | |
2083 | localenv.subject = _FP_strdup (sstate.envelope.subject); | |
2084 | localenv.rcpt = _FP_strdup (sstate.envelope.rcpt); | |
2085 | localenv.date = _FP_strdup (sstate.envelope.date); | |
2082 | localenv.mimevers = FP_strdup (sstate.envelope.mimevers); | |
2083 | localenv.from = FP_strdup (sstate.envelope.from); | |
2084 | localenv.subject = FP_strdup (sstate.envelope.subject); | |
2085 | localenv.rcpt = FP_strdup (sstate.envelope.rcpt); | |
2086 | localenv.date = FP_strdup (sstate.envelope.date); | |
2086 | 2087 | |
2087 | 2088 | if ((sstate.envelope.mimevers != NULL && localenv.mimevers == NULL) || |
2088 | 2089 | (sstate.envelope.from != NULL && localenv.from == NULL) || |
2093 | 2094 | while (mssdepth) { |
2094 | 2095 | mssdepth--; |
2095 | 2096 | UUkillheaders (&(multistack[mssdepth].envelope)); |
2096 | _FP_free (multistack[mssdepth].source); | |
2097 | FP_free (multistack[mssdepth].source); | |
2097 | 2098 | } |
2098 | 2099 | sstate.isfolder = 0; |
2099 | 2100 | sstate.ismime = 0; |
2100 | ||
2101 | ||
2101 | 2102 | UUkillheaders (&localenv); |
2102 | 2103 | *errcode = UURET_NOMEM; |
2103 | _FP_free (result); | |
2104 | FP_free (result); | |
2104 | 2105 | return NULL; |
2105 | 2106 | } |
2106 | ||
2107 | ||
2107 | 2108 | /* Scan subheader. But what if there is no subheader? */ |
2108 | 2109 | hcount = 0; |
2109 | 2110 | lcount = 0; |
2110 | 2111 | preheaders = prevpos; |
2111 | ||
2112 | if (_FP_fgets (line, 1024, datei) == NULL) { | |
2112 | ||
2113 | if (FP_fgets (line, 1024, datei) == NULL) { | |
2113 | 2114 | sstate.isfolder = 0; |
2114 | 2115 | sstate.ismime = 0; |
2115 | 2116 | while (mssdepth) { |
2116 | 2117 | mssdepth--; |
2117 | 2118 | UUkillheaders (&(multistack[mssdepth].envelope)); |
2118 | _FP_free (multistack[mssdepth].source); | |
2119 | FP_free (multistack[mssdepth].source); | |
2119 | 2120 | } |
2120 | 2121 | UUkillheaders (&localenv); |
2121 | _FP_free (result); | |
2122 | FP_free (result); | |
2122 | 2123 | return NULL; |
2123 | 2124 | } |
2124 | 2125 | |
2125 | while (!feof (datei) && !IsLineEmpty (line)) { | |
2126 | while (!FP_feof (datei) && !IsLineEmpty (line)) { | |
2126 | 2127 | if (IsKnownHeader (line)) |
2127 | 2128 | hcount++; |
2128 | 2129 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
2140 | 2141 | |
2141 | 2142 | prevpos = ftell (datei); |
2142 | 2143 | |
2143 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2144 | if (FP_fgets (line, 1024, datei) == NULL) | |
2144 | 2145 | break; |
2145 | 2146 | lcount++; |
2146 | 2147 | } |
2153 | 2154 | fseek (datei, prevpos, SEEK_SET); |
2154 | 2155 | } |
2155 | 2156 | |
2156 | if (_FP_stristr (localenv.ctype, "multipart") != NULL) { | |
2157 | if (FP_stristr (localenv.ctype, "multipart") != NULL) { | |
2157 | 2158 | /* oh no, not again */ |
2158 | 2159 | if (mssdepth >= MSMAXDEPTH) { |
2159 | 2160 | /* Argh, what an isane message. Treat as plain text */ |
2169 | 2170 | memcpy (&sstate.envelope, &localenv, sizeof (headers)); |
2170 | 2171 | memset (&localenv, 0, sizeof (headers)); |
2171 | 2172 | sstate.mimestate = MS_PREAMBLE; |
2172 | if ((sstate.source = _FP_strdup (sstate.source)) == NULL) | |
2173 | if ((sstate.source = FP_strdup (sstate.source)) == NULL) | |
2173 | 2174 | *errcode = UURET_NOMEM; |
2174 | 2175 | |
2175 | 2176 | if (*errcode == UURET_OK) |
2177 | 2178 | |
2178 | 2179 | mssdepth++; |
2179 | 2180 | /* need a restart */ |
2180 | _FP_free (result); | |
2181 | FP_free (result); | |
2181 | 2182 | return NULL; |
2182 | 2183 | } |
2183 | 2184 | } |
2195 | 2196 | * would then be correctly typed as `text/plain'. |
2196 | 2197 | */ |
2197 | 2198 | |
2198 | if (_FP_stristr (localenv.ctenc, "base64") != NULL) | |
2199 | if (FP_stristr (localenv.ctenc, "base64") != NULL) | |
2199 | 2200 | result->uudet = B64ENCODED; |
2200 | else if (_FP_stristr (localenv.ctenc, "x-uue") != NULL) { | |
2201 | else if (FP_stristr (localenv.ctenc, "x-uue") != NULL) { | |
2201 | 2202 | result->uudet = UU_ENCODED; |
2202 | 2203 | result->begin = result->end = 1; |
2203 | 2204 | } |
2204 | else if (_FP_stristr (localenv.ctenc, "x-yenc") != NULL) { | |
2205 | else if (FP_stristr (localenv.ctenc, "x-yenc") != NULL) { | |
2205 | 2206 | result->uudet = YENC_ENCODED; |
2206 | 2207 | result->begin = result->end = 1; |
2207 | 2208 | } |
2208 | else if (_FP_stristr (localenv.ctenc, "quoted-printable") != NULL) | |
2209 | else if (FP_stristr (localenv.ctenc, "quoted-printable") != NULL) | |
2209 | 2210 | result->uudet = QP_ENCODED; |
2210 | else if (_FP_stristr (localenv.ctenc, "7bit") != NULL || | |
2211 | _FP_stristr (localenv.ctenc, "8bit") != NULL) | |
2211 | else if (FP_stristr (localenv.ctenc, "7bit") != NULL || | |
2212 | FP_stristr (localenv.ctenc, "8bit") != NULL) | |
2212 | 2213 | result->uudet = PT_ENCODED; |
2213 | else if (_FP_stristr (localenv.ctype, "multipart") != NULL || | |
2214 | _FP_stristr (localenv.ctype, "message") != NULL) | |
2214 | else if (FP_stristr (localenv.ctype, "multipart") != NULL || | |
2215 | FP_stristr (localenv.ctype, "message") != NULL) | |
2215 | 2216 | result->uudet = PT_ENCODED; |
2216 | 2217 | |
2217 | 2218 | /* |
2230 | 2231 | prevpos = ftell (datei); |
2231 | 2232 | blen = strlen (sstate.envelope.boundary); |
2232 | 2233 | lcount = 0; |
2233 | ||
2234 | while (!feof (datei)) { | |
2235 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2234 | ||
2235 | while (!FP_feof (datei)) { | |
2236 | if (FP_fgets (line, 1024, datei) == NULL) | |
2236 | 2237 | break; |
2237 | 2238 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
2238 | 2239 | line[255] = '\0'; |
2249 | 2250 | * Content-Type: multipart/... boundary="same-boundary" |
2250 | 2251 | */ |
2251 | 2252 | if (line[0] == 'C' && line[1] == 'o' && |
2252 | _FP_strnicmp (line, "Content-Type:", 13) == 0) { | |
2253 | FP_strnicmp_fast (line, "Content-Type:", 13) == 0) { | |
2253 | 2254 | ptr1 = ScanHeaderLine (datei, line); |
2254 | ptr2 = (ptr1)?_FP_stristr(ptr1,"boundary"):NULL; | |
2255 | ptr2 = (ptr1)?FP_stristr(ptr1,"boundary"):NULL; | |
2255 | 2256 | ptr1 = (ptr2)?ParseValue(ptr2):NULL; |
2256 | 2257 | if (ptr1 && strcmp (ptr1, sstate.envelope.boundary) == 0) |
2257 | 2258 | break; |
2280 | 2281 | while (mssdepth) { |
2281 | 2282 | mssdepth--; |
2282 | 2283 | UUkillheaders (&(multistack[mssdepth].envelope)); |
2283 | _FP_free (multistack[mssdepth].source); | |
2284 | FP_free (multistack[mssdepth].source); | |
2284 | 2285 | } |
2285 | 2286 | /* |
2286 | 2287 | * Don't retry if uu_fast_scanning |
2291 | 2292 | sstate.isfolder = 0; |
2292 | 2293 | sstate.ismime = 0; |
2293 | 2294 | sstate.mimestate = MS_BODY; |
2294 | _FP_free (result); | |
2295 | FP_free (result); | |
2295 | 2296 | return NULL; |
2296 | 2297 | } |
2297 | 2298 | |
2335 | 2336 | /* or if the file is explicitely named */ |
2336 | 2337 | if (result->uudet == B64ENCODED || lcount) { |
2337 | 2338 | if (localenv.fname) { |
2338 | _FP_free (result->filename); | |
2339 | if ((result->filename = _FP_strdup (localenv.fname)) == NULL) | |
2339 | FP_free (result->filename); | |
2340 | if ((result->filename = FP_strdup (localenv.fname)) == NULL) | |
2340 | 2341 | *errcode = UURET_NOMEM; |
2341 | 2342 | } |
2342 | 2343 | else if ((result->uudet==QP_ENCODED||result->uudet==PT_ENCODED) && |
2343 | 2344 | result->filename == NULL && uu_handletext) { |
2344 | 2345 | sprintf (line, "%04d.txt", ++mimseqno); |
2345 | if ((result->filename = _FP_strdup (line)) == NULL) | |
2346 | if ((result->filename = FP_strdup (line)) == NULL) | |
2346 | 2347 | *errcode = UURET_NOMEM; |
2347 | 2348 | } |
2348 | result->subject = _FP_strdup (localenv.subject); | |
2349 | result->origin = _FP_strdup (localenv.from); | |
2350 | result->mimeid = _FP_strdup (localenv.mimeid); | |
2351 | result->mimetype = _FP_strdup (localenv.ctype); | |
2349 | result->subject = FP_strdup (localenv.subject); | |
2350 | result->origin = FP_strdup (localenv.from); | |
2351 | result->mimeid = FP_strdup (localenv.mimeid); | |
2352 | result->mimetype = FP_strdup (localenv.ctype); | |
2352 | 2353 | result->mode = 0644; |
2353 | result->sfname = _FP_strdup (fname); | |
2354 | result->sfname = FP_strdup (fname); | |
2354 | 2355 | result->flags = FL_SINGLE | FL_PROPER; |
2355 | 2356 | result->partno = 1; |
2356 | 2357 | /* result->uudet determined above */ |
2364 | 2365 | } |
2365 | 2366 | else { |
2366 | 2367 | /* don't produce a result */ |
2367 | _FP_free (result); | |
2368 | FP_free (result); | |
2368 | 2369 | result = NULL; |
2369 | 2370 | } |
2370 | 2371 | if (*errcode == UURET_OK) |
2398 | 2399 | blen = strlen (sstate.envelope.boundary); |
2399 | 2400 | prevpos = ftell (datei); |
2400 | 2401 | |
2401 | while (!feof (datei)) { | |
2402 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2402 | while (!FP_feof (datei)) { | |
2403 | if (FP_fgets (line, 1024, datei) == NULL) | |
2403 | 2404 | break; |
2404 | 2405 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
2405 | 2406 | if (line[0] == '-' && line[1] == '-' && |
2406 | 2407 | strncmp (line+2, sstate.envelope.boundary, blen) == 0) |
2407 | 2408 | break; |
2408 | 2409 | if (line[0] == 'C' && line[1] == 'o' && |
2409 | _FP_strnicmp (line, "Content-Type:", 13) == 0) { | |
2410 | FP_strnicmp_fast (line, "Content-Type:", 13) == 0) { | |
2410 | 2411 | ptr1 = ScanHeaderLine (datei, line); |
2411 | ptr2 = (ptr1)?_FP_stristr(ptr1,"boundary"):NULL; | |
2412 | ptr2 = (ptr1)?FP_stristr(ptr1,"boundary"):NULL; | |
2412 | 2413 | ptr1 = (ptr2)?ParseValue(ptr2):NULL; |
2413 | 2414 | if (ptr1 && strcmp (ptr1, sstate.envelope.boundary) == 0) |
2414 | 2415 | break; |
2429 | 2430 | else { |
2430 | 2431 | UUMessage (uuscan_id, __LINE__, UUMSG_WARNING, |
2431 | 2432 | uustring (S_MIME_B_NOT_FOUND)); |
2432 | ||
2433 | ||
2433 | 2434 | while (mssdepth) { |
2434 | 2435 | mssdepth--; |
2435 | 2436 | UUkillheaders (&(multistack[mssdepth].envelope)); |
2436 | _FP_free (multistack[mssdepth].source); | |
2437 | FP_free (multistack[mssdepth].source); | |
2437 | 2438 | } |
2438 | 2439 | |
2439 | 2440 | if (uu_fast_scanning) { |
2441 | 2442 | sstate.isfolder = 0; |
2442 | 2443 | sstate.ismime = 0; |
2443 | 2444 | sstate.mimestate = MS_BODY; |
2444 | _FP_free (result); | |
2445 | FP_free (result); | |
2445 | 2446 | return NULL; |
2446 | 2447 | } |
2447 | 2448 | |
2449 | 2450 | * Retry, listening to headers this time |
2450 | 2451 | */ |
2451 | 2452 | fseek (datei, result->startpos, SEEK_SET); |
2452 | ||
2453 | ||
2453 | 2454 | UUkillfread (result); |
2454 | 2455 | if ((result = (fileread *) malloc (sizeof (fileread))) == NULL) { |
2455 | 2456 | *errcode = UURET_NOMEM; |
2490 | 2491 | |
2491 | 2492 | if (sstate.ismime && sstate.mimestate == MS_SUBPART && |
2492 | 2493 | strcmp (localenv.mimevers, "1.0") == 0 && |
2493 | _FP_stristr (localenv.ctype, "text") != NULL && | |
2494 | FP_stristr (localenv.ctype, "text") != NULL && | |
2494 | 2495 | !uu_desperate) { |
2495 | 2496 | if (result->uudet == UU_ENCODED && !(result->begin || result->end)) { |
2496 | 2497 | result->uudet = 0; |
2506 | 2507 | } |
2507 | 2508 | |
2508 | 2509 | if (localenv.fname) { |
2509 | _FP_free (result->filename); | |
2510 | if ((result->filename = _FP_strdup (localenv.fname)) == NULL) | |
2510 | FP_free (result->filename); | |
2511 | if ((result->filename = FP_strdup (localenv.fname)) == NULL) | |
2511 | 2512 | *errcode = UURET_NOMEM; |
2512 | 2513 | } |
2513 | 2514 | else if ((result->uudet==QP_ENCODED || result->uudet==PT_ENCODED) && |
2514 | 2515 | result->filename==NULL && uu_handletext) { |
2515 | 2516 | sprintf (line, "%04d.txt", ++mimseqno); |
2516 | if ((result->filename = _FP_strdup (line)) == NULL) | |
2517 | if ((result->filename = FP_strdup (line)) == NULL) | |
2517 | 2518 | *errcode = UURET_NOMEM; |
2518 | 2519 | } |
2519 | 2520 | else { |
2520 | 2521 | /* assign a filename lateron */ |
2521 | 2522 | } |
2522 | if (result->mimetype) _FP_free (result->mimetype); | |
2523 | if (result->mimetype) FP_free (result->mimetype); | |
2523 | 2524 | if (result->uudet) { |
2524 | if (_FP_stristr (localenv.ctype, "text") != NULL && | |
2525 | if (FP_stristr (localenv.ctype, "text") != NULL && | |
2525 | 2526 | result->uudet != QP_ENCODED && result->uudet != PT_ENCODED) |
2526 | 2527 | result->mimetype = NULL; /* better don't set it */ |
2527 | 2528 | else |
2528 | result->mimetype = _FP_strdup (localenv.ctype); | |
2529 | } | |
2530 | if (result->origin) _FP_free (result->origin); | |
2531 | result->origin = _FP_strdup (localenv.from); | |
2532 | ||
2533 | if (result->subject) _FP_free (result->subject); | |
2534 | result->subject = _FP_strdup (localenv.subject); | |
2529 | result->mimetype = FP_strdup (localenv.ctype); | |
2530 | } | |
2531 | if (result->origin) FP_free (result->origin); | |
2532 | result->origin = FP_strdup (localenv.from); | |
2533 | ||
2534 | if (result->subject) FP_free (result->subject); | |
2535 | result->subject = FP_strdup (localenv.subject); | |
2535 | 2536 | |
2536 | 2537 | if (result->sfname == NULL) |
2537 | if ((result->sfname = _FP_strdup (fname)) == NULL) | |
2538 | if ((result->sfname = FP_strdup (fname)) == NULL) | |
2538 | 2539 | *errcode = UURET_NOMEM; |
2539 | 2540 | |
2540 | 2541 | result->length = prevpos - result->startpos; |
2555 | 2556 | * kill local envelope |
2556 | 2557 | */ |
2557 | 2558 | UUkillheaders (&localenv); |
2558 | ||
2559 | ||
2559 | 2560 | return result; |
2560 | 2561 | } |
2561 | 2562 | |
2566 | 2567 | */ |
2567 | 2568 | |
2568 | 2569 | if (sstate.isfolder && sstate.ismime && sstate.mimestate == MS_BODY && |
2569 | _FP_stristr (sstate.envelope.ctype, "message") != NULL && | |
2570 | _FP_stristr (sstate.envelope.ctype, "partial") != NULL) { | |
2570 | FP_stristr (sstate.envelope.ctype, "message") != NULL && | |
2571 | FP_stristr (sstate.envelope.ctype, "partial") != NULL) { | |
2571 | 2572 | |
2572 | 2573 | result->startpos = ftell (datei); |
2573 | 2574 | |
2578 | 2579 | |
2579 | 2580 | /* skip over blank lines first */ |
2580 | 2581 | prevpos = ftell (datei); |
2581 | while (!feof (datei)) { | |
2582 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2582 | while (!FP_feof (datei)) { | |
2583 | if (FP_fgets (line, 1024, datei) == NULL) | |
2583 | 2584 | break; |
2584 | 2585 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
2585 | 2586 | if (!IsLineEmpty (line)) |
2591 | 2592 | lcount = 0; |
2592 | 2593 | preheaders = prevpos; |
2593 | 2594 | |
2594 | while (!feof (datei) && !IsLineEmpty (line)) { | |
2595 | while (!FP_feof (datei) && !IsLineEmpty (line)) { | |
2595 | 2596 | if (IsKnownHeader (line)) |
2596 | 2597 | hcount++; |
2597 | 2598 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
2603 | 2604 | if (ParseHeader (&localenv, ptr1) == NULL) |
2604 | 2605 | *errcode = UURET_NOMEM; |
2605 | 2606 | |
2606 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2607 | if (FP_fgets (line, 1024, datei) == NULL) | |
2607 | 2608 | break; |
2608 | 2609 | lcount++; |
2609 | 2610 | } |
2612 | 2613 | * Examine local header. We're mostly interested in the Content-Type |
2613 | 2614 | * and the Content-Transfer-Encoding. |
2614 | 2615 | */ |
2615 | if (_FP_stristr (localenv.ctype, "multipart") != NULL) { | |
2616 | if (FP_stristr (localenv.ctype, "multipart") != NULL) { | |
2616 | 2617 | UUMessage (uuscan_id, __LINE__, UUMSG_WARNING, |
2617 | 2618 | uustring (S_MIME_PART_MULTI)); |
2618 | 2619 | } |
2619 | 2620 | if (localenv.subject) |
2620 | result->subject = _FP_strdup (localenv.subject); | |
2621 | result->subject = FP_strdup (localenv.subject); | |
2621 | 2622 | else |
2622 | result->subject = _FP_strdup (sstate.envelope.subject); | |
2623 | result->subject = FP_strdup (sstate.envelope.subject); | |
2623 | 2624 | |
2624 | 2625 | if (localenv.from) |
2625 | result->origin = _FP_strdup (localenv.from); | |
2626 | result->origin = FP_strdup (localenv.from); | |
2626 | 2627 | else |
2627 | result->origin = _FP_strdup (sstate.envelope.from); | |
2628 | result->origin = FP_strdup (sstate.envelope.from); | |
2628 | 2629 | |
2629 | 2630 | if (localenv.ctype) |
2630 | result->mimetype = _FP_strdup (localenv.ctype); | |
2631 | result->mimetype = FP_strdup (localenv.ctype); | |
2631 | 2632 | else |
2632 | result->mimetype = _FP_strdup ("text/plain"); | |
2633 | ||
2634 | if (_FP_stristr (localenv.ctenc, "quoted-printable") != NULL) | |
2633 | result->mimetype = FP_strdup ("text/plain"); | |
2634 | ||
2635 | if (FP_stristr (localenv.ctenc, "quoted-printable") != NULL) | |
2635 | 2636 | result->uudet = QP_ENCODED; |
2636 | else if (_FP_stristr (localenv.ctenc, "base64") != NULL) | |
2637 | else if (FP_stristr (localenv.ctenc, "base64") != NULL) | |
2637 | 2638 | result->uudet = B64ENCODED; |
2638 | else if (_FP_stristr (localenv.ctenc, "x-uue") != NULL) { | |
2639 | else if (FP_stristr (localenv.ctenc, "x-uue") != NULL) { | |
2639 | 2640 | result->uudet = UU_ENCODED; |
2640 | 2641 | result->begin = result->end = 1; |
2641 | 2642 | } |
2642 | else if (_FP_stristr (localenv.ctenc, "x-yenc") != NULL) { | |
2643 | else if (FP_stristr (localenv.ctenc, "x-yenc") != NULL) { | |
2643 | 2644 | result->uudet = YENC_ENCODED; |
2644 | 2645 | result->begin = result->end = 1; |
2645 | 2646 | } |
2646 | else if (_FP_stristr (localenv.ctenc, "7bit") != NULL || | |
2647 | _FP_stristr (localenv.ctenc, "8bit") != NULL) | |
2647 | else if (FP_stristr (localenv.ctenc, "7bit") != NULL || | |
2648 | FP_stristr (localenv.ctenc, "8bit") != NULL) | |
2648 | 2649 | result->uudet = PT_ENCODED; |
2649 | else if (_FP_stristr (localenv.ctype, "multipart") != NULL || | |
2650 | _FP_stristr (localenv.ctype, "message") != NULL) | |
2650 | else if (FP_stristr (localenv.ctype, "multipart") != NULL || | |
2651 | FP_stristr (localenv.ctype, "message") != NULL) | |
2651 | 2652 | result->uudet = PT_ENCODED; |
2652 | 2653 | |
2653 | 2654 | /* |
2684 | 2685 | hcount = lcount = 0; |
2685 | 2686 | prevpos = ftell (datei); |
2686 | 2687 | |
2687 | if (_FP_stristr (localenv.ctype, "message") != NULL && | |
2688 | _FP_stristr (localenv.ctype, "rfc822") != NULL) { | |
2688 | if (FP_stristr (localenv.ctype, "message") != NULL && | |
2689 | FP_stristr (localenv.ctype, "rfc822") != NULL) { | |
2689 | 2690 | /* |
2690 | 2691 | * skip over empty lines and local header |
2691 | 2692 | */ |
2692 | 2693 | preheaders = ftell (datei); |
2693 | while (!feof (datei)) { | |
2694 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2694 | while (!FP_feof (datei)) { | |
2695 | if (FP_fgets (line, 1024, datei) == NULL) | |
2695 | 2696 | break; |
2696 | 2697 | if (!IsLineEmpty (line)) { |
2697 | 2698 | break; |
2698 | 2699 | } |
2699 | 2700 | } |
2700 | 2701 | |
2701 | while (!feof (datei) && !IsLineEmpty (line)) { | |
2702 | while (!FP_feof (datei) && !IsLineEmpty (line)) { | |
2702 | 2703 | if (IsKnownHeader (line)) |
2703 | 2704 | hcount++; |
2704 | 2705 | lcount++; |
2705 | 2706 | if (lcount > WAITHEADER && hcount < hlcount.afternl) |
2706 | 2707 | break; |
2707 | 2708 | |
2708 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2709 | if (FP_fgets (line, 1024, datei) == NULL) | |
2709 | 2710 | break; |
2710 | 2711 | } |
2711 | 2712 | if (hcount < hlcount.afternl) |
2717 | 2718 | * look for next header |
2718 | 2719 | */ |
2719 | 2720 | |
2720 | while (!feof (datei)) { | |
2721 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2721 | while (!FP_feof (datei)) { | |
2722 | if (FP_fgets (line, 1024, datei) == NULL) | |
2722 | 2723 | break; |
2723 | 2724 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
2724 | 2725 | if (ferror (datei)) |
2775 | 2776 | * produce result |
2776 | 2777 | */ |
2777 | 2778 | if (localenv.fname) { |
2778 | _FP_free (result->filename); | |
2779 | if ((result->filename = _FP_strdup (localenv.fname)) == NULL) | |
2779 | FP_free (result->filename); | |
2780 | if ((result->filename = FP_strdup (localenv.fname)) == NULL) | |
2780 | 2781 | *errcode = UURET_NOMEM; |
2781 | 2782 | } |
2782 | 2783 | else if (sstate.envelope.fname) { |
2783 | _FP_free (result->filename); | |
2784 | if ((result->filename = _FP_strdup (sstate.envelope.fname)) == NULL) | |
2784 | FP_free (result->filename); | |
2785 | if ((result->filename = FP_strdup (sstate.envelope.fname)) == NULL) | |
2785 | 2786 | *errcode = UURET_NOMEM; |
2786 | 2787 | } |
2787 | 2788 | else if ((result->uudet==QP_ENCODED || result->uudet==PT_ENCODED) && |
2788 | 2789 | result->filename == NULL) { |
2789 | 2790 | sprintf (line, "%04d.txt", ++mimseqno); |
2790 | if ((result->filename = _FP_strdup (line)) == NULL) | |
2791 | if ((result->filename = FP_strdup (line)) == NULL) | |
2791 | 2792 | *errcode = UURET_NOMEM; |
2792 | 2793 | } |
2793 | 2794 | else { |
2795 | 2796 | } |
2796 | 2797 | if (result->subject == NULL) { |
2797 | 2798 | if (sstate.envelope.subject) |
2798 | result->subject = _FP_strdup (sstate.envelope.subject); | |
2799 | result->subject = FP_strdup (sstate.envelope.subject); | |
2799 | 2800 | } |
2800 | 2801 | result->partno = sstate.envelope.partno; |
2801 | 2802 | result->maxpno = sstate.envelope.numparts; |
2802 | result->flags = FL_PARTIAL | | |
2803 | result->flags = FL_PARTIAL | | |
2803 | 2804 | ((res==1 || uu_fast_scanning) ? FL_PROPER : 0) | |
2804 | 2805 | ((uu_fast_scanning) ? FL_TOEND : 0); |
2805 | result->mimeid = _FP_strdup (sstate.envelope.mimeid); | |
2806 | result->mimeid = FP_strdup (sstate.envelope.mimeid); | |
2806 | 2807 | if (result->partno == 1) |
2807 | 2808 | result->begin = 1; |
2808 | 2809 | |
2812 | 2813 | result->length = prevpos - result->startpos; |
2813 | 2814 | |
2814 | 2815 | if (result->sfname == NULL) |
2815 | result->sfname = _FP_strdup (fname); | |
2816 | result->sfname = FP_strdup (fname); | |
2816 | 2817 | |
2817 | 2818 | if (result->mode == 0) |
2818 | 2819 | result->mode = 0644; |
2828 | 2829 | sstate.isfolder = 1; |
2829 | 2830 | sstate.ismime = 0; |
2830 | 2831 | sstate.mimestate = MS_HEADERS; |
2831 | ||
2832 | ||
2832 | 2833 | UUkillheaders (&sstate.envelope); |
2833 | 2834 | memset (&sstate.envelope, 0, sizeof (headers)); |
2834 | 2835 | } |
2856 | 2857 | |
2857 | 2858 | if (sstate.isfolder && sstate.ismime && |
2858 | 2859 | sstate.mimestate == MS_BODY && |
2859 | (_FP_stristr (sstate.envelope.ctenc, "quoted-printable") != NULL || | |
2860 | _FP_stristr (sstate.envelope.ctenc, "base64") != NULL || | |
2861 | _FP_stristr (sstate.envelope.ctenc, "x-uue") != NULL || | |
2862 | _FP_stristr (sstate.envelope.ctenc, "x-yenc") != NULL || | |
2863 | _FP_stristr (sstate.envelope.ctype, "message") != NULL || | |
2860 | (FP_stristr (sstate.envelope.ctenc, "quoted-printable") != NULL || | |
2861 | FP_stristr (sstate.envelope.ctenc, "base64") != NULL || | |
2862 | FP_stristr (sstate.envelope.ctenc, "x-uue") != NULL || | |
2863 | FP_stristr (sstate.envelope.ctenc, "x-yenc") != NULL || | |
2864 | FP_stristr (sstate.envelope.ctype, "message") != NULL || | |
2864 | 2865 | sstate.envelope.fname != NULL)) { |
2865 | 2866 | |
2866 | 2867 | if (sstate.envelope.subject) |
2867 | result->subject = _FP_strdup (sstate.envelope.subject); | |
2868 | result->subject = FP_strdup (sstate.envelope.subject); | |
2868 | 2869 | if (sstate.envelope.from) |
2869 | result->origin = _FP_strdup (sstate.envelope.from); | |
2870 | result->origin = FP_strdup (sstate.envelope.from); | |
2870 | 2871 | |
2871 | 2872 | if (sstate.envelope.ctype) |
2872 | result->mimetype = _FP_strdup (sstate.envelope.ctype); | |
2873 | result->mimetype = FP_strdup (sstate.envelope.ctype); | |
2873 | 2874 | else |
2874 | result->mimetype = _FP_strdup ("text/plain"); | |
2875 | ||
2876 | if (_FP_stristr (sstate.envelope.ctenc, "quoted-printable") != NULL) | |
2875 | result->mimetype = FP_strdup ("text/plain"); | |
2876 | ||
2877 | if (FP_stristr (sstate.envelope.ctenc, "quoted-printable") != NULL) | |
2877 | 2878 | result->uudet = QP_ENCODED; |
2878 | else if (_FP_stristr (sstate.envelope.ctenc, "base64") != NULL) | |
2879 | else if (FP_stristr (sstate.envelope.ctenc, "base64") != NULL) | |
2879 | 2880 | result->uudet = B64ENCODED; |
2880 | else if (_FP_stristr (sstate.envelope.ctenc, "x-uue") != NULL) { | |
2881 | else if (FP_stristr (sstate.envelope.ctenc, "x-uue") != NULL) { | |
2881 | 2882 | result->uudet = UU_ENCODED; |
2882 | 2883 | result->begin = result->end = 1; |
2883 | 2884 | } |
2884 | else if (_FP_stristr (sstate.envelope.ctenc, "x-yenc") != NULL) { | |
2885 | else if (FP_stristr (sstate.envelope.ctenc, "x-yenc") != NULL) { | |
2885 | 2886 | result->uudet = YENC_ENCODED; |
2886 | 2887 | } |
2887 | else if (_FP_stristr (sstate.envelope.ctenc, "7bit") != NULL || | |
2888 | _FP_stristr (sstate.envelope.ctenc, "8bit") != NULL) | |
2888 | else if (FP_stristr (sstate.envelope.ctenc, "7bit") != NULL || | |
2889 | FP_stristr (sstate.envelope.ctenc, "8bit") != NULL) | |
2889 | 2890 | result->uudet = PT_ENCODED; |
2890 | else if (_FP_stristr (sstate.envelope.ctype, "multipart") != NULL || | |
2891 | _FP_stristr (sstate.envelope.ctype, "message") != NULL || | |
2891 | else if (FP_stristr (sstate.envelope.ctype, "multipart") != NULL || | |
2892 | FP_stristr (sstate.envelope.ctype, "message") != NULL || | |
2892 | 2893 | sstate.envelope.fname != NULL) |
2893 | 2894 | result->uudet = PT_ENCODED; |
2894 | 2895 | |
2917 | 2918 | hcount = lcount = 0; |
2918 | 2919 | prevpos = ftell (datei); |
2919 | 2920 | |
2920 | if (_FP_stristr (sstate.envelope.ctype, "message") != NULL && | |
2921 | _FP_stristr (sstate.envelope.ctype, "rfc822") != NULL) { | |
2921 | if (FP_stristr (sstate.envelope.ctype, "message") != NULL && | |
2922 | FP_stristr (sstate.envelope.ctype, "rfc822") != NULL) { | |
2922 | 2923 | /* |
2923 | 2924 | * skip over empty lines and local header |
2924 | 2925 | */ |
2925 | 2926 | preheaders = ftell (datei); |
2926 | while (!feof (datei)) { | |
2927 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2927 | while (!FP_feof (datei)) { | |
2928 | if (FP_fgets (line, 1024, datei) == NULL) | |
2928 | 2929 | break; |
2929 | 2930 | if (!IsLineEmpty (line)) { |
2930 | 2931 | break; |
2931 | 2932 | } |
2932 | 2933 | } |
2933 | 2934 | |
2934 | while (!feof (datei) && !IsLineEmpty (line)) { | |
2935 | while (!FP_feof (datei) && !IsLineEmpty (line)) { | |
2935 | 2936 | if (IsKnownHeader (line)) |
2936 | 2937 | hcount++; |
2937 | 2938 | lcount++; |
2938 | 2939 | if (lcount > WAITHEADER && hcount < hlcount.afternl) |
2939 | 2940 | break; |
2940 | 2941 | |
2941 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2942 | if (FP_fgets (line, 1024, datei) == NULL) | |
2942 | 2943 | break; |
2943 | 2944 | } |
2944 | 2945 | if (hcount < hlcount.afternl) |
2950 | 2951 | * look for next header |
2951 | 2952 | */ |
2952 | 2953 | |
2953 | while (!feof (datei)) { | |
2954 | if (_FP_fgets (line, 1024, datei) == NULL) | |
2954 | while (!FP_feof (datei)) { | |
2955 | if (FP_fgets (line, 1024, datei) == NULL) | |
2955 | 2956 | break; |
2956 | 2957 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
2957 | 2958 | if (ferror (datei)) |
3006 | 3007 | * produce result |
3007 | 3008 | */ |
3008 | 3009 | if (sstate.envelope.fname) { |
3009 | _FP_free (result->filename); | |
3010 | if ((result->filename = _FP_strdup (sstate.envelope.fname)) == NULL) | |
3010 | FP_free (result->filename); | |
3011 | if ((result->filename = FP_strdup (sstate.envelope.fname)) == NULL) | |
3011 | 3012 | *errcode = UURET_NOMEM; |
3012 | 3013 | } |
3013 | 3014 | else if ((result->uudet==QP_ENCODED||result->uudet==PT_ENCODED) && |
3014 | 3015 | result->filename == NULL) { |
3015 | 3016 | sprintf (line, "%04d.txt", ++mimseqno); |
3016 | if ((result->filename = _FP_strdup (line)) == NULL) | |
3017 | if ((result->filename = FP_strdup (line)) == NULL) | |
3017 | 3018 | *errcode = UURET_NOMEM; |
3018 | 3019 | } |
3019 | 3020 | else { |
3021 | 3022 | } |
3022 | 3023 | if (result->subject == NULL) { |
3023 | 3024 | if (sstate.envelope.subject) |
3024 | result->subject = _FP_strdup (sstate.envelope.subject); | |
3025 | result->subject = FP_strdup (sstate.envelope.subject); | |
3025 | 3026 | } |
3026 | 3027 | result->flags = ((res==1||uu_fast_scanning)?FL_PROPER:0) | |
3027 | 3028 | ((uu_fast_scanning) ? FL_TOEND : 0); |
3028 | result->mimeid = _FP_strdup (sstate.envelope.mimeid); | |
3029 | result->mimeid = FP_strdup (sstate.envelope.mimeid); | |
3029 | 3030 | |
3030 | 3031 | if (uu_fast_scanning) |
3031 | 3032 | result->length = progress.fsize - result->startpos; |
3033 | 3034 | result->length = prevpos - result->startpos; |
3034 | 3035 | |
3035 | 3036 | if (result->sfname == NULL) |
3036 | result->sfname = _FP_strdup (fname); | |
3037 | result->sfname = FP_strdup (fname); | |
3037 | 3038 | |
3038 | 3039 | if (result->mode == 0) |
3039 | 3040 | result->mode = 0644; |
3076 | 3077 | * be here! |
3077 | 3078 | */ |
3078 | 3079 | |
3079 | if ((!sstate.envelope.ctype || _FP_stristr (sstate.envelope.ctype, "multipart")) | |
3080 | if ((!sstate.envelope.ctype || FP_stristr (sstate.envelope.ctype, "multipart")) | |
3080 | 3081 | && !uu_more_mime) { |
3081 | 3082 | prevpos = ftell (datei); |
3082 | while (!feof (datei)) { | |
3083 | if (_FP_fgets (line, 1024, datei) == NULL) | |
3083 | while (!FP_feof (datei)) { | |
3084 | if (FP_fgets (line, 1024, datei) == NULL) | |
3084 | 3085 | break; |
3085 | 3086 | if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL(); |
3086 | 3087 | if (!IsLineEmpty (line)) |
3087 | 3088 | break; |
3088 | 3089 | } |
3089 | 3090 | if (line[0] == '-' && line[1] == '-' && |
3090 | !IsLineEmpty (line+2) && !feof (datei)) { | |
3091 | ptr1 = _FP_strrstr (line+2, "--"); | |
3091 | !IsLineEmpty (line+2) && !FP_feof (datei)) { | |
3092 | ptr1 = FP_strrstr (line+2, "--"); | |
3092 | 3093 | ptr2 = ScanHeaderLine (datei, NULL); |
3093 | 3094 | if ((ptr1 == NULL || ptr1[2]) && |
3094 | ptr2 && _FP_strnicmp (ptr2, "Content-", 8) == 0) { | |
3095 | ptr2 && FP_strnicmp_fast (ptr2, "Content-", 8) == 0) { | |
3095 | 3096 | /* |
3096 | 3097 | * hmm, okay, let's do it! |
3097 | 3098 | */ |
3106 | 3107 | ptr1++; |
3107 | 3108 | *ptr1 = '\0'; |
3108 | 3109 | |
3109 | sstate.envelope.mimevers = _FP_strdup ("1.0"); | |
3110 | sstate.envelope.boundary = _FP_strdup (line+2); | |
3111 | ||
3110 | sstate.envelope.mimevers = FP_strdup ("1.0"); | |
3111 | sstate.envelope.boundary = FP_strdup (line+2); | |
3112 | ||
3112 | 3113 | /* |
3113 | 3114 | * need restart |
3114 | 3115 | */ |
3115 | ||
3116 | ||
3116 | 3117 | fseek (datei, prevpos, SEEK_SET); |
3117 | ||
3118 | _FP_free (result); | |
3118 | ||
3119 | FP_free (result); | |
3119 | 3120 | return NULL; |
3120 | 3121 | } |
3121 | 3122 | } |
3129 | 3130 | */ |
3130 | 3131 | |
3131 | 3132 | if (sstate.envelope.subject) |
3132 | result->subject = _FP_strdup (sstate.envelope.subject); | |
3133 | result->subject = FP_strdup (sstate.envelope.subject); | |
3133 | 3134 | |
3134 | 3135 | if (sstate.envelope.from) |
3135 | result->origin = _FP_strdup (sstate.envelope.from); | |
3136 | result->origin = FP_strdup (sstate.envelope.from); | |
3136 | 3137 | |
3137 | 3138 | if (sstate.envelope.ctype) |
3138 | result->mimetype = _FP_strdup (sstate.envelope.ctype); | |
3139 | ||
3140 | if ((res=ScanData (datei, fname, errcode, NULL, | |
3139 | result->mimetype = FP_strdup (sstate.envelope.ctype); | |
3140 | ||
3141 | if ((res=ScanData (datei, fname, errcode, NULL, | |
3141 | 3142 | sstate.ismime, 1, result))==-1) { |
3142 | 3143 | /* oops, something went wrong */ |
3143 | 3144 | sstate.isfolder = 0; |
3162 | 3163 | */ |
3163 | 3164 | } |
3164 | 3165 | else if (sstate.envelope.fname) { |
3165 | _FP_free (result->filename); | |
3166 | if ((result->filename = _FP_strdup (sstate.envelope.fname)) == NULL) | |
3166 | FP_free (result->filename); | |
3167 | if ((result->filename = FP_strdup (sstate.envelope.fname)) == NULL) | |
3167 | 3168 | *errcode = UURET_NOMEM; |
3168 | 3169 | } |
3169 | 3170 | else if ((result->uudet==QP_ENCODED||result->uudet==PT_ENCODED) && |
3170 | 3171 | result->filename == NULL) { |
3171 | 3172 | sprintf (line, "%04d.txt", ++mimseqno); |
3172 | if ((result->filename = _FP_strdup (line)) == NULL) | |
3173 | if ((result->filename = FP_strdup (line)) == NULL) | |
3173 | 3174 | *errcode = UURET_NOMEM; |
3174 | 3175 | } |
3175 | 3176 | else { |
3178 | 3179 | |
3179 | 3180 | if (result->subject == NULL) { |
3180 | 3181 | if (sstate.envelope.subject) |
3181 | result->subject = _FP_strdup (sstate.envelope.subject); | |
3182 | result->subject = FP_strdup (sstate.envelope.subject); | |
3182 | 3183 | } |
3183 | 3184 | |
3184 | 3185 | result->flags = (result->uudet==PT_ENCODED)?FL_SINGLE:0; |
3185 | result->mimeid = _FP_strdup (sstate.envelope.mimeid); | |
3186 | result->mimeid = FP_strdup (sstate.envelope.mimeid); | |
3186 | 3187 | result->length = ftell (datei) - result->startpos; |
3187 | 3188 | |
3188 | 3189 | if (result->mode == 0) |
3189 | 3190 | result->mode = 0644; |
3190 | 3191 | |
3191 | 3192 | if (result->sfname == NULL) |
3192 | result->sfname = _FP_strdup (fname); | |
3193 | result->sfname = FP_strdup (fname); | |
3193 | 3194 | |
3194 | 3195 | if (res == 1) { |
3195 | 3196 | /* |
3222 | 3223 | while (mssdepth) { |
3223 | 3224 | mssdepth--; |
3224 | 3225 | UUkillheaders (&(multistack[mssdepth].envelope)); |
3225 | _FP_free (multistack[mssdepth].source); | |
3226 | FP_free (multistack[mssdepth].source); | |
3226 | 3227 | } |
3227 | 3228 | |
3228 | 3229 | return NULL; |
100 | 100 | { S_BINHEX_SIZES, "BinHex file: data/resource fork sizes %ld/%ld" }, |
101 | 101 | { S_BINHEX_BOTH, "BinHex file: both forks non-empty, decoding data fork" }, |
102 | 102 | { S_SMERGE_MERGED, "Parts of '%s' merged with parts of '%s' (%d)" }, |
103 | ||
103 | ||
104 | 104 | /* MIME-related messages */ |
105 | 105 | { S_MIME_NO_BOUNDARY, "Multipart message without boundary ignored" }, |
106 | 106 | { S_MIME_B_NOT_FOUND, "Boundary expected on Multipart message but found EOF" }, |
89 | 89 | UUkillfread (fileread *data) |
90 | 90 | { |
91 | 91 | if (data != NULL) { |
92 | _FP_free (data->subject); | |
93 | _FP_free (data->filename); | |
94 | _FP_free (data->origin); | |
95 | _FP_free (data->mimeid); | |
96 | _FP_free (data->mimetype); | |
97 | _FP_free (data->sfname); | |
98 | _FP_free (data); | |
92 | FP_free (data->subject); | |
93 | FP_free (data->filename); | |
94 | FP_free (data->origin); | |
95 | FP_free (data->mimeid); | |
96 | FP_free (data->mimetype); | |
97 | FP_free (data->sfname); | |
98 | FP_free (data); | |
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
105 | 105 | uufile *next; |
106 | 106 | |
107 | 107 | while (data) { |
108 | _FP_free (data->filename); | |
109 | _FP_free (data->subfname); | |
110 | _FP_free (data->mimeid); | |
111 | _FP_free (data->mimetype); | |
108 | FP_free (data->filename); | |
109 | FP_free (data->subfname); | |
110 | FP_free (data->mimeid); | |
111 | FP_free (data->mimetype); | |
112 | 112 | UUkillfread (data->data); |
113 | 113 | |
114 | 114 | next = data->NEXT; |
115 | _FP_free (data); | |
115 | FP_free (data); | |
116 | 116 | data = next; |
117 | 117 | } |
118 | 118 | } |
129 | 129 | uustring (S_TMP_NOT_REMOVED), |
130 | 130 | data->binfile, strerror (errno)); |
131 | 131 | |
132 | _FP_free (data->filename); | |
133 | _FP_free (data->subfname); | |
134 | _FP_free (data->mimeid); | |
135 | _FP_free (data->mimetype); | |
136 | _FP_free (data->binfile); | |
132 | FP_free (data->filename); | |
133 | FP_free (data->subfname); | |
134 | FP_free (data->mimeid); | |
135 | FP_free (data->mimetype); | |
136 | FP_free (data->binfile); | |
137 | 137 | UUkillfile (data->thisfile); |
138 | _FP_free (data->haveparts); | |
139 | _FP_free (data->misparts); | |
138 | FP_free (data->haveparts); | |
139 | FP_free (data->misparts); | |
140 | 140 | |
141 | 141 | next = data->NEXT; |
142 | _FP_free (data); | |
142 | FP_free (data); | |
143 | 143 | data = next; |
144 | 144 | } |
145 | 145 | } |
152 | 152 | UUkillheaders (headers *data) |
153 | 153 | { |
154 | 154 | if (data != NULL) { |
155 | _FP_free (data->from); | |
156 | _FP_free (data->subject); | |
157 | _FP_free (data->rcpt); | |
158 | _FP_free (data->date); | |
159 | _FP_free (data->mimevers); | |
160 | _FP_free (data->ctype); | |
161 | _FP_free (data->ctenc); | |
162 | _FP_free (data->fname); | |
163 | _FP_free (data->boundary); | |
164 | _FP_free (data->mimeid); | |
155 | FP_free (data->from); | |
156 | FP_free (data->subject); | |
157 | FP_free (data->rcpt); | |
158 | FP_free (data->date); | |
159 | FP_free (data->mimevers); | |
160 | FP_free (data->ctype); | |
161 | FP_free (data->ctenc); | |
162 | FP_free (data->fname); | |
163 | FP_free (data->boundary); | |
164 | FP_free (data->mimeid); | |
165 | 165 | memset (data, 0, sizeof (headers)); |
166 | 166 | } |
167 | 167 | } |
174 | 174 | static int |
175 | 175 | UUSMPKnownExt (char *filename) |
176 | 176 | { |
177 | char **eiter = knownexts, *ptr=_FP_strrchr(filename, '.'); | |
177 | char **eiter = knownexts, *ptr=FP_strrchr(filename, '.'); | |
178 | 178 | int count=0, where=0; |
179 | 179 | |
180 | 180 | if (ptr == NULL) |
182 | 182 | ptr++; |
183 | 183 | |
184 | 184 | while (*eiter) { |
185 | if (_FP_stricmp (ptr, (**eiter=='@')?*eiter+1:*eiter) == 0) | |
185 | if (FP_stricmp (ptr, (**eiter=='@')?*eiter+1:*eiter) == 0) | |
186 | 186 | return where; |
187 | 187 | else |
188 | 188 | eiter++; |
214 | 214 | */ |
215 | 215 | |
216 | 216 | int |
217 | UUbhdecomp (char *in, char *out, char *last, int *rpc, | |
217 | UUbhdecomp (char *in, char *out, char *last, int *rpc, | |
218 | 218 | size_t inc, size_t max, size_t *opc) |
219 | 219 | { |
220 | 220 | size_t count, used=0, dummy; |
382 | 382 | fiter = addit->thisfile; |
383 | 383 | |
384 | 384 | if (iter->filename == NULL && addit->filename != NULL) |
385 | iter->filename = _FP_strdup (addit->filename); | |
385 | iter->filename = FP_strdup (addit->filename); | |
386 | 386 | |
387 | 387 | if (addit->begin) iter->begin = 1; |
388 | 388 | if (addit->end) iter->end = 1; |
447 | 447 | uustring (S_SMERGE_MERGED), |
448 | 448 | (iter->subfname) ? iter->subfname : "", |
449 | 449 | (res->subfname) ? res->subfname : "", pass); |
450 | ||
450 | ||
451 | 451 | temp = iter->NEXT; |
452 | 452 | iter->NEXT = NULL; |
453 | 453 | UUkilllist (iter); |