/[muddleftpd]/muddleftpd/src/string.c
ViewVC logotype

Diff of /muddleftpd/src/string.c

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

revision 1.1 by ganneff, Thu Sep 26 07:55:42 2002 UTC revision 1.2 by rugger, Tue Oct 29 05:01:38 2002 UTC
# Line 84  void string_filterbadchars(STRING **s, i Line 84  void string_filterbadchars(STRING **s, i
84                    
85          pos1 = pos2 = STRTOCHAR(*s) + start;          pos1 = pos2 = STRTOCHAR(*s) + start;
86          slen = STRLENGTH(*s);          slen = STRLENGTH(*s);
87          for(count = start; count < slen; count++)          count = start;
88            
89            while(count < slen)
90          {          {
91                  /* be very aggressive. Only printable charaters! */                  /* be very aggressive. Only printable charaters! */
92                  if ((*pos1 >= 32) && (*pos1 <= 126))                  if ((*pos1 >= 32) && (*pos1 <= 126))
# Line 96  void string_filterbadchars(STRING **s, i Line 98  void string_filterbadchars(STRING **s, i
98                  {                  {
99                          switch(*pos1)                          switch(*pos1)
100                          {                          {
                                 case '\n':  
101                                  case '\r':                                  case '\r':
102                                            /* allow specific case of \r\n only. */
103                                            if (count != (slen - 1))
104                                                    if (*(pos1 + 1) == '\n')
105                                                    {
106                                                            // forward 2 chars
107                                                            *pos2 = *pos1;
108                                                            *(pos2 + 1) = *(pos1 + 1);
109                                                            pos1++;
110                                                            pos2 += 2;
111                                                            count++;
112                                                    }
113                                            break;
114                                  case '\t':                                  case '\t':
115                                          *pos2 = *pos1;                                          *pos2 = *pos1;
116                                          pos2++;                                          pos2++;
# Line 108  void string_filterbadchars(STRING **s, i Line 121  void string_filterbadchars(STRING **s, i
121                          }                          }
122                  }                  }
123                  pos1++;                  pos1++;
124                    count++;
125          }          }
126          *pos2 = 0;          *pos2 = 0;
127  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26