ctb_formats_detection/
chain.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//! Multipart filename extension peeling, format candidate chain derivation,
446//! and format chain specification formatting.
447
448#[allow(
449    unused_imports,
450    clippy::wildcard_imports,
451    reason = "Standard workspace module prelude"
452)]
453use crate::utilities::*;
454
455use crate::detection::extension::resolve_extension_candidates;
456use crate::format_id::FormatId;
457
458/// Represents a candidate chain of format layers with associated likelihood score.
459#[derive(Debug, Clone, PartialEq, Eq)]
460pub struct ProbableFormatChain {
461    pub outer: FormatId,
462    pub inner: Option<FormatId>,
463    pub layers: Vec<FormatId>,
464    pub stem: String,
465    pub score: u32,
466}
467
468impl ProbableFormatChain {
469    /// Converts this format chain into a format specification string representation,
470    /// ordering layers from innermost payload to outermost container (`inner > ... > outer`).
471    #[must_use]
472    pub fn to_format_spec_string(&self) -> String {
473        let mut rev_layers = self.layers.clone();
474        rev_layers.reverse();
475        let names: Vec<String> =
476            rev_layers.iter().map(|fmt| format!("{fmt:?}")).collect();
477        names.join(" > ")
478    }
479}
480
481/// Represents a structured chain of format layers parsed from a multipart filename (e.g. .html.gz).
482#[derive(Debug, Clone, PartialEq, Eq)]
483pub struct FormatChain {
484    /// Outermost container/compression format (e.g. Gzip for page.html.gz).
485    pub outer: FormatId,
486    /// Inner payload format if identifiable (e.g. Html for page.html.gz).
487    pub inner: Option<FormatId>,
488    /// Full sequence of identified formats from outermost to innermost.
489    pub layers: Vec<FormatId>,
490    /// Remaining base filename stem after stripping all identified format extensions.
491    pub stem: String,
492}
493
494impl FormatChain {
495    /// Converts this format chain into a format specification string representation,
496    /// ordering layers from innermost payload to outermost container (`inner > ... > outer`).
497    #[must_use]
498    pub fn to_format_spec_string(&self) -> String {
499        let mut rev_layers = self.layers.clone();
500        rev_layers.reverse();
501        let names: Vec<String> =
502            rev_layers.iter().map(|fmt| format!("{fmt:?}")).collect();
503        names.join(" > ")
504    }
505}
506
507/// Default maximum number of extension layers to peel from a filename.
508/// Aligned with `DEFAULT_MAX_DECOMPRESSION_DEPTH + 1` (1 payload + 3 container layers).
509pub const DEFAULT_MAX_CHAIN_LAYERS: usize = 4;
510
511/// Hard upper ceiling on candidate format chains generated from Cartesian products
512/// to protect against exponential memory and CPU consumption on crafted inputs.
513pub const MAX_FORMAT_CHAINS_LIMIT: usize = 128;
514
515/// Parses a filename or path into candidate format chains, bounding peeled extension layers
516/// to `max_layers` and total Cartesian combinations to [`MAX_FORMAT_CHAINS_LIMIT`].
517pub fn guess_format_chains_bounded(
518    filename: &str,
519    platform: Option<FormatId>,
520    max_layers: usize,
521) -> Vec<ProbableFormatChain> {
522    if max_layers == 0 {
523        return Vec::new();
524    }
525    // Reason for fallback: filename without path separators uses full input filename as basename
526    let basename = filename.rsplit(['/', '\\']).next().unwrap_or(filename);
527    let mut parts: Vec<&str> = basename.split('.').collect();
528    if parts.len() <= 1 {
529        return Vec::new();
530    }
531
532    // Peel outer extension
533    let outer_ext = match parts.pop() {
534        Some(ext) => ext,
535        None => return Vec::new(),
536    };
537
538    let outer_candidates = resolve_extension_candidates(outer_ext, platform);
539    if outer_candidates.is_empty() {
540        return Vec::new();
541    }
542
543    // Peel subsequent inner extensions up to `max_layers` as long as remaining parts
544    // resolve to recognized format candidates and leave a stem.
545    let mut peeled_layers: Vec<Vec<(FormatId, u32)>> = vec![outer_candidates];
546    while parts.len() > 1 && peeled_layers.len() < max_layers {
547        let next_ext = match parts.last() {
548            Some(&ext) => ext,
549            None => break,
550        };
551        let candidates = resolve_extension_candidates(next_ext, platform);
552        if candidates.is_empty() {
553            break;
554        }
555        parts.pop();
556        peeled_layers.push(candidates);
557    }
558
559    let stem = parts.join(".");
560    let num_layers = peeled_layers.len();
561
562    let mut results = Vec::new();
563    let mut current_layers = Vec::with_capacity(num_layers);
564    let mut current_scores = Vec::with_capacity(num_layers);
565
566    fn build_cartesian_chains(
567        peeled: &[Vec<(FormatId, u32)>],
568        depth: usize,
569        current_layers: &mut Vec<FormatId>,
570        current_scores: &mut Vec<u32>,
571        stem: &str,
572        results: &mut Vec<ProbableFormatChain>,
573    ) {
574        if results.len() >= MAX_FORMAT_CHAINS_LIMIT {
575            return;
576        }
577        if depth == peeled.len() {
578            let Some(&outer) = current_layers.first() else {
579                return;
580            };
581            let inner = if current_layers.len() > 1 {
582                current_layers.last().copied()
583            } else {
584                None
585            };
586            let sum_score: u64 =
587                current_scores.iter().map(|&s| u64::from(s)).sum();
588            let len_u64 = match u64::try_from(current_scores.len()) {
589                Ok(len) if len > 0 => len,
590                _ => 1,
591            };
592            // Reason for fallback: len_u64 is non-zero so checked_div cannot fail; defaults to 0 on division failure.
593            let avg_u64 = sum_score.checked_div(len_u64).unwrap_or(0);
594            // Reason for fallback: average score of u32 values fits within u32; defaults to 0 on numeric overflow.
595            let avg_score = u32::try_from(avg_u64).unwrap_or(0);
596            results.push(ProbableFormatChain {
597                outer,
598                inner,
599                layers: current_layers.clone(),
600                stem: stem.to_string(),
601                score: avg_score,
602            });
603            return;
604        }
605
606        if let Some(cands) = peeled.get(depth) {
607            for &(fmt, score) in cands {
608                if results.len() >= MAX_FORMAT_CHAINS_LIMIT {
609                    break;
610                }
611                current_layers.push(fmt);
612                current_scores.push(score);
613                build_cartesian_chains(
614                    peeled,
615                    depth.saturating_add(1),
616                    current_layers,
617                    current_scores,
618                    stem,
619                    results,
620                );
621                current_scores.pop();
622                current_layers.pop();
623            }
624        }
625    }
626
627    build_cartesian_chains(
628        &peeled_layers,
629        0,
630        &mut current_layers,
631        &mut current_scores,
632        &stem,
633        &mut results,
634    );
635
636    boost_common_implied_ancestors(&mut results);
637
638    results.sort_by(|a, b| b.score.cmp(&a.score));
639
640    results
641}
642
643/// Parses a filename or path into candidate format chains, branching on ambiguous extensions
644/// and peeling recognized extension layers up to [`DEFAULT_MAX_CHAIN_LAYERS`].
645pub fn guess_format_chains(
646    filename: &str,
647    platform: Option<FormatId>,
648) -> Vec<ProbableFormatChain> {
649    guess_format_chains_bounded(filename, platform, DEFAULT_MAX_CHAIN_LAYERS)
650}
651
652/// Boosts, by one point, each chain in an exact-score tie group whose
653/// branching format at any layer is transitively implied by all other
654/// siblings that match on every other layer. When an ambiguous extension
655/// resolves to a format family whose members all `@implies()` a shared
656/// general format (e.g. the `CscJournal` variants), the extension could not
657/// distinguish between the candidates, so the undifferentiated superset gets
658/// a minimal +1 nudge to rank first without distorting the wider score tiers
659/// used for confidence.
660///
661/// Multi-layer chains (such as `.cscjournal.sz`) branch at each ambiguous
662/// extension independently. Sibling comparison is performed per-layer: two
663/// chains are siblings at layer `k` if they share the exact same formats at all
664/// other layers `j != k`, are tied in score, and differ at layer `k`.
665fn boost_common_implied_ancestors(chains: &mut [ProbableFormatChain]) {
666    let mut boosts = vec![0u32; chains.len()];
667
668    for (idx, chain) in chains.iter().enumerate() {
669        let n = chain.layers.len();
670        if n == 0 {
671            continue;
672        }
673        let mut is_boosted = false;
674        for k in 0..n {
675            let Some(&chain_fmt_at_k) = chain.layers.get(k) else {
676                continue;
677            };
678
679            let mut siblings_at_k = Vec::new();
680            for (other_idx, other) in chains.iter().enumerate() {
681                if other_idx == idx
682                    || other.score != chain.score
683                    || other.layers.len() != n
684                {
685                    continue;
686                }
687                let matches_others = (0..n).all(|j| {
688                    if j == k {
689                        other.layers.get(j) != Some(&chain_fmt_at_k)
690                    } else {
691                        other.layers.get(j) == chain.layers.get(j)
692                    }
693                });
694                if matches_others {
695                    if let Some(&other_fmt) = other.layers.get(k) {
696                        siblings_at_k.push(other_fmt);
697                    }
698                }
699            }
700
701            if !siblings_at_k.is_empty()
702                && siblings_at_k.iter().all(|other_fmt| {
703                    other_fmt.implies().contains(&chain_fmt_at_k)
704                })
705            {
706                is_boosted = true;
707                break;
708            }
709        }
710
711        if is_boosted {
712            if let Some(b) = boosts.get_mut(idx) {
713                *b = 1;
714            }
715        }
716    }
717
718    for (chain, &b) in chains.iter_mut().zip(&boosts) {
719        if b > 0 {
720            chain.score = chain.score.saturating_add(b);
721        }
722    }
723}
724
725/// Parses a filename or path into a single structured `FormatChain`.
726pub fn parse_format_chain(filename: &str) -> Option<FormatChain> {
727    let chains = guess_format_chains(filename, None);
728    let top = chains.first()?;
729    Some(FormatChain {
730        outer: top.outer,
731        inner: top.inner,
732        layers: top.layers.clone(),
733        stem: top.stem.clone(),
734    })
735}
736
737#[cfg(test)]
738#[allow(
739    clippy::panic,
740    clippy::expect_used,
741    clippy::unwrap_used,
742    clippy::unwrap_in_result,
743    clippy::panic_in_result_fn,
744    clippy::indexing_slicing,
745    clippy::arithmetic_side_effects,
746    reason = "Standard repository test boilerplate"
747)]
748mod tests {
749    use super::*;
750
751    #[ctb_test]
752    fn test_parse_format_chain() {
753        let chain = parse_format_chain("example.html.gz").unwrap();
754        assert_eq!(chain.outer, FormatId::Gzip);
755        assert_eq!(chain.inner, Some(FormatId::Html));
756        assert_eq!(chain.stem, "example");
757        assert_eq!(chain.to_format_spec_string(), "Html > Gzip");
758    }
759
760    #[ctb_test]
761    fn test_ambiguous_peeling() {
762        let chains =
763            guess_format_chains("archive.as.gz", Some(FormatId::MacOs));
764        assert!(!chains.is_empty());
765        assert_eq!(chains[0].outer, FormatId::Gzip);
766        assert_eq!(chains[0].inner, Some(FormatId::AppleSingle));
767    }
768
769    #[ctb_test]
770    fn test_tie_boost_common_implied_ancestor() {
771        // Each CscJournal variant @implies() the base CscJournal format, so a
772        // .cscjournal filename yields six chains tied at 50; the
773        // undifferentiated superset gets the +1 nudge while the variants keep
774        // their catalog order.
775        let chains = guess_format_chains("v4_dcmixed.cscjournal", None);
776        assert_eq!(chains.len(), 6);
777        assert_eq!(chains[0].outer, FormatId::CscJournal);
778        assert_eq!(chains[0].score, 51);
779        assert_eq!(
780            chains[1..]
781                .iter()
782                .map(|chain| (chain.outer, chain.score))
783                .collect::<Vec<_>>(),
784            vec![
785                (FormatId::CscJournal1Meta1, 50),
786                (FormatId::CscJournal1Meta2, 50),
787                (FormatId::CscJournal1Meta3, 50),
788                (FormatId::CscJournal4, 50),
789                (FormatId::CscJournal5, 50),
790            ]
791        );
792    }
793
794    #[ctb_test]
795    fn test_tie_boost_inner_layer_of_two_layer_chain() {
796        // With a two-layer filename, every chain shares the Gzip outermost
797        // format, so the tie branches on the ambiguous inner extension; the
798        // +1 nudge keys on the inner payload format and lifts the
799        // undifferentiated CscJournal superset to the top.
800        let chains = guess_format_chains("v4_dcmixed.cscjournal.gz", None);
801        assert_eq!(chains.len(), 6);
802        assert_eq!(chains[0].outer, FormatId::Gzip);
803        assert_eq!(chains[0].inner, Some(FormatId::CscJournal));
804        assert_eq!(chains[0].stem, "v4_dcmixed");
805        assert_eq!(chains[0].score, 51);
806        assert_eq!(
807            chains[1..]
808                .iter()
809                .map(|chain| (chain.inner, chain.score))
810                .collect::<Vec<_>>(),
811            vec![
812                (Some(FormatId::CscJournal1Meta1), 50),
813                (Some(FormatId::CscJournal1Meta2), 50),
814                (Some(FormatId::CscJournal1Meta3), 50),
815                (Some(FormatId::CscJournal4), 50),
816                (Some(FormatId::CscJournal5), 50),
817            ]
818        );
819
820        // The structured chain parser now resolves the superset payload
821        // rather than an arbitrary variant.
822        let chain = parse_format_chain("v4_dcmixed.cscjournal.gz").unwrap();
823        assert_eq!(chain.outer, FormatId::Gzip);
824        assert_eq!(chain.inner, Some(FormatId::CscJournal));
825        assert_eq!(chain.to_format_spec_string(), "CscJournal > Gzip");
826    }
827
828    #[ctb_test]
829    fn test_no_boost_without_common_implied_ancestor() {
830        // A sole candidate for its extension forms no tie group and must keep
831        // its raw extension score.
832        let chains = guess_format_chains("archive.gz", None);
833        assert_eq!(chains.len(), 1);
834        assert_eq!(chains[0].outer, FormatId::Gzip);
835        assert_eq!(chains[0].score, 50);
836
837        // Tied two-layer chains branch on the inner payload format; the
838        // formats the .html extension resolves to imply neither one another
839        // nor a shared superset candidate, so nothing is nudged.
840        let chains = guess_format_chains("page.html.gz", None);
841        assert_eq!(chains.len(), 2);
842        assert!(chains.iter().all(|chain| chain.outer == FormatId::Gzip));
843        assert!(chains.iter().all(|chain| chain.score == 50));
844    }
845
846    #[ctb_test]
847    fn test_tie_boost_multi_ambiguous_layers() {
848        // Both .sz (5 candidates) and .cscjournal (6 candidates) branch, producing
849        // 30 chains. Sibling comparison per-layer allows CscJournal to be recognized
850        // as the superset at the inner layer for every outer variant, giving it
851        // score 51 over the 50-scored variant inner formats.
852        let chains = guess_format_chains("v4_dcmixed.cscjournal.sz", None);
853        assert_eq!(chains.len(), 30);
854        // The top candidate has CscJournal inner format with boosted score 51
855        assert_eq!(chains[0].outer, FormatId::Szip);
856        assert_eq!(chains[0].inner, Some(FormatId::CscJournal));
857        assert_eq!(chains[0].score, 51);
858
859        // Every outer variant's CscJournal chain is boosted to 51
860        let boosted_inners: Vec<(FormatId, Option<FormatId>, u32)> = chains
861            .iter()
862            .filter(|c| c.score == 51)
863            .map(|c| (c.outer, c.inner, c.score))
864            .collect();
865        assert_eq!(boosted_inners.len(), 5);
866        for (_, inner, score) in boosted_inners {
867            assert_eq!(inner, Some(FormatId::CscJournal));
868            assert_eq!(score, 51);
869        }
870    }
871
872    #[ctb_test]
873    fn test_indefinite_peeling_three_layers() {
874        // archive.tar.gz.br has 3 extension layers: .br -> .gz -> .tar
875        let chains = guess_format_chains("archive.tar.gz.br", None);
876        assert!(!chains.is_empty());
877        let top = &chains[0];
878        assert_eq!(top.layers.len(), 3);
879        assert_eq!(top.outer, FormatId::Brotli);
880        assert_eq!(top.inner, Some(FormatId::Tar));
881        assert_eq!(
882            top.layers,
883            vec![FormatId::Brotli, FormatId::Gzip, FormatId::Tar]
884        );
885        assert_eq!(top.stem, "archive");
886        assert_eq!(top.to_format_spec_string(), "Tar > Gzip > Brotli");
887    }
888
889    #[ctb_test]
890    fn test_bounded_peeling_depth() {
891        // Peeling bounded to 2 layers on a 3-extension filename
892        let chains_2 =
893            guess_format_chains_bounded("archive.tar.gz.br", None, 2);
894        assert!(!chains_2.is_empty());
895        let top_2 = &chains_2[0];
896        assert_eq!(top_2.layers.len(), 2);
897        assert_eq!(top_2.outer, FormatId::Brotli);
898        assert_eq!(top_2.inner, Some(FormatId::Gzip));
899        assert_eq!(top_2.stem, "archive.tar");
900
901        // Peeling bounded to 1 layer
902        let chains_1 =
903            guess_format_chains_bounded("archive.tar.gz.br", None, 1);
904        assert!(!chains_1.is_empty());
905        let top_1 = &chains_1[0];
906        assert_eq!(top_1.layers.len(), 1);
907        assert_eq!(top_1.outer, FormatId::Brotli);
908        assert_eq!(top_1.inner, None);
909        assert_eq!(top_1.stem, "archive.tar.gz");
910
911        // Peeling bounded to 0 layers returns nothing
912        let chains_0 =
913            guess_format_chains_bounded("archive.tar.gz.br", None, 0);
914        assert!(chains_0.is_empty());
915    }
916
917    #[ctb_test]
918    fn test_cartesian_limit_dos_protection() {
919        // .sz has 5 candidates and .cscjournal has 5 candidates.
920        // 5 layers of alternating ambiguous extensions would produce 5^5 = 3125 chains.
921        // The safety cap MAX_FORMAT_CHAINS_LIMIT (128) must prevent combinatorial explosion.
922        let chains = guess_format_chains_bounded(
923            "crafted.sz.cscjournal.sz.cscjournal.sz",
924            None,
925            10,
926        );
927        assert_eq!(chains.len(), MAX_FORMAT_CHAINS_LIMIT);
928        assert!(chains.len() <= 128);
929    }
930}
931/*
932/*
933 * Adapted from: apptype.c, Written by Eberhard Mattes and put into the
934 * file_public domain
935 *
936 * Notes: 1. Qualify the filename so that DosQueryAppType does not do extraneous
937 * searches.
938 *
939 * 2. DosQueryAppType will return FAPPTYP_DOS on a file ending with ".com"
940 * (other than an OS/2 exe or Win exe with this name). Eberhard Mattes
941 * remarks Tue, 6 Apr 93: Moreover, it reports the type of the (new and very
942 * bug ridden) Win Emacs as "OS/2 executable".
943 *
944 * 3. apptype() uses the filename if given, otherwise a tmp file is created with
945 * the contents of buf. If buf is not the complete file, apptype can
946 * incorrectly identify the exe type. The "-z" option of "file" is the reason
947 * for this ugly code.
948 */
949
950The preceding notice is from src/apptype.c in `file`.
951
952
953
954/*-
955 * Copyright (c) 2008 Christos Zoulas
956 * All rights reserved.
957 *
958 * Redistribution and use in source and binary forms, with or without
959 * modification, are permitted provided that the following conditions
960 * are met:
961 * 1. Redistributions of source code must retain the above copyright
962 *    notice, this list of conditions and the following disclaimer.
963 * 2. Redistributions in binary form must reproduce the above copyright
964 *    notice, this list of conditions and the following disclaimer in the
965 *    documentation and/or other materials provided with the distribution.
966 *
967 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
968 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
969 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
970 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
971 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
972 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
973 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
974 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
975 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
976 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
977 * POSSIBILITY OF SUCH DAMAGE.
978 */
979
980The preceding notice is from src/cdf.c, src/cdf.h, and src/cdf_time.c in `file`.
981
982
983
984/*-
985 * Copyright (c) 2016 Christos Zoulas
986 * All rights reserved.
987 *
988 * Redistribution and use in source and binary forms, with or without
989 * modification, are permitted provided that the following conditions
990 * are met:
991 * 1. Redistributions of source code must retain the above copyright
992 *    notice, this list of conditions and the following disclaimer.
993 * 2. Redistributions in binary form must reproduce the above copyright
994 *    notice, this list of conditions and the following disclaimer in the
995 *    documentation and/or other materials provided with the distribution.
996 *
997 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
998 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
999 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1000 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1001 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1002 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1003 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1004 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1005 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1006 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1007 * POSSIBILITY OF SUCH DAMAGE.
1008 */
1009
1010The preceding notice is from src/der.c and src/der.h in `file`.
1011
1012
1013
1014/*-
1015 * Copyright (c) 2019 Christos Zoulas
1016 * All rights reserved.
1017 *
1018 * Redistribution and use in source and binary forms, with or without
1019 * modification, are permitted provided that the following conditions
1020 * are met:
1021 * 1. Redistributions of source code must retain the above copyright
1022 *    notice, this list of conditions and the following disclaimer.
1023 * 2. Redistributions in binary form must reproduce the above copyright
1024 *    notice, this list of conditions and the following disclaimer in the
1025 *    documentation and/or other materials provided with the distribution.
1026 *
1027 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1028 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1029 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1030 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1031 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1032 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1033 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1034 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1035 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1036 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1037 * POSSIBILITY OF SUCH DAMAGE.
1038 */
1039
1040The preceding notice is from src/is_csv.c in `file`.
1041
1042
1043
1044/*-
1045 * Copyright (c) 2018 Christos Zoulas
1046 * All rights reserved.
1047 *
1048 * Redistribution and use in source and binary forms, with or without
1049 * modification, are permitted provided that the following conditions
1050 * are met:
1051 * 1. Redistributions of source code must retain the above copyright
1052 *    notice, this list of conditions and the following disclaimer.
1053 * 2. Redistributions in binary form must reproduce the above copyright
1054 *    notice, this list of conditions and the following disclaimer in the
1055 *    documentation and/or other materials provided with the distribution.
1056 *
1057 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1058 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1059 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1060 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1061 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1062 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1063 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1064 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1065 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1066 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1067 * POSSIBILITY OF SUCH DAMAGE.
1068 */
1069
1070The preceding notice is from src/is_json.c in `file`.
1071
1072
1073
1074/*-
1075 * Copyright (c) 2023 Christos Zoulas
1076 * All rights reserved.
1077 *
1078 * Redistribution and use in source and binary forms, with or without
1079 * modification, are permitted provided that the following conditions
1080 * are met:
1081 * 1. Redistributions of source code must retain the above copyright
1082 *    notice, this list of conditions and the following disclaimer.
1083 * 2. Redistributions in binary form must reproduce the above copyright
1084 *    notice, this list of conditions and the following disclaimer in the
1085 *    documentation and/or other materials provided with the distribution.
1086 *
1087 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1088 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1089 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1090 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1091 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1092 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1093 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1094 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1095 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1096 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1097 * POSSIBILITY OF SUCH DAMAGE.
1098 */
1099
1100The preceding notice is from src/is_simh.c in `file`.
1101
1102
1103
1104/*-
1105 * SPDX-License-Identifier: BSD-3-Clause
1106 *
1107 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1108 * Copyright (c) 1992, 1993, 1994
1109 *      The Regents of the University of California.  All rights reserved.
1110 *
1111 * This code is derived from software contributed to Berkeley by
1112 * Henry Spencer.
1113 *
1114 * Redistribution and use in source and binary forms, with or without
1115 * modification, are permitted provided that the following conditions
1116 * are met:
1117 * 1. Redistributions of source code must retain the above copyright
1118 *    notice, this list of conditions and the following disclaimer.
1119 * 2. Redistributions in binary form must reproduce the above copyright
1120 *    notice, this list of conditions and the following disclaimer in the
1121 *    documentation and/or other materials provided with the distribution.
1122 * 3. Neither the name of the University nor the names of its contributors
1123 *    may be used to endorse or promote products derived from this software
1124 *    without specific prior written permission.
1125 *
1126 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1127 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1128 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1129 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1130 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1131 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1132 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1133 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1134 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1135 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1136 * SUCH DAMAGE.
1137 *
1138 *      @(#)cname.h     8.3 (Berkeley) 3/20/94
1139 * $FreeBSD: head/lib/libc/regex/cname.h 326025 2017-11-20 19:49:47Z pfg $
1140 */
1141
1142The preceding notice is from src/missing/cname.h in `file`.
1143
1144
1145
1146/*-
1147 * SPDX-License-Identifier: BSD-3-Clause
1148 *
1149 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1150 * Copyright (c) 1992, 1993, 1994
1151 *      The Regents of the University of California.  All rights reserved.
1152 *
1153 * This code is derived from software contributed to Berkeley by
1154 * Henry Spencer.
1155 *
1156 * Redistribution and use in source and binary forms, with or without
1157 * modification, are permitted provided that the following conditions
1158 * are met:
1159 * 1. Redistributions of source code must retain the above copyright
1160 *    notice, this list of conditions and the following disclaimer.
1161 * 2. Redistributions in binary form must reproduce the above copyright
1162 *    notice, this list of conditions and the following disclaimer in the
1163 *    documentation and/or other materials provided with the distribution.
1164 * 3. Neither the name of the University nor the names of its contributors
1165 *    may be used to endorse or promote products derived from this software
1166 *    without specific prior written permission.
1167 *
1168 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1169 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1170 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1171 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1172 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1173 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1174 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1175 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1176 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1177 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1178 * SUCH DAMAGE.
1179 *
1180 *      @(#)engine.c    8.5 (Berkeley) 3/20/94
1181 */
1182
1183The preceding notice is from src/missing/engine.c in `file`.
1184
1185
1186
1187/*-
1188 * Copyright (c) 2000 The NetBSD Foundation, Inc.
1189 * All rights reserved.
1190 *
1191 * This code was contributed to The NetBSD Foundation by Allen Briggs.
1192 *
1193 * Redistribution and use in source and binary forms, with or without
1194 * modification, are permitted provided that the following conditions
1195 * are met:
1196 * 1. Redistributions of source code must retain the above copyright
1197 *    notice, this list of conditions and the following disclaimer.
1198 * 2. Redistributions in binary form must reproduce the above copyright
1199 *    notice, this list of conditions and the following disclaimer in the
1200 *    documentation and/or other materials provided with the distribution.
1201 *
1202 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1203 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1204 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1205 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1206 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1207 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1208 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1209 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1210 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1211 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1212 * POSSIBILITY OF SUCH DAMAGE.
1213 */
1214
1215The preceding notice is from src/missing/fmtcheck.c in `file`.
1216
1217
1218
1219/*-
1220 * Copyright (c) 2011 The NetBSD Foundation, Inc.
1221 * All rights reserved.
1222 *
1223 * This code is derived from software contributed to The NetBSD Foundation
1224 * by Christos Zoulas.
1225 *
1226 * Redistribution and use in source and binary forms, with or without
1227 * modification, are permitted provided that the following conditions
1228 * are met:
1229 * 1. Redistributions of source code must retain the above copyright
1230 *    notice, this list of conditions and the following disclaimer.
1231 * 2. Redistributions in binary form must reproduce the above copyright
1232 *    notice, this list of conditions and the following disclaimer in the
1233 *    documentation and/or other materials provided with the distribution.
1234 *
1235 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1236 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1237 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1238 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1239 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1240 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1241 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1242 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1243 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1244 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1245 * POSSIBILITY OF SUCH DAMAGE.
1246 */
1247
1248The preceding notice is from src/missing/getline.c in `file`.
1249
1250
1251
1252/*-
1253 * Copyright (c) 2000 The NetBSD Foundation, Inc.
1254 * All rights reserved.
1255 *
1256 * This code is derived from software contributed to The NetBSD Foundation
1257 * by Dieter Baron and Thomas Klausner.
1258 *
1259 * Redistribution and use in source and binary forms, with or without
1260 * modification, are permitted provided that the following conditions
1261 * are met:
1262 * 1. Redistributions of source code must retain the above copyright
1263 *    notice, this list of conditions and the following disclaimer.
1264 * 2. Redistributions in binary form must reproduce the above copyright
1265 *    notice, this list of conditions and the following disclaimer in the
1266 *    documentation and/or other materials provided with the distribution.
1267 *
1268 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1269 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1270 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1271 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1272 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1273 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1274 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1275 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1276 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1277 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1278 * POSSIBILITY OF SUCH DAMAGE.
1279 */
1280
1281The preceding notice is from src/missing/getopt_long.c and src/mygetopt.h in `file`.
1282
1283
1284
1285/*
1286 * Public domain fallback for reallocarray(3), for platforms (e.g.
1287 * AmigaOS/libnix) whose C library declares it but does not implement it.
1288 */
1289
1290The preceding notice is from src/missing/reallocarray.c in `file`.
1291
1292
1293
1294/*-
1295 * SPDX-License-Identifier: BSD-3-Clause
1296 *
1297 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1298 * Copyright (c) 1992, 1993, 1994
1299 *      The Regents of the University of California.  All rights reserved.
1300 *
1301 * Copyright (c) 2011 The FreeBSD Foundation
1302 * All rights reserved.
1303 * Portions of this software were developed by David Chisnall
1304 * under sponsorship from the FreeBSD Foundation.
1305 *
1306 * This code is derived from software contributed to Berkeley by
1307 * Henry Spencer.
1308 *
1309 * Redistribution and use in source and binary forms, with or without
1310 * modification, are permitted provided that the following conditions
1311 * are met:
1312 * 1. Redistributions of source code must retain the above copyright
1313 *    notice, this list of conditions and the following disclaimer.
1314 * 2. Redistributions in binary form must reproduce the above copyright
1315 *    notice, this list of conditions and the following disclaimer in the
1316 *    documentation and/or other materials provided with the distribution.
1317 * 3. Neither the name of the University nor the names of its contributors
1318 *    may be used to endorse or promote products derived from this software
1319 *    without specific prior written permission.
1320 *
1321 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1322 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1323 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1324 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1325 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1326 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1327 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1328 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1329 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1330 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1331 * SUCH DAMAGE.
1332 *
1333 *      @(#)regcomp.c   8.5 (Berkeley) 3/20/94
1334 */
1335
1336The preceding notice is from src/missing/regcomp.c in `file`.
1337
1338
1339
1340/*-
1341 * SPDX-License-Identifier: BSD-3-Clause
1342 *
1343 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1344 * Copyright (c) 1992, 1993, 1994
1345 *      The Regents of the University of California.  All rights reserved.
1346 *
1347 * This code is derived from software contributed to Berkeley by
1348 * Henry Spencer.
1349 *
1350 * Redistribution and use in source and binary forms, with or without
1351 * modification, are permitted provided that the following conditions
1352 * are met:
1353 * 1. Redistributions of source code must retain the above copyright
1354 *    notice, this list of conditions and the following disclaimer.
1355 * 2. Redistributions in binary form must reproduce the above copyright
1356 *    notice, this list of conditions and the following disclaimer in the
1357 *    documentation and/or other materials provided with the distribution.
1358 * 3. Neither the name of the University nor the names of its contributors
1359 *    may be used to endorse or promote products derived from this software
1360 *    without specific prior written permission.
1361 *
1362 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1363 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1364 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1365 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1366 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1367 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1368 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1369 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1370 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1371 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1372 * SUCH DAMAGE.
1373 *
1374 *      @(#)regerror.c  8.4 (Berkeley) 3/20/94
1375 */
1376
1377The preceding notice is from src/missing/regerror.c in `file`.
1378
1379
1380
1381$NetBSD: COPYRIGHT,v 1.5 2003/08/07 16:43:19 agc Exp $
1382
1383Copyright 1992, 1993, 1994 Henry Spencer.  All rights reserved.
1384This software is not subject to any license of the American Telephone
1385and Telegraph Company or of the Regents of the University of California.
1386
1387Permission is granted to anyone to use this software for any purpose on
1388any computer system, and to alter it and redistribute it, subject
1389to the following restrictions:
1390
13911. The author is not responsible for the consequences of use of this
1392   software, no matter how awful, even if they arise from flaws in it.
1393
13942. The origin of this software must not be misrepresented, either by
1395   explicit claim or by omission.  Since few users ever read sources,
1396   credits must appear in the documentation.
1397
13983. Altered versions must be plainly marked as such, and must not be
1399   misrepresented as being the original software.  Since few users
1400   ever read sources, credits must appear in the documentation.
1401
14024. This notice may not be removed or altered.
1403
1404=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1405/*-
1406 * Copyright (c) 1994
1407 *      The Regents of the University of California.  All rights reserved.
1408 *
1409 * Redistribution and use in source and binary forms, with or without
1410 * modification, are permitted provided that the following conditions
1411 * are met:
1412 * 1. Redistributions of source code must retain the above copyright
1413 *    notice, this list of conditions and the following disclaimer.
1414 * 2. Redistributions in binary form must reproduce the above copyright
1415 *    notice, this list of conditions and the following disclaimer in the
1416 *    documentation and/or other materials provided with the distribution.
1417 * 3. Neither the name of the University nor the names of its contributors
1418 *    may be used to endorse or promote products derived from this software
1419 *    without specific prior written permission.
1420 *
1421 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1422 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1423 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1424 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1425 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1426 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1427 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1428 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1429 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1430 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1431 * SUCH DAMAGE.
1432 *
1433 *      @(#)COPYRIGHT   8.1 (Berkeley) 3/16/94
1434 */
1435
1436The preceding notice is from src/missing/REGEX-COPYRIGHT in `file`.
1437
1438
1439
1440/*-
1441 * SPDX-License-Identifier: BSD-3-Clause
1442 *
1443 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1444 * Copyright (c) 1992, 1993, 1994
1445 *      The Regents of the University of California.  All rights reserved.
1446 *
1447 * This code is derived from software contributed to Berkeley by
1448 * Henry Spencer.
1449 *
1450 * Redistribution and use in source and binary forms, with or without
1451 * modification, are permitted provided that the following conditions
1452 * are met:
1453 * 1. Redistributions of source code must retain the above copyright
1454 *    notice, this list of conditions and the following disclaimer.
1455 * 2. Redistributions in binary form must reproduce the above copyright
1456 *    notice, this list of conditions and the following disclaimer in the
1457 *    documentation and/or other materials provided with the distribution.
1458 * 3. Neither the name of the University nor the names of its contributors
1459 *    may be used to endorse or promote products derived from this software
1460 *    without specific prior written permission.
1461 *
1462 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1463 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1464 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1465 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1466 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1467 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1468 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1469 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1470 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1471 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1472 * SUCH DAMAGE.
1473 *
1474 *      @(#)regex2.h    8.4 (Berkeley) 3/20/94
1475 * $FreeBSD: head/lib/libc/regex/regex2.h 368359 2020-12-05 03:18:48Z kevans $
1476 */
1477
1478The preceding notice is from src/missing/regex2.h in `file`.
1479
1480
1481
1482/*-
1483 * SPDX-License-Identifier: BSD-3-Clause
1484 *
1485 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1486 * Copyright (c) 1992, 1993, 1994
1487 *      The Regents of the University of California.  All rights reserved.
1488 *
1489 * This code is derived from software contributed to Berkeley by
1490 * Henry Spencer.
1491 *
1492 * Redistribution and use in source and binary forms, with or without
1493 * modification, are permitted provided that the following conditions
1494 * are met:
1495 * 1. Redistributions of source code must retain the above copyright
1496 *    notice, this list of conditions and the following disclaimer.
1497 * 2. Redistributions in binary form must reproduce the above copyright
1498 *    notice, this list of conditions and the following disclaimer in the
1499 *    documentation and/or other materials provided with the distribution.
1500 * 3. Neither the name of the University nor the names of its contributors
1501 *    may be used to endorse or promote products derived from this software
1502 *    without specific prior written permission.
1503 *
1504 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1505 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1506 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1507 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1508 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1509 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1510 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1511 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1512 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1513 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1514 * SUCH DAMAGE.
1515 *
1516 *      @(#)regexec.c   8.3 (Berkeley) 3/20/94
1517 */
1518
1519The preceding notice is from src/missing/regexec.c in `file`.
1520
1521
1522
1523/*-
1524 * SPDX-License-Identifier: BSD-3-Clause
1525 *
1526 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1527 * Copyright (c) 1992, 1993, 1994
1528 *      The Regents of the University of California.  All rights reserved.
1529 *
1530 * This code is derived from software contributed to Berkeley by
1531 * Henry Spencer.
1532 *
1533 * Redistribution and use in source and binary forms, with or without
1534 * modification, are permitted provided that the following conditions
1535 * are met:
1536 * 1. Redistributions of source code must retain the above copyright
1537 *    notice, this list of conditions and the following disclaimer.
1538 * 2. Redistributions in binary form must reproduce the above copyright
1539 *    notice, this list of conditions and the following disclaimer in the
1540 *    documentation and/or other materials provided with the distribution.
1541 * 3. Neither the name of the University nor the names of its contributors
1542 *    may be used to endorse or promote products derived from this software
1543 *    without specific prior written permission.
1544 *
1545 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1546 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1547 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1548 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1549 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1550 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1551 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1552 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1553 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1554 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1555 * SUCH DAMAGE.
1556 *
1557 *      @(#)regfree.c   8.3 (Berkeley) 3/20/94
1558 */
1559
1560The preceding notice is from src/missing/regfree.c in `file`.
1561
1562
1563
1564/*-
1565 * Copyright (c) 1990, 1993
1566 *      The Regents of the University of California.  All rights reserved.
1567 *
1568 * This code is derived from software contributed to Berkeley by
1569 * Chris Torek.
1570 *
1571 * Redistribution and use in source and binary forms, with or without
1572 * modification, are permitted provided that the following conditions
1573 * are met:
1574 * 1. Redistributions of source code must retain the above copyright
1575 *    notice, this list of conditions and the following disclaimer.
1576 * 2. Redistributions in binary form must reproduce the above copyright
1577 *    notice, this list of conditions and the following disclaimer in the
1578 *    documentation and/or other materials provided with the distribution.
1579 * 3. Neither the name of the University nor the names of its contributors
1580 *    may be used to endorse or promote products derived from this software
1581 *    without specific prior written permission.
1582 *
1583 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1584 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1585 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1586 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1587 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1588 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1589 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1590 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1591 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1592 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1593 * SUCH DAMAGE.
1594 */
1595
1596The preceding notice is from src/missing/strcasestr.c in `file`.
1597
1598
1599
1600/*
1601 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
1602 *
1603 * Permission to use, copy, modify, and distribute this software for any
1604 * purpose with or without fee is hereby granted, provided that the above
1605 * copyright notice and this permission notice appear in all copies.
1606 *
1607 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1608 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1609 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1610 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1611 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1612 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1613 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1614 */
1615
1616The preceding notice is from src/missing/strlcat.c and src/missing/strlcpy.c in `file`.
1617
1618
1619
1620/*-
1621 * SPDX-License-Identifier: BSD-3-Clause
1622 *
1623 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1624 * Copyright (c) 1992, 1993, 1994
1625 *      The Regents of the University of California.  All rights reserved.
1626 *
1627 * This code is derived from software contributed to Berkeley by
1628 * Henry Spencer.
1629 *
1630 * Redistribution and use in source and binary forms, with or without
1631 * modification, are permitted provided that the following conditions
1632 * are met:
1633 * 1. Redistributions of source code must retain the above copyright
1634 *    notice, this list of conditions and the following disclaimer.
1635 * 2. Redistributions in binary form must reproduce the above copyright
1636 *    notice, this list of conditions and the following disclaimer in the
1637 *    documentation and/or other materials provided with the distribution.
1638 * 3. Neither the name of the University nor the names of its contributors
1639 *    may be used to endorse or promote products derived from this software
1640 *    without specific prior written permission.
1641 *
1642 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1643 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1644 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1645 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1646 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1647 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1648 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1649 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1650 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1651 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1652 * SUCH DAMAGE.
1653 *
1654 *      @(#)utils.h     8.3 (Berkeley) 3/20/94
1655 * $FreeBSD: head/lib/libc/regex/utils.h 341838 2018-12-12 04:23:00Z yuripv $
1656 */
1657
1658The preceding notice is from src/missing/utils.h in `file`.
1659
1660
1661
1662/*-
1663 * Copyright (c) 2008, 2016 Christos Zoulas
1664 * All rights reserved.
1665 *
1666 * Redistribution and use in source and binary forms, with or without
1667 * modification, are permitted provided that the following conditions
1668 * are met:
1669 * 1. Redistributions of source code must retain the above copyright
1670 *    notice, this list of conditions and the following disclaimer.
1671 * 2. Redistributions in binary form must reproduce the above copyright
1672 *    notice, this list of conditions and the following disclaimer in the
1673 *    documentation and/or other materials provided with the distribution.
1674 *
1675 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1676 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1677 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1678 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1679 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1680 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1681 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1682 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1683 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1684 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1685 * POSSIBILITY OF SUCH DAMAGE.
1686 */
1687
1688The preceding notice is from src/readcdf.c in `file`.
1689
1690
1691
1692/*-
1693 * Copyright (c) 1992 Henry Spencer.
1694 * Copyright (c) 1992, 1993
1695 *      The Regents of the University of California.  All rights reserved.
1696 *
1697 * This code is derived from software contributed to Berkeley by
1698 * Henry Spencer of the University of Toronto.
1699 *
1700 * Redistribution and use in source and binary forms, with or without
1701 * modification, are permitted provided that the following conditions
1702 * are met:
1703 * 1. Redistributions of source code must retain the above copyright
1704 *    notice, this list of conditions and the following disclaimer.
1705 * 2. Redistributions in binary form must reproduce the above copyright
1706 *    notice, this list of conditions and the following disclaimer in the
1707 *    documentation and/or other materials provided with the distribution.
1708 * 3. Neither the name of the University nor the names of its contributors
1709 *    may be used to endorse or promote products derived from this software
1710 *    without specific prior written permission.
1711 *
1712 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1713 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1714 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1715 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1716 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1717 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1718 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1719 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1720 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1721 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1722 * SUCH DAMAGE.
1723 *
1724 *      @(#)regex.h     8.2 (Berkeley) 1/3/94
1725 * $FreeBSD: src/include/regex.h,v 1.12 2010/02/16 19:39:50 imp Exp $
1726 */
1727
1728The preceding notice is from src/regex-bsd.h in `file`.
1729*/
1730/*
1731
1732Text of LICENSE from DROID:
1733
1734Copyright (c) 2016, The National Archives <pronom@nationalarchives.gov.uk>
1735All rights reserved.
1736
1737Redistribution and use in source and binary forms, with or without
1738modification, are permitted provided that the following
1739conditions are met:
1740
1741 * Redistributions of source code must retain the above copyright
1742   notice, this list of conditions and the following disclaimer.
1743
1744 * Redistributions in binary form must reproduce the above copyright
1745   notice, this list of conditions and the following disclaimer in the
1746   documentation and/or other materials provided with the distribution.
1747
1748 * Neither the name of the The National Archives nor the
1749   names of its contributors may be used to endorse or promote products
1750   derived from this software without specific prior written permission.
1751
1752THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1753AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1754IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1755PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
1756CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1757EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1758PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1759PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1760LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1761NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1762SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1763*/
1764
1765/*
1766
1767Text of LICENSE from fileid:
1768
1769The MIT License (MIT)
1770
1771Copyright (c) 2015 David B Heise
1772
1773Permission is hereby granted, free of charge, to any person obtaining a copy of
1774this software and associated documentation files (the "Software"), to deal in
1775the Software without restriction, including without limitation the rights to
1776use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1777the Software, and to permit persons to whom the Software is furnished to do so,
1778subject to the following conditions:
1779
1780The above copyright notice and this permission notice shall be included in all
1781copies or substantial portions of the Software.
1782
1783THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1784IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1785FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1786COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1787IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1788CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1789
1790
1791*/
1792
1793/*
1794Text of LICENSE from binwalk:
1795
1796
1797MIT License
1798
1799Copyright (c) 2024 devttys0
1800
1801Permission is hereby granted, free of charge, to any person obtaining a copy
1802of this software and associated documentation files (the "Software"), to deal
1803in the Software without restriction, including without limitation the rights
1804to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1805copies of the Software, and to permit persons to whom the Software is
1806furnished to do so, subject to the following conditions:
1807
1808The above copyright notice and this permission notice shall be included in all
1809copies or substantial portions of the Software.
1810
1811THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1812IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1813FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1814AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1815LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1816OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1817SOFTWARE.
1818
1819*/
1820
1821/*
1822Text of LICENSE from polyfile:
1823
1824
1825                                 Apache License
1826                           Version 2.0, January 2004
1827                        http://www.apache.org/licenses/
1828
1829   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1830
1831   1. Definitions.
1832
1833      "License" shall mean the terms and conditions for use, reproduction,
1834      and distribution as defined by Sections 1 through 9 of this document.
1835
1836      "Licensor" shall mean the copyright owner or entity authorized by
1837      the copyright owner that is granting the License.
1838
1839      "Legal Entity" shall mean the union of the acting entity and all
1840      other entities that control, are controlled by, or are under common
1841      control with that entity. For the purposes of this definition,
1842      "control" means (i) the power, direct or indirect, to cause the
1843      direction or management of such entity, whether by contract or
1844      otherwise, or (ii) ownership of fifty percent (50%) or more of the
1845      outstanding shares, or (iii) beneficial ownership of such entity.
1846
1847      "You" (or "Your") shall mean an individual or Legal Entity
1848      exercising permissions granted by this License.
1849
1850      "Source" form shall mean the preferred form for making modifications,
1851      including but not limited to software source code, documentation
1852      source, and configuration files.
1853
1854      "Object" form shall mean any form resulting from mechanical
1855      transformation or translation of a Source form, including but
1856      not limited to compiled object code, generated documentation,
1857      and conversions to other media types.
1858
1859      "Work" shall mean the work of authorship, whether in Source or
1860      Object form, made available under the License, as indicated by a
1861      copyright notice that is included in or attached to the work
1862      (an example is provided in the Appendix below).
1863
1864      "Derivative Works" shall mean any work, whether in Source or Object
1865      form, that is based on (or derived from) the Work and for which the
1866      editorial revisions, annotations, elaborations, or other modifications
1867      represent, as a whole, an original work of authorship. For the purposes
1868      of this License, Derivative Works shall not include works that remain
1869      separable from, or merely link (or bind by name) to the interfaces of,
1870      the Work and Derivative Works thereof.
1871
1872      "Contribution" shall mean any work of authorship, including
1873      the original version of the Work and any modifications or additions
1874      to that Work or Derivative Works thereof, that is intentionally
1875      submitted to Licensor for inclusion in the Work by the copyright owner
1876      or by an individual or Legal Entity authorized to submit on behalf of
1877      the copyright owner. For the purposes of this definition, "submitted"
1878      means any form of electronic, verbal, or written communication sent
1879      to the Licensor or its representatives, including but not limited to
1880      communication on electronic mailing lists, source code control systems,
1881      and issue tracking systems that are managed by, or on behalf of, the
1882      Licensor for the purpose of discussing and improving the Work, but
1883      excluding communication that is conspicuously marked or otherwise
1884      designated in writing by the copyright owner as "Not a Contribution."
1885
1886      "Contributor" shall mean Licensor and any individual or Legal Entity
1887      on behalf of whom a Contribution has been received by Licensor and
1888      subsequently incorporated within the Work.
1889
1890   2. Grant of Copyright License. Subject to the terms and conditions of
1891      this License, each Contributor hereby grants to You a perpetual,
1892      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1893      copyright license to reproduce, prepare Derivative Works of,
1894      publicly display, publicly perform, sublicense, and distribute the
1895      Work and such Derivative Works in Source or Object form.
1896
1897   3. Grant of Patent License. Subject to the terms and conditions of
1898      this License, each Contributor hereby grants to You a perpetual,
1899      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1900      (except as stated in this section) patent license to make, have made,
1901      use, offer to sell, sell, import, and otherwise transfer the Work,
1902      where such license applies only to those patent claims licensable
1903      by such Contributor that are necessarily infringed by their
1904      Contribution(s) alone or by combination of their Contribution(s)
1905      with the Work to which such Contribution(s) was submitted. If You
1906      institute patent litigation against any entity (including a
1907      cross-claim or counterclaim in a lawsuit) alleging that the Work
1908      or a Contribution incorporated within the Work constitutes direct
1909      or contributory patent infringement, then any patent licenses
1910      granted to You under this License for that Work shall terminate
1911      as of the date such litigation is filed.
1912
1913   4. Redistribution. You may reproduce and distribute copies of the
1914      Work or Derivative Works thereof in any medium, with or without
1915      modifications, and in Source or Object form, provided that You
1916      meet the following conditions:
1917
1918      (a) You must give any other recipients of the Work or
1919          Derivative Works a copy of this License; and
1920
1921      (b) You must cause any modified files to carry prominent notices
1922          stating that You changed the files; and
1923
1924      (c) You must retain, in the Source form of any Derivative Works
1925          that You distribute, all copyright, patent, trademark, and
1926          attribution notices from the Source form of the Work,
1927          excluding those notices that do not pertain to any part of
1928          the Derivative Works; and
1929
1930      (d) If the Work includes a "NOTICE" text file as part of its
1931          distribution, then any Derivative Works that You distribute must
1932          include a readable copy of the attribution notices contained
1933          within such NOTICE file, excluding those notices that do not
1934          pertain to any part of the Derivative Works, in at least one
1935          of the following places: within a NOTICE text file distributed
1936          as part of the Derivative Works; within the Source form or
1937          documentation, if provided along with the Derivative Works; or,
1938          within a display generated by the Derivative Works, if and
1939          wherever such third-party notices normally appear. The contents
1940          of the NOTICE file are for informational purposes only and
1941          do not modify the License. You may add Your own attribution
1942          notices within Derivative Works that You distribute, alongside
1943          or as an addendum to the NOTICE text from the Work, provided
1944          that such additional attribution notices cannot be construed
1945          as modifying the License.
1946
1947      You may add Your own copyright statement to Your modifications and
1948      may provide additional or different license terms and conditions
1949      for use, reproduction, or distribution of Your modifications, or
1950      for any such Derivative Works as a whole, provided Your use,
1951      reproduction, and distribution of the Work otherwise complies with
1952      the conditions stated in this License.
1953
1954   5. Submission of Contributions. Unless You explicitly state otherwise,
1955      any Contribution intentionally submitted for inclusion in the Work
1956      by You to the Licensor shall be under the terms and conditions of
1957      this License, without any additional terms or conditions.
1958      Notwithstanding the above, nothing herein shall supersede or modify
1959      the terms of any separate license agreement you may have executed
1960      with Licensor regarding such Contributions.
1961
1962   6. Trademarks. This License does not grant permission to use the trade
1963      names, trademarks, service marks, or product names of the Licensor,
1964      except as required for reasonable and customary use in describing the
1965      origin of the Work and reproducing the content of the NOTICE file.
1966
1967   7. Disclaimer of Warranty. Unless required by applicable law or
1968      agreed to in writing, Licensor provides the Work (and each
1969      Contributor provides its Contributions) on an "AS IS" BASIS,
1970      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1971      implied, including, without limitation, any warranties or conditions
1972      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1973      PARTICULAR PURPOSE. You are solely responsible for determining the
1974      appropriateness of using or redistributing the Work and assume any
1975      risks associated with Your exercise of permissions under this License.
1976
1977   8. Limitation of Liability. In no event and under no legal theory,
1978      whether in tort (including negligence), contract, or otherwise,
1979      unless required by applicable law (such as deliberate and grossly
1980      negligent acts) or agreed to in writing, shall any Contributor be
1981      liable to You for damages, including any direct, indirect, special,
1982      incidental, or consequential damages of any character arising as a
1983      result of this License or out of the use or inability to use the
1984      Work (including but not limited to damages for loss of goodwill,
1985      work stoppage, computer failure or malfunction, or any and all
1986      other commercial damages or losses), even if such Contributor
1987      has been advised of the possibility of such damages.
1988
1989   9. Accepting Warranty or Additional Liability. While redistributing
1990      the Work or Derivative Works thereof, You may choose to offer,
1991      and charge a fee for, acceptance of support, warranty, indemnity,
1992      or other liability obligations and/or rights consistent with this
1993      License. However, in accepting such obligations, You may act only
1994      on Your own behalf and on Your sole responsibility, not on behalf
1995      of any other Contributor, and only if You agree to indemnify,
1996      defend, and hold each Contributor harmless for any liability
1997      incurred by, or claims asserted against, such Contributor by reason
1998      of your accepting any such warranty or additional liability.
1999
2000   END OF TERMS AND CONDITIONS
2001
2002   APPENDIX: How to apply the Apache License to your work.
2003
2004      To apply the Apache License to your work, attach the following
2005      boilerplate notice, with the fields enclosed by brackets "[]"
2006      replaced with your own identifying information. (Don't include
2007      the brackets!)  The text should be enclosed in the appropriate
2008      comment syntax for the file format. We also recommend that a
2009      file or class name and description of purpose be included on the
2010      same "printed page" as the copyright notice for easier
2011      identification within third-party archives.
2012
2013   Copyright [yyyy] [name of copyright owner]
2014
2015   Licensed under the Apache License, Version 2.0 (the "License");
2016   you may not use this file except in compliance with the License.
2017   You may obtain a copy of the License at
2018
2019       http://www.apache.org/licenses/LICENSE-2.0
2020
2021   Unless required by applicable law or agreed to in writing, software
2022   distributed under the License is distributed on an "AS IS" BASIS,
2023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2024   See the License for the specific language governing permissions and
2025   limitations under the License.
2026
2027*/