From 78b078b455b834695ebd3104ec3dbe8a4ac9f3a3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 7 Feb 2006 22:18:36 +0000 Subject: [PATCH] * NEWS: --version now outputs copyright etc., to conform to the GNU coding standards. Remove --license. * gnulib.modules: Add version-etc-fsf. * doc/tar.texi: Document the change. * lib/.cvsignore: Add version-etc-fsf.c, version-etc.c, version-etc.h. * scripts/Makefile.am (SED_CMD): Update PAKCAGE_NAME, not PACKAGE. * scripts/backup.in: Remove --license. Change --version to conform to GCS. * scripts/restore.in: Likewise. * scripts/backup.sh.in (license): Output briefer license in the style of coreutils, for consistency with other changes. * src/tar.c: Include . (LICENSE_OPTION): Remove. (options): Remove --license. (license): Remove. (parse_opt): Use version_etc instead of rolling it ourselves. Remove --license. * tests/version.at (tar --version): Check only the first line of output. --- ChangeLog | 20 +++++++ NEWS | 5 ++ doc/tar.texi | 138 +++++++++++++++++++++---------------------- gnulib.modules | 1 + lib/.cvsignore | 3 + scripts/Makefile.am | 4 +- scripts/backup.in | 37 ++++++------ scripts/backup.sh.in | 37 ++++-------- scripts/restore.in | 40 +++++-------- src/tar.c | 80 ++++++++----------------- tests/version.at | 5 +- 11 files changed, 171 insertions(+), 199 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79776bf..e353e52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 2006-02-07 Paul Eggert + * NEWS: --version now outputs copyright etc., to conform to the + GNU coding standards. Remove --license. + * gnulib.modules: Add version-etc-fsf. + * doc/tar.texi: Document the change. + * lib/.cvsignore: Add version-etc-fsf.c, version-etc.c, version-etc.h. + * scripts/Makefile.am (SED_CMD): Update PAKCAGE_NAME, not PACKAGE. + * scripts/backup.in: Remove --license. Change --version to conform + to GCS. + * scripts/restore.in: Likewise. + * scripts/backup.sh.in (license): Output briefer license in the + style of coreutils, for consistency with other changes. + * src/tar.c: Include . + (LICENSE_OPTION): Remove. + (options): Remove --license. + (license): Remove. + (parse_opt): Use version_etc instead of rolling it ourselves. + Remove --license. + * tests/version.at (tar --version): Check only the first line of + output. + * ChangeLog, NEWS, src/common.h, src/extract.c, src/incremen.c: * src/list.c, src/names.c, src/tar.h, src/xheader.c: Update copyright year to 2006. diff --git a/NEWS b/NEWS index 7642af7..380dc96 100644 --- a/NEWS +++ b/NEWS @@ -87,6 +87,11 @@ modification times. ** When creating an archive, do not attempt to store files whose meta-data cannot be stored in the header due to format limitations (for ustar and v7 formats). +** The --version option now also outputs information about copyright, +license, and credits. This reverts to the behavior of tar 1.14 and +earlier, and conforms to the GNU coding standards. The --license (-L) +option introduced in tar 1.15 has been removed, since it's no longer +needed. version 1.15.1 - Sergey Poznyakoff, 2004-12-21 diff --git a/doc/tar.texi b/doc/tar.texi index e95a3ad..1814bff 100644 --- a/doc/tar.texi +++ b/doc/tar.texi @@ -819,7 +819,7 @@ standard output or some physical tape drive attached to your machine --show-defaults}, @pxref{defaults}). If there is no tape drive attached, or the default is not meaningful, then @command{tar} will print an error message. The error message might look roughly like one -of the following: +of the following: @smallexample tar: can't open /dev/rmt8 : No such device or address @@ -1390,7 +1390,7 @@ from an archive, use the @option{--extract} (@option{--get} or @option{-x}) operation. As with @option{--create}, specify the name of the archive with @option{--file} (@option{-f}) option. Extracting an archive does not modify the archive in any way; you can extract it -multiple times if you want or need to. +multiple times if you want or need to. Using @option{--extract}, you can extract an entire archive, or specific files. The files can be directories containing other files, or not. As @@ -1474,7 +1474,7 @@ with the @option{--to-stdout} (@option{-O}) option (@pxref{Writing to Standard Output}). If you give the @option{--verbose} option, then @option{--extract} -will print the names of the archive members as it extracts them. +will print the names of the archive members as it extracts them. @node extract dir @subsection Extracting Files that are Directories @@ -1690,7 +1690,7 @@ prior to the execution of the @command{tar} command. working directory. @command{tar} will make all file names relative (by removing leading slashes when archiving or restoring files), unless you specify otherwise (using the @option{--absolute-names} -option). @xref{absolute}, for more information about +option). @xref{absolute}, for more information about @option{--absolute-names}. If you give the name of a directory as either a file name or a member @@ -1740,7 +1740,7 @@ aiming simplicity in that area, for now. If you are not using the that everything went well, besides maybe innocuous warnings. Nonzero means that something went wrong. Right now, as of today, ``nonzero'' is almost always 2, except for remote operations, where it may be -128. +128. @node using tar options @section Using @command{tar} Options @@ -2589,7 +2589,7 @@ Use case-sensitive matching when excluding files. @opindex no-ignore-command-error, summary @item --no-ignore-command-error Print warnings about subprocesses terminated with a non-zero exit -code. @xref{Writing to an External Program}. +code. @xref{Writing to an External Program}. @opindex no-quote-chars, summary @item --no-quote-chars=@var{string} @@ -2732,7 +2732,7 @@ Set quoting style to use when printing member and file names @code{literal}, @code{shell}, @code{shell-always}, @code{c}, @code{escape}, @code{locale}, and @code{clocale}. Default quoting style is @code{escape}, unless overridden while configuring the -package. +package. @opindex pax-option, summary @item --pax-option=@var{keyword-list} @@ -3101,8 +3101,8 @@ archive. @xref{verify}. @opindex version, summary @item --version -@command{tar} will print an informational message about what version -it is and a copyright message, some credits, and then exit. +Print information about the program's name, version, origin and legal +status, all on standard output, and then exit successfully. @xref{help}. @opindex volno-file, summary @@ -3310,15 +3310,18 @@ the earlier versions of @GNUTAR{}. In the future releases @cindex Version of the @command{tar} program Being careful, the first thing is really checking that you are using @GNUTAR{}, indeed. The @option{--version} option -will generate a message giving confirmation that you are using -@GNUTAR{}, with the precise version of @GNUTAR{} -you are using. @command{tar} identifies itself and -prints the version number to the standard output, then immediately -exits successfully, without doing anything else, ignoring all other -options. For example, @w{@samp{tar --version}} might return: +causes @command{tar} to print information about its name, version, +origin and legal status, all on standard output, and then exit +successfully. For example, @w{@samp{tar --version}} might print: @smallexample -tar (@acronym{GNU} tar) @value{VERSION} +tar (GNU tar) 1.15.2 +Copyright (C) 2006 Free Software Foundation, Inc. +This is free software. You may redistribute copies of it under the terms of +the GNU General Public License . +There is NO WARRANTY, to the extent permitted by law. + +Written by John Gilmore and Jay Fenlason. @end smallexample @noindent @@ -3330,7 +3333,7 @@ named @samp{tar}, after the name of the main program it contains@footnote{There are plans to merge the @command{cpio} and @command{tar} packages into a single one which would be called @code{paxutils}. So, who knows if, one of this days, the -@option{--version} would not yield @w{@samp{tar (@acronym{GNU} +@option{--version} would not output @w{@samp{tar (@acronym{GNU} paxutils) 3.2}}}. @cindex Obtaining help @@ -3445,7 +3448,7 @@ silent. When used with most operations, the @option{--verbose} (@option{-v}) option causes @command{tar} to print the name of each file or archive member as it is processed. This and the other options which make @command{tar} print status information can be useful in -monitoring @command{tar}. +monitoring @command{tar}. With @option{--create} or @option{--extract}, @option{--verbose} used once just prints the names of the files or members as they are processed. @@ -3578,7 +3581,7 @@ output free to receive verbose output, all separate from errors. The basic @command{tar} operations, @option{--create} (@option{-c}), @option{--list} (@option{-t}) and @option{--extract} (@option{--get}, -@option{-x}), are currently presented and described in the tutorial +@option{-x}), are currently presented and described in the tutorial chapter of this manual. This section provides some complementary notes for these operations. @@ -3623,7 +3626,7 @@ given, there are no arguments besides options, and around the cautiousness of @GNUTAR{} and nevertheless create an archive with nothing in it, one may still use, as the value for the @option{--files-from} option, a file with no names in it, as shown in -the following commands: +the following commands: @smallexample @kbd{tar --create --file=empty-archive.tar --files-from=/dev/null} @@ -3780,7 +3783,7 @@ tar --extract --file archive.tar --occurrence=2 myfile @noindent would extract only the second copy. @xref{Option Summary,---occurrence}, for the description of @option{--occurrence} -option. +option. @FIXME{ hag -- you might want to incorporate some of the above into the MMwtSN node; not sure. i didn't know how to make it simpler... @@ -3931,13 +3934,13 @@ $ @kbd{tar --extract -vv --occurrence --file=collection.tar blues} @opindex update In the previous section, you learned how to use @option{--append} to -add a file to an existing archive. A related operation is +add a file to an existing archive. A related operation is @option{--update} (@option{-u}). The @option{--update} operation updates a @command{tar} archive by comparing the date of the specified archive members against the date of the file with the same name. If the file has been modified more recently than the archive member, then the newer version of the file is added to the archive (as with -@option{--append}). +@option{--append}). Unfortunately, you cannot use @option{--update} with magnetic tape drives. The operation will fail. @@ -4053,7 +4056,7 @@ $ @kbd{tar -tvf folkjazz.tar} -rw-r--r-- melissa user 65 1997-01-30 14:15 jazz @end smallexample -We can concatenate these two archives with @command{tar}: +We can concatenate these two archives with @command{tar}: @smallexample $ @kbd{cd ..} @@ -4266,7 +4269,7 @@ If you're not sure of the blocking factor of an archive, you can read the archive by specifying @option{--read-full-records} (@option{-B}) and @option{--blocking-factor=@var{512-size}} (@option{-b @var{512-size}}), using a blocking factor larger than what the archive -uses. This lets you avoid having to determine the blocking factor +uses. This lets you avoid having to determine the blocking factor of an archive. @xref{Blocking Factor}. @menu @@ -4487,7 +4490,7 @@ the files were extracted, use the @option{--touch} (@option{-m}) option in conjunction with @option{--extract} (@option{--get}, @option{-x}). @table @option -@opindex touch +@opindex touch @item --touch @itemx -m Sets the data modification time of extracted archive members to the time @@ -4619,7 +4622,7 @@ used, instead of creating the files specified, @command{tar} writes the contents of the files extracted to its standard output. This may be useful if you are only extracting the files in order to send them through a pipe. This option is meaningless with @option{--list} -(@option{-t}). +(@option{-t}). @end table This can be useful, for example, if you have a tar archive containing @@ -4814,7 +4817,7 @@ In this case, @option{--starting-file} is not necessary. To process large lists of file names on machines with small amounts of memory. Use in conjunction with @option{--compare} (@option{--diff}, @option{-d}), @option{--list} (@option{-t}) or @option{--extract} -(@option{--get}, @option{-x}). +(@option{--get}, @option{-x}). @end table The @option{--same-order} (@option{--preserve-order}, @option{-s}) option tells @command{tar} that the list of file @@ -5087,7 +5090,7 @@ have to. (Files not being modified are written with no trouble, and do not corrupt the entire archive.) You will want to use the @option{--label=@var{archive-label}} -(@option{-V @var{archive-label}}) option to give the archive a +(@option{-V @var{archive-label}}) option to give the archive a volume label, so you can tell what this archive is even if the label falls off the tape, or anything like that. @@ -5098,12 +5101,12 @@ Make sure you have enough tapes on hand to complete the backup. If you want to dump each file system separately you will need to use the @option{--one-file-system} (@option{-l}) option to prevent @command{tar} from crossing file system boundaries when storing -(sub)directories. +(sub)directories. The @option{--incremental} (@option{-G}) (@pxref{Incremental Dumps}) option is not needed, since this is a complete copy of everything in the file system, and a full restore from this backup would only be -done onto a completely +done onto a completely empty disk. Unless you are in a hurry, and trust the @command{tar} program (and your @@ -5122,7 +5125,7 @@ can be restored when extracting the archive. @GNUTAR{} currently offers two options for handling incremental backups: @option{--listed-incremental=@var{snapshot-file}} (@option{-g -@var{snapshot-file}}) and @option{--incremental} (@option{-G}). +@var{snapshot-file}}) and @option{--incremental} (@option{-G}). @opindex listed-incremental The option @option{--listed-incremental} instructs tar to operate on @@ -5762,13 +5765,10 @@ Wait till @var{time}, then do backup. @itemx --help Display short help message and exit. -@item -L -@itemx --license -Display program license and exit. - @item -V @itemx --version -Display program version and exit. +Display information about the program's name, version, origin and legal +status, all on standard output, and then exit successfully. @end table @@ -5833,13 +5833,10 @@ is 100, which means the highest debugging level. @itemx --help Display short help message and exit. -@item -L -@itemx --license -Display program license and exit. - @item -V @itemx --version -Display program version and exit. +Display information about the program's name, version, origin and legal +status, all on standard output, and then exit successfully. @end table You should start the restore script with the media containing the @@ -6210,7 +6207,7 @@ $ @kbd{tar -c -v --null --files-from=long-files --file=big.tar} @cindex Excluding files by name and pattern @cindex Excluding files by file system To avoid operating on files whose names match a particular pattern, -use the @option{--exclude} or @option{--exclude-from} options. +use the @option{--exclude} or @option{--exclude-from} options. @table @option @opindex exclude @@ -6260,7 +6257,7 @@ well-known name @file{CACHEDIR.TAG} and having a standard header specified in @url{http://www.brynosaurus.com/cachedir/spec.html}. Various applications write cache directory tags into directories they use to hold regenerable, non-precious data, so that such data can be -more easily excluded from backups. +more easily excluded from backups. @menu * controlling pattern-matching with exclude:: @@ -6352,7 +6349,7 @@ You can sometimes confuse the meanings of @option{--exclude} and to be excluded are given as a pattern on the command line. Use @option{--exclude-from} to introduce the name of a file which contains a list of patterns, one per line; each of these patterns can exclude -zero, one, or many files. +zero, one, or many files. @item When you use @option{--exclude=@var{pattern}}, be sure to quote the @var{pattern} @@ -6386,7 +6383,7 @@ In earlier versions of @command{tar}, what is now the @option{--exclude-from} option was called @option{--exclude} instead. Now, @option{--exclude} applies to patterns listed on the command line and @option{--exclude-from} applies to patterns listed in a -file. +file. @end itemize @@ -6539,7 +6536,7 @@ in renamed directories) are not selected properly by these options. @FIXME{show dan bob's comments, from 2-10-97} Usually, @command{tar} will recursively explore all directories (either -those given on the command line or through the @option{--files-from} +those given on the command line or through the @option{--files-from} option) for the various files they contain. However, you may not always want @command{tar} to act this way. @@ -6577,7 +6574,7 @@ directories themselves are not in the archive; so the @option{--same-permissions} (@option{--preserve-permissions}, @option{-p}) option does not affect them---while users might really like it to. Specifying @option{--no-recursion} is a way to tell -@command{tar} to grab only the directory entries given to it, adding +@command{tar} to grab only the directory entries given to it, adding no new files on its own. The @option{--no-recursion} option also applies when extracting: it @@ -7406,7 +7403,7 @@ archives the ``real contents'' of the file. On extraction (using @option{--sparse} is not needed on extraction) any such files have holes created wherever the continuous stretches of zeros were found. Thus, if you use @option{--sparse}, @command{tar} archives -won't take more space than the original. +won't take more space than the original. A file is sparse if it contains blocks of zeros whose existence is recorded, but that have no space allocated on disk. When you specify @@ -8209,7 +8206,7 @@ maximum tape length, you might avoid the problem entirely. @itemx --new-volume-script=@var{file} Execute @file{file} at end of each tape. This implies @option{--multi-volume} (@option{-M}). @xref{info-script}, for a detailed -description of this option. +description of this option. @end table @node Remote Tape Server @@ -8275,7 +8272,7 @@ This means that the @option{--append}, @option{--concatenate}, and @option{--delete} commands will not work on any other kind of file. Some media simply cannot be backspaced, which means these commands and options will never be able to work on them. These non-backspacing -media include pipes and cartridge tape drives. +media include pipes and cartridge tape drives. Some other media can be backspaced, and @command{tar} will work on them once @command{tar} is modified to do so. @@ -8381,7 +8378,7 @@ factor, use the @option{--blocking-factor=@var{512-size}} (@option{-b @xref{Standard}.) Each file written to the archive uses at least one full record. As a result, using a larger record size can result in more wasted space for small files. On the other hand, a larger record -size can often be read and written much more efficiently. +size can often be read and written much more efficiently. Further complicating the problem is that some tape drives ignore the blocking entirely. For these, a larger record size can still improve @@ -8477,7 +8474,7 @@ The @option{--blocking-factor=@var{512-size}} (@option{-b The default blocking factor is typically 20 (i.e., 10240 bytes), but can be specified at installation. To find out the blocking factor of an existing archive, use @samp{tar --list --file=@var{archive-name}}. -This may not work on some devices. +This may not work on some devices. Records are separated by gaps, which waste space on the archive media. If you are archiving on magnetic tape, using a larger blocking factor @@ -8657,7 +8654,7 @@ Reblock as we read (for reading 4.2BSD pipes). If @option{--read-full-records} is used, @command{tar} will not panic if an attempt to read a record from the archive does not return a full record. Instead, @command{tar} will keep reading -until it has obtained a full +until it has obtained a full record. This option is turned on by default when @command{tar} is reading @@ -8972,14 +8969,14 @@ If you want more elaborate behavior than this, give @command{tar} the be a program (or shell script) to be run instead of the normal prompting procedure. It is executed without any command line arguments. Additional data is passed to it via the following -environment variables: +environment variables: @table @env @vrindex TAR_VERSION, info script environment variable @item TAR_VERSION @GNUTAR{} version number. -@vrindex TAR_ARCHIVE, info script environment variable +@vrindex TAR_ARCHIVE, info script environment variable @item TAR_ARCHIVE The name of the archive @command{tar} is processing. @@ -8989,13 +8986,13 @@ Ordinal number of the volume @command{tar} is about to start. @vrindex TAR_SUBCOMMAND, info script environment variable @item TAR_SUBCOMMAND -Short option describing the operation @command{tar} is executed. +Short option describing the operation @command{tar} is executed. @xref{Operations}, for a complete list of subcommand options. @vrindex TAR_FORMAT, info script environment variable @item TAR_FORMAT Format of the archive being processed. @xref{Formats}, for a complete -list of archive format names. +list of archive format names. @end table The info script can instruct @command{tar} to use new archive name, @@ -9003,7 +9000,7 @@ by writing in to file descriptor 3 (see below for an example). If the info script fails, @command{tar} exits; otherwise, it begins -writing the next volume. +writing the next volume. The method @command{tar} uses to detect end of tape is not perfect, and fails on some operating systems or on some devices. You can use the @@ -9012,7 +9009,7 @@ fails on some operating systems or on some devices. You can use the selects @option{--multi-volume} (@option{-M}) automatically. The @var{size} argument should then be the usable size of the tape in units of 1024 bytes. But for many devices, and floppy disks in -particular, this option is never required for real, as far as we know. +particular, this option is never required for real, as far as we know. @cindex Volume number file @cindex volno file @@ -9093,7 +9090,7 @@ the media, use the @option{--multi-volume} (@option{-M}) option in conjunction w the @option{--create} option (@pxref{create}). A @dfn{multi-volume} archive can be manipulated like any other archive (provided the @option{--multi-volume} option is specified), but is stored on more -than one tape or disk. +than one tape or disk. When you specify @option{--multi-volume}, @command{tar} does not report an error when it comes to the end of an archive volume (when reading), or @@ -9140,7 +9137,7 @@ If a multi-volume archive was labeled using automatically label volumes which are added later. To label subsequent volumes, specify @option{--label=@var{archive-label}} again in conjunction with the @option{--append}, @option{--update} or -@option{--concatenate} operation. +@option{--concatenate} operation. @cindex Labeling multi-volume archives @FIXME{example} @@ -9191,7 +9188,7 @@ volume label will have @samp{Volume @var{nnn}} appended to the name you give, where @var{nnn} is the number of the volume of the archive. (If you use the @option{--label=@var{volume-label}}) option when reading an archive, it checks to make sure the label on the tape -matches the one you give. @xref{label}. +matches the one you give. @xref{label}. When @command{tar} writes an archive to tape, it creates a single tape file. If multiple archives are written to the same tape, one @@ -9247,7 +9244,7 @@ media, you can include a @dfn{label} entry---an archive member which contains the name of the archive---in the archive itself. Use the @option{--label=@var{archive-label}} (@option{-V @var{archive-label}}) option in conjunction with the @option{--create} operation to include -a label entry in the archive as it is being created. +a label entry in the archive as it is being created. @table @option @item --label=@var{archive-label} @@ -9412,13 +9409,13 @@ drives, and some other devices cannot be verified. One can explicitly compare an already made archive with the file system by using the @option{--compare} (@option{--diff}, @option{-d}) option, instead of using the more automatic @option{--verify} option. -@xref{compare}. +@xref{compare}. Note that these two options have a slightly different intent. The @option{--compare} option checks how identical are the logical contents of some archive with what is on your disks, while the @option{--verify} option is really for checking if the physical contents agree and if the recording -media itself is of dependable quality. So, for the @option{--verify} +media itself is of dependable quality. So, for the @option{--verify} operation, @command{tar} tries to defeat all in-memory cache pertaining to the archive, while it lets the speed optimization undisturbed for the @option{--compare} option. If you nevertheless use @option{--compare} for @@ -9437,7 +9434,7 @@ The @option{--verify} (@option{-W}) option will not work in conjunction with the @option{--multi-volume} (@option{-M}) option or the @option{--append} (@option{-r}), @option{--update} (@option{-u}) and @option{--delete} operations. @xref{Operations}, for more -information on these operations. +information on these operations. Also, since @command{tar} normally strips leading @samp{/} from file names (@pxref{absolute}), a command like @samp{tar --verify -cf @@ -9527,7 +9524,7 @@ the option. For example, here is an excerpt from the actual @kbd{tar -c, --create create a new archive -d, --diff, --compare find differences between archive and file system - --delete delete from the archive + --delete delete from the archive @end verbatim @vrindex ARGP_HELP_FMT, environment variable @@ -9703,14 +9700,14 @@ following text: @verbatim Main operation mode: - -A, --catenate, --concatenate append tar files to + -A, --catenate, --concatenate append tar files to an archive -c, --create create a new archive @end verbatim @noindent @samp{Main operation mode:} is the group header. -The default value is 1. +The default value is 1. @end deftypevr @deftypevr {Help Output} offset usage-indent @@ -9768,4 +9765,3 @@ options. The options are listed without the preceeding double-dash. @c Local variables: @c texinfo-column-for-description: 32 @c End: - diff --git a/gnulib.modules b/gnulib.modules index 821cfc5..3688a08 100644 --- a/gnulib.modules +++ b/gnulib.modules @@ -44,6 +44,7 @@ unlinkdir unlocked-io utime utimens +version-etc-fsf xalloc xalloc-die xgetcwd diff --git a/lib/.cvsignore b/lib/.cvsignore index 7c2c006..900e49e 100644 --- a/lib/.cvsignore +++ b/lib/.cvsignore @@ -191,6 +191,9 @@ utimens.h vasnprintf.c vasnprintf.h verify.h +version-etc-fsf.c +version-etc.c +version-etc.h vsnprintf.c vsnprintf.h xalloc-die.c diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 2ee04e9..a250a66 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2006 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 @@ -31,7 +31,7 @@ CLEANFILES=backup.sh backup restore dump-remind SED_CMD="s,\@libexecdir\@,$(libexecdir),;\ s,\@sysconfdir\@,$(sysconfdir),;\ - s,\@PACKAGE\@,$(PACKAGE),;\ + s,\@PACKAGE_NAME\@,$(PACKAGE_NAME),;\ s,\@VERSION\@,$(VERSION),;\ s,\@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),;\ s,\@DATE_FORMAT_OK\@,$(DATE_FORMAT_OK),;@BACKUP_SED_COND@" diff --git a/scripts/backup.in b/scripts/backup.in index d64f2fa..6a50e51 100644 --- a/scripts/backup.in +++ b/scripts/backup.in @@ -1,6 +1,6 @@ #! /bin/sh # This program is part of GNU tar -# Copyright 2004, 2005, Free Software Foundation +# Copyright (C) 2004, 2005, 2006 Free Software Foundation # # 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 @@ -34,11 +34,10 @@ Options are: -f, --force Force backup even if today's log file already exists. -v, --verbose[=LEVEL] Set verbosity level. Default 100. - -t, --time=TIME Wait till TIME, then do backup. + -t, --time=TIME Wait till TIME, then do backup. -Informational options: +Informational options: -h, --help Display this help message. - -L, --license Display program license. -V, --version Display program version. Optional argument WHEN is for backward compatibility only. It has been @@ -87,16 +86,14 @@ do TIME=$optarg ;; -t) prev=--t;; - -t*) TIME=`expr $option : "-t\(.*\)"`;; + -t*) TIME=`expr $option : "-t\(.*\)"`;; --t|--ti|--tim|--time) prev=$option ;; -V|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "backup (@PACKAGE@ @VERSION@)" - exit 0;; - -L|--li|--lic|--lice|--licen|--licens|--license) - license - exit;; + echo "backup (@PACKAGE_NAME@) @VERSION@" + license + exit;; -h|--h|--he|--hel|--help) usage exit;; @@ -108,13 +105,13 @@ do else TIME=$option fi;; - esac -done + esac +done if [ "x$TIME" = x ]; then bailout "No backup time specified. Try $PROGNAME --help for more info." exit 1 -fi +fi init_backup @@ -138,10 +135,10 @@ fi if [ "x$FORCE" = "xyes" ]; then rm ${LOGFILE} -fi +fi if [ -f "${LOGFILE}" ] ; then - bailout "Log file ${LOGFILE} already exists." + bailout "Log file ${LOGFILE} already exists." else touch "${LOGFILE}" fi @@ -172,7 +169,7 @@ message 20 "BACKUP_FILES=$BACKUP_FILES" if [ -z "$remotehost" ]; then remotehost=$localhost fi - + echo "Backing up ${1} at ${date}" message 10 "fs=$fs" message 10 "fsname=$fsname" @@ -183,7 +180,7 @@ message 20 "BACKUP_FILES=$BACKUP_FILES" echo "Last `prev_level` dump on this filesystem was on $PREV_DATE" remote_run "${remotehost}" cp "`level_log_name ${fsname} $PREV_LEVEL`" "`level_log_name temp`" fi - + ${DUMP_BEGIN-:} $DUMP_LEVEL $remotehost $fs $fsname backup_host ${remotehost} \ "--listed=`level_log_name temp`" \ @@ -214,14 +211,14 @@ message 20 "BACKUP_FILES=$BACKUP_FILES" date="`date`" if [ $DUMP_LEVEL -eq 0 ]; then - make_level_log $localhost + make_level_log $localhost else echo "Last `prev_level` dump on this filesystem was on $PREV_DATE" remote_run "${localhost}" cp "`level_log_name MISC $PREV_LEVEL`" "`level_log_name temp`" fi echo "Backing up miscellaneous files at ${date}" - + ${DUMP_BEGIN-:} $DUMP_LEVEL $localhost MISC MISC backup_host $localhost \ "--listed=`level_log_name temp`"\ @@ -243,7 +240,7 @@ message 20 "BACKUP_FILES=$BACKUP_FILES" message 1 "final cleanup" - $MT_REWIND "${TAPE_FILE}" + $MT_REWIND "${TAPE_FILE}" $MT_OFFLINE "${TAPE_FILE}" echo "." ) 2>&1 | tee -a "${LOGFILE}" diff --git a/scripts/backup.sh.in b/scripts/backup.sh.in index 0862427..adcdfe2 100644 --- a/scripts/backup.sh.in +++ b/scripts/backup.sh.in @@ -1,6 +1,6 @@ #! /bin/sh # This program is part of GNU tar -# Copyright 2004, 2005, Free Software Foundation +# Copyright (C) 2004, 2005, 2006 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 @@ -78,7 +78,7 @@ bailout() { # Return current date now() { -#IF_DATE_FORMAT_OK +#IF_DATE_FORMAT_OK date +%Y-%m-%d #ELSE_DATE_FORMAT_OK LC_ALL=C date | \ @@ -108,7 +108,7 @@ test_root() { root_fs() { echo "${ROOT_FS}$1" | tr -s / -} +} advice() { echo "Directory $1 is not found." >&2 @@ -139,7 +139,7 @@ init_common() { advice $LOGPATH exit 1 fi - fi + fi # Get the values of BACKUP_DIRS, BACKUP_FILES, and other variables. if [ ! -r $CONFIGFILE ]; then echo "$PROGNAME: cannot read $CONFIGFILE. Stop." >&2 @@ -151,7 +151,7 @@ init_common() { test_root - if [ x"${ADMINISTRATOR}" = x ]; then + if [ x"${ADMINISTRATOR}" = x ]; then bailout "ADMINISTRATOR not defined" fi @@ -159,7 +159,7 @@ init_common() { [ x"$SLEEP_TIME" = x ] && SLEEP_TIME=60 if [ x$VOLNO_FILE = x ]; then - bailout "VOLNO_FILE not specified" + bailout "VOLNO_FILE not specified" fi if [ -r $DIRLIST ]; then @@ -253,7 +253,7 @@ wait_time() { diff = 3600 * (time[1] - now[1]) + 60 * (time[2] - now[2]); if (diff < 0) diff += 3600 * 24 - print diff + print diff }'`" clear echo "${SLEEP_MESSAGE}" @@ -320,7 +320,7 @@ print_level() { else echo "Level ${1-$DUMP_LEVEL}" fi -} +} prev_level() { print_level `expr $DUMP_LEVEL - 1` | tr A-Z a-z @@ -339,22 +339,9 @@ remote_run() { license() { cat - <. +There is NO WARRANTY, to the extent permitted by law. EOF } diff --git a/scripts/restore.in b/scripts/restore.in index 5676cf9..efc320a 100644 --- a/scripts/restore.in +++ b/scripts/restore.in @@ -1,6 +1,6 @@ #! /bin/sh # This program is part of GNU tar -# Copyright 2004, Free Software Foundation +# Copyright (C) 2004, 2006 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 @@ -31,9 +31,8 @@ Options are: (default $DUMP_LEVEL). -v, --verbose[=LEVEL] Set verbosity level. Default 100. -Informational options: +Informational options: -h, --help Display this help message. - -L, --license Display program license. -V, --version Display program version. Send bug reports to @PACKAGE_BUGREPORT@. @@ -72,30 +71,28 @@ do ;; -v*) VERBOSE=`expr $option : "-v\(.*\)"`;; -V|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "restore (@PACKAGE@ @VERSION@)" - exit 0;; - -L|--li|--lic|--lice|--licen|--licens|--license) - license - exit;; + echo "restore (@PACKAGE_NAME@) @VERSION@" + license + exit;; -h|--h|--he|--hel|--help) usage exit;; -*) bailout "Unknown option $opt. Try $PROGNAME --help for more info.";; *) if [ -z "$PATTERN" ]; then PATTERN=$opt - else + else PATTERN="$PATTERN|$opt" fi ;; - esac -done + esac +done if [ -z "$RESTORE_ALL" ]; then if [ -z "$PATTERN" ]; then usage exit; fi -fi +fi init_restore cat > $LOGFILE <&1 | tee -a "${LOGFILE}" -# EOF +fi) 2>&1 | tee -a "${LOGFILE}" - - - - +# EOF diff --git a/src/tar.c b/src/tar.c index 8e75e7a..c8eeaa4 100644 --- a/src/tar.c +++ b/src/tar.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -187,16 +188,16 @@ subcommand_string (enum subcommand c) case CAT_SUBCOMMAND: return "-A"; - + case CREATE_SUBCOMMAND: return "-c"; - + case DELETE_SUBCOMMAND: return "-D"; case DIFF_SUBCOMMAND: return "-d"; - + case EXTRACT_SUBCOMMAND: return "-x"; @@ -257,7 +258,6 @@ enum IGNORE_FAILED_READ_OPTION, INDEX_FILE_OPTION, KEEP_NEWER_FILES_OPTION, - LICENSE_OPTION, MODE_OPTION, NEWER_MTIME_OPTION, NO_ANCHORED_OPTION, @@ -369,7 +369,7 @@ static struct argp_option options[] = { N_("Test archive volume label and exit"), GRID+1 }, #undef GRID -#define GRID 20 +#define GRID 20 {NULL, 0, NULL, 0, N_("Operation modifiers:"), GRID }, @@ -387,7 +387,7 @@ static struct argp_option options[] = { N_("archive is seekable"), GRID+1 }, #undef GRID -#define GRID 30 +#define GRID 30 {NULL, 0, NULL, 0, N_("Overwrite control:\n"), GRID+1 }, @@ -409,7 +409,7 @@ static struct argp_option options[] = { N_("preserve metadata of existing directories"), GRID+1 }, #undef GRID -#define GRID 40 +#define GRID 40 {NULL, 0, NULL, 0, N_("Select output stream:"), GRID }, @@ -423,7 +423,7 @@ static struct argp_option options[] = { N_("treat non-zero exit codes of children as error"), GRID+1 }, #undef GRID -#define GRID 50 +#define GRID 50 {NULL, 0, NULL, 0, N_("Handling of file attributes:"), GRID }, @@ -463,7 +463,7 @@ static struct argp_option options[] = { N_("Cancel the effect of --delay-directory-restore option."), GRID+1 }, #undef GRID -#define GRID 60 +#define GRID 60 {NULL, 0, NULL, 0, N_("Device selection and switching:\n"), GRID+1 }, @@ -502,7 +502,7 @@ static struct argp_option options[] = { N_("use/update the volume number in FILE"), GRID+1 }, #undef GRID -#define GRID 70 +#define GRID 70 {NULL, 0, NULL, 0, N_("Device blocking:"), GRID+1 }, @@ -516,7 +516,7 @@ static struct argp_option options[] = { N_("reblock as we read (for 4.2BSD pipes)"), GRID+1 }, #undef GRID -#define GRID 80 +#define GRID 80 {NULL, 0, NULL, 0, N_("Archive format selection:"), GRID }, @@ -558,7 +558,7 @@ static struct argp_option options[] = { N_("filter through PROG (must accept -d)"), GRID+8 }, #undef GRID -#define GRID 90 +#define GRID 90 {NULL, 0, NULL, 0, N_("Local file selection:"), GRID }, @@ -623,7 +623,7 @@ static struct argp_option options[] = { N_("exclude pattern wildcards match `/' (default)"), GRID+1 }, #undef GRID -#define GRID 100 +#define GRID 100 {NULL, 0, NULL, 0, N_("Informative output:"), GRID }, @@ -659,7 +659,7 @@ static struct argp_option options[] = { N_("Disable quoting for characters from STRING"), GRID+1 }, #undef GRID -#define GRID 110 +#define GRID 110 {NULL, 0, NULL, 0, N_("Compatibility options:"), GRID }, @@ -667,23 +667,22 @@ static struct argp_option options[] = { N_("when creating, same as --old-archive. When extracting, same as --no-same-owner"), GRID+1 }, #undef GRID -#define GRID 120 +#define GRID 120 {NULL, 0, NULL, 0, N_("Other options:"), GRID }, - {"restrict", RESTRICT_OPTION, 0, 0, + {"restrict", RESTRICT_OPTION, 0, 0, N_("Restrict use of some potentially harmful options"), -1 }, - + {"help", '?', 0, 0, N_("Give this help list"), -1}, {"usage", USAGE_OPTION, 0, 0, N_("Give a short usage message"), -1}, - {"license", LICENSE_OPTION, 0, 0, N_("Print license and exit"), -1}, {"version", VERSION_OPTION, 0, 0, N_("Print program version"), -1}, /* FIXME -V (--label) conflicts with the default short option for --version */ {"HANG", HANG_OPTION, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN, N_("Hang for SECS seconds (default 3600)"), 0}, #undef GRID - + {0, 0, 0, 0, 0, 0} }; @@ -744,30 +743,6 @@ set_use_compress_program_option (const char *string) use_compress_program_option = string; } -void -license () -{ - printf ("tar (%s) %s\n%s\n", PACKAGE_NAME, PACKAGE_VERSION, - "Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1999, \n\ -2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.\n"); - puts (_("Based on the work of John Gilmore and Jay Fenlason. See AUTHORS\n\ -for complete list of authors.\n")); - printf (_(" GNU tar is free software; you can redistribute it and/or modify\n" - " it under the terms of the GNU General Public License as published by\n" - " the Free Software Foundation; either version 2 of the License, or\n" - " (at your option) any later version.\n" - "\n" - " GNU tar is distributed in the hope that it will be useful,\n" - " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - " GNU General Public License for more details.\n" - "\n" - " You should have received a copy of the GNU General Public License\n" - " along with GNU tar; if not, write to the Free Software Foundation,\n" - " Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\n\n")); - exit (0); -} - static volatile int _argp_hang; enum read_file_list_state /* Result of reading file name from the list file */ @@ -1274,7 +1249,7 @@ parse_opt (int key, char *arg, struct argp_state *state) case NO_DELAY_DIRECTORY_RESTORE_OPTION: delay_directory_restore_option = false; break; - + case DELETE_OPTION: set_subcommand_option (DELETE_SUBCOMMAND); break; @@ -1357,7 +1332,7 @@ parse_opt (int key, char *arg, struct argp_state *state) for (;*arg; arg++) set_char_quoting (NULL, *arg, 0); break; - + case NO_WILDCARDS_OPTION: args->exclude_options &= ~ EXCLUDE_WILDCARDS; break; @@ -1414,7 +1389,7 @@ parse_opt (int key, char *arg, struct argp_state *state) case QUOTING_STYLE_OPTION: tar_set_quoting_style (arg); break; - + case PAX_OPTION: args->pax_option++; xheader_set_option (arg); @@ -1455,7 +1430,7 @@ parse_opt (int key, char *arg, struct argp_state *state) case RESTRICT_OPTION: restrict_option = true; break; - + case RMT_COMMAND_OPTION: rmt_command = arg; break; @@ -1624,7 +1599,7 @@ parse_opt (int key, char *arg, struct argp_state *state) fprintf (state->out_stream, "\n%s\n\n", _("Valid arguments for --quoting-style options are:")); tar_list_quoting_styles (state->out_stream, " "); - + fprintf (state->out_stream, _("\n*This* tar defaults to:\n")); show_default_settings (state->out_stream); fprintf (state->out_stream, "\n"); @@ -1638,13 +1613,10 @@ parse_opt (int key, char *arg, struct argp_state *state) break; case VERSION_OPTION: - fprintf (state->out_stream, "%s\n", argp_program_version); + version_etc (state->out_stream, "tar", PACKAGE_NAME, VERSION, + "John Gilmore", "Jay Fenlason", (char *) NULL); exit (0); - case LICENSE_OPTION: - license (); - break; - case HANG_OPTION: _argp_hang = atoi (arg ? arg : "3600"); while (_argp_hang-- > 0) @@ -1838,7 +1810,7 @@ decode_options (int argc, char **argv) && !tape_length_option) USAGE_ERROR ((0, 0, _("creating multi-volume archives in posix format requires using --tape-length (-L) option"))); - + if (occurrence_option) { if (!args.input_files) diff --git a/tests/version.at b/tests/version.at index 44a613d..c846373 100644 --- a/tests/version.at +++ b/tests/version.at @@ -1,5 +1,5 @@ # Checking tar version -*- Autotest -*- -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2006 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 @@ -18,10 +18,9 @@ AT_SETUP([tar version]) -AT_CHECK([tar --version], +AT_CHECK([tar --version | sed 1q], [0], [AT_PACKAGE_TARNAME (AT_PACKAGE_NAME) AT_PACKAGE_VERSION ]) AT_CLEANUP - \ No newline at end of file -- 2.44.0