#!/usr/local/bin/zsh
reporter_OSVersion="`uname -s`_`uname -r`"
case ${reporter_OSVersion} in
SunOS_5.*)
CPP=${CPP:-/usr/ccs/lib/cpp}
AWK=${AWK:-nawk} ;;
esac
CPP=${CPP:-/lib/cpp}
AWK=${AWK:-awk}
reporter_do_all=yes
for reporter_each
do
case "$reporter_each"
in
ali*) reporter_do_aliases=yes; reporter_do_all=no ;;
b*) reporter_do_bindings=yes; reporter_do_all=no ;;
c*) reporter_do_compctl=yes; reporter_do_all=no ;;
f*) reporter_do_fun=yes; reporter_do_all=no ;;
l*) reporter_do_lim=yes; reporter_do_all=no ;;
m*) reporter_do_mod=yes; reporter_do_all=no ;;
o*) reporter_do_setopt=yes; reporter_do_all=no ;;
v*) reporter_do_vars=yes; reporter_do_all=no ;;
zs*|s*) reporter_do_zstyle=yes; reporter_do_all=no ;;
*) ;;
esac
done
reporter_junkiequotes="no"
reporter_shwordsplit="no"
reporter_kshoptprint="no"
reporter_nounset="no"
if [[ -o cshjunkiequotes ]]
then
reporter_junkiequotes="yes"
unsetopt cshjunkiequotes
fi
if [[ -o shwordsplit ]]
then
reporter_shwordsplit="yes"
unsetopt shwordsplit
fi
if [[ -o kshoptionprint ]]
then
reporter_kshoptprint="yes"
unsetopt kshoptionprint
fi
if [[ -o nounset ]]
then
reporter_nounset="yes"
unsetopt nounset
fi
reporter_cppdef=(`strings -3 ${CPP} |
sed -n '
/^[a-zA-Z_][a-zA-Z0-9_]*$/{
s/.*/ s/.* \(.*\)/"\1";/p
s/.*/ }
' | ${CPP} |sed '
/^[ ]*$/d
/^ s/.*"\(.*\)".*/\1/'`)
reporter_uname=""
for reporter_each in `echo $PATH | sed -e 's/:/ /g'`
do
if [[ -x $reporter_each/uname ]]
then
reporter_uname="$reporter_each/uname"
break
fi
done
case "$reporter_uname"
in
"") reporter_uname="echo not found on this system" ;;
*) ;;
esac
for reporter_each in $reporter_cppdef
do
case "$reporter_each"
in
pyr) reporter_uname="/bin/att uname" ;;
*) ;;
esac
done
echo 'echo 'echo
unset reporter_cppdef
unset reporter_uname
unset reporter_each
if [[ "$reporter_do_all" = "yes" || "$reporter_do_aliases" = "yes" ]]
then
echo ' echo
alias -L
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_bindings" = "yes" ]]
then
echo
echo "# Key bindings."
echo
bindkey -lL | grep -v ' \.safe$'
(
alias bindkey=bindkey
bindkey () {
[[ "$1" == "-N" ]] || return
[[ "$2" == "--" ]] && shift
[[ "$2" == ".safe" ]] && return
echo
builtin bindkey -L -M -- "$2"
}
eval "`builtin bindkey -lL`"
)
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_compctl" = "yes" ]]
then
echo
echo "# Completions."
echo
compctl -L
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_fun" = "yes" ]]
then
echo
echo "# Undefined functions."
echo
autoload + | ${AWK} '{print "autoload " $1}'
echo
echo "# Defined functions."
echo
(
unfunction `autoload +` 2>/dev/null
functions
)
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_lim" = "yes" ]]
then
echo
echo ' echo
(
set X `limit | grep "cputime" | grep -v "unlimited" |
sed -e 's/:/ /g'`
if test "$#" -gt 1
then
hr=$3
min=$4
sec=$5
if test "$hr" -gt 0
then
echo "limit cputime ${hr}h"
else
echo "limit cputime $min:$sec"
fi
fi
)
limit | grep -v "cputime" | grep -v "unlimited" |
sed -e 's/Mb/m/' -e 's/Kb/k/' |
${AWK} 'NF > 1 {print "limit " $0}'
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_mod" = "yes" ]]
then
echo
if ( zmodload ) >& /dev/null; then
echo "# Modules."
echo
zmodload -d -L
echo
zmodload -ab -L
echo
zmodload -ac -L
echo
zmodload -ap -L
echo
zmodload -L
else
echo "# Modules: zmodload not available."
fi
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_vars" = "yes" ]]
then
echo
echo "# Non-array variables."
echo
(
zmodload -u `zmodload | grep parameter` 2>/dev/null
echo "ARGC=0"
eval `typeset + |
grep -v 'array ' |
grep -v 'association ' |
grep -v 'undefined ' |
grep -v ' ARGC$' |
grep -v '^reporter_' |
grep -wv '[! sed -e 's/.* \(.*\)/print -r -- \1=${(qq)\1};/' \
-e 's/^\([^ ]*\)$/print -r -- \1=${(qq)\1};/'`
echo "prompt='test%'"
)
echo
echo "# Array variables."
echo
(
zmodload -u `zmodload | grep parameter` 2>/dev/null
echo "argv=()"
eval `{ typeset + | grep 'array ' ;
typeset + | grep 'association ' } |
grep -v 'undefined ' |
grep -v ' argv$' |
grep -v ' reporter_' |
grep -v ' [! sed 's/.* \(.*\)/print -r -- \1=\\\(${(qq)\1}\\\);/'`
)
echo
echo "# Exported variables."
echo
(
zmodload -u `zmodload | grep parameter` 2>/dev/null
export | grep -v "^'*"'[! ${AWK} -F'=' '{print "export " $1}'
)
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_setopt" = "yes" ]]
then
echo
echo ' echo
(
setopt | grep -v 'interactive' | ${AWK} '{print "setopt " $0}'
case "$reporter_junkiequotes"
in
yes) echo "setopt cshjunkiequotes" ;;
*) ;;
esac
case "$reporter_shwordsplit"
in
yes) echo "setopt shwordsplit" ;;
*) ;;
esac
case "$reporter_kshoptprint"
in
yes) echo "setopt kshoptionprint" ;;
*) ;;
esac
case "$reporter_nounset"
in
yes) echo "setopt nounset" ;;
*) ;;
esac
) | sort
fi
if [[ "$reporter_do_all" = "yes" || "$reporter_do_zstyle" = "yes" ]]
then
echo
echo ' echo
zstyle -L
fi
echo
echo '
unset reporter_do_all
unset reporter_do_aliases
unset reporter_do_bindings
unset reporter_do_compctl
unset reporter_do_fun
unset reporter_do_lim
unset reporter_do_setopt
unset reporter_do_vars
case "$reporter_junkiequotes"
in
yes) setopt cshjunkiequotes ;;
*) ;;
esac
case "$reporter_shwordsplit"
in
yes) setopt shwordsplit ;;
*) ;;
esac
case "$reporter_kshoptprint"
in
yes) setopt kshoptionprint ;;
*) ;;
esac
case "$reporter_nounset"
in
yes) setopt nounset ;;
*) ;;
esac
unset reporter_junkiequotes
unset reporter_shwordsplit
unset reporter_kshoptprint
unset reporter_nounset
unset reporter_OSVersion