plan9port/bin/B

57 lines
741 B
Text
Raw Permalink Normal View History

2003-10-11 03:55:45 +00:00
#!/bin/sh
files=""
dest=""
2006-07-28 01:08:02 +00:00
line=""
if [ $# -gt 0 ]; then
case "$1" in
+[0-9]*)
line="`echo $1 | sed 's/+/:/'`"
shift
;;
esac
fi
2003-10-11 03:55:45 +00:00
if [ $# -eq 0 ]
then
2006-07-28 01:08:02 +00:00
echo 'usage: B [+line] file...' 2>&1
2003-10-11 03:55:45 +00:00
exit 1
fi
if [ "x$DISPLAY" = "x" ]
then
sam="/tmp/.sam.$USER"
else
if [ "$DISPLAY" = ":0" ]
then
DISPLAY=:0.0
fi
2003-10-11 03:55:45 +00:00
sam="/tmp/.sam.$USER.$DISPLAY"
fi
if [ ! -p $sam ]
then
2004-04-19 05:51:41 +00:00
pwd="`pwd`"
for i
do
2006-07-28 01:08:02 +00:00
i="$i$line"
2004-04-23 06:51:06 +00:00
i=`cleanname -d "$pwd" "$i"`
plumb -s B -d edit "$i"
done
2003-10-11 03:55:45 +00:00
else
for i
do
2006-07-28 01:08:02 +00:00
i="$i$line"
pwd=`pwd`
file=`cleanname -d $pwd $i`
line=`echo $file | sed 's/.*://'`
file=`echo $file | sed 's/:.*//'`
echo "B $file" >>$sam
if [ "x$line" != "x" -a "x$line" != "x$file" ]
then
echo "$line" >> $sam
fi
2003-10-11 03:55:45 +00:00
done
fi