ref: e51294c08d71412a8153157c8f82d36e4853f6a3
dir: /bin/9bbs2nostromo/
#!/bin/rc # convert old message format to new message format. rfork e fn checkdir{ if(! test -d $1){ echo $1 does not exist >[1=2] exit checkdir } } fn seconds2rfc822{ date `{cat} | awk '{print $1 ", " $3 " " $2 " " $6 " " $4 " " $5}' } fn usage{ echo usage: 9bbs2nostromo src dst post >[1=2] exit usage } if(~ $#2 0 || ~ $#4 1) usage src=$1 dst=$2 post=$3 checkdir $src checkdir $dst builtin cd $src if(~ $#post 0 || ! ~ $post [0-9]*) post=1 for(i in `{ls | grep -e '^[0-9]'}){ { echo From: `{cat $i/from} echo X-Room: `{cat name} echo Date: `{echo $i | seconds2rfc822} echo X-Date-N: $i echo cat $i/body } >$dst/$post echo $i '->' $post post=`{echo $post^+1 | bc} }