'=========================================================================== ' Subject: HTML VIEWER V1.02 FOR PB Date: 11-02-97 (14:45) ' Author: Ian Smith Code: PB ' Origin: ian@isis.demon.co.uk Packet: HTML.ABC '=========================================================================== 'HTML Viewer - Ian Smith - ian@isis.demon.co.uk - PB 3.2 'I regard it as PD, so feel free to do with it as you wish... ' 'Written to view HTML docs, select links and, optionally, put the 'URLs for those links into a script for collection. ' 'Use: hv (.htm suffix not required, but if the suffix is ' anything other than .htm the suffix *is* required.) ' 'Keys: Home - go to top of file ' Up arrow - move display up one line ' Down arrow - move display down one line ' End - go to end of file ' Page down - move display down one page ' Space bar - ditto ' Page up - move display up one page ' TAB - jump highlight to next link ' Enter - save URL from highlighted link ' Esc - Exit ' 'History: 'HTML decoder was inspired by the V3.07 one in the ABC collection, 'written by Toshigiro Horie. 'Converted to PB and modified to pull URLs from the page. 'That was a long time ago... ' 'Small memory model with minimal string allocation to run under 'YAN 1.3 (KA9Q). Speed traded for size.... $STRING 1 OPTION BINARY BASE 1 DEFINT A-Z '$DYNAMIC DECLARE SUB Process(file$) DECLARE SUB URLproc() DECLARE SUB Pullhref() DECLARE SUB Pullimf() DECLARE SUB Textout() DECLARE SUB Htmlproc() DECLARE SUB Catchall() DECLARE SUB Bypass() DECLARE SUB Lineproc(cline$) DECLARE SUB Entities(cline$) DECLARE SUB Spaces(cline$) DECLARE SUB Tabs(cline$) DECLARE SUB Display() DECLARE SUB Debug() SHARED urlcnt%, lcnt%, tabby%, count%,filesize&, textarrow% SHARED fg%, quit%, html%, pre%, cols%, textarrow%, xline$ SHARED aline$, baseadd$, version$, a$, table%, Title$, order% DIM httpc(300) AS SHARED INTEGER 'HTTP col position def DIM httpl(300) AS SHARED INTEGER 'HTTP line position def DIM http(300) AS SHARED STRING 'HTTP URLs DIM url(50) AS SHARED STRING 'URLs pulled for script DIM pline(3000) AS SHARED STRING 'display lines Version$ = "1.02" CMD$ = UCASE$(COMMAND$) ' command line string Title$ = "HTML VIEWER V" + version$ SCREEN 0 CLS COLOR 7, 0 IF INSTR(Cmd$, ".HTM") = 0 THEN Cmd$ = Cmd$ + ".HTM" IF Cmd$ = ".HTM" OR Cmd$ = "" THEN PRINT "File not found" END END IF ' OK, we've got a valid page to process Process Cmd$ Display URLproc ' Debug ' display and log some diags stuff and log the converted doc. END '------------------------------------------------------------------------- SUB Debug ' debug data - can be dropped OPEN "DEBUG" FOR OUTPUT AS #2 PRINT #2," --==< Debug Info >==--" PRINT #2, USING "Free Memory: #######. Stack low water mark: ####.";fre(-1), fre(-2) PRINT #2, USING "Display lines used: ####. URLs found: ###."; lcnt%, count% PRINT #2, USING "HTML file size: ######.";filesize& PRINT #2, " " FOR db% = 1 to lcnt% PRINT #2, pline$(db%) NEXT CLOSE PRINT " --==< Debug Info >==--" PRINT USING "Free Memory: #######. Stack low water mark: ####.";fre(-1), fre(-2) PRINT USING "Display lines used: ####. URLs found: ###."; lcnt%, count% PRINT USING "HTML file size: ######.";filesize& END SUB '------------------------------------------------------------------------- SUB Process (file$) a$ = " " lcnt% = 1 LOCATE 1, 1 COLOR 11,1 PRINT Title$, TAB(80); LOCATE 1, 81 - LEN(file$) PRINT file$; LOCATE 1, 36 COLOR 11, 1 LOCATE 25, 1 COLOR 0, 7 PRINT TAB(80):PRINT " "; VIEW TEXT (pbvScrnCols,2) - (pbvScrnCols,24) 'progress window COLOR 14,3 CLS VIEW TEXT (1,2)-(pbvScrnCols - 1,24) ' text page COLOR 7,0 PRINT "Reading input file..." OPEN file$ FOR BINARY AS #1 filesize& = LOF(1) GET #1, 1, a$ WHILE NOT EOF(1) IF a$ > CHR$(31) THEN ' legit characters IF a$ = "<" OR h% = 1 THEN ' HTML field CALL Htmlproc ELSE CALL Textout ' Plain text END IF END IF WEND CLOSE END SUB '------------------------------------------------------------------------ SUB URLproc 'process selected URLs VIEW TEXT (1,1)-(pbvScrnCols,25) COLOR 7, 0 CLS ' print baseadd$ IF LEFT$(baseadd$,4) = "