#!/bin/sh

# run-parts - concept taken from Debian
#
# modified for PLD by Pawel Wilk <siefca@pld.org.pl>
# be ware: run-parts is now able to get arguments!
#          first argument is always set to the name of 
#          invoked directory

# keep going when something fails
set +e

if [ $# -lt 1 ]; then
	echo "Usage: run-parts <dir> <args...>"
	exit 1
fi

if [ ! -d $1 ]; then
	echo "Not a directory: $1"
	exit 1
fi

for i in $1/* ; do
	[ -d $i ] && continue
	if [ -x $i ]; then
		$i $*
	fi
done

exit 0
