/[mailutils]/mailutils/auth/lbuf.c
ViewVC logotype

Diff of /mailutils/auth/lbuf.c

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

revision 1.1 by gray, Thu Aug 28 19:34:09 2003 UTC revision 1.2 by gray, Thu Aug 28 21:54:06 2003 UTC
# Line 110  _auth_lb_readline (struct _line_buffer * Line 110  _auth_lb_readline (struct _line_buffer *
110      size = p - s->buffer + 1;      size = p - s->buffer + 1;
111    return _auth_lb_read (s, ptr, size);    return _auth_lb_read (s, ptr, size);
112  }  }
113      
114    int
115    _auth_lb_writelines (struct _line_buffer *s, const char *iptr, size_t isize,
116                         off_t offset,
117                         int (*wr) (void *data, char *start, char *end),
118                         void *data,
119                         size_t *nbytes)
120    {
121      if (s->level > 2)
122        {
123          char *start, *end;
124          
125          for (start = s->buffer, end = strchr (start, '\n');
126               end && end < s->buffer + s->level;
127               start = end + 1, end = strchr (start, '\n'))
128            if (end[-1] == '\r')
129              {
130                int rc = wr (data, start, end);
131                if (rc)
132                  return rc;
133              }
134    
135          if (start > s->buffer)
136            {
137              if (start < s->buffer + s->level)
138                {
139                  int rest = s->buffer + s->level - start + 1;
140                  memmove (s->buffer, start, rest);
141                  s->level = rest;
142                }
143              else
144                s->level = 0;
145            }
146        }
147    
148      if (nbytes)
149        *nbytes = isize;
150      return 0;
151    }
152    
153  int  int
154  _auth_lb_level (struct _line_buffer *s)  _auth_lb_level (struct _line_buffer *s)
155  {  {

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