H=' ========== errorin ========== generates an ex script to insert error messages in C source code. the error messages are assumed to be in a file error.2. the output of errorin is placed in a file error.3. ========== BUGS ========== * inconsistency in the format of error messages can cause ex to vomit during the insertion process. * compilation across several directories will result in files that cannot be found. ========== ' case $1 in -h|help|hint) clear;echo "$H";exit 0;; *) ;; esac A=' BEGIN{ xn = 0 pn = "BARF" ef = 0 } /one void/{ next } { if(NF == 1) { sn = $0 if(xn >= 1 && pn != "BARF") printf("w\n") xn = 0 pn = sn next } lp = index($0,"(") rp = index($0,")") if(lp && rp) { if(xn == 0) { printf("e %s\n",sn) fn[ef] = sn ef += 1 } ln = substr($0,lp+1,rp-lp-1) printf("%da\n",ln+xn-1); # WORKING printf("/*### %s === */\n",$0); printf(".\n"); xn += 1; } } END{ if(ef) { for(i = 0; i < ef; i++) printf(" %s",fn[i]) >>"error.4" printf("\n") >>"error.4" } } ' awk -e "$A" error.2 > error.3 if test -s error.4 then ex - < error.3 vi +/###/ `cat error.4` cat - > error.5 <<\END /### /d END ksedit -f error.5 `cat error.4` fi rm -f error.[-9]