Home | History | Annotate | Line # | Download | only in cpio
cpio.h revision 1.1.1.4
      1      1.1  joerg /*-
      2      1.1  joerg  * Copyright (c) 2003-2007 Tim Kientzle
      3      1.1  joerg  * All rights reserved.
      4      1.1  joerg  *
      5      1.1  joerg  * Redistribution and use in source and binary forms, with or without
      6      1.1  joerg  * modification, are permitted provided that the following conditions
      7      1.1  joerg  * are met:
      8      1.1  joerg  * 1. Redistributions of source code must retain the above copyright
      9      1.1  joerg  *    notice, this list of conditions and the following disclaimer.
     10      1.1  joerg  * 2. Redistributions in binary form must reproduce the above copyright
     11      1.1  joerg  *    notice, this list of conditions and the following disclaimer in the
     12      1.1  joerg  *    documentation and/or other materials provided with the distribution.
     13      1.1  joerg  *
     14      1.1  joerg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
     15      1.1  joerg  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     16      1.1  joerg  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     17      1.1  joerg  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
     18      1.1  joerg  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     19      1.1  joerg  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     20      1.1  joerg  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     21      1.1  joerg  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     22      1.1  joerg  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     23      1.1  joerg  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24      1.1  joerg  *
     25  1.1.1.2  joerg  * $FreeBSD: src/usr.bin/cpio/cpio.h,v 1.7 2008/12/06 07:30:40 kientzle Exp $
     26      1.1  joerg  */
     27      1.1  joerg 
     28      1.1  joerg #ifndef CPIO_H_INCLUDED
     29      1.1  joerg #define CPIO_H_INCLUDED
     30      1.1  joerg 
     31      1.1  joerg #include "cpio_platform.h"
     32      1.1  joerg #include <stdio.h>
     33      1.1  joerg 
     34      1.1  joerg /*
     35      1.1  joerg  * The internal state for the "cpio" program.
     36      1.1  joerg  *
     37      1.1  joerg  * Keeping all of the state in a structure like this simplifies memory
     38      1.1  joerg  * leak testing (at exit, anything left on the heap is suspect).  A
     39      1.1  joerg  * pointer to this structure is passed to most cpio internal
     40      1.1  joerg  * functions.
     41      1.1  joerg  */
     42      1.1  joerg struct cpio {
     43  1.1.1.2  joerg 	/* Option parsing */
     44  1.1.1.3  joerg 	const char	 *argument;
     45  1.1.1.2  joerg 
     46      1.1  joerg 	/* Options */
     47  1.1.1.3  joerg 	int		  add_filter; /* --uuencode */
     48  1.1.1.2  joerg 	const char	 *filename;
     49  1.1.1.3  joerg 	int		  mode; /* -i -o -p */
     50  1.1.1.3  joerg 	int		  compress; /* -j, -y, or -z */
     51      1.1  joerg 	const char	 *format; /* -H format */
     52      1.1  joerg 	int		  bytes_per_block; /* -b block_size */
     53      1.1  joerg 	int		  verbose;   /* -v */
     54  1.1.1.3  joerg 	int		  dot;  /* -V */
     55      1.1  joerg 	int		  quiet;   /* --quiet */
     56      1.1  joerg 	int		  extract_flags; /* Flags for extract operation */
     57      1.1  joerg 	const char	 *compress_program;
     58      1.1  joerg 	int		  option_append; /* -A, only relevant for -o */
     59      1.1  joerg 	int		  option_atime_restore; /* -a */
     60      1.1  joerg 	int		  option_follow_links; /* -L */
     61      1.1  joerg 	int		  option_link; /* -l */
     62      1.1  joerg 	int		  option_list; /* -t */
     63  1.1.1.2  joerg 	char		  option_null; /* --null */
     64  1.1.1.2  joerg 	int		  option_numeric_uid_gid; /* -n */
     65      1.1  joerg 	int		  option_rename; /* -r */
     66      1.1  joerg 	char		 *destdir;
     67      1.1  joerg 	size_t		  pass_destpath_alloc;
     68      1.1  joerg 	char		 *pass_destpath;
     69      1.1  joerg 	int		  uid_override;
     70  1.1.1.3  joerg 	char		 *uname_override;
     71      1.1  joerg 	int		  gid_override;
     72  1.1.1.3  joerg 	char		 *gname_override;
     73  1.1.1.2  joerg 	int		  day_first; /* true if locale prefers day/mon */
     74  1.1.1.3  joerg 	const char	 *passphrase;
     75      1.1  joerg 
     76      1.1  joerg 	/* If >= 0, then close this when done. */
     77      1.1  joerg 	int		  fd;
     78      1.1  joerg 
     79      1.1  joerg 	/* Miscellaneous state information */
     80      1.1  joerg 	struct archive	 *archive;
     81  1.1.1.2  joerg 	struct archive	 *archive_read_disk;
     82      1.1  joerg 	int		  argc;
     83      1.1  joerg 	char		**argv;
     84      1.1  joerg 	int		  return_value; /* Value returned by main() */
     85      1.1  joerg 	struct archive_entry_linkresolver *linkresolver;
     86      1.1  joerg 
     87  1.1.1.2  joerg 	struct name_cache *uname_cache;
     88  1.1.1.2  joerg 	struct name_cache *gname_cache;
     89  1.1.1.2  joerg 
     90      1.1  joerg 	/* Work data. */
     91  1.1.1.3  joerg 	struct archive   *matching;
     92      1.1  joerg 	char		 *buff;
     93      1.1  joerg 	size_t		  buff_size;
     94  1.1.1.3  joerg 	char		 *ppbuff;
     95      1.1  joerg };
     96      1.1  joerg 
     97  1.1.1.2  joerg const char *owner_parse(const char *, int *, int *);
     98      1.1  joerg 
     99      1.1  joerg 
    100      1.1  joerg /* Fake short equivalents for long options that otherwise lack them. */
    101      1.1  joerg enum {
    102  1.1.1.3  joerg 	OPTION_B64ENCODE = 1,
    103  1.1.1.3  joerg 	OPTION_GRZIP,
    104  1.1.1.3  joerg 	OPTION_INSECURE,
    105  1.1.1.3  joerg 	OPTION_LRZIP,
    106  1.1.1.3  joerg 	OPTION_LZ4,
    107  1.1.1.2  joerg 	OPTION_LZMA,
    108  1.1.1.3  joerg 	OPTION_LZOP,
    109  1.1.1.3  joerg 	OPTION_PASSPHRASE,
    110  1.1.1.2  joerg 	OPTION_NO_PRESERVE_OWNER,
    111  1.1.1.2  joerg 	OPTION_PRESERVE_OWNER,
    112      1.1  joerg 	OPTION_QUIET,
    113  1.1.1.3  joerg 	OPTION_UUENCODE,
    114  1.1.1.4  joerg 	OPTION_VERSION,
    115  1.1.1.4  joerg 	OPTION_ZSTD,
    116      1.1  joerg };
    117      1.1  joerg 
    118      1.1  joerg int	cpio_getopt(struct cpio *cpio);
    119      1.1  joerg 
    120      1.1  joerg #endif
    121