home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 10
/
Fresh_Fish_10_2352.bin
/
useful
/
util
/
edit
/
mg
/
rexx
/
notabs.mg
< prev
next >
Wrap
Text File
|
1990-06-02
|
838b
|
46 lines
/* Convert all TABs in a region to spaces */
options results
'rexx-region' fooey
'kill-region'
do i=1 to fooey.0
if index(fooey.i,'0d'x) then text=slashquote(rot13(left(fooey.i,length(fooey.i)-1)))||'\n'
else text=slashquote(notab(fooey.i))
'rexx-insert "'||text||'"'
end
exit
notab:procedure
parse arg line
tmp=1
do until tmp=0
tmp=index(line,'09'x)
if tmp>0 then do
no=9-(tmp//8)
line=delstr(line,tmp,1)
line=insert(left("",no),line,tmp-1)
end
end
return line
/* slashquote - puts '\' in front of any '"''s or '\''s we find in a string */
slashquote: procedure
parse arg in
i = index(in, '\')
do while i > 0
in = substr(in, 1, i - 1)'\\'substr(in, i + 1)
i = index(in, '\', i + 2)
end
i = index(in, '"')
do while i > 0
in = substr(in, 1, i - 1)'\"'substr(in, i + 1)
i = index(in, '"', i + 2)
end
return in