########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1987-2012 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
:
# @(#)tar.sh (AT&T Labs Research) 1989-04-06
#
# tar -> pax interface script
#
command=tar
#Usage: $command c[bBfkLopvVwzZ[[0-9][hlm]]] [tarfile] [exclude-file]
# $command r[bBfkLvVwzZ[[0-9][hlm]]] [files ...]
# $command t[bBfkvX[[0-9][hlm]] [tarfile] [exclude-file]
# $command u[bBfkLvVwzZ[[0-9][hlm]]] [tarfile]
# $command x[bBfkmopvVw[[0-9][hlm]]] [tarfile] [exclude-file]"
usage=$'
[-?\n@(#)$Id: tar (AT&T Labs Research) 2012-05-07 $\n]
[+NAME?tar - create tape archives, and add or extract files]
[+DESCRIPTION?The \btar\b utility is a compatibility script on top of
the \bpax\b(1) utility. It archives and extracts files to and from a
single file called a \atarfile\a. A \atarfile\a can be any file,
including a magnetic tape. \btar\b\'s actions are controlled by the
\akey\a. The \akey\a is an \aoptions\a string containing one of the
single-character function letters \(\bc\b, \br\b, \bt\b, \bu\b, or
\bx\b\) and other function modifiers as needed, depending on the
function character used. The leading - is optional for the
single-character function letters. Some of the function modifiers
(\bb\b, \bf\b, \bX\b) take operands. Operands of these function
modifiers appear after the \aoptions\a string instead of immediately
following the corresponding function modfier character in the
\aoptions\a string. Other command-line arguments are filenames \(or
directory names\) that specify which files are to be archived or
extracted. In all cases, appearance of a directory name refers to the
files and \(recursively\) subdirectories of that directory.]
[A:catenate|concatenate?Append \btar\b files to an archive.]
[c:create?Create a new archive.]
[r:append?Append files to the end of an archive.]
[t:list?List the contents of an archive.]
[x:extract|get?Extract files from an archive.]
[13:atime-preserve?Do not change access times on dumped files.]
[b:block-size]:[N?block size of Nx512 bytes (default N=20).]
[B:read-full-blocks?Reblock as we read (for reading 4.2BSD pipes).]
[E?Write a tar file with extended headers.]
[h:logical|dereference?Follow symbolic links.]
[j:bzip?Filter the archive through \bbzip2\b(1).]
[J:xz?Filter the archive through \bxz\b(1).]
[k?On archive read only extract files that are newer than the target
files.]
[l?Link. Complain if tar cannot resolve all of the links to files being
archived.]
[L:tape-length]:[N?Change tapes after writing N*1024 bytes.]
[m:modification-time?Do not extract file modified time.]
[o?Assign to extracted files the user and group identifiers of the user
running the tar program, rather than those on tarfile.]
[p:same-permissions|preserve-permissions?Extract all protection
information.]
[v:verbose?Verbosely list files processed.]
[V:label]:[name?Create archive with volume name \aname\a.]
[w:interactive|confirmation?Ask for confirmation for every action.]
[23:exclude-file]:[pattern?Do not extract matching the \bksh\b(1)
\apattern\a from the archive.]
[z:gzip?Filter the archive through \bgzip\b(1).]
[Z:compress?Filter the archive through \bcompress\b(1).]
[33:show?Show but do not execute the underlying \bpax\b(1) command.]
[0|1|2|3|4|5|6|7|8|9?Alternative drive number.]
[operands] files ...
[+SEE ALSO?\bar\b(1), \bbzip2\b(1), \bchown\b(1), \bcompress\b(1),
\bcpio\b(1), \bcsh\b(1), \bgzip\b(1), \bksh\b(1), \bls\b(1),
\bmt\b(1), \bpax\b(1), \bumask\b(2), \bxz\b(1), \benviron\b(5)]
'
typeset -a options
integer noptions=0
eval=eval
file=""
list=false
r_ok=true
w_ok=true
arg=""
lastopt=""
mode=""
format="ustar"
zip=""
optsWargs=""
directedToExclude=false
fileSpecified=false
tapeSpecified=false
{
OPTIND=0
exit 2
}
{
case $1 in
[0-9]) case $fileSpecified in
*) file="--tape=$1"
tapeSpecified=true
;;
esac
;;
23) if [[ $# == 0 ]]
then
else
excludedFiles+=" $OPTARG"
directedToExclude=true
w_ok=false
fi
;;
33) set --showme
eval=
;;
*) case $1 in
l) ;;
esac
;;
esac
;;
b) if [[ $2 == "short form" ]]
then
optsWargs+="b "
elif [[ $# == 0 ]]
then
else
fi
;;
f) if [[ $tapeSpecified == true ]]
then
elif [[ $2 == "short form" ]]
then
optsWargs+="f "
fileSpecified=true
elif [[ $# == 0 ]]
then
else
case $1 in # Retain most recent file operand
esac
fileSpecified=true
fi
;;
L) if [[ $2 == "short form" ]]
then
optsWargs+="L "
elif [[ $# == 0 ]]
then
else
fi
;;
V) if [[ $2 == "short form" ]]
then
optsWargs+="V "
elif [[ $# == 0 ]]
then
else
fi
;;
*) usage ;;
esac
lastopt=$1
}
case $1 in
do process_option "$opt" "long form"
done
;;
"") usage
;;
*) if [[ ${1:0:1} == '-' ]]
else arg=$1
fi
shift
while [[ $arg ]]
done
;;
esac
block=""
maxout=""
label=""
for i in $optsWargs
do
case $i in
b) case $# in
esac
shift
;;
f) case $# in
esac
-) file="" ;;
*) file="--file=$1" ;;
esac
shift
;;
L) case $# in
esac
shift
;;
V) case $# in
esac
shift
;;
esac
done
if [[ $block ]]
then options[noptions++]="-b"; options[noptions++]="${block}b" # Take most recent block operand short form
fi
if [[ $maxout ]]
fi
if [[ $label ]]
fi
if [[ $directedToExclude == true ]]
then
exclude=""
for i in $excludedFiles
prefix="|"
done
if [[ $exclude ]]
then exclude+=")"
set -- $exclude
fi
fi
esac
true) mode="" ;;
esac
;;
esac
case $# in
0) set "." ;;
esac
;;
esac