home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
epmsmp.zip
/
SUBSET.E
< prev
next >
Wrap
Text File
|
1995-07-24
|
2KB
|
53 lines
; Subset.e - this presents you with a file containing the subset of the
; current file which contains a given string. The argument to the Subset
; command is the argument to the Locate command, so that the desired options
; can be specified. E.g.,
; subset /officer/ c
; subset -OS/2-
; Author: Larry Margolis
compile if not defined(SMALL) -- If compiling stand-alone...
include 'english.e'
defmain
'subset' arg(1)
compile endif
defc subset =
getfileid startfid
'xcom e /c /q tempfile'
if rc<>-282 then -- sayerror('New file')
sayerror ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext(rc)
return
endif
getfileid subfid
.autosave = 0
browse_mode = browse() -- query current state
if browse_mode then call browse(0); endif
activatefile startfid
call psave_pos(save_pos)
0
do forever
'xcom l' arg(1)
if rc then
leave
endif
insertline textline(.line), subfid.last+1, subfid
endline
enddo
call prestore_pos(save_pos)
activatefile subfid
if not .modify then
'xcom quit'
activatefile startfid
if browse_mode then call browse(1); endif -- restore browse state
return
endif
sayerror 0 -- Delete last "not found" message.
deleteline 1
.modify = 0
if browse_mode then call browse(1); endif -- restore browse state
.filename = '.subset'
.titletext = 'Subset of' startfid.filename 'matching: 'arg(1)