ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/irc_string.c
(Generate patch)

Comparing ircd-hybrid-7.3/src/irc_string.c (file contents):
Revision 1029 by michael, Sun Nov 8 13:10:50 2009 UTC vs.
Revision 1045 by michael, Tue Jan 26 12:58:42 2010 UTC

# Line 70 | Line 70 | myctime(time_t value)
70   }
71  
72   /*
73 – * clean_string - clean up a string possibly containing garbage
74 – *
75 – * *sigh* Before the kiddies find this new and exciting way of
76 – * annoying opers, lets clean up what is sent to local opers
77 – * -Dianora
78 – */
79 – char *
80 – clean_string(char* dest, const unsigned char* src, size_t len)
81 – {
82 –  char* d    = dest;
83 –  assert(0 != dest);
84 –  assert(0 != src);
85 –
86 –  if(dest == NULL || src == NULL)
87 –    return NULL;
88 –    
89 –  len -= 3;  /* allow for worst case, '^A\0' */
90 –
91 –  while (*src && (len > 0))
92 –  {
93 –    if (*src & 0x80)             /* if high bit is set */
94 –    {
95 –      *d++ = '.';
96 –      --len;
97 –    }
98 –    else if (!IsPrint(*src))       /* if NOT printable */
99 –    {
100 –      *d++ = '^';
101 –      --len;
102 –      *d++ = 0x40 + *src;   /* turn it into a printable */
103 –    }
104 –    else
105 –      *d++ = *src;
106 –    ++src, --len;
107 –  }
108 –  *d = '\0';
109 –  return dest;
110 – }
111 –
112 – /*
73   * strip_tabs(dst, src, length)
74   *
75   *   Copies src to dst, while converting all \t (tabs) into spaces.

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)