/[mailutils]/mailutils/imap4d/util.c
ViewVC logotype

Diff of /mailutils/imap4d/util.c

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

revision 1.35 by gray, Fri Jul 26 11:18:27 2002 UTC revision 1.36 by gray, Sat Jul 27 14:48:00 2002 UTC
# Line 131  util_getfullpath (char *name, const char Line 131  util_getfullpath (char *name, const char
131    return mu_normalize_path (p, delim);    return mu_normalize_path (p, delim);
132  }  }
133    
134    static int
135    comp_int (const void *a, const void *b)
136    {
137      return *(int*)a - *(int*)b;
138    }
139    
140  /* Return in set an allocated array contain (n) numbers, for imap messsage set  /* Return in set an allocated array contain (n) numbers, for imap messsage set
141     set ::= sequence_num / (sequence_num ":" sequence_num) / (set "," set)     set ::= sequence_num / (sequence_num ":" sequence_num) / (set "," set)
142     sequence_num    ::= nz_number / "*"     sequence_num    ::= nz_number / "*"
# Line 151  util_msgset (char *s, size_t **set, int Line 157  util_msgset (char *s, size_t **set, int
157    int done = 0;    int done = 0;
158    int status = 0;    int status = 0;
159    size_t max = 0;    size_t max = 0;
160      size_t *tmp;
161      int i,j;
162    
163    status = mailbox_messages_count (mbox, &max);    status = mailbox_messages_count (mbox, &max);
164    if (status != 0)    if (status != 0)
# Line 283  util_msgset (char *s, size_t **set, int Line 291  util_msgset (char *s, size_t **set, int
291              return status;              return status;
292          }          }
293      }      }
294    
295      qsort (*set, *n, sizeof (**set), comp_int);
296    
297      tmp = *set;
298      for (i = 0, j = 1; i < *n; i++)
299        if (tmp[j-1] != (*set)[i])
300          tmp[j++] = tmp[i];
301      *n = j;
302    return 0;    return 0;
303  }  }
304    
# Line 347  util_out (int rc, const char *format, .. Line 363  util_out (int rc, const char *format, ..
363    int status;    int status;
364    va_list ap;    va_list ap;
365    asprintf (&buf, "* %s%s\r\n", sc2string (rc), format);    asprintf (&buf, "* %s%s\r\n", sc2string (rc), format);
   if (daemon_param.transcript)  
     syslog (LOG_DEBUG, "sent: %s", buf);  
366    va_start (ap, format);    va_start (ap, format);
367      if (daemon_param.transcript)
368        {
369          char *buf1 = NULL;
370          vasprintf (&buf1, buf, ap);
371          if (buf1)
372            {
373              syslog (LOG_DEBUG, "sent: %s", buf1);
374              free (buf1);
375            }
376        }
377    status = vfprintf (ofile, buf, ap);    status = vfprintf (ofile, buf, ap);
378    va_end (ap);    va_end (ap);
379    free (buf);    free (buf);
# Line 368  util_finish (struct imap4d_command *comm Line 392  util_finish (struct imap4d_command *comm
392    asprintf (&buf, "%s %s%s %s\r\n", command->tag, sc2string (rc),    asprintf (&buf, "%s %s%s %s\r\n", command->tag, sc2string (rc),
393              command->name, format);              command->name, format);
394    
395      va_start (ap, format);
396    if (daemon_param.transcript)    if (daemon_param.transcript)
397      syslog (LOG_DEBUG, "send: %s", buf);      {
398          char *buf1 = NULL;
399          vasprintf (&buf1, buf, ap);
400          if (buf1)
401            {
402              syslog (LOG_DEBUG, "sent: %s", buf1);
403              free (buf1);
404            }
405        }
406        
   va_start (ap, format);  
407    status = vfprintf (ofile, buf, ap);    status = vfprintf (ofile, buf, ap);
408    va_end (ap);    va_end (ap);
409    free (buf);    free (buf);

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

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