summaryrefslogtreecommitdiff
path: root/esummary
diff options
context:
space:
mode:
Diffstat (limited to 'esummary')
-rwxr-xr-xesummary45
1 files changed, 31 insertions, 14 deletions
diff --git a/esummary b/esummary
index 5c6fb54..6b35405 100755
--- a/esummary
+++ b/esummary
@@ -32,31 +32,50 @@
#
# ==========================================================================
-for x in "$@"
-do
- if [ "x$x" = "x-newmode" ]
- then
- USE_NEW_EDIRECT=1
- break
- fi
-done
-
pth=$( dirname "$0" )
+# conditionally execute original Perl implementation
+
PERL=""
+internal=no
+while [ "$#" -ne 0 ]
+do
+ case "$1" in
+ -internal )
+ internal=yes
+ shift
+ ;;
+ -newmode )
+ USE_NEW_EDIRECT=1
+ shift
+ ;;
+ -oldmode )
+ USE_NEW_EDIRECT=0
+ shift
+ ;;
+ * )
+ break
+ ;;
+ esac
+done
+if [ "$internal" = yes ]
+then
+ set _ -internal "$@"
+ shift
+fi
+
if [ ! -f "$pth"/ecommon.sh ]
then
USE_NEW_EDIRECT=false
fi
-# set PERL path if using old EDirect
-
case "${USE_NEW_EDIRECT}" in
"" | [FfNn]* | 0 | [Oo][Ff][Ff] )
+ # set PERL path if using old EDirect
PERL=perl
case "$( uname -s )" in
- CYGWIN_NT*)
+ CYGWIN_NT* )
# Use a negative match here because the shell treats 0 as success.
if perl -e 'exit $^O !~ /^MSWin/'; then
pth=$( cygpath -w "$pth" )
@@ -71,8 +90,6 @@ case "${USE_NEW_EDIRECT}" in
;;
esac
-# conditionally execute original Perl implementation
-
if [ -n "${PERL}" ]
then
exec "${PERL}" "$pth"/edirect.pl -fetch -format docsum "$@"