devdraw: cleanup, fix macargv

This commit is contained in:
Russ Cox 2011-10-12 13:18:32 -04:00
parent 0e881c054a
commit 7064acbd10
5 changed files with 63 additions and 23 deletions

View file

@ -1,12 +1,21 @@
#!/bin/bash
. ~/.bashrc
PLAN9=${PLAN9:-/usr/local/plan9}
filename="$($PLAN9/bin/macargv)"
# Blank are problematic in the file name. Make them go away but keep the content.
if echo "$filename" | grep -q " "
then
base=$(basename "$filename" | sed 's/ /_/g')
cat "$filename" | plumb -i -d edit -a "action=showdata filename=/BadName/$base"
else
$PLAN9/bin/plumb -d edit "$filename"
fi
bin=$PLAN9/bin
IFS=$'\n'
for file in $($bin/macargv)
do
# 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
done