#!/usr/bin/bash

PLAN9=${PLAN9:-/builddir/build/BUILD/plan9port-0_20260827git.b6564bd-build/plan9port-b6564bd96ca189c69e28797738dad56f91eb5967}
bin=$PLAN9/bin

file=$1

# Blanks are problematic in filenames: just plumb
# the file's content.
if echo "$file" | grep -q " "
then
	base=$(basename "$file" | sed 's/ /_/g')
	attr="action=showdata filename=/BadName/$base"
	cat $file | "$bin/plumb" -i -d edit -a "$attr"
else
	"$bin/plumb" -d edit "$file"
fi
