#!/bin/sh
#
# This script gets email and returns user belongs to the email.
#

test -n "$COMMON_LIB_PATH" || COMMON_LIB_PATH="`dirname $0`"
. "${COMMON_LIB_PATH}/common.sh"

while true
do
	read email
	if [ $? != 0 ]; then
		break;
	elif [ "$email" != "$END_OF_INPUT" ]; then
		user_account="`user_account_by_login ${email%%\@$DOMAIN}`"
		if [ -n "$user_account" ]; then
			send_line "`echo $user_account | awk -F: '{print $3}'`"
		fi
		send_end
	fi
done

