diff options
| author | stanley lieber <stanley.lieber@gmail.com> | 2011-10-22 20:01:07 -0500 |
|---|---|---|
| committer | stanley lieber <stanley.lieber@gmail.com> | 2011-10-22 20:01:07 -0500 |
| commit | da81fd83cef21d07ef613535867e97ab77ed09a8 (patch) | |
| tree | 58a7d471347eb82341e1b0326566a2d93d7f3c42 /rc/bin | |
| parent | 98d01a7719188f1fae193da77ed0949d903ed764 (diff) | |
| download | plan9front-da81fd83cef21d07ef613535867e97ab77ed09a8.tar.xz | |
add ssam
Diffstat (limited to 'rc/bin')
| -rwxr-xr-x | rc/bin/ssam | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/rc/bin/ssam b/rc/bin/ssam new file mode 100755 index 000000000..917a34f71 --- /dev/null +++ b/rc/bin/ssam @@ -0,0 +1,41 @@ +#!/bin/rc +# ssam - stream interface to sam + +flagfmt='n,e script,f sfile' +args='[ file ... ]' +if(! ifs=() eval `{aux/getflags $*}){ + usage + exit usage +} + +if(~ $#flage 0 && ~ $#flagf 0) { + if(~ $#* 0) { + usage + exit usage + } + flage=$1 + shift +} + +if(~ $#TMPDIR 0) + TMPDIR=/tmp +tmp=$TMPDIR/ssam.tmp.$user.$pid +cat $* >$tmp + +{ + # select entire file + echo ',{' + echo k + echo '}' + echo 0k + + # run scripts, print + if(! ~ $#flagf 0) + cat $flagf + if(! ~ $#flage 0) + echo $flage + if(~ $#flagn 0) + echo , +} | sam -d $tmp >[2]/dev/null + +rm -f $tmp |
