#!/bin/sh

# uget script for venusd exec
# Copyright (c) 2015 Wavestore Ltd

T="$1"
N="$2"

#check type is correct
if [ "$1" = "audio" ]; then
	P=/usr/share/venusd/audio
elif [ "$1" = "lua" ]; then
	P=/usr/share/venusd/lua
elif [ "$1" = "map" ]; then
	P=/usr/share/venusd/map
else
	echo "usage: uget <lua|audio|map> <filename>"
	exit 1
fi

#remove special chars from name $N but allow . - and _
N=`tr -cd <<<"$N" "[-_a-zA-Z0-9\.]"`

#validate it's not null
if [ -z "$N" ]; then
	echo "usage: uget <lua|audio|map> <filename>"
	exit 1
fi

/bin/cat "$P/$N"
