Added command line options -help and -version

This commit is contained in:
Dan Moore 2021-07-26 08:51:50 -07:00
parent a332c23524
commit aabed04a2c
2 changed files with 20 additions and 1 deletions

View File

@ -4,6 +4,7 @@ SRCS = tclnetgen.c
include ${NETGENDIR}/defs.mak
VERSION := $(shell cat ../VERSION)
EXTRA_LIBS = ${MAIN_EXTRA_LIBS}
DFLAGS += -DNETGEN_DATE="\"`date`\""
@ -32,11 +33,12 @@ netgen.tcl: netgen.tcl.in
-e 's%SHDLIB_EXT%${SHDLIB_EXT}%g' \
netgen.tcl.in > netgen.tcl
netgen.sh: netgen.sh.in
netgen.sh: netgen.sh.in ../VERSION
sed -e 's%TCL_DIR%${TCLDIR}%g' \
-e 's%PY_DIR%${PYDIR}%g' \
-e 's%TCLLIB_DIR%${TCL_LIB_DIR}%g' \
-e 's%WISH_EXE%${WISH_EXE}%g' \
-e 's%=VERSION%=${VERSION}%' \
netgen.sh.in > netgen.sh
$(DESTDIR)${INSTALL_TCLDIR}/%: %

View File

@ -16,6 +16,7 @@ TKCON=true
BATCH=
GUI=
NETGEN_WISH=WISH_EXE
VERSION=VERSION
export NETGEN_WISH
# Hacks for Cygwin
@ -24,6 +25,20 @@ if [ ${TERM:=""} = "cygwin" ]; then
export DISPLAY=${DISPLAY:=":0"}
fi
usage() {
echo "Usage: netgen [-noconsole] [<command_line>]"
echo " netgen -batch <command_line>"
echo " netgen -gui"
echo " netgen [-help | -version]"
echo "Options:"
echo " -noconsole no console window, interpreter prompt will be in the terminal"
echo " -batch implies -noconsole, and exits after executing <command_line> argument"
echo " -gui runs the LVS manager"
echo " -help show help and exit"
echo " -version show version and exit"
exit 1
}
# Preserve quotes in arguments (thanks, Stackoverflow!)
arglist=''
for i in "$@" ; do
@ -31,6 +46,8 @@ for i in "$@" ; do
-noc*) TKCON=;;
-bat*) BATCH=true; TKCON=;;
-gui) GUI=true; TKCON=;;
-v | -version | --version) echo ${VERSION}; exit 1;;
-h | -help | --help) usage;;
*) arglist="$arglist${arglist:+ }\"${i//\"/\\\"}\"";;
esac
done