#!/bin/sh case "$1" in 0)#--=--:--==--:--=-- #fasm filer # > sh catinc.sh 0 *.ASM shift 1 help() { { echo "?= $0 f" echo "f: fasm file" ;}>&2 exit 1 } if [ -z "$1" ];then help ;fi cd "$(dirname "$1")" C=$(basename "$1") P=$(cat< 0) { Sp-- return S[Sp+1] } } function sip(f) { if(match(\$0,/include .*'/)) { A=substr(\$0,RSTART+9,RLENGTH-10) B=substr(\$0,0,RSTART-1) sub(/\\\\/,"/",A) #CMD="find "A #CMD |getline A #close(CMD) #print("|[ "A" ]|") if(match(B,/\{/)) { print B } else B="" dissolve(f,A) if(B) print "}" } else print } function dissolve(fo,fn) { pit(pwd) CMD="dirname "fn CMD |getline pwd=pwd \$0"/" close(CMD) CMD="basename "fn CMD |getline close(CMD) pit(B) B=pwd \$0 printf(m1,fo," * ",fn) while((getline < B) > 0) { sip(fn) } B=tap() close(fn) printf(m1,fo,"|] ",fn) pwd=tap() } { sip("$C") } EOF ) printf "%s" "$P" |awk -f - "$C" ;;#--=--:--==--:--=-- 1)#--=--:--==--:--=-- #word counter # > Y=u Y *.ASM $(sh catinc.sh 1) shift 1 printf '%s ' $(xe -Q sed '/format/d;/align/d;/include/d;/^[ \t]*;/d;s/[0-9][0-9A-F]\+h//g;s/'\''[^'\'']*'\''//g;s/[\t,:+\(\)-]/ /g;s/[^A-Za-z _]//g;s/^ *//;s/ *$//;s/ /\n/g') \| $(xe -Q sed '/^$/d') \| sort \| uniq -c ;;#--=--:--==--:--=-- esac #ERROR: "project" abort