$ VerifyProcedure = 'F$Verify ( 0, F$Environment ( "Verify_Image" ) )' $ VerifyImage = F$Environment ( "Verify_Image" ) $ Set NoVerify $ If F$Mode ( ) .EQS. "OTHER" Then Exit $ If F$Type ( eMosaicConvertVerify ) .EQS. "STRING" Then - $ Set 'eMosaicConvertVerify' $ $! Procedure: eMosaic-Convert; read other "profiles" and write ours $! $! Allow one parameter: File to convert $! Assume the file contains enough information to deduce browser and type $! $! Copyright © 1996, ciscoSystems, Inc. All rights reserved. $! $! This command procedure is provided AS IS. $! $! Ed Lyon | EALyon@Cisco.Com | MultiNet-VMS@Cisco.Com $! Technical Support | VOX: +1 408 461 8600 | FAX: +1 408 461 8667 $! ciscoSystems/TGV | 101 Cooper Street | Santa Cruz, CA 95060 USA $ $ HistoryFile = "eMosaic-Global-History.HTML" $ HistoryRecord = "!AS
" $ HistoryRecordL = 255 - F$Length ( HistoryRecord ) $ HotListFile = "eMosaic-HotList-Default.HTML" $ HotListRecord = "!AS
" $ HotListRecordL = 255 - F$Length ( HotListRecord ) $ SpecialSchemes = "http:gopher:ftp:wais:news:nntp:prospero:mailserver:" $ SpecialSchemesL = F$Length ( SpecialSchemes ) $ $GetParameter: $ If p1 .EQS. "" $ Then $ Read /Error=Quit /Prompt="_File: " Sys$Command p1 $ GoTo GetParameter $ EndIf $ $ Open /Read InputFile 'p1' $ On Control_Y Then GoTo Quit $ On Warning Then GoTo Quit $ GoSub DeduceBrowserAndType $ GoSub OpenOutputFile $ ProcessRecord: $ GoSub Read'Browser''Type'Record $ Descriptor = F$Extract ( 0, 'Type'RecordL - F$Length(URL), Descriptor ) $ Write OutputFile F$FAO ( 'Type'Record, URL, TimeStamp, Descriptor ) $ GoTo ProcessRecord $ EndOfFile: $ Close OutputFile $ Close InputFile $ Write Sys$Error "%eMosaicConvert-S-Normal, normal successful completion" $ Status = %X10030001 ! %CLI-S-NORMAL, normal successful completion $ GoTo Exit $ $Quit: $ Status = $Status .OR. %X10000000 $ If F$TrnLNm ( "OutputFile" ) .NES. "" Then Close OutputFile $ If F$TrnLNm ( "InputFile" ) .NES. "" Then Close InputFile $Exit: $ Exit Status + 0 * F$Verify ( VerifyProcedure, VerifyImage ) $! $! Routine: DeduceBrowserAndType; Determine input file type. $! $! Input: File, the one to be converted. $! Output: Variable, Browser; Value, name of the browser inferred. $! Variable, Heading; Value, heading text inferred. $! Variable, Type; Value, type of file inferred. $! $! In addition to inferring the output values, we strip all header lines. $ $DeduceBrowserAndType: $ TimeStamp = "Ddd Mmm dd HH:MM:SS yyyy" $ Read /End_Of_File=Quit InputFile FileFormat $ If F$Element ( 0, "-", FileFormat ) .EQS. "ncsa" $ Then $ Browser = "NCSAmosaic" $ DaysBeforeMonth := |0|31|59|90|120|151|181|212|243|273|304|334|365| $ MonthNames := JanFebMarAprMayJunJulAugSepOctNovDec $ TimeStampL = F$Length ( TimeStamp ) $ Read /End_Of_File=Quit InputFile FileType $ If FileFormat .EQS. "ncsa-mosaic-history-format-1" $ Then $ Heading = "Global History" $ Type = "History" $ If FileType .EQS. "Global" Then Return $ EndIf $ If FileFormat .EQS. "ncsa-xmosaic-hotlist-format-1" $ Then $ Heading = "Hotlist" $ Type = "HotList" $ If FileType .EQS. "Default" Then Return $ EndIf $ EndIf $ CR[0,8] = 13 $ FileFormat = F$Element ( 0, CR, FileFormat ) $ If FileFormat .EQS. "MCOM-Global-history-file-1" $ Then $ Browser = "NetScape" $ Heading = "Global History" $ Type = "History" $ TAB[0,8] = 9 $ Return $ EndIf $ If FileFormat .EQS. "" .OR. - FileFormat .EQS. "" $ Then $ Browser = "NetScape" $ Heading = "Hotlist" $ Type = "HotList" $ GoSub SkipNetScapeBookMarkHeader $ AddDate = """ ADD_DATE=" $ AnchorEnd = "" $ hRef = "HREF=""" $ hRefL = F$Length ( hRef ) $ LastVisit = "LAST_VISIT=""" $ LastVisitL = F$Length ( LastVisit ) $ TermDef = "
" Then - $ GoTo SkipNetScapeBookMarkHeader $ Return $! $! Routine: UnixTime; Calculate seconds since the beginning of the U*x epoch. $! $! Input: Variable, TimeStamp; Value, U*x time stamp as output by ctime(). $! Output: Variable, TimeStamp; Value, seconds since 00:00:00 1-Jan-1970. $! $! Note that the following code has limited utility: $! $! The signed arithmetic used will overflow at 03:14:08 on 19-Jan-2038. $! $! The algorithm used will break at 00:00:00 on 1-Mar-2100. $! Beginning then, it will gain one day every 100 years until 1-Mar-4000. $! $! Given the life expectancy of the code, generality is not worth the effort. $ $UnixTime: $ TimeStamp = F$Edit ( TimeStamp, "Compress,Trim,UpCase" ) $ Day = F$Element ( 2, " ", TimeStamp ) $ Month = F$Locate ( F$Element ( 1, " ", TimeStamp ), MonthNames ) / 3 + 1 $ Year = F$Element ( 4, " ", TimeStamp ) $ TimeStamp = F$Element ( 3, " ", TimeStamp ) $ Hour = F$Element ( 0, ":", TimeStamp ) $ Minute = F$Element ( 1, ":", TimeStamp ) $ Second = F$Element ( 2, ":", TimeStamp ) $ Days = ( Year - 1970 ) * 365 - ! Years to Days + ( Year - 1968 ) / 4 - ! plus Leap Days - ( Month .LT. 3 .AND. Year/4*4 .EQ. Year ) - ! but only after Feb. + F$Element ( Month, "|", DaysBeforeMonth ) - ! plus days this year + Day - 1 ! plus days before this $ TimeStamp = 60 * ( 60 * ( 24 * Days + Hour ) + Minute ) + Second $ Return