ctb_formats_detection/magic_data.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//! Centralized registry of magic header signatures across format types.
446
447#[allow(
448 unused_imports,
449 clippy::wildcard_imports,
450 reason = "Standard workspace module prelude"
451)]
452use crate::utilities::*;
453
454use std::collections::HashMap;
455use std::sync::LazyLock;
456
457use super::magic_parser::{
458 HierarchicalMagicRule, parse_magic_content_with_templates,
459};
460
461static MAGDIR_FILES: LazyLock<Vec<(String, Vec<u8>)>> = LazyLock::new(|| {
462 let mut files = Vec::new();
463 if let Ok(paths) = ctb_storage_asset_bundle::find_assets(
464 "data/detection/magic/upstream/magic/Magdir/*",
465 ) {
466 for path in paths {
467 if let Some(bytes) = ctb_storage_asset_bundle::get_asset(&path) {
468 files.push((path, bytes));
469 }
470 }
471 }
472 if files.is_empty() {
473 // Reason for fallback: when running tests or before asset bundle repack, load from repository assets directory
474 let magdir_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
475 .join("../../../assets/data/detection/magic/upstream/magic/Magdir");
476 if let Ok(entries) = std::fs::read_dir(&magdir_path) {
477 let mut sorted_entries = entries.flatten().collect::<Vec<_>>();
478 sorted_entries.sort_by_key(|e| e.path());
479 for entry in sorted_entries {
480 let p = entry.path();
481 if p.is_file() {
482 if let Ok(bytes) = std::fs::read(&p) {
483 let name = p
484 .file_name()
485 .map(|n| n.to_string_lossy().into_owned())
486 // Reason for fallback: default to empty string if path has no file name
487 .unwrap_or_default();
488 files.push((name, bytes));
489 }
490 }
491 }
492 }
493 }
494 files
495});
496
497/// Returns all bundled Magdir rule files as (`relative_path`, `content_bytes`) pairs.
498pub fn get_magdir_files() -> Vec<(&'static str, &'static [u8])> {
499 MAGDIR_FILES
500 .iter()
501 .map(|(path, bytes)| (path.as_str(), bytes.as_slice()))
502 .collect()
503}
504
505/// Returns the content of `ctoolbox.magic` from the asset bundle or repository assets.
506pub fn get_ctb_magic_content() -> Option<Vec<u8>> {
507 let key = "data/detection/magic/ctoolbox.magic";
508 if let Some(bytes) = ctb_storage_asset_bundle::get_asset(key) {
509 return Some(bytes);
510 }
511 // Reason for fallback: when running tests or before asset bundle repack, load from repository assets directory
512 let disk_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
513 .join("../../../assets")
514 .join(key);
515 std::fs::read(disk_path).ok()
516}
517
518/// Global compiled hierarchical magic database loaded from in-repo custom definitions (`ctoolbox.magic`)
519/// and upstream Magdir rule files.
520pub static COMPILED_MAGIC_DATABASE: LazyLock<(
521 Vec<HierarchicalMagicRule>,
522 Vec<HierarchicalMagicRule>,
523 HashMap<String, HierarchicalMagicRule>,
524)> = LazyLock::new(|| {
525 let mut ctb_rules = Vec::new();
526 let mut file_rules = Vec::new();
527 let mut all_templates = HashMap::new();
528
529 // 1. In-repo custom rules (ctoolbox.magic)
530 if let Some(bytes) = get_ctb_magic_content() {
531 if let Ok(content) = std::str::from_utf8(&bytes) {
532 let (rules, tpls) = parse_magic_content_with_templates(content);
533 ctb_rules.extend(rules);
534 all_templates.extend(tpls);
535 }
536 }
537
538 // 2. Upstream Magdir rule files
539 for (_path, bytes) in get_magdir_files() {
540 if let Ok(content) = std::str::from_utf8(bytes) {
541 let (rules, tpls) = parse_magic_content_with_templates(content);
542 file_rules.extend(rules);
543 all_templates.extend(tpls);
544 }
545 }
546
547 (ctb_rules, file_rules, all_templates)
548});
549
550/// Global compiled hierarchical magic rules defined specifically by ctoolbox (`ctoolbox.magic`).
551pub static COMPILED_CTB_MAGIC_RULES: LazyLock<Vec<HierarchicalMagicRule>> =
552 LazyLock::new(|| COMPILED_MAGIC_DATABASE.0.clone());
553
554/// Global compiled hierarchical magic rules from upstream `file` / Magdir.
555pub static COMPILED_FILE_MAGIC_RULES: LazyLock<Vec<HierarchicalMagicRule>> =
556 LazyLock::new(|| COMPILED_MAGIC_DATABASE.1.clone());
557
558/// Global compiled named template subroutines.
559pub static COMPILED_MAGIC_TEMPLATES: LazyLock<
560 HashMap<String, HierarchicalMagicRule>,
561> = LazyLock::new(|| COMPILED_MAGIC_DATABASE.2.clone());
562
563/// Legacy alias providing all rules combined.
564pub static COMPILED_MAGIC_RULES: LazyLock<Vec<HierarchicalMagicRule>> =
565 LazyLock::new(|| {
566 let mut combined = COMPILED_CTB_MAGIC_RULES.clone();
567 combined.extend(COMPILED_FILE_MAGIC_RULES.clone());
568 combined
569 });
570/*
571/*
572 * Adapted from: apptype.c, Written by Eberhard Mattes and put into the
573 * file_public domain
574 *
575 * Notes: 1. Qualify the filename so that DosQueryAppType does not do extraneous
576 * searches.
577 *
578 * 2. DosQueryAppType will return FAPPTYP_DOS on a file ending with ".com"
579 * (other than an OS/2 exe or Win exe with this name). Eberhard Mattes
580 * remarks Tue, 6 Apr 93: Moreover, it reports the type of the (new and very
581 * bug ridden) Win Emacs as "OS/2 executable".
582 *
583 * 3. apptype() uses the filename if given, otherwise a tmp file is created with
584 * the contents of buf. If buf is not the complete file, apptype can
585 * incorrectly identify the exe type. The "-z" option of "file" is the reason
586 * for this ugly code.
587 */
588
589The preceding notice is from src/apptype.c in `file`.
590
591
592
593/*-
594 * Copyright (c) 2008 Christos Zoulas
595 * All rights reserved.
596 *
597 * Redistribution and use in source and binary forms, with or without
598 * modification, are permitted provided that the following conditions
599 * are met:
600 * 1. Redistributions of source code must retain the above copyright
601 * notice, this list of conditions and the following disclaimer.
602 * 2. Redistributions in binary form must reproduce the above copyright
603 * notice, this list of conditions and the following disclaimer in the
604 * documentation and/or other materials provided with the distribution.
605 *
606 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
607 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
608 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
609 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
610 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
611 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
612 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
613 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
614 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
615 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
616 * POSSIBILITY OF SUCH DAMAGE.
617 */
618
619The preceding notice is from src/cdf.c, src/cdf.h, and src/cdf_time.c in `file`.
620
621
622
623/*-
624 * Copyright (c) 2016 Christos Zoulas
625 * All rights reserved.
626 *
627 * Redistribution and use in source and binary forms, with or without
628 * modification, are permitted provided that the following conditions
629 * are met:
630 * 1. Redistributions of source code must retain the above copyright
631 * notice, this list of conditions and the following disclaimer.
632 * 2. Redistributions in binary form must reproduce the above copyright
633 * notice, this list of conditions and the following disclaimer in the
634 * documentation and/or other materials provided with the distribution.
635 *
636 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
637 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
638 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
639 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
640 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
641 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
642 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
643 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
644 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
645 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
646 * POSSIBILITY OF SUCH DAMAGE.
647 */
648
649The preceding notice is from src/der.c and src/der.h in `file`.
650
651
652
653/*-
654 * Copyright (c) 2019 Christos Zoulas
655 * All rights reserved.
656 *
657 * Redistribution and use in source and binary forms, with or without
658 * modification, are permitted provided that the following conditions
659 * are met:
660 * 1. Redistributions of source code must retain the above copyright
661 * notice, this list of conditions and the following disclaimer.
662 * 2. Redistributions in binary form must reproduce the above copyright
663 * notice, this list of conditions and the following disclaimer in the
664 * documentation and/or other materials provided with the distribution.
665 *
666 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
667 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
668 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
669 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
670 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
671 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
672 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
673 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
674 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
675 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
676 * POSSIBILITY OF SUCH DAMAGE.
677 */
678
679The preceding notice is from src/is_csv.c in `file`.
680
681
682
683/*-
684 * Copyright (c) 2018 Christos Zoulas
685 * All rights reserved.
686 *
687 * Redistribution and use in source and binary forms, with or without
688 * modification, are permitted provided that the following conditions
689 * are met:
690 * 1. Redistributions of source code must retain the above copyright
691 * notice, this list of conditions and the following disclaimer.
692 * 2. Redistributions in binary form must reproduce the above copyright
693 * notice, this list of conditions and the following disclaimer in the
694 * documentation and/or other materials provided with the distribution.
695 *
696 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
697 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
698 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
699 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
700 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
701 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
702 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
703 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
704 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
705 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
706 * POSSIBILITY OF SUCH DAMAGE.
707 */
708
709The preceding notice is from src/is_json.c in `file`.
710
711
712
713/*-
714 * Copyright (c) 2023 Christos Zoulas
715 * All rights reserved.
716 *
717 * Redistribution and use in source and binary forms, with or without
718 * modification, are permitted provided that the following conditions
719 * are met:
720 * 1. Redistributions of source code must retain the above copyright
721 * notice, this list of conditions and the following disclaimer.
722 * 2. Redistributions in binary form must reproduce the above copyright
723 * notice, this list of conditions and the following disclaimer in the
724 * documentation and/or other materials provided with the distribution.
725 *
726 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
727 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
728 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
729 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
730 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
731 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
732 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
733 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
734 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
735 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
736 * POSSIBILITY OF SUCH DAMAGE.
737 */
738
739The preceding notice is from src/is_simh.c in `file`.
740
741
742
743/*-
744 * SPDX-License-Identifier: BSD-3-Clause
745 *
746 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
747 * Copyright (c) 1992, 1993, 1994
748 * The Regents of the University of California. All rights reserved.
749 *
750 * This code is derived from software contributed to Berkeley by
751 * Henry Spencer.
752 *
753 * Redistribution and use in source and binary forms, with or without
754 * modification, are permitted provided that the following conditions
755 * are met:
756 * 1. Redistributions of source code must retain the above copyright
757 * notice, this list of conditions and the following disclaimer.
758 * 2. Redistributions in binary form must reproduce the above copyright
759 * notice, this list of conditions and the following disclaimer in the
760 * documentation and/or other materials provided with the distribution.
761 * 3. Neither the name of the University nor the names of its contributors
762 * may be used to endorse or promote products derived from this software
763 * without specific prior written permission.
764 *
765 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
766 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
767 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
768 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
769 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
770 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
771 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
772 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
773 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
774 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
775 * SUCH DAMAGE.
776 *
777 * @(#)cname.h 8.3 (Berkeley) 3/20/94
778 * $FreeBSD: head/lib/libc/regex/cname.h 326025 2017-11-20 19:49:47Z pfg $
779 */
780
781The preceding notice is from src/missing/cname.h in `file`.
782
783
784
785/*-
786 * SPDX-License-Identifier: BSD-3-Clause
787 *
788 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
789 * Copyright (c) 1992, 1993, 1994
790 * The Regents of the University of California. All rights reserved.
791 *
792 * This code is derived from software contributed to Berkeley by
793 * Henry Spencer.
794 *
795 * Redistribution and use in source and binary forms, with or without
796 * modification, are permitted provided that the following conditions
797 * are met:
798 * 1. Redistributions of source code must retain the above copyright
799 * notice, this list of conditions and the following disclaimer.
800 * 2. Redistributions in binary form must reproduce the above copyright
801 * notice, this list of conditions and the following disclaimer in the
802 * documentation and/or other materials provided with the distribution.
803 * 3. Neither the name of the University nor the names of its contributors
804 * may be used to endorse or promote products derived from this software
805 * without specific prior written permission.
806 *
807 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
808 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
809 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
810 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
811 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
812 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
813 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
814 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
815 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
816 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
817 * SUCH DAMAGE.
818 *
819 * @(#)engine.c 8.5 (Berkeley) 3/20/94
820 */
821
822The preceding notice is from src/missing/engine.c in `file`.
823
824
825
826/*-
827 * Copyright (c) 2000 The NetBSD Foundation, Inc.
828 * All rights reserved.
829 *
830 * This code was contributed to The NetBSD Foundation by Allen Briggs.
831 *
832 * Redistribution and use in source and binary forms, with or without
833 * modification, are permitted provided that the following conditions
834 * are met:
835 * 1. Redistributions of source code must retain the above copyright
836 * notice, this list of conditions and the following disclaimer.
837 * 2. Redistributions in binary form must reproduce the above copyright
838 * notice, this list of conditions and the following disclaimer in the
839 * documentation and/or other materials provided with the distribution.
840 *
841 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
842 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
843 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
844 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
845 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
846 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
847 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
848 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
849 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
850 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
851 * POSSIBILITY OF SUCH DAMAGE.
852 */
853
854The preceding notice is from src/missing/fmtcheck.c in `file`.
855
856
857
858/*-
859 * Copyright (c) 2011 The NetBSD Foundation, Inc.
860 * All rights reserved.
861 *
862 * This code is derived from software contributed to The NetBSD Foundation
863 * by Christos Zoulas.
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/missing/getline.c in `file`.
888
889
890
891/*-
892 * Copyright (c) 2000 The NetBSD Foundation, Inc.
893 * All rights reserved.
894 *
895 * This code is derived from software contributed to The NetBSD Foundation
896 * by Dieter Baron and Thomas Klausner.
897 *
898 * Redistribution and use in source and binary forms, with or without
899 * modification, are permitted provided that the following conditions
900 * are met:
901 * 1. Redistributions of source code must retain the above copyright
902 * notice, this list of conditions and the following disclaimer.
903 * 2. Redistributions in binary form must reproduce the above copyright
904 * notice, this list of conditions and the following disclaimer in the
905 * documentation and/or other materials provided with the distribution.
906 *
907 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
908 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
909 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
910 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
911 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
912 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
913 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
914 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
915 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
916 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
917 * POSSIBILITY OF SUCH DAMAGE.
918 */
919
920The preceding notice is from src/missing/getopt_long.c and src/mygetopt.h in `file`.
921
922
923
924/*
925 * Public domain fallback for reallocarray(3), for platforms (e.g.
926 * AmigaOS/libnix) whose C library declares it but does not implement it.
927 */
928
929The preceding notice is from src/missing/reallocarray.c in `file`.
930
931
932
933/*-
934 * SPDX-License-Identifier: BSD-3-Clause
935 *
936 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
937 * Copyright (c) 1992, 1993, 1994
938 * The Regents of the University of California. All rights reserved.
939 *
940 * Copyright (c) 2011 The FreeBSD Foundation
941 * All rights reserved.
942 * Portions of this software were developed by David Chisnall
943 * under sponsorship from the FreeBSD Foundation.
944 *
945 * This code is derived from software contributed to Berkeley by
946 * Henry Spencer.
947 *
948 * Redistribution and use in source and binary forms, with or without
949 * modification, are permitted provided that the following conditions
950 * are met:
951 * 1. Redistributions of source code must retain the above copyright
952 * notice, this list of conditions and the following disclaimer.
953 * 2. Redistributions in binary form must reproduce the above copyright
954 * notice, this list of conditions and the following disclaimer in the
955 * documentation and/or other materials provided with the distribution.
956 * 3. Neither the name of the University nor the names of its contributors
957 * may be used to endorse or promote products derived from this software
958 * without specific prior written permission.
959 *
960 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
961 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
962 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
963 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
964 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
965 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
966 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
967 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
968 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
969 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
970 * SUCH DAMAGE.
971 *
972 * @(#)regcomp.c 8.5 (Berkeley) 3/20/94
973 */
974
975The preceding notice is from src/missing/regcomp.c in `file`.
976
977
978
979/*-
980 * SPDX-License-Identifier: BSD-3-Clause
981 *
982 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
983 * Copyright (c) 1992, 1993, 1994
984 * The Regents of the University of California. All rights reserved.
985 *
986 * This code is derived from software contributed to Berkeley by
987 * Henry Spencer.
988 *
989 * Redistribution and use in source and binary forms, with or without
990 * modification, are permitted provided that the following conditions
991 * are met:
992 * 1. Redistributions of source code must retain the above copyright
993 * notice, this list of conditions and the following disclaimer.
994 * 2. Redistributions in binary form must reproduce the above copyright
995 * notice, this list of conditions and the following disclaimer in the
996 * documentation and/or other materials provided with the distribution.
997 * 3. Neither the name of the University nor the names of its contributors
998 * may be used to endorse or promote products derived from this software
999 * without specific prior written permission.
1000 *
1001 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1002 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1003 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1004 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1005 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1006 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1007 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1008 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1009 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1010 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1011 * SUCH DAMAGE.
1012 *
1013 * @(#)regerror.c 8.4 (Berkeley) 3/20/94
1014 */
1015
1016The preceding notice is from src/missing/regerror.c in `file`.
1017
1018
1019
1020$NetBSD: COPYRIGHT,v 1.5 2003/08/07 16:43:19 agc Exp $
1021
1022Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
1023This software is not subject to any license of the American Telephone
1024and Telegraph Company or of the Regents of the University of California.
1025
1026Permission is granted to anyone to use this software for any purpose on
1027any computer system, and to alter it and redistribute it, subject
1028to the following restrictions:
1029
10301. The author is not responsible for the consequences of use of this
1031 software, no matter how awful, even if they arise from flaws in it.
1032
10332. The origin of this software must not be misrepresented, either by
1034 explicit claim or by omission. Since few users ever read sources,
1035 credits must appear in the documentation.
1036
10373. Altered versions must be plainly marked as such, and must not be
1038 misrepresented as being the original software. Since few users
1039 ever read sources, credits must appear in the documentation.
1040
10414. This notice may not be removed or altered.
1042
1043=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1044/*-
1045 * Copyright (c) 1994
1046 * The Regents of the University of California. All rights reserved.
1047 *
1048 * Redistribution and use in source and binary forms, with or without
1049 * modification, are permitted provided that the following conditions
1050 * are met:
1051 * 1. Redistributions of source code must retain the above copyright
1052 * notice, this list of conditions and the following disclaimer.
1053 * 2. Redistributions in binary form must reproduce the above copyright
1054 * notice, this list of conditions and the following disclaimer in the
1055 * documentation and/or other materials provided with the distribution.
1056 * 3. Neither the name of the University nor the names of its contributors
1057 * may be used to endorse or promote products derived from this software
1058 * without specific prior written permission.
1059 *
1060 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1061 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1062 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1063 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1064 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1065 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1066 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1067 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1068 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1069 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1070 * SUCH DAMAGE.
1071 *
1072 * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94
1073 */
1074
1075The preceding notice is from src/missing/REGEX-COPYRIGHT in `file`.
1076
1077
1078
1079/*-
1080 * SPDX-License-Identifier: BSD-3-Clause
1081 *
1082 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1083 * Copyright (c) 1992, 1993, 1994
1084 * The Regents of the University of California. All rights reserved.
1085 *
1086 * This code is derived from software contributed to Berkeley by
1087 * Henry Spencer.
1088 *
1089 * Redistribution and use in source and binary forms, with or without
1090 * modification, are permitted provided that the following conditions
1091 * are met:
1092 * 1. Redistributions of source code must retain the above copyright
1093 * notice, this list of conditions and the following disclaimer.
1094 * 2. Redistributions in binary form must reproduce the above copyright
1095 * notice, this list of conditions and the following disclaimer in the
1096 * documentation and/or other materials provided with the distribution.
1097 * 3. Neither the name of the University nor the names of its contributors
1098 * may be used to endorse or promote products derived from this software
1099 * without specific prior written permission.
1100 *
1101 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1102 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1103 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1104 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1105 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1106 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1107 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1108 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1109 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1110 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1111 * SUCH DAMAGE.
1112 *
1113 * @(#)regex2.h 8.4 (Berkeley) 3/20/94
1114 * $FreeBSD: head/lib/libc/regex/regex2.h 368359 2020-12-05 03:18:48Z kevans $
1115 */
1116
1117The preceding notice is from src/missing/regex2.h in `file`.
1118
1119
1120
1121/*-
1122 * SPDX-License-Identifier: BSD-3-Clause
1123 *
1124 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1125 * Copyright (c) 1992, 1993, 1994
1126 * The Regents of the University of California. All rights reserved.
1127 *
1128 * This code is derived from software contributed to Berkeley by
1129 * Henry Spencer.
1130 *
1131 * Redistribution and use in source and binary forms, with or without
1132 * modification, are permitted provided that the following conditions
1133 * are met:
1134 * 1. Redistributions of source code must retain the above copyright
1135 * notice, this list of conditions and the following disclaimer.
1136 * 2. Redistributions in binary form must reproduce the above copyright
1137 * notice, this list of conditions and the following disclaimer in the
1138 * documentation and/or other materials provided with the distribution.
1139 * 3. Neither the name of the University nor the names of its contributors
1140 * may be used to endorse or promote products derived from this software
1141 * without specific prior written permission.
1142 *
1143 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1144 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1145 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1146 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1147 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1148 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1149 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1150 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1151 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1152 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1153 * SUCH DAMAGE.
1154 *
1155 * @(#)regexec.c 8.3 (Berkeley) 3/20/94
1156 */
1157
1158The preceding notice is from src/missing/regexec.c in `file`.
1159
1160
1161
1162/*-
1163 * SPDX-License-Identifier: BSD-3-Clause
1164 *
1165 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1166 * Copyright (c) 1992, 1993, 1994
1167 * The Regents of the University of California. All rights reserved.
1168 *
1169 * This code is derived from software contributed to Berkeley by
1170 * Henry Spencer.
1171 *
1172 * Redistribution and use in source and binary forms, with or without
1173 * modification, are permitted provided that the following conditions
1174 * are met:
1175 * 1. Redistributions of source code must retain the above copyright
1176 * notice, this list of conditions and the following disclaimer.
1177 * 2. Redistributions in binary form must reproduce the above copyright
1178 * notice, this list of conditions and the following disclaimer in the
1179 * documentation and/or other materials provided with the distribution.
1180 * 3. Neither the name of the University nor the names of its contributors
1181 * may be used to endorse or promote products derived from this software
1182 * without specific prior written permission.
1183 *
1184 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1185 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1186 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1187 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1188 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1189 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1190 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1191 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1192 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1193 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1194 * SUCH DAMAGE.
1195 *
1196 * @(#)regfree.c 8.3 (Berkeley) 3/20/94
1197 */
1198
1199The preceding notice is from src/missing/regfree.c in `file`.
1200
1201
1202
1203/*-
1204 * Copyright (c) 1990, 1993
1205 * The Regents of the University of California. All rights reserved.
1206 *
1207 * This code is derived from software contributed to Berkeley by
1208 * Chris Torek.
1209 *
1210 * Redistribution and use in source and binary forms, with or without
1211 * modification, are permitted provided that the following conditions
1212 * are met:
1213 * 1. Redistributions of source code must retain the above copyright
1214 * notice, this list of conditions and the following disclaimer.
1215 * 2. Redistributions in binary form must reproduce the above copyright
1216 * notice, this list of conditions and the following disclaimer in the
1217 * documentation and/or other materials provided with the distribution.
1218 * 3. Neither the name of the University nor the names of its contributors
1219 * may be used to endorse or promote products derived from this software
1220 * without specific prior written permission.
1221 *
1222 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1223 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1224 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1225 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1226 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1227 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1228 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1229 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1230 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1231 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1232 * SUCH DAMAGE.
1233 */
1234
1235The preceding notice is from src/missing/strcasestr.c in `file`.
1236
1237
1238
1239/*
1240 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
1241 *
1242 * Permission to use, copy, modify, and distribute this software for any
1243 * purpose with or without fee is hereby granted, provided that the above
1244 * copyright notice and this permission notice appear in all copies.
1245 *
1246 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1247 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1248 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1249 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1250 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1251 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1252 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1253 */
1254
1255The preceding notice is from src/missing/strlcat.c and src/missing/strlcpy.c in `file`.
1256
1257
1258
1259/*-
1260 * SPDX-License-Identifier: BSD-3-Clause
1261 *
1262 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1263 * Copyright (c) 1992, 1993, 1994
1264 * The Regents of the University of California. All rights reserved.
1265 *
1266 * This code is derived from software contributed to Berkeley by
1267 * Henry Spencer.
1268 *
1269 * Redistribution and use in source and binary forms, with or without
1270 * modification, are permitted provided that the following conditions
1271 * are met:
1272 * 1. Redistributions of source code must retain the above copyright
1273 * notice, this list of conditions and the following disclaimer.
1274 * 2. Redistributions in binary form must reproduce the above copyright
1275 * notice, this list of conditions and the following disclaimer in the
1276 * documentation and/or other materials provided with the distribution.
1277 * 3. Neither the name of the University nor the names of its contributors
1278 * may be used to endorse or promote products derived from this software
1279 * without specific prior written permission.
1280 *
1281 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1282 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1283 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1284 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1285 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1286 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1287 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1288 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1289 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1290 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1291 * SUCH DAMAGE.
1292 *
1293 * @(#)utils.h 8.3 (Berkeley) 3/20/94
1294 * $FreeBSD: head/lib/libc/regex/utils.h 341838 2018-12-12 04:23:00Z yuripv $
1295 */
1296
1297The preceding notice is from src/missing/utils.h in `file`.
1298
1299
1300
1301/*-
1302 * Copyright (c) 2008, 2016 Christos Zoulas
1303 * All rights reserved.
1304 *
1305 * Redistribution and use in source and binary forms, with or without
1306 * modification, are permitted provided that the following conditions
1307 * are met:
1308 * 1. Redistributions of source code must retain the above copyright
1309 * notice, this list of conditions and the following disclaimer.
1310 * 2. Redistributions in binary form must reproduce the above copyright
1311 * notice, this list of conditions and the following disclaimer in the
1312 * documentation and/or other materials provided with the distribution.
1313 *
1314 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1315 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1316 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1317 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1318 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1319 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1320 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1321 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1322 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1323 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1324 * POSSIBILITY OF SUCH DAMAGE.
1325 */
1326
1327The preceding notice is from src/readcdf.c in `file`.
1328
1329
1330
1331/*-
1332 * Copyright (c) 1992 Henry Spencer.
1333 * Copyright (c) 1992, 1993
1334 * The Regents of the University of California. All rights reserved.
1335 *
1336 * This code is derived from software contributed to Berkeley by
1337 * Henry Spencer of the University of Toronto.
1338 *
1339 * Redistribution and use in source and binary forms, with or without
1340 * modification, are permitted provided that the following conditions
1341 * are met:
1342 * 1. Redistributions of source code must retain the above copyright
1343 * notice, this list of conditions and the following disclaimer.
1344 * 2. Redistributions in binary form must reproduce the above copyright
1345 * notice, this list of conditions and the following disclaimer in the
1346 * documentation and/or other materials provided with the distribution.
1347 * 3. Neither the name of the University nor the names of its contributors
1348 * may be used to endorse or promote products derived from this software
1349 * without specific prior written permission.
1350 *
1351 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1352 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1353 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1354 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1355 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1356 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1357 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1358 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1359 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1360 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1361 * SUCH DAMAGE.
1362 *
1363 * @(#)regex.h 8.2 (Berkeley) 1/3/94
1364 * $FreeBSD: src/include/regex.h,v 1.12 2010/02/16 19:39:50 imp Exp $
1365 */
1366
1367The preceding notice is from src/regex-bsd.h in `file`.
1368*/
1369/*
1370
1371Text of LICENSE from DROID:
1372
1373Copyright (c) 2016, The National Archives <pronom@nationalarchives.gov.uk>
1374All rights reserved.
1375
1376Redistribution and use in source and binary forms, with or without
1377modification, are permitted provided that the following
1378conditions are met:
1379
1380 * Redistributions of source code must retain the above copyright
1381 notice, this list of conditions and the following disclaimer.
1382
1383 * Redistributions in binary form must reproduce the above copyright
1384 notice, this list of conditions and the following disclaimer in the
1385 documentation and/or other materials provided with the distribution.
1386
1387 * Neither the name of the The National Archives nor the
1388 names of its contributors may be used to endorse or promote products
1389 derived from this software without specific prior written permission.
1390
1391THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1392AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1393IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1394PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
1395CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1396EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1397PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1398PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1399LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1400NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1401SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1402*/
1403
1404/*
1405
1406Text of LICENSE from fileid:
1407
1408The MIT License (MIT)
1409
1410Copyright (c) 2015 David B Heise
1411
1412Permission is hereby granted, free of charge, to any person obtaining a copy of
1413this software and associated documentation files (the "Software"), to deal in
1414the Software without restriction, including without limitation the rights to
1415use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1416the Software, and to permit persons to whom the Software is furnished to do so,
1417subject to the following conditions:
1418
1419The above copyright notice and this permission notice shall be included in all
1420copies or substantial portions of the Software.
1421
1422THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1423IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1424FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1425COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1426IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1427CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1428
1429
1430*/
1431
1432/*
1433Text of LICENSE from binwalk:
1434
1435
1436MIT License
1437
1438Copyright (c) 2024 devttys0
1439
1440Permission is hereby granted, free of charge, to any person obtaining a copy
1441of this software and associated documentation files (the "Software"), to deal
1442in the Software without restriction, including without limitation the rights
1443to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1444copies of the Software, and to permit persons to whom the Software is
1445furnished to do so, subject to the following conditions:
1446
1447The above copyright notice and this permission notice shall be included in all
1448copies or substantial portions of the Software.
1449
1450THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1451IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1452FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1453AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1454LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1455OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1456SOFTWARE.
1457
1458*/
1459
1460/*
1461Text of LICENSE from polyfile:
1462
1463
1464 Apache License
1465 Version 2.0, January 2004
1466 http://www.apache.org/licenses/
1467
1468 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1469
1470 1. Definitions.
1471
1472 "License" shall mean the terms and conditions for use, reproduction,
1473 and distribution as defined by Sections 1 through 9 of this document.
1474
1475 "Licensor" shall mean the copyright owner or entity authorized by
1476 the copyright owner that is granting the License.
1477
1478 "Legal Entity" shall mean the union of the acting entity and all
1479 other entities that control, are controlled by, or are under common
1480 control with that entity. For the purposes of this definition,
1481 "control" means (i) the power, direct or indirect, to cause the
1482 direction or management of such entity, whether by contract or
1483 otherwise, or (ii) ownership of fifty percent (50%) or more of the
1484 outstanding shares, or (iii) beneficial ownership of such entity.
1485
1486 "You" (or "Your") shall mean an individual or Legal Entity
1487 exercising permissions granted by this License.
1488
1489 "Source" form shall mean the preferred form for making modifications,
1490 including but not limited to software source code, documentation
1491 source, and configuration files.
1492
1493 "Object" form shall mean any form resulting from mechanical
1494 transformation or translation of a Source form, including but
1495 not limited to compiled object code, generated documentation,
1496 and conversions to other media types.
1497
1498 "Work" shall mean the work of authorship, whether in Source or
1499 Object form, made available under the License, as indicated by a
1500 copyright notice that is included in or attached to the work
1501 (an example is provided in the Appendix below).
1502
1503 "Derivative Works" shall mean any work, whether in Source or Object
1504 form, that is based on (or derived from) the Work and for which the
1505 editorial revisions, annotations, elaborations, or other modifications
1506 represent, as a whole, an original work of authorship. For the purposes
1507 of this License, Derivative Works shall not include works that remain
1508 separable from, or merely link (or bind by name) to the interfaces of,
1509 the Work and Derivative Works thereof.
1510
1511 "Contribution" shall mean any work of authorship, including
1512 the original version of the Work and any modifications or additions
1513 to that Work or Derivative Works thereof, that is intentionally
1514 submitted to Licensor for inclusion in the Work by the copyright owner
1515 or by an individual or Legal Entity authorized to submit on behalf of
1516 the copyright owner. For the purposes of this definition, "submitted"
1517 means any form of electronic, verbal, or written communication sent
1518 to the Licensor or its representatives, including but not limited to
1519 communication on electronic mailing lists, source code control systems,
1520 and issue tracking systems that are managed by, or on behalf of, the
1521 Licensor for the purpose of discussing and improving the Work, but
1522 excluding communication that is conspicuously marked or otherwise
1523 designated in writing by the copyright owner as "Not a Contribution."
1524
1525 "Contributor" shall mean Licensor and any individual or Legal Entity
1526 on behalf of whom a Contribution has been received by Licensor and
1527 subsequently incorporated within the Work.
1528
1529 2. Grant of Copyright License. Subject to the terms and conditions of
1530 this License, each Contributor hereby grants to You a perpetual,
1531 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1532 copyright license to reproduce, prepare Derivative Works of,
1533 publicly display, publicly perform, sublicense, and distribute the
1534 Work and such Derivative Works in Source or Object form.
1535
1536 3. Grant of Patent License. Subject to the terms and conditions of
1537 this License, each Contributor hereby grants to You a perpetual,
1538 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1539 (except as stated in this section) patent license to make, have made,
1540 use, offer to sell, sell, import, and otherwise transfer the Work,
1541 where such license applies only to those patent claims licensable
1542 by such Contributor that are necessarily infringed by their
1543 Contribution(s) alone or by combination of their Contribution(s)
1544 with the Work to which such Contribution(s) was submitted. If You
1545 institute patent litigation against any entity (including a
1546 cross-claim or counterclaim in a lawsuit) alleging that the Work
1547 or a Contribution incorporated within the Work constitutes direct
1548 or contributory patent infringement, then any patent licenses
1549 granted to You under this License for that Work shall terminate
1550 as of the date such litigation is filed.
1551
1552 4. Redistribution. You may reproduce and distribute copies of the
1553 Work or Derivative Works thereof in any medium, with or without
1554 modifications, and in Source or Object form, provided that You
1555 meet the following conditions:
1556
1557 (a) You must give any other recipients of the Work or
1558 Derivative Works a copy of this License; and
1559
1560 (b) You must cause any modified files to carry prominent notices
1561 stating that You changed the files; and
1562
1563 (c) You must retain, in the Source form of any Derivative Works
1564 that You distribute, all copyright, patent, trademark, and
1565 attribution notices from the Source form of the Work,
1566 excluding those notices that do not pertain to any part of
1567 the Derivative Works; and
1568
1569 (d) If the Work includes a "NOTICE" text file as part of its
1570 distribution, then any Derivative Works that You distribute must
1571 include a readable copy of the attribution notices contained
1572 within such NOTICE file, excluding those notices that do not
1573 pertain to any part of the Derivative Works, in at least one
1574 of the following places: within a NOTICE text file distributed
1575 as part of the Derivative Works; within the Source form or
1576 documentation, if provided along with the Derivative Works; or,
1577 within a display generated by the Derivative Works, if and
1578 wherever such third-party notices normally appear. The contents
1579 of the NOTICE file are for informational purposes only and
1580 do not modify the License. You may add Your own attribution
1581 notices within Derivative Works that You distribute, alongside
1582 or as an addendum to the NOTICE text from the Work, provided
1583 that such additional attribution notices cannot be construed
1584 as modifying the License.
1585
1586 You may add Your own copyright statement to Your modifications and
1587 may provide additional or different license terms and conditions
1588 for use, reproduction, or distribution of Your modifications, or
1589 for any such Derivative Works as a whole, provided Your use,
1590 reproduction, and distribution of the Work otherwise complies with
1591 the conditions stated in this License.
1592
1593 5. Submission of Contributions. Unless You explicitly state otherwise,
1594 any Contribution intentionally submitted for inclusion in the Work
1595 by You to the Licensor shall be under the terms and conditions of
1596 this License, without any additional terms or conditions.
1597 Notwithstanding the above, nothing herein shall supersede or modify
1598 the terms of any separate license agreement you may have executed
1599 with Licensor regarding such Contributions.
1600
1601 6. Trademarks. This License does not grant permission to use the trade
1602 names, trademarks, service marks, or product names of the Licensor,
1603 except as required for reasonable and customary use in describing the
1604 origin of the Work and reproducing the content of the NOTICE file.
1605
1606 7. Disclaimer of Warranty. Unless required by applicable law or
1607 agreed to in writing, Licensor provides the Work (and each
1608 Contributor provides its Contributions) on an "AS IS" BASIS,
1609 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1610 implied, including, without limitation, any warranties or conditions
1611 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1612 PARTICULAR PURPOSE. You are solely responsible for determining the
1613 appropriateness of using or redistributing the Work and assume any
1614 risks associated with Your exercise of permissions under this License.
1615
1616 8. Limitation of Liability. In no event and under no legal theory,
1617 whether in tort (including negligence), contract, or otherwise,
1618 unless required by applicable law (such as deliberate and grossly
1619 negligent acts) or agreed to in writing, shall any Contributor be
1620 liable to You for damages, including any direct, indirect, special,
1621 incidental, or consequential damages of any character arising as a
1622 result of this License or out of the use or inability to use the
1623 Work (including but not limited to damages for loss of goodwill,
1624 work stoppage, computer failure or malfunction, or any and all
1625 other commercial damages or losses), even if such Contributor
1626 has been advised of the possibility of such damages.
1627
1628 9. Accepting Warranty or Additional Liability. While redistributing
1629 the Work or Derivative Works thereof, You may choose to offer,
1630 and charge a fee for, acceptance of support, warranty, indemnity,
1631 or other liability obligations and/or rights consistent with this
1632 License. However, in accepting such obligations, You may act only
1633 on Your own behalf and on Your sole responsibility, not on behalf
1634 of any other Contributor, and only if You agree to indemnify,
1635 defend, and hold each Contributor harmless for any liability
1636 incurred by, or claims asserted against, such Contributor by reason
1637 of your accepting any such warranty or additional liability.
1638
1639 END OF TERMS AND CONDITIONS
1640
1641 APPENDIX: How to apply the Apache License to your work.
1642
1643 To apply the Apache License to your work, attach the following
1644 boilerplate notice, with the fields enclosed by brackets "[]"
1645 replaced with your own identifying information. (Don't include
1646 the brackets!) The text should be enclosed in the appropriate
1647 comment syntax for the file format. We also recommend that a
1648 file or class name and description of purpose be included on the
1649 same "printed page" as the copyright notice for easier
1650 identification within third-party archives.
1651
1652 Copyright [yyyy] [name of copyright owner]
1653
1654 Licensed under the Apache License, Version 2.0 (the "License");
1655 you may not use this file except in compliance with the License.
1656 You may obtain a copy of the License at
1657
1658 http://www.apache.org/licenses/LICENSE-2.0
1659
1660 Unless required by applicable law or agreed to in writing, software
1661 distributed under the License is distributed on an "AS IS" BASIS,
1662 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1663 See the License for the specific language governing permissions and
1664 limitations under the License.
1665
1666*/