#! /opt/bin/dash # # os/prog/paging-linear-translate/post.sh export PATH="/opt/bin:/bin:/usr/bin" #echo "Content-type: text/plain\n"; in=$(cat); echo "in = \"$in\""; exit echo "Content-type: text/html\n\n
$in\n" #exit n="10"; a="1m"; p="64m"; P="64k"; u="70"; s="123456789" if [ -n "$useed" ]; then seed="$useed" msg="- seed = $seed" else x=$(perl -e "print unpack(\"C*\",$user);"); seed="${s}${x}" #echo "
s = $s, x = $x, seed = $seed" msg="" fi echo "$user - paging-linear-translate results $msg
green = correct |
red = wrong |
" #echo "
" #python3 ./paging-linear-translate.py -s "$seed" -n "$n" -P "$P" -p "$p" -a "$a" -u "$u" -v -c # sed -e 's/) / /' -e 's/)$//' #echo "" out=$( (echo "$in"; python3 ./paging-linear-translate.py -s "$seed" -n "$n" -P "$P" -p "$p" -a "$a" -u "$u" -v -c) | awk 'function hex(h) { if( index(h,"0x") == 1) h=substr(h,3); # remove leading 0x while(length(h)>8 && index(h,"0") == 1) h=substr(h,2); # remove excess leading zeros while(length(h)<8) h = "0"h; return "0x"h; } # add leading zeros to make length 8 BEGIN { v=0; print "
# | "; print "VA | PA |
---|---|---|
"v" | "va" | "; x=u["v"v"v"]; if( x != "" && hex(x) == pa) color="#90EE90"; else color="#FF6347"; print ""x" |