#! /usr/local/bin/sybperl

#
#	@(#)report.pl	1.1	6/24/92
#

require "sybperl.pl";
require "sql.pl";

#
# Log us in to Sybase.
#
$d = &dblogin;

#
# define the format
#
format top=
			 PASSWORD FILE
Login      Uid Group      Shell                   Home directory
-------- ----- ---------- ----------------------- ----------------------
. 
format stdout=
@<<<<<<< @>>>> @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<
$n,      $u,   $gn,       $s,                     $d
. 

#
# See if everything is there.
#
@results = &sql($d, '
	select username, uid, isnull(groupname,convert(char,p.gid)), shell, home
	from password p, groups g
	where	p.gid *= g.gid
	order by uid
	');
foreach $x (@results) {
	($n,$u,$gn,$s,$d) = split("~",$x);
	write;
}

