#!/usr/bin/env bash

set -e
set -o pipefail

if [ $# != 2 ]
then
	echo "usage: $0 <input> <output>" >&2
	exit 1
fi

src="$1"
dst="$2"

hex() {
	od -A n -vt x1 <lib/tos/tos | sed 's/\([0-9a-fA-F]\{2\}\)/0x\1,/g'
}

echo 'static const uint8_t tos[] = {'	 >"$dst".tmp
hex				<"$src"	>>"$dst".tmp
echo '};'				>>"$dst".tmp
mv "$dst".tmp "$dst"
