# Copyright (C) 2004  Melissa K. Schrumpf
# 
# This software may be distributed freely, provided that it is
# distributed in its entirety, without modifications, and with
# the original copyright notice and license included.
# 
# You may distribute your own separate patches together with
# this software package or a modified package if you always
# include a pointer where to get the original unmodified package.
# In this case you must inform the author about the modified package.
# 
# The software may not be sold for profit or as "hidden" part of 
# another software, but it may be included with collections 
# of other free software, such as CD-ROM images of FTP servers
# and similar, provided that this software is not a significant part 
# of that collection.  In this case you must inform the author of the
# method of distribution.
# 
# Pre-compiled binaries of this software may be distributed in the
# same way, provided that this copyright notice and license is
# included without modification.
# 
# This software may be used freely, for personal and non-profit
# use, provided that the original author is always credited.  If you
# intend to use this software as a significant part of business
# (for-profit) activities, the author's permission is required.  Also,
# any usage that is not covered by this license requires the explicit
# permission of the author.
# 
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
# 
# 
# 
#!/bin/sh
PKGCF=/var/sadm/install/contents
isfp=0
if [ $# = 0 ]; then
	echo "Usage: pkgcont [-d contents-file] package..."
	exit 1
elif [ $# = 1 ]; then
	if [ $1 = "-f" ]; then
		echo "Usage: pkgcont [-d contents-file] package..."
		exit 1
	fi
elif [ $# = 2 ]; then
	if [ $1 = "-f" ]; then
		echo "Usage: pkgcont [-d contents-file] package..."
		exit 1
	fi
else
	if [ $1 = "-f" ]; then
		PKGCF=$2
	fi
fi

if [ -r $PKGCF ]; then
	for i in $*; do
		if [ "`pkginfo $i 2>/dev/null`" ]; then
			grep " $i" $PKGCF | gawk '{print $1}' | uniq | sort
		fi
		echo
	done
else
	echo "File $PKGCF not accessible."
	exit 1
fi


