ctb_formats_detection/platform.rs
1/*
2$File: COPYING,v 1.2 2018/09/09 20:33:28 christos Exp $
3Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
4Software written by Ian F. Darwin and others;
5maintained 1994- Christos Zoulas.
6
7This software is not subject to any export provision of the United States
8Department of Commerce, and may be exported to any country or planet.
9
10Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions
12are met:
131. Redistributions of source code must retain the above copyright
14 notice immediately at the beginning of the file, without modification,
15 this list of conditions, and the following disclaimer.
162. Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in the
18 documentation and/or other materials provided with the distribution.
19
20THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
24ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30SUCH DAMAGE.
31
32The preceding notice is from COPYING in `file`.
33
34
35
36/*
37 * Copyright (c) Ian F. Darwin 1986-1995.
38 * Software written by Ian F. Darwin and others;
39 * maintained 1995-present by Christos Zoulas and others.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 * 1. Redistributions of source code must retain the above copyright
45 * notice immediately at the beginning of the file, without modification,
46 * this list of conditions, and the following disclaimer.
47 * 2. Redistributions in binary form must reproduce the above copyright
48 * notice, this list of conditions and the following disclaimer in the
49 * documentation and/or other materials provided with the distribution.
50 *
51 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
52 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
55 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61 * SUCH DAMAGE.
62 */
63
64The preceding notice is from src/apprentice.c, src/ascmagic.c, src/compress.c, src/encoding.c, src/file.c, src/file.h, src/fsmagic.c, src/missing/asprintf.c, src/missing/dprintf.c, src/print.c, src/softmagic.c, src/swap.c, and src/swap.h in `file`.
65
66
67
68/*
69 * Copyright (c) Christos Zoulas 2017.
70 * All Rights Reserved.
71 *
72 * Redistribution and use in source and binary forms, with or without
73 * modification, are permitted provided that the following conditions
74 * are met:
75 * 1. Redistributions of source code must retain the above copyright
76 * notice immediately at the beginning of the file, without modification,
77 * this list of conditions, and the following disclaimer.
78 * 2. Redistributions in binary form must reproduce the above copyright
79 * notice, this list of conditions and the following disclaimer in the
80 * documentation and/or other materials provided with the distribution.
81 *
82 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
83 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
84 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
85 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
86 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
87 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
88 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
89 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
90 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
91 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
92 * SUCH DAMAGE.
93 */
94
95The preceding notice is from src/buffer.c in `file`.
96
97
98
99/*
100 * Copyright (c) Christos Zoulas 2008.
101 * All Rights Reserved.
102 *
103 * Redistribution and use in source and binary forms, with or without
104 * modification, are permitted provided that the following conditions
105 * are met:
106 * 1. Redistributions of source code must retain the above copyright
107 * notice immediately at the beginning of the file, without modification,
108 * this list of conditions, and the following disclaimer.
109 * 2. Redistributions in binary form must reproduce the above copyright
110 * notice, this list of conditions and the following disclaimer in the
111 * documentation and/or other materials provided with the distribution.
112 *
113 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
114 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
115 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
116 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
117 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
118 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
119 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
120 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
121 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
122 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
123 * SUCH DAMAGE.
124 */
125
126The preceding notice is from src/elfclass.h in `file`.
127
128
129
130/*
131 * Copyright (c) Christos Zoulas 2003.
132 * All Rights Reserved.
133 *
134 * Redistribution and use in source and binary forms, with or without
135 * modification, are permitted provided that the following conditions
136 * are met:
137 * 1. Redistributions of source code must retain the above copyright
138 * notice immediately at the beginning of the file, without modification,
139 * this list of conditions, and the following disclaimer.
140 * 2. Redistributions in binary form must reproduce the above copyright
141 * notice, this list of conditions and the following disclaimer in the
142 * documentation and/or other materials provided with the distribution.
143 *
144 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
145 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
146 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
147 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
148 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
149 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
150 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
151 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
152 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
153 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
154 * SUCH DAMAGE.
155 */
156
157The preceding notice is from src/funcs.c, src/magic.c, src/magic.h.in, src/readelf.c, and src/readelf.h in `file`.
158
159
160
161/*
162 * Copyright (c) Ian F. Darwin 1986-1995.
163 * Software written by Ian F. Darwin and others;
164 * maintained 1995-present by Christos Zoulas and others.
165 *
166 * Redistribution and use in source and binary forms, with or without
167 * modification, are permitted provided that the following conditions
168 * are met:
169 * 1. Redistributions of source code must retain the above copyright
170 * notice immediately at the beginning of the file, without modification,
171 * this list of conditions, and the following disclaimer.
172 * 2. Redistributions in binary form must reproduce the above copyright
173 * notice, this list of conditions and the following disclaimer in the
174 * documentation and/or other materials provided with the distribution.
175 *
176 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
177 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
178 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
179 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
180 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
181 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
182 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
183 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
184 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
185 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
186 * SUCH DAMAGE.
187 */
188
189/*
190 * is_tar() -- figure out whether file is a tar archive.
191 *
192 * Stolen (by the author!) from the file_public domain tar program:
193 * Public Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
194 *
195 * @(#)list.c 1.18 9/23/86 Public Domain - gnu
196 *
197 * Comments changed and some code/comments reformatted
198 * for file command by Ian Darwin.
199 */
200
201The preceding notice is from src/is_tar.c in `file`.
202
203
204
205/*
206 * Redistribution and use in source and binary forms, with or without
207 * modification, are permitted provided that the following conditions
208 * are met:
209 * 1. Redistributions of source code must retain the above copyright
210 * notice immediately at the beginning of the file, without modification,
211 * this list of conditions, and the following disclaimer.
212 * 2. Redistributions in binary form must reproduce the above copyright
213 * notice, this list of conditions and the following disclaimer in the
214 * documentation and/or other materials provided with the distribution.
215 *
216 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
217 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
218 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
219 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
220 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
222 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
223 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
224 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
225 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
226 * SUCH DAMAGE.
227 */
228
229The preceding notice is from src/landlock.c and src/seccomp.c in `file`.
230
231
232
233/*
234 * Copyright (c) Christos Zoulas 2021.
235 * All Rights Reserved.
236 *
237 * Redistribution and use in source and binary forms, with or without
238 * modification, are permitted provided that the following conditions
239 * are met:
240 * 1. Redistributions of source code must retain the above copyright
241 * notice immediately at the beginning of the file, without modification,
242 * this list of conditions, and the following disclaimer.
243 * 2. Redistributions in binary form must reproduce the above copyright
244 * notice, this list of conditions and the following disclaimer in the
245 * documentation and/or other materials provided with the distribution.
246 *
247 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
248 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
249 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
250 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
251 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
252 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
253 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
254 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
255 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
256 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
257 * SUCH DAMAGE.
258 */
259
260The preceding notice is from src/memtest.c in `file`.
261
262
263
264/*
265 * Copyright (c) Ian F. Darwin 1986-1995.
266 * Software written by Ian F. Darwin and others;
267 * maintained 1995-present by Christos Zoulas and others.
268 *
269 * Redistribution and use in source and binary forms, with or without
270 * modification, are permitted provided that the following conditions
271 * are met:
272 * 1. Redistributions of source code must retain the above copyright
273 * notice immediately at the beginning of the file, without modification,
274 * this list of conditions, and the following disclaimer.
275 * 2. Redistributions in binary form must reproduce the above copyright
276 * notice, this list of conditions and the following disclaimer in the
277 * documentation and/or other materials provided with the distribution.
278 *
279 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
280 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
282 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
283 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
284 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
285 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
286 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
287 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
288 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
289 * SUCH DAMAGE.
290 */
291
292/*###########################################################################
293 # #
294 # vasprintf #
295 # #
296 # Copyright (c) 2002-2005 David TAILLANDIER #
297 # #
298 ###########################################################################*/
299
300/*
301
302This software is distributed under the "modified BSD licence".
303
304This software is also released with GNU license (GPL) in another file (same
305source-code, only license differ).
306
307
308
309Redistribution and use in source and binary forms, with or without
310modification, are permitted provided that the following conditions are met:
311
312Redistributions of source code must retain the above copyright notice, this
313list of conditions and the following disclaimer. Redistributions in binary
314form must reproduce the above copyright notice, this list of conditions and
315the following disclaimer in the documentation and/or other materials
316provided with the distribution. The name of the author may not be used to
317endorse or promote products derived from this software without specific
318prior written permission.
319
320THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
321WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
322MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
323EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
324SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
325PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
326OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
327WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
328OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
329ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
330
331====================
332
333Hacked from xnprintf version of 26th February 2005 to provide only
334vasprintf by Reuben Thomas <rrt@sc3d.org>.
335
336====================
337
338
339'printf' function family use the following format string:
340
341%[flag][width][.prec][modifier]type
342
343%% is the escape sequence to print a '%'
344% followed by an unknown format will print the characters without
345trying to do any interpretation
346
347flag: none + - # (blank)
348width: n 0n *
349prec: none .0 .n .*
350modifier: F N L h l ll z t ('F' and 'N' are ms-dos/16-bit specific)
351type: d i o u x X f e g E G c s p n
352
353
354The function needs to allocate memory to store the full text before to
355actually writing it. i.e if you want to fnprintf() 1000 characters, the
356functions will allocate 1000 bytes.
357This behaviour can be modified: you have to customise the code to flush the
358internal buffer (writing to screen or file) when it reach a given size. Then
359the buffer can have a shorter length. But what? If you really need to write
360HUGE string, don't use printf!
361During the process, some other memory is allocated (1024 bytes minimum)
362to handle the output of partial sprintf() calls. If you have only 10000 bytes
363free in memory, you *may* not be able to nprintf() an 8000 bytes-long text.
364
365note: if a buffer overflow occurs, exit() is called. This situation should
366never appear ... but if you want to be *really* sure, you have to modify the
367code to handle those situations (only one place to modify).
368A buffer overflow can only occur if your sprintf() do strange things or when
369you use strange formats.
370
371*/
372
373The preceding notice is from src/missing/vasprintf.c in `file`.
374
375
376
377/*
378 * Copyright (c) Ian F. Darwin 1986-1995.
379 * Software written by Ian F. Darwin and others;
380 * maintained 1995-present by Christos Zoulas and others.
381 *
382 * Redistribution and use in source and binary forms, with or without
383 * modification, are permitted provided that the following conditions
384 * are met:
385 * 1. Redistributions of source code must retain the above copyright
386 * notice immediately at the beginning of the file, without modification,
387 * this list of conditions, and the following disclaimer.
388 * 2. Redistributions in binary form must reproduce the above copyright
389 * notice, this list of conditions and the following disclaimer in the
390 * documentation and/or other materials provided with the distribution.
391 *
392 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
393 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
394 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
395 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
396 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
397 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
398 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
399 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
400 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
401 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
402 * SUCH DAMAGE.
403 */
404
405/*
406 * Header file for file_public domain tar (tape archive) program.
407 *
408 * @(#)tar.h 1.20 86/10/29 Public Domain.
409 *
410 * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
411 *
412 * $File: tar.h,v 1.16 2022/12/26 17:31:14 christos Exp $ # checkin only
413 */
414
415The preceding notice is from src/tar.h in `file`.
416*/
417
418// SPDX-License-Identifier: AGPL-3.0-or-later AND BSD-2-Clause-Darwin AND Apache-2.0 AND MIT AND BSD-3-Clause
419// SPDX-License-Identifier for parts derived from `file` (libmagic): BSD-2-Clause-Darwin AND BSD-3-Clause
420// SPDX-License-Identifier for parts derived from polyfile: Apache-2.0
421// SPDX-License-Identifier for parts derived from fileid and binwalk: MIT
422// SPDX-License-Identifier for parts derived from DROID: BSD-3-Clause
423/*
424This file is part of Collective Toolbox, a database and document workspace and utilities.
425Copyright (C) 2026 Collective Toolbox Developers
426Contact: info@collectivetoolbox.com
427
428This program is free software: you can redistribute it and/or modify it under
429the terms of the GNU Affero General Public License as published by the Free
430Software Foundation, either version 3 of the License, or (at your option) any
431later version.
432
433This program is distributed in the hope that it will be useful, but WITHOUT ANY
434WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
435A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
436
437You should have received a copy of the GNU Affero General Public License along
438with this program. If not, see <https://www.gnu.org/licenses/>.
439*/
440
441// The Collective Toolbox file detection tools, of which this file is a part, combine elements from several other similar tools: `file`, polyfile, binwalk, fileid, and DROID.
442// See license texts at the beginning and end of this file for full license details for parts derived from `file` <https://www.darwinsys.com/file/>.
443// See the full license details for parts derived from polyfile <https://github.com/trailofbits/polyfile>, binwalk <https://github.com/ReFirmLabs/binwalk>, fileid <https://github.com/DBHeise/fileid>, and DROID <https://github.com/digital-preservation/droid> at the end of this file.
444
445//! Platform association, operating system compatibility matching, and
446//! environment prior scoring for format detection.
447
448#[allow(
449 unused_imports,
450 clippy::wildcard_imports,
451 reason = "Standard workspace module prelude"
452)]
453use crate::utilities::*;
454
455pub use ctb_formats_utilities::platform::{current_platform_os, is_os_match};
456
457use crate::detection::mime_derivation::FORMAT_CATALOG;
458use crate::format_id::FormatId;
459
460/// Checks whether a candidate format has recorded OS associations compatible
461/// with the specified target operating system.
462#[must_use]
463pub fn format_matches_platform(
464 format_id: FormatId,
465 target_os: FormatId,
466) -> bool {
467 if let Some(mapping) = FORMAT_CATALOG.lookup_ident(format_id.ident()) {
468 mapping
469 .os_associations
470 .iter()
471 .any(|&cand_os| is_os_match(cand_os, target_os))
472 } else {
473 false
474 }
475}
476
477#[cfg(test)]
478#[allow(
479 clippy::panic,
480 clippy::expect_used,
481 clippy::unwrap_used,
482 clippy::unwrap_in_result,
483 clippy::panic_in_result_fn,
484 clippy::indexing_slicing,
485 clippy::arithmetic_side_effects,
486 reason = "Standard repository test boilerplate"
487)]
488mod tests {
489 use super::*;
490
491 #[ctb_test]
492 fn test_os_match_matrix() {
493 assert!(is_os_match(FormatId::Linux, FormatId::Unix));
494 assert!(is_os_match(FormatId::Unix, FormatId::Linux));
495 assert!(is_os_match(FormatId::MacOs, FormatId::MacOsDarwin));
496 assert!(is_os_match(FormatId::WinClassic, FormatId::Windows));
497 assert!(!is_os_match(FormatId::Windows, FormatId::Linux));
498 }
499
500 #[ctb_test]
501 fn test_current_platform_os_is_consistent() {
502 let os = current_platform_os();
503 #[cfg(target_os = "linux")]
504 assert_eq!(os, Some(FormatId::GnuLinux));
505 #[cfg(target_os = "macos")]
506 assert_eq!(os, Some(FormatId::MacOs));
507 #[cfg(target_os = "windows")]
508 assert_eq!(os, Some(FormatId::Windows));
509 }
510}
511/*
512/*
513 * Adapted from: apptype.c, Written by Eberhard Mattes and put into the
514 * file_public domain
515 *
516 * Notes: 1. Qualify the filename so that DosQueryAppType does not do extraneous
517 * searches.
518 *
519 * 2. DosQueryAppType will return FAPPTYP_DOS on a file ending with ".com"
520 * (other than an OS/2 exe or Win exe with this name). Eberhard Mattes
521 * remarks Tue, 6 Apr 93: Moreover, it reports the type of the (new and very
522 * bug ridden) Win Emacs as "OS/2 executable".
523 *
524 * 3. apptype() uses the filename if given, otherwise a tmp file is created with
525 * the contents of buf. If buf is not the complete file, apptype can
526 * incorrectly identify the exe type. The "-z" option of "file" is the reason
527 * for this ugly code.
528 */
529
530The preceding notice is from src/apptype.c in `file`.
531
532
533
534/*-
535 * Copyright (c) 2008 Christos Zoulas
536 * All rights reserved.
537 *
538 * Redistribution and use in source and binary forms, with or without
539 * modification, are permitted provided that the following conditions
540 * are met:
541 * 1. Redistributions of source code must retain the above copyright
542 * notice, this list of conditions and the following disclaimer.
543 * 2. Redistributions in binary form must reproduce the above copyright
544 * notice, this list of conditions and the following disclaimer in the
545 * documentation and/or other materials provided with the distribution.
546 *
547 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
548 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
549 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
550 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
551 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
552 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
553 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
554 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
555 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
556 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
557 * POSSIBILITY OF SUCH DAMAGE.
558 */
559
560The preceding notice is from src/cdf.c, src/cdf.h, and src/cdf_time.c in `file`.
561
562
563
564/*-
565 * Copyright (c) 2016 Christos Zoulas
566 * All rights reserved.
567 *
568 * Redistribution and use in source and binary forms, with or without
569 * modification, are permitted provided that the following conditions
570 * are met:
571 * 1. Redistributions of source code must retain the above copyright
572 * notice, this list of conditions and the following disclaimer.
573 * 2. Redistributions in binary form must reproduce the above copyright
574 * notice, this list of conditions and the following disclaimer in the
575 * documentation and/or other materials provided with the distribution.
576 *
577 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
578 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
579 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
580 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
581 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
582 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
583 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
584 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
585 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
586 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
587 * POSSIBILITY OF SUCH DAMAGE.
588 */
589
590The preceding notice is from src/der.c and src/der.h in `file`.
591
592
593
594/*-
595 * Copyright (c) 2019 Christos Zoulas
596 * All rights reserved.
597 *
598 * Redistribution and use in source and binary forms, with or without
599 * modification, are permitted provided that the following conditions
600 * are met:
601 * 1. Redistributions of source code must retain the above copyright
602 * notice, this list of conditions and the following disclaimer.
603 * 2. Redistributions in binary form must reproduce the above copyright
604 * notice, this list of conditions and the following disclaimer in the
605 * documentation and/or other materials provided with the distribution.
606 *
607 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
608 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
609 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
610 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
611 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
612 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
613 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
614 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
615 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
616 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
617 * POSSIBILITY OF SUCH DAMAGE.
618 */
619
620The preceding notice is from src/is_csv.c in `file`.
621
622
623
624/*-
625 * Copyright (c) 2018 Christos Zoulas
626 * All rights reserved.
627 *
628 * Redistribution and use in source and binary forms, with or without
629 * modification, are permitted provided that the following conditions
630 * are met:
631 * 1. Redistributions of source code must retain the above copyright
632 * notice, this list of conditions and the following disclaimer.
633 * 2. Redistributions in binary form must reproduce the above copyright
634 * notice, this list of conditions and the following disclaimer in the
635 * documentation and/or other materials provided with the distribution.
636 *
637 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
638 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
639 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
640 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
641 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
642 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
643 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
644 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
645 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
646 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
647 * POSSIBILITY OF SUCH DAMAGE.
648 */
649
650The preceding notice is from src/is_json.c in `file`.
651
652
653
654/*-
655 * Copyright (c) 2023 Christos Zoulas
656 * All rights reserved.
657 *
658 * Redistribution and use in source and binary forms, with or without
659 * modification, are permitted provided that the following conditions
660 * are met:
661 * 1. Redistributions of source code must retain the above copyright
662 * notice, this list of conditions and the following disclaimer.
663 * 2. Redistributions in binary form must reproduce the above copyright
664 * notice, this list of conditions and the following disclaimer in the
665 * documentation and/or other materials provided with the distribution.
666 *
667 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
668 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
669 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
670 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
671 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
672 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
673 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
674 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
675 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
676 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
677 * POSSIBILITY OF SUCH DAMAGE.
678 */
679
680The preceding notice is from src/is_simh.c in `file`.
681
682
683
684/*-
685 * SPDX-License-Identifier: BSD-3-Clause
686 *
687 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
688 * Copyright (c) 1992, 1993, 1994
689 * The Regents of the University of California. All rights reserved.
690 *
691 * This code is derived from software contributed to Berkeley by
692 * Henry Spencer.
693 *
694 * Redistribution and use in source and binary forms, with or without
695 * modification, are permitted provided that the following conditions
696 * are met:
697 * 1. Redistributions of source code must retain the above copyright
698 * notice, this list of conditions and the following disclaimer.
699 * 2. Redistributions in binary form must reproduce the above copyright
700 * notice, this list of conditions and the following disclaimer in the
701 * documentation and/or other materials provided with the distribution.
702 * 3. Neither the name of the University nor the names of its contributors
703 * may be used to endorse or promote products derived from this software
704 * without specific prior written permission.
705 *
706 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
707 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
708 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
709 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
710 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
711 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
712 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
713 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
714 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
715 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
716 * SUCH DAMAGE.
717 *
718 * @(#)cname.h 8.3 (Berkeley) 3/20/94
719 * $FreeBSD: head/lib/libc/regex/cname.h 326025 2017-11-20 19:49:47Z pfg $
720 */
721
722The preceding notice is from src/missing/cname.h in `file`.
723
724
725
726/*-
727 * SPDX-License-Identifier: BSD-3-Clause
728 *
729 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
730 * Copyright (c) 1992, 1993, 1994
731 * The Regents of the University of California. All rights reserved.
732 *
733 * This code is derived from software contributed to Berkeley by
734 * Henry Spencer.
735 *
736 * Redistribution and use in source and binary forms, with or without
737 * modification, are permitted provided that the following conditions
738 * are met:
739 * 1. Redistributions of source code must retain the above copyright
740 * notice, this list of conditions and the following disclaimer.
741 * 2. Redistributions in binary form must reproduce the above copyright
742 * notice, this list of conditions and the following disclaimer in the
743 * documentation and/or other materials provided with the distribution.
744 * 3. Neither the name of the University nor the names of its contributors
745 * may be used to endorse or promote products derived from this software
746 * without specific prior written permission.
747 *
748 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
749 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
750 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
751 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
752 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
753 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
754 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
755 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
756 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
757 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
758 * SUCH DAMAGE.
759 *
760 * @(#)engine.c 8.5 (Berkeley) 3/20/94
761 */
762
763The preceding notice is from src/missing/engine.c in `file`.
764
765
766
767/*-
768 * Copyright (c) 2000 The NetBSD Foundation, Inc.
769 * All rights reserved.
770 *
771 * This code was contributed to The NetBSD Foundation by Allen Briggs.
772 *
773 * Redistribution and use in source and binary forms, with or without
774 * modification, are permitted provided that the following conditions
775 * are met:
776 * 1. Redistributions of source code must retain the above copyright
777 * notice, this list of conditions and the following disclaimer.
778 * 2. Redistributions in binary form must reproduce the above copyright
779 * notice, this list of conditions and the following disclaimer in the
780 * documentation and/or other materials provided with the distribution.
781 *
782 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
783 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
784 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
785 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
786 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
787 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
788 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
789 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
790 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
791 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
792 * POSSIBILITY OF SUCH DAMAGE.
793 */
794
795The preceding notice is from src/missing/fmtcheck.c in `file`.
796
797
798
799/*-
800 * Copyright (c) 2011 The NetBSD Foundation, Inc.
801 * All rights reserved.
802 *
803 * This code is derived from software contributed to The NetBSD Foundation
804 * by Christos Zoulas.
805 *
806 * Redistribution and use in source and binary forms, with or without
807 * modification, are permitted provided that the following conditions
808 * are met:
809 * 1. Redistributions of source code must retain the above copyright
810 * notice, this list of conditions and the following disclaimer.
811 * 2. Redistributions in binary form must reproduce the above copyright
812 * notice, this list of conditions and the following disclaimer in the
813 * documentation and/or other materials provided with the distribution.
814 *
815 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
816 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
817 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
818 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
819 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
820 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
821 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
822 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
823 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
824 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
825 * POSSIBILITY OF SUCH DAMAGE.
826 */
827
828The preceding notice is from src/missing/getline.c in `file`.
829
830
831
832/*-
833 * Copyright (c) 2000 The NetBSD Foundation, Inc.
834 * All rights reserved.
835 *
836 * This code is derived from software contributed to The NetBSD Foundation
837 * by Dieter Baron and Thomas Klausner.
838 *
839 * Redistribution and use in source and binary forms, with or without
840 * modification, are permitted provided that the following conditions
841 * are met:
842 * 1. Redistributions of source code must retain the above copyright
843 * notice, this list of conditions and the following disclaimer.
844 * 2. Redistributions in binary form must reproduce the above copyright
845 * notice, this list of conditions and the following disclaimer in the
846 * documentation and/or other materials provided with the distribution.
847 *
848 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
849 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
850 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
851 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
852 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
853 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
854 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
855 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
856 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
857 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
858 * POSSIBILITY OF SUCH DAMAGE.
859 */
860
861The preceding notice is from src/missing/getopt_long.c and src/mygetopt.h in `file`.
862
863
864
865/*
866 * Public domain fallback for reallocarray(3), for platforms (e.g.
867 * AmigaOS/libnix) whose C library declares it but does not implement it.
868 */
869
870The preceding notice is from src/missing/reallocarray.c in `file`.
871
872
873
874/*-
875 * SPDX-License-Identifier: BSD-3-Clause
876 *
877 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
878 * Copyright (c) 1992, 1993, 1994
879 * The Regents of the University of California. All rights reserved.
880 *
881 * Copyright (c) 2011 The FreeBSD Foundation
882 * All rights reserved.
883 * Portions of this software were developed by David Chisnall
884 * under sponsorship from the FreeBSD Foundation.
885 *
886 * This code is derived from software contributed to Berkeley by
887 * Henry Spencer.
888 *
889 * Redistribution and use in source and binary forms, with or without
890 * modification, are permitted provided that the following conditions
891 * are met:
892 * 1. Redistributions of source code must retain the above copyright
893 * notice, this list of conditions and the following disclaimer.
894 * 2. Redistributions in binary form must reproduce the above copyright
895 * notice, this list of conditions and the following disclaimer in the
896 * documentation and/or other materials provided with the distribution.
897 * 3. Neither the name of the University nor the names of its contributors
898 * may be used to endorse or promote products derived from this software
899 * without specific prior written permission.
900 *
901 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
902 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
903 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
904 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
905 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
906 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
907 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
908 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
909 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
910 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
911 * SUCH DAMAGE.
912 *
913 * @(#)regcomp.c 8.5 (Berkeley) 3/20/94
914 */
915
916The preceding notice is from src/missing/regcomp.c in `file`.
917
918
919
920/*-
921 * SPDX-License-Identifier: BSD-3-Clause
922 *
923 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
924 * Copyright (c) 1992, 1993, 1994
925 * The Regents of the University of California. All rights reserved.
926 *
927 * This code is derived from software contributed to Berkeley by
928 * Henry Spencer.
929 *
930 * Redistribution and use in source and binary forms, with or without
931 * modification, are permitted provided that the following conditions
932 * are met:
933 * 1. Redistributions of source code must retain the above copyright
934 * notice, this list of conditions and the following disclaimer.
935 * 2. Redistributions in binary form must reproduce the above copyright
936 * notice, this list of conditions and the following disclaimer in the
937 * documentation and/or other materials provided with the distribution.
938 * 3. Neither the name of the University nor the names of its contributors
939 * may be used to endorse or promote products derived from this software
940 * without specific prior written permission.
941 *
942 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
943 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
944 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
945 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
946 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
947 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
948 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
949 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
950 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
951 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
952 * SUCH DAMAGE.
953 *
954 * @(#)regerror.c 8.4 (Berkeley) 3/20/94
955 */
956
957The preceding notice is from src/missing/regerror.c in `file`.
958
959
960
961$NetBSD: COPYRIGHT,v 1.5 2003/08/07 16:43:19 agc Exp $
962
963Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
964This software is not subject to any license of the American Telephone
965and Telegraph Company or of the Regents of the University of California.
966
967Permission is granted to anyone to use this software for any purpose on
968any computer system, and to alter it and redistribute it, subject
969to the following restrictions:
970
9711. The author is not responsible for the consequences of use of this
972 software, no matter how awful, even if they arise from flaws in it.
973
9742. The origin of this software must not be misrepresented, either by
975 explicit claim or by omission. Since few users ever read sources,
976 credits must appear in the documentation.
977
9783. Altered versions must be plainly marked as such, and must not be
979 misrepresented as being the original software. Since few users
980 ever read sources, credits must appear in the documentation.
981
9824. This notice may not be removed or altered.
983
984=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
985/*-
986 * Copyright (c) 1994
987 * The Regents of the University of California. All rights reserved.
988 *
989 * Redistribution and use in source and binary forms, with or without
990 * modification, are permitted provided that the following conditions
991 * are met:
992 * 1. Redistributions of source code must retain the above copyright
993 * notice, this list of conditions and the following disclaimer.
994 * 2. Redistributions in binary form must reproduce the above copyright
995 * notice, this list of conditions and the following disclaimer in the
996 * documentation and/or other materials provided with the distribution.
997 * 3. Neither the name of the University nor the names of its contributors
998 * may be used to endorse or promote products derived from this software
999 * without specific prior written permission.
1000 *
1001 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1002 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1003 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1004 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1005 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1006 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1007 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1008 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1009 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1010 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1011 * SUCH DAMAGE.
1012 *
1013 * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94
1014 */
1015
1016The preceding notice is from src/missing/REGEX-COPYRIGHT in `file`.
1017
1018
1019
1020/*-
1021 * SPDX-License-Identifier: BSD-3-Clause
1022 *
1023 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1024 * Copyright (c) 1992, 1993, 1994
1025 * The Regents of the University of California. All rights reserved.
1026 *
1027 * This code is derived from software contributed to Berkeley by
1028 * Henry Spencer.
1029 *
1030 * Redistribution and use in source and binary forms, with or without
1031 * modification, are permitted provided that the following conditions
1032 * are met:
1033 * 1. Redistributions of source code must retain the above copyright
1034 * notice, this list of conditions and the following disclaimer.
1035 * 2. Redistributions in binary form must reproduce the above copyright
1036 * notice, this list of conditions and the following disclaimer in the
1037 * documentation and/or other materials provided with the distribution.
1038 * 3. Neither the name of the University nor the names of its contributors
1039 * may be used to endorse or promote products derived from this software
1040 * without specific prior written permission.
1041 *
1042 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1043 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1044 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1045 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1046 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1047 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1048 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1049 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1050 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1051 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1052 * SUCH DAMAGE.
1053 *
1054 * @(#)regex2.h 8.4 (Berkeley) 3/20/94
1055 * $FreeBSD: head/lib/libc/regex/regex2.h 368359 2020-12-05 03:18:48Z kevans $
1056 */
1057
1058The preceding notice is from src/missing/regex2.h in `file`.
1059
1060
1061
1062/*-
1063 * SPDX-License-Identifier: BSD-3-Clause
1064 *
1065 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1066 * Copyright (c) 1992, 1993, 1994
1067 * The Regents of the University of California. All rights reserved.
1068 *
1069 * This code is derived from software contributed to Berkeley by
1070 * Henry Spencer.
1071 *
1072 * Redistribution and use in source and binary forms, with or without
1073 * modification, are permitted provided that the following conditions
1074 * are met:
1075 * 1. Redistributions of source code must retain the above copyright
1076 * notice, this list of conditions and the following disclaimer.
1077 * 2. Redistributions in binary form must reproduce the above copyright
1078 * notice, this list of conditions and the following disclaimer in the
1079 * documentation and/or other materials provided with the distribution.
1080 * 3. Neither the name of the University nor the names of its contributors
1081 * may be used to endorse or promote products derived from this software
1082 * without specific prior written permission.
1083 *
1084 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1085 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1086 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1087 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1088 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1089 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1090 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1091 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1092 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1093 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1094 * SUCH DAMAGE.
1095 *
1096 * @(#)regexec.c 8.3 (Berkeley) 3/20/94
1097 */
1098
1099The preceding notice is from src/missing/regexec.c in `file`.
1100
1101
1102
1103/*-
1104 * SPDX-License-Identifier: BSD-3-Clause
1105 *
1106 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1107 * Copyright (c) 1992, 1993, 1994
1108 * The Regents of the University of California. All rights reserved.
1109 *
1110 * This code is derived from software contributed to Berkeley by
1111 * Henry Spencer.
1112 *
1113 * Redistribution and use in source and binary forms, with or without
1114 * modification, are permitted provided that the following conditions
1115 * are met:
1116 * 1. Redistributions of source code must retain the above copyright
1117 * notice, this list of conditions and the following disclaimer.
1118 * 2. Redistributions in binary form must reproduce the above copyright
1119 * notice, this list of conditions and the following disclaimer in the
1120 * documentation and/or other materials provided with the distribution.
1121 * 3. Neither the name of the University nor the names of its contributors
1122 * may be used to endorse or promote products derived from this software
1123 * without specific prior written permission.
1124 *
1125 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1126 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1127 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1128 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1129 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1130 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1131 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1132 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1133 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1134 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1135 * SUCH DAMAGE.
1136 *
1137 * @(#)regfree.c 8.3 (Berkeley) 3/20/94
1138 */
1139
1140The preceding notice is from src/missing/regfree.c in `file`.
1141
1142
1143
1144/*-
1145 * Copyright (c) 1990, 1993
1146 * The Regents of the University of California. All rights reserved.
1147 *
1148 * This code is derived from software contributed to Berkeley by
1149 * Chris Torek.
1150 *
1151 * Redistribution and use in source and binary forms, with or without
1152 * modification, are permitted provided that the following conditions
1153 * are met:
1154 * 1. Redistributions of source code must retain the above copyright
1155 * notice, this list of conditions and the following disclaimer.
1156 * 2. Redistributions in binary form must reproduce the above copyright
1157 * notice, this list of conditions and the following disclaimer in the
1158 * documentation and/or other materials provided with the distribution.
1159 * 3. Neither the name of the University nor the names of its contributors
1160 * may be used to endorse or promote products derived from this software
1161 * without specific prior written permission.
1162 *
1163 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1164 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1165 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1166 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1167 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1168 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1169 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1170 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1171 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1172 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1173 * SUCH DAMAGE.
1174 */
1175
1176The preceding notice is from src/missing/strcasestr.c in `file`.
1177
1178
1179
1180/*
1181 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
1182 *
1183 * Permission to use, copy, modify, and distribute this software for any
1184 * purpose with or without fee is hereby granted, provided that the above
1185 * copyright notice and this permission notice appear in all copies.
1186 *
1187 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1188 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1189 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1190 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1191 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1192 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1193 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1194 */
1195
1196The preceding notice is from src/missing/strlcat.c and src/missing/strlcpy.c in `file`.
1197
1198
1199
1200/*-
1201 * SPDX-License-Identifier: BSD-3-Clause
1202 *
1203 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1204 * Copyright (c) 1992, 1993, 1994
1205 * The Regents of the University of California. All rights reserved.
1206 *
1207 * This code is derived from software contributed to Berkeley by
1208 * Henry Spencer.
1209 *
1210 * Redistribution and use in source and binary forms, with or without
1211 * modification, are permitted provided that the following conditions
1212 * are met:
1213 * 1. Redistributions of source code must retain the above copyright
1214 * notice, this list of conditions and the following disclaimer.
1215 * 2. Redistributions in binary form must reproduce the above copyright
1216 * notice, this list of conditions and the following disclaimer in the
1217 * documentation and/or other materials provided with the distribution.
1218 * 3. Neither the name of the University nor the names of its contributors
1219 * may be used to endorse or promote products derived from this software
1220 * without specific prior written permission.
1221 *
1222 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1223 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1224 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1225 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1226 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1227 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1228 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1229 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1230 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1231 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1232 * SUCH DAMAGE.
1233 *
1234 * @(#)utils.h 8.3 (Berkeley) 3/20/94
1235 * $FreeBSD: head/lib/libc/regex/utils.h 341838 2018-12-12 04:23:00Z yuripv $
1236 */
1237
1238The preceding notice is from src/missing/utils.h in `file`.
1239
1240
1241
1242/*-
1243 * Copyright (c) 2008, 2016 Christos Zoulas
1244 * All rights reserved.
1245 *
1246 * Redistribution and use in source and binary forms, with or without
1247 * modification, are permitted provided that the following conditions
1248 * are met:
1249 * 1. Redistributions of source code must retain the above copyright
1250 * notice, this list of conditions and the following disclaimer.
1251 * 2. Redistributions in binary form must reproduce the above copyright
1252 * notice, this list of conditions and the following disclaimer in the
1253 * documentation and/or other materials provided with the distribution.
1254 *
1255 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1256 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1257 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1258 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1259 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1260 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1261 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1262 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1263 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1264 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1265 * POSSIBILITY OF SUCH DAMAGE.
1266 */
1267
1268The preceding notice is from src/readcdf.c in `file`.
1269
1270
1271
1272/*-
1273 * Copyright (c) 1992 Henry Spencer.
1274 * Copyright (c) 1992, 1993
1275 * The Regents of the University of California. All rights reserved.
1276 *
1277 * This code is derived from software contributed to Berkeley by
1278 * Henry Spencer of the University of Toronto.
1279 *
1280 * Redistribution and use in source and binary forms, with or without
1281 * modification, are permitted provided that the following conditions
1282 * are met:
1283 * 1. Redistributions of source code must retain the above copyright
1284 * notice, this list of conditions and the following disclaimer.
1285 * 2. Redistributions in binary form must reproduce the above copyright
1286 * notice, this list of conditions and the following disclaimer in the
1287 * documentation and/or other materials provided with the distribution.
1288 * 3. Neither the name of the University nor the names of its contributors
1289 * may be used to endorse or promote products derived from this software
1290 * without specific prior written permission.
1291 *
1292 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1293 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1294 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1295 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1296 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1297 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1298 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1299 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1300 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1301 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1302 * SUCH DAMAGE.
1303 *
1304 * @(#)regex.h 8.2 (Berkeley) 1/3/94
1305 * $FreeBSD: src/include/regex.h,v 1.12 2010/02/16 19:39:50 imp Exp $
1306 */
1307
1308The preceding notice is from src/regex-bsd.h in `file`.
1309*/
1310/*
1311
1312Text of LICENSE from DROID:
1313
1314Copyright (c) 2016, The National Archives <pronom@nationalarchives.gov.uk>
1315All rights reserved.
1316
1317Redistribution and use in source and binary forms, with or without
1318modification, are permitted provided that the following
1319conditions are met:
1320
1321 * Redistributions of source code must retain the above copyright
1322 notice, this list of conditions and the following disclaimer.
1323
1324 * Redistributions in binary form must reproduce the above copyright
1325 notice, this list of conditions and the following disclaimer in the
1326 documentation and/or other materials provided with the distribution.
1327
1328 * Neither the name of the The National Archives nor the
1329 names of its contributors may be used to endorse or promote products
1330 derived from this software without specific prior written permission.
1331
1332THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1333AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1334IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1335PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
1336CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1337EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1338PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1339PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1340LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1341NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1342SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1343*/
1344
1345/*
1346
1347Text of LICENSE from fileid:
1348
1349The MIT License (MIT)
1350
1351Copyright (c) 2015 David B Heise
1352
1353Permission is hereby granted, free of charge, to any person obtaining a copy of
1354this software and associated documentation files (the "Software"), to deal in
1355the Software without restriction, including without limitation the rights to
1356use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1357the Software, and to permit persons to whom the Software is furnished to do so,
1358subject to the following conditions:
1359
1360The above copyright notice and this permission notice shall be included in all
1361copies or substantial portions of the Software.
1362
1363THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1364IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1365FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1366COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1367IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1368CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1369
1370
1371*/
1372
1373/*
1374Text of LICENSE from binwalk:
1375
1376
1377MIT License
1378
1379Copyright (c) 2024 devttys0
1380
1381Permission is hereby granted, free of charge, to any person obtaining a copy
1382of this software and associated documentation files (the "Software"), to deal
1383in the Software without restriction, including without limitation the rights
1384to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1385copies of the Software, and to permit persons to whom the Software is
1386furnished to do so, subject to the following conditions:
1387
1388The above copyright notice and this permission notice shall be included in all
1389copies or substantial portions of the Software.
1390
1391THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1392IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1393FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1394AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1395LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1396OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1397SOFTWARE.
1398
1399*/
1400
1401/*
1402Text of LICENSE from polyfile:
1403
1404
1405 Apache License
1406 Version 2.0, January 2004
1407 http://www.apache.org/licenses/
1408
1409 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1410
1411 1. Definitions.
1412
1413 "License" shall mean the terms and conditions for use, reproduction,
1414 and distribution as defined by Sections 1 through 9 of this document.
1415
1416 "Licensor" shall mean the copyright owner or entity authorized by
1417 the copyright owner that is granting the License.
1418
1419 "Legal Entity" shall mean the union of the acting entity and all
1420 other entities that control, are controlled by, or are under common
1421 control with that entity. For the purposes of this definition,
1422 "control" means (i) the power, direct or indirect, to cause the
1423 direction or management of such entity, whether by contract or
1424 otherwise, or (ii) ownership of fifty percent (50%) or more of the
1425 outstanding shares, or (iii) beneficial ownership of such entity.
1426
1427 "You" (or "Your") shall mean an individual or Legal Entity
1428 exercising permissions granted by this License.
1429
1430 "Source" form shall mean the preferred form for making modifications,
1431 including but not limited to software source code, documentation
1432 source, and configuration files.
1433
1434 "Object" form shall mean any form resulting from mechanical
1435 transformation or translation of a Source form, including but
1436 not limited to compiled object code, generated documentation,
1437 and conversions to other media types.
1438
1439 "Work" shall mean the work of authorship, whether in Source or
1440 Object form, made available under the License, as indicated by a
1441 copyright notice that is included in or attached to the work
1442 (an example is provided in the Appendix below).
1443
1444 "Derivative Works" shall mean any work, whether in Source or Object
1445 form, that is based on (or derived from) the Work and for which the
1446 editorial revisions, annotations, elaborations, or other modifications
1447 represent, as a whole, an original work of authorship. For the purposes
1448 of this License, Derivative Works shall not include works that remain
1449 separable from, or merely link (or bind by name) to the interfaces of,
1450 the Work and Derivative Works thereof.
1451
1452 "Contribution" shall mean any work of authorship, including
1453 the original version of the Work and any modifications or additions
1454 to that Work or Derivative Works thereof, that is intentionally
1455 submitted to Licensor for inclusion in the Work by the copyright owner
1456 or by an individual or Legal Entity authorized to submit on behalf of
1457 the copyright owner. For the purposes of this definition, "submitted"
1458 means any form of electronic, verbal, or written communication sent
1459 to the Licensor or its representatives, including but not limited to
1460 communication on electronic mailing lists, source code control systems,
1461 and issue tracking systems that are managed by, or on behalf of, the
1462 Licensor for the purpose of discussing and improving the Work, but
1463 excluding communication that is conspicuously marked or otherwise
1464 designated in writing by the copyright owner as "Not a Contribution."
1465
1466 "Contributor" shall mean Licensor and any individual or Legal Entity
1467 on behalf of whom a Contribution has been received by Licensor and
1468 subsequently incorporated within the Work.
1469
1470 2. Grant of Copyright License. Subject to the terms and conditions of
1471 this License, each Contributor hereby grants to You a perpetual,
1472 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1473 copyright license to reproduce, prepare Derivative Works of,
1474 publicly display, publicly perform, sublicense, and distribute the
1475 Work and such Derivative Works in Source or Object form.
1476
1477 3. Grant of Patent License. Subject to the terms and conditions of
1478 this License, each Contributor hereby grants to You a perpetual,
1479 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1480 (except as stated in this section) patent license to make, have made,
1481 use, offer to sell, sell, import, and otherwise transfer the Work,
1482 where such license applies only to those patent claims licensable
1483 by such Contributor that are necessarily infringed by their
1484 Contribution(s) alone or by combination of their Contribution(s)
1485 with the Work to which such Contribution(s) was submitted. If You
1486 institute patent litigation against any entity (including a
1487 cross-claim or counterclaim in a lawsuit) alleging that the Work
1488 or a Contribution incorporated within the Work constitutes direct
1489 or contributory patent infringement, then any patent licenses
1490 granted to You under this License for that Work shall terminate
1491 as of the date such litigation is filed.
1492
1493 4. Redistribution. You may reproduce and distribute copies of the
1494 Work or Derivative Works thereof in any medium, with or without
1495 modifications, and in Source or Object form, provided that You
1496 meet the following conditions:
1497
1498 (a) You must give any other recipients of the Work or
1499 Derivative Works a copy of this License; and
1500
1501 (b) You must cause any modified files to carry prominent notices
1502 stating that You changed the files; and
1503
1504 (c) You must retain, in the Source form of any Derivative Works
1505 that You distribute, all copyright, patent, trademark, and
1506 attribution notices from the Source form of the Work,
1507 excluding those notices that do not pertain to any part of
1508 the Derivative Works; and
1509
1510 (d) If the Work includes a "NOTICE" text file as part of its
1511 distribution, then any Derivative Works that You distribute must
1512 include a readable copy of the attribution notices contained
1513 within such NOTICE file, excluding those notices that do not
1514 pertain to any part of the Derivative Works, in at least one
1515 of the following places: within a NOTICE text file distributed
1516 as part of the Derivative Works; within the Source form or
1517 documentation, if provided along with the Derivative Works; or,
1518 within a display generated by the Derivative Works, if and
1519 wherever such third-party notices normally appear. The contents
1520 of the NOTICE file are for informational purposes only and
1521 do not modify the License. You may add Your own attribution
1522 notices within Derivative Works that You distribute, alongside
1523 or as an addendum to the NOTICE text from the Work, provided
1524 that such additional attribution notices cannot be construed
1525 as modifying the License.
1526
1527 You may add Your own copyright statement to Your modifications and
1528 may provide additional or different license terms and conditions
1529 for use, reproduction, or distribution of Your modifications, or
1530 for any such Derivative Works as a whole, provided Your use,
1531 reproduction, and distribution of the Work otherwise complies with
1532 the conditions stated in this License.
1533
1534 5. Submission of Contributions. Unless You explicitly state otherwise,
1535 any Contribution intentionally submitted for inclusion in the Work
1536 by You to the Licensor shall be under the terms and conditions of
1537 this License, without any additional terms or conditions.
1538 Notwithstanding the above, nothing herein shall supersede or modify
1539 the terms of any separate license agreement you may have executed
1540 with Licensor regarding such Contributions.
1541
1542 6. Trademarks. This License does not grant permission to use the trade
1543 names, trademarks, service marks, or product names of the Licensor,
1544 except as required for reasonable and customary use in describing the
1545 origin of the Work and reproducing the content of the NOTICE file.
1546
1547 7. Disclaimer of Warranty. Unless required by applicable law or
1548 agreed to in writing, Licensor provides the Work (and each
1549 Contributor provides its Contributions) on an "AS IS" BASIS,
1550 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1551 implied, including, without limitation, any warranties or conditions
1552 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1553 PARTICULAR PURPOSE. You are solely responsible for determining the
1554 appropriateness of using or redistributing the Work and assume any
1555 risks associated with Your exercise of permissions under this License.
1556
1557 8. Limitation of Liability. In no event and under no legal theory,
1558 whether in tort (including negligence), contract, or otherwise,
1559 unless required by applicable law (such as deliberate and grossly
1560 negligent acts) or agreed to in writing, shall any Contributor be
1561 liable to You for damages, including any direct, indirect, special,
1562 incidental, or consequential damages of any character arising as a
1563 result of this License or out of the use or inability to use the
1564 Work (including but not limited to damages for loss of goodwill,
1565 work stoppage, computer failure or malfunction, or any and all
1566 other commercial damages or losses), even if such Contributor
1567 has been advised of the possibility of such damages.
1568
1569 9. Accepting Warranty or Additional Liability. While redistributing
1570 the Work or Derivative Works thereof, You may choose to offer,
1571 and charge a fee for, acceptance of support, warranty, indemnity,
1572 or other liability obligations and/or rights consistent with this
1573 License. However, in accepting such obligations, You may act only
1574 on Your own behalf and on Your sole responsibility, not on behalf
1575 of any other Contributor, and only if You agree to indemnify,
1576 defend, and hold each Contributor harmless for any liability
1577 incurred by, or claims asserted against, such Contributor by reason
1578 of your accepting any such warranty or additional liability.
1579
1580 END OF TERMS AND CONDITIONS
1581
1582 APPENDIX: How to apply the Apache License to your work.
1583
1584 To apply the Apache License to your work, attach the following
1585 boilerplate notice, with the fields enclosed by brackets "[]"
1586 replaced with your own identifying information. (Don't include
1587 the brackets!) The text should be enclosed in the appropriate
1588 comment syntax for the file format. We also recommend that a
1589 file or class name and description of purpose be included on the
1590 same "printed page" as the copyright notice for easier
1591 identification within third-party archives.
1592
1593 Copyright [yyyy] [name of copyright owner]
1594
1595 Licensed under the Apache License, Version 2.0 (the "License");
1596 you may not use this file except in compliance with the License.
1597 You may obtain a copy of the License at
1598
1599 http://www.apache.org/licenses/LICENSE-2.0
1600
1601 Unless required by applicable law or agreed to in writing, software
1602 distributed under the License is distributed on an "AS IS" BASIS,
1603 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1604 See the License for the specific language governing permissions and
1605 limitations under the License.
1606
1607*/