#!/bin/sh
#
# Generate list of programs for manual. Treat non-module entries special.
#
PROGRAMS_TEX="manual/users.guide/programs.tex"
echo "Generate $PROGRAMS_TEX"
echo "% autogenerated file:  DO NOT edit" >$PROGRAMS_TEX
printf "\chapter{Programs}\n" >>$PROGRAMS_TEX
for file in `cd manual/users.guide/programs/; ls *.tex`
do
  file=`echo $file| sed -e 's/.tex//'`
  if [ -f "manual/users.guide/programs/$file.tex" ] ; then
    Descr=`grep -i '%%Descr' manual/users.guide/programs/$file.tex`
    if [ -n "$Descr" ] ; then
      echo '\\input {users.guide/programs/'$file'}' | sed -e 's/\\\\/\\/g' >>$PROGRAMS_TEX
    fi
  fi
done
echo '\\input {users.guide/programs/programs_extra}' | sed -e 's/\\\\/\\/g' >>$PROGRAMS_TEX
