#!/bin/sh get() { hexdump -v -s $1 -n ${4:-${3:-2}} -e "\"\" 1/${3:-2} \" %u\n\"" "$2" } [ -s $1/SETS ] || exit 1 SET="$(cat $1/SETS)" if ! grep -q 'span id="format"' index-$1.html; then awk 'BEGIN {i=-1} { if (/o fd/) { sub(/o fd/,"&") } if (/ fd/) { sub(/ fd/,"&") } if (/B of RAM and /) { i++ ; sub(/B of RAM and /,"&") } print }' < index-$1.html | \ sed -e 's|\.img\.
|
&|;s| floppies:|&|' \ -e 's|1.44MB|1.44MB|' \ -e 's|
|
|' \ -e "s||\\ \\ \\ &|" \ -e 's|
|
|' > index-$1.html.$$ mv index-$1.html.$$ index-$1.html fi cat $1/fd???.img > $1/fd.img dir=$1 set -- $SET if [ -n "$SET" ]; then size=$1 best=$1 cd $dir for i in $(sed '/option value/!d;s|.*value=.||;s|. title.*||' ../format.js); do s=$((((($size-1)/$i)+1)*$i)) [ $s -gt $best ] && best=$s dd of=fd.img bs=1 count=0 seek=$s 2> /dev/null [ -d $i ] || mkdir $i cd $i split -b $i ../fd.img xx set -- $SET n=1; sz=0 ls xx* | while read x; do mv $x $(printf "fd%03d.img" $n) n=$(($n+1)) sz=$(($sz+$i)) if [ $sz -ge $1 ]; then n=$(($n-($n%100)+100)) shift [ -n "$1" ] || break fi done md5sum fd* > md5sum rm fd* cd .. done dd of=fd.img bs=1 count=0 seek=$best 2> /dev/null cd .. echo $SET fi .