Blob
1 #!/usr/local/plan9/bin/rc3 if(! ~ $#* 2){4 echo usage: netfilestat system path >[1=2]5 exit usage6 }8 f=dostat10 . netfilelib.rc $112 fn dostat {13 echo cd $2 | runsftp $114 if(9 test -e $t.sftp -a ! -s $t.sftp){15 echo directory16 exit 017 }18 if(9 grep -s 'Can''t change directory|is not a directory' $t.sftp){19 echo file20 exit 021 }22 if(9 grep -s 'Couldn''t stat remote file|such file' $t.sftp){23 echo nonexistent24 exit 025 }26 {27 echo unknown error:28 sed 's/^/ /' $t.sftp29 } >[1=2]30 exit 031 }33 fn dostat9p {34 if(! 9p ls -ld $1/$2 >$t >[2]/dev/null){35 echo nonexistent36 exit 037 }38 if(9 grep -s '^d' $t){39 echo directory40 exit 041 }42 echo file43 exit 044 }46 $f $1 $2