#! /bin/sh
set -e
PROG=`mktemp`
cat >$PROG <<EOF
#!/bin/sh
case \$1 in
--help) echo "Usage:  gap [OPTIONS] [FILES]";
        (cd ../..; ./gap -l . -h 2>&1) | tail -n +3;;
--version) echo -n "GAP - Groups, Algorithms and Programming ";
        (cd ../..; ./gap -l . -h 2>&1) | grep Version | sed -e "s/^.*Version/Version/";;
esac
EOF
chmod a+x $PROG
EXTRA=`mktemp`
cat >$EXTRA <<"EOF"
[description]
GAP is a system for computational discrete algebra, with particular emphasis
on Computational Group Theory. GAP provides a programming language, a library
of thousands of functions implementing algebraic algorithms written in the GAP
language as well as large data libraries of algebraic objects. GAP is used in
research and teaching for studying groups and their representations, rings,
vector spaces, algebras, combinatorial structures, and more.
[see also]
.I gac(1)
.I update-gap-workspace(1)
.P
You can read the complete manual in /usr/share/gap/doc or you can use the online help system. Type ?help inside GAP to access it.
Type 
.P
?Reference: options!under UNIX
.P
to access the full documentation of options.
.P
[authors]
The GAP Group <http://www.gap-system.org>
[copyright]
     Copyright (1988--2024) by its authors.

     GAP  is free software; you can redistribute it and/or modify it under
the  terms  of  the  GNU  General  Public  License as published by the Free
Software  Foundation;  either version 2 of the License, or (at your option)
any  later  version. 
EOF

help2man --source="The GAP team" -N $PROG --include=$EXTRA -n "Groups, Algorithms and Programming"
rm $PROG $EXTRA 
