home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
epmsmp.zip
/
WEBSORT.E
< prev
next >
Wrap
Text File
|
1996-02-06
|
3KB
|
118 lines
/* --- For IBM WebExplorer users ---
The following will load the copy of your EXPLORE.INI from your ETC
directory and sort the contents of the Quicklist. If you start the
Web Explorer with the /i option to handle multiple EXPLORE.INI files,
you can explicitly pass the fully-qualified name of your .INI file as
an argument.
This can be compiled (ETPM WEBSORT) and used as an external command,
or can be included in your base EPM configuration. It would be best
run using EPM 6; the shorter line length of EPM 5.51 will probably be
too limiting. (In any case, this should be "safe" - it won't trash your
EXPLORE.INI if the data is too long to be handled.)
Larry Margolis, margoli@watson.IBM.com
*/
compile if not defined(ERROR__MSG)
include 'english.e'
compile if not defined(MAXCOL)
MAXCOL = 255
compile endif
defmain
'websort' arg(1)
compile endif
defc websort =
if arg(1)<>'' then
inifilename = arg(1)
else
inifilename = get_env('ETC')'\explore.ini'
endif
getfileid startfid
'e /d' inifilename
if rc then
if rc=-282 then -- sayerror("New file")
'quit'
sayerror inifilename 'does not exist.'
else
sayerror 'Error' rc 'loading' inifilename '-' sayerrortext(rc)
endif
return
endif
'xcom l /[quicklist]/'
if rc then
sayerror 'Quicklist heading not found.'
return
endif
getfileid inifid
startline = .line + 1
'xcom e /c .temp'
if rc<>sayerror('New file') then
sayerror ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext(rc)
return rc
endif
getfileid tempfid
.autosave = 0
do i = startline to inifid.last by 2
if i>inifid.last then
leave
endif
getline line, i, inifid
if leftstr(line, 11)<>'quicklist= ' then
leave
endif
if i+1>inifid.last then
sayerror 'Bad EXPLORE.INI file - missing URL for "'substr(line, 12)'"'
return
endif
getline line2, i+1, inifid
insertline line || \1 || line2, .last+1
if length(line) + length(line2)>=MAXCOL then
bottom
.modify = 0
compile if MAXCOL = 255
sayerror 'Text + URL too long to handle - use EPM 6.x instead.'
compile else
sayerror 'Text + URL too long to handle, sorry.'
compile endif
return
endif
enddo
if not .modify then
'quit'
sayerror 'Empty quicklist.'
return
endif
result = sort(2, .last, 12, 55, tempfid, 'I' )
if result then
sayerror 'SORT' ERROR_NUMBER__MSG result
stop
endif
old_autosave = inifid.autosave
inifid.autosave = 0
old_modify = inifid.modify
do i = 2 to .last
getline line, i
parse value textline(i) with line1 \1 line2
replaceline line1, startline, inifid
replaceline line2, startline+1, inifid
startline = startline + 2
enddo
.modify = 0
'quit'
activatefile inifid -- Insurance...
.modify = old_modify + 1
.autosave = old_autosave
'file'
if not rc then
sayerror 'All done!'
activatefile startfid
endif
/*
[quicklist]
quicklist= Watson Research home page
http://mp.watson.ibm.com/xw-wat
*/