#!/usr/bin/env sh man="$1" section="$2" if [ -z "$man" ] || [ -z "$section" ]; then echo "Usage: $0
" exit 1 fi file="man/man${section}/${man}.${section}" if [ -f "$file" ]; then echo "File $file already exists. Move it out of the way." exit 1 fi ( mdocdate=$(date "+%B %d %Y") uppercase=$(echo "$man" | tr '[:lower:]' '[:upper:]') echo ".Dd \$Mdocdate: February 16 2023 ${mdocdate} \$" echo ".Dt ${uppercase} ${section}" echo ".Os Telodendria Project" echo ".Sh NAME" echo ".Nm ${man}" echo ".Nd {SET DESCRIPTION HERE}" echo ".Sh SYNOPSIS" echo ".In ${man}.h" echo ".Sh DESCRIPTION" echo ".Sh RETURN VALUES" echo ".Sh SEE ALSO" ) > "$file" $EDITOR "$file"