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