^Ms, easier solution correction!

From: The Awakening (awake@texas.net)
Date: 11/25/95


It never fails that when you edit a function on the fly before mailing 
it, you'll screw up.  Originally the cleanup function returned void and 
just modified *dest.  Well, in changing it to return a char * so you 
could use it inside fprint and such, I forgot to make a couple of 
necessary changes.  So, here's the correct version (hehehe, maybe I 
should practice playing with strings).

/* strips \r's from line */
char *cleanup(char *dest, const char *src)
{
  if (!dest || !src)
    return NULL;

  char *temp = &dest[0];
  int i = 0, length = strlen(src);

  for (; *src && (i < length); i++, src++)
     if (*src != '\r')
       *(temp++) = *src;

  // terminate it properly
  *temp = '\0';

  return dest;
}


This should work correctly now (=.

Chris
(awake@texas.net)
(http://www.texas.net/~awake)
(awake.gstand.com 4000)

"Try not!  Do or do not!  There is no try!"  --Yoda, Jedi Master



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