MAJOR=4
MINOR=7
DEVNAME=tty7
 ("    #!/bin/sh
# $Id: texlinks.sh 53554 2020-01-26 23:58:37Z karl $

# Thomas Esser, 1999, 2002, 2003. public domain.

# texlinks: script to maintain symlinks from format to engine. Interprets
# the lines given in fmtutil.cnf.

# History:
#   (Further changes in ChangeLog.)
#   Tue Oct  9 14:23:01 BST 2007
#      Added unlink option (-u) to aid OpenBSD package uninstall
#      Edd Barrett <vext01@gmail.com>
#   Sun Aug 28 21:41:06 CEST 2005
#      remove special cases for csplain,cslatex,pdfcslatex,pdfcsplain
#   Fr Apr  8 19:15:05 CEST 2005
#      cleanup now has an argument for the return code
#   So Mar 27 18:52:06 CEST 2005
#       honor $TMPDIR, $TEMP and $TMP, not just $TMP
#   Mon May 10 20:52:48 CEST 2004
#       kpseaccess instead of access
#   Thu Dec 25 22:11:53 CET 2003, te:
#       add version string
#   Tue Apr  9 22:46:34 CEST 2002, te:
#       do not create symlinks for cont-??, metafun and mptopdf

test -f /bin/sh5 && test -z "$RUNNING_SH5" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
  && { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
unset RUNNING_SH5

test -f /bin/bsh && test -z "$RUNNING_BSH" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
  && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
unset RUNNING_BSH

export PATH

# hack around a bug in zsh:
test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'

version='$Id: texlinks.sh 53554 2020-01-26 23:58:37Z karl $'
progname=texlinks
cnf=fmtutil.cnf   # name of the config file

usage='Usage: texlinks [OPTION]... [DIRECTORY]...

Create symbolic links format -> engine according to fmtutil setup.

Mandatory arguments to long options are mandatory for short options too.
  -e, --exeext EXT     append EXT to symlink targets (default: none)
  -f, --cnffile FILE   use FILE as config file (default: fmtutil.cnf)
  -m, --multiplatform  operate in all platform specific directories
                        (default: operate only in directory for this platform)
  -q, --quiet          silently skip existing scripts / binaries
                        (default: issue warning)
  -s, --silent         same as -q
  -u, --unlink	       remove symlinks created by texlinks
  -v, --verbose        enable verbose messages (default: off)
  -h, --help           show this help text
  --version            show version string

The DIRECTORY arguments are an optional list of directories in which to
operate.  If no directories are specified and --multiplatform is
likewise not specified, the directory of this script itself is used.
With --multiplatform, all child dirs of an upper-level bin/ dir are used.

Report bugs to: tex-k@tug.org
TeX Live home page: <http://tug.org/texlive/>
'

# print `errmsg' to stderr and exit with error code 1:
abort() { errmsg "texlinks: $1."; cleanup 1; }

# error message to stderr:
errmsg() { echo "$@" >&2; }

# give message to stderr only if "verbose" mode is on:
verbose_echo() { $verbose && errmsg "$@"; }

# in verbose mode: show command that is executed:
verbose_do() { verbose_echo "$@"; "$@"; }

# clean up the temp area and exit with proper exit status:
cleanup()
{
  rc=$1
  $needsCleanup && test -n "$tmpdir" && test -d "$tmpdir" \
    && { rm -f "$tmpdir"/*; cd /; rmdir "$tmpdir"; }
  exit $rc
}

###############################################################################
# setupTmpDir()
#   set up a temp directory and a trap to remove it
###############################################################################
setupTmpDir()
{
  $needsCleanup && return

  trap 'cleanup 1' 1 2 3 7 13 15
  needsCleanup=true
  (umask 077; mkdir "$tmpdir") \
    || abort "could not create directory \`$tmpdir'"
}


# search a binary along $PATH:
check_for_binary()
{
  testbin=$1
  set x `echo "$PATH" | sed 's/^:/.:/; s/:$/:./; s/::/:.:/g; s/:/ /g'`; shift
  for i
  do
    if [ -x "$i/$testbin" ]; then
      echo "$i/$testbin"
      return 0
    fi
  done
  return 1
}


#######################################################################