blob: d9229a12ee4a403123fbf2a67ef834541f689b91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#! @PERL@
#
# Copyright 2000-2022 Double Precision, Inc. See COPYING for
# distribution information.
#
# Ok, the output of LIST is given in filesystem order, so fix that by
# prefixing a line number count, which doesn't incremenet for a LIST,
# and have the output of this script sorted.
#
$n=0;
sub sortflags {
my ($n)=@_;
my $sp="";
$sp=" " if $n =~ s/\s+$//;
my @w = grep { $_ ne ""} split(/\s+/, $n);
return join(" ", sort @w) . $sp;
}
sub sortflags2 {
my ($n)=@_;
my @w = split(/,/,$n);
return join(",", sort @w);
}
while (<>)
{
s/UIDVALIDITY \d+/UIDVALIDITY/;
s/INTERNALDATE "[^"]*"/INTERNALDATE -DATE-/g;
s/\[COPYUID.*\] //;
s/\[APPENDUID.*\] //;
s/^\* ADD \"UID=.*/* ADD UID/;
s/^\* COPY \d+ \"NEWUID=.*/* COPY NEWUID/;
s/^(\* (\d+ FETCH \()?FLAGS \(|\* OK \[PERMANENTFLAGS \()([^\\\)]+)/$1 . sortflags($3)/e;
s/^(\* FETCH \d+ .*"[-+]?KEYWORDS=)([^"]+)/$1 . sortflags2($2)/e;
printf("%06d %s", $n, $_);
++$n unless $_ =~ /^\* (LIST|LSUB|ENABLED)/ || $_ =~ /Options enabled/;
}
|