#! /bin/sh
# aoe-interfaces

zero="`basename $0`"
devf=/dev/etherd/interfaces
sysf=/sys/module/aoe/parameters/aoe_iflist

if test -z "$*"; then
	if test -r "$sysf"; then
		cat "$sysf"
	else
		# can't read from interfaces device
		false
	fi
	exit
fi

if test $1 = "-c"; then
	shift
fi

if test -w "$sysf"; then
	printf '%s\0' "$*" > "$sysf"
else
	if test ! -w "$devf"; then
		echo 1>&2 "$zero: $devf does not exist or is not writeable."
		exit 1
	fi
	printf '%s\0' "$*" > "$devf"
fi
