#! /bin/sh

printf "Content-Type: text/plain\r\n\r\n"

FILE="/data/sequences/${QUERY_STRING}"

if grep 'DEVICE TYPE: switch' "${FILE}" >/dev/null 2>&1
then
	echo "DEVICE TYPE: switch"
elif grep 'DEVICE TYPE: spst' "${FILE}" >/dev/null 2>&1
then
	echo "DEVICE TYPE: spst"
else
	echo "DEVICE TYPE: attenuator"
fi

# Ignore the first 6 lines (header)
sed -ne '7,$p' "${FILE}"
