URI:
       tnetfilelib.rc - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tnetfilelib.rc (854B)
       ---
            1 
            2 ns=`{namespace}
            3 if(</dev/null dial 'unix!'^$ns/$1 >[2]/dev/null)
            4         f=$f^9p
            5 
            6 t=/tmp/netfilexxx.$pid.$USER
            7 fn sigexit { rm -f $t $t.* }
            8 
            9 fn runsftp {
           10         eflag=no
           11         if(~ $1 -e){
           12                 eflag=yes
           13                 shift
           14         }
           15         if(! </dev/null dial 'unix!'^$ns/$1.sftp >[2]/dev/null){
           16                 sftpcache -D $1 </dev/null >[1=2]
           17         }
           18         {
           19                 if(! </dev/null dial 'unix!'^$ns/$1.sftp >[2]/dev/null){
           20                         sed 's/^/-/' | sftp -b /dev/stdin $1 && echo DONE
           21                 }
           22                 if not{
           23                         {cat; echo DONE} | dial -e 'unix!'^$ns/$1.sftp
           24                 }
           25         } >$t.sftp1 >[2=1]
           26         sed '/^sftp> /d
           27                 /^Connecting to /d
           28                 /^Fetching /d
           29                 /^Uploading /d
           30                 /^DONE$/d
           31         ' $t.sftp1 >$t.sftp
           32         if(! 9 grep -s '^DONE$' $t.sftp1){
           33                 echo sftp did not finish: >[1=2]
           34                 sed 's/^/        /g' $t.sftp1 >[1=2]
           35                 exit 1
           36         }
           37         if(~ $eflag yes && test -s $t.sftp){
           38                 echo sftp error output: >[1=2]
           39                 sed '/^DONE$/d; s/^/        /g' $t.sftp1 >[1=2]
           40                 exit 1
           41         }
           42         status=''
           43 }
           44