#!/bin/bash
cat >changes.html <<EOF
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>grep - GNU Project - Free Software Foundation (FSF)</TITLE>
<LINK REV="made" HREF="mailto:webmasters@www.gnu.org">
<META NAME="keywords" CONTENT="grep">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#1F00FF" ALINK="#FF0000" VLINK="#9900DD">
<H3>grep</H3>
<A HREF="/graphics/agnuhead.html"><IMG SRC="/graphics/gnu-head-sm.jpg"
ALT=" [image of the Head of a GNU] "
WIDTH="129" HEIGHT="122"></A>
<CENTER>
  <A HREF="grep.html#introduction" NAME="TOCintroduction">Introduction</A>
| <A HREF="grep.html#downloading" NAME="TOCdownloading">Get the Software</A>
| <A HREF="doc/grep.html">View the documentation</A>
| <A HREF="changes.html">Changes between latest stable and alpha releases</A>
</CENTER>
<P>
<HR>
<h2>User-visible changes:</h2>
EOF
initial=1
ul_level=0
cat /usr/src/CVS/grep/NEWS |while true; do
	read foo
	if echo $foo |grep -q "^Version"; then
		if [ "$initial" = "1" ]; then
			initial=0
		else
			break
		fi
	elif echo $foo |grep -q "^-"; then
		if [ "$ul_level" = "0" ]; then
			echo "<ul>" >>changes.html
			ul_level=`expr $ul_level + 1`
		elif [ "$ul_level" -gt 1 ]; then
			for i in `seq 2 $ul_level`; do
				echo "</ul>" >>changes.html
				ul_level=`expr $ul_level - 1`
			done
		fi
		echo $foo |sed -e "s,- ,<li>," >>changes.html
	elif echo $foo |grep -q "^\."; then
		if [ "$ul_level" -lt 2 ]; then
			echo "<ul>" >>changes.html
			ul_level=`expr $ul_level + 1`
		fi
		echo $foo |sed -e "s,^\. ,<li>," >>changes.html
	elif [ -z "$foo" ]; then
		echo "</li>" >>changes.html
	else
		echo $foo >>changes.html
	fi
done
for i in `seq 0 $ul_level`; do
	echo "</ul>" >>changes.html
done
cat >>changes.html <<EOF
<br>
<h2>Detailed list of changes:</h2>
<tt><pre>
EOF
cat /usr/src/CVS/grep/ChangeLog >>changes.html
cat >>changes.html <<EOF
</tt></pre></body></html>
