is this a typo in ed.ex?

new topic     » topic index » view thread      » older message » newer message
-- code from Euphoria 3.1, ed.ex 
without warning 
function clean(sequence line) 
-- replace control characters with a graphics character 
-- Linux: replace CR-LF with LF (for now) 
    integer c 
     
    for i = 1 to length(line) do 
	c = line[i] 
	if c < SAFE_CHAR and c != '\n' and c != '\t' then 
	    if c != '\r' or platform() != LINUX then 
		line[i] = CONTROL_CHAR  -- replace with displayable character 
		control_chars = TRUE 
	    end if 
	end if 
    end for 
    if line[length(line)] != '\n' then 
	line &= '\n' 
    end if 
    if platform() = LINUX and  
       length(line) > 1 and ---------<<------------------------ 
       line[length(line)-1] = '\r' then 
       -- DOS file: remove CR 
       cr_removed = TRUE 
       line = line[1..length(line)-2] & '\n' 
    end if 
    return line 
end function 
with warning 
 
-- euphoria 4.0.3, ed.ex 
function clean(sequence line) 
-- replace control characters with a graphics character 
-- Linux: replace CR-LF with LF (for now) 
	integer c 
 
	if line[$] != '\n' then 
		line &= '\n' 
	end if 
 
	ifdef UNIX  then 
 -------------------------------------------------------------------- line as downloaded in 4.0.3 tar.gz :            
         if length(line) > 2 and if length(line) > 1 and  ------<<<-------------------------------------????? 
------------------------------------------------------------------------------		 
------------------------------------- many months back, I edited the above line as follows: 
------- if length(line) > 2 and	 
          if length(line) > 1 and 
                      line[$-1] = '\r' then 
			-- DOS file: remove CR 
			cr_removed = TRUE 
			line = line[1..$-2] & '\n' 
	   end if 
	end ifdef 
 
	for i = 1 to length(line)-1 do 
		c = line[i] 
		if c < SAFE_CHAR and c != '\t' then 
			line[i] = CONTROL_CHAR  -- replace with displayable character 
			control_chars = TRUE 
		end if 
	end for 
	return line 
end function 

I haven't noticed any problems since I edited out the line I believe to be extraneous.

Regards, Kenneth Rhodes

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu