#!/bin/sh
if [[ $# -eq 0 ]]; then
	tmpinfile=`mktemp /tmp/temppldump.in.XXXXX`
	tmpfile=`mktemp /tmp/temppldump.XXXXX`
	cat > $tmpinfile
	plutil -convert xml1 -o $tmpfile $tmpinfile
	cat $tmpfile
	rm $tmpinfile $tmpfile
	exit 0
fi
if [[ $# -gt 1 ]]; then
	printfilenames=1
fi
while [[ $# -gt 0 ]]; do
	if [[ -n "$printfilenames" ]]; then
		echo $1
	fi
	ft=`file -b "$1"`
	if [[ $ft == "OSX binary property list file" || $ft == "Apple binary property list" ]]; then
		tmpfile=`mktemp /tmp/temppldump.XXXXX`
		plutil -convert xml1 -o $tmpfile "$1"
		cat $tmpfile
		rm $tmpfile
	else
		cat "$1"
	fi
	shift
done
