#!/bin/sh
# $NetBSD: script1,v 1.3 2002/02/08 09:10:05 garbled Exp $

if [ "$1" = "inactive" ]; then
	if [ -f "/etc/usermgmt.conf" ]; then
		DATA=`grep $1 /etc/usermgmt.conf | sed -e "s@$1	*@@"`
	else
		echo "0"
		exit 0
	fi
	if [ "$?" = "0" ]; then
		expr $DATA / 86400
	else
		echo "0"
	fi
	exit 0
fi
if [ -f "/etc/usermgmt.conf" ]; then
	DATA=`grep $1 /etc/usermgmt.conf | sed -e "s@$1	*@@"`
else
	DATA="FILE_DOESNT_EXIST"
	/usr/bin/false
fi
if [ "$?" = "0" -a "$DATA" != "" ]; then
	echo "$DATA"
else
	if [ "$1" = "preserve" ]; then
		echo "false"
		echo "true"
		exit 0
	fi
	if [ "$1" = "expire" ]; then
		echo "Null (unset)"
		exit 0
	fi
	if [ "$1" = "password" ]; then
		echo " "
		exit 0
	fi
	if [ "$1" = "base_dir" ]; then
		echo "/home"
		exit 0
	fi
	if [ "$1" = "skel_dir" ]; then
		echo "/etc/skel"
		exit 0
	fi
	if [ "$1" = "range" ]; then
		echo "1000..60000"
		exit 0
	fi
fi

if [ "$1" = "shell" ]; then
	cat /etc/shells | grep -v $DATA | grep -v '^$' | grep -v '^#'
fi
if [ "$1" = "group" ]; then
	cut -f1 -d : /etc/group | grep -v $DATA
fi
if [ "$1" = "preserve" ]; then
	if [ "$DATA" = "true" ]; then
		echo "false"
	else
		echo "true"
	fi
	if [ "$DATA" = "" ]; then
		echo "false"
	fi
fi
