Blame autoconf/shtool

Packit Service 5195f2
#!/bin/sh
Packit Service 5195f2
##
Packit Service 5195f2
##  GNU shtool -- The GNU Portable Shell Tool
Packit Service 5195f2
##  Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
##
Packit Service 5195f2
##  See http://www.gnu.org/software/shtool/ for more information.
Packit Service 5195f2
##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
Packit Service 5195f2
##
Packit Service 5195f2
##  Version:  2.0.8 (18-Jul-2008)
Packit Service 5195f2
##  Contents: all available modules
Packit Service 5195f2
##
Packit Service 5195f2
Packit Service 5195f2
##
Packit Service 5195f2
##  This program is free software; you can redistribute it and/or modify
Packit Service 5195f2
##  it under the terms of the GNU General Public License as published by
Packit Service 5195f2
##  the Free Software Foundation; either version 2 of the License, or
Packit Service 5195f2
##  (at your option) any later version.
Packit Service 5195f2
##
Packit Service 5195f2
##  This program is distributed in the hope that it will be useful,
Packit Service 5195f2
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 5195f2
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit Service 5195f2
##  General Public License for more details.
Packit Service 5195f2
##
Packit Service 5195f2
##  You should have received a copy of the GNU General Public License
Packit Service 5195f2
##  along with this program; if not, write to the Free Software
Packit Service 5195f2
##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
Packit Service 5195f2
##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
Packit Service 5195f2
##
Packit Service 5195f2
##  NOTICE: Given that you include this file verbatim into your own
Packit Service 5195f2
##  source tree, you are justified in saying that it remains separate
Packit Service 5195f2
##  from your package, and that this way you are simply just using GNU
Packit Service 5195f2
##  shtool. So, in this situation, there is no requirement that your
Packit Service 5195f2
##  package itself is licensed under the GNU General Public License in
Packit Service 5195f2
##  order to take advantage of GNU shtool.
Packit Service 5195f2
##
Packit Service 5195f2
Packit Service 5195f2
##
Packit Service 5195f2
##  Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]
Packit Service 5195f2
##
Packit Service 5195f2
##  Available commands:
Packit Service 5195f2
##    echo       Print string with optional construct expansion
Packit Service 5195f2
##    mdate      Pretty-print modification time of a file or dir
Packit Service 5195f2
##    table      Pretty-print a field-separated list as a table
Packit Service 5195f2
##    prop       Display progress with a running propeller
Packit Service 5195f2
##    move       Move files with simultaneous substitution
Packit Service 5195f2
##    install    Install a program, script or datafile
Packit Service 5195f2
##    mkdir      Make one or more directories
Packit Service 5195f2
##    mkln       Make link with calculation of relative paths
Packit Service 5195f2
##    mkshadow   Make a shadow tree through symbolic links
Packit Service 5195f2
##    fixperm    Fix file permissions inside a source tree
Packit Service 5195f2
##    rotate     Logfile rotation
Packit Service 5195f2
##    tarball    Roll distribution tarballs
Packit Service 5195f2
##    subst      Apply sed(1) substitution operations
Packit Service 5195f2
##    platform   Platform Identification Utility
Packit Service 5195f2
##    arx        Extended archive command
Packit Service 5195f2
##    slo        Separate linker options by library class
Packit Service 5195f2
##    scpp       Sharing C Pre-Processor
Packit Service 5195f2
##    version    Maintain a version information file
Packit Service 5195f2
##    path       Deal with program paths
Packit Service 5195f2
##
Packit Service 5195f2
Packit Service 5195f2
#   maximum Bourne-Shell compatibility
Packit Service 5195f2
if [ ".$ZSH_VERSION" != . ] && (emulate sh) >/dev/null 2>&1; then
Packit Service 5195f2
    #   reconfigure zsh(1)
Packit Service 5195f2
    emulate sh
Packit Service 5195f2
    NULLCMD=:
Packit Service 5195f2
    alias -g '${1+"$@"}'='"$@"'
Packit Service 5195f2
elif [ ".$BASH_VERSION" != . ] && (set -o posix) >/dev/null 2>&1; then
Packit Service 5195f2
    #   reconfigure bash(1)
Packit Service 5195f2
    set -o posix
Packit Service 5195f2
fi
Packit Service 5195f2
Packit Service 5195f2
#   maximum independence of NLS nuisances
Packit Service 5195f2
for var in \
Packit Service 5195f2
    LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
Packit Service 5195f2
    LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
Packit Service 5195f2
    LC_TELEPHONE LC_TIME
Packit Service 5195f2
do
Packit Service 5195f2
    if (set +x; test -z "`(eval $var=C; export $var) 2>&1`"); then
Packit Service 5195f2
        eval $var=C; export $var
Packit Service 5195f2
    else
Packit Service 5195f2
        unset $var
Packit Service 5195f2
    fi
Packit Service 5195f2
done
Packit Service 5195f2
Packit Service 5195f2
#   initial command line handling
Packit Service 5195f2
if [ $# -eq 0 ]; then
Packit Service 5195f2
    echo "$0:Error: invalid command line" 1>&2
Packit Service 5195f2
    echo "$0:Hint:  run \`$0 -h' for usage" 1>&2
Packit Service 5195f2
    exit 1
Packit Service 5195f2
fi
Packit Service 5195f2
if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then
Packit Service 5195f2
    echo "This is GNU shtool, version 2.0.8 (18-Jul-2008)"
Packit Service 5195f2
    echo 'Copyright (c) 1994-2008 Ralf S. Engelschall <rse@engelschall.com>'
Packit Service 5195f2
    echo 'Report bugs to <bug-shtool@gnu.org>'
Packit Service 5195f2
    echo ''
Packit Service 5195f2
    echo 'Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]'
Packit Service 5195f2
    echo ''
Packit Service 5195f2
    echo 'Available global <options>:'
Packit Service 5195f2
    echo '  -v, --version   display shtool version information'
Packit Service 5195f2
    echo '  -h, --help      display shtool usage help page (this one)'
Packit Service 5195f2
    echo '  -d, --debug     display shell trace information'
Packit Service 5195f2
    echo '  -r, --recreate  recreate this shtool script via shtoolize'
Packit Service 5195f2
    echo ''
Packit Service 5195f2
    echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
Packit Service 5195f2
    echo '  echo     [-n|--newline] [-e|--expand] [<string> ...]'
Packit Service 5195f2
    echo '  mdate    [-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits]'
Packit Service 5195f2
    echo '           [-f|--field-sep <str>] [-o|--order <spec>] <path>'
Packit Service 5195f2
    echo '  table    [-F|--field-sep <sep>] [-w|--width <width>] [-c|--columns'
Packit Service 5195f2
    echo '           <cols>] [-s|--strip <strip>] <str><sep><str>...'
Packit Service 5195f2
    echo '  prop     [-p|--prefix <str>]'
Packit Service 5195f2
    echo '  move     [-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve]'
Packit Service 5195f2
    echo '           <src-file> <dst-file>'
Packit Service 5195f2
    echo '  install  [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]'
Packit Service 5195f2
    echo '           [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>]'
Packit Service 5195f2
    echo '           [-o|--owner <owner>] [-g|--group <group>] [-e|--exec'
Packit Service 5195f2
    echo '           <sed-cmd>] <file> [<file> ...] <path>'
Packit Service 5195f2
    echo '  mkdir    [-t|--trace] [-f|--force] [-p|--parents] [-m|--mode'
Packit Service 5195f2
    echo '           <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir>'
Packit Service 5195f2
    echo '           [<dir> ...]'
Packit Service 5195f2
    echo '  mkln     [-t|--trace] [-f|--force] [-s|--symbolic] <src-path>'
Packit Service 5195f2
    echo '           [<src-path> ...] <dst-path>'
Packit Service 5195f2
    echo '  mkshadow [-v|--verbose] [-t|--trace] [-a|--all] <src-dir> <dst-dir>'
Packit Service 5195f2
    echo '  fixperm  [-v|--verbose] [-t|--trace] <path> [<path> ...]'
Packit Service 5195f2
    echo '  rotate   [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files'
Packit Service 5195f2
    echo '           <count>] [-s|--size <size>] [-c|--copy] [-r|--remove]'
Packit Service 5195f2
    echo '           [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>]'
Packit Service 5195f2
    echo '           [-b|--background] [-d|--delay] [-p|--pad <len>] [-m|--mode'
Packit Service 5195f2
    echo '           <mode>] [-o|--owner <owner>] [-g|--group <group>] [-M|--migrate'
Packit Service 5195f2
    echo '           <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]'
Packit Service 5195f2
    echo '  tarball  [-t|--trace] [-v|--verbose] [-o|--output <tarball>]'
Packit Service 5195f2
    echo '           [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user'
Packit Service 5195f2
    echo '           <user>] [-g|--group <group>] [-e|--exclude <pattern>]'
Packit Service 5195f2
    echo '           <path> [<path> ...]'
Packit Service 5195f2
    echo '  subst    [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning]'
Packit Service 5195f2
    echo '           [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup'
Packit Service 5195f2
    echo '           <ext>] [-e|--exec <cmd>] [-f|--file <cmd-file>] [<file>]'
Packit Service 5195f2
    echo '           [...]'
Packit Service 5195f2
    echo '  platform [-F|--format <format>] [-S|--sep <string>] [-C|--conc'
Packit Service 5195f2
    echo '           <string>] [-L|--lower] [-U|--upper] [-v|--verbose]'
Packit Service 5195f2
    echo '           [-c|--concise] [-n|--no-newline] [-t|--type <type>]'
Packit Service 5195f2
    echo '           [-V|--version] [-h|--help]'
Packit Service 5195f2
    echo '  arx      [-t|--trace] [-C|--command <cmd>] <op> <archive> [<file>'
Packit Service 5195f2
    echo '           ...]'
Packit Service 5195f2
    echo '  slo      [-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib>'
Packit Service 5195f2
    echo '           ...]'
Packit Service 5195f2
    echo '  scpp     [-v|--verbose] [-p|--preserve] [-f|--filter <filter>]'
Packit Service 5195f2
    echo '           [-o|--output <ofile>] [-t|--template <tfile>] [-M|--mark'
Packit Service 5195f2
    echo '           <mark>] [-D|--define <dname>] [-C|--class <cname>]'
Packit Service 5195f2
    echo '           <file> [<file> ...]'
Packit Service 5195f2
    echo '  version  [-l|--language <lang>] [-n|--name <name>] [-p|--prefix'
Packit Service 5195f2
    echo '           <prefix>] [-s|--set <version>] [-e|--edit] [-i|--increase'
Packit Service 5195f2
    echo '           <knob>] [-d|--display <type>] <file>'
Packit Service 5195f2
    echo '  path     [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename]'
Packit Service 5195f2
    echo '           [-m|--magic] [-p|--path <path>] <str> [<str> ...]'
Packit Service 5195f2
    echo ''
Packit Service 5195f2
    exit 0
Packit Service 5195f2
fi
Packit Service 5195f2
if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then
Packit Service 5195f2
    echo "GNU shtool 2.0.8 (18-Jul-2008)"
Packit Service 5195f2
    exit 0
Packit Service 5195f2
fi
Packit Service 5195f2
if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then
Packit Service 5195f2
    shtoolize -oshtool all
Packit Service 5195f2
    exit 0
Packit Service 5195f2
fi
Packit Service 5195f2
if [ ".$1" = ".-d" ] || [ ".$1" = ".--debug" ]; then
Packit Service 5195f2
    shift
Packit Service 5195f2
    set -x
Packit Service 5195f2
fi
Packit Service 5195f2
name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'`
Packit Service 5195f2
case "$name" in
Packit Service 5195f2
    echo|mdate|table|prop|move|install|mkdir|mkln|mkshadow|fixperm|rotate|tarball|subst|platform|arx|slo|scpp|version|path )
Packit Service 5195f2
        #   implicit tool command selection
Packit Service 5195f2
        tool="$name"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    * )
Packit Service 5195f2
        #   explicit tool command selection
Packit Service 5195f2
        tool="$1"
Packit Service 5195f2
        shift
Packit Service 5195f2
        ;;
Packit Service 5195f2
esac
Packit Service 5195f2
arg_spec=""
Packit Service 5195f2
opt_spec=""
Packit Service 5195f2
gen_tmpfile=no
Packit Service 5195f2
Packit Service 5195f2
##
Packit Service 5195f2
##  DISPATCH INTO SCRIPT PROLOG
Packit Service 5195f2
##
Packit Service 5195f2
Packit Service 5195f2
case $tool in
Packit Service 5195f2
    echo )
Packit Service 5195f2
        str_tool="echo"
Packit Service 5195f2
        str_usage="[-n|--newline] [-e|--expand] [<string> ...]"
Packit Service 5195f2
        arg_spec="0+"
Packit Service 5195f2
        opt_spec="n.e."
Packit Service 5195f2
        opt_alias="n:newline,e:expand"
Packit Service 5195f2
        opt_n=no
Packit Service 5195f2
        opt_e=no
Packit Service 5195f2
        ;;
Packit Service 5195f2
    mdate )
Packit Service 5195f2
        str_tool="mdate"
Packit Service 5195f2
        str_usage="[-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits] [-f|--field-sep <str>] [-o|--order <spec>] <path>"
Packit Service 5195f2
        arg_spec="1="
Packit Service 5195f2
        opt_spec="n.z.s.d.f:o:"
Packit Service 5195f2
        opt_alias="n:newline,z:zero,s:shorten,d:digits,f:field-sep,o:order"
Packit Service 5195f2
        opt_n=no
Packit Service 5195f2
        opt_z=no
Packit Service 5195f2
        opt_s=no
Packit Service 5195f2
        opt_d=no
Packit Service 5195f2
        opt_f=" "
Packit Service 5195f2
        opt_o="dmy"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    table )
Packit Service 5195f2
        str_tool="table"
Packit Service 5195f2
        str_usage="[-F|--field-sep <sep>] [-w|--width <width>] [-c|--columns <cols>] [-s|--strip <strip>] <str><sep><str>..."
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="F:w:c:s:"
Packit Service 5195f2
        opt_alias="F:field-sep,w:width,c:columns,s:strip"
Packit Service 5195f2
        opt_F=":"
Packit Service 5195f2
        opt_w=15
Packit Service 5195f2
        opt_c=3
Packit Service 5195f2
        opt_s=79
Packit Service 5195f2
        ;;
Packit Service 5195f2
    prop )
Packit Service 5195f2
        str_tool="prop"
Packit Service 5195f2
        str_usage="[-p|--prefix <str>]"
Packit Service 5195f2
        arg_spec="0="
Packit Service 5195f2
        opt_spec="p:"
Packit Service 5195f2
        opt_alias="p:prefix"
Packit Service 5195f2
        opt_p=""
Packit Service 5195f2
        ;;
Packit Service 5195f2
    move )
Packit Service 5195f2
        str_tool="move"
Packit Service 5195f2
        str_usage="[-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve] <src-file> <dst-file>"
Packit Service 5195f2
        arg_spec="2="
Packit Service 5195f2
        opt_spec="v.t.e.p."
Packit Service 5195f2
        opt_alias="v:verbose,t:trace,e:expand,p:preserve"
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_e=no
Packit Service 5195f2
        opt_p=no
Packit Service 5195f2
        ;;
Packit Service 5195f2
    install )
Packit Service 5195f2
        str_tool="install"
Packit Service 5195f2
        str_usage="[-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] [-e|--exec <sed-cmd>] <file> [<file> ...] <path>"
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="v.t.d.c.C.s.m:o:g:e+"
Packit Service 5195f2
        opt_alias="v:verbose,t:trace,d:mkdir,c:copy,C:compare-copy,s:strip,m:mode,o:owner,g:group,e:exec"
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_d=no
Packit Service 5195f2
        opt_c=no
Packit Service 5195f2
        opt_C=no
Packit Service 5195f2
        opt_s=no
Packit Service 5195f2
        opt_m="0755"
Packit Service 5195f2
        opt_o=""
Packit Service 5195f2
        opt_g=""
Packit Service 5195f2
        opt_e=""
Packit Service 5195f2
        ;;
Packit Service 5195f2
    mkdir )
Packit Service 5195f2
        str_tool="mkdir"
Packit Service 5195f2
        str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] <dir> [<dir> ...]"
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="t.f.p.m:o:g:"
Packit Service 5195f2
        opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group"
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_f=no
Packit Service 5195f2
        opt_p=no
Packit Service 5195f2
        opt_m=""
Packit Service 5195f2
        opt_o=""
Packit Service 5195f2
        opt_g=""
Packit Service 5195f2
        ;;
Packit Service 5195f2
    mkln )
Packit Service 5195f2
        str_tool="mkln"
Packit Service 5195f2
        str_usage="[-t|--trace] [-f|--force] [-s|--symbolic] <src-path> [<src-path> ...] <dst-path>"
Packit Service 5195f2
        arg_spec="2+"
Packit Service 5195f2
        opt_spec="t.f.s."
Packit Service 5195f2
        opt_alias="t:trace,f:force,s:symbolic"
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_f=no
Packit Service 5195f2
        opt_s=no
Packit Service 5195f2
        ;;
Packit Service 5195f2
    mkshadow )
Packit Service 5195f2
        str_tool="mkshadow"
Packit Service 5195f2
        str_usage="[-v|--verbose] [-t|--trace] [-a|--all] <src-dir> <dst-dir>"
Packit Service 5195f2
        arg_spec="2="
Packit Service 5195f2
        opt_spec="v.t.a."
Packit Service 5195f2
        opt_alias="v:verbose,t:trace,a:all"
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_a=no
Packit Service 5195f2
        ;;
Packit Service 5195f2
    fixperm )
Packit Service 5195f2
        str_tool="fixperm"
Packit Service 5195f2
        str_usage="[-v|--verbose] [-t|--trace] <path> [<path> ...]"
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="v.t."
Packit Service 5195f2
        opt_alias="v:verbose,t:trace"
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        ;;
Packit Service 5195f2
    rotate )
Packit Service 5195f2
        str_tool="rotate"
Packit Service 5195f2
        str_usage="[-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files <count>] [-s|--size <size>] [-c|--copy] [-r|--remove] [-a|--archive-dir <dir>] [-z|--compress [<tool>:]<level>] [-b|--background] [-d|--delay] [-p|--pad <len>] [-m|--mode <mode>] [-o|--owner <owner>] [-g|--group <group>] [-M|--migrate <cmd>] [-P|--prolog <cmd>] [-E|--epilog <cmd>] <file> [...]"
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="v.t.f.n:s:c.r.a:z:b.d.p:o:g:m:M:P:E:"
Packit Service 5195f2
        opt_alias="v:verbose,t:trace,f:force,n:num-files,s:size,c:copy,r:remove,a:archive-dir,z:compress,b:background,d:delay,p:pad,o:owner,g:group,m:mode,M:migrate,P:prolog,E:epilog"
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_f=no
Packit Service 5195f2
        opt_n=10
Packit Service 5195f2
        opt_s=""
Packit Service 5195f2
        opt_c=no
Packit Service 5195f2
        opt_r=no
Packit Service 5195f2
        opt_a=""
Packit Service 5195f2
        opt_z=""
Packit Service 5195f2
        opt_b=no
Packit Service 5195f2
        opt_d=no
Packit Service 5195f2
        opt_p=1
Packit Service 5195f2
        opt_o=""
Packit Service 5195f2
        opt_g=""
Packit Service 5195f2
        opt_m=""
Packit Service 5195f2
        opt_M=""
Packit Service 5195f2
        opt_P=""
Packit Service 5195f2
        opt_E=""
Packit Service 5195f2
        ;;
Packit Service 5195f2
    tarball )
Packit Service 5195f2
        str_tool="tarball"
Packit Service 5195f2
        str_usage="[-t|--trace] [-v|--verbose] [-o|--output <tarball>] [-c|--compress <prog>] [-d|--directory <dir>] [-u|--user <user>] [-g|--group <group>] [-e|--exclude <pattern>] <path> [<path> ...]"
Packit Service 5195f2
        gen_tmpfile=yes
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="t.v.o:c:d:u:g:e:"
Packit Service 5195f2
        opt_alias="t:trace,v:verbose,o:output,c:compress,d:directory,u:user,g:group,e:exclude"
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_o=""
Packit Service 5195f2
        opt_c=""
Packit Service 5195f2
        opt_d=""
Packit Service 5195f2
        opt_u=""
Packit Service 5195f2
        opt_g=""
Packit Service 5195f2
        opt_e="CVS,\\.cvsignore,\\.svn,\\.[oa]\$"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    subst )
Packit Service 5195f2
        str_tool="subst"
Packit Service 5195f2
        str_usage="[-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup <ext>] [-e|--exec <cmd>] [-f|--file <cmd-file>] [<file>] [...]"
Packit Service 5195f2
        gen_tmpfile=yes
Packit Service 5195f2
        arg_spec="0+"
Packit Service 5195f2
        opt_spec="v.t.n.w.q.s.i.b:e+f:"
Packit Service 5195f2
        opt_alias="v:verbose,t:trace,n:nop,w:warning,q:quiet,s:stealth,i:interactive,b:backup,e:exec,f:file"
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_n=no
Packit Service 5195f2
        opt_w=no
Packit Service 5195f2
        opt_q=no
Packit Service 5195f2
        opt_s=no
Packit Service 5195f2
        opt_i=no
Packit Service 5195f2
        opt_b=""
Packit Service 5195f2
        opt_e=""
Packit Service 5195f2
        opt_f=""
Packit Service 5195f2
        ;;
Packit Service 5195f2
    platform )
Packit Service 5195f2
        str_tool="platform"
Packit Service 5195f2
        str_usage="[-F|--format <format>] [-S|--sep <string>] [-C|--conc <string>] [-L|--lower] [-U|--upper] [-v|--verbose] [-c|--concise] [-n|--no-newline] [-t|--type <type>] [-V|--version] [-h|--help]"
Packit Service 5195f2
        arg_spec="0="
Packit Service 5195f2
        opt_spec="F:S:C:L.U.v.c.n.t:d.V.h."
Packit Service 5195f2
        opt_alias="F:format,S:sep,C:conc,L:lower,U:upper,v:verbose,c:consise,t:type,n:no-newline,V:version,h:help"
Packit Service 5195f2
        opt_F="%{sp} (%{ap})"
Packit Service 5195f2
        opt_S=" "
Packit Service 5195f2
        opt_C="/"
Packit Service 5195f2
        opt_L=no
Packit Service 5195f2
        opt_U=no
Packit Service 5195f2
        opt_t=""
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_c=no
Packit Service 5195f2
        opt_n=no
Packit Service 5195f2
        opt_V=no
Packit Service 5195f2
        opt_h=no
Packit Service 5195f2
        ;;
Packit Service 5195f2
    arx )
Packit Service 5195f2
        str_tool="arx"
Packit Service 5195f2
        str_usage="[-t|--trace] [-C|--command <cmd>] <op> <archive> [<file> ...]"
Packit Service 5195f2
        arg_spec="2+"
Packit Service 5195f2
        opt_spec="t.C:"
Packit Service 5195f2
        opt_alias="t:trace,C:command"
Packit Service 5195f2
        opt_t=no
Packit Service 5195f2
        opt_C="ar"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    slo )
Packit Service 5195f2
        str_tool="slo"
Packit Service 5195f2
        str_usage="[-p|--prefix <str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]"
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="p:"
Packit Service 5195f2
        opt_alias="p:prefix"
Packit Service 5195f2
        opt_p="SLO_"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    scpp )
Packit Service 5195f2
        str_tool="scpp"
Packit Service 5195f2
        str_usage="[-v|--verbose] [-p|--preserve] [-f|--filter <filter>] [-o|--output <ofile>] [-t|--template <tfile>] [-M|--mark <mark>] [-D|--define <dname>] [-C|--class <cname>] <file> [<file> ...]"
Packit Service 5195f2
        gen_tmpfile=yes
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="v.p.f+o:t:M:D:C:"
Packit Service 5195f2
        opt_alias="v:verbose,p:preserve,f:filter,o:output,t:template,M:mark,D:define,C:class"
Packit Service 5195f2
        opt_v=no
Packit Service 5195f2
        opt_p=no
Packit Service 5195f2
        opt_f=""
Packit Service 5195f2
        opt_o="lib.h"
Packit Service 5195f2
        opt_t="lib.h.in"
Packit Service 5195f2
        opt_M="%%MARK%%"
Packit Service 5195f2
        opt_D="cpp"
Packit Service 5195f2
        opt_C="intern"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    version )
Packit Service 5195f2
        str_tool="version"
Packit Service 5195f2
        str_usage="[-l|--language <lang>] [-n|--name <name>] [-p|--prefix <prefix>] [-s|--set <version>] [-e|--edit] [-i|--increase <knob>] [-d|--display <type>] <file>"
Packit Service 5195f2
        arg_spec="1="
Packit Service 5195f2
        opt_spec="l:n:p:s:i:e.d:"
Packit Service 5195f2
        opt_alias="l:language,n:name,p:prefix,s:set,e:edit,i:increase,d:display"
Packit Service 5195f2
        opt_l="txt"
Packit Service 5195f2
        opt_n="unknown"
Packit Service 5195f2
        opt_p=""
Packit Service 5195f2
        opt_s=""
Packit Service 5195f2
        opt_e="no"
Packit Service 5195f2
        opt_i=""
Packit Service 5195f2
        opt_d="short"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    path )
Packit Service 5195f2
        str_tool="path"
Packit Service 5195f2
        str_usage="[-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path <path>] <str> [<str> ...]"
Packit Service 5195f2
        gen_tmpfile=yes
Packit Service 5195f2
        arg_spec="1+"
Packit Service 5195f2
        opt_spec="s.r.d.b.m.p:"
Packit Service 5195f2
        opt_alias="s:suppress,r:reverse,d:dirname,b:basename,m:magic,p:path"
Packit Service 5195f2
        opt_s=no
Packit Service 5195f2
        opt_r=no
Packit Service 5195f2
        opt_d=no
Packit Service 5195f2
        opt_b=no
Packit Service 5195f2
        opt_m=no
Packit Service 5195f2
        opt_p="$PATH"
Packit Service 5195f2
        ;;
Packit Service 5195f2
    -* )
Packit Service 5195f2
        echo "$0:Error: unknown option \`$tool'" 2>&1
Packit Service 5195f2
        echo "$0:Hint:  run \`$0 -h' for usage" 2>&1
Packit Service 5195f2
        exit 1
Packit Service 5195f2
        ;;
Packit Service 5195f2
    * )
Packit Service 5195f2
        echo "$0:Error: unknown command \`$tool'" 2>&1
Packit Service 5195f2
        echo "$0:Hint:  run \`$0 -h' for usage" 2>&1
Packit Service 5195f2
        exit 1
Packit Service 5195f2
        ;;
Packit Service 5195f2
esac
Packit Service 5195f2
Packit Service 5195f2
##
Packit Service 5195f2
##  COMMON UTILITY CODE
Packit Service 5195f2
##
Packit Service 5195f2
Packit Service 5195f2
#   commonly used ASCII values
Packit Service 5195f2
ASC_TAB="	"
Packit Service 5195f2
ASC_NL="
Packit Service 5195f2
"
Packit Service 5195f2
Packit Service 5195f2
#   determine name of tool
Packit Service 5195f2
if [ ".$tool" != . ]; then
Packit Service 5195f2
    #   used inside shtool script
Packit Service 5195f2
    toolcmd="$0 $tool"
Packit Service 5195f2
    toolcmdhelp="shtool $tool"
Packit Service 5195f2
    msgprefix="shtool:$tool"
Packit Service 5195f2
else
Packit Service 5195f2
    #   used as standalone script
Packit Service 5195f2
    toolcmd="$0"
Packit Service 5195f2
    toolcmdhelp="sh $0"
Packit Service 5195f2
    msgprefix="$str_tool"
Packit Service 5195f2
fi
Packit Service 5195f2
Packit Service 5195f2
#   parse argument specification string
Packit Service 5195f2
eval `echo $arg_spec |\
Packit Service 5195f2
      sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
Packit Service 5195f2
Packit Service 5195f2
#   parse option specification string
Packit Service 5195f2
eval `echo h.$opt_spec |\
Packit Service 5195f2
      sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
Packit Service 5195f2
Packit Service 5195f2
#   parse option alias string
Packit Service 5195f2
eval `echo h:help,$opt_alias |\
Packit Service 5195f2
      sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'`
Packit Service 5195f2
Packit Service 5195f2
#   interate over argument line
Packit Service 5195f2
opt_PREV=''
Packit Service 5195f2
while [ $# -gt 0 ]; do
Packit Service 5195f2
    #   special option stops processing
Packit Service 5195f2
    if [ ".$1" = ".--" ]; then
Packit Service 5195f2
        shift
Packit Service 5195f2
        break
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine option and argument
Packit Service 5195f2
    opt_ARG_OK=no
Packit Service 5195f2
    if [ ".$opt_PREV" != . ]; then
Packit Service 5195f2
        #   merge previous seen option with argument
Packit Service 5195f2
        opt_OPT="$opt_PREV"
Packit Service 5195f2
        opt_ARG="$1"
Packit Service 5195f2
        opt_ARG_OK=yes
Packit Service 5195f2
        opt_PREV=''
Packit Service 5195f2
    else
Packit Service 5195f2
        #   split argument into option and argument
Packit Service 5195f2
        case "$1" in
Packit Service 5195f2
            --[a-zA-Z0-9]*=*)
Packit Service 5195f2
                eval `echo "x$1" |\
Packit Service 5195f2
                      sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'`
Packit Service 5195f2
                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
Packit Service 5195f2
                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
Packit Service 5195f2
                ;;
Packit Service 5195f2
            --[a-zA-Z0-9]*)
Packit Service 5195f2
                opt_OPT=`echo "x$1" | cut -c4-`
Packit Service 5195f2
                opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'`
Packit Service 5195f2
                eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}"
Packit Service 5195f2
                opt_ARG=''
Packit Service 5195f2
                ;;
Packit Service 5195f2
            -[a-zA-Z0-9]*)
Packit Service 5195f2
                eval `echo "x$1" |\
Packit Service 5195f2
                      sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
Packit Service 5195f2
                          -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
Packit Service 5195f2
                ;;
Packit Service 5195f2
            -[a-zA-Z0-9])
Packit Service 5195f2
                opt_OPT=`echo "x$1" | cut -c3-`
Packit Service 5195f2
                opt_ARG=''
Packit Service 5195f2
                ;;
Packit Service 5195f2
            *)
Packit Service 5195f2
                break
Packit Service 5195f2
                ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   eat up option
Packit Service 5195f2
    shift
Packit Service 5195f2
Packit Service 5195f2
    #   determine whether option needs an argument
Packit Service 5195f2
    eval "opt_MODE=\$opt_MODE_${opt_OPT}"
Packit Service 5195f2
    if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then
Packit Service 5195f2
        if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then
Packit Service 5195f2
            opt_PREV="$opt_OPT"
Packit Service 5195f2
            continue
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   process option
Packit Service 5195f2
    case $opt_MODE in
Packit Service 5195f2
        '.' )
Packit Service 5195f2
            #   boolean option
Packit Service 5195f2
            eval "opt_${opt_OPT}=yes"
Packit Service 5195f2
            ;;
Packit Service 5195f2
        ':' )
Packit Service 5195f2
            #   option with argument (multiple occurances override)
Packit Service 5195f2
            eval "opt_${opt_OPT}=\"\$opt_ARG\""
Packit Service 5195f2
            ;;
Packit Service 5195f2
        '+' )
Packit Service 5195f2
            #   option with argument (multiple occurances append)
Packit Service 5195f2
            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\""
Packit Service 5195f2
            ;;
Packit Service 5195f2
        * )
Packit Service 5195f2
            echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2
Packit Service 5195f2
            echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
Packit Service 5195f2
            exit 1
Packit Service 5195f2
            ;;
Packit Service 5195f2
    esac
Packit Service 5195f2
done
Packit Service 5195f2
if [ ".$opt_PREV" != . ]; then
Packit Service 5195f2
    echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2
Packit Service 5195f2
    echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
Packit Service 5195f2
    exit 1
Packit Service 5195f2
fi
Packit Service 5195f2
Packit Service 5195f2
#   process help option
Packit Service 5195f2
if [ ".$opt_h" = .yes ]; then
Packit Service 5195f2
    echo "Usage: $toolcmdhelp $str_usage"
Packit Service 5195f2
    exit 0
Packit Service 5195f2
fi
Packit Service 5195f2
Packit Service 5195f2
#   complain about incorrect number of arguments
Packit Service 5195f2
case $arg_MODE in
Packit Service 5195f2
    '=' )
Packit Service 5195f2
        if [ $# -ne $arg_NUMS ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
Packit Service 5195f2
            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man shtool' for details" 1>&2
Packit Service 5195f2
            exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
        ;;
Packit Service 5195f2
    '+' )
Packit Service 5195f2
        if [ $# -lt $arg_NUMS ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
Packit Service 5195f2
            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man shtool' for details" 1>&2
Packit Service 5195f2
            exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
        ;;
Packit Service 5195f2
esac
Packit Service 5195f2
Packit Service 5195f2
#   establish a temporary file on request
Packit Service 5195f2
if [ ".$gen_tmpfile" = .yes ]; then
Packit Service 5195f2
    #   create (explicitly) secure temporary directory
Packit Service 5195f2
    if [ ".$TMPDIR" != . ]; then
Packit Service 5195f2
        tmpdir="$TMPDIR"
Packit Service 5195f2
    elif [ ".$TEMPDIR" != . ]; then
Packit Service 5195f2
        tmpdir="$TEMPDIR"
Packit Service 5195f2
    else
Packit Service 5195f2
        tmpdir="/tmp"
Packit Service 5195f2
    fi
Packit Service 5195f2
    tmpdir="$tmpdir/.shtool.$$"
Packit Service 5195f2
    ( umask 077
Packit Service 5195f2
      rm -rf "$tmpdir" >/dev/null 2>&1 || true
Packit Service 5195f2
      mkdir  "$tmpdir" >/dev/null 2>&1
Packit Service 5195f2
      if [ $? -ne 0 ]; then
Packit Service 5195f2
          echo "$msgprefix:Error: failed to create temporary directory \`$tmpdir'" 1>&2
Packit Service 5195f2
          exit 1
Packit Service 5195f2
      fi
Packit Service 5195f2
    )
Packit Service 5195f2
Packit Service 5195f2
    #   create (implicitly) secure temporary file
Packit Service 5195f2
    tmpfile="$tmpdir/shtool.tmp"
Packit Service 5195f2
    touch "$tmpfile"
Packit Service 5195f2
fi
Packit Service 5195f2
Packit Service 5195f2
#   utility function: map string to lower case
Packit Service 5195f2
util_lower () {
Packit Service 5195f2
    echo "$1" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
Packit Service 5195f2
}
Packit Service 5195f2
Packit Service 5195f2
#   utility function: map string to upper case
Packit Service 5195f2
util_upper () {
Packit Service 5195f2
    echo "$1" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Packit Service 5195f2
}
Packit Service 5195f2
Packit Service 5195f2
#   cleanup procedure
Packit Service 5195f2
shtool_exit () {
Packit Service 5195f2
    rc="$1"
Packit Service 5195f2
    if [ ".$gen_tmpfile" = .yes ]; then
Packit Service 5195f2
        rm -rf "$tmpdir" >/dev/null 2>&1 || true
Packit Service 5195f2
    fi
Packit Service 5195f2
    exit $rc
Packit Service 5195f2
}
Packit Service 5195f2
Packit Service 5195f2
##
Packit Service 5195f2
##  DISPATCH INTO SCRIPT BODY
Packit Service 5195f2
##
Packit Service 5195f2
Packit Service 5195f2
case $tool in
Packit Service 5195f2
Packit Service 5195f2
echo )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  echo -- Print string with optional construct expansion
Packit Service 5195f2
    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    text="$*"
Packit Service 5195f2
Packit Service 5195f2
    #   check for broken escape sequence expansion
Packit Service 5195f2
    seo=''
Packit Service 5195f2
    bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
Packit Service 5195f2
    if [ ".$bytes" != .3 ]; then
Packit Service 5195f2
        bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
Packit Service 5195f2
        if [ ".$bytes" = .3 ]; then
Packit Service 5195f2
            seo='-E'
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   check for existing -n option (to suppress newline)
Packit Service 5195f2
    minusn=''
Packit Service 5195f2
    bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
Packit Service 5195f2
    if [ ".$bytes" = .3 ]; then
Packit Service 5195f2
        minusn='-n'
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine terminal bold sequence
Packit Service 5195f2
    term_bold=''
Packit Service 5195f2
    term_norm=''
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[Bb]'`" != . ]; then
Packit Service 5195f2
        case $TERM in
Packit Service 5195f2
            #   for the most important terminal types we directly know the sequences
Packit Service 5195f2
            xterm|xterm*|vt220|vt220*)
Packit Service 5195f2
                term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
Packit Service 5195f2
                term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
Packit Service 5195f2
                ;;
Packit Service 5195f2
            vt100|vt100*|cygwin)
Packit Service 5195f2
                term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
Packit Service 5195f2
                term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
Packit Service 5195f2
                ;;
Packit Service 5195f2
            #   for all others, we try to use a possibly existing `tput' or `tcout' utility
Packit Service 5195f2
            * )
Packit Service 5195f2
                paths=`echo $PATH | sed -e 's/:/ /g'`
Packit Service 5195f2
                for tool in tput tcout; do
Packit Service 5195f2
                    for dir in $paths; do
Packit Service 5195f2
                        if [ -r "$dir/$tool" ]; then
Packit Service 5195f2
                            for seq in bold md smso; do # 'smso' is last
Packit Service 5195f2
                                bold="`$dir/$tool $seq 2>/dev/null`"
Packit Service 5195f2
                                if [ ".$bold" != . ]; then
Packit Service 5195f2
                                    term_bold="$bold"
Packit Service 5195f2
                                    break
Packit Service 5195f2
                                fi
Packit Service 5195f2
                            done
Packit Service 5195f2
                            if [ ".$term_bold" != . ]; then
Packit Service 5195f2
                                for seq in sgr0 me rmso init reset; do # 'reset' is last
Packit Service 5195f2
                                    norm="`$dir/$tool $seq 2>/dev/null`"
Packit Service 5195f2
                                    if [ ".$norm" != . ]; then
Packit Service 5195f2
                                        term_norm="$norm"
Packit Service 5195f2
                                        break
Packit Service 5195f2
                                    fi
Packit Service 5195f2
                                done
Packit Service 5195f2
                            fi
Packit Service 5195f2
                            break
Packit Service 5195f2
                        fi
Packit Service 5195f2
                    done
Packit Service 5195f2
                    if [ ".$term_bold" != . ] && [ ".$term_norm" != . ]; then
Packit Service 5195f2
                        break;
Packit Service 5195f2
                    fi
Packit Service 5195f2
                done
Packit Service 5195f2
                ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
        if [ ".$term_bold" = . ] || [ ".$term_norm" = . ]; then
Packit Service 5195f2
            echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
Packit Service 5195f2
            term_bold=''
Packit Service 5195f2
            term_norm=''
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine user name
Packit Service 5195f2
    username=''
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[uUgG]'`" != . ]; then
Packit Service 5195f2
        username="`(id -un) 2>/dev/null`"
Packit Service 5195f2
        if [ ".$username" = . ]; then
Packit Service 5195f2
            str="`(id) 2>/dev/null`"
Packit Service 5195f2
            if [ ".`echo $str | grep '^uid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
Packit Service 5195f2
                username=`echo $str | sed -e 's/^uid[ 	]*=[ 	]*[0-9]*(//' -e 's/).*$//'`
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$username" = . ]; then
Packit Service 5195f2
                username="$LOGNAME"
Packit Service 5195f2
                if [ ".$username" = . ]; then
Packit Service 5195f2
                    username="$USER"
Packit Service 5195f2
                    if [ ".$username" = . ]; then
Packit Service 5195f2
                        username="`(whoami) 2>/dev/null |\
Packit Service 5195f2
                                   awk '{ printf("%s", $1); }'`"
Packit Service 5195f2
                        if [ ".$username" = . ]; then
Packit Service 5195f2
                            username="`(who am i) 2>/dev/null |\
Packit Service 5195f2
                                       awk '{ printf("%s", $1); }'`"
Packit Service 5195f2
                            if [ ".$username" = . ]; then
Packit Service 5195f2
                                username='unknown'
Packit Service 5195f2
                            fi
Packit Service 5195f2
                        fi
Packit Service 5195f2
                    fi
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine user id
Packit Service 5195f2
    userid=''
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%U'`" != . ]; then
Packit Service 5195f2
        userid="`(id -u) 2>/dev/null`"
Packit Service 5195f2
        if [ ".$userid" = . ]; then
Packit Service 5195f2
            userid="`(id -u ${username}) 2>/dev/null`"
Packit Service 5195f2
            if [ ".$userid" = . ]; then
Packit Service 5195f2
                str="`(id) 2>/dev/null`"
Packit Service 5195f2
                if [ ".`echo $str | grep '^uid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
Packit Service 5195f2
                    userid=`echo $str | sed -e 's/^uid[ 	]*=[ 	]*//' -e 's/(.*$//'`
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$userid" = . ]; then
Packit Service 5195f2
                    userid=`(getent passwd ${username}) 2>/dev/null | \
Packit Service 5195f2
                            sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                    if [ ".$userid" = . ]; then
Packit Service 5195f2
                        userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
Packit Service 5195f2
                                sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                        if [ ".$userid" = . ]; then
Packit Service 5195f2
                            userid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
Packit Service 5195f2
                                    sed -e 'q' | sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                            if [ ".$userid" = . ]; then
Packit Service 5195f2
                                userid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
Packit Service 5195f2
                                        sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                                if [ ".$userid" = . ]; then
Packit Service 5195f2
                                    userid='?'
Packit Service 5195f2
                                fi
Packit Service 5195f2
                            fi
Packit Service 5195f2
                        fi
Packit Service 5195f2
                    fi
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine (primary) group id
Packit Service 5195f2
    groupid=''
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[gG]'`" != . ]; then
Packit Service 5195f2
        groupid="`(id -g ${username}) 2>/dev/null`"
Packit Service 5195f2
        if [ ".$groupid" = . ]; then
Packit Service 5195f2
            str="`(id) 2>/dev/null`"
Packit Service 5195f2
            if [ ".`echo $str | grep 'gid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
Packit Service 5195f2
                groupid=`echo $str | sed -e 's/^.*gid[ 	]*=[ 	]*//' -e 's/(.*$//'`
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$groupid" = . ]; then
Packit Service 5195f2
                groupid=`(getent passwd ${username}) 2>/dev/null | \
Packit Service 5195f2
                         sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                if [ ".$groupid" = . ]; then
Packit Service 5195f2
                    groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \
Packit Service 5195f2
                             sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                    if [ ".$groupid" = . ]; then
Packit Service 5195f2
                        groupid=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \
Packit Service 5195f2
                                 sed -e 'q' | sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                        if [ ".$groupid" = . ]; then
Packit Service 5195f2
                            groupid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \
Packit Service 5195f2
                                     sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'`
Packit Service 5195f2
                            if [ ".$groupid" = . ]; then
Packit Service 5195f2
                                groupid='?'
Packit Service 5195f2
                            fi
Packit Service 5195f2
                        fi
Packit Service 5195f2
                    fi
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine (primary) group name
Packit Service 5195f2
    groupname=''
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%g'`" != . ]; then
Packit Service 5195f2
        groupname="`(id -gn ${username}) 2>/dev/null`"
Packit Service 5195f2
        if [ ".$groupname" = . ]; then
Packit Service 5195f2
            str="`(id) 2>/dev/null`"
Packit Service 5195f2
            if [ ".`echo $str | grep 'gid[ 	]*=[ 	]*[0-9]*('`" != . ]; then
Packit Service 5195f2
                groupname=`echo $str | sed -e 's/^.*gid[ 	]*=[ 	]*[0-9]*(//' -e 's/).*$//'`
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$groupname" = . ]; then
Packit Service 5195f2
                groupname=`(getent group) 2>/dev/null | \
Packit Service 5195f2
                           grep "^[^:]*:[^:]*:${groupid}:" | \
Packit Service 5195f2
                           sed -e 's/:.*$//'`
Packit Service 5195f2
                if [ ".$groupname" = . ]; then
Packit Service 5195f2
                    groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \
Packit Service 5195f2
                               sed -e 's/:.*$//'`
Packit Service 5195f2
                    if [ ".$groupname" = . ]; then
Packit Service 5195f2
                        groupname=`(ypcat group; niscat group) 2>/dev/null | \
Packit Service 5195f2
                                   sed -e 'q' | grep "^[^:]*:[^:]*:${groupid}:" | \
Packit Service 5195f2
                                   sed -e 's/:.*$//'`
Packit Service 5195f2
                        if [ ".$groupname" = . ]; then
Packit Service 5195f2
                            groupname=`(nidump group .) 2>/dev/null | \
Packit Service 5195f2
                                       grep "^[^:]*:[^:]*:${groupid}:" | \
Packit Service 5195f2
                                       sed -e 's/:.*$//'`
Packit Service 5195f2
                            if [ ".$groupname" = . ]; then
Packit Service 5195f2
                                groupname='?'
Packit Service 5195f2
                            fi
Packit Service 5195f2
                        fi
Packit Service 5195f2
                    fi
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine host and domain name
Packit Service 5195f2
    hostname=''
Packit Service 5195f2
    domainname=''
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%h'`" != . ]; then
Packit Service 5195f2
        hostname="`(uname -n) 2>/dev/null |\
Packit Service 5195f2
                   awk '{ printf("%s", $1); }'`"
Packit Service 5195f2
        if [ ".$hostname" = . ]; then
Packit Service 5195f2
            hostname="`(hostname) 2>/dev/null |\
Packit Service 5195f2
                       awk '{ printf("%s", $1); }'`"
Packit Service 5195f2
            if [ ".$hostname" = . ]; then
Packit Service 5195f2
                hostname='unknown'
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
        case $hostname in
Packit Service 5195f2
            *.* )
Packit Service 5195f2
                domainname=".`echo $hostname | cut -d. -f2-`"
Packit Service 5195f2
                hostname="`echo $hostname | cut -d. -f1`"
Packit Service 5195f2
                ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    fi
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%d'`" != . ]; then
Packit Service 5195f2
        if [ ".$domainname" = . ]; then
Packit Service 5195f2
            if [ -f /etc/resolv.conf ]; then
Packit Service 5195f2
                domainname="`grep '^[ 	]*domain' /etc/resolv.conf | sed -e 'q' |\
Packit Service 5195f2
                             sed -e 's/.*domain//' \
Packit Service 5195f2
                                 -e 's/^[ 	]*//' -e 's/^ *//' -e 's/^	*//' \
Packit Service 5195f2
                                 -e 's/^\.//' -e 's/^/./' |\
Packit Service 5195f2
                             awk '{ printf("%s", $1); }'`"
Packit Service 5195f2
                if [ ".$domainname" = . ]; then
Packit Service 5195f2
                    domainname="`grep '^[ 	]*search' /etc/resolv.conf | sed -e 'q' |\
Packit Service 5195f2
                                 sed -e 's/.*search//' \
Packit Service 5195f2
                                     -e 's/^[ 	]*//' -e 's/^ *//' -e 's/^	*//' \
Packit Service 5195f2
                                     -e 's/ .*//' -e 's/	.*//' \
Packit Service 5195f2
                                     -e 's/^\.//' -e 's/^/./' |\
Packit Service 5195f2
                                 awk '{ printf("%s", $1); }'`"
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine current time
Packit Service 5195f2
    time_day=''
Packit Service 5195f2
    time_month=''
Packit Service 5195f2
    time_year=''
Packit Service 5195f2
    time_monthname=''
Packit Service 5195f2
    if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[DMYm]'`" != . ]; then
Packit Service 5195f2
        time_day=`date '+%d'`
Packit Service 5195f2
        time_month=`date '+%m'`
Packit Service 5195f2
        time_year=`date '+%Y' 2>/dev/null`
Packit Service 5195f2
        if [ ".$time_year" = . ]; then
Packit Service 5195f2
            time_year=`date '+%y'`
Packit Service 5195f2
            case $time_year in
Packit Service 5195f2
                [5-9][0-9]) time_year="19$time_year" ;;
Packit Service 5195f2
                [0-4][0-9]) time_year="20$time_year" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
        fi
Packit Service 5195f2
        case $time_month in
Packit Service 5195f2
            1|01) time_monthname='Jan' ;;
Packit Service 5195f2
            2|02) time_monthname='Feb' ;;
Packit Service 5195f2
            3|03) time_monthname='Mar' ;;
Packit Service 5195f2
            4|04) time_monthname='Apr' ;;
Packit Service 5195f2
            5|05) time_monthname='May' ;;
Packit Service 5195f2
            6|06) time_monthname='Jun' ;;
Packit Service 5195f2
            7|07) time_monthname='Jul' ;;
Packit Service 5195f2
            8|08) time_monthname='Aug' ;;
Packit Service 5195f2
            9|09) time_monthname='Sep' ;;
Packit Service 5195f2
              10) time_monthname='Oct' ;;
Packit Service 5195f2
              11) time_monthname='Nov' ;;
Packit Service 5195f2
              12) time_monthname='Dec' ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   expand special ``%x'' constructs
Packit Service 5195f2
    if [ ".$opt_e" = .yes ]; then
Packit Service 5195f2
        text=`echo $seo "$text" |\
Packit Service 5195f2
              sed -e "s/%B/${term_bold}/g" \
Packit Service 5195f2
                  -e "s/%b/${term_norm}/g" \
Packit Service 5195f2
                  -e "s/%u/${username}/g" \
Packit Service 5195f2
                  -e "s/%U/${userid}/g" \
Packit Service 5195f2
                  -e "s/%g/${groupname}/g" \
Packit Service 5195f2
                  -e "s/%G/${groupid}/g" \
Packit Service 5195f2
                  -e "s/%h/${hostname}/g" \
Packit Service 5195f2
                  -e "s/%d/${domainname}/g" \
Packit Service 5195f2
                  -e "s/%D/${time_day}/g" \
Packit Service 5195f2
                  -e "s/%M/${time_month}/g" \
Packit Service 5195f2
                  -e "s/%Y/${time_year}/g" \
Packit Service 5195f2
                  -e "s/%m/${time_monthname}/g" 2>/dev/null`
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   create output
Packit Service 5195f2
    if [ .$opt_n = .no ]; then
Packit Service 5195f2
        echo $seo "$text"
Packit Service 5195f2
    else
Packit Service 5195f2
        #   the harder part: echo -n is best, because
Packit Service 5195f2
        #   awk may complain about some \xx sequences.
Packit Service 5195f2
        if [ ".$minusn" != . ]; then
Packit Service 5195f2
            echo $seo $minusn "$text"
Packit Service 5195f2
        else
Packit Service 5195f2
            echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
mdate )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  mdate -- Pretty-print modification time of a file or dir
Packit Service 5195f2
    ##  Copyright (c) 1995-1997 Free Software Foundation, Inc.
Packit Service 5195f2
    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    fod="$1"
Packit Service 5195f2
    case "$opt_o" in
Packit Service 5195f2
        [dmy][dmy][dmy] )
Packit Service 5195f2
            ;;
Packit Service 5195f2
        * ) echo "$msgprefix:Error: invalid argument to option \`-o': $opt_o" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
            ;;
Packit Service 5195f2
    esac
Packit Service 5195f2
    if [ ! -r "$fod" ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: file or directory not found: $fod" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   GNU ls changes its time format in response to the TIME_STYLE
Packit Service 5195f2
    #   variable. Since we cannot assume "unset" works, revert this
Packit Service 5195f2
    #   variable to its documented default.
Packit Service 5195f2
    if [ ".$TIME_STYLE" != . ]; then
Packit Service 5195f2
        TIME_STYLE=posix-long-iso
Packit Service 5195f2
        export TIME_STYLE
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   get the extended ls output of the file or directory.
Packit Service 5195f2
    if /bin/ls -L /dev/null >/dev/null 2>&1; then
Packit Service 5195f2
        set - x`/bin/ls -L -l -d $fod`
Packit Service 5195f2
    else
Packit Service 5195f2
        set - x`/bin/ls -l -d $fod`
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   The month is at least the fourth argument
Packit Service 5195f2
    #   (3 shifts here, the next inside the loop).
Packit Service 5195f2
    shift; shift; shift
Packit Service 5195f2
Packit Service 5195f2
    #   Find the month. Next argument is day, followed by the year or time.
Packit Service 5195f2
    month=""
Packit Service 5195f2
    while [ ".$month" = . ]; do
Packit Service 5195f2
        shift
Packit Service 5195f2
        case $1 in
Packit Service 5195f2
            Jan) month=January;   nummonth=1  ;;
Packit Service 5195f2
            Feb) month=February;  nummonth=2  ;;
Packit Service 5195f2
            Mar) month=March;     nummonth=3  ;;
Packit Service 5195f2
            Apr) month=April;     nummonth=4  ;;
Packit Service 5195f2
            May) month=May;       nummonth=5  ;;
Packit Service 5195f2
            Jun) month=June;      nummonth=6  ;;
Packit Service 5195f2
            Jul) month=July;      nummonth=7  ;;
Packit Service 5195f2
            Aug) month=August;    nummonth=8  ;;
Packit Service 5195f2
            Sep) month=September; nummonth=9  ;;
Packit Service 5195f2
            Oct) month=October;   nummonth=10 ;;
Packit Service 5195f2
            Nov) month=November;  nummonth=11 ;;
Packit Service 5195f2
            Dec) month=December;  nummonth=12 ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    done
Packit Service 5195f2
    day="$2"
Packit Service 5195f2
    year="$3"
Packit Service 5195f2
Packit Service 5195f2
    #   We finally have to deal with the problem that the "ls" output
Packit Service 5195f2
    #   gives either the time of the day or the year.
Packit Service 5195f2
    case $year in
Packit Service 5195f2
        *:*)
Packit Service 5195f2
            this_year=`date '+%Y' 2>/dev/null`
Packit Service 5195f2
            if [ ".$this_year" = . ]; then
Packit Service 5195f2
                this_year=`date '+%y'`
Packit Service 5195f2
                case $this_year in
Packit Service 5195f2
                    [5-9][0-9]) this_year="19$this_year" ;;
Packit Service 5195f2
                    [0-4][0-9]) this_year="20$this_year" ;;
Packit Service 5195f2
                esac
Packit Service 5195f2
            fi
Packit Service 5195f2
            #   for the following months of the last year the time notation
Packit Service 5195f2
            #   is usually also used for files modified in the last year.
Packit Service 5195f2
            this_month=`date '+%m'`
Packit Service 5195f2
            if (expr $nummonth \> $this_month) >/dev/null; then
Packit Service 5195f2
                this_year=`expr $this_year - 1`
Packit Service 5195f2
            fi
Packit Service 5195f2
            year="$this_year"
Packit Service 5195f2
            ;;
Packit Service 5195f2
    esac
Packit Service 5195f2
Packit Service 5195f2
    #   Optionally fill day and month with leeding zeros
Packit Service 5195f2
    if [ ".$opt_z" = .yes ]; then
Packit Service 5195f2
        case $day in
Packit Service 5195f2
            [0-9][0-9] ) ;;
Packit Service 5195f2
                 [0-9] ) day="0$day" ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
        case $nummonth in
Packit Service 5195f2
            [0-9][0-9] ) ;;
Packit Service 5195f2
                 [0-9] ) nummonth="0$nummonth" ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   Optionally use digits for month
Packit Service 5195f2
    if [ ".$opt_d" = .yes ]; then
Packit Service 5195f2
        month="$nummonth"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   Optionally shorten the month name to three characters
Packit Service 5195f2
    if [ ".$opt_s" = .yes ]; then
Packit Service 5195f2
        month=`echo $month | cut -c1-3`
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   Output the resulting date string
Packit Service 5195f2
    echo dummy | awk '{
Packit Service 5195f2
        for (i = 0; i < 3; i++) {
Packit Service 5195f2
            now = substr(order, 1, 1);
Packit Service 5195f2
            order = substr(order, 2);
Packit Service 5195f2
            if (now == "d")
Packit Service 5195f2
                out = day;
Packit Service 5195f2
            else if (now == "m")
Packit Service 5195f2
                out = month;
Packit Service 5195f2
            else if (now == "y")
Packit Service 5195f2
                out = year;
Packit Service 5195f2
            if (i < 2)
Packit Service 5195f2
                printf("%s%s", out, field);
Packit Service 5195f2
            else
Packit Service 5195f2
                printf("%s", out);
Packit Service 5195f2
        }
Packit Service 5195f2
        if (newline != "yes")
Packit Service 5195f2
            printf("\n");
Packit Service 5195f2
    }' "day=$day" "month=$month" "year=$year" \
Packit Service 5195f2
       "field=$opt_f" "order=$opt_o" "newline=$opt_n"
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
table )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  table -- Pretty-print a field-separated list as a table
Packit Service 5195f2
    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    if [ $opt_c -gt 4 ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: Invalid number of colums (1..4 allowed only)" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
    case "x$opt_F" in
Packit Service 5195f2
        x? ) ;;
Packit Service 5195f2
        *  ) echo "$msgprefix:Error: Invalid separator (one char allowed only)" 1>&2; shtool_exit 1 ;;
Packit Service 5195f2
    esac
Packit Service 5195f2
Packit Service 5195f2
    #   split the list into a table
Packit Service 5195f2
    list=`
Packit Service 5195f2
        IFS="$opt_F"
Packit Service 5195f2
        for entry in $*; do
Packit Service 5195f2
            if [ ".$entry" != . ]; then
Packit Service 5195f2
                echo "$entry"
Packit Service 5195f2
            fi
Packit Service 5195f2
        done |\
Packit Service 5195f2
        awk "
Packit Service 5195f2
            BEGIN { list = \"\"; n = 0; }
Packit Service 5195f2
            {
Packit Service 5195f2
                list = list \\$1;
Packit Service 5195f2
                n = n + 1;
Packit Service 5195f2
                if (n < $opt_c) {
Packit Service 5195f2
                    list = list \":\";
Packit Service 5195f2
                }
Packit Service 5195f2
                if (n == $opt_c) {
Packit Service 5195f2
                    list = list \"\\n\";
Packit Service 5195f2
                    n = 0;
Packit Service 5195f2
                }
Packit Service 5195f2
            }
Packit Service 5195f2
            END { print list; }
Packit Service 5195f2
         "
Packit Service 5195f2
    `
Packit Service 5195f2
Packit Service 5195f2
    #   format table cells and make sure table
Packit Service 5195f2
    #   doesn't exceed maximum width
Packit Service 5195f2
    OIFS="$IFS"
Packit Service 5195f2
    IFS='
Packit Service 5195f2
'
Packit Service 5195f2
    for entry in $list; do
Packit Service 5195f2
        case $opt_c in
Packit Service 5195f2
            1 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s\\n\", \$1); }'" ;;
Packit Service 5195f2
            2 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s\\n\", \$1, \$2); }'" ;;
Packit Service 5195f2
            3 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3); }'" ;;
Packit Service 5195f2
            4 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3, \$4); }'" ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    done |\
Packit Service 5195f2
    awk "{
Packit Service 5195f2
        if (length(\$0) > $opt_s) {
Packit Service 5195f2
            printf(\"%s\\n\", substr(\$0, 0, $opt_s-1));
Packit Service 5195f2
        } else {
Packit Service 5195f2
            print \$0;
Packit Service 5195f2
        }
Packit Service 5195f2
    }"
Packit Service 5195f2
    IFS="$OIFS"
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
prop )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  prop -- Display progress with a running propeller
Packit Service 5195f2
    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    perl=''
Packit Service 5195f2
    for dir in `echo $PATH | sed -e 's/:/ /g'` .; do
Packit Service 5195f2
        if [ -f "$dir/perl" ]; then
Packit Service 5195f2
            perl="$dir/perl"
Packit Service 5195f2
            break
Packit Service 5195f2
        fi
Packit Service 5195f2
    done
Packit Service 5195f2
    if [ ".$perl" != . ]; then
Packit Service 5195f2
        #   Perl is preferred because writing to STDERR in
Packit Service 5195f2
        #   Perl really writes immediately as one would expect
Packit Service 5195f2
        $perl -e '
Packit Service 5195f2
            @p = ("|","/","-","\\");
Packit Service 5195f2
            $i = 0;
Packit Service 5195f2
            while (<STDIN>) {
Packit Service 5195f2
                printf(STDERR "\r%s...%s\b", $ARGV[0], $p[$i++]);
Packit Service 5195f2
                $i = 0 if ($i > 3);
Packit Service 5195f2
            }
Packit Service 5195f2
            printf(STDERR "\r%s    \n", $ARGV[0]);
Packit Service 5195f2
        ' "$opt_p"
Packit Service 5195f2
    else
Packit Service 5195f2
        #   But if Perl doesn't exists we use Awk even
Packit Service 5195f2
        #   some Awk's buffer even the /dev/stderr writing :-(
Packit Service 5195f2
        awk '
Packit Service 5195f2
            BEGIN {
Packit Service 5195f2
                split("|#/#-#\\", p, "#");
Packit Service 5195f2
                i = 1;
Packit Service 5195f2
            }
Packit Service 5195f2
            {
Packit Service 5195f2
                printf("\r%s%c\b", prefix, p[i++]) > "/dev/stderr";
Packit Service 5195f2
                if (i > 4) { i = 1; }
Packit Service 5195f2
            }
Packit Service 5195f2
            END {
Packit Service 5195f2
                printf("\r%s    \n", prefix) > "/dev/stderr";
Packit Service 5195f2
            }
Packit Service 5195f2
        ' "prefix=$opt_p"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
move )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  move -- Move files with simultaneous substitution
Packit Service 5195f2
    ##  Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    src="$1"
Packit Service 5195f2
    dst="$2"
Packit Service 5195f2
Packit Service 5195f2
    #   consistency checks
Packit Service 5195f2
    if [ ".$src" = . ] || [ ".$dst" = . ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: Invalid arguments" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
    if [ ".$src" = ".$dst" ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: Source and destination files are the same" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
    expsrc="$src"
Packit Service 5195f2
    if [ ".$opt_e" = .yes ]; then
Packit Service 5195f2
        expsrc="`echo $expsrc`"
Packit Service 5195f2
    fi
Packit Service 5195f2
    if [ ".$opt_e" = .yes ]; then
Packit Service 5195f2
        if [ ".`echo "$src" | sed -e 's;^.*\\*.*$;;'`" = ".$src" ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: Source doesn't contain wildcard ('*'): $dst" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".`echo "$dst" | sed -e 's;^.*%[1-9].*$;;'`" = ".$dst" ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: Destination doesn't contain substitution ('%N'): $dst" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$expsrc" = ".$src" ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: Sources not found or no asterisk : $src" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
    else
Packit Service 5195f2
        if [ ! -r "$src" ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: Source not found: $src" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine substitution patterns
Packit Service 5195f2
    if [ ".$opt_e" = .yes ]; then
Packit Service 5195f2
        srcpat=`echo "$src" | sed -e 's/\\./\\\\./g' -e 's/;/\\;/g' -e 's;\\*;\\\\(.*\\\\);g'`
Packit Service 5195f2
        dstpat=`echo "$dst" | sed -e 's;%\([1-9]\);\\\\\1;g'`
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   iterate over source(s)
Packit Service 5195f2
    for onesrc in $expsrc; do
Packit Service 5195f2
        if [ .$opt_e = .yes ]; then
Packit Service 5195f2
            onedst=`echo $onesrc | sed -e "s;$srcpat;$dstpat;"`
Packit Service 5195f2
        else
Packit Service 5195f2
            onedst="$dst"
Packit Service 5195f2
        fi
Packit Service 5195f2
        errorstatus=0
Packit Service 5195f2
        if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
            echo "$onesrc -> $onedst"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_p" = .yes ]; then
Packit Service 5195f2
            if [ -r $onedst ]; then
Packit Service 5195f2
                if cmp -s $onesrc $onedst; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "rm -f $onesrc" 1>&2
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    rm -f $onesrc || errorstatus=$?
Packit Service 5195f2
                else
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "mv -f $onesrc $onedst" 1>&2
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    mv -f $onesrc $onedst || errorstatus=$?
Packit Service 5195f2
                fi
Packit Service 5195f2
            else
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "mv -f $onesrc $onedst" 1>&2
Packit Service 5195f2
                fi
Packit Service 5195f2
                mv -f $onesrc $onedst || errorstatus=$?
Packit Service 5195f2
            fi
Packit Service 5195f2
        else
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "mv -f $onesrc $onedst" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            mv -f $onesrc $onedst || errorstatus=$?
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ $errorstatus -ne 0 ]; then
Packit Service 5195f2
            break;
Packit Service 5195f2
        fi
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit $errorstatus
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
install )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  install -- Install a program, script or datafile
Packit Service 5195f2
    ##  Copyright (c) 1997-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    #   special case: "shtool install -d <dir> [...]" internally
Packit Service 5195f2
    #   maps to "shtool mkdir -f -p -m 755 <dir> [...]"
Packit Service 5195f2
    if [ "$opt_d" = yes ]; then
Packit Service 5195f2
        cmd="$0 mkdir -f -p -m 755"
Packit Service 5195f2
        if [ ".$opt_o" != . ]; then
Packit Service 5195f2
            cmd="$cmd -o '$opt_o'"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_g" != . ]; then
Packit Service 5195f2
            cmd="$cmd -g '$opt_g'"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
            cmd="$cmd -v"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            cmd="$cmd -t"
Packit Service 5195f2
        fi
Packit Service 5195f2
        for dir in "$@"; do
Packit Service 5195f2
            eval "$cmd $dir" || shtool_exit $?
Packit Service 5195f2
        done
Packit Service 5195f2
        shtool_exit 0
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine source(s) and destination
Packit Service 5195f2
    argc=$#
Packit Service 5195f2
    srcs=""
Packit Service 5195f2
    while [ $# -gt 1 ]; do
Packit Service 5195f2
        srcs="$srcs $1"
Packit Service 5195f2
        shift
Packit Service 5195f2
    done
Packit Service 5195f2
    dstpath="$1"
Packit Service 5195f2
Packit Service 5195f2
    #   type check for destination
Packit Service 5195f2
    dstisdir=0
Packit Service 5195f2
    if [ -d $dstpath ]; then
Packit Service 5195f2
        dstpath=`echo "$dstpath" | sed -e 's:/$::'`
Packit Service 5195f2
        dstisdir=1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   consistency check for destination
Packit Service 5195f2
    if [ $argc -gt 2 ] && [ $dstisdir = 0 ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   iterate over all source(s)
Packit Service 5195f2
    for src in $srcs; do
Packit Service 5195f2
        dst=$dstpath
Packit Service 5195f2
Packit Service 5195f2
        #   if destination is a directory, append the input filename
Packit Service 5195f2
        if [ $dstisdir = 1 ]; then
Packit Service 5195f2
            dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
Packit Service 5195f2
            dst="$dst/$dstfile"
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   check for correct arguments
Packit Service 5195f2
        if [ ".$src" = ".$dst" ]; then
Packit Service 5195f2
            echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
Packit Service 5195f2
            continue
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ -d "$src" ]; then
Packit Service 5195f2
            echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
Packit Service 5195f2
            continue
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   make a temp file name in the destination directory
Packit Service 5195f2
        dsttmp=`echo $dst |\
Packit Service 5195f2
                sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
Packit Service 5195f2
                    -e "s;\$;/#INST@$$#;"`
Packit Service 5195f2
Packit Service 5195f2
        #   verbosity
Packit Service 5195f2
        if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
            echo "$src -> $dst" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   copy or move the file name to the temp name
Packit Service 5195f2
        #   (because we might be not allowed to change the source)
Packit Service 5195f2
        if [ ".$opt_C" = .yes ]; then
Packit Service 5195f2
            opt_c=yes
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_c" = .yes ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "cp $src $dsttmp" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            cp "$src" "$dsttmp" || shtool_exit $?
Packit Service 5195f2
        else
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "mv $src $dsttmp" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            mv "$src" "$dsttmp" || shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   adjust the target file
Packit Service 5195f2
        if [ ".$opt_e" != . ]; then
Packit Service 5195f2
            sed='sed'
Packit Service 5195f2
            OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS"
Packit Service 5195f2
            for e
Packit Service 5195f2
            do
Packit Service 5195f2
                sed="$sed -e '$e'"
Packit Service 5195f2
            done
Packit Service 5195f2
            cp "$dsttmp" "$dsttmp.old"
Packit Service 5195f2
            chmod u+w $dsttmp
Packit Service 5195f2
            eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $?
Packit Service 5195f2
            rm -f $dsttmp.old
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_s" = .yes ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "strip $dsttmp" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            strip $dsttmp || shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_o" != . ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "chown $opt_o $dsttmp" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            chown $opt_o $dsttmp || shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_g" != . ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "chgrp $opt_g $dsttmp" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            chgrp $opt_g $dsttmp || shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_m" != ".-" ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "chmod $opt_m $dsttmp" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            chmod $opt_m $dsttmp || shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   determine whether to do a quick install
Packit Service 5195f2
        #   (has to be done _after_ the strip was already done)
Packit Service 5195f2
        quick=no
Packit Service 5195f2
        if [ ".$opt_C" = .yes ]; then
Packit Service 5195f2
            if [ -r $dst ]; then
Packit Service 5195f2
                if cmp -s "$src" "$dst"; then
Packit Service 5195f2
                    quick=yes
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   finally, install the file to the real destination
Packit Service 5195f2
        if [ $quick = yes ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "rm -f $dsttmp" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            rm -f $dsttmp
Packit Service 5195f2
        else
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "rm -f $dst && mv $dsttmp $dst" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            rm -f $dst && mv $dsttmp $dst
Packit Service 5195f2
        fi
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
mkdir )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  mkdir -- Make one or more directories
Packit Service 5195f2
    ##  Copyright (c) 1996-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    errstatus=0
Packit Service 5195f2
    for p in ${1+"$@"}; do
Packit Service 5195f2
        #   if the directory already exists...
Packit Service 5195f2
        if [ -d "$p" ]; then
Packit Service 5195f2
            if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
Packit Service 5195f2
                echo "$msgprefix:Error: directory already exists: $p" 1>&2
Packit Service 5195f2
                errstatus=1
Packit Service 5195f2
                break
Packit Service 5195f2
            else
Packit Service 5195f2
                continue
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
        #   if the directory has to be created...
Packit Service 5195f2
        if [ ".$opt_p" = .no ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "mkdir $p" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            mkdir $p || errstatus=$?
Packit Service 5195f2
            if [ ".$opt_o" != . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "chown $opt_o $p" 1>&2
Packit Service 5195f2
                fi
Packit Service 5195f2
                chown $opt_o $p || errstatus=$?
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$opt_g" != . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "chgrp $opt_g $p" 1>&2
Packit Service 5195f2
                fi
Packit Service 5195f2
                chgrp $opt_g $p || errstatus=$?
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$opt_m" != . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "chmod $opt_m $p" 1>&2
Packit Service 5195f2
                fi
Packit Service 5195f2
                chmod $opt_m $p || errstatus=$?
Packit Service 5195f2
            fi
Packit Service 5195f2
        else
Packit Service 5195f2
            #   the smart situation
Packit Service 5195f2
            set fnord `echo ":$p" |\
Packit Service 5195f2
                       sed -e 's/^:\//%/' \
Packit Service 5195f2
                           -e 's/^://' \
Packit Service 5195f2
                           -e 's/\// /g' \
Packit Service 5195f2
                           -e 's/^%/\//'`
Packit Service 5195f2
            shift
Packit Service 5195f2
            pathcomp=''
Packit Service 5195f2
            for d in ${1+"$@"}; do
Packit Service 5195f2
                pathcomp="$pathcomp$d"
Packit Service 5195f2
                case "$pathcomp" in
Packit Service 5195f2
                    -* ) pathcomp="./$pathcomp" ;;
Packit Service 5195f2
                esac
Packit Service 5195f2
                if [ ! -d "$pathcomp" ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "mkdir $pathcomp" 1>&2
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    mkdir $pathcomp || errstatus=$?
Packit Service 5195f2
                    if [ ".$opt_o" != . ]; then
Packit Service 5195f2
                        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                            echo "chown $opt_o $pathcomp" 1>&2
Packit Service 5195f2
                        fi
Packit Service 5195f2
                        chown $opt_o $pathcomp || errstatus=$?
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    if [ ".$opt_g" != . ]; then
Packit Service 5195f2
                        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                            echo "chgrp $opt_g $pathcomp" 1>&2
Packit Service 5195f2
                        fi
Packit Service 5195f2
                        chgrp $opt_g $pathcomp || errstatus=$?
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    if [ ".$opt_m" != . ]; then
Packit Service 5195f2
                        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                            echo "chmod $opt_m $pathcomp" 1>&2
Packit Service 5195f2
                        fi
Packit Service 5195f2
                        chmod $opt_m $pathcomp || errstatus=$?
Packit Service 5195f2
                    fi
Packit Service 5195f2
                fi
Packit Service 5195f2
                pathcomp="$pathcomp/"
Packit Service 5195f2
            done
Packit Service 5195f2
        fi
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit $errstatus
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
mkln )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  mkln -- Make link with calculation of relative paths
Packit Service 5195f2
    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    #   determine source(s) and destination
Packit Service 5195f2
    args=$#
Packit Service 5195f2
    srcs=""
Packit Service 5195f2
    while [ $# -gt 1 ]; do
Packit Service 5195f2
        srcs="$srcs $1"
Packit Service 5195f2
        shift
Packit Service 5195f2
    done
Packit Service 5195f2
    dst="$1"
Packit Service 5195f2
    if [ ! -d $dst ]; then
Packit Service 5195f2
        if [ $args -gt 2 ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: multiple sources not allowed when target isn't a directory" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine link options
Packit Service 5195f2
    lnopt=""
Packit Service 5195f2
    if [ ".$opt_f" = .yes ]; then
Packit Service 5195f2
        lnopt="$lnopt -f"
Packit Service 5195f2
    fi
Packit Service 5195f2
    if [ ".$opt_s" = .yes ]; then
Packit Service 5195f2
        lnopt="$lnopt -s"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   iterate over sources
Packit Service 5195f2
    for src in $srcs; do
Packit Service 5195f2
        #   determine if one of the paths is an absolute path,
Packit Service 5195f2
        #   because then we _have_ to use an absolute symlink
Packit Service 5195f2
        oneisabs=0
Packit Service 5195f2
        srcisabs=0
Packit Service 5195f2
        dstisabs=0
Packit Service 5195f2
        case $src in
Packit Service 5195f2
            /* ) oneisabs=1; srcisabs=1 ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
        case $dst in
Packit Service 5195f2
            /* ) oneisabs=1; dstisabs=1 ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
Packit Service 5195f2
        #   split source and destination into dir and base name
Packit Service 5195f2
        if [ -d $src ]; then
Packit Service 5195f2
            srcdir=`echo $src | sed -e 's;/*$;;'`
Packit Service 5195f2
            srcbase=""
Packit Service 5195f2
        else
Packit Service 5195f2
            srcdir=`echo  $src | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'`
Packit Service 5195f2
            srcbase=`echo $src | sed -e 's;.*/\([^/]*\)$;\1;'`
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ -d $dst ]; then
Packit Service 5195f2
            dstdir=`echo $dst | sed -e 's;/*$;;'`
Packit Service 5195f2
            dstbase=""
Packit Service 5195f2
        else
Packit Service 5195f2
            dstdir=`echo  $dst | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'`
Packit Service 5195f2
            dstbase=`echo $dst | sed -e 's;.*/\([^/]*\)$;\1;'`
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   consistency check
Packit Service 5195f2
        if [ ".$dstdir" != . ]; then
Packit Service 5195f2
            if [ ! -d $dstdir ]; then
Packit Service 5195f2
                echo "$msgprefix:Error: destination directory not found: $dstdir" 1>&2
Packit Service 5195f2
                shtool_exit 1
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   make sure the source is reachable from the destination
Packit Service 5195f2
        if [ $dstisabs = 1 ]; then
Packit Service 5195f2
            if [ $srcisabs = 0 ]; then
Packit Service 5195f2
                if [ ".$srcdir" = . ]; then
Packit Service 5195f2
                    srcdir="`pwd | sed -e 's;/*$;;'`"
Packit Service 5195f2
                    srcisabs=1
Packit Service 5195f2
                    oneisabs=1
Packit Service 5195f2
                elif [ -d $srcdir ]; then
Packit Service 5195f2
                    srcdir="`cd $srcdir; pwd | sed -e 's;/*$;;'`"
Packit Service 5195f2
                    srcisabs=1
Packit Service 5195f2
                    oneisabs=1
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   split away a common prefix
Packit Service 5195f2
        prefix=""
Packit Service 5195f2
        if [ ".$srcdir" = ".$dstdir" ] && [ ".$srcdir" != . ]; then
Packit Service 5195f2
            prefix="$srcdir/"
Packit Service 5195f2
            srcdir=""
Packit Service 5195f2
            dstdir=""
Packit Service 5195f2
        else
Packit Service 5195f2
            while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do
Packit Service 5195f2
                presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'`
Packit Service 5195f2
                predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'`
Packit Service 5195f2
                if [ ".$presrc" != ".$predst" ]; then
Packit Service 5195f2
                    break
Packit Service 5195f2
                fi
Packit Service 5195f2
                prefix="$prefix$presrc/"
Packit Service 5195f2
                srcdir=`echo $srcdir | sed -e 's;^[^/]*/*;;'`
Packit Service 5195f2
                dstdir=`echo $dstdir | sed -e 's;^[^/]*/*;;'`
Packit Service 5195f2
            done
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   destination prefix is just the common prefix
Packit Service 5195f2
        dstpre="$prefix"
Packit Service 5195f2
Packit Service 5195f2
        #   determine source prefix which is the reverse directory
Packit Service 5195f2
        #   step-up corresponding to the destination directory
Packit Service 5195f2
        srcpre=""
Packit Service 5195f2
        allow_relative_srcpre=no
Packit Service 5195f2
        if [ ".$prefix" != . ] && [ ".$prefix" != ./ ]; then
Packit Service 5195f2
            allow_relative_srcpre=yes
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ $oneisabs = 0 ]; then
Packit Service 5195f2
            allow_relative_srcpre=yes
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_s" != .yes ]; then
Packit Service 5195f2
            allow_relative_srcpre=no
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$allow_relative_srcpre" = .yes ]; then
Packit Service 5195f2
            pl="$dstdir/"
Packit Service 5195f2
            OIFS="$IFS"; IFS='/'
Packit Service 5195f2
            for pe in $pl; do
Packit Service 5195f2
                [ ".$pe" = .  ] && continue
Packit Service 5195f2
                [ ".$pe" = .. ] && continue
Packit Service 5195f2
                srcpre="../$srcpre"
Packit Service 5195f2
            done
Packit Service 5195f2
            IFS="$OIFS"
Packit Service 5195f2
        else
Packit Service 5195f2
            if [ $srcisabs = 1 ]; then
Packit Service 5195f2
                srcpre="$prefix"
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   determine destination symlink name
Packit Service 5195f2
        if [ ".$dstbase" = . ]; then
Packit Service 5195f2
            if [ ".$srcbase" != . ]; then
Packit Service 5195f2
                dstbase="$srcbase"
Packit Service 5195f2
            else
Packit Service 5195f2
                dstbase=`echo "$prefix$srcdir" | sed -e 's;/*$;;' -e 's;.*/\([^/]*\)$;\1;'`
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   now finalize source and destination directory paths
Packit Service 5195f2
        srcdir=`echo $srcdir | sed -e 's;\([^/]\)$;\1/;'`
Packit Service 5195f2
        dstdir=`echo $dstdir | sed -e 's;\([^/]\)$;\1/;'`
Packit Service 5195f2
Packit Service 5195f2
        #   run the final link command
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase"
Packit Service 5195f2
        fi
Packit Service 5195f2
        eval ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
mkshadow )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  mkshadow -- Make a shadow tree through symbolic links
Packit Service 5195f2
    ##  Copyright (c) 1998-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    #   source and destination directory
Packit Service 5195f2
    src=`echo "$1" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'`
Packit Service 5195f2
    dst=`echo "$2" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'`
Packit Service 5195f2
Packit Service 5195f2
    #   check whether source exists
Packit Service 5195f2
    if [ ! -d $src ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: source directory not found: \`$src'" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine if one of the paths is an absolute path,
Packit Service 5195f2
    #   because then we have to use an absolute symlink
Packit Service 5195f2
    oneisabs=0
Packit Service 5195f2
    case $src in
Packit Service 5195f2
        /* ) oneisabs=1 ;;
Packit Service 5195f2
    esac
Packit Service 5195f2
    case $dst in
Packit Service 5195f2
        /* ) oneisabs=1 ;;
Packit Service 5195f2
    esac
Packit Service 5195f2
Packit Service 5195f2
    #   determine reverse directory for destination directory
Packit Service 5195f2
    dstrevdir=''
Packit Service 5195f2
    if [ $oneisabs = 0 ]; then
Packit Service 5195f2
        #   derive reverse path from forward path
Packit Service 5195f2
        pwd=`pwd`
Packit Service 5195f2
        OIFS="$IFS"; IFS='/'
Packit Service 5195f2
        for pe in $dst; do
Packit Service 5195f2
            if [ "x$pe" = "x.." ]; then
Packit Service 5195f2
                OIFS2="$IFS"; IFS="$DIFS"
Packit Service 5195f2
                eval `echo "$pwd" |\
Packit Service 5195f2
                      sed -e 's:\([^/]*\)$:; dir="\1":' \
Packit Service 5195f2
                          -e 's:^\(.*\)/[^/]*;:pwd="\1";:'\
Packit Service 5195f2
                          -e 's:^;:pwd="";:'`
Packit Service 5195f2
                dstrevdir="$dir/$dstrevdir"
Packit Service 5195f2
                IFS="$OIFS2"
Packit Service 5195f2
            else
Packit Service 5195f2
                dstrevdir="../$dstrevdir"
Packit Service 5195f2
            fi
Packit Service 5195f2
        done
Packit Service 5195f2
        IFS="$OIFS"
Packit Service 5195f2
    else
Packit Service 5195f2
        src="`cd $src; pwd`";
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   create directory tree at destination
Packit Service 5195f2
    if [ ! -d $dst ]; then
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "mkdir $dst" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        mkdir $dst
Packit Service 5195f2
    fi
Packit Service 5195f2
    if [ ".$opt_a" = .yes ]; then
Packit Service 5195f2
        DIRS=`cd $src; find . -type d -print |\
Packit Service 5195f2
              sed -e '/^\.$/d' -e 's:^\./::'`
Packit Service 5195f2
    else
Packit Service 5195f2
        DIRS=`cd $src; find . -type d -print |\
Packit Service 5195f2
              sed -e '/\/CVS/d' -e '/^\.$/d' -e 's:^\./::'`
Packit Service 5195f2
    fi
Packit Service 5195f2
    for dir in $DIRS; do
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "mkdir $dst/$dir" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        mkdir $dst/$dir
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    #   fill directory tree with symlinks to files
Packit Service 5195f2
    if [ ".$opt_a" = .yes ]; then
Packit Service 5195f2
        FILES="`cd $src; find . -depth -print |\
Packit Service 5195f2
                sed -e 's/^\.\///'`"
Packit Service 5195f2
    else
Packit Service 5195f2
        FILES="`cd $src; find . -depth -print |\
Packit Service 5195f2
                sed -e '/\.o$/d' -e '/\.a$/d' -e '/\.so$/d' \
Packit Service 5195f2
                    -e '/\.cvsignore$/d' -e '/\/CVS/d' \
Packit Service 5195f2
                    -e '/\/\.#/d' -e '/\.orig$/d' \
Packit Service 5195f2
                    -e 's/^\.\///'`"
Packit Service 5195f2
    fi
Packit Service 5195f2
    for file in $FILES; do
Packit Service 5195f2
         #  don't use `-type f' above for find because of symlinks
Packit Service 5195f2
         if [ -d "$src/$file" ]; then
Packit Service 5195f2
             continue
Packit Service 5195f2
         fi
Packit Service 5195f2
         basename=`echo $file | sed -e 's:^.*/::'`
Packit Service 5195f2
         dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'`
Packit Service 5195f2
         from=`echo "$src/$file" | sed -e 's/^\.\///'`
Packit Service 5195f2
         to="$dst/$dir$basename"
Packit Service 5195f2
         if [ $oneisabs = 0 ]; then
Packit Service 5195f2
             if [ ".$dir" != . ]; then
Packit Service 5195f2
                 subdir=`echo $dir | sed -e 's:/$::'`
Packit Service 5195f2
                 #   derive reverse path from forward path
Packit Service 5195f2
                 revdir=''
Packit Service 5195f2
                 OIFS="$IFS"; IFS='/'
Packit Service 5195f2
                 for pe in $subdir; do
Packit Service 5195f2
                     revdir="../$revdir"
Packit Service 5195f2
                 done
Packit Service 5195f2
                 IFS="$OIFS"
Packit Service 5195f2
                 #   finalize from
Packit Service 5195f2
                 from="$revdir$from"
Packit Service 5195f2
             fi
Packit Service 5195f2
             from="$dstrevdir$from"
Packit Service 5195f2
         fi
Packit Service 5195f2
         if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
             echo "    $to" 1>&2
Packit Service 5195f2
         fi
Packit Service 5195f2
         if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
             echo "ln -s $from $to" 1>&2
Packit Service 5195f2
         fi
Packit Service 5195f2
         ln -s $from $to
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
fixperm )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  fixperm -- Fix file permissions inside a source tree
Packit Service 5195f2
    ##  Copyright (c) 1996-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    paths="$*"
Packit Service 5195f2
Packit Service 5195f2
    #   check whether the test command supports the -x option
Packit Service 5195f2
    if [ -x /bin/sh ] 2>/dev/null; then
Packit Service 5195f2
        minusx="-x"
Packit Service 5195f2
    else
Packit Service 5195f2
        minusx="-r"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   iterate over paths
Packit Service 5195f2
    for p in $paths; do
Packit Service 5195f2
        for file in `find $p -depth -print`; do
Packit Service 5195f2
            if [ -f $file ]; then
Packit Service 5195f2
                if [ $minusx $file ]; then
Packit Service 5195f2
                    if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
                        echo "-rwxr-xr-x $file" 2>&1
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chmod 755 $file" 2>&1
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chmod 755 $file
Packit Service 5195f2
                else
Packit Service 5195f2
                    if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
                        echo "-rw-r--r-- $file" 2>&1
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chmod 644 $file" 2>&1
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chmod 644 $file
Packit Service 5195f2
                fi
Packit Service 5195f2
                continue
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ -d $file ]; then
Packit Service 5195f2
                if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
                    echo "drwxr-xr-x $file" 2>&1
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "chmod 755 $file" 2>&1
Packit Service 5195f2
                fi
Packit Service 5195f2
                chmod 755 $file
Packit Service 5195f2
                continue
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
                echo "?????????? $file" 2>&1
Packit Service 5195f2
            fi
Packit Service 5195f2
        done
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
rotate )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  rotate -- Logfile rotation
Packit Service 5195f2
    ##  Copyright (c) 2001-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    #   make sure we have at least one file to rotate
Packit Service 5195f2
    if [ ".$opt_n" = .0 ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: invalid argument \`$opt_n' to option -n." 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   canonicalize -s option argument
Packit Service 5195f2
    if [ ".$opt_s" != . ]; then
Packit Service 5195f2
        if [ ".`expr $opt_s : '[0-9]*$'`" != .0 ]; then
Packit Service 5195f2
            :
Packit Service 5195f2
        elif [ ".`expr $opt_s : '[0-9]*[Kk]$'`" != .0 ]; then
Packit Service 5195f2
            opt_s=`expr $opt_s : '\([0-9]*\)[Kk]$'`
Packit Service 5195f2
            opt_s=`expr $opt_s \* 1024`
Packit Service 5195f2
        elif [ ".`expr $opt_s : '[0-9]*[Mm]$'`" != .0 ]; then
Packit Service 5195f2
            opt_s=`expr $opt_s : '\([0-9]*\)[Mm]$'`
Packit Service 5195f2
            opt_s=`expr $opt_s \* 1048576` # 1024*1024
Packit Service 5195f2
        elif [ ".`expr $opt_s : '[0-9]*[Gg]$'`" != .0 ]; then
Packit Service 5195f2
            opt_s=`expr $opt_s : '\([0-9]*\)[Gg]$'`
Packit Service 5195f2
            opt_s=`expr $opt_s \* 1073741824` # 1024*1024*1024
Packit Service 5195f2
        else
Packit Service 5195f2
            echo "$msgprefix:Error: invalid argument \`$opt_s' to option -s." 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   option -d/-z consistency
Packit Service 5195f2
    if [ ".$opt_d" = .yes ] && [ ".$opt_z" = . ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: option -d requires option -z." 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   make sure target directory exists
Packit Service 5195f2
    if [ ".$opt_a" != . ]; then
Packit Service 5195f2
        if [ ! -d $opt_a ]; then
Packit Service 5195f2
            if [ ".$opt_f" = .no ]; then
Packit Service 5195f2
                echo "$msgprefix:Error: archive directory \`$opt_a' does not exist." 1>&2
Packit Service 5195f2
                shtool_exit 1
Packit Service 5195f2
            fi
Packit Service 5195f2
            mkdir $opt_a || shtool_exit $?
Packit Service 5195f2
            chmod 755 $opt_a
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ! -w $opt_a ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: archive directory \`$opt_a' not writable." 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine compression approach
Packit Service 5195f2
    if [ ".$opt_z" != . ]; then
Packit Service 5195f2
        comp_lvl="$opt_z"
Packit Service 5195f2
        comp_prg=""
Packit Service 5195f2
        case $comp_lvl in
Packit Service 5195f2
            *:* ) eval `echo $comp_lvl |\
Packit Service 5195f2
                        sed -e 's%^\(.*\):\(.*\)$%comp_prg="\1"; comp_lvl="\2"%'` ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
Packit Service 5195f2
        #   compression level consistency
Packit Service 5195f2
        case $comp_lvl in
Packit Service 5195f2
            [0-9] )
Packit Service 5195f2
                ;;
Packit Service 5195f2
            * ) echo "$msgprefix:Error: invalid compression level \`$comp_lvl'" 1>&2
Packit Service 5195f2
                shtool_exit 1
Packit Service 5195f2
                ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
Packit Service 5195f2
        #   determine a suitable compression tool
Packit Service 5195f2
        if [ ".$comp_prg" = . ]; then
Packit Service 5195f2
            #   check whether the test command supports the -x option
Packit Service 5195f2
            if [ -x /bin/sh ] 2>/dev/null; then
Packit Service 5195f2
                minusx="-x"
Packit Service 5195f2
            else
Packit Service 5195f2
                minusx="-r"
Packit Service 5195f2
            fi
Packit Service 5195f2
            #   search for tools in $PATH
Packit Service 5195f2
            paths="`echo $PATH |\
Packit Service 5195f2
                    sed -e 's%/*:%:%g' -e 's%/*$%%' \
Packit Service 5195f2
                        -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
Packit Service 5195f2
                        -e 's/:/ /g'`"
Packit Service 5195f2
            for prg in bzip2 gzip compress; do
Packit Service 5195f2
                for path in $paths; do
Packit Service 5195f2
                    if [ $minusx "$path/$prg" ] && [ ! -d "$path/$prg" ]; then
Packit Service 5195f2
                        comp_prg="$prg"
Packit Service 5195f2
                        break
Packit Service 5195f2
                    fi
Packit Service 5195f2
                done
Packit Service 5195f2
                if [ ".$comp_prg" != . ]; then
Packit Service 5195f2
                    break
Packit Service 5195f2
                fi
Packit Service 5195f2
            done
Packit Service 5195f2
            if [ ".$comp_prg" = . ]; then
Packit Service 5195f2
                echo "$msgprefix:Error: no suitable compression tool found in \$PATH" 1>&2
Packit Service 5195f2
                shtool_exit 1
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   determine standard compression extension
Packit Service 5195f2
        #   and make sure it is a known tool
Packit Service 5195f2
        case $comp_prg in
Packit Service 5195f2
            */bzip2    | bzip2    ) comp_ext="bz2" comp_lvl="-$comp_lvl" ;;
Packit Service 5195f2
            */gzip     | gzip     ) comp_ext="gz"  comp_lvl="-$comp_lvl" ;;
Packit Service 5195f2
            */compress | compress ) comp_ext="Z";  comp_lvl=""           ;;
Packit Service 5195f2
            * ) echo "$msgprefix:Error: tool \`$comp_prg' is not a known compression tool" 1>&2
Packit Service 5195f2
                shtool_exit 1
Packit Service 5195f2
                ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
        comp_suf=".$comp_ext"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   iterate over all given logfile arguments
Packit Service 5195f2
    for file in $*; do
Packit Service 5195f2
        #   make sure the logfile exists
Packit Service 5195f2
        if [ ! -f $file ]; then
Packit Service 5195f2
            if [ ".$opt_f" = .yes ]; then
Packit Service 5195f2
                continue
Packit Service 5195f2
            fi
Packit Service 5195f2
            echo "$msgprefix:Error: logfile \`$file' not found" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   determine log directory (where original logfile is placed)
Packit Service 5195f2
        ldir="."
Packit Service 5195f2
        case $file in
Packit Service 5195f2
            */* ) eval `echo $file | sed -e 's%^\(.*\)/\([^/]*\)$%ldir="\1"; file="\2";%'` ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
Packit Service 5195f2
        #   determine archive directory (where rotated logfiles are placed)
Packit Service 5195f2
        adir="$ldir"
Packit Service 5195f2
        if [ ".$opt_a" != . ]; then
Packit Service 5195f2
            case "$opt_a" in
Packit Service 5195f2
                /* | ./* ) adir="$opt_a" ;;
Packit Service 5195f2
                * ) adir="$ldir/$opt_a"  ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   optionally take logfile size into account
Packit Service 5195f2
        if [ ".$opt_s" != . ]; then
Packit Service 5195f2
            #   determine size of logfile
Packit Service 5195f2
            set -- `env -i /bin/ls -l "$ldir/$file" | sed -e "s;$ldir/$file;;" |\
Packit Service 5195f2
                    sed -e 's; -> .*$;;' -e 's;[ 	][ 	]*; ;g'`
Packit Service 5195f2
            n=`expr $# - 3`
Packit Service 5195f2
            eval "size=\`echo \${$n}\`"
Packit Service 5195f2
Packit Service 5195f2
            #   skip logfile if size is still too small
Packit Service 5195f2
            if [ $size -lt $opt_s ]; then
Packit Service 5195f2
                if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
                    echo "$ldir/$file: still too small in size -- skipping"
Packit Service 5195f2
                fi
Packit Service 5195f2
                continue
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   verbosity
Packit Service 5195f2
        if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
            echo "rotating $ldir/$file"
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   execute prolog
Packit Service 5195f2
        if [ ".$opt_P" != . ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "$opt_P"
Packit Service 5195f2
            fi
Packit Service 5195f2
            eval $opt_P
Packit Service 5195f2
            [ $? -ne 0 ] && shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   kick away out-rotated logfile
Packit Service 5195f2
        n=`expr $opt_n - 1`
Packit Service 5195f2
        n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n`
Packit Service 5195f2
        if [ -f "${adir}/${file}.${n}${comp_suf}" ]; then
Packit Service 5195f2
            #   optionally migrate away the out-rotated logfile
Packit Service 5195f2
            if [ ".$opt_M" != . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "$opt_M ${adir}/${file}.${n}${comp_suf}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                eval "$opt_M ${adir}/${file}.${n}${comp_suf}"
Packit Service 5195f2
                [ $? -ne 0 ] && shtool_exit $?
Packit Service 5195f2
            fi
Packit Service 5195f2
            #   finally get rid of the out-rotated logfile
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "rm -f ${adir}/${file}.${n}${comp_suf}"
Packit Service 5195f2
            fi
Packit Service 5195f2
            rm -f ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   rotate already archived logfiles
Packit Service 5195f2
        while [ $n -gt 0 ]; do
Packit Service 5195f2
            m=$n
Packit Service 5195f2
            n=`expr $n - 1`
Packit Service 5195f2
            n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n`
Packit Service 5195f2
            if [ $n -eq 0 ] && [ ".$opt_d" = .yes ]; then
Packit Service 5195f2
                #   special case: first rotation file under delayed compression situation
Packit Service 5195f2
                if [ ! -f "${adir}/${file}.${n}" ]; then
Packit Service 5195f2
                    continue
Packit Service 5195f2
                fi
Packit Service 5195f2
Packit Service 5195f2
                #   compress file (delayed)
Packit Service 5195f2
                if [ ".$opt_b" = .yes ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "mv ${adir}/${file}.${n} ${adir}/${file}.${m}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    mv ${adir}/${file}.${n} ${adir}/${file}.${m} || shtool_exit $?
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${m} >${adir}/${file}.${m}${comp_suf}; rm -f ${adir}/${file}.${m}) &"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    ( ${comp_prg} ${comp_lvl} \
Packit Service 5195f2
                          <${adir}/${file}.${m} \
Packit Service 5195f2
                          >${adir}/${file}.${m}${comp_suf} || shtool_exit $?
Packit Service 5195f2
                      rm -f ${adir}/${file}.${m} || shtool_exit $?
Packit Service 5195f2
                    ) </dev/null >/dev/null 2>&1 &
Packit Service 5195f2
                else
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${m}${comp_suf}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    ${comp_prg} ${comp_lvl} \
Packit Service 5195f2
                        <${adir}/${file}.${n} \
Packit Service 5195f2
                        >${adir}/${file}.${m}${comp_suf} || shtool_exit $?
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "rm -f ${adir}/${file}.${n}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    rm -f ${adir}/${file}.${n} || shtool_exit $?
Packit Service 5195f2
                fi
Packit Service 5195f2
Packit Service 5195f2
                #   fix file attributes
Packit Service 5195f2
                if [ ".$opt_o" != . ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chown $opt_o ${adir}/${file}.${m}${comp_suf}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chown $opt_o ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_g" != . ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chgrp $opt_g ${adir}/${file}.${m}${comp_suf}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chgrp $opt_g ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_m" != . ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chmod $opt_m ${adir}/${file}.${m}${comp_suf}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chmod $opt_m ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
Packit Service 5195f2
                fi
Packit Service 5195f2
            else
Packit Service 5195f2
                #   standard case: second and following rotation file
Packit Service 5195f2
                if [ ! -f "${adir}/${file}.${n}${comp_suf}" ]; then
Packit Service 5195f2
                    continue
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf} || shtool_exit $?
Packit Service 5195f2
            fi
Packit Service 5195f2
        done
Packit Service 5195f2
Packit Service 5195f2
        #   move away current logfile
Packit Service 5195f2
        if [ ".$opt_c" = .yes ]; then
Packit Service 5195f2
            #   approach: copy[+truncate]
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "cp -p ${ldir}/${file} ${adir}/${file}.${n}"
Packit Service 5195f2
            fi
Packit Service 5195f2
            cp -p ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $?
Packit Service 5195f2
            if [ ".$opt_r" = .no ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "cp /dev/null ${ldir}/${file}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                cp /dev/null ${ldir}/${file} || shtool_exit $?
Packit Service 5195f2
            fi
Packit Service 5195f2
        else
Packit Service 5195f2
            #   approach: move[+touch]
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "mv ${ldir}/${file} ${adir}/${file}.${n}"
Packit Service 5195f2
            fi
Packit Service 5195f2
            mv ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $?
Packit Service 5195f2
            if [ ".$opt_r" = .no ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "touch ${ldir}/${file}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                touch ${ldir}/${file} || shtool_exit $?
Packit Service 5195f2
                #   fix file attributes
Packit Service 5195f2
                if [ ".$opt_o" != . ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chown $opt_o ${ldir}/${file}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chown $opt_o ${ldir}/${file} || shtool_exit $?
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_g" != . ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chgrp $opt_g ${ldir}/${file}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chgrp $opt_g ${ldir}/${file} || shtool_exit $?
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_m" != . ]; then
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "chmod $opt_m ${ldir}/${file}"
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    chmod $opt_m ${ldir}/${file} || shtool_exit $?
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   regular compression step
Packit Service 5195f2
        if [ ".$opt_z" != . ] && [ ".$opt_d" = .no ]; then
Packit Service 5195f2
            #   compress file
Packit Service 5195f2
            if [ ".$opt_b" = .yes ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}; rm -f ${adir}/${file}.${n}) &"
Packit Service 5195f2
                fi
Packit Service 5195f2
                ( ${comp_prg} ${comp_lvl} \
Packit Service 5195f2
                      <${adir}/${file}.${n} \
Packit Service 5195f2
                      >${adir}/${file}.${n}${comp_suf} || shtool_exit $?
Packit Service 5195f2
                  rm -f ${adir}/${file}.${n} || shtool_exit $?
Packit Service 5195f2
                ) </dev/null >/dev/null 2>&1 &
Packit Service 5195f2
            else
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                ${comp_prg} ${comp_lvl} \
Packit Service 5195f2
                    <${adir}/${file}.${n} \
Packit Service 5195f2
                    >${adir}/${file}.${n}${comp_suf} || shtool_exit $?
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "rm -f ${opt_a}${file}.${n}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                rm -f ${adir}/${file}.${n} || shtool_exit $?
Packit Service 5195f2
            fi
Packit Service 5195f2
Packit Service 5195f2
            #   fix file attributes
Packit Service 5195f2
            if [ ".$opt_o" != . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "chown $opt_o ${adir}/${file}.${n}${comp_suf}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                chown $opt_o ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$opt_g" != . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "chgrp $opt_g ${adir}/${file}.${n}${comp_suf}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                chgrp $opt_g ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$opt_m" != . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "chmod $opt_m ${adir}/${file}.${n}${comp_suf}"
Packit Service 5195f2
                fi
Packit Service 5195f2
                chmod $opt_m ${adir}/${file}.${n}${comp_suf} || shtool_exit $?
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
Packit Service 5195f2
        #   execute epilog
Packit Service 5195f2
        if [ ".$opt_E" != . ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "$opt_E"
Packit Service 5195f2
            fi
Packit Service 5195f2
            eval $opt_E
Packit Service 5195f2
            [ $? -ne 0 ] && shtool_exit $?
Packit Service 5195f2
        fi
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
tarball )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  tarball -- Roll distribution tarballs
Packit Service 5195f2
    ##  Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    srcs="$*"
Packit Service 5195f2
Packit Service 5195f2
    #   check whether the test command supports the -x option
Packit Service 5195f2
    if [ -x /bin/sh ] 2>/dev/null; then
Packit Service 5195f2
        minusx="-x"
Packit Service 5195f2
    else
Packit Service 5195f2
        minusx="-r"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   find the tools
Packit Service 5195f2
    paths="`echo $PATH |\
Packit Service 5195f2
            sed -e 's%/*:%:%g' -e 's%/*$%%' \
Packit Service 5195f2
                -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
Packit Service 5195f2
                -e 's/:/ /g'`"
Packit Service 5195f2
    for spec in find:gfind,find tar:gtar,tar tardy:tardy,tarcust; do
Packit Service 5195f2
        prg=`echo $spec | sed -e 's/:.*$//'`
Packit Service 5195f2
        tools=`echo $spec | sed -e 's/^.*://'`
Packit Service 5195f2
        eval "prg_${prg}=''"
Packit Service 5195f2
        #   iterate over tools
Packit Service 5195f2
        for tool in `echo $tools | sed -e 's/,/ /g'`; do
Packit Service 5195f2
            #   iterate over paths
Packit Service 5195f2
            for path in $paths; do
Packit Service 5195f2
                if [ $minusx "$path/$tool" ] && [ ! -d "$path/$tool" ]; then
Packit Service 5195f2
                    eval "prg_${prg}=\"$path/$tool\""
Packit Service 5195f2
                    break
Packit Service 5195f2
                fi
Packit Service 5195f2
            done
Packit Service 5195f2
            eval "val=\$prg_${prg}"
Packit Service 5195f2
            if [ ".$val" != . ]; then
Packit Service 5195f2
                break
Packit Service 5195f2
            fi
Packit Service 5195f2
        done
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    #   expand source paths
Packit Service 5195f2
    exclude=''
Packit Service 5195f2
    for pat in `echo $opt_e | sed 's/,/ /g'`; do
Packit Service 5195f2
        exclude="$exclude | grep -v '$pat'"
Packit Service 5195f2
    done
Packit Service 5195f2
    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
        echo "cp /dev/null $tmpfile.lst" 1>&2
Packit Service 5195f2
    fi
Packit Service 5195f2
    cp /dev/null $tmpfile.lst
Packit Service 5195f2
    for src in $srcs; do
Packit Service 5195f2
        if [ -d $src ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "(cd $src && $prg_find . -type f -depth -print) | sed -e 's:^\\.\$::' -e 's:^\\./::' | cat $exclude >>$tmpfile.lst" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            (cd $src && $prg_find . -type f -depth -print) |\
Packit Service 5195f2
            sed -e 's:^\.$::' -e 's:^\./::' | eval cat $exclude >>$tmpfile.lst
Packit Service 5195f2
        else
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "echo $src >>$tmpfile.lst" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            echo $src >>$tmpfile.lst
Packit Service 5195f2
        fi
Packit Service 5195f2
    done
Packit Service 5195f2
    sort <$tmpfile.lst >$tmpfile.lst.n
Packit Service 5195f2
    mv $tmpfile.lst.n $tmpfile.lst
Packit Service 5195f2
    if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
        cat $tmpfile.lst | sed -e 's/^/  /' 1>&2
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine tarball file and directory name
Packit Service 5195f2
    if [ ".$opt_o" != . ]; then
Packit Service 5195f2
        tarfile="$opt_o"
Packit Service 5195f2
        if [ ".$opt_d" != . ]; then
Packit Service 5195f2
            tarname="$opt_d"
Packit Service 5195f2
        else
Packit Service 5195f2
            tarname=`echo $tarfile | sed -e 's/\.tar.*$//' -e 's;.*/\([^/]*\)$;\1;'`
Packit Service 5195f2
        fi
Packit Service 5195f2
    else
Packit Service 5195f2
        if [ ".$opt_d" != . ]; then
Packit Service 5195f2
            tarname="$opt_d"
Packit Service 5195f2
        elif [ -d "$from" ]; then
Packit Service 5195f2
            tarname=`echo $from | sed -e 's;.*/\([^/]*\)$;\1;'`
Packit Service 5195f2
        else
Packit Service 5195f2
            tarname="out"
Packit Service 5195f2
        fi
Packit Service 5195f2
        tarfile="$tarname.tar"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   roll the tarball
Packit Service 5195f2
    compress=''
Packit Service 5195f2
    if [ ".$opt_c" != . ]; then
Packit Service 5195f2
        compress="| $opt_c"
Packit Service 5195f2
    fi
Packit Service 5195f2
    if [ ".$prg_tardy" != . ]; then
Packit Service 5195f2
        #   the elegant hackers way
Packit Service 5195f2
        tardy_opt="--prefix=$tarname"
Packit Service 5195f2
        tardy_opt="$tardy_opt --user_number=0 --group_number=0" # security!
Packit Service 5195f2
        if [ ".$opt_u" != . ]; then
Packit Service 5195f2
            tardy_opt="$tardy_opt --user_name=$opt_u"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_g" != . ]; then
Packit Service 5195f2
            tardy_opt="$tardy_opt --group_name=$opt_g"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "cat $tmpfile.lst | xargs $prg_tar cf - | $prg_tardy $tardy_opt | cat $compress >$tmpfile.out" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        cat $tmpfile.lst |\
Packit Service 5195f2
        xargs $prg_tar cf - |\
Packit Service 5195f2
        $prg_tardy $tardy_opt |\
Packit Service 5195f2
        eval cat $compress >$tmpfile.out
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "cp $tmpfile.out $tarfile" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        cp $tmpfile.out $tarfile
Packit Service 5195f2
    else
Packit Service 5195f2
        #  the portable standard way
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "mkdir $tmpdir/$tarname" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        mkdir $tmpdir/$tarname || shtool_exit 1
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "cat $tmpfile.lst | xargs $prg_tar cf - | (cd $tmpdir/$tarname && $prg_tar xf -)" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        cat $tmpfile.lst |\
Packit Service 5195f2
        xargs $prg_tar cf - |\
Packit Service 5195f2
        (cd $tmpdir/$tarname && $prg_tar xf -)
Packit Service 5195f2
        if [ ".$opt_u" != . ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1" 2>&1
Packit Service 5195f2
            fi
Packit Service 5195f2
            chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1 ||\
Packit Service 5195f2
            echo "$msgprefix:Warning: cannot set user name \`$opt_u' (would require root privileges)"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_g" != . ]; then
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1" 2>&1
Packit Service 5195f2
            fi
Packit Service 5195f2
            chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1 ||\
Packit Service 5195f2
            echo "$msgprefix:Warning: cannot set group name \`$opt_g' (would require root privileges)"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "(cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) | cat $compress >$tmpfile.out" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        (cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) |\
Packit Service 5195f2
        eval cat $compress >$tmpfile.out
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "cp $tmpfile.out $tarfile" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        cp $tmpfile.out $tarfile
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "rm -rf $tmpdir/$tarname" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        rm -rf $tmpdir/$tarname
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   cleanup
Packit Service 5195f2
    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
        echo "rm -f $tmpfile.lst $tmpfile.out" 1>&2
Packit Service 5195f2
    fi
Packit Service 5195f2
    rm -f $tmpfile.lst $tmpfile.out
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
subst )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  subst -- Apply sed(1) substitution operations
Packit Service 5195f2
    ##  Copyright (c) 2001-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    #   remember optional list of file(s)
Packit Service 5195f2
    files="$*"
Packit Service 5195f2
    files_num="$#"
Packit Service 5195f2
Packit Service 5195f2
    #   parameter consistency check
Packit Service 5195f2
    if [ $# -eq 0 ] && [ ".$opt_b" != . ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: option -b cannot be applied to stdin" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
    if [ $# -eq 0 ] && [ ".$opt_s" = .yes ]; then
Packit Service 5195f2
        echo "$msgprefix:Error: option -s cannot be applied to stdin" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   build underlying sed(1) command
Packit Service 5195f2
    sedcmd='sed'
Packit Service 5195f2
    if [ ".$opt_e" != . ]; then
Packit Service 5195f2
        OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS"
Packit Service 5195f2
        for e
Packit Service 5195f2
        do
Packit Service 5195f2
            sedcmd="$sedcmd -e '$e'"
Packit Service 5195f2
        done
Packit Service 5195f2
    elif [ ".$opt_f" != . ]; then
Packit Service 5195f2
        if [ ! -f $opt_f ]; then
Packit Service 5195f2
            echo "$msgprefix:Error: command file \`$opt_f' not found or not a regular file" 1>&2
Packit Service 5195f2
            shtool_exit 1
Packit Service 5195f2
        fi
Packit Service 5195f2
        sedcmd="$sedcmd -f '$opt_f'"
Packit Service 5195f2
    else
Packit Service 5195f2
        echo "$msgprefix:Error: either -e option(s) or -f option required" 1>&2
Packit Service 5195f2
        shtool_exit 1
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   determine extension for original file
Packit Service 5195f2
    orig=".orig"
Packit Service 5195f2
    if [ ".$opt_b" != . ]; then
Packit Service 5195f2
        orig="$opt_b"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   apply sed(1) operation(s)
Packit Service 5195f2
    if [ ".$files" != . ]; then
Packit Service 5195f2
        #   apply operation(s) to files
Packit Service 5195f2
        substdone=no
Packit Service 5195f2
        for file in $files; do
Packit Service 5195f2
            test ".$file" = . && continue
Packit Service 5195f2
            if [ ! -f $file ]; then
Packit Service 5195f2
                echo "$msgprefix:Warning: file \`$file' not found or not a regular file" 1>&2
Packit Service 5195f2
                continue
Packit Service 5195f2
            fi
Packit Service 5195f2
Packit Service 5195f2
            #   handle interactive mode
Packit Service 5195f2
            if [ ".$opt_i" = .yes ]; then
Packit Service 5195f2
                eval "$sedcmd <$file >$file.new"
Packit Service 5195f2
                skip=no
Packit Service 5195f2
                if cmp $file $file.new >/dev/null 2>&1; then
Packit Service 5195f2
                    rm -f $file.new
Packit Service 5195f2
                    skip=yes
Packit Service 5195f2
                else
Packit Service 5195f2
                    (diff -U1 $file $file.new >$tmpfile) 2>/dev/null
Packit Service 5195f2
                    if [ ".`cat $tmpfile`" = . ]; then
Packit Service 5195f2
                        (diff -C1 $file $file.new >$tmpfile) 2>/dev/null
Packit Service 5195f2
                        if [ ".`cat $tmpfile`" = . ]; then
Packit Service 5195f2
                            echo "$msgprefix:Warning: unable to show difference for file \`$file'" 1>&2
Packit Service 5195f2
                            cp /dev/null $tmpfile
Packit Service 5195f2
                        fi
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    rm -f $file.new
Packit Service 5195f2
                    cat $tmpfile
Packit Service 5195f2
                    echo dummy | awk '{ printf("%s", TEXT); }' TEXT=">>> Apply [Y/n]: "
Packit Service 5195f2
                    read input
Packit Service 5195f2
                    if [ ".$input" != .Y ] &&\
Packit Service 5195f2
                       [ ".$input" != .y ] &&\
Packit Service 5195f2
                       [ ".$input" != . ]; then
Packit Service 5195f2
                       skip=yes
Packit Service 5195f2
                    fi
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$skip" = .yes ]; then
Packit Service 5195f2
                    if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
                        echo "file \`$file' -- skipped" 1>&2
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    continue
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
Packit Service 5195f2
            #   apply sed(1) operation(s)
Packit Service 5195f2
            if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
                echo "patching \`$file'" 1>&2
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                echo "\$ cp -p $file $file$orig"
Packit Service 5195f2
                echo "\$ chmod u+w $file"
Packit Service 5195f2
                echo "\$ $sedcmd <$file$orig >$file"
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$opt_n" = .no ]; then
Packit Service 5195f2
                cp -p $file $file$orig
Packit Service 5195f2
                chmod u+w $file >/dev/null 2>&1 || true
Packit Service 5195f2
                eval "$sedcmd <$file$orig >$file"
Packit Service 5195f2
            fi
Packit Service 5195f2
Packit Service 5195f2
            #   optionally fix timestamp
Packit Service 5195f2
            if [ ".$opt_s" = .yes ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "\$ touch -r $file$orig $file"
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_n" = .no ]; then
Packit Service 5195f2
                    touch -r $file$orig $file
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
Packit Service 5195f2
            #   optionally check whether any content change actually occurred
Packit Service 5195f2
            if [ ".$opt_q" = .no ]; then
Packit Service 5195f2
                if cmp $file$orig $file >/dev/null 2>&1; then
Packit Service 5195f2
                    if [ ".$opt_w" = .yes ]; then
Packit Service 5195f2
                        echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2
Packit Service 5195f2
                    fi
Packit Service 5195f2
                else
Packit Service 5195f2
                    substdone=yes
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
Packit Service 5195f2
            #   optionally remove preserved original file
Packit Service 5195f2
            if [ ".$opt_b" = . ]; then
Packit Service 5195f2
                if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                    echo "\$ rm -f $file$orig"
Packit Service 5195f2
                fi
Packit Service 5195f2
                if [ ".$opt_n" = .no ]; then
Packit Service 5195f2
                    rm -f $file$orig
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        done
Packit Service 5195f2
        if [ ".$opt_q" = .no ] && [ ".$opt_w" = .no ]; then
Packit Service 5195f2
            if [ ".$substdone" = .no ]; then
Packit Service 5195f2
                if [ ".$files_num" = .1 ]; then
Packit Service 5195f2
                    echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2
Packit Service 5195f2
                else
Packit Service 5195f2
                    echo "$msgprefix:Warning: substitution resulted in no content change on any file" 1>&2
Packit Service 5195f2
                fi
Packit Service 5195f2
            fi
Packit Service 5195f2
        fi
Packit Service 5195f2
    else
Packit Service 5195f2
        #   apply operation(s) to stdin/stdout
Packit Service 5195f2
        if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
            echo "patching <stdin>" 1>&2
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
            echo "\$ $sedcmd"
Packit Service 5195f2
        fi
Packit Service 5195f2
        if [ ".$opt_n" = .no ]; then
Packit Service 5195f2
            eval "$sedcmd"
Packit Service 5195f2
        fi
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
platform )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  platform -- Platform Identification Utility
Packit Service 5195f2
    ##  Copyright (c) 2003-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    #   option post-processing
Packit Service 5195f2
    if [ ".$opt_t" != . ]; then
Packit Service 5195f2
        case "$opt_t" in
Packit Service 5195f2
            binary )
Packit Service 5195f2
                #   binary package id (OpenPKG RPM)
Packit Service 5195f2
                opt_F="%<ap>-%<sp>"
Packit Service 5195f2
                opt_L=yes
Packit Service 5195f2
                opt_S=""
Packit Service 5195f2
                opt_C="+"
Packit Service 5195f2
                ;;
Packit Service 5195f2
            build )
Packit Service 5195f2
                #   build time checking (OpenPKG RPM)
Packit Service 5195f2
                opt_F="%<at>-%<st>"
Packit Service 5195f2
                opt_L=yes
Packit Service 5195f2
                opt_S=""
Packit Service 5195f2
                opt_C="+"
Packit Service 5195f2
                ;;
Packit Service 5195f2
            gnu )
Packit Service 5195f2
                #   GNU config.guess style <arch>-<vendor>-<os><osversion>
Packit Service 5195f2
                opt_F="%<at>-unknown-%<st>"
Packit Service 5195f2
                opt_L=yes
Packit Service 5195f2
                opt_S=""
Packit Service 5195f2
                opt_C="+"
Packit Service 5195f2
                ;;
Packit Service 5195f2
            web )
Packit Service 5195f2
                #   non-whitespace HTTP Server-header id
Packit Service 5195f2
                opt_F="%<sp>-%<ap>"
Packit Service 5195f2
                opt_S="/"
Packit Service 5195f2
                opt_C="+"
Packit Service 5195f2
                ;;
Packit Service 5195f2
            summary)
Packit Service 5195f2
                #   human readable verbose summary information
Packit Service 5195f2
                opt_F="Class:      %[sc] (%[ac])\\nProduct:    %[sp] (%[ap])\\nTechnology: %[st] (%[at])"
Packit Service 5195f2
                opt_S=" "
Packit Service 5195f2
                opt_C="/"
Packit Service 5195f2
                ;;
Packit Service 5195f2
            all-in-one )
Packit Service 5195f2
                #   full-table all-in-one information
Packit Service 5195f2
                opt_F=""
Packit Service 5195f2
                opt_F="${opt_F}concise architecture class:      %<ac>\\n"
Packit Service 5195f2
                opt_F="${opt_F}regular architecture class:      %{ac}\\n"
Packit Service 5195f2
                opt_F="${opt_F}verbose architecture class:      %[ac]\\n"
Packit Service 5195f2
                opt_F="${opt_F}concise architecture product:    %<ap>\\n"
Packit Service 5195f2
                opt_F="${opt_F}regular architecture product:    %{ap}\\n"
Packit Service 5195f2
                opt_F="${opt_F}verbose architecture product:    %[ap]\\n"
Packit Service 5195f2
                opt_F="${opt_F}concise architecture technology: %<at>\\n"
Packit Service 5195f2
                opt_F="${opt_F}regular architecture technology: %{at}\\n"
Packit Service 5195f2
                opt_F="${opt_F}verbose architecture technology: %[at]\\n"
Packit Service 5195f2
                opt_F="${opt_F}concise system class:            %<sc>\\n"
Packit Service 5195f2
                opt_F="${opt_F}regular system class:            %{sc}\\n"
Packit Service 5195f2
                opt_F="${opt_F}verbose system class:            %[sc]\\n"
Packit Service 5195f2
                opt_F="${opt_F}concise system product:          %<sp>\\n"
Packit Service 5195f2
                opt_F="${opt_F}regular system product:          %{sp}\\n"
Packit Service 5195f2
                opt_F="${opt_F}verbose system product:          %[sp]\\n"
Packit Service 5195f2
                opt_F="${opt_F}concise system technology:       %<st>\\n"
Packit Service 5195f2
                opt_F="${opt_F}regular system technology:       %{st}\\n"
Packit Service 5195f2
                opt_F="${opt_F}verbose system technology:       %[st]"
Packit Service 5195f2
                ;;
Packit Service 5195f2
            * )
Packit Service 5195f2
                echo "$msgprefix:Error: invalid type \`$opt_t'" 1>&2
Packit Service 5195f2
                exit 1
Packit Service 5195f2
                ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   assemble initial platform information
Packit Service 5195f2
    UNAME_MACHINE=`(uname -m) 2>/dev/null` ||\
Packit Service 5195f2
    UNAME_MACHINE=`(uname -p) 2>/dev/null` ||\
Packit Service 5195f2
    UNAME_MACHINE='unknown'
Packit Service 5195f2
    UNAME_SYSTEM=`(uname -s) 2>/dev/null`  ||\
Packit Service 5195f2
    UNAME_SYSTEM='unknown'
Packit Service 5195f2
    UNAME_RELEASE=`(uname -r) 2>/dev/null` ||\
Packit Service 5195f2
    UNAME_RELEASE=`(uname -v) 2>/dev/null` ||\
Packit Service 5195f2
    UNAME_RELEASE='unknown'
Packit Service 5195f2
Packit Service 5195f2
    UNAME="${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}"
Packit Service 5195f2
Packit Service 5195f2
    AC=""; AP=""; AT=""
Packit Service 5195f2
    SC=""; SP=""; ST=""
Packit Service 5195f2
Packit Service 5195f2
    #    dispatch into platform specific sections
Packit Service 5195f2
    case "${UNAME}" in
Packit Service 5195f2
Packit Service 5195f2
        #   FreeBSD
Packit Service 5195f2
        *:FreeBSD:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AC="${UNAME_MACHINE}"
Packit Service 5195f2
            case "${AC}" in
Packit Service 5195f2
                i386 ) AC="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AP="${AC}"
Packit Service 5195f2
            AT="${AP}"
Packit Service 5195f2
            if [ ".${AT}" = ".iX86" ]; then
Packit Service 5195f2
                case "`(/sbin/sysctl -n hw.model) 2>&1`" in
Packit Service 5195f2
                    *"Xeon"* | *"Pentium Pro"* | *"Cyrix 6x86MX"* | *"Pentium II"* | *"Pentium III"* | *"Pentium 4"* | *"Celeron"* ) AT="i686" ;;
Packit Service 5195f2
                    *"Pentium"* ) AT="i586" ;; *"i486[SD]X"* | *"Cyrix 486"* | *"Cyrix [56]x86"* | *"Blue Lightning" | *"Cyrix 486S/DX" ) AT="i486" ;;
Packit Service 5195f2
                    *"i386[SD]X"* | *"NexGen 586"* ) AT="i386" ;;
Packit Service 5195f2
                esac
Packit Service 5195f2
            fi
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            r=`echo "${UNAME_RELEASE}" |\
Packit Service 5195f2
               sed -e 's;[()];;' -e 's/\(-.*\)$/[\1]/'`
Packit Service 5195f2
            ST="FreeBSD ${r}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            case "${r}" in
Packit Service 5195f2
                1.* ) SC="4.3BSD" ;;
Packit Service 5195f2
                *   ) SC="4.4BSD" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   NetBSD
Packit Service 5195f2
        *:NetBSD:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                i[3-6]86 ) AP="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'`
Packit Service 5195f2
            ST="NetBSD ${r}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            case "${r}" in
Packit Service 5195f2
                0.* ) SC="4.3BSD" ;;
Packit Service 5195f2
                *   ) SC="4.4BSD" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   OpenBSD
Packit Service 5195f2
        *:OpenBSD:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                i[3-6]86 ) AP="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'`
Packit Service 5195f2
            ST="OpenBSD ${r}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            SC="4.4BSD"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   DragonFly BSD
Packit Service 5195f2
        *:DragonFly:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                i[3-6]86 ) AP="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'`
Packit Service 5195f2
            ST="DragonFly ${r}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            SC="4.4BSD"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   GNU/Linux
Packit Service 5195f2
        *:Linux:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            case "${AT}" in
Packit Service 5195f2
               ia64     ) AT="IA64"   ;;
Packit Service 5195f2
               x86_64   ) AT='AMD64'  ;;
Packit Service 5195f2
               parisc   ) AT="HPPA32" ;;
Packit Service 5195f2
               parisc64 ) AT="HPPA64" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
               i[3-6]86 ) AP='iX86' ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            v_kern=`echo "${UNAME_RELEASE}" |\
Packit Service 5195f2
                sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
Packit Service 5195f2
            v_libc=`(strings /lib/libc.so.* | grep '^GLIBC_' | sed -e 's/^GLIBC_//' |\
Packit Service 5195f2
                env -i sort -n | sed -n -e '$p' | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') 2>/dev/null`
Packit Service 5195f2
            ST="GNU/<Linux >${v_libc}/<${v_kern}>"
Packit Service 5195f2
            if [ -f /etc/lsb-release ]; then
Packit Service 5195f2
                eval `( . /etc/lsb-release
Packit Service 5195f2
                    echo "SC=\"LSB${LSB_VERSION}\""
Packit Service 5195f2
                    if [ ".${DISTRIB_ID}" != . -a ".${DISTRIB_RELEASE}" != . ]; then
Packit Service 5195f2
                        echo "SP=\"${DISTRIB_ID} ${DISTRIB_RELEASE}\""
Packit Service 5195f2
                    fi
Packit Service 5195f2
                ) 2>/dev/null`
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$SP" = . ]; then
Packit Service 5195f2
                for tagfile in x \
Packit Service 5195f2
                    `cd /etc && \
Packit Service 5195f2
                    /bin/ls *[_-]release *[_-]version 2>/dev/null | env -i sort | \
Packit Service 5195f2
                    sed -e '/^redhat-release$/d' -e '/^lsb-release$/d'; \
Packit Service 5195f2
                    echo redhat-release lsb-release`
Packit Service 5195f2
                do
Packit Service 5195f2
                    [ ".${tagfile}" = .x ] && continue
Packit Service 5195f2
                    [ ! -f "/etc/${tagfile}" ] && continue
Packit Service 5195f2
                    n=`echo ${tagfile} | sed -e 's/[_-]release$//' -e 's/[_-]version$//'`
Packit Service 5195f2
                    v=`(grep VERSION /etc/${tagfile}; cat /etc/${tagfile}) | grep '[0-9]' | sed -e 'q' |\
Packit Service 5195f2
                       sed -e 's/^/#/' \
Packit Service 5195f2
                           -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
Packit Service 5195f2
                           -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
Packit Service 5195f2
                           -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
Packit Service 5195f2
                           -e 's/^#.*$//'`
Packit Service 5195f2
                    case "`util_lower ${n}`" in
Packit Service 5195f2
                        redhat )
Packit Service 5195f2
                            if [ ".`egrep '(Red Hat Enterprise Linux|CentOS)' /etc/${tagfile}`" != . ]; then
Packit Service 5195f2
                                n="<R>ed <H>at <E>nterprise <L>inux"
Packit Service 5195f2
                            else
Packit Service 5195f2
                                n="<R>ed <H>at <L>inux"
Packit Service 5195f2
                            fi
Packit Service 5195f2
                            ;;
Packit Service 5195f2
                        debian             ) n="Debian[ GNU/Linux]"        ;;
Packit Service 5195f2
                        ubuntu             ) n="Ubuntu[ GNU/Linux]"        ;;
Packit Service 5195f2
                        fedora             ) n="<Fedora> Core[ GNU/Linux]" ;;
Packit Service 5195f2
                        suse               ) n="[Novell ]SUSE[ Linux]"     ;;
Packit Service 5195f2
                        mandrake*|mandriva ) n="Mandriva[ Linux]"          ;;
Packit Service 5195f2
                        gentoo             ) n="Gentoo[ GNU/Linux]"        ;;
Packit Service 5195f2
                        slackware          ) n="Slackware[ Linux]"         ;;
Packit Service 5195f2
                        turbolinux         ) n="TurboLinux"                ;;
Packit Service 5195f2
                        unitedlinux        ) n="UnitedLinux"               ;;
Packit Service 5195f2
                        *                  ) n="${n}[ GNU/Linux]"          ;;
Packit Service 5195f2
                    esac
Packit Service 5195f2
                    case "$n" in
Packit Service 5195f2
                        *"<"*">"* ) SP="$n <$v>" ;;
Packit Service 5195f2
                        *         ) SP="$n $v"   ;;
Packit Service 5195f2
                    esac
Packit Service 5195f2
                    break
Packit Service 5195f2
                done
Packit Service 5195f2
            fi
Packit Service 5195f2
            [ ".$SP" = . ] && SP="${ST}"
Packit Service 5195f2
            [ ".$SC" = . ] && SC="LSB"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   Sun Solaris
Packit Service 5195f2
        *:SunOS:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            case "${AT}" in
Packit Service 5195f2
                i86pc )
Packit Service 5195f2
                    AT="iX86"
Packit Service 5195f2
                    case "`(/bin/isainfo -k) 2>&1`" in
Packit Service 5195f2
                        amd64 ) AT="AMD64" ;;
Packit Service 5195f2
                    esac
Packit Service 5195f2
                    ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                sun4[cdm] ) AP="SPARC32" ;;
Packit Service 5195f2
                sun4[uv]  ) AP="SPARC64" ;;
Packit Service 5195f2
                sun4*     ) AP="SPARC"   ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            case "${AC}" in
Packit Service 5195f2
                SPARC* ) AC="SPARC" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            ST="[Sun ]SunOS ${UNAME_RELEASE}"
Packit Service 5195f2
            v=`echo "${UNAME_RELEASE}" |\
Packit Service 5195f2
               sed -e 's;^4\.;1.;' \
Packit Service 5195f2
                   -e 's;^5\.\([0-6]\)[^0-9]*$;2.\1;' \
Packit Service 5195f2
                   -e 's;^5\.\([0-9][0-9]*\).*;\1;'`
Packit Service 5195f2
            SP="[Sun ]Solaris $v"
Packit Service 5195f2
            case "${UNAME_RELEASE}" in
Packit Service 5195f2
                4.* ) SC="4.3BSD" ;;
Packit Service 5195f2
                5.* ) SC="SVR4"   ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   SCO UnixWare
Packit Service 5195f2
        *:UnixWare:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            case "${AT}" in
Packit Service 5195f2
                i[3-6]86 | ix86at ) AT="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            v=`/sbin/uname -v`
Packit Service 5195f2
            ST="[SCO ]UnixWare ${v}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            SC="SVR${UNAME_RELEASE}"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   QNX
Packit Service 5195f2
        *:QNX:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            case "${AT}" in
Packit Service 5195f2
                x86pc ) AT="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            v="${UNAME_RELEASE}"
Packit Service 5195f2
            ST="QNX[ Neutrino RTOS] ${v}"
Packit Service 5195f2
            v=`echo "${v}" | sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;'`
Packit Service 5195f2
            SP="QNX[ Neutrino RTOS] ${v}"
Packit Service 5195f2
            SC="QNX"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   SGI IRIX
Packit Service 5195f2
        *:IRIX*:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}:${UNAME_SYSTEM}" in
Packit Service 5195f2
                IP*:IRIX64 ) AP="MIPS64" ;;
Packit Service 5195f2
                IP*:*      ) AP="MIPS"   ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            v=`(/bin/uname -R || /bin/uname -r) 2>/dev/null | sed -e 's;[0-9.]* ;;'`
Packit Service 5195f2
            ST="[SGI ]IRIX ${v}"
Packit Service 5195f2
            v="${UNAME_RELEASE}"
Packit Service 5195f2
            SP="[SGI ]IRIX ${v}"
Packit Service 5195f2
            SC="4.2BSD/SVR3"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   HP HP-UX
Packit Service 5195f2
        *:HP-UX:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="${UNAME_MACHINE}"
Packit Service 5195f2
            case "${AT}" in
Packit Service 5195f2
                ia64 ) AT="IA64" ;;
Packit Service 5195f2
                9000/[34]?? ) AT=M68K ;;
Packit Service 5195f2
                9000/[678][0-9][0-9])
Packit Service 5195f2
                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
Packit Service 5195f2
                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
Packit Service 5195f2
                    case "${sc_cpu_version}" in
Packit Service 5195f2
                        523 ) AT="HPPA1.0" ;;
Packit Service 5195f2
                        528 ) AT="HPPA1.1" ;;
Packit Service 5195f2
                        532 ) AT="HPPA2.0"
Packit Service 5195f2
                            case "${sc_kernel_bits}" in
Packit Service 5195f2
                                32 ) AT="${AT}n" ;;
Packit Service 5195f2
                                64 ) AT="${AT}w" ;;
Packit Service 5195f2
                            esac
Packit Service 5195f2
                            ;;
Packit Service 5195f2
                    esac
Packit Service 5195f2
                    ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                HPPA* ) AP="HPPA" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            v=`echo "${UNAME_RELEASE}" | sed -e 's;^[^0-9]*;;'`
Packit Service 5195f2
            ST="[HP ]<HP>-<UX ${v}>"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            case "${v}" in
Packit Service 5195f2
                10.*   ) SC="SVR4.2" ;;
Packit Service 5195f2
                [7-9]* ) SC="SVR4"   ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   HP Tru64 (OSF1)
Packit Service 5195f2
        *:OSF1:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AP="${UNAME_MACHINE}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                alpha ) AP="Alpha" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            alpha_type=`(/usr/sbin/psrinfo -v) 2>/dev/null |\
Packit Service 5195f2
                sed -n -e 's/^.*The alpha \([^ ][^ ]*\).*processor.*$/\1/p' | sed -e 'q'`
Packit Service 5195f2
            AT="${AP}${alpha_type}"
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            v=`echo "${UNAME_RELEASE}" | sed -e 's;^[VTX];;'`
Packit Service 5195f2
            ST="[HP ]Tru64 ${v}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            SC="OSF1"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   IBM AIX
Packit Service 5195f2
        *:AIX:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            cpu_arch=RS6000
Packit Service 5195f2
            if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then
Packit Service 5195f2
                cpu_id=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
Packit Service 5195f2
                if [ ".`/usr/sbin/lsattr -El ${cpu_id} | grep -i powerpc`" != . ]; then
Packit Service 5195f2
                    cpu_arch=PPC
Packit Service 5195f2
                fi
Packit Service 5195f2
            elif [ -d /QOpenSys ]; then
Packit Service 5195f2
                #   IBM i5/OS (aka OS/400) with PASE (Portable Application Solutions Environment)
Packit Service 5195f2
                cpu_arch=PPC
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ -x /usr/bin/oslevel ]; then
Packit Service 5195f2
                os_level=`/usr/bin/oslevel`
Packit Service 5195f2
            else
Packit Service 5195f2
                os_level="`uname -v`.`uname -r`"
Packit Service 5195f2
            fi
Packit Service 5195f2
            os_level=`echo "${os_level}" |\
Packit Service 5195f2
                      sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(\.[0-9][0-9]*\)\(.*\)$;<\1>\2[\3];' \
Packit Service 5195f2
                          -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(.*\)$;<\1>\2;'`
Packit Service 5195f2
            AT="${cpu_arch}"
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            ST="[IBM ]<AIX >${os_level}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            case "${os_level}" in
Packit Service 5195f2
                [12]* ) SC="SVR2" ;;
Packit Service 5195f2
                *     ) SC="SVR4" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   Apple Mac OS X (Darwin)
Packit Service 5195f2
        *:Darwin:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="`uname -p`"
Packit Service 5195f2
            case "${AT}" in
Packit Service 5195f2
                powerpc ) AT="PPC" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                i?86 ) AP="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            unset v1; unset v2; unset v3
Packit Service 5195f2
            eval `echo "${UNAME_RELEASE}" |\
Packit Service 5195f2
                  sed -e 's/^/#/' \
Packit Service 5195f2
                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
Packit Service 5195f2
                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
Packit Service 5195f2
                      -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
Packit Service 5195f2
                      -e 's/^#.*$/v1="0"/'`
Packit Service 5195f2
            ST="[Apple ]<${UNAME_SYSTEM} ${v1}>${v2+.$v2}${v3+[.$v3]}"
Packit Service 5195f2
            SP="$ST"
Packit Service 5195f2
            v="`(sw_vers) 2>/dev/null | grep 'ProductVersion:' | sed -e 's/^ProductVersion:[^0-9]*\([0-9][0-9.]*\).*$/\1/'`"
Packit Service 5195f2
            if [ ".$v" = . ]; then
Packit Service 5195f2
                for name in System Server; do
Packit Service 5195f2
                    if [ -f /System/Library/CoreServices/${name}Version.plist ]; then
Packit Service 5195f2
                        v=`(defaults read "/System/Library/CoreServices/${name}Version" "ProductVersion") 2>/dev/null`
Packit Service 5195f2
                        [ ".$v" != . ] && break
Packit Service 5195f2
                    fi
Packit Service 5195f2
                done
Packit Service 5195f2
            fi
Packit Service 5195f2
            if [ ".$v" != . ]; then
Packit Service 5195f2
                unset v1; unset v2; unset v3
Packit Service 5195f2
                eval `echo "${v}" |\
Packit Service 5195f2
                      sed -e 's/^/#/' \
Packit Service 5195f2
                          -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
Packit Service 5195f2
                          -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
Packit Service 5195f2
                          -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
Packit Service 5195f2
                          -e 's/^#.*$/v1="0"/'`
Packit Service 5195f2
                SP="[Apple ]Mac OS X ${v1}${v2+.$v2}${v3+[.$v3]}"
Packit Service 5195f2
            fi
Packit Service 5195f2
            SC="4.4BSD/Mach3.0"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   Windows/Cygwin
Packit Service 5195f2
        *:CYGWIN*:* )
Packit Service 5195f2
            #   determine architecture
Packit Service 5195f2
            AT="`uname -m`"
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            case "${AP}" in
Packit Service 5195f2
                i?86 ) AP="iX86" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            #   determine system
Packit Service 5195f2
            unset v1; unset v2; unset v3
Packit Service 5195f2
            eval `echo "${UNAME_RELEASE}" |\
Packit Service 5195f2
                  sed -e 's/^/#/' \
Packit Service 5195f2
                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \
Packit Service 5195f2
                      -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \
Packit Service 5195f2
                      -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \
Packit Service 5195f2
                      -e 's/^#.*$/v1="0"/'`
Packit Service 5195f2
            ST="Cygwin ${v1}${v2+.$v2}${v3+[.$v3]}"
Packit Service 5195f2
            SP="$ST"
Packit Service 5195f2
            SC="Windows"
Packit Service 5195f2
            v=`echo "${UNAME_SYSTEM}" | sed -e 's/^CYGWIN_NT-//' |\
Packit Service 5195f2
               sed -e 's/^/#/' -e 's/^#\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' -e 's/^#.*$//'`
Packit Service 5195f2
            case "$v" in
Packit Service 5195f2
                4.0 ) SC="$SC[ NT]"    ;;
Packit Service 5195f2
                5.0 ) SC="$SC[ 2000]"  ;;
Packit Service 5195f2
                5.1 ) SC="$SC[ XP]"    ;;
Packit Service 5195f2
                6.0 ) SC="$SC[ Vista]" ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
        #   TODO ...ADD YOUR NEW PLATFORM CHECK HERE... TODO
Packit Service 5195f2
        # *:XXX:* )
Packit Service 5195f2
        #   ...
Packit Service 5195f2
        #   ;;
Packit Service 5195f2
Packit Service 5195f2
        #   ...A STILL UNKNOWN PLATFORM...
Packit Service 5195f2
        * )
Packit Service 5195f2
            AT=`echo "${UNAME_MACHINE}" | sed -e "s; ;${opt_C};g"`
Packit Service 5195f2
            AP="${AT}"
Packit Service 5195f2
            AC="${AP}"
Packit Service 5195f2
            v=`echo "${UNAME_RELEASE}" |\
Packit Service 5195f2
               sed -e 's/^/#/' \
Packit Service 5195f2
                   -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
Packit Service 5195f2
                   -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \
Packit Service 5195f2
                   -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \
Packit Service 5195f2
                   -e 's/^#.*$/?/'`
Packit Service 5195f2
            ST="${UNAME_SYSTEM} ${v}"
Packit Service 5195f2
            SP="${ST}"
Packit Service 5195f2
            SC="${SP}"
Packit Service 5195f2
            ;;
Packit Service 5195f2
Packit Service 5195f2
    esac
Packit Service 5195f2
Packit Service 5195f2
    #   provide fallback values
Packit Service 5195f2
    [ ".$AT" = . ] && AT="${AP:-${AC}}"
Packit Service 5195f2
    [ ".$AP" = . ] && AP="${AT:-${AC}}"
Packit Service 5195f2
    [ ".$AC" = . ] && AC="${AP:-${AT}}"
Packit Service 5195f2
    [ ".$ST" = . ] && ST="${SP:-${SC}}"
Packit Service 5195f2
    [ ".$SP" = . ] && SP="${ST:-${SC}}"
Packit Service 5195f2
    [ ".$SC" = . ] && SC="${SP:-${ST}}"
Packit Service 5195f2
Packit Service 5195f2
    #   support explicit enforced verbose/concise output
Packit Service 5195f2
    if [ ".$opt_v" = .yes ]; then
Packit Service 5195f2
        opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%[\1]/g'`
Packit Service 5195f2
    elif [ ".$opt_c" = .yes ]; then
Packit Service 5195f2
        opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%<\1>/g'`
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   provide verbose and concise variants
Packit Service 5195f2
    AC_V=""; AC_N=""; AC_C=""
Packit Service 5195f2
    AP_V=""; AP_N=""; AP_C=""
Packit Service 5195f2
    AT_V=""; AT_N=""; AT_C=""
Packit Service 5195f2
    SC_V=""; SC_N=""; SC_C=""
Packit Service 5195f2
    SP_V=""; SP_N=""; SP_C=""
Packit Service 5195f2
    ST_V=""; ST_N=""; ST_C=""
Packit Service 5195f2
    for var_lc in at ap ac st sp sc; do
Packit Service 5195f2
        case "$opt_F" in
Packit Service 5195f2
            *"%[${val_lc}]"* | *"%{${val_lc}}"* | *"%${val_lc}"* | *"%<${val_lc}>"* )
Packit Service 5195f2
            var_uc=`util_upper "$var_lc"`
Packit Service 5195f2
            eval "val=\"\$${var_uc}\""
Packit Service 5195f2
            val_V=""; val_N=""; val_C=""
Packit Service 5195f2
            case "$opt_F" in
Packit Service 5195f2
                *"%[${var_lc}]"* )
Packit Service 5195f2
                    val_V=`echo ":$val" | \
Packit Service 5195f2
                           sed -e 's/^://' \
Packit Service 5195f2
                               -e 's;\[\([^]]*\)\];\1;g' \
Packit Service 5195f2
                               -e 's;<\([^>]*\)>;\1;g' \
Packit Service 5195f2
                               -e "s; ;§§;g" \
Packit Service 5195f2
                               -e "s;/;%%;g" \
Packit Service 5195f2
                               -e "s;§§;${opt_S};g" \
Packit Service 5195f2
                               -e "s;%%;${opt_C};g"`
Packit Service 5195f2
                    eval "${var_uc}_V=\"\${val_V}\""
Packit Service 5195f2
                    ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            case "$opt_F" in
Packit Service 5195f2
                *"%{${var_lc}}"* | *"%${var_lc}"* )
Packit Service 5195f2
                    val_N=`echo ":$val" | \
Packit Service 5195f2
                           sed -e 's/^://' \
Packit Service 5195f2
                               -e 's;\[\([^]]*\)\];;g' \
Packit Service 5195f2
                               -e 's;<\([^>]*\)>;\1;g' \
Packit Service 5195f2
                               -e "s; ;§§;g" \
Packit Service 5195f2
                               -e "s;/;%%;g" \
Packit Service 5195f2
                               -e "s;§§;${opt_S};g" \
Packit Service 5195f2
                               -e "s;%%;${opt_C};g"`
Packit Service 5195f2
                    eval "${var_uc}_N=\"\${val_N}\""
Packit Service 5195f2
                    ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            case "$opt_F" in
Packit Service 5195f2
                *"%<${var_lc}>"* )
Packit Service 5195f2
                    val_C=`echo ":$val" | \
Packit Service 5195f2
                           sed -e 's/^://' \
Packit Service 5195f2
                               -e 's;\[\([^]]*\)\];;g' \
Packit Service 5195f2
                               -e 's;[^<]*<\([^>]*\)>[^<]*;\1;g' \
Packit Service 5195f2
                               -e "s; ;§§;g" \
Packit Service 5195f2
                               -e "s;/;%%;g" \
Packit Service 5195f2
                               -e "s;§§;${opt_S};g" \
Packit Service 5195f2
                               -e "s;%%;${opt_C};g"`
Packit Service 5195f2
                    eval "${var_uc}_C=\"\${val_C}\""
Packit Service 5195f2
                    ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
            ;;
Packit Service 5195f2
        esac
Packit Service 5195f2
    done
Packit Service 5195f2
Packit Service 5195f2
    #   create output string
Packit Service 5195f2
    output=`echo ":$opt_F" |\
Packit Service 5195f2
            sed -e "s/^://" \
Packit Service 5195f2
                -e "s;%\\[ac\\];${AC_V};g" \
Packit Service 5195f2
                -e "s;%{ac};${AC_N};g" \
Packit Service 5195f2
                -e "s;%ac;${AC_N};g" \
Packit Service 5195f2
                -e "s;%<ac>;${AC_C};g" \
Packit Service 5195f2
                -e "s;%\\[ap\\];${AP_V};g" \
Packit Service 5195f2
                -e "s;%{ap};${AP_N};g" \
Packit Service 5195f2
                -e "s;%ap;${AP_N};g" \
Packit Service 5195f2
                -e "s;%<ap>;${AP_C};g" \
Packit Service 5195f2
                -e "s;%\\[at\\];${AT_V};g" \
Packit Service 5195f2
                -e "s;%{at};${AT_N};g" \
Packit Service 5195f2
                -e "s;%at;${AT_N};g" \
Packit Service 5195f2
                -e "s;%<at>;${AT_C};g" \
Packit Service 5195f2
                -e "s;%\\[sc\\];${SC_V};g" \
Packit Service 5195f2
                -e "s;%{sc};${SC_N};g" \
Packit Service 5195f2
                -e "s;%sc;${SC_N};g" \
Packit Service 5195f2
                -e "s;%<sc>;${SC_C};g" \
Packit Service 5195f2
                -e "s;%\\[sp\\];${SP_V};g" \
Packit Service 5195f2
                -e "s;%{sp};${SP_N};g" \
Packit Service 5195f2
                -e "s;%sp;${SP_N};g" \
Packit Service 5195f2
                -e "s;%<sp>;${SP_C};g" \
Packit Service 5195f2
                -e "s;%\\[st\\];${ST_V};g" \
Packit Service 5195f2
                -e "s;%{st};${ST_N};g" \
Packit Service 5195f2
                -e "s;%st;${ST_N};g" \
Packit Service 5195f2
                -e "s;%<st>;${ST_C};g" \
Packit Service 5195f2
                -e 's/\\\\n/^/g' |\
Packit Service 5195f2
             tr '^' '\012'`
Packit Service 5195f2
Packit Service 5195f2
    #   support lower/upper-case mapping
Packit Service 5195f2
    if [ ".$opt_L" = .yes ]; then
Packit Service 5195f2
        output=`util_lower "$output"`
Packit Service 5195f2
    elif [ ".$opt_U" = .yes ]; then
Packit Service 5195f2
        output=`util_upper "$output"`
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    #   display output string
Packit Service 5195f2
    if [ ".$opt_n" = .yes ]; then
Packit Service 5195f2
        echo . | awk '{ printf("%s", output); }' output="$output"
Packit Service 5195f2
    else
Packit Service 5195f2
        echo "$output"
Packit Service 5195f2
    fi
Packit Service 5195f2
Packit Service 5195f2
    shtool_exit 0
Packit Service 5195f2
    ;;
Packit Service 5195f2
Packit Service 5195f2
arx )
Packit Service 5195f2
    ##
Packit Service 5195f2
    ##  arx -- Extended archive command
Packit Service 5195f2
    ##  Copyright (c) 1999-2008 Ralf S. Engelschall <rse@engelschall.com>
Packit Service 5195f2
    ##
Packit Service 5195f2
Packit Service 5195f2
    ar_prg="$opt_C"
Packit Service 5195f2
    ar_cmd="$1"; shift
Packit Service 5195f2
    archive="$1"; shift
Packit Service 5195f2
    files="$*"
Packit Service 5195f2
Packit Service 5195f2
    #   walk through the file list and expand archives members
Packit Service 5195f2
    ar_tmpdir=`echo $archive | sed -e 's;[^/]*$;.arx;'`
Packit Service 5195f2
    nfiles=''
Packit Service 5195f2
    if [ ".$files" != . ]; then
Packit Service 5195f2
        for file in $files; do
Packit Service 5195f2
            if [ ! -f $file ]; then
Packit Service 5195f2
                echo "$msgprefix:Error: input file not found: $file" 1>&2
Packit Service 5195f2
                shtool_exit 1
Packit Service 5195f2
            fi
Packit Service 5195f2
            case $file in
Packit Service 5195f2
                *.a )
Packit Service 5195f2
                    if [ ! -d $ar_tmpdir ]; then
Packit Service 5195f2
                        if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                            echo "mkdir $ar_tmpdir" 1>&2
Packit Service 5195f2
                        fi
Packit Service 5195f2
                        mkdir $ar_tmpdir
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    case $ar_tmpdir in
Packit Service 5195f2
                         .arx )
Packit Service 5195f2
                             from="../$file"
Packit Service 5195f2
                             ;;
Packit Service 5195f2
                         * )
Packit Service 5195f2
                             dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'`
Packit Service 5195f2
                             base=`echo $file | sed -e 's;.*/\([^/]*\)$;\1;'`
Packit Service 5195f2
                             from="`cd $dir; pwd`/$base"
Packit Service 5195f2
                             ;;
Packit Service 5195f2
                    esac
Packit Service 5195f2
                    if [ ".$opt_t" = .yes ]; then
Packit Service 5195f2
                        echo "(cd $ar_tmpdir && $ar_prg x $from)" 1>&2
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    (cd $ar_tmpdir && eval $ar_prg x $from)
Packit Service 5195f2
                    if [ $? -ne 0 ]; then
Packit Service 5195f2
                        echo "$msgprefix:Error: member extraction failed for archive: $file" 1>&2
Packit Service 5195f2
                        shtool_exit 1
Packit Service 5195f2
                    fi
Packit Service 5195f2
                    for member in - `eval $ar_prg t $file | sed -e '/_\.SYMDEF/d'`; do
Packit Service 5195f2
                        [ ".$member" = .- ] && continue
Packit Service 5195f2
                        nfiles="$nfiles $ar_tmpdir/$member"
Packit Service 5195f2
                    done
Packit Service 5195f2
                    ;;
Packit Service 5195f2
                * )
Packit Service 5195f2
                    nfiles="$nfiles $file"
Packit Service 5195f2
                    ;;
Packit Service 5195f2
            esac
Packit Service 5195f2
        done