home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.utils.bug
- Path: sparky!uunet!usc!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!thor.atd.ucar.edu!thor
- From: thor@thor.atd.ucar.edu (Richard Neitzel)
- Subject: Suggested patch to support gzip.
- Message-ID: <9212281744.AA29497@thor.atd.ucar.EDU>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Mon, 28 Dec 1992 17:44:32 GMT
- Approved: bug-gnu-utils@prep.ai.mit.edu
- Lines: 281
-
- The following is a quick & dirty patch to make tar-1.11.1 support the
- new gzip program. It breaks the -z & -Z flags apart, -z becoming the
- gzip switch and -Z the compress switch.
-
- --
- Richard Neitzel thor@thor.atd.ucar.edu Torren med sitt skjegg
- National Center For Atmospheric Research lokkar borni under sole-vegg
- Box 3000 Boulder, CO 80307-3000 Gjo'i med sitt shinn
- 303-497-2057 jagar borni inn.
- --------------------------------------------------------------------
- *** tar.c.orig Mon Sep 14 15:31:38 1992
- --- tar.c Mon Dec 28 10:33:46 1992
- ***************
- *** 609,618 ****
- add_exclude_file(optarg);
- break;
-
- ! case 'z': /* Easy to type */
- ! case 'Z': /* Like the filename extension .Z */
- f_compress++;
- break;
-
- case '?':
- badopt:
- --- 609,626 ----
- add_exclude_file(optarg);
- break;
-
- ! case 'z': /* Zip mode */
- ! #ifdef USE_ZIP
- f_compress++;
- + f_compress_mode = USE_ZIP;
- break;
- + #endif
- + case 'Z': /* Compress mode */
- + f_compress++;
- + #ifdef USE_ZIP
- + f_compress_mode = USE_COMPRESS;
- + #endif
- + break;
-
- case '?':
- badopt:
- ***************
- *** 650,655 ****
- --- 658,736 ----
- describe()
- {
- puts("choose one of the following:");
- + #ifdef USE_ZIP
- + fputs("\
- + -A, --catenate,\n\
- + --concatenate append tar files to an archive\n\
- + -c, --create create a new archive\n\
- + -d, --diff,\n\
- + --compare find differences between archive and file system\n\
- + --delete delete from the archive (not for use on mag tapes!)\n\
- + -r, --append append files to the end of an archive\n\
- + -t, --list list the contents of an archive\n\
- + -u, --update only append files that are newer than copy in archive\n\
- + -x, --extract,\n\
- + --get extract files from an archive\n",stdout);
- +
- + fprintf(stdout, "\
- + Other options:\n\
- + --atime-preserve don't change access times on dumped files\n\
- + -b, --block-size N block size of Nx512 bytes (default N=%d)\n", DEFBLOCKING);
- + fputs ("\
- + -B, --read-full-blocks reblock as we read (for reading 4.2BSD pipes)\n\
- + -C, --directory DIR change to directory DIR\n\
- + --checkpoint print directory names while reading the archive\n\
- + ", stdout); /* KLUDGE */ fprintf(stdout, "\
- + -f, --file [HOSTNAME:]F use archive file or device F (default %s)\n",
- + DEF_AR_FILE); fputs("\
- + --force-local archive file is local even if has a colon\n\
- + -F, --info-script F run script at end of each tape (implies -M)\n\
- + -G, --incremental create/list/extract old GNU-format incremental backup\n\
- + -g, --listed-incremental F create/list/extract new GNU-format incremental backup\n\
- + -h, --dereference don't dump symlinks; dump the files they point to\n\
- + -i, --ignore-zeros ignore blocks of zeros in archive (normally mean EOF)\n\
- + --ignore-failed-read don't exit with non-zero status on unreadable files\n\
- + -k, --keep-old-files keep existing files; don't overwrite them from archive\n\
- + -K, --starting-file FILE begin at FILE in the archive\n\
- + -l, --one-file-system stay in local file system when creating an archive\n\
- + -L, --tape-length LENGTH change tapes after writing LENGTH\n\
- + ", stdout); /* KLUDGE */ fputs("\
- + -m, --modification-time don't extract file modified time\n\
- + -M, --multi-volume create/list/extract multi-volume archive\n\
- + -N, --after-date DATE,\n\
- + --newer DATE only store files newer than DATE\n\
- + -o, --old-archive,\n\
- + --portability write a V7 format archive, rather than ANSI format\n\
- + -O, --to-stdout extract files to standard output\n\
- + -p, --same-permissions,\n\
- + --preserve-permissions extract all protection information\n\
- + -P, --absolute-paths don't strip leading `/'s from file names\n\
- + --preserve like -p -s\n\
- + ", stdout); /* KLUDGE */ fputs("\
- + -R, --record-number show record number within archive with each message\n\
- + --remove-files remove files after adding them to the archive\n\
- + -s, --same-order,\n\
- + --preserve-order list of names to extract is sorted to match archive\n\
- + --same-owner create extracted files with the same ownership \n\
- + -S, --sparse handle sparse files efficiently\n\
- + -T, --files-from F get names to extract or create from file F\n\
- + --null -T reads null-terminated names, disable -C\n\
- + --totals print total bytes written with --create\n\
- + -v, --verbose verbosely list files processed\n\
- + -V, --label NAME create archive with volume name NAME\n\
- + --version print tar program version number\n\
- + -w, --interactive,\n\
- + --confirmation ask for confirmation for every action\n\
- + ", stdout); /* KLUDGE */ fputs("\
- + -W, --verify attempt to verify the archive after writing it\n\
- + --exclude FILE exclude file FILE\n\
- + -X, --exclude-from FILE exclude files listed in FILE\n\
- + -z filter the archive through gzip\n\
- + -Z filter the archive through compress\n\
- + -[0-7][lmh] specify drive and density\n\
- + ", stdout);
- + }
- + #else
- fputs("\
- -A, --catenate,\n\
- --concatenate append tar files to an archive\n\
- ***************
- *** 721,727 ****
- -[0-7][lmh] specify drive and density\n\
- ", stdout);
- }
- !
- void
- name_add(name)
- char *name;
- --- 802,808 ----
- -[0-7][lmh] specify drive and density\n\
- ", stdout);
- }
- ! #endif /* USE_ZIP */
- void
- name_add(name)
- char *name;
- *** tar.h.orig Tue Sep 8 13:45:34 1992
- --- tar.h Mon Dec 28 09:35:24 1992
- ***************
- *** 224,231 ****
- TAR_EXTERN int f_verify; /* -W */
- /* CMD_EXTRACT -x */
- TAR_EXTERN int f_exclude; /* -X */
- ! TAR_EXTERN int f_compress; /* -z */
- ! /* -Z */
- TAR_EXTERN int f_do_chown; /* --do-chown */
- TAR_EXTERN int f_totals; /* --totals */
- TAR_EXTERN int f_remove_files; /* --remove-files */
- --- 224,231 ----
- TAR_EXTERN int f_verify; /* -W */
- /* CMD_EXTRACT -x */
- TAR_EXTERN int f_exclude; /* -X */
- ! TAR_EXTERN int f_compress; /* -z/-Z in use */
- ! TAR_EXTERN int f_compress_mode; /* -z(use gzip) -Z(use compress) */
- TAR_EXTERN int f_do_chown; /* --do-chown */
- TAR_EXTERN int f_totals; /* --totals */
- TAR_EXTERN int f_remove_files; /* --remove-files */
- ***************
- *** 276,281 ****
- --- 276,286 ----
- */
- TAR_EXTERN char read_error_flag;
-
- + /*
- + * Defines for determining which compression program to use.
- + */
- + #define USE_ZIP 1
- + #define USE_COMPRESS 2
-
- /*
- * Declarations of functions available to the world.
- *** buffer.c.orig Mon Sep 14 14:56:39 1992
- --- buffer.c Mon Dec 28 10:15:56 1992
- ***************
- *** 262,267 ****
- --- 262,268 ----
-
- int kidpipe[2];
- int kidchildpid;
- + char *compress_prog;
-
- #define READ 0
- #define WRITE 1
- ***************
- *** 451,461 ****
- exit(0);
- }
- }
- ! /* So we should exec compress (-d) */
- if(ar_reading)
- ! execlp("compress", "compress", "-d", (char *)0);
- else
- ! execlp("compress", "compress", (char *)0);
- msg_perror("can't exec compress");
- _exit(EX_SYSTEM);
- }
- --- 452,475 ----
- exit(0);
- }
- }
- ! #ifndef ZIP_NAME
- ! #define ZIP_NAME "gzip"
- ! #endif
- ! #ifndef COMPRESS_NAME
- ! #define COMPRESS_NAME "compress"
- ! #endif
- ! /* So we should exec compress || zip (-d) */
- ! #ifdef USE_ZIP
- ! if (f_compress_mode == USE_ZIP)
- ! compress_prog = ZIP_NAME;
- ! else
- ! #endif
- ! compress_prog = COMPRESS_NAME;
- !
- if(ar_reading)
- ! execlp(compress_prog, compress_prog, "-d", (char *)0);
- else
- ! execlp(compress_prog, compress_prog, (char *)0);
- msg_perror("can't exec compress");
- _exit(EX_SYSTEM);
- }
- *** Makefile.in.orig Mon Dec 28 10:01:37 1992
- --- Makefile.in Mon Dec 28 10:01:20 1992
- ***************
- *** 63,68 ****
- --- 63,71 ----
- # -DNO_OPEN3 If you lack the 3-argument open and want to
- # disable the tar -k option instead of emulating open.
- # -DXENIX If you have sys/inode.h and need it to be included.
- + # -DUSE_ZIP If you have GNU gzip and what to use it.
- + # -DZIPNAME=\"????\" Your local name for gzip. Defaults to "gzip".
- + # -DCOMPRESS_NAME=\"???\" Your local name for compress. Defaults to "compress".
-
- DEF_AR_FILE = @DEF_AR_FILE@
- DEFBLOCKING = 20
- *** configure.orig Tue Sep 15 18:29:09 1992
- --- configure Mon Dec 28 09:56:56 1992
- ***************
- *** 172,177 ****
- --- 172,204 ----
- test -n "$need_trad" && CC="$CC -traditional"
- fi
-
- + # Check for gzip.
- + if test -z "$USE_ZIP"; then
- + echo checking for gzip
- + saveifs="$IFS"; IFS="${IFS}:"
- + for dir in $PATH; do
- + test -z "$dir" && dir=.
- + if test -f $dir/gzip; then
- + DEFS="$DEFS -DUSE_ZIP"
- + USE_ZIP=1
- + break
- + fi
- + done
- + IFS="$saveifs"
- + fi
- + if test -z "$USE_ZIP"; then
- + echo checking for zip
- + saveifs="$IFS"; IFS="${IFS}:"
- + for dir in $PATH; do
- + test -z "$dir" && dir=.
- + if test -f $dir/zip; then
- + DEFS="$DEFS -DUSE_ZIP"
- + break
- + fi
- + done
- + IFS="$saveifs"
- + fi
- +
- # Make sure to not get the incompatible SysV /etc/install and
- # /usr/sbin/install, which might be in PATH before a BSD-like install,
- # or the SunOS /usr/etc/install directory.
-
-
-