# Miscellaneous fixups. # Copyright (c) 1992-2012 by Hamilton Laboratories. All rights reserved. # 1. The # beginning a comment must be followed by white space. # Special case #=== lines to delete one =. # 2. /dev/null (Unix) --> nul (OS/2 or NT) # 3. $? (sh status) --> $status (csh status) # 4. $! (sh last child) --> $child (csh last child) # 5. $0 --> $scriptname # 6. $1 thru $9 --> $0 thru $8 # 7. kill -9 pid --> kill ppid # 8. Escape any :'s following a variable reference. # 9. Fixup any : null statements as ; statements and any : statements # as tests in a while. # 10. Fixup any if's without then's and any fi's that might have # sneaked thru during case fixups. # 11. Fixup any pipes that continue to the next line by escaping # the line ends. # 12. let --> @ /#[^ ]/{ s/#=/#/ s/#/# / } /# $/s/ $// s/\/dev\/null/nul/ /^[^#']*\$\?/s/\$\?/$status/g /^[^#']*\$\!/s/\$\!/$child/g /^[^#']*\$0/s/\$0/$scriptname/g /^[^#']*\$1/s/\$1/$0/g /^[^#']*\$2/s/\$2/$1/g /^[^#']*\$3/s/\$3/$2/g /^[^#']*\$4/s/\$4/$3/g /^[^#']*\$5/s/\$5/$4/g /^[^#']*\$6/s/\$6/$5/g /^[^#']*\$7/s/\$7/$6/g /^[^#']*\$8/s/\$8/$7/g /^[^#']*\$9/s/\$9/$8/g /^[ ]*kill -9 \$/s/-9 /p/ /^[^#']*\${[^}]*}:/s/\(\${[^}]*}\):/\1\\:/ /^[^#']*\$[a-zA-Z][a-zA-Z0-9_]*:/s/\(\$[a-zA-Z][a-zA-Z0-9_]*\):/\1\\:/ /^[ ]*while[ ]*:$/s/:/( 1 )/ /^[^#"']*:/{ /case/ ! { /default/ ! s/:/;/ } } /^[ ]*fi[ ]*$/s/fi/end/ /^[ ]*if/{ /then$/ ! s/$/ then/ } /^[^#].*|$/s/$/ ^/ /^[ ]*let[ ]/s/let/@/ |