From 7064acbd104d7c1af5a94533213d2bb124a7a60e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 12 Oct 2011 13:18:32 -0400 Subject: devdraw: cleanup, fix macargv --- mac/Plumb.app/Contents/MacOS/plumb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'mac') diff --git a/mac/Plumb.app/Contents/MacOS/plumb b/mac/Plumb.app/Contents/MacOS/plumb index 80918aa2..fc5e2c30 100755 --- a/mac/Plumb.app/Contents/MacOS/plumb +++ b/mac/Plumb.app/Contents/MacOS/plumb @@ -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 -- cgit v1.2.3