#! /bin/ksh

typeset DIR=''
typeset NAAM=''
typeset ACCOUNT=''

function tabber
{
  typeset -i i=1+$1
  shift
  typeset STR="$@"
  typeset -i cnt=$(( i - ${#STR} / 8 ))

  while (( cnt-=1 ))
  do
    STR="${STR}\t"
  done
  
  print -n "${STR}"

  return
} 

awk -F: '{print $6 " " $1 " " $5}' /etc/passwd \
| while read DIR ACCOUNT NAAM
  do
    if [[ -h "${DIR}" ]]
    then
      DIR=$( readlink ${DIR} )
    fi
    tabber 4 "${DIR}"
    tabber 2 "${ACCOUNT}" 
    print "${NAAM}"
  done | sort

exit 0

####################### EOF #######################
