/* rexx*/
/* David McRitchie for "The REXX Macros Toolbox" 1996 */
address "ISREDIT";"MACRO"
/* ................
a.b.c d e fuuu
a.b.c d e fuuu
bbbbbbbbbbb
a.b.c d e fuuu
a.b.c d e fuuu
a.b.c d e fuuu
a.b.c d e fuuu
a.b.c d e fuuu
a.b.c d e fuuu
..........*/
arg clear1
parse version v1 v2 v3 v4 v5 /* REXXSAA, REXX/2, REXX370 */
if v1 = "REXX/2" then env = "CMD"; else env = "OS2ENVIRONMENT"
userid = value('userid',,env)
"(dataset) = dataset"
date1 = left(date('s'),4)"/"substr(date('s'),5,2)"/"right(date('s'),2)
/*
x = stream(dataset,"command","open write")
say stream(dataset,"description")
exit
*/
"save"
if rc \= 0 then do
say """Can't SAVE so have exited before continuing"""
"line_before .zfirst = noteline",
"""Can't SAVE so have exited before continuing"""
exit
end
"bounds"
"f first p'=' 1" /* if empty or CLEAR -- refresh with orig.*/
"(dataset) = dataset"
"(member) = member"
member = translate(strip(member))
member = translate(strip(member))
if member = "BOOKMARU.HTM" then do
"delete .zf .zl all"
"copy" "bookmark.htm"
signal byp0
end
if rc \= 0 | clear1 = "CLEAR" then do
if right(member,6) \= 'U.HTML' then
if right(member,5) \= 'U.HTM' then return 8
parse var member memb 'U.HTM'
if clear1 = "CLEAR" then "delete .zf .zl all"
i=pos('.HT',memb)
if i = 0 then copyfrom = memb||'.htm'
else copyfrom = memb
say member ',' memb ',' copyfrom
"copy" copyfrom
end
byp0:
"change all x'0d202020' ''"
"reset change"
"find first ''"
"find next 1 '<'"
"line_before .zcsr = dataline """""
"line_before .zcsr = dataline """""
if copyfrom \= "COPYFROM" then
"line_before .zcsr = dataline """""
"change all '
' '
'"
"cursor = 1 0"
do i = 1 to 1500
"f 'href=""'"
if rc \= 0 then leave i
if i//100 = 0 then say "Now processing the" i"th href= string"
"(row1,col1) = cursor"
"(line) = line .zcsr"
"f '""' next"
if rc \= 0 then leave i
"f '""' next"
if rc \= 0 then leave i
"(row2,col2) = cursor"
if row2 = row1 then urladdr = substr(line,col1+6,col2-col1-6)
else urladdr = substr(line,col1+6)
/* there may be a limit of about xxx characters on a command*/
/* so it is being split up into parts */
"(rowx,colx) = cursor"
"c '' '[--"strip(replace(urladdr,"&","&&"))"--]'"
"CURSOR =" rowx colx
"c '' ''"
end
/*"c all '
' '>
[BASE --"strip(urladdr)" --]
'"
end
/*"c all '
5" all
"line_before .zf = dataline ""
"""
"f first
";"find next <"
"@ICOPY nx .zcsr .zlast after .zfirst .zfirst"
"del all .zfirst .zfirst"
/* remove BookMark date information */
/* Netscape timestamps can be interpreted using SECSINCE.SPF */
"change all p' ADD$DATE$$^^^^^^^^^$' ''"
"change all p' LAST$VISIT$$^^^^^^^^^$' ''"
"change all p' LAST$MODIFIED$$^^^^^^^^^$' ''"
"change all ' LAST_VISIT=""0""' ''"
"change all ' LAST_MODIFIED=""0""' ''"
"find first p'=' 1"
"reset"
"up 3"
return 0
/* REPLACE is included from txt2html to handle & within url: */
Replace: procedure
parse arg string, old, new
lold = length(old)
lnew = length(new)
lll=length(string) /*<-- make SPF/PC work*/
if 0 = length(string) then return string
if 0 = length(old) then return string
P = 1; k=0
do forever
k=k+1
p = pos(old, string, p)
if p = 0 then signal xxx
string = substr(string,1,p-1)new||substr(string,p+lold)
p = p + lnew
lll = lll - lold + lnew /* <--make SPF/PC work*/
end
xxx:
/*********************************************************************/
/* Following *@#*#* code is necessary for SPF/PC you figure it out */
/* I can't. Leave out this code and get spurious data if you */
/* convert http://www.geocities.com/davemcritchie/excel/pathname.txt */
/* SPF/PC is not limited to 255 byte records, you could start with */
/* a 150 byte record and end up with a 285 byte record. You could */
/* have 8000 byte records. YOU MAY RUN OUT OF MEMEMORY TOO. */
/*********************************************************************/
string = left(string,lll)
return string
exit