#!/bin/sh
set -e

out=fuzzcat.d

rm -rf "$out"
mkdir "$out"

categ () {
	fuzz=$1
	exec <"$fuzz"
	read nargs
	read arg0len
	read program
	program="${program##*/}"
	mkdir -p "$out/$program"
	ln "$fuzz" "$out/$program"/.
}

for case in "$@"; do
	categ "fuzz-$case"
	categ "fuzzraw-$case"
done
