ChangeLog.awk revision 418968b6d1424ce89cb1d8521f27b6cdae8237c4
1#!/bin/awk -f
2BEGIN         { 
3		nb_entry = 0
4                in_entry = 0
5                in_item = 0
6		print "<log>"
7	      }
8END           {
9                if (in_item == 1)  printf("%s</item>\n", item)
10                if (in_entry == 1) print "  </entry>"
11                print "</log>"
12	      }
13/^[ \t]*$/    { next }
14/^Mon|^Tue|^Wed|^Thu|^Fri|^Sat|^Sun/ { 
15                match($0, "\(.*\) \([A-Z]+\) \([0-9][0-9][0-9][0-9]\) \(.*\) <\(.*\)>", loge)
16                if (in_item == 1)  printf("%s</item>\n", item)
17                if (in_entry == 1) print "  </entry>"
18		nb_entry = nb_entry + 1
19		if (nb_entry > 50) {
20		    in_entry = 0
21		    in_item = 0
22		    exit
23		}
24                in_entry = 1
25                in_item = 0
26		printf("  <entry date='%s' timezone='%s' year='%s'\n         who='%s' email='%s'>\n", loge[1], loge[2], loge[3], loge[4], loge[5])
27	      }
28/^[ \t]*\*/   {
29                if (in_item == 1)  printf("%s</item>\n", item)
30                in_item = 1
31		printf("    <item>")
32                match($0, "[ \t]*. *\(.*\)", loge)
33		item = loge[1]
34              }
35/^[ \t]*[a-zA-Z0-9\#]/    { 
36                if (in_item == 1) {
37		    match($0, "[ \t]*\(.*\)[ \t]*", loge)
38		    item = sprintf("%s %s",  item, loge[1])
39		}
40              }
41