~ubuntu-branches/debian/sid/git/sid

« back to all changes in this revision

Viewing changes to builtin/mailsplit.c

  • Committer: Package Import Robot
  • Author(s): Jonathan Nieder
  • Date: 2013-06-12 07:50:53 UTC
  • mfrom: (1.2.19) (2.1.31 experimental)
  • Revision ID: package-import@ubuntu.com-20130612075053-uue9xe0dq0rvm44y
Tags: 1:1.8.3.1-1
* merge branch debian-experimental
* new upstream point release (see RelNotes/1.8.3.1.txt).
* debian/watch: use xz-compressed tarballs from kernel.org.

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
        return 0;
131
131
}
132
132
 
 
133
static int maildir_filename_cmp(const char *a, const char *b)
 
134
{
 
135
        while (*a && *b) {
 
136
                if (isdigit(*a) && isdigit(*b)) {
 
137
                        long int na, nb;
 
138
                        na = strtol(a, (char **)&a, 10);
 
139
                        nb = strtol(b, (char **)&b, 10);
 
140
                        if (na != nb)
 
141
                                return na - nb;
 
142
                        /* strtol advanced our pointers */
 
143
                }
 
144
                else {
 
145
                        if (*a != *b)
 
146
                                return (unsigned char)*a - (unsigned char)*b;
 
147
                        a++;
 
148
                        b++;
 
149
                }
 
150
        }
 
151
        return (unsigned char)*a - (unsigned char)*b;
 
152
}
 
153
 
133
154
static int split_maildir(const char *maildir, const char *dir,
134
155
        int nr_prec, int skip)
135
156
{
139
160
        int i;
140
161
        struct string_list list = STRING_LIST_INIT_DUP;
141
162
 
 
163
        list.cmp = maildir_filename_cmp;
 
164
 
142
165
        if (populate_maildir_list(&list, maildir) < 0)
143
166
                goto out;
144
167