/[svn]/ircd-hybrid-7.3/src/irc_string.c
ViewVC logotype

Diff of /ircd-hybrid-7.3/src/irc_string.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1044 by michael, Sun Nov 8 13:10:50 2009 UTC revision 1045 by michael, Tue Jan 26 12:58:42 2010 UTC
# Line 70  myctime(time_t value) Line 70  myctime(time_t value)
70  }  }
71    
72  /*  /*
  * clean_string - clean up a string possibly containing garbage  
  *  
  * *sigh* Before the kiddies find this new and exciting way of  
  * annoying opers, lets clean up what is sent to local opers  
  * -Dianora  
  */  
 char *  
 clean_string(char* dest, const unsigned char* src, size_t len)  
 {  
   char* d    = dest;  
   assert(0 != dest);  
   assert(0 != src);  
   
   if(dest == NULL || src == NULL)  
     return NULL;  
       
   len -= 3;  /* allow for worst case, '^A\0' */  
   
   while (*src && (len > 0))  
   {  
     if (*src & 0x80)             /* if high bit is set */  
     {  
       *d++ = '.';  
       --len;  
     }  
     else if (!IsPrint(*src))       /* if NOT printable */  
     {  
       *d++ = '^';  
       --len;  
       *d++ = 0x40 + *src;   /* turn it into a printable */  
     }  
     else  
       *d++ = *src;  
     ++src, --len;  
   }  
   *d = '\0';  
   return dest;  
 }  
   
 /*  
73   * strip_tabs(dst, src, length)   * strip_tabs(dst, src, length)
74   *   *
75   *   Copies src to dst, while converting all \t (tabs) into spaces.   *   Copies src to dst, while converting all \t (tabs) into spaces.

Legend:
Removed from v.1044  
changed lines
  Added in v.1045

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28