⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.h

📁 gnu tar 源码包。 tar 软件是 Unix 系统下的一个打包软件
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Common declarations for the tar program.   Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.   This program is free software; you can redistribute it and/or modify it   under the terms of the GNU General Public License as published by the   Free Software Foundation; either version 3, or (at your option) any later   version.   This program is distributed in the hope that it will be useful, but   WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General   Public License for more details.   You should have received a copy of the GNU General Public License along   with this program; if not, write to the Free Software Foundation, Inc.,   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  *//* Declare the GNU tar archive format.  */#include "tar.h"/* The checksum field is filled with this while the checksum is computed.  */#define CHKBLANKS	"        "	/* 8 blanks, no null *//* Some constants from POSIX are given names.  */#define NAME_FIELD_SIZE   100#define PREFIX_FIELD_SIZE 155#define UNAME_FIELD_SIZE   32#define GNAME_FIELD_SIZE   32/* Some various global definitions.  *//* Name of file to use for interacting with user.  *//* GLOBAL is defined to empty in tar.c only, and left alone in other *.c   modules.  Here, we merely set it to "extern" if it is not already set.   GNU tar does depend on the system loader to preset all GLOBAL variables to   neutral (or zero) values, explicit initialization is usually not done.  */#ifndef GLOBAL# define GLOBAL extern#endif#define TAREXIT_SUCCESS PAXEXIT_SUCCESS#define TAREXIT_DIFFERS PAXEXIT_DIFFERS#define TAREXIT_FAILURE PAXEXIT_FAILURE#include "arith.h"#include <backupfile.h>#include <exclude.h>#include <full-write.h>#include <modechange.h>#include <quote.h>#include <safe-read.h>#include <stat-time.h>#include <timespec.h>#define obstack_chunk_alloc xmalloc#define obstack_chunk_free free#include <obstack.h>#include <paxlib.h>/* Log base 2 of common values.  */#define LG_8 3#define LG_64 6#define LG_256 8/* Information gleaned from the command line.  *//* Name of this program.  */GLOBAL const char *program_name;/* Main command option.  */enum subcommand{  UNKNOWN_SUBCOMMAND,		/* none of the following */  APPEND_SUBCOMMAND,		/* -r */  CAT_SUBCOMMAND,		/* -A */  CREATE_SUBCOMMAND,		/* -c */  DELETE_SUBCOMMAND,		/* -D */  DIFF_SUBCOMMAND,		/* -d */  EXTRACT_SUBCOMMAND,		/* -x */  LIST_SUBCOMMAND,		/* -t */  UPDATE_SUBCOMMAND		/* -u */};GLOBAL enum subcommand subcommand_option;/* Selected format for output archive.  */GLOBAL enum archive_format archive_format;/* Either NL or NUL, as decided by the --null option.  */GLOBAL char filename_terminator;/* Size of each record, once in blocks, once in bytes.  Those two variables   are always related, the second being BLOCKSIZE times the first.  They do   not have _option in their name, even if their values is derived from   option decoding, as these are especially important in tar.  */GLOBAL int blocking_factor;GLOBAL size_t record_size;GLOBAL bool absolute_names_option;/* Display file times in UTC */GLOBAL bool utc_option;/* This variable tells how to interpret newer_mtime_option, below.  If zero,   files get archived if their mtime is not less than newer_mtime_option.   If nonzero, files get archived if *either* their ctime or mtime is not less   than newer_mtime_option.  */GLOBAL int after_date_option;enum atime_preserve{  no_atime_preserve,  replace_atime_preserve,  system_atime_preserve};GLOBAL enum atime_preserve atime_preserve_option;GLOBAL bool backup_option;/* Type of backups being made.  */GLOBAL enum backup_type backup_type;GLOBAL bool block_number_option;GLOBAL unsigned checkpoint_option;#define DEFAULT_CHECKPOINT 10/* Specified name of compression program, or "gzip" as implied by -z.  */GLOBAL const char *use_compress_program_option;GLOBAL bool dereference_option;GLOBAL bool hard_dereference_option;/* Print a message if not all links are dumped */GLOBAL int check_links_option;/* Patterns that match file names to be excluded.  */GLOBAL struct exclude *excluded;enum exclusion_tag_type  {    exclusion_tag_none,     /* Exclude the directory contents, but preserve the directory	itself and the exclusion tag file */    exclusion_tag_contents,    /* Exclude everything below the directory, preserving the directory       itself */    exclusion_tag_under,    /* Exclude entire directory  */    exclusion_tag_all,  };/* Specified value to be put into tar file in place of stat () results, or   just -1 if such an override should not take place.  */GLOBAL gid_t group_option;GLOBAL bool ignore_failed_read_option;GLOBAL bool ignore_zeros_option;GLOBAL bool incremental_option;/* Specified name of script to run at end of each tape change.  */GLOBAL const char *info_script_option;GLOBAL bool interactive_option;/* If nonzero, extract only Nth occurrence of each named file */GLOBAL uintmax_t occurrence_option;enum old_files{  DEFAULT_OLD_FILES,          /* default */  NO_OVERWRITE_DIR_OLD_FILES, /* --no-overwrite-dir */  OVERWRITE_OLD_FILES,        /* --overwrite */  UNLINK_FIRST_OLD_FILES,     /* --unlink-first */  KEEP_OLD_FILES,             /* --keep-old-files */  KEEP_NEWER_FILES	      /* --keep-newer-files */};GLOBAL enum old_files old_files_option;/* Specified file name for incremental list.  */GLOBAL const char *listed_incremental_option;/* Check device numbers when doing incremental dumps. */GLOBAL bool check_device_option;/* Specified mode change string.  */GLOBAL struct mode_change *mode_option;/* Initial umask, if needed for mode change string.  */GLOBAL mode_t initial_umask;GLOBAL bool multi_volume_option;/* Specified threshold date and time.  Files having an older time stamp   do not get archived (also see after_date_option above).  */GLOBAL struct timespec newer_mtime_option;/* If true, override actual mtime (see below) */GLOBAL bool set_mtime_option;/* Value to be put in mtime header field instead of the actual mtime */GLOBAL struct timespec mtime_option;/* Return true if newer_mtime_option is initialized.  */#define NEWER_OPTION_INITIALIZED(opt) (0 <= (opt).tv_nsec)/* Return true if the struct stat ST's M time is less than   newer_mtime_option.  */#define OLDER_STAT_TIME(st, m) \  (timespec_cmp (get_stat_##m##time (&(st)), newer_mtime_option) < 0)/* Likewise, for struct tar_stat_info ST.  */#define OLDER_TAR_STAT_TIME(st, m) \  (timespec_cmp ((st).m##time, newer_mtime_option) < 0)/* Zero if there is no recursion, otherwise FNM_LEADING_DIR.  */GLOBAL int recursion_option;GLOBAL bool numeric_owner_option;GLOBAL bool one_file_system_option;/* Specified value to be put into tar file in place of stat () results, or   just -1 if such an override should not take place.  */GLOBAL uid_t owner_option;GLOBAL bool recursive_unlink_option;GLOBAL bool read_full_records_option;GLOBAL bool remove_files_option;/* Specified rmt command.  */GLOBAL const char *rmt_command_option;/* Specified remote shell command.  */GLOBAL const char *rsh_command_option;GLOBAL bool same_order_option;/* If positive, preserve ownership when extracting.  */GLOBAL int same_owner_option;/* If positive, preserve permissions when extracting.  */GLOBAL int same_permissions_option;/* When set, strip the given number of file name components from the file name   before extracting */GLOBAL size_t strip_name_components;GLOBAL bool show_omitted_dirs_option;GLOBAL bool sparse_option;GLOBAL unsigned tar_sparse_major;GLOBAL unsigned tar_sparse_minor;GLOBAL bool starting_file_option;/* Specified maximum byte length of each tape volume (multiple of 1024).  */GLOBAL tarlong tape_length_option;GLOBAL bool to_stdout_option;GLOBAL bool totals_option;GLOBAL bool touch_option;GLOBAL char *to_command_option;GLOBAL bool ignore_command_error_option;/* Restrict some potentially harmful tar options */GLOBAL bool restrict_option;/* Return true if the extracted files are not being written to disk */#define EXTRACT_OVER_PIPE (to_stdout_option || to_command_option)/* Count how many times the option has been set, multiple setting yields   more verbose behavior.  Value 0 means no verbosity, 1 means file name   only, 2 means file name and all attributes.  More than 2 is just like 2.  */GLOBAL int verbose_option;GLOBAL bool verify_option;/* Specified name of file containing the volume number.  */GLOBAL const char *volno_file_option;/* Specified value or pattern.  */GLOBAL const char *volume_label_option;/* Other global variables.  *//* File descriptor for archive file.  */GLOBAL int archive;/* Nonzero when outputting to /dev/null.  */GLOBAL bool dev_null_output;/* Timestamps: */GLOBAL struct timespec start_time;        /* when we started execution */GLOBAL struct timespec volume_start_time; /* when the current volume was					     opened*/GLOBAL struct timespec last_stat_time;    /* when the statistics was last					     computed */GLOBAL struct tar_stat_info current_stat_info;/* List of tape drive names, number of such tape drives, allocated number,   and current cursor in list.  */GLOBAL const char **archive_name_array;GLOBAL size_t archive_names;GLOBAL size_t allocated_archive_names;GLOBAL const char **archive_name_cursor;/* Output index file name.  */GLOBAL char const *index_file_name;/* Structure for keeping track of filenames and lists thereof.  */struct name  {    struct name *next;          /* Link to the next element */    int change_dir;		/* Number of the directory to change to.				   Set with the -C option. */    uintmax_t found_count;	/* number of times a matching file has				   been found */    int matching_flags;		/* this name is a regexp, not literal */    char const *dir_contents;	/* for incremental_option */    size_t length;		/* cached strlen(name) */    char name[1];  };/* Obnoxious test to see if dimwit is trying to dump the archive.  */GLOBAL dev_t ar_dev;GLOBAL ino_t ar_ino;GLOBAL bool seekable_archive;GLOBAL dev_t root_device;/* Unquote filenames */GLOBAL bool unquote_option;GLOBAL bool test_label_option; /* Test archive volume label and exit *//* Show file or archive names after transformation.   In particular, when creating archive in verbose mode, list member names   as stored in the archive */GLOBAL bool show_transformed_names_option;/* Delay setting modification times and permissions of extracted directories   until the end of extraction. This variable helps correctly restore directory   timestamps from archives with an unusual member order. It is automatically   set for incremental archives. */GLOBAL bool delay_directory_restore_option;/* Warn about implicit use of the wildcards in command line arguments.   (Default for tar prior to 1.15.91, but changed afterwards */GLOBAL bool warn_regex_usage;/* Declarations for each module.  *//* FIXME: compare.c should not directly handle the following variable,   instead, this should be done in buffer.c only.  */enum access_mode{  ACCESS_READ,  ACCESS_WRITE,  ACCESS_UPDATE};extern enum access_mode access_mode;/* Module buffer.c.  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -