diff options
author | Karl Berry <karl@freefriends.org> | 2009-12-24 19:26:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-12-24 19:26:39 +0000 |
commit | ff50243846dfc599e894ee1d19f5eb4b1feba949 (patch) | |
tree | a8f41bf80735f0bbea9c2f081140ada987c95449 /Build | |
parent | 0a6c1f047b3e08d3fb3d4fc453180ec026491f9e (diff) |
use gawk for default awk only if it exists, else try awk
git-svn-id: svn://tug.org/texlive/trunk@16504 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/utils/tpic2pdftex/ChangeLog | 4 | ||||
-rwxr-xr-x | Build/source/utils/tpic2pdftex/tpic2pdftex | 55 |
2 files changed, 54 insertions, 5 deletions
diff --git a/Build/source/utils/tpic2pdftex/ChangeLog b/Build/source/utils/tpic2pdftex/ChangeLog index f5c2639cc13..73c2b9ee58d 100644 --- a/Build/source/utils/tpic2pdftex/ChangeLog +++ b/Build/source/utils/tpic2pdftex/ChangeLog @@ -1,3 +1,7 @@ +2009-12-24 Karl Berry <karl@tug.org> + + * tpic2pdftex: use gawk for default awk only if it exists. + 2009-12-11 Peter Breitenlohner <peb@mppmu.mpg.de> * tpic2pdftex.test: Ignore diffs in generated .tex files diff --git a/Build/source/utils/tpic2pdftex/tpic2pdftex b/Build/source/utils/tpic2pdftex/tpic2pdftex index 70c1a33c7e8..a264993e7e4 100755 --- a/Build/source/utils/tpic2pdftex/tpic2pdftex +++ b/Build/source/utils/tpic2pdftex/tpic2pdftex @@ -20,7 +20,7 @@ # Bounding box does not care for line thickness (groff pic feature). # Splines might be outside bounding box. # -# Copyright (C) 2002--2004 by Hartmut Henkel +# Copyright (C) 2002--2004, 2009 by Hartmut Henkel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,15 +33,14 @@ # See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA +# along with this program. If not, see <http://www.gnu.org/licenses/>. # # The author may be contacted via the e-mail address # # hartmut_henkel@gmx.de # # NEWS: + 24 Dec. 2009 - use gawk for default awk only if it exists. # 14 Jan. 2007 - make it executable shell script, calling awk # 16 Dec. 2004 - Replaced // {print} by {print} (some AWKs did choke) # 09 Apr. 2004 - Locale check: Decimal point in float numbers? @@ -65,7 +64,53 @@ # ######################################################################## -AWK=${AWK:-gawk} +# In case someone pedantic insists on using grep -E. +: ${EGREP=egrep}} + +# Systems which define $COMSPEC or $ComSpec use semicolons to separate +# directories in TEXINPUTS -- except for Cygwin et al., where COMSPEC +# might be inherited, but : is used. +if test -n "$COMSPEC$ComSpec" \ + && uname | $EGREP -iv 'cygwin|mingw|djgpp' >/dev/null; then + path_sep=";" +else + path_sep=":" +fi + +# findprog PROG +# ------------- +# Return true if PROG is somewhere in PATH, else false. +findprog () +{ + local saveIFS="$IFS" + IFS=$path_sep # break path components at the path separator + for dir in $PATH; do + IFS=$saveIFS + # The basic test for an executable is `test -f $f && test -x $f'. + # (`test -x' is not enough, because it can also be true for directories.) + # We have to try this both for $1 and $1.exe. + # + # Note: On Cygwin and DJGPP, `test -x' also looks for .exe. On Cygwin, + # also `test -f' has this enhancement, bot not on DJGPP. (Both are + # design decisions, so there is little chance to make them consistent.) + # Thusly, it seems to be difficult to make use of these enhancements. + # + if { test -f "$dir/$1" && test -x "$dir/$1"; } || + { test -f "$dir/$1.exe" && test -x "$dir/$1.exe"; }; then + return 0 + fi + done + return 1 +} + +if test -z "$AWK"; then # if set by user, leave it. + if findprog gawk; then + AWK=gawk + else + AWK=awk + fi +fi + export LANG="C" AWKPROG=' |