ctb_formats_detection/
types.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//! Core data types, candidate representations, and report structures for the
446//! format detection engine.
447
448#[allow(
449    unused_imports,
450    clippy::wildcard_imports,
451    reason = "Standard workspace module prelude"
452)]
453use crate::utilities::*;
454
455pub use ctb_utilities::FormatId;
456pub use ctb_utilities::format_id::FormatCategory;
457
458/// Calibrated confidence tier for a detection candidate.
459#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
460pub enum ConfidenceTier {
461    /// Conflicting strong evidence detected across multiple formats.
462    Conflicted = 0,
463    /// Weak or ambiguous heuristic evidence.
464    Weak = 1,
465    /// Extension match or generic container without child specialization.
466    Moderate = 2,
467    /// Distinctive magic signature or verified extension + partial magic.
468    Strong = 3,
469    /// Exact magic signature + child specialization (and extension if present).
470    HighestConfidence = 4,
471}
472
473/// Types of resource quotas enforced during detection.
474#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
475pub enum DetectionQuotaType {
476    /// Maximum byte inspection window limit reached.
477    ByteBudget,
478    /// Maximum directory entries inspected during bundle probing.
479    BundleEntries,
480    /// Maximum directory or container nesting depth exceeded.
481    RecursionDepth,
482}
483
484/// Specific evidence item contributing to a candidate's confidence score.
485#[derive(Debug, Clone, PartialEq, Eq)]
486pub enum DetectionEvidence {
487    /// Magic pattern matched from upstream `file` / Magdir rules.
488    FileMagic {
489        description: String,
490        score: u32,
491    },
492    /// Fast static magic pattern added specifically by ctoolbox (`MAGIC_REGISTRY`).
493    CtbMagic {
494        description: String,
495        score: u32,
496    },
497    /// Rule-based or specialized format detection logic in ctoolbox (small formats, etc.).
498    CtbRule {
499        description: String,
500        score: u32,
501    },
502    Extension {
503        ext: String,
504        is_primary: bool,
505        score: u32,
506    },
507    PlatformPrior {
508        platform: FormatId,
509        score: u32,
510    },
511    CategoryMatch {
512        category: FormatCategory,
513        score: u32,
514    },
515    AppleTypeCode {
516        code: [u8; 4],
517        score: u32,
518    },
519    AttachedStream {
520        stream_kind_name: String,
521        detail: String,
522        score: u32,
523    },
524    SubsumedAncestor {
525        parent_id: Option<FormatId>,
526        parent_mime: Option<String>,
527        score: u32,
528    },
529    /// Character set encoding identified for text content.
530    Encoding {
531        encoding: String,
532        score: u32,
533    },
534    /// Text properties including line endings, long lines, and escape sequences.
535    TextProperties {
536        line_ending: Option<crate::encoding::LineEndingKind>,
537        has_long_lines: bool,
538        has_escapes: bool,
539        score: u32,
540    },
541    /// Special file or filesystem entity.
542    SpecialFile {
543        kind: String,
544        score: u32,
545    },
546    /// Container or specialized structural inspection evidence.
547    ContainerStructure {
548        detail: String,
549        score: u32,
550    },
551    /// Dual-anchored BOF / EOF match evidence (DROID/PRONOM style).
552    DualAnchored {
553        bof_offset: u64,
554        eof_offset: Option<u64>,
555        score: u32,
556    },
557    /// `PolyFile` byte-range attribution spanning [start, end) offsets.
558    ByteRange {
559        start: u64,
560        end: u64,
561        label: String,
562        score: u32,
563    },
564    /// Polyglot container evidence where multiple independent primary formats co-exist.
565    Polyglot {
566        formats: Vec<String>,
567        detail: String,
568        score: u32,
569    },
570    /// DROID / PRONOM format identification evidence.
571    Pronom {
572        puid: String,
573        score: u32,
574    },
575}
576
577/// Output candidate produced by format detection.
578#[derive(Debug, Clone, PartialEq, Eq)]
579pub struct DetectionCandidate {
580    /// Authoritative workspace `FormatId` if a matching Dc exists.
581    pub format_id: Option<FormatId>,
582    /// Global graph Document Character ID if known.
583    pub dc_id: Option<u128>,
584    /// Detected MIME type (from magic rule or format catalog).
585    pub mime: Option<String>,
586    /// Human-readable format description.
587    pub description: String,
588    /// Calibrated confidence tier.
589    pub confidence: ConfidenceTier,
590    /// Quantitative score (0–100 scale).
591    pub score: u32,
592    /// Accumulated evidence trails.
593    pub evidence: Vec<DetectionEvidence>,
594    /// Decompression-derived format chain layers ordered innermost → outermost
595    /// (matching the `@chain(inner > outer)` directive syntax), if this
596    /// candidate wraps a decompressed payload; `None` otherwise.
597    pub chain_layers: Option<Vec<FormatId>>,
598}
599
600/// Contextual hints provided by the caller to guide detection.
601#[derive(Debug, Clone, Default)]
602pub struct DetectionHint {
603    pub filename: Option<String>,
604    pub extension: Option<String>,
605    pub platform: Option<FormatId>,
606    pub expected_category: Option<FormatCategory>,
607    pub expected_categories: Vec<FormatCategory>,
608    pub limit_to_categories: bool,
609    pub apple_type_code: Option<[u8; 4]>,
610    pub stream_candidates: Vec<DetectionCandidate>,
611    pub special_kind: Option<String>,
612    pub file_origin: Option<ctb_io_file::FileOrigin>,
613    /// Whether transparent decompression inspection is requested (like `file -z`).
614    pub uncompress: bool,
615    /// Whether decompression inspection should suppress outer format reporting (like `file -Z`).
616    pub uncompress_noreport: bool,
617    /// Maximum byte limit for bounded decompression inspection (defaults to 1 MiB).
618    pub decompress_byte_limit: Option<usize>,
619    /// Maximum decompression recursion depth for chain probing (defaults to 3).
620    /// A value of `Some(0)` disables decompression probing entirely.
621    pub max_decompression_depth: Option<usize>,
622    /// Current recursion depth of payload peeling / decompression.
623    pub recursion_depth: usize,
624    /// Whether detection should strictly emulate standard UNIX `file` output.
625    pub compat: bool,
626    /// POSIX file permission mode bits (e.g. 0o755) if known.
627    pub file_mode: Option<u32>,
628}
629
630impl DetectionHint {
631    /// Creates a detection hint strictly limited to a single format category.
632    #[must_use]
633    pub fn for_category(cat: FormatCategory) -> Self {
634        Self {
635            expected_category: Some(cat),
636            expected_categories: vec![cat],
637            limit_to_categories: true,
638            ..Default::default()
639        }
640    }
641
642    /// Creates a detection hint strictly limited to a list of format categories.
643    #[must_use]
644    pub fn for_categories(cats: &[FormatCategory]) -> Self {
645        Self {
646            expected_category: cats.first().copied(),
647            expected_categories: cats.to_vec(),
648            limit_to_categories: true,
649            ..Default::default()
650        }
651    }
652
653    /// Sets the expected category and limits detection to it.
654    #[must_use]
655    pub fn with_category(mut self, cat: FormatCategory) -> Self {
656        self.expected_category = Some(cat);
657        if !self.expected_categories.contains(&cat) {
658            self.expected_categories.push(cat);
659        }
660        self.limit_to_categories = true;
661        self
662    }
663
664    /// Sets multiple allowed categories and limits detection to them.
665    #[must_use]
666    pub fn with_categories(mut self, cats: &[FormatCategory]) -> Self {
667        self.expected_categories = cats.to_vec();
668        if self.expected_category.is_none() {
669            self.expected_category = cats.first().copied();
670        }
671        self.limit_to_categories = true;
672        self
673    }
674
675    /// Checks if a candidate category matches the hint's category constraints.
676    #[must_use]
677    pub fn allows_category(&self, cat: FormatCategory) -> bool {
678        if !self.limit_to_categories {
679            return true;
680        }
681        if let Some(exp) = self.expected_category {
682            if exp == cat {
683                return true;
684            }
685        }
686        self.expected_categories.contains(&cat)
687    }
688}
689
690/// Detailed outcome of format detection.
691#[derive(Debug, Clone, PartialEq, Eq)]
692pub enum DetectionOutcome {
693    /// One or more matching format candidates were identified and ranked.
694    Matched(Vec<DetectionCandidate>),
695    /// Insufficient data was available to evaluate candidate signatures
696    /// (e.g., source length is smaller than required minimum magic offset).
697    InsufficientData {
698        available_bytes: u64,
699        required_bytes: u64,
700    },
701    /// A configured quota or resource budget was exhausted during detection.
702    QuotaExhausted {
703        quota_type: DetectionQuotaType,
704        limit: u64,
705    },
706    /// A hardware or OS read error occurred during probing.
707    ReadError { offset: u64, message: String },
708    /// The source was inspected up to all required bounds and did not
709    /// match any known format signature.
710    TrueNegative { bytes_inspected: u64 },
711}
712
713/// Comprehensive report produced by format detection.
714#[derive(Debug, Clone, PartialEq, Eq)]
715pub struct DetectionReport {
716    /// High-level detection outcome.
717    pub outcome: DetectionOutcome,
718    /// Evaluated candidates (empty on error, insufficient data, or true negative).
719    pub candidates: Vec<DetectionCandidate>,
720    /// Total bytes read and evaluated across all probes.
721    pub bytes_evaluated: u64,
722    /// Whether any attached stream or fork signals were evaluated.
723    pub stream_signals_used: bool,
724    /// Origin source where the inspected file or stream originated.
725    pub file_origin: Option<ctb_io_file::FileOrigin>,
726}
727/*
728/*
729 * Adapted from: apptype.c, Written by Eberhard Mattes and put into the
730 * file_public domain
731 *
732 * Notes: 1. Qualify the filename so that DosQueryAppType does not do extraneous
733 * searches.
734 *
735 * 2. DosQueryAppType will return FAPPTYP_DOS on a file ending with ".com"
736 * (other than an OS/2 exe or Win exe with this name). Eberhard Mattes
737 * remarks Tue, 6 Apr 93: Moreover, it reports the type of the (new and very
738 * bug ridden) Win Emacs as "OS/2 executable".
739 *
740 * 3. apptype() uses the filename if given, otherwise a tmp file is created with
741 * the contents of buf. If buf is not the complete file, apptype can
742 * incorrectly identify the exe type. The "-z" option of "file" is the reason
743 * for this ugly code.
744 */
745
746The preceding notice is from src/apptype.c in `file`.
747
748
749
750/*-
751 * Copyright (c) 2008 Christos Zoulas
752 * All rights reserved.
753 *
754 * Redistribution and use in source and binary forms, with or without
755 * modification, are permitted provided that the following conditions
756 * are met:
757 * 1. Redistributions of source code must retain the above copyright
758 *    notice, this list of conditions and the following disclaimer.
759 * 2. Redistributions in binary form must reproduce the above copyright
760 *    notice, this list of conditions and the following disclaimer in the
761 *    documentation and/or other materials provided with the distribution.
762 *
763 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
764 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
765 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
766 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
767 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
768 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
769 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
770 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
771 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
772 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
773 * POSSIBILITY OF SUCH DAMAGE.
774 */
775
776The preceding notice is from src/cdf.c, src/cdf.h, and src/cdf_time.c in `file`.
777
778
779
780/*-
781 * Copyright (c) 2016 Christos Zoulas
782 * All rights reserved.
783 *
784 * Redistribution and use in source and binary forms, with or without
785 * modification, are permitted provided that the following conditions
786 * are met:
787 * 1. Redistributions of source code must retain the above copyright
788 *    notice, this list of conditions and the following disclaimer.
789 * 2. Redistributions in binary form must reproduce the above copyright
790 *    notice, this list of conditions and the following disclaimer in the
791 *    documentation and/or other materials provided with the distribution.
792 *
793 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
794 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
795 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
796 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
797 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
798 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
799 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
800 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
801 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
802 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
803 * POSSIBILITY OF SUCH DAMAGE.
804 */
805
806The preceding notice is from src/der.c and src/der.h in `file`.
807
808
809
810/*-
811 * Copyright (c) 2019 Christos Zoulas
812 * All rights reserved.
813 *
814 * Redistribution and use in source and binary forms, with or without
815 * modification, are permitted provided that the following conditions
816 * are met:
817 * 1. Redistributions of source code must retain the above copyright
818 *    notice, this list of conditions and the following disclaimer.
819 * 2. Redistributions in binary form must reproduce the above copyright
820 *    notice, this list of conditions and the following disclaimer in the
821 *    documentation and/or other materials provided with the distribution.
822 *
823 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
824 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
825 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
826 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
827 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
828 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
829 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
830 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
831 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
832 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
833 * POSSIBILITY OF SUCH DAMAGE.
834 */
835
836The preceding notice is from src/is_csv.c in `file`.
837
838
839
840/*-
841 * Copyright (c) 2018 Christos Zoulas
842 * All rights reserved.
843 *
844 * Redistribution and use in source and binary forms, with or without
845 * modification, are permitted provided that the following conditions
846 * are met:
847 * 1. Redistributions of source code must retain the above copyright
848 *    notice, this list of conditions and the following disclaimer.
849 * 2. Redistributions in binary form must reproduce the above copyright
850 *    notice, this list of conditions and the following disclaimer in the
851 *    documentation and/or other materials provided with the distribution.
852 *
853 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
854 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
855 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
856 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
857 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
858 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
859 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
860 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
861 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
862 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
863 * POSSIBILITY OF SUCH DAMAGE.
864 */
865
866The preceding notice is from src/is_json.c in `file`.
867
868
869
870/*-
871 * Copyright (c) 2023 Christos Zoulas
872 * All rights reserved.
873 *
874 * Redistribution and use in source and binary forms, with or without
875 * modification, are permitted provided that the following conditions
876 * are met:
877 * 1. Redistributions of source code must retain the above copyright
878 *    notice, this list of conditions and the following disclaimer.
879 * 2. Redistributions in binary form must reproduce the above copyright
880 *    notice, this list of conditions and the following disclaimer in the
881 *    documentation and/or other materials provided with the distribution.
882 *
883 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
884 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
885 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
886 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
887 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
888 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
889 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
890 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
891 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
892 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
893 * POSSIBILITY OF SUCH DAMAGE.
894 */
895
896The preceding notice is from src/is_simh.c in `file`.
897
898
899
900/*-
901 * SPDX-License-Identifier: BSD-3-Clause
902 *
903 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
904 * Copyright (c) 1992, 1993, 1994
905 *      The Regents of the University of California.  All rights reserved.
906 *
907 * This code is derived from software contributed to Berkeley by
908 * Henry Spencer.
909 *
910 * Redistribution and use in source and binary forms, with or without
911 * modification, are permitted provided that the following conditions
912 * are met:
913 * 1. Redistributions of source code must retain the above copyright
914 *    notice, this list of conditions and the following disclaimer.
915 * 2. Redistributions in binary form must reproduce the above copyright
916 *    notice, this list of conditions and the following disclaimer in the
917 *    documentation and/or other materials provided with the distribution.
918 * 3. Neither the name of the University nor the names of its contributors
919 *    may be used to endorse or promote products derived from this software
920 *    without specific prior written permission.
921 *
922 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
923 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
924 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
925 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
926 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
927 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
928 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
929 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
930 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
931 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
932 * SUCH DAMAGE.
933 *
934 *      @(#)cname.h     8.3 (Berkeley) 3/20/94
935 * $FreeBSD: head/lib/libc/regex/cname.h 326025 2017-11-20 19:49:47Z pfg $
936 */
937
938The preceding notice is from src/missing/cname.h in `file`.
939
940
941
942/*-
943 * SPDX-License-Identifier: BSD-3-Clause
944 *
945 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
946 * Copyright (c) 1992, 1993, 1994
947 *      The Regents of the University of California.  All rights reserved.
948 *
949 * This code is derived from software contributed to Berkeley by
950 * Henry Spencer.
951 *
952 * Redistribution and use in source and binary forms, with or without
953 * modification, are permitted provided that the following conditions
954 * are met:
955 * 1. Redistributions of source code must retain the above copyright
956 *    notice, this list of conditions and the following disclaimer.
957 * 2. Redistributions in binary form must reproduce the above copyright
958 *    notice, this list of conditions and the following disclaimer in the
959 *    documentation and/or other materials provided with the distribution.
960 * 3. Neither the name of the University nor the names of its contributors
961 *    may be used to endorse or promote products derived from this software
962 *    without specific prior written permission.
963 *
964 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
965 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
966 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
967 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
968 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
969 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
970 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
971 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
972 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
973 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
974 * SUCH DAMAGE.
975 *
976 *      @(#)engine.c    8.5 (Berkeley) 3/20/94
977 */
978
979The preceding notice is from src/missing/engine.c in `file`.
980
981
982
983/*-
984 * Copyright (c) 2000 The NetBSD Foundation, Inc.
985 * All rights reserved.
986 *
987 * This code was contributed to The NetBSD Foundation by Allen Briggs.
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 *
998 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
999 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1000 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1001 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1002 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1003 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1004 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1005 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1006 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1007 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1008 * POSSIBILITY OF SUCH DAMAGE.
1009 */
1010
1011The preceding notice is from src/missing/fmtcheck.c in `file`.
1012
1013
1014
1015/*-
1016 * Copyright (c) 2011 The NetBSD Foundation, Inc.
1017 * All rights reserved.
1018 *
1019 * This code is derived from software contributed to The NetBSD Foundation
1020 * by Christos Zoulas.
1021 *
1022 * Redistribution and use in source and binary forms, with or without
1023 * modification, are permitted provided that the following conditions
1024 * are met:
1025 * 1. Redistributions of source code must retain the above copyright
1026 *    notice, this list of conditions and the following disclaimer.
1027 * 2. Redistributions in binary form must reproduce the above copyright
1028 *    notice, this list of conditions and the following disclaimer in the
1029 *    documentation and/or other materials provided with the distribution.
1030 *
1031 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1032 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1033 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1034 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1035 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1036 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1037 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1038 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1039 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1040 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1041 * POSSIBILITY OF SUCH DAMAGE.
1042 */
1043
1044The preceding notice is from src/missing/getline.c in `file`.
1045
1046
1047
1048/*-
1049 * Copyright (c) 2000 The NetBSD Foundation, Inc.
1050 * All rights reserved.
1051 *
1052 * This code is derived from software contributed to The NetBSD Foundation
1053 * by Dieter Baron and Thomas Klausner.
1054 *
1055 * Redistribution and use in source and binary forms, with or without
1056 * modification, are permitted provided that the following conditions
1057 * are met:
1058 * 1. Redistributions of source code must retain the above copyright
1059 *    notice, this list of conditions and the following disclaimer.
1060 * 2. Redistributions in binary form must reproduce the above copyright
1061 *    notice, this list of conditions and the following disclaimer in the
1062 *    documentation and/or other materials provided with the distribution.
1063 *
1064 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1065 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1066 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1067 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1068 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1069 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1070 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1071 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1072 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1073 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1074 * POSSIBILITY OF SUCH DAMAGE.
1075 */
1076
1077The preceding notice is from src/missing/getopt_long.c and src/mygetopt.h in `file`.
1078
1079
1080
1081/*
1082 * Public domain fallback for reallocarray(3), for platforms (e.g.
1083 * AmigaOS/libnix) whose C library declares it but does not implement it.
1084 */
1085
1086The preceding notice is from src/missing/reallocarray.c in `file`.
1087
1088
1089
1090/*-
1091 * SPDX-License-Identifier: BSD-3-Clause
1092 *
1093 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1094 * Copyright (c) 1992, 1993, 1994
1095 *      The Regents of the University of California.  All rights reserved.
1096 *
1097 * Copyright (c) 2011 The FreeBSD Foundation
1098 * All rights reserved.
1099 * Portions of this software were developed by David Chisnall
1100 * under sponsorship from the FreeBSD Foundation.
1101 *
1102 * This code is derived from software contributed to Berkeley by
1103 * Henry Spencer.
1104 *
1105 * Redistribution and use in source and binary forms, with or without
1106 * modification, are permitted provided that the following conditions
1107 * are met:
1108 * 1. Redistributions of source code must retain the above copyright
1109 *    notice, this list of conditions and the following disclaimer.
1110 * 2. Redistributions in binary form must reproduce the above copyright
1111 *    notice, this list of conditions and the following disclaimer in the
1112 *    documentation and/or other materials provided with the distribution.
1113 * 3. Neither the name of the University nor the names of its contributors
1114 *    may be used to endorse or promote products derived from this software
1115 *    without specific prior written permission.
1116 *
1117 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1118 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1119 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1120 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1121 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1122 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1123 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1124 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1125 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1126 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1127 * SUCH DAMAGE.
1128 *
1129 *      @(#)regcomp.c   8.5 (Berkeley) 3/20/94
1130 */
1131
1132The preceding notice is from src/missing/regcomp.c in `file`.
1133
1134
1135
1136/*-
1137 * SPDX-License-Identifier: BSD-3-Clause
1138 *
1139 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1140 * Copyright (c) 1992, 1993, 1994
1141 *      The Regents of the University of California.  All rights reserved.
1142 *
1143 * This code is derived from software contributed to Berkeley by
1144 * Henry Spencer.
1145 *
1146 * Redistribution and use in source and binary forms, with or without
1147 * modification, are permitted provided that the following conditions
1148 * are met:
1149 * 1. Redistributions of source code must retain the above copyright
1150 *    notice, this list of conditions and the following disclaimer.
1151 * 2. Redistributions in binary form must reproduce the above copyright
1152 *    notice, this list of conditions and the following disclaimer in the
1153 *    documentation and/or other materials provided with the distribution.
1154 * 3. Neither the name of the University nor the names of its contributors
1155 *    may be used to endorse or promote products derived from this software
1156 *    without specific prior written permission.
1157 *
1158 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1159 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1160 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1161 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1162 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1163 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1164 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1165 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1166 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1167 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1168 * SUCH DAMAGE.
1169 *
1170 *      @(#)regerror.c  8.4 (Berkeley) 3/20/94
1171 */
1172
1173The preceding notice is from src/missing/regerror.c in `file`.
1174
1175
1176
1177$NetBSD: COPYRIGHT,v 1.5 2003/08/07 16:43:19 agc Exp $
1178
1179Copyright 1992, 1993, 1994 Henry Spencer.  All rights reserved.
1180This software is not subject to any license of the American Telephone
1181and Telegraph Company or of the Regents of the University of California.
1182
1183Permission is granted to anyone to use this software for any purpose on
1184any computer system, and to alter it and redistribute it, subject
1185to the following restrictions:
1186
11871. The author is not responsible for the consequences of use of this
1188   software, no matter how awful, even if they arise from flaws in it.
1189
11902. The origin of this software must not be misrepresented, either by
1191   explicit claim or by omission.  Since few users ever read sources,
1192   credits must appear in the documentation.
1193
11943. Altered versions must be plainly marked as such, and must not be
1195   misrepresented as being the original software.  Since few users
1196   ever read sources, credits must appear in the documentation.
1197
11984. This notice may not be removed or altered.
1199
1200=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1201/*-
1202 * Copyright (c) 1994
1203 *      The Regents of the University of California.  All rights reserved.
1204 *
1205 * Redistribution and use in source and binary forms, with or without
1206 * modification, are permitted provided that the following conditions
1207 * are met:
1208 * 1. Redistributions of source code must retain the above copyright
1209 *    notice, this list of conditions and the following disclaimer.
1210 * 2. Redistributions in binary form must reproduce the above copyright
1211 *    notice, this list of conditions and the following disclaimer in the
1212 *    documentation and/or other materials provided with the distribution.
1213 * 3. Neither the name of the University nor the names of its contributors
1214 *    may be used to endorse or promote products derived from this software
1215 *    without specific prior written permission.
1216 *
1217 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1218 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1219 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1220 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1221 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1222 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1223 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1224 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1225 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1226 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1227 * SUCH DAMAGE.
1228 *
1229 *      @(#)COPYRIGHT   8.1 (Berkeley) 3/16/94
1230 */
1231
1232The preceding notice is from src/missing/REGEX-COPYRIGHT in `file`.
1233
1234
1235
1236/*-
1237 * SPDX-License-Identifier: BSD-3-Clause
1238 *
1239 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1240 * Copyright (c) 1992, 1993, 1994
1241 *      The Regents of the University of California.  All rights reserved.
1242 *
1243 * This code is derived from software contributed to Berkeley by
1244 * Henry Spencer.
1245 *
1246 * Redistribution and use in source and binary forms, with or without
1247 * modification, are permitted provided that the following conditions
1248 * are met:
1249 * 1. Redistributions of source code must retain the above copyright
1250 *    notice, this list of conditions and the following disclaimer.
1251 * 2. Redistributions in binary form must reproduce the above copyright
1252 *    notice, this list of conditions and the following disclaimer in the
1253 *    documentation and/or other materials provided with the distribution.
1254 * 3. Neither the name of the University nor the names of its contributors
1255 *    may be used to endorse or promote products derived from this software
1256 *    without specific prior written permission.
1257 *
1258 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1259 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1260 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1261 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1262 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1263 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1264 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1265 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1266 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1267 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1268 * SUCH DAMAGE.
1269 *
1270 *      @(#)regex2.h    8.4 (Berkeley) 3/20/94
1271 * $FreeBSD: head/lib/libc/regex/regex2.h 368359 2020-12-05 03:18:48Z kevans $
1272 */
1273
1274The preceding notice is from src/missing/regex2.h in `file`.
1275
1276
1277
1278/*-
1279 * SPDX-License-Identifier: BSD-3-Clause
1280 *
1281 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1282 * Copyright (c) 1992, 1993, 1994
1283 *      The Regents of the University of California.  All rights reserved.
1284 *
1285 * This code is derived from software contributed to Berkeley by
1286 * Henry Spencer.
1287 *
1288 * Redistribution and use in source and binary forms, with or without
1289 * modification, are permitted provided that the following conditions
1290 * are met:
1291 * 1. Redistributions of source code must retain the above copyright
1292 *    notice, this list of conditions and the following disclaimer.
1293 * 2. Redistributions in binary form must reproduce the above copyright
1294 *    notice, this list of conditions and the following disclaimer in the
1295 *    documentation and/or other materials provided with the distribution.
1296 * 3. Neither the name of the University nor the names of its contributors
1297 *    may be used to endorse or promote products derived from this software
1298 *    without specific prior written permission.
1299 *
1300 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1301 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1302 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1303 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1304 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1305 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1306 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1307 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1308 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1309 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1310 * SUCH DAMAGE.
1311 *
1312 *      @(#)regexec.c   8.3 (Berkeley) 3/20/94
1313 */
1314
1315The preceding notice is from src/missing/regexec.c in `file`.
1316
1317
1318
1319/*-
1320 * SPDX-License-Identifier: BSD-3-Clause
1321 *
1322 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1323 * Copyright (c) 1992, 1993, 1994
1324 *      The Regents of the University of California.  All rights reserved.
1325 *
1326 * This code is derived from software contributed to Berkeley by
1327 * Henry Spencer.
1328 *
1329 * Redistribution and use in source and binary forms, with or without
1330 * modification, are permitted provided that the following conditions
1331 * are met:
1332 * 1. Redistributions of source code must retain the above copyright
1333 *    notice, this list of conditions and the following disclaimer.
1334 * 2. Redistributions in binary form must reproduce the above copyright
1335 *    notice, this list of conditions and the following disclaimer in the
1336 *    documentation and/or other materials provided with the distribution.
1337 * 3. Neither the name of the University nor the names of its contributors
1338 *    may be used to endorse or promote products derived from this software
1339 *    without specific prior written permission.
1340 *
1341 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1342 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1343 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1344 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1345 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1346 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1347 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1348 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1349 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1350 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1351 * SUCH DAMAGE.
1352 *
1353 *      @(#)regfree.c   8.3 (Berkeley) 3/20/94
1354 */
1355
1356The preceding notice is from src/missing/regfree.c in `file`.
1357
1358
1359
1360/*-
1361 * Copyright (c) 1990, 1993
1362 *      The Regents of the University of California.  All rights reserved.
1363 *
1364 * This code is derived from software contributed to Berkeley by
1365 * Chris Torek.
1366 *
1367 * Redistribution and use in source and binary forms, with or without
1368 * modification, are permitted provided that the following conditions
1369 * are met:
1370 * 1. Redistributions of source code must retain the above copyright
1371 *    notice, this list of conditions and the following disclaimer.
1372 * 2. Redistributions in binary form must reproduce the above copyright
1373 *    notice, this list of conditions and the following disclaimer in the
1374 *    documentation and/or other materials provided with the distribution.
1375 * 3. Neither the name of the University nor the names of its contributors
1376 *    may be used to endorse or promote products derived from this software
1377 *    without specific prior written permission.
1378 *
1379 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1380 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1381 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1382 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1383 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1384 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1385 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1386 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1387 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1388 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1389 * SUCH DAMAGE.
1390 */
1391
1392The preceding notice is from src/missing/strcasestr.c in `file`.
1393
1394
1395
1396/*
1397 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
1398 *
1399 * Permission to use, copy, modify, and distribute this software for any
1400 * purpose with or without fee is hereby granted, provided that the above
1401 * copyright notice and this permission notice appear in all copies.
1402 *
1403 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1404 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1405 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1406 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1407 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1408 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1409 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1410 */
1411
1412The preceding notice is from src/missing/strlcat.c and src/missing/strlcpy.c in `file`.
1413
1414
1415
1416/*-
1417 * SPDX-License-Identifier: BSD-3-Clause
1418 *
1419 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
1420 * Copyright (c) 1992, 1993, 1994
1421 *      The Regents of the University of California.  All rights reserved.
1422 *
1423 * This code is derived from software contributed to Berkeley by
1424 * Henry Spencer.
1425 *
1426 * Redistribution and use in source and binary forms, with or without
1427 * modification, are permitted provided that the following conditions
1428 * are met:
1429 * 1. Redistributions of source code must retain the above copyright
1430 *    notice, this list of conditions and the following disclaimer.
1431 * 2. Redistributions in binary form must reproduce the above copyright
1432 *    notice, this list of conditions and the following disclaimer in the
1433 *    documentation and/or other materials provided with the distribution.
1434 * 3. Neither the name of the University nor the names of its contributors
1435 *    may be used to endorse or promote products derived from this software
1436 *    without specific prior written permission.
1437 *
1438 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1439 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1440 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1441 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1442 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1443 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1444 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1445 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1446 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1447 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1448 * SUCH DAMAGE.
1449 *
1450 *      @(#)utils.h     8.3 (Berkeley) 3/20/94
1451 * $FreeBSD: head/lib/libc/regex/utils.h 341838 2018-12-12 04:23:00Z yuripv $
1452 */
1453
1454The preceding notice is from src/missing/utils.h in `file`.
1455
1456
1457
1458/*-
1459 * Copyright (c) 2008, 2016 Christos Zoulas
1460 * All rights reserved.
1461 *
1462 * Redistribution and use in source and binary forms, with or without
1463 * modification, are permitted provided that the following conditions
1464 * are met:
1465 * 1. Redistributions of source code must retain the above copyright
1466 *    notice, this list of conditions and the following disclaimer.
1467 * 2. Redistributions in binary form must reproduce the above copyright
1468 *    notice, this list of conditions and the following disclaimer in the
1469 *    documentation and/or other materials provided with the distribution.
1470 *
1471 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1472 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1473 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1474 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1475 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1476 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1477 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1478 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1479 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1480 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1481 * POSSIBILITY OF SUCH DAMAGE.
1482 */
1483
1484The preceding notice is from src/readcdf.c in `file`.
1485
1486
1487
1488/*-
1489 * Copyright (c) 1992 Henry Spencer.
1490 * Copyright (c) 1992, 1993
1491 *      The Regents of the University of California.  All rights reserved.
1492 *
1493 * This code is derived from software contributed to Berkeley by
1494 * Henry Spencer of the University of Toronto.
1495 *
1496 * Redistribution and use in source and binary forms, with or without
1497 * modification, are permitted provided that the following conditions
1498 * are met:
1499 * 1. Redistributions of source code must retain the above copyright
1500 *    notice, this list of conditions and the following disclaimer.
1501 * 2. Redistributions in binary form must reproduce the above copyright
1502 *    notice, this list of conditions and the following disclaimer in the
1503 *    documentation and/or other materials provided with the distribution.
1504 * 3. Neither the name of the University nor the names of its contributors
1505 *    may be used to endorse or promote products derived from this software
1506 *    without specific prior written permission.
1507 *
1508 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1509 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1510 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1511 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1512 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1513 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1514 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1515 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1516 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1517 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1518 * SUCH DAMAGE.
1519 *
1520 *      @(#)regex.h     8.2 (Berkeley) 1/3/94
1521 * $FreeBSD: src/include/regex.h,v 1.12 2010/02/16 19:39:50 imp Exp $
1522 */
1523
1524The preceding notice is from src/regex-bsd.h in `file`.
1525*/
1526/*
1527
1528Text of LICENSE from DROID:
1529
1530Copyright (c) 2016, The National Archives <pronom@nationalarchives.gov.uk>
1531All rights reserved.
1532
1533Redistribution and use in source and binary forms, with or without
1534modification, are permitted provided that the following
1535conditions are met:
1536
1537 * Redistributions of source code must retain the above copyright
1538   notice, this list of conditions and the following disclaimer.
1539
1540 * Redistributions in binary form must reproduce the above copyright
1541   notice, this list of conditions and the following disclaimer in the
1542   documentation and/or other materials provided with the distribution.
1543
1544 * Neither the name of the The National Archives nor the
1545   names of its contributors may be used to endorse or promote products
1546   derived from this software without specific prior written permission.
1547
1548THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1549AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1550IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1551PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
1552CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1553EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1554PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1555PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1556LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1557NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1558SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1559*/
1560
1561/*
1562
1563Text of LICENSE from fileid:
1564
1565The MIT License (MIT)
1566
1567Copyright (c) 2015 David B Heise
1568
1569Permission is hereby granted, free of charge, to any person obtaining a copy of
1570this software and associated documentation files (the "Software"), to deal in
1571the Software without restriction, including without limitation the rights to
1572use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1573the Software, and to permit persons to whom the Software is furnished to do so,
1574subject to the following conditions:
1575
1576The above copyright notice and this permission notice shall be included in all
1577copies or substantial portions of the Software.
1578
1579THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1580IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1581FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1582COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1583IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1584CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1585
1586
1587*/
1588
1589/*
1590Text of LICENSE from binwalk:
1591
1592
1593MIT License
1594
1595Copyright (c) 2024 devttys0
1596
1597Permission is hereby granted, free of charge, to any person obtaining a copy
1598of this software and associated documentation files (the "Software"), to deal
1599in the Software without restriction, including without limitation the rights
1600to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1601copies of the Software, and to permit persons to whom the Software is
1602furnished to do so, subject to the following conditions:
1603
1604The above copyright notice and this permission notice shall be included in all
1605copies or substantial portions of the Software.
1606
1607THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1608IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1609FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1610AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1611LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1612OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1613SOFTWARE.
1614
1615*/
1616
1617/*
1618Text of LICENSE from polyfile:
1619
1620
1621                                 Apache License
1622                           Version 2.0, January 2004
1623                        http://www.apache.org/licenses/
1624
1625   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1626
1627   1. Definitions.
1628
1629      "License" shall mean the terms and conditions for use, reproduction,
1630      and distribution as defined by Sections 1 through 9 of this document.
1631
1632      "Licensor" shall mean the copyright owner or entity authorized by
1633      the copyright owner that is granting the License.
1634
1635      "Legal Entity" shall mean the union of the acting entity and all
1636      other entities that control, are controlled by, or are under common
1637      control with that entity. For the purposes of this definition,
1638      "control" means (i) the power, direct or indirect, to cause the
1639      direction or management of such entity, whether by contract or
1640      otherwise, or (ii) ownership of fifty percent (50%) or more of the
1641      outstanding shares, or (iii) beneficial ownership of such entity.
1642
1643      "You" (or "Your") shall mean an individual or Legal Entity
1644      exercising permissions granted by this License.
1645
1646      "Source" form shall mean the preferred form for making modifications,
1647      including but not limited to software source code, documentation
1648      source, and configuration files.
1649
1650      "Object" form shall mean any form resulting from mechanical
1651      transformation or translation of a Source form, including but
1652      not limited to compiled object code, generated documentation,
1653      and conversions to other media types.
1654
1655      "Work" shall mean the work of authorship, whether in Source or
1656      Object form, made available under the License, as indicated by a
1657      copyright notice that is included in or attached to the work
1658      (an example is provided in the Appendix below).
1659
1660      "Derivative Works" shall mean any work, whether in Source or Object
1661      form, that is based on (or derived from) the Work and for which the
1662      editorial revisions, annotations, elaborations, or other modifications
1663      represent, as a whole, an original work of authorship. For the purposes
1664      of this License, Derivative Works shall not include works that remain
1665      separable from, or merely link (or bind by name) to the interfaces of,
1666      the Work and Derivative Works thereof.
1667
1668      "Contribution" shall mean any work of authorship, including
1669      the original version of the Work and any modifications or additions
1670      to that Work or Derivative Works thereof, that is intentionally
1671      submitted to Licensor for inclusion in the Work by the copyright owner
1672      or by an individual or Legal Entity authorized to submit on behalf of
1673      the copyright owner. For the purposes of this definition, "submitted"
1674      means any form of electronic, verbal, or written communication sent
1675      to the Licensor or its representatives, including but not limited to
1676      communication on electronic mailing lists, source code control systems,
1677      and issue tracking systems that are managed by, or on behalf of, the
1678      Licensor for the purpose of discussing and improving the Work, but
1679      excluding communication that is conspicuously marked or otherwise
1680      designated in writing by the copyright owner as "Not a Contribution."
1681
1682      "Contributor" shall mean Licensor and any individual or Legal Entity
1683      on behalf of whom a Contribution has been received by Licensor and
1684      subsequently incorporated within the Work.
1685
1686   2. Grant of Copyright License. Subject to the terms and conditions of
1687      this License, each Contributor hereby grants to You a perpetual,
1688      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1689      copyright license to reproduce, prepare Derivative Works of,
1690      publicly display, publicly perform, sublicense, and distribute the
1691      Work and such Derivative Works in Source or Object form.
1692
1693   3. Grant of Patent License. Subject to the terms and conditions of
1694      this License, each Contributor hereby grants to You a perpetual,
1695      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1696      (except as stated in this section) patent license to make, have made,
1697      use, offer to sell, sell, import, and otherwise transfer the Work,
1698      where such license applies only to those patent claims licensable
1699      by such Contributor that are necessarily infringed by their
1700      Contribution(s) alone or by combination of their Contribution(s)
1701      with the Work to which such Contribution(s) was submitted. If You
1702      institute patent litigation against any entity (including a
1703      cross-claim or counterclaim in a lawsuit) alleging that the Work
1704      or a Contribution incorporated within the Work constitutes direct
1705      or contributory patent infringement, then any patent licenses
1706      granted to You under this License for that Work shall terminate
1707      as of the date such litigation is filed.
1708
1709   4. Redistribution. You may reproduce and distribute copies of the
1710      Work or Derivative Works thereof in any medium, with or without
1711      modifications, and in Source or Object form, provided that You
1712      meet the following conditions:
1713
1714      (a) You must give any other recipients of the Work or
1715          Derivative Works a copy of this License; and
1716
1717      (b) You must cause any modified files to carry prominent notices
1718          stating that You changed the files; and
1719
1720      (c) You must retain, in the Source form of any Derivative Works
1721          that You distribute, all copyright, patent, trademark, and
1722          attribution notices from the Source form of the Work,
1723          excluding those notices that do not pertain to any part of
1724          the Derivative Works; and
1725
1726      (d) If the Work includes a "NOTICE" text file as part of its
1727          distribution, then any Derivative Works that You distribute must
1728          include a readable copy of the attribution notices contained
1729          within such NOTICE file, excluding those notices that do not
1730          pertain to any part of the Derivative Works, in at least one
1731          of the following places: within a NOTICE text file distributed
1732          as part of the Derivative Works; within the Source form or
1733          documentation, if provided along with the Derivative Works; or,
1734          within a display generated by the Derivative Works, if and
1735          wherever such third-party notices normally appear. The contents
1736          of the NOTICE file are for informational purposes only and
1737          do not modify the License. You may add Your own attribution
1738          notices within Derivative Works that You distribute, alongside
1739          or as an addendum to the NOTICE text from the Work, provided
1740          that such additional attribution notices cannot be construed
1741          as modifying the License.
1742
1743      You may add Your own copyright statement to Your modifications and
1744      may provide additional or different license terms and conditions
1745      for use, reproduction, or distribution of Your modifications, or
1746      for any such Derivative Works as a whole, provided Your use,
1747      reproduction, and distribution of the Work otherwise complies with
1748      the conditions stated in this License.
1749
1750   5. Submission of Contributions. Unless You explicitly state otherwise,
1751      any Contribution intentionally submitted for inclusion in the Work
1752      by You to the Licensor shall be under the terms and conditions of
1753      this License, without any additional terms or conditions.
1754      Notwithstanding the above, nothing herein shall supersede or modify
1755      the terms of any separate license agreement you may have executed
1756      with Licensor regarding such Contributions.
1757
1758   6. Trademarks. This License does not grant permission to use the trade
1759      names, trademarks, service marks, or product names of the Licensor,
1760      except as required for reasonable and customary use in describing the
1761      origin of the Work and reproducing the content of the NOTICE file.
1762
1763   7. Disclaimer of Warranty. Unless required by applicable law or
1764      agreed to in writing, Licensor provides the Work (and each
1765      Contributor provides its Contributions) on an "AS IS" BASIS,
1766      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1767      implied, including, without limitation, any warranties or conditions
1768      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1769      PARTICULAR PURPOSE. You are solely responsible for determining the
1770      appropriateness of using or redistributing the Work and assume any
1771      risks associated with Your exercise of permissions under this License.
1772
1773   8. Limitation of Liability. In no event and under no legal theory,
1774      whether in tort (including negligence), contract, or otherwise,
1775      unless required by applicable law (such as deliberate and grossly
1776      negligent acts) or agreed to in writing, shall any Contributor be
1777      liable to You for damages, including any direct, indirect, special,
1778      incidental, or consequential damages of any character arising as a
1779      result of this License or out of the use or inability to use the
1780      Work (including but not limited to damages for loss of goodwill,
1781      work stoppage, computer failure or malfunction, or any and all
1782      other commercial damages or losses), even if such Contributor
1783      has been advised of the possibility of such damages.
1784
1785   9. Accepting Warranty or Additional Liability. While redistributing
1786      the Work or Derivative Works thereof, You may choose to offer,
1787      and charge a fee for, acceptance of support, warranty, indemnity,
1788      or other liability obligations and/or rights consistent with this
1789      License. However, in accepting such obligations, You may act only
1790      on Your own behalf and on Your sole responsibility, not on behalf
1791      of any other Contributor, and only if You agree to indemnify,
1792      defend, and hold each Contributor harmless for any liability
1793      incurred by, or claims asserted against, such Contributor by reason
1794      of your accepting any such warranty or additional liability.
1795
1796   END OF TERMS AND CONDITIONS
1797
1798   APPENDIX: How to apply the Apache License to your work.
1799
1800      To apply the Apache License to your work, attach the following
1801      boilerplate notice, with the fields enclosed by brackets "[]"
1802      replaced with your own identifying information. (Don't include
1803      the brackets!)  The text should be enclosed in the appropriate
1804      comment syntax for the file format. We also recommend that a
1805      file or class name and description of purpose be included on the
1806      same "printed page" as the copyright notice for easier
1807      identification within third-party archives.
1808
1809   Copyright [yyyy] [name of copyright owner]
1810
1811   Licensed under the Apache License, Version 2.0 (the "License");
1812   you may not use this file except in compliance with the License.
1813   You may obtain a copy of the License at
1814
1815       http://www.apache.org/licenses/LICENSE-2.0
1816
1817   Unless required by applicable law or agreed to in writing, software
1818   distributed under the License is distributed on an "AS IS" BASIS,
1819   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1820   See the License for the specific language governing permissions and
1821   limitations under the License.
1822
1823*/