tssam(1): new command - not just manual - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0a1990b94af2ac34aa63c0ed2b082aa8d15c3030
 (DIR) parent 113867b836eaa85215e4b2ece5ccf612f34c3e03
 (HTM) Author: Jason Catena <jason.catena@gmail.com>
       Date:   Wed, 30 Sep 2009 11:01:45 -0700
       
       ssam(1): new command - not just manual
       
       Diffstat:
         A bin/ssam                            |      41 +++++++++++++++++++++++++++++++
       
       1 file changed, 41 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/bin/ssam b/bin/ssam
       t@@ -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