#!/bin/sh
# Clean .gcda files from under a specific root, defaults to $STO
# Copyright (C) 2014 - 2018 FARGOS Development, LLC
# $Id$

underDir="${STO:-.}"

while test $# -gt 0
do
	case "${1}" in
	-h | -help | --help)
		printf "usage: %s [-d underDirectory]\n" "${0}" >&2
		exit 1
		;;
	-d)
		underDir="${2}"
		shift
		;;
	-*)
		printf "%s: unrecognized option \"%s\"\n" "${0}" "${1}" >&2
		exit 1
		;;
	*)
		printf "%s: unrecognized argument \"%s\"\n" "${0}" "${1}" >&2
		exit 1
		;;
	esac
	shift
done

find ${underDir} -name '*.gcda' -exec rm '{}' ';'
