#!/bin/sh

printf '[[title\n'
printf '            A List of Recently Updated Bugs (sorted by date)\n'
printf ']]\n'


printf '[[blockquote\n'
printf '  [[styled-lines\n'

(for bug in `scripts/bug-list` ; do
  if grep '^[[:blank:]][[:blank:]]*status:' all-bugs/$bug.bug \
     | head -1 \
     | grep -q 'open' ; then
    status=open
  else
    status=closed
  fi

  statusdesc="$(grep '^[[:blank:]][[:blank:]]*status:' all-bugs/$bug.bug \
                | sed -e 's,[^:]*:[[:blank:]]*,,' \
                      -e 's,[[:blank:]]*$,,')"

  date=$(grep '^[[:blank:]][[:blank:]]*received:' all-bugs/$bug.bug \
         | head -1 \
         | sed -e 's,[^:]*:,,' -e 's,[[:blank:]]*,,g')

  update=$(grep '^[[:blank:]][[:blank:]]*last-update:' all-bugs/$bug.bug \
           | head -1 \
           | sed -e 's,[^:]*:,,' -e 's,[[:blank:]]*,,g')

  if test -z "$update" ; then
    update="$date"
  fi

  summary=$(grep '^[[:blank:]][[:blank:]]*summary:' all-bugs/$bug.bug \
         | head -1 \
         | sed -e 's,[^:]*:,,' -e 's,[[:blank:]]*$,,g')


  printf '%s    <"%s" -- ../all-bugs/%s.html>  *(%s)* rcvd: %s, updated: %s~*%s*\n' "$update" "$bug" "$bug" "$statusdesc" "$date" "$update" "$summary"
 done) \
| sort -r -k1 \
| sed -e 's,^....-..-..,,' \
      -e 's,~\(.*\),\
    \1\
,'

printf '  ]]\n'
printf ']]\n'

# arch-tag: Tom Lord Sat Feb 12 19:11:14 2005 (scripts/recent-updates)
