/* OS/2 REXX, requires DOSCALL.EXE and F-PROT.EXE 3.11b or later: */ /* Start F-PROT.EXE on a given file or directory tree in an OS/2 */ /* text mode window (VIO) using DOSCALL.EXE to get rc and output. */ PROT = 'f:\etc\f-prot\f-prot.exe' PLOG = 'f:\etc\f-prot\f-prot.log' /* Usage: F-PROT [drive, file or directory] [options] */ /* */ /* /AI Enable neural-network virus detection. */ /* /APPEND Append to existing report file. */ /* /ARCHIVE Scan inside .ZIP and .ARJ files. */ /* /AUTO Automatic virus removal. */ /* /BEEP Beep when a virus is found. */ /* /CDROM Scan any attached CD-ROM drives. */ /* /COLLECT Scan a virus collection. */ /* /DELETE Delete infected files. */ /* /DISINF Disinfect whenever possible. */ /* /DUMB Do a "dumb" scan of all files. */ /* /EXT Scan only files with default extensions. */ /* /FREEZE "Freeze" the program if a virus is found. */ /* /HARD Scan the hard disk(s). */ /* /HELP Display this list. */ /* /LIST List all files checked. */ /* /LOADDEF Load DEF files from a floppy. */ /* /NET Scan network directories mapped to a drive. */ /* /NOBOOT Do not scan boot sectors. */ /* /NOBREAK Do not abort scan if ESC is pressed. */ /* /NOFILE Do not scan files. */ /* /NOFLOPPY For use on system without floppy drives. */ /* /NOHEUR Disable heuristics. */ /* /NOLFN Disable long file name support. */ /* /NOMEM Do not scan memory for viruses. */ /* /NOSUB Do not scan subdirectories. */ /* /OLD Do not complain when using outdated DEF files. */ /* /ONLYHEUR Only use heuristics, not "normal" scanning. */ /* /PACKED Unpack compressed executables. */ /* /RENAME Rename infected COM/EXE files to VOM/VXE. */ /* /TYPE Select files by type. (default) */ /* /VIRLIST List the known viruses. */ /* /VIRNO Count the known viruses. */ /* /WRAP Wrap text so the report fits in 78 columns. */ /* /SILENT Do not generate any screen output. */ /* /NOMACRO Do not scan for macro viruses. */ /* /ONLYMACRO Only scan for macro viruses. */ /* /REMOVEALL Remove all macros from all documents. */ /* /REMOVENEW Remove new variants of macro viruses by */ /* removing all macros from infected documents. */ /* /SAFEREMOVE Remove all macros from documents, if a known */ /* virus is found. */ /* */ /* Without options F-PROT.CMD uses /AI /ARCHIVE /PACKED /WRAP ... */ signal on novalue name TRAP ; signal on syntax name TRAP signal on failure name TRAP ; signal on halt name TRAP call UTIL 'SysGetKey' ; call UTIL 'SysTextScreenSize' parse arg FILE '/' OPTS if FILE = '' then exit HELP( 1 ) if OPTS <> '' then OPTS = '/' || translate( strip( OPTS )) else OPTS = '/AI /ARCHIVE /PACKED /WRAP' if pos( 'INTER', OPTS ) > 0 then exit HELP( 0 ) if pos( 'PAGE' , OPTS ) > 0 then exit HELP( 0 ) address CMD 'DOSCALL' PROT FILE OPTS '/REPORT=' || PLOG exit rc HELP: procedure parse value SysTextScreenSize() with ROWS . ; HERE = 0 if arg( 1 ) then do N = 1 parse value sourceline( N ) with STOP '/*' LINE '*/' if HERE = 0 then if abbrev( strip( LINE ), 'Usage:' ) = 0 then iterate N if STOP <> '' then leave N HERE = HERE + 1 ; say LINE if HERE // ( ROWS - 2 ) = 0 then call SysGetKey 'NoEcho' end N else say "sorry, options /INTER or /PAGE won't work in a pipe..." return 1 /* see , (c) F. Ellermann */ UTIL: procedure /* load necessary RexxUtil entry */ if RxFuncQuery( arg( 1 )) then if RxFuncAdd( arg( 1 ), 'RexxUtil', arg( 1 )) then exit TRAP( "can't add RexxUtil" arg( 1 )) return 0 TRAP: /* select REXX exception handler */ call trace 'O' ; trace N /* don't trace interactive */ parse source TRAP /* source on separate line */ TRAP = x2c( 0D ) || right( '+++', 10 ) TRAP || x2c( 0D0A ) TRAP = TRAP || right( '+++', 10 ) /* = standard trace prefix */ TRAP = TRAP strip( condition( 'c' ) 'trap:' condition( 'd' )) select when wordpos( condition( 'c' ), 'ERROR FAILURE' ) > 0 then do if condition( 'd' ) > '' /* need an additional line */ then TRAP = TRAP || x2c( 0D0A ) || right( '+++', 10 ) TRAP = TRAP '(RC' rc || ')' /* any system error codes */ if condition( 'c' ) = 'FAILURE' then rc = -3 end when wordpos( condition( 'c' ), 'HALT SYNTAX' ) > 0 then do if condition( 'c' ) = 'HALT' then rc = 4 if condition( 'd' ) > '' & condition( 'd' ) <> rc then do if condition( 'd' ) <> errortext( rc ) then do TRAP = TRAP || x2c( 0D0A ) || right( '+++', 10 ) TRAP = TRAP errortext( rc ) end /* future condition( 'd' ) */ end /* may use errortext( rc ) */ else TRAP = TRAP errortext( rc ) rc = -rc /* rc < 0: REXX error code */ end when condition( 'c' ) = 'NOVALUE' then rc = -2 /* dubious */ when condition( 'c' ) = 'NOTREADY' then rc = -1 /* dubious */ otherwise /* force non-zero whole rc */ if datatype( value( 'RC' ), 'W' ) = 0 then rc = 1 if rc = 0 then rc = 1 if condition() = '' then TRAP = TRAP arg( 1 ) end /* direct: TRAP( message ) */ TRAP = TRAP || x2c( 0D0A ) || format( sigl, 6 ) signal on syntax name TRAP.SIGL /* throw syntax error 3... */ if 0 < sigl & sigl <= sourceline() /* if no handle for source */ then TRAP = TRAP '*-*' strip( sourceline( sigl )) else TRAP = TRAP '+++ (source line unavailable)' TRAP.SIGL: /* ...catch syntax error 3 */ if abbrev( right( TRAP, 2 + 6 ), x2c( 0D0A )) then do TRAP = TRAP '+++ (source line unreadable)' ; rc = -rc end select when 0 then do /* in pipes STDERR: output */ parse version TRAP.REXX . . /* REXX/Personal: \dev\con */ signal on syntax name TRAP.FAIL if TRAP.REXX = 'REXXSAA' /* fails if no more handle */ then call lineout 'STDERR' , TRAP else call lineout '\dev\con', TRAP end when 0 then do /* OS/2 PM: RxMessageBox() */ signal on syntax name TRAP.FAIL call RxMessageBox , /* fails if not in PMREXX */ translate( TRAP, ' ', x2c( 0D )), , 'CANCEL', 'WARNING' end /* replace any CR by blank */ otherwise say TRAP ; trace ?L /* interactive Label trace */ end if condition() = 'SIGNAL' then signal TRAP.EXIT TRAP.CALL: return rc /* continue after CALL ON */ TRAP.FAIL: say TRAP ; rc = 0 - rc /* force TRAP error output */ TRAP.EXIT: exit rc /* exit for any SIGNAL ON */