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