summaryrefslogtreecommitdiff
path: root/Master/bin/amd64-freebsd
diff options
context:
space:
mode:
Diffstat (limited to 'Master/bin/amd64-freebsd')
-rwxr-xr-xMaster/bin/amd64-freebsd/fmtutil217
1 files changed, 135 insertions, 82 deletions
diff --git a/Master/bin/amd64-freebsd/fmtutil b/Master/bin/amd64-freebsd/fmtutil
index f86a06003de..7297ac69b4b 100755
--- a/Master/bin/amd64-freebsd/fmtutil
+++ b/Master/bin/amd64-freebsd/fmtutil
@@ -1,39 +1,13 @@
#!/bin/sh
+# fmtutil - utility to maintain format files.
+# Public domain. Originally written by Thomas Esser.
-###############################################################################
-# fmtutil: utility to maintain format files.
-#
-# Thomas Esser, public domain.
-#
-# Commands:
-# --all recreate all format files
-# --missing create all missing format files
-# --refresh recreate only existing format files
-# --byfmt formatname (re)create format for `formatname'
-# --byhyphen hyphenfile (re)create formats that depend on `hyphenfile'
-# --enablefmt formatname enable formatname in config file
-# --disablefmt formatname disable formatname in config file
-# --listcfg list (enabled and disabled) configurations,
-# filtered to available formats
-# --catcfg output the content of the config file
-# --showhyphen formatname print name of hyphenfile for format `formatname'
-# --edit edit fmtutil.cnf file
-# --version show version info
-# --help show this message
-#
-# Options:
-# --cnffile file set configfile for fmtutil
-# --fmtdir directory set destination directory for format files
-# --no-engine-subdir don't use $engine subdirectory of the fmtdir
-###############################################################################
-
-###############################################################################
# program history:
# further changes in texk/tetex/ChangeLog.
# 2007-01-04 patch by JK to support $engine subdir (enabled by default)
# Fr Apr 8 19:15:05 CEST 2005 cleanup now has an argument for the return code
# Do Mar 02 10:42:31 CET 2006 add tmpdir to TEXFORMATS
-# So Mär 27 18:52:06 CEST 2005 honor $TMPDIR, $TEMP and $TMP, not just $TMP
+# So Ma 27 18:52:06 CEST 2005 honor $TMPDIR, $TEMP and $TMP, not just $TMP
# Sa Jan 15 18:13:46 CET 2005 avoid multiple variable assignments in one statement
# Di Jan 11 11:42:36 CET 2005 fix --byhyphen with relative hyphenfile
# Fr Dez 31 16:51:29 CET 2004 option catcfg added (for being called by texconfig)
@@ -84,8 +58,7 @@ test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
progname=fmtutil
argv0=$0
-version=1205513038 # seconds since `00:00:00 1970-01-01 UTC'
- # date '+%s' (with GNU date)
+version=20090815.0056
cnf=fmtutil.cnf # name of the config file
export PATH
@@ -104,6 +77,58 @@ cleanup()
}
###############################################################################
+# help() and version()
+# display help (or version) message and exit
+###############################################################################
+help()
+{
+ cat <<'eof'
+Usage: fmtutil [OPTION]... CMD [ARG]...
+
+Rebuild, manage, and otherwise manipulate TeX formats (and Metafont
+bases and MetaPost mems).
+
+Valid options:
+ --cnffile FILE
+ --fmtdir DIRECTORY
+ --no-engine-subdir don't use engine-specific subdir of the fmtdir
+ --quiet (not implemented, just for compatibility)
+ --test (not implemented, just for compatibility)
+ --dolinks (not implemented, just for compatibility)
+ --force (not implemented, just for compatibility)
+
+Valid commands:
+ --all recreate all format files
+ --missing create all missing format files
+ --refresh recreate only existing format files
+ --byengine ENGINENAME (re)create formats using ENGINENAME
+ --byfmt FORMATNAME (re)create format for FORMATNAME
+ --byhyphen HYPHENFILE (re)create formats that depend on HYPHENFILE
+ --enablefmt FORMATNAME enable formatname in config file
+ --disablefmt FORMATNAME disable formatname in config file
+ --listcfg list (enabled and disabled) configurations,
+ filtered to available formats
+ --catcfg output the content of the config file
+ --showhyphen FORMATNAME print name of hyphenfile for format FORMATNAME
+ --edit edit config file
+ --version show version info
+ --help show this message
+
+The config file is named fmtutil.cnf, and
+running kpsewhich fmtutil.cnf should show the active file.
+eof
+ cleanup 0
+}
+
+version()
+{
+ cat <<eof
+$progname version $version
+eof
+ cleanup 0
+}
+
+###############################################################################
# setupTmpDir()
# set up a temp directory and a trap to remove it
###############################################################################
@@ -191,51 +216,6 @@ cache_vars()
}
###############################################################################
-# help()
-# display help message and exit
-###############################################################################
-help()
-{
- cat <<'eof'
-Usage: fmtutil [option] ... cmd [argument]
-
-Valid options:
- --cnffile file
- --fmtdir directory
- --no-engine-subdir don't use engine-specific subdir of the fmtdir
- --quiet (not implemented, just for compatibility)
- --test (not implemented, just for compatibility)
- --dolinks (not implemented, just for compatibility)
- --force (not implemented, just for compatibility)
-
-Valid commands:
- --all recreate all format files
- --missing create all missing format files
- --refresh recreate only existing format files
- --byfmt formatname (re)create format for `formatname'
- --byhyphen hyphenfile (re)create formats that depend on `hyphenfile'
- --enablefmt formatname enable formatname in config file
- --disablefmt formatname disable formatname in config file
- --listcfg list (enabled and disabled) configurations,
- filtered to available formats
- --catcfg output the content of the config file
- --showhyphen formatname print name of hyphenfile for format `formatname'
- --edit edit fmtutil.cnf file
- --version show version info
- --help show this message
-eof
- cleanup 0
-}
-
-version()
-{
- cat <<eof
-$progname version $version.
-eof
- cleanup 0
-}
-
-###############################################################################
# abort(errmsg)
# print `errmsg' to stderr and exit with error code 1
###############################################################################
@@ -259,6 +239,23 @@ verboseMsg() {
###############################################################################
byebye()
{
+ if $has_warnings; then
+ {
+ cat <<eof
+
+###############################################################################
+$progname: Warning! Some warnings have been issued.
+Visit the log files in directory
+ $destdir
+for details.
+###############################################################################
+
+This is a summary of all \`warning' messages:
+$log_warning_msg
+eof
+ } >&2
+ fi
+
if $has_errors; then
{
cat <<eof
@@ -270,7 +267,7 @@ Visit the log files in directory
for details.
###############################################################################
-This is a summary of all \`failed' messages and warnings:
+This is a summary of all \`failed' messages:
$log_failure_msg
eof
} >&2
@@ -281,6 +278,16 @@ eof
}
###############################################################################
+# init_log_warning()
+# reset the list of warning messages
+###############################################################################
+init_log_warning()
+{
+ log_warning_msg=
+ has_warnings=false
+}
+
+###############################################################################
# init_log_failure()
# reset the list of failure messages
###############################################################################
@@ -291,6 +298,24 @@ init_log_failure()
}
###############################################################################
+# log_warning(errmsg)
+# report and save warning message `errmsg'
+###############################################################################
+log_warning()
+{
+ echo "Warning: $@" >&2
+ if test -z "$log_warning_msg"; then
+ log_warning_msg="$@"
+ else
+ OLDIFS=$IFS; IFS=
+ log_warning_msg="$log_warning_msg
+$@"
+ IFS=$OLDIFS
+ fi
+ has_warnings=true
+}
+
+###############################################################################
# log_failure(errmsg)
# report and save failure message `errmsg'
###############################################################################
@@ -410,6 +435,10 @@ main()
cmd=missing;;
--refresh|-r)
cmd=refresh;;
+ --byengine)
+ shift; cmd=byengine; arg=$1;;
+ --byengine=*)
+ cmd=byengine; arg=`echo "$1" | sed 's/--byengine=//'`; shift ;;
--byfmt|-f)
shift; cmd=byfmt; arg=$1;;
--byfmt=*)
@@ -547,6 +576,7 @@ main()
cache_vars
init_log_failure
+ init_log_warning
# execute the desired command:
case "$cmd" in
all)
@@ -555,6 +585,8 @@ main()
create_missing;;
refresh)
recreate_existing;;
+ byengine)
+ recreate_by_engine "$arg";;
byfmt)
recreate_by_fmt "$arg";;
byhyphen)
@@ -607,15 +639,16 @@ parse_line()
texargs="$@"
- eval lastarg=\$$#
- inifile=`echo $lastarg | sed 's%^\*%%'`
-
case "$engine" in
mpost) fmtfile="$format.mem"; kpsefmt=mp; texengine=metapost;;
mf|mfw|mf-nowin) fmtfile="$format.base"; kpsefmt=mf; texengine=metafont;;
*) fmtfile="$format.fmt"; kpsefmt=tex; texengine=$engine;;
esac
+ # remove any * for the sake of the kpsewhich lookup.
+ eval lastarg=\$$#
+ inifile=`echo $lastarg | sed 's%^\*%%'`
+
# See if we can find $inifile for return code:
kpsewhich -progname=$format -format=$kpsefmt $inifile >/dev/null 2>&1
}
@@ -705,7 +738,7 @@ run_initex()
mkdir -p "$fulldestdir"
if test -f $fmtfile; then
grep '^! ' $format.log >/dev/null 2>&1 &&
- log_failure "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' possibly failed."
+ log_warning "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' possibly failed."
# We don't want user-interaction for the following "mv" commands:
mv "$format.log" "$fulldestdir/$format.log" </dev/null
@@ -842,9 +875,29 @@ recreate_by_hyphenfile()
recreate_loop
# Now check if there was at least one match:
- getmatch || abort "no format depends on \`$hyphenfile'"
+ getmatch || abort "no format depends on hyphen file \`$hyphenfile'"
}
+###############################################################################
+# recreate_by_engine(enginename)
+# recreate all formats that are based on enginename
+###############################################################################
+recreate_by_engine()
+{
+ enginename=$1
+
+ match_cmd="test x\$engine = x$enginename"
+
+ # No match before the loop:
+ setmatch false
+
+ recreate_loop
+
+ # Now check if there was at least one match:
+ getmatch || abort "no format depends on engine \`$enginename'"
+}
+
+
###############################################################################
# show_hyphen_file(format)