home *** CD-ROM | disk | FTP | other *** search
- * All rights reserved
- *
- * Terminal emulators such as MsKermit, Telix and Procomm can capture
- * the session in a capture file. A problem with these files is that
- * (depending on the host) the capture files can end up with lots of
- * escape sequences, and other control characters. This macro is for
- * stripping them from a Unix host session. Particularly useful after
- * reading InterNet news with a capture file turned on.
- *
- * By Timo Salmi, Thu 26-Dec-91
- *
- * To compile this macro apply QMAC SESSION.MAC SESSION.QMA /A- /B
- * The QMAC.EXE macro translator is from
- * garbo.uwasa.fi:/pc/editor/qmac215.zip
- * (Also the earlier version 2.1 will do).
- *
-
- * ┌───────────────────────────────────────────────────────────────────┐
- * │ Filter escape sequences & other garbage from a session log, ALT-5 │
- * └───────────────────────────────────────────────────────────────────┘
- @5 MacroBegin
-
- * Perform the deletes required by backspaces,
- * and simultaneously filter the backspace characters
- BegFile
- next10:
- Find #8
- Return
- Return
- JFalse next11:
- DelCh
- Backspace
- Jump next10:
-
- * Replace by proper linefeeds
- next11:
- BegFile
- next12:
- Find #13
- Return
- Return
- JFalse next15:
- DelCh
- Return
- Jump next12:
-
- * Replace the clear screen ansi code with a few linefeeds
- next15:
- BegFile
- next16:
- Find #27 "[2J"
- Return
- Return
- JFalse next17:
- DelCh DelCh DelCh DelCh
- Return
- Return
- Return
- Jump next16:
-
- * Filter certain escape sequences
- next17:
- BegFile
- next18:
- Find #27 "[5"
- Return
- Return
- JFalse next19:
- DelCh DelCh DelCh
- Return
- Jump next18:
-
- next19:
- BegFile
- next20:
- Find #27 "[19"
- Return
- Return
- JFalse next21:
- DelCh DelCh DelCh DelCh
- Return
- Jump next20:
-
- next21:
- BegFile FindReplace ";1H" Return Return " " backSpace Return
- Jfalse label1: "r"
- label1:
- BegFile FindReplace #27 "[K" Return Return Return Jfalse label2: "r" label2:
- BegFile FindReplace #27 ";4H" Return Return Return Jfalse label3: "r"
- label3:
- BegFile FindReplace #27 "[m" Return Return Return Jfalse label4: "r"
- label4:
- BegFile FindReplace #27 "[4m" Return Return Return Jfalse label5: "r"
- label5:
- BegFile FindReplace #27 "[A" Return Return Return Jfalse label6: "r"
- label6:
- BegFile FindReplace #27 "[7m" Return Return Return Jfalse label7: "r"
- label7:
- BegFile FindReplace #27 "[;H" Return Return Return Jfalse label8: "r"
- label8:
- BegFile FindReplace #27 "[2" Return Return Return Jfalse label9: "r"
- label9:
- BegFile FindReplace #27 "[24" Return Return Return Jfalse label10: "r"
- label10:
- BegFile FindReplace #27 "[17" Return Return Return Jfalse label11: "r"
- label11:
- BegFile FindReplace ";10H" Return Return Return Jfalse label12: "r"
- label12:
-
- * Strip InterNet news more-response lines
- addr1:
- BegFile
- addr2:
- Find "--more--("
- Return
- Return
- JFalse addr3:
- DelLine
- Jump addr2:
-
- * Back to the beginning
- addr3:
- BegFile
-