head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	2004.03.09.20.06.42;	author garbled;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Apply patches from PR bin/24695 by Peter Postma:
        The changes are:

        * rename "Security and Users" to "Users and Groups"
        * use default settings in /etc/usermgmt.conf (if it exists)
          when adding a new user.
        * fix output for 'List users'.
        * add the following menu's: Modify user, Change password, Add group,
          List groups, Delete group.
@
text
@#!/bin/sh
# $NetBSD$

if [ -z "$1" -o -z "$2" ]; then
	exit 1
fi

if [ "$2" = "uid" ]; then
	userinfo $1 | grep 'uid' | awk '{print $2}'
fi

if [ "$2" = "1stgroup" ]; then
	FIRST=`userinfo $1 | grep 'groups' | awk '{print $2}'`
	echo "$FIRST"
	cut -f1 -d':' /etc/group | grep -v "$FIRST"
fi

if [ "$2" = "2ndgroup" ]; then
	FIRST=`userinfo $1 | grep 'groups' | awk '{print $3}'`
	if [ -z "$FIRST" ]; then
		FIRST=" "
	fi
	echo "$FIRST"
	cut -f1 -d':' /etc/group | grep -v "$FIRST"
fi

if [ "$2" = "realname" ]; then
	userinfo $1 | grep 'gecos' | sed 's/gecos	//g' | sed 's/,//g'
fi

if [ "$2" = "homedir" ]; then
	userinfo $1 | grep 'dir' | awk '{print $2}'
fi

if [ "$2" = "shell" ]; then
	FIRST=`userinfo $1 | grep 'shell' | awk '{print $2}'`
	echo $FIRST
	egrep -v '(^#|^$)' /etc/shells | grep -v "$FIRST"
fi

if [ "$2" = "expire" ]; then
	userinfo $1 | grep 'expire' | awk '{print $2}'
fi
@
