@echo off
if "%1"=="" goto l4
if "%man.dir%"=="" goto l5
if "%2"=="" goto l2
if exist %1 goto l1
less -VQMei ++/%2 %man.dir%\%1.*
goto end
:l1
less -VQMei ++/%2 %1
goto end
:l2
if exist %1 goto l3
less -VQMei %man.dir%\%1.*
goto end
:l3
less -VQMei %1
goto end
:l4
echo show manual, usage: man progname [topic]
echo.
:l5
echo the environment variable `MAN.DIR' must
echo be set to indicate the manual directory
echo.
:end
