#!/bin/sh -
#
#	Generates an alphabetical (i.e. sorted by surname) class list
#	for a given labgroup, giving realnames and login-names,
#	on the standard output.
#
progname=`basename $0`

if [ $# -ne 1 ]; then
	echo "usage: $progname <labgroup>" >&2
	exit 1
fi

labgroup=$1
if [ `show_all_labgroups | grep -wc $labgroup` -ne 1 ]; then
	echo "$progname: error: no labgroup $labgroup" >&2
	exit 1
fi

echo "=========Alphabetical class list for $labgroup:========="
echo ""

for student in `show_all_students $labgroup | sort_by_surname` ; do
	echo "`findname $student` ($student)"
done #for student

echo ""
echo "=========End of alphabetical class list for $labgroup.========="
