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