Re: Those pesky ^Ms

mudad@alpha.coresco.com
Date: 11/25/95


My solution to the ^M problem:

Add this code to utils.c:

/* strips unessisary ^M 's from input line */
char *strip_m(char * lts)
{
  char *p, *final;
  p = strtok(lts, "\r");
  if (p==NULL)
  {                        /* based on code summited by  Brain E Mouse  */
    final = lts;
    return final;
  }
  final = p;
  while((p=strtok(NULL, "\r")) != NULL)
    strcat(final, p);
  return final;
}      

and change the redit & iedit write fuctions like so:

From: fprintf(fp, "%s~\n", obj->name);
      fprintf(fp, "%s~\n", obj->short_description);
      fprintf(fp, "%s~\n", obj->description);

To:   fprintf(fp, "%s~\n", strip_m(obj->name));
      fprintf(fp, "%s~\n", strip_m(obj->short_description));
      fprintf(fp, "%s~\n", strip_m(obj->description));
      
and so on through the rest of the function.
So far, it has worked like a champ on my MUD.

Hope this helps,

Thunder      
	



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