110898Sroland.mainz@nrubsig.org#!/usr/bin/ksh93
210898Sroland.mainz@nrubsig.org
310898Sroland.mainz@nrubsig.org#
410898Sroland.mainz@nrubsig.org# CDDL HEADER START
510898Sroland.mainz@nrubsig.org#
610898Sroland.mainz@nrubsig.org# The contents of this file are subject to the terms of the
710898Sroland.mainz@nrubsig.org# Common Development and Distribution License (the "License").
810898Sroland.mainz@nrubsig.org# You may not use this file except in compliance with the License.
910898Sroland.mainz@nrubsig.org#
1010898Sroland.mainz@nrubsig.org# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1110898Sroland.mainz@nrubsig.org# or http://www.opensolaris.org/os/licensing.
1210898Sroland.mainz@nrubsig.org# See the License for the specific language governing permissions
1310898Sroland.mainz@nrubsig.org# and limitations under the License.
1410898Sroland.mainz@nrubsig.org#
1510898Sroland.mainz@nrubsig.org# When distributing Covered Code, include this CDDL HEADER in each
1610898Sroland.mainz@nrubsig.org# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1710898Sroland.mainz@nrubsig.org# If applicable, add the following below this CDDL HEADER, with the
1810898Sroland.mainz@nrubsig.org# fields enclosed by brackets "[]" replaced with your own identifying
1910898Sroland.mainz@nrubsig.org# information: Portions Copyright [yyyy] [name of copyright owner]
2010898Sroland.mainz@nrubsig.org#
2110898Sroland.mainz@nrubsig.org# CDDL HEADER END
2210898Sroland.mainz@nrubsig.org#
2310898Sroland.mainz@nrubsig.org
2410898Sroland.mainz@nrubsig.org#
25*12068SRoger.Faulkner@Oracle.COM# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
2610898Sroland.mainz@nrubsig.org#
2710898Sroland.mainz@nrubsig.org
2810898Sroland.mainz@nrubsig.org#
2910898Sroland.mainz@nrubsig.org# simplefileattributetree1 - build a simple file tree (including file attributes)
3010898Sroland.mainz@nrubsig.org#
3110898Sroland.mainz@nrubsig.org
3210898Sroland.mainz@nrubsig.org# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant
3310898Sroland.mainz@nrubsig.orgexport PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin
3410898Sroland.mainz@nrubsig.org
3510898Sroland.mainz@nrubsig.org# Make sure all math stuff runs in the "C" locale to avoid problems
3610898Sroland.mainz@nrubsig.org# with alternative # radix point representations (e.g. ',' instead of
3710898Sroland.mainz@nrubsig.org# '.' in de_DE.*-locales). This needs to be set _before_ any
3810898Sroland.mainz@nrubsig.org# floating-point constants are defined in this script).
3910898Sroland.mainz@nrubsig.orgif [[ "${LC_ALL}" != "" ]] ; then
4010898Sroland.mainz@nrubsig.org    export \
4110898Sroland.mainz@nrubsig.org        LC_MONETARY="${LC_ALL}" \
4210898Sroland.mainz@nrubsig.org        LC_MESSAGES="${LC_ALL}" \
4310898Sroland.mainz@nrubsig.org        LC_COLLATE="${LC_ALL}" \
4410898Sroland.mainz@nrubsig.org        LC_CTYPE="${LC_ALL}"
4510898Sroland.mainz@nrubsig.org        unset LC_ALL
4610898Sroland.mainz@nrubsig.orgfi
4710898Sroland.mainz@nrubsig.orgexport LC_NUMERIC=C
4810898Sroland.mainz@nrubsig.org
4910898Sroland.mainz@nrubsig.org
5010898Sroland.mainz@nrubsig.orgfunction add_file_to_tree
5110898Sroland.mainz@nrubsig.org{
5210898Sroland.mainz@nrubsig.org	typeset treename=$1
5310898Sroland.mainz@nrubsig.org	typeset filename=$2
5410898Sroland.mainz@nrubsig.org	nameref destnodename=$3
5510898Sroland.mainz@nrubsig.org	integer i
5610898Sroland.mainz@nrubsig.org	typeset nodepath # full name of compound variable
5710898Sroland.mainz@nrubsig.org	typeset -a pe # path elements
5810898Sroland.mainz@nrubsig.org
5910898Sroland.mainz@nrubsig.org	# first built an array containing the names of each path element
6010898Sroland.mainz@nrubsig.org	# (e.g. "foo/var/baz"" results in an array containing "( 'foo' 'bar' 'baz' )")
6110898Sroland.mainz@nrubsig.org	typeset IFS='/'
6210898Sroland.mainz@nrubsig.org	pe+=( ${filename} )
6310898Sroland.mainz@nrubsig.org
6410898Sroland.mainz@nrubsig.org	[[ ${pe[0]} == '' ]] && pe[0]='/'
6510898Sroland.mainz@nrubsig.org
6610898Sroland.mainz@nrubsig.org	# walk path described via the "pe" array and build nodes if
6710898Sroland.mainz@nrubsig.org	# there aren't any nodes yet
6810898Sroland.mainz@nrubsig.org	nodepath="${treename}"
6910898Sroland.mainz@nrubsig.org	for (( i=0 ; i < (${#pe[@]}-1) ; i++ )) ; do
7010898Sroland.mainz@nrubsig.org		nameref x="${nodepath}"
71*12068SRoger.Faulkner@Oracle.COM
72*12068SRoger.Faulkner@Oracle.COM		# [[ -v ]] does not work for arrays because [[ -v ar ]]
73*12068SRoger.Faulkner@Oracle.COM		# is equal to [[ -v ar[0] ]]. In this case we can
74*12068SRoger.Faulkner@Oracle.COM		# use the output of typeset +p x.nodes
75*12068SRoger.Faulkner@Oracle.COM		[[ "${ typeset +p x.nodes ; }" == "" ]] && compound -A x.nodes
7610898Sroland.mainz@nrubsig.org
7710898Sroland.mainz@nrubsig.org		nodepath+=".nodes[${pe[i]}]"
7810898Sroland.mainz@nrubsig.org	done
7910898Sroland.mainz@nrubsig.org
8010898Sroland.mainz@nrubsig.org	# insert element
8110898Sroland.mainz@nrubsig.org	nameref node="${nodepath}"
82*12068SRoger.Faulkner@Oracle.COM	[[ "${ typeset +p node.elements ; }" == "" ]] && compound -A node.elements
8310898Sroland.mainz@nrubsig.org	node.elements[${pe[i]}]=(
8410898Sroland.mainz@nrubsig.org		filepath="${filename}"
8510898Sroland.mainz@nrubsig.org	)
8610898Sroland.mainz@nrubsig.org
8710898Sroland.mainz@nrubsig.org	destnodename="${!node}.elements[${pe[i]}]"
8810898Sroland.mainz@nrubsig.org
8910898Sroland.mainz@nrubsig.org	return 0
9010898Sroland.mainz@nrubsig.org}
9110898Sroland.mainz@nrubsig.org
9210898Sroland.mainz@nrubsig.orgfunction parse_findls
9310898Sroland.mainz@nrubsig.org{
9410898Sroland.mainz@nrubsig.org	nameref out=$1
9510898Sroland.mainz@nrubsig.org	typeset str="$2"
9610898Sroland.mainz@nrubsig.org
9710898Sroland.mainz@nrubsig.org	# find -ls on Solaris uses the following output format by default:
9810898Sroland.mainz@nrubsig.org	#604302    3 -rw-r--r--   1 test001  users        2678 May  9 00:46 ./httpsresdump
9910898Sroland.mainz@nrubsig.org
10010898Sroland.mainz@nrubsig.org	integer out.inodenum="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\1}"
10110898Sroland.mainz@nrubsig.org	integer out.kbblocks="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\2}"
10210898Sroland.mainz@nrubsig.org	typeset out.mode="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\3}"
10310898Sroland.mainz@nrubsig.org	integer out.numlinks="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\4}"
10410898Sroland.mainz@nrubsig.org	compound out.owner=(
10510898Sroland.mainz@nrubsig.org		typeset user="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\5}"
10610898Sroland.mainz@nrubsig.org		typeset group="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\6}"
10710898Sroland.mainz@nrubsig.org	)
10810898Sroland.mainz@nrubsig.org	integer out.filesize="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\7}"
10910898Sroland.mainz@nrubsig.org	typeset out.date="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\8}"
11010898Sroland.mainz@nrubsig.org	typeset out.filepath="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\9}"
11110898Sroland.mainz@nrubsig.org
11210898Sroland.mainz@nrubsig.org	return 0
11310898Sroland.mainz@nrubsig.org}
11410898Sroland.mainz@nrubsig.org
11510898Sroland.mainz@nrubsig.orgfunction usage
11610898Sroland.mainz@nrubsig.org{
11710898Sroland.mainz@nrubsig.org	OPTIND=0
11810898Sroland.mainz@nrubsig.org	getopts -a "${progname}" "${simplefileattributetree1_usage}" OPT '-?'
11910898Sroland.mainz@nrubsig.org	exit 2
12010898Sroland.mainz@nrubsig.org}
12110898Sroland.mainz@nrubsig.org
12210898Sroland.mainz@nrubsig.org# main
12310898Sroland.mainz@nrubsig.orgbuiltin basename
12410898Sroland.mainz@nrubsig.orgbuiltin dirname
12510898Sroland.mainz@nrubsig.org
12610898Sroland.mainz@nrubsig.orgset -o noglob
12710898Sroland.mainz@nrubsig.orgset -o nounset
12810898Sroland.mainz@nrubsig.org
12910898Sroland.mainz@nrubsig.org# tree base
13010898Sroland.mainz@nrubsig.orgcompound filetree
13110898Sroland.mainz@nrubsig.org
13210898Sroland.mainz@nrubsig.org# benchmark data
13310898Sroland.mainz@nrubsig.orgcompound bench=(
13410898Sroland.mainz@nrubsig.org	float start
13510898Sroland.mainz@nrubsig.org	float stop
13610898Sroland.mainz@nrubsig.org)
13710898Sroland.mainz@nrubsig.org
13810898Sroland.mainz@nrubsig.orgcompound appconfig=(
13910898Sroland.mainz@nrubsig.org	typeset do_benchmarking=false
14010898Sroland.mainz@nrubsig.org	compound do_record=(
14110898Sroland.mainz@nrubsig.org		typeset content=false
14210898Sroland.mainz@nrubsig.org		typeset filetype=false
14310898Sroland.mainz@nrubsig.org	)
14410898Sroland.mainz@nrubsig.org)
14510898Sroland.mainz@nrubsig.org
14610898Sroland.mainz@nrubsig.org
14710898Sroland.mainz@nrubsig.orginteger i
14810898Sroland.mainz@nrubsig.org
14910898Sroland.mainz@nrubsig.orgtypeset progname="${ basename "${0}" ; }"
15010898Sroland.mainz@nrubsig.org
15110898Sroland.mainz@nrubsig.orgtypeset -r simplefileattributetree1_usage=$'+
152*12068SRoger.Faulkner@Oracle.COM[-?\n@(#)\$Id: simplefileattributetree1 (Roland Mainz) 2010-03-27 \$\n]
15310898Sroland.mainz@nrubsig.org[-author?Roland Mainz <roland.mainz@nrubsig.org>]
15410898Sroland.mainz@nrubsig.org[+NAME?simplefileattributetree1 - generate compound variable tree which contains file names and their attributes]
15510898Sroland.mainz@nrubsig.org[+DESCRIPTION?\bsimplefileattributetree1\b is a simple variable tree
15610898Sroland.mainz@nrubsig.org	demo which builds a compound variable tree based on the output
15710898Sroland.mainz@nrubsig.org	of /usr/xpg4/bin/file which contains the file name, the file attributes
15810898Sroland.mainz@nrubsig.org	and optionally file type and content]
15910898Sroland.mainz@nrubsig.org[b:benchmark?Print time needed to generate the tree.]
16010898Sroland.mainz@nrubsig.org[c:includecontent?Include the file\'s content in the tree, split into 1kb blocks.]
16110898Sroland.mainz@nrubsig.org[t:includefiletype?Include the file type (output of /usr/xpg4/bin/file).]
16210898Sroland.mainz@nrubsig.org
16310898Sroland.mainz@nrubsig.orgpath
16410898Sroland.mainz@nrubsig.org
16510898Sroland.mainz@nrubsig.org[+SEE ALSO?\bksh93\b(1), \bfile\b(1), \bfind\b(1)]
16610898Sroland.mainz@nrubsig.org'
16710898Sroland.mainz@nrubsig.org
16810898Sroland.mainz@nrubsig.orgwhile getopts -a "${progname}" "${simplefileattributetree1_usage}" OPT ; do
16910898Sroland.mainz@nrubsig.org#	printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|"
17010898Sroland.mainz@nrubsig.org	case ${OPT} in
17110898Sroland.mainz@nrubsig.org		b)	appconfig.do_benchmarking="true"	;;
17210898Sroland.mainz@nrubsig.org		+b)	appconfig.do_benchmarking="false"	;;
17310898Sroland.mainz@nrubsig.org		c)	appconfig.do_record.content="true"	;;
17410898Sroland.mainz@nrubsig.org		+c)	appconfig.do_record.content="false"	;;
17510898Sroland.mainz@nrubsig.org		t)	appconfig.do_record.filetype="true"	;;
17610898Sroland.mainz@nrubsig.org		+t)	appconfig.do_record.filetype="false"	;;
17710898Sroland.mainz@nrubsig.org		*)	usage ;;
17810898Sroland.mainz@nrubsig.org	esac
17910898Sroland.mainz@nrubsig.orgdone
18010898Sroland.mainz@nrubsig.orgshift $((OPTIND-1))
18110898Sroland.mainz@nrubsig.org
18210898Sroland.mainz@nrubsig.org
18310898Sroland.mainz@nrubsig.org# argument prechecks
18410898Sroland.mainz@nrubsig.orgif (( $# == 0 )) ; then
18510898Sroland.mainz@nrubsig.org	print -u2 -f "%s: Missing <path> argument.\n" "${progname}"
18610898Sroland.mainz@nrubsig.org	exit 1
18710898Sroland.mainz@nrubsig.orgfi
18810898Sroland.mainz@nrubsig.org
18910898Sroland.mainz@nrubsig.org
19010898Sroland.mainz@nrubsig.orgprint -u2 -f "# reading file names...\n"
19110898Sroland.mainz@nrubsig.orgwhile (( $# > 0 )) ; do
19210898Sroland.mainz@nrubsig.org	# "ulimit -c 0" use used to force ksh93 to use a seperate process for subshells,
19310898Sroland.mainz@nrubsig.org	# this is used to work around a bug with LC_ALL changes bleeding through subshells
19410898Sroland.mainz@nrubsig.org	IFS=$'\n' ; typeset -a findls_lines=( $(ulimit -c 0 ; LC_ALL=C find "$1" -type f -ls) ) ; IFS=$' \t\n'
19510898Sroland.mainz@nrubsig.org	shift
19610898Sroland.mainz@nrubsig.orgdone
19710898Sroland.mainz@nrubsig.org
19810898Sroland.mainz@nrubsig.org
19910898Sroland.mainz@nrubsig.orgprint -u2 -f "# building tree...\n"
20010898Sroland.mainz@nrubsig.org
20110898Sroland.mainz@nrubsig.org${appconfig.do_benchmarking} && (( bench.start=SECONDS ))
20210898Sroland.mainz@nrubsig.org
20310898Sroland.mainz@nrubsig.orgfor (( i=0 ; i < ${#findls_lines[@]} ; i++ )) ; do
20410898Sroland.mainz@nrubsig.org	compound parseddata
20510898Sroland.mainz@nrubsig.org	typeset treenodename
20610898Sroland.mainz@nrubsig.org
20710898Sroland.mainz@nrubsig.org	# parse "find -ls" output
20810898Sroland.mainz@nrubsig.org	parse_findls parseddata "${findls_lines[i]}"
20910898Sroland.mainz@nrubsig.org
21010898Sroland.mainz@nrubsig.org	# add node to tree and return it's absolute name in "treenodename"
21110898Sroland.mainz@nrubsig.org	add_file_to_tree filetree "${parseddata.filepath}" treenodename
21210898Sroland.mainz@nrubsig.org
21310898Sroland.mainz@nrubsig.org	# merge parsed "find -ls" output into tree node
21410898Sroland.mainz@nrubsig.org	nameref treenode="${treenodename}"
21510898Sroland.mainz@nrubsig.org	treenode+=parseddata
21610898Sroland.mainz@nrubsig.org
21710898Sroland.mainz@nrubsig.org	# extras (calculated from the existing values in "parseddata")
21810898Sroland.mainz@nrubsig.org	typeset treenode.dirname="${ dirname "${treenode.filepath}" ; }"
21910898Sroland.mainz@nrubsig.org	typeset treenode.basename="${ basename "${treenode.filepath}" ; }"
22010898Sroland.mainz@nrubsig.org
22110898Sroland.mainz@nrubsig.org	if ${appconfig.do_record.filetype} ; then
22210898Sroland.mainz@nrubsig.org		# Using /usr/(xpg4/)*/bin/file requires a |fork()|+|exec()| which makes the script a few hundred times slower... ;-(
22310898Sroland.mainz@nrubsig.org		typeset treenode.filetype="$(file "${treenode.filepath}")"
22410898Sroland.mainz@nrubsig.org	fi
22510898Sroland.mainz@nrubsig.org
22610898Sroland.mainz@nrubsig.org	if ${appconfig.do_record.content} ; then
22710898Sroland.mainz@nrubsig.org		if [[ -r "${treenode.filepath}" ]] ; then
22810898Sroland.mainz@nrubsig.org			# We use an array of compound variables here to support
22910898Sroland.mainz@nrubsig.org			# files with holes (and later alternative streams, too)
23010898Sroland.mainz@nrubsig.org			compound -a treenode.content
23110898Sroland.mainz@nrubsig.org			integer cl=0
23210898Sroland.mainz@nrubsig.org			while \
23310898Sroland.mainz@nrubsig.org				{
23410898Sroland.mainz@nrubsig.org					treenode.content[${cl}]=(
23510898Sroland.mainz@nrubsig.org						typeset type="data" # (todo: "add support for "holes" (sparse files))
23610898Sroland.mainz@nrubsig.org						typeset -b bin
23710898Sroland.mainz@nrubsig.org					)
23810898Sroland.mainz@nrubsig.org					read -n1024 treenode.content[${cl}].bin
23910898Sroland.mainz@nrubsig.org				} ; do
24010898Sroland.mainz@nrubsig.org				(( cl++ ))
24110898Sroland.mainz@nrubsig.org			done < "${treenode.filepath}"
24210898Sroland.mainz@nrubsig.org			unset treenode.content[${cl}]
24310898Sroland.mainz@nrubsig.org
24410898Sroland.mainz@nrubsig.org			typeset -A treenode.hashsum=(
24510898Sroland.mainz@nrubsig.org				[md5]="$(sum -x md5 < "${treenode.filepath}")"
24610898Sroland.mainz@nrubsig.org				[sha512]="$(sum -x sha512 < "${treenode.filepath}")"
24710898Sroland.mainz@nrubsig.org			)
24810898Sroland.mainz@nrubsig.org
24910898Sroland.mainz@nrubsig.org			# we do this for internal debugging only
25010898Sroland.mainz@nrubsig.org			if [[ "${ {
25110898Sroland.mainz@nrubsig.org					integer j
25210898Sroland.mainz@nrubsig.org					for (( j=0 ; j < ${#treenode.content[@]} ; j++ )) ; do
25310898Sroland.mainz@nrubsig.org						printf "%B" treenode.content[$j].bin
25410898Sroland.mainz@nrubsig.org					done
25510898Sroland.mainz@nrubsig.org				} | sum -x sha512 ; }" != "${treenode.hashsum[sha512]}" ]] ; then
25610898Sroland.mainz@nrubsig.org				# this should never happen...
25710898Sroland.mainz@nrubsig.org				print -u2 -f "fatal hash mismatch for %s\n" "${treenode.filepath}"
25810898Sroland.mainz@nrubsig.org				unset treenode.content treenode.hashsum
25910898Sroland.mainz@nrubsig.org			fi
26010898Sroland.mainz@nrubsig.org		fi
26110898Sroland.mainz@nrubsig.org	fi
26210898Sroland.mainz@nrubsig.orgdone
26310898Sroland.mainz@nrubsig.org
26410898Sroland.mainz@nrubsig.org${appconfig.do_benchmarking} && (( bench.stop=SECONDS ))
26510898Sroland.mainz@nrubsig.org
26610898Sroland.mainz@nrubsig.org
26710898Sroland.mainz@nrubsig.orgif ${appconfig.do_benchmarking} ; then
26810898Sroland.mainz@nrubsig.org	# print benchmark data
26910898Sroland.mainz@nrubsig.org	print -u2 -f "# time used: %f\n" $((bench.stop - bench.start))
27010898Sroland.mainz@nrubsig.orgfi
27110898Sroland.mainz@nrubsig.org
27210898Sroland.mainz@nrubsig.org# print variable tree
27310898Sroland.mainz@nrubsig.orgprint -v filetree
27410898Sroland.mainz@nrubsig.org
27510898Sroland.mainz@nrubsig.orgexit 0
27610898Sroland.mainz@nrubsig.org# EOF.
277