diff options
author | Jason Catena <jason.catena@gmail.com> | 2009-09-30 11:01:45 -0700 |
---|---|---|
committer | Jason Catena <jason.catena@gmail.com> | 2009-09-30 11:01:45 -0700 |
commit | 0a1990b94af2ac34aa63c0ed2b082aa8d15c3030 (patch) | |
tree | 4c529f54d7f97080c0475e7a24916c4139c6a727 /bin/ssam | |
parent | 113867b836eaa85215e4b2ece5ccf612f34c3e03 (diff) | |
download | plan9port-0a1990b94af2ac34aa63c0ed2b082aa8d15c3030.tar.gz plan9port-0a1990b94af2ac34aa63c0ed2b082aa8d15c3030.tar.bz2 plan9port-0a1990b94af2ac34aa63c0ed2b082aa8d15c3030.zip |
ssam(1): new command - not just manual
Diffstat (limited to 'bin/ssam')
-rw-r--r-- | bin/ssam | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bin/ssam b/bin/ssam new file mode 100644 index 00000000..7b479ea5 --- /dev/null +++ b/bin/ssam @@ -0,0 +1,41 @@ +#!/usr/local/plan9/bin/rc +# ssam - stream interface to sam + +flagfmt='n,e script,f sfile' +args='[ file ... ]' +if(! ifs=() eval `{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 |