Re: extra ^M's in files from iedit/redit

From: Sammy (samedi@clark.net)
Date: 11/01/95


On Wed, 1 Nov 1995, Billy H. Chan (~{3B:FH;~}) wrote:

> Hi all,
> 	Finally had time to futz around with redit/iedit (in trying
> to do a zedit that everyone will love), I realized why the thing was
> putting them ^M's all over the place.... well... the culprit, at
> least on the Sun, is that it's fprintf'ing "\r\n" instead of just
> "\n"... the "\r" translates to that ^M we see and love.  So, if you're
> using iedit/redit, go and chuck a few of them \r's that are in
> fprintfs if you're using Unix (I'm not sure about dos, which may or
> maynot need the ^M.... for instance, if I down load ascii text files
> from my dos box to my linux box, sometimes I get them pesky ^M's.)

I'm not sure about redit and iedit, but my olc has the same problem, and 
it doesn't seem to be as simple as that.  Text descriptions need those 
\r's online, or people who are using terminals that need them see crap 
like a line
           and the next line
                            and so on.  Somebody a while back posted a 
fix for modify.c to leave out the \r's when using iedit and redit.  I 
tried this and got the above problem with certain users.  I think the 
only way to get normal-looking text online, but save the file without the 
^M's is to parse descriptions to remove all ^M's before writing to the 
output file. 

I'm pretty weak on string manipulation so I haven't worked this out yet, 
but I think you could probably reformat the text by changing all ^M's to 
spaces.

For example, something like this:

remove_emms(char *description)
{
  int i;

  for(i = 0; i <= strlen(description); i++) {
    if(*description + i == '\r')
      *description + i = ' ';
  }
}

This is off the top of my head so don't assume it's correct.  I'm gonna 
try it later and see if it takes care of the problem.

Sam



This archive was generated by hypermail 2b30 : 12/07/00 PST