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