#! /bin/sh

if [ ! -d .ugly ]
then
   echo "fail"
   exit 1
fi

cat .ugly/README.md.header 

#
# need mulle-markdown-utilities to generate this
#
n=0
for i in $*
do
  n=`expr $n + 1`
done 

i=0
for manpage in $*
do
   i=`expr $i + 1`
   if [ -f "$manpage" ]
   then
      echo "##" `basename $manpage .8` 
      /bin/echo -n "<pre>"
      nroff -man "$manpage" | col -b  
      /bin/echo "</pre>"
      if [ $i -lt $n ] 
      then
         echo "---"
      fi
   fi
done

cat .ugly/README.md.footer