:
#      @(#)addpppuser	5.2 Lachman System V STREAMS TCP  source
#
#	System V STREAMS TCP - Release 4.0
#
#   Copyright 1990 Interactive Systems Corporation,(ISC)
#   All Rights Reserved.
#
#	Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI)
#	All Rights Reserved.
#
#	The copyright above and this notice must be preserved in all
#	copies of this source code.  The copyright above does not
#	evidence any actual or intended publication of this source
#	code.
#
#	This is unpublished proprietary trade secret source code of
#	Lachman Associates.  This source code may not be copied,
#	disclosed, distributed, demonstrated or licensed except as
#	expressly authorized by Lachman Associates.
#
#	System V STREAMS TCP was jointly developed by Lachman
#	Associates and Convergent Technologies.
#
#      SCCS IDENTIFICATION
#
# unique finds a unique user id searching upward from a given number
#
unique() {
	userid=$1
	while grep :${userid}: /etc/passwd > /dev/null 2>&1
	do
		userid=`expr $userid + 1`
	done
	echo $userid
}

# main()

who=`who am i | awk '{ print $1 }'`
[ "$who" = "" ] && who=root
[ "$who" != "root" ] && {
	echo "You are not logged in as root.
Please log in as root to run $0."
	exit 0
}
grep "^nppp:" /etc/passwd >/dev/null || {
	echo "Adding nppp account."
	userid=`unique 200`
	echo "nppp:x:$userid:50:PPP Login:/usr/lib/ppp:/usr/lib/ppp/ppp" >> \
/etc/passwd
	/tcb/bin/passwdupd > /dev/null 2>&1
	echo "Please set a password on the nppp account."
	/bin/passwd nppp
}
