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