Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command line options -help and -version #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tcltk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SRCS = tclnetgen.c

include ${NETGENDIR}/defs.mak

VERSION := $(shell cat ../VERSION)
EXTRA_LIBS = ${MAIN_EXTRA_LIBS}

DFLAGS += -DNETGEN_DATE="\"`date`\""
Expand Down Expand Up @@ -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}/%: %
Expand Down
17 changes: 17 additions & 0 deletions tcltk/netgen.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ TKCON=true
BATCH=
GUI=
NETGEN_WISH=WISH_EXE
VERSION=VERSION
export NETGEN_WISH

# Hacks for Cygwin
Expand All @@ -24,13 +25,29 @@ 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
case $i in
-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
Expand Down