- /* local variables */
-
-int ascii = 0; /* convert end-of-lines to local OS conventions */
-int to_stdout = 0; /* output to stdout (-c) */
-int decompress = 0; /* decompress (-d) */
-int force = 0; /* don't ask questions, compress links (-f) */
-int no_name = -1; /* don't save or restore the original file name */
-int no_time = -1; /* don't save or restore the original file time */
-int recursive = 0; /* recurse through directories (-r) */
-int list = 0; /* list the file contents (-l) */
-int verbose = 0; /* be verbose (-v) */
-int quiet = 0; /* be very quiet (-q) */
-int do_lzw = 0; /* generate output compatible with old compress (-Z) */
-int test = 0; /* test .gz file integrity */
-int foreground = 0; /* set if program run in foreground */
-char *program_name; /* program name */
-int maxbits = BITS; /* max bits per code for LZW */
-int method = DEFLATED;/* compression method */
-int level = 6; /* compression level */
-int exit_code = OK; /* program exit code */
-int save_orig_name; /* set if original name must be saved */
-int last_member; /* set for .zip and .Z files */
-int part_nb; /* number of parts in .gz file */
-struct timespec time_stamp; /* original time stamp (modification time) */
-off_t ifile_size; /* input file size, -1 for devices (debug only) */
-char *env; /* contents of GZIP env variable */
-char **args = NULL; /* argv pointer if GZIP env variable defined */
-char *z_suffix; /* default suffix (can be set with --suffix) */
-size_t z_len; /* strlen(z_suffix) */
+ /* local variables */
+
+/* If true, pretend that standard input is a tty. This option
+ is deliberately not documented, and only for testing. */
+static bool presume_input_tty;
+
+/* If true, transfer output data to the output file's storage device
+ when supported. Otherwise, if the system crashes around the time
+ gzip is run, the user might lose both input and output data. See:
+ Pillai TS et al. All file systems are not created equal: on the
+ complexity of crafting crash-consistent applications. OSDI'14. 2014:433-48.
+ https://www.usenix.org/conference/osdi14/technical-sessions/presentation/pillai */
+static bool synchronous;
+
+static int ascii = 0; /* convert end-of-lines to local OS conventions */
+ int to_stdout = 0; /* output to stdout (-c) */
+static int decompress = 0; /* decompress (-d) */
+static int force = 0; /* don't ask questions, compress links (-f) */
+static int keep = 0; /* keep (don't delete) input files */
+static int no_name = -1; /* don't save or restore the original file name */
+static int no_time = -1; /* don't save or restore the original file time */
+static int recursive = 0; /* recurse through directories (-r) */
+static int list = 0; /* list the file contents (-l) */
+ int verbose = 0; /* be verbose (-v) */
+ int quiet = 0; /* be very quiet (-q) */
+static int do_lzw = 0; /* generate output compatible with old compress (-Z) */
+ int test = 0; /* test .gz file integrity */
+static int foreground = 0; /* set if program run in foreground */
+ char *program_name; /* program name */
+ int maxbits = BITS; /* max bits per code for LZW */
+ int method = DEFLATED;/* compression method */
+ int level = 6; /* compression level */
+ int exit_code = OK; /* program exit code */
+ int save_orig_name; /* set if original name must be saved */
+static int last_member; /* set for .zip and .Z files */
+static int part_nb; /* number of parts in .gz file */
+ off_t ifile_size; /* input file size, -1 for devices (debug only) */
+static char *env; /* contents of GZIP env variable */
+static char const *z_suffix; /* default suffix (can be set with --suffix) */
+static size_t z_len; /* strlen(z_suffix) */
+
+/* The original timestamp (modification time). If the original is
+ unknown, TIME_STAMP.tv_nsec is negative. If the original is
+ greater than struct timespec range, TIME_STAMP is the maximal
+ struct timespec value; this can happen on hosts with 32-bit signed
+ time_t because the gzip format's MTIME is 32-bit unsigned.
+ The original cannot be less than struct timespec range. */
+struct timespec time_stamp;