#!/bin/sh
# Copyright (C) 2010 - 2018 FARGOS Development, LLC
# $Id$
# sbinfo - display information about an active sandbox workon session
originDir=`dirname $0`

showPaths=0
while test $# -gt 0
do
	case "${1}" in
	-h | -help | --help)
		printf "usage: %s [-p]\n" "${0}" >&2
		printf "  -p = show paths\n" >&2
		exit 0
		;;
	-p)
		showPaths=1
		;;
	-*)
		printf "%s: unrecognized option \"%s\"\n" "${0}" "${1}" >&2
		exit 1
		;;
	*)
		printf "%s: unrecognized argument \"%s\"\n" "${0}" "${1}" >&2
		exit 1
		;;
	esac
	shift
done

if test -z "${SB_NAME}"
then
	printf "%s: no workon currently active\n" "$0" >&2
	exit 1
fi

bldArch=`${originDir}/buildArch -ba`
tgtArch=`${originDir}/buildArch -ta`

printf "sandbox: %s targetArch: %s buildArch: %s\n" "${SB_NAME}" "${tgtArch}" "${bldArch}"
if test ${showPaths} -eq 1
then
	printf "ST:  %s\n" "${ST}"
	count=1
	eval p=\$BT${count}
	while test -n "${p}"
	do
		printf "BT%s: %s\n" "${count}" "${p}"
		count=`expr ${count} + 1`
		eval p=\$BT${count}
	done
fi
exit 0
