xref: /dflybsd-src/contrib/libarchive/cat/bsdcat.h (revision 6b384f3989c11f4c0078ee986d3d85a2da3bf92a)
1*6b384f39SPeter Avalos /*-
2*6b384f39SPeter Avalos  * Copyright (c) 2014, Mike Kazantsev
3*6b384f39SPeter Avalos  * All rights reserved.
4*6b384f39SPeter Avalos  *
5*6b384f39SPeter Avalos  * Redistribution and use in source and binary forms, with or without
6*6b384f39SPeter Avalos  * modification, are permitted provided that the following conditions
7*6b384f39SPeter Avalos  * are met:
8*6b384f39SPeter Avalos  * 1. Redistributions of source code must retain the above copyright
9*6b384f39SPeter Avalos  *    notice, this list of conditions and the following disclaimer.
10*6b384f39SPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
11*6b384f39SPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
12*6b384f39SPeter Avalos  *    documentation and/or other materials provided with the distribution.
13*6b384f39SPeter Avalos  *
14*6b384f39SPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15*6b384f39SPeter Avalos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16*6b384f39SPeter Avalos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17*6b384f39SPeter Avalos  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18*6b384f39SPeter Avalos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19*6b384f39SPeter Avalos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20*6b384f39SPeter Avalos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21*6b384f39SPeter Avalos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22*6b384f39SPeter Avalos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23*6b384f39SPeter Avalos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24*6b384f39SPeter Avalos  */
25*6b384f39SPeter Avalos 
26*6b384f39SPeter Avalos #if defined(PLATFORM_CONFIG_H)
27*6b384f39SPeter Avalos /* Use hand-built config.h in environments that need it. */
28*6b384f39SPeter Avalos #include PLATFORM_CONFIG_H
29*6b384f39SPeter Avalos #else
30*6b384f39SPeter Avalos /* Not having a config.h of some sort is a serious problem. */
31*6b384f39SPeter Avalos #include "config.h"
32*6b384f39SPeter Avalos #endif
33*6b384f39SPeter Avalos 
34*6b384f39SPeter Avalos #include <archive.h>
35*6b384f39SPeter Avalos #include <archive_entry.h>
36*6b384f39SPeter Avalos 
37*6b384f39SPeter Avalos struct bsdcat {
38*6b384f39SPeter Avalos 	/* Option parser state */
39*6b384f39SPeter Avalos 	int		  getopt_state;
40*6b384f39SPeter Avalos 	char		 *getopt_word;
41*6b384f39SPeter Avalos 
42*6b384f39SPeter Avalos 	/* Miscellaneous state information */
43*6b384f39SPeter Avalos 	int		  argc;
44*6b384f39SPeter Avalos 	char		**argv;
45*6b384f39SPeter Avalos 	const char	 *argument;
46*6b384f39SPeter Avalos };
47*6b384f39SPeter Avalos 
48*6b384f39SPeter Avalos enum {
49*6b384f39SPeter Avalos 	OPTION_VERSION
50*6b384f39SPeter Avalos };
51*6b384f39SPeter Avalos 
52*6b384f39SPeter Avalos int bsdcat_getopt(struct bsdcat *);
53*6b384f39SPeter Avalos void usage(FILE *stream, int eval);
54*6b384f39SPeter Avalos void bsdcat_next(void);
55*6b384f39SPeter Avalos void bsdcat_print_error(void);
56*6b384f39SPeter Avalos void bsdcat_read_to_stdout(char* filename);
57