#!/bin/rc rfork en delim='⊢⊣' file='' fn printfile { shift if(! ~ $#* 0) file=$1 if(~ $file '') echo 'No filename; specify one.' if not { cat $file echo $delim } } fn writefile { shift if(! ~ $#* 0) file=$1 if(~ $file '') echo 'No filename; specify one.' if not { { # select entire file echo '?'$delim'?,$d' echo '0,$p' echo q echo q } | sam -d /dev/text > $file >[2]/dev/null } } if(! ~ $#* 0) { file=$1 cat $1 >[2]/dev/null || echo 'New file.' } echo $delim while () { c=`{read} switch($c) { case d echo $delim case p printfile $c case q exit case w writefile $c } }