#!/bin/sh

"$0.real" "$@"
ret=$?

while test $# -gt 0; do
	if test "$1" != "-d"; then
		shift
		continue
	fi
	shift
	if test -n "$1"; then
		dev="$1"
		break
	fi
done

if test -n "$dev" -a -f /etc/wide-dhcpv6/dhcp6c.conf.$dev; then
	if test "$ret" = "2"; then
		sed 's/send/information-only;\n\tsend/' -i /etc/wide-dhcpv6/dhcp6c.conf.$dev
	else
		sed '/information-only;/d' -i /etc/wide-dhcpv6/dhcp6c.conf.$dev
	fi
fi

if test "$ret" = "3"; then
	ret=1
fi

exit $ret
