home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / hcshdemo.zip / csh-os2.zip / SAMPLES / SH_2_CSH / MISC.SED < prev    next >
Text File  |  1993-11-24  |  1KB  |  60 lines

  1. #    Miscellaneous fixups:
  2.  
  3. #        1.    The # beginning a comment must be followed by white space.
  4. #            Special case #=== lines to delete one =.
  5.  
  6. #        2.    /dev/null (Unix)        -->    nul (OS/2 or NT)
  7.  
  8. #        3.    $?    (sh status)            -->    $status (csh status)
  9.  
  10. #        4. $! (sh last child)    -->    $child (csh last child)
  11.  
  12. #        5. kill -9 pid                -->    kill ppid
  13.  
  14. #        6. read foo                    -->    @ foo = getline
  15.  
  16. #        7.    Escape any $'s standing alone.
  17.  
  18. #        8. Escape any :'s following a variable reference.
  19.  
  20. #        9. Fixup any : null statements as ; statements and any : statements
  21. #            as tests in a while.
  22.  
  23. #        10. Fixup any if's without then's and any fi's that might have
  24. #            sneaked thru during case fixups.
  25.  
  26. /#[^     ]/{
  27.     s/#=/#/
  28.     s/#/# /
  29.     }
  30. /# $/s/ $//
  31.  
  32. s/\/dev\/null/nul/
  33.  
  34. /^[^#']*\$\?/s/\$\?/$status/
  35.  
  36. /^[^#']*\$\!/s/\$\!/$child/
  37.  
  38. /^[     ]*kill -9 \$/s/-9 /p/
  39.  
  40. /^[     ]*read /s/read[     ][     ]*\([^     ]*\)/@ \1 = getline/
  41.  
  42. s/^\([^#]*\)\([^\\$]\)\$$/\1\2\\$/
  43. s/^\([^#]*\)\([^\\$]\)\$\([^$a-zA-Z0-9{]\)/\1\2\\$\3/
  44.  
  45. /^[^#']*\${[^}]*}:/s/\(\${[^}]*}\):/\1\\:/
  46. /^[^#']*\$[a-zA-Z][a-zA-Z0-9_]*:/s/\(\$[a-zA-Z][a-zA-Z0-9_]*\):/\1\\:/
  47.  
  48. /^[     ]*while[     ]*:$/s/:/( 1 )/
  49.  
  50. /^[^#"']*:/{
  51.     /case/ ! {
  52.         /default/ ! s/:/;/
  53.         }
  54.     }
  55.  
  56. /^[     ]*fi[     ]*$/s/fi/end/
  57. /^[     ]*if/{
  58.     /then$/ ! s/$/ then/
  59.     }
  60.