5 kx /* global.c - global variables and initial values for cpio.
5 kx Copyright (C) 1990-1992, 2001, 2006-2007, 2009-2010, 2014-2015, 2017
5 kx Free Software Foundation, Inc.
5 kx
5 kx This program is free software; you can redistribute it and/or modify
5 kx it under the terms of the GNU General Public License as published by
5 kx the Free Software Foundation; either version 3, or (at your option)
5 kx any later version.
5 kx
5 kx This program is distributed in the hope that it will be useful,
5 kx but WITHOUT ANY WARRANTY; without even the implied warranty of
5 kx MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 kx GNU General Public License for more details.
5 kx
5 kx You should have received a copy of the GNU General Public
5 kx License along with this program; if not, write to the Free
5 kx Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
5 kx Boston, MA 02110-1301 USA. */
5 kx
5 kx #include <system.h>
5 kx
5 kx #include <sys/types.h>
5 kx #include "cpiohdr.h"
5 kx #include "dstring.h"
5 kx #include "extern.h"
5 kx
5 kx /* If true, reset access times after reading files (-a). */
5 kx int reset_time_flag = false;
5 kx
5 kx /* Block size value, initially 512. -B sets to 5120. */
5 kx int io_block_size = 512;
5 kx
5 kx /* The header format to recognize and produce. */
5 kx enum archive_format archive_format = arf_unknown;
5 kx
5 kx /* If true, create directories as needed. (-d with -i or -p) */
5 kx int create_dir_flag = false;
5 kx
5 kx /* If true, interactively rename files. (-r) */
5 kx int rename_flag = false;
5 kx
5 kx /* If non-NULL, the name of a file that will be read to
5 kx rename all of the files in the archive. --rename-batch-file. */
5 kx char *rename_batch_file = NULL;
5 kx
5 kx /* If true, print a table of contents of input. (-t) */
5 kx int table_flag = false;
5 kx
5 kx /* If true, copy unconditionally (older replaces newer). (-u) */
5 kx int unconditional_flag = false;
5 kx
5 kx /* If true, list the files processed, or ls -l style output with -t. (-v) */
5 kx int verbose_flag = false;
5 kx
5 kx /* If true, print a . for each file processed. (-V) */
5 kx int dot_flag = false;
5 kx
5 kx /* If true, link files whenever possible. Used with -p option. (-l) */
5 kx int link_flag = false;
5 kx
5 kx /* If true, retain previous file modification time. (-m) */
5 kx int retain_time_flag = false;
5 kx
5 kx /* Set true if crc_flag is true and we are doing a cpio -i. Used
5 kx by copy_files so it knows whether to compute the crc. */
5 kx int crc_i_flag = false;
5 kx
5 kx /* If true, append to end of archive. (-A) */
5 kx int append_flag = false;
5 kx
5 kx /* If true, swap bytes of each file during cpio -i. */
5 kx int swap_bytes_flag = false;
5 kx
5 kx /* If true, swap halfwords of each file during cpio -i. */
5 kx int swap_halfwords_flag = false;
5 kx
5 kx /* If true, we are swapping halfwords on the current file. */
5 kx int swapping_halfwords = false;
5 kx
5 kx /* If true, we are swapping bytes on the current file. */
5 kx int swapping_bytes = false;
5 kx
5 kx /* Umask for creating new directories */
5 kx mode_t newdir_umask;
5 kx
5 kx /* If true, set ownership of all files to UID `set_owner'. */
5 kx int set_owner_flag = false;
5 kx uid_t set_owner;
5 kx
5 kx /* If true, set group ownership of all files to GID `set_group'. */
5 kx int set_group_flag = false;
5 kx gid_t set_group;
5 kx
5 kx /* If true, do not chown the files. */
5 kx int no_chown_flag = false;
5 kx
5 kx /* If true, try to write sparse ("holey") files. */
5 kx int sparse_flag = false;
5 kx
5 kx /* If true, don't report number of blocks copied. */
5 kx int quiet_flag = false;
5 kx
5 kx /* If true, only read the archive and verify the files' CRC's, don't
5 kx actually extract the files. */
5 kx int only_verify_crc_flag = false;
5 kx
5 kx /* If true, don't use any absolute paths, prefix them by `./'. */
5 kx int no_abs_paths_flag = false;
5 kx
5 kx #ifdef DEBUG_CPIO
5 kx /* If true, print debugging information. */
5 kx int debug_flag = false;
5 kx #endif
5 kx
5 kx /* File position of last header read. Only used during -A to determine
5 kx where the old TRAILER!!! record started. */
5 kx int last_header_start = 0;
5 kx
5 kx /* With -i; if true, copy only files that match any of the given patterns;
5 kx if false, copy only files that do not match any of the patterns. (-f) */
5 kx int copy_matching_files = true;
5 kx
5 kx /* With -itv; if true, list numeric uid and gid instead of translating them
5 kx into names. */
5 kx int numeric_uid = false;
5 kx
5 kx /* Name of file containing additional patterns (-E). */
5 kx char *pattern_file_name = NULL;
5 kx
5 kx /* Message to print when end of medium is reached (-M). */
5 kx char *new_media_message = NULL;
5 kx
5 kx /* With -M with %d, message to print when end of medium is reached. */
5 kx char *new_media_message_with_number = NULL;
5 kx char *new_media_message_after_number = NULL;
5 kx
5 kx /* File descriptor containing the archive. */
5 kx int archive_des;
5 kx
5 kx /* Name of file containing the archive, if known; NULL if stdin/out. */
5 kx char *archive_name = NULL;
5 kx
5 kx /* Name of the remote shell command, if known; NULL otherwise. */
5 kx char *rsh_command_option = NULL;
5 kx
5 kx /* CRC checksum. */
5 kx uint32_t crc;
5 kx
5 kx /* Input and output buffers. */
5 kx char *input_buffer, *output_buffer;
5 kx
5 kx /* The size of the input buffer. */
5 kx size_t input_buffer_size;
5 kx
5 kx /* Current locations in `input_buffer' and `output_buffer'. */
5 kx char *in_buff, *out_buff;
5 kx
5 kx /* Current number of bytes stored at `input_buff' and `output_buff'. */
5 kx size_t input_size, output_size;
5 kx
5 kx off_t input_bytes, output_bytes;
5 kx
5 kx /* Saving of argument values for later reference. */
5 kx char *directory_name = NULL;
5 kx char **save_patterns;
5 kx int num_patterns;
5 kx
5 kx /* Character that terminates file names read from stdin. */
5 kx char name_end = '\n';
5 kx
5 kx /* true if input (cpio -i) or output (cpio -o) is a device node. */
5 kx char input_is_special = false;
5 kx char output_is_special = false;
5 kx
5 kx /* true if lseek works on the input. */
5 kx char input_is_seekable = false;
5 kx
5 kx /* true if lseek works on the output. */
5 kx char output_is_seekable = false;
5 kx
5 kx /* Print extra warning messages */
5 kx unsigned int warn_option = 0;
5 kx
5 kx /* Extract to standard output? */
5 kx bool to_stdout_option = false;
5 kx
5 kx /* The name this program was run with. */
5 kx extern const char *program_name;
5 kx
5 kx /* A pointer to either lstat or stat, depending on whether
5 kx dereferencing of symlinks is done for input files. */
5 kx int (*xstat) ();
5 kx
5 kx /* Which copy operation to perform. (-i, -o, -p) */
5 kx void (*copy_function) () = 0;
5 kx
5 kx char *change_directory_option;
5 kx
5 kx int renumber_inodes_option;
5 kx int ignore_devno_option;
5 kx