Imported Upstream version 4.0.19 upstream/4.0.19
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 14 Jan 2022 01:51:39 +0000 (10:51 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 14 Jan 2022 01:51:39 +0000 (10:51 +0900)
52 files changed:
NEWS
config.guess
config.sub
configure
configure-stamp [deleted file]
debian/changelog
debian/rules
file_name.c
floppyd.1
floppyd_installtest.1
mattrib.1
mbadblocks.1
mcat.1
mcd.1
mclasserase.1
mcopy.1
mdel.1
mdeltree.1
mdir.1
mdir.c
mdu.1
mformat.1
mformat.c
minfo.1
mk_direntry.c
mkmanifest.1
mlabel.1
mmd.1
mmount.1
mmove.1
mpartition.1
mpartition.c
mrd.1
mren.1
msdos.h
mshortname.1
mshowfat.1
mtools.1
mtools.5
mtools.info
mtools.spec
mtools.texi
mtools.tmpl.1
mtools.tmpl.5
mtoolstest.1
mtype.1
mzip.1
partition.h
patchlevel.c
texinfo.tex
version.texi
vfat.c

diff --git a/NEWS b/NEWS
index 5b7b371..535ed07 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+v4_0_19
+       - Fix for short file names starting with character 0xE5
+       (by remapping it to 0x5)
+       - mpartition: Partition types closer to what Microsoft uses
+       - mformat: figure out LBA geometry as last resort if geometry
+       is neither specified in config and/or commandline, nor can be
+       queried from the device
+       - mformat: use same default cluster size by size as Microsoft
+       for FAT32
+       - additional sanity checks
+       - document how cluster size is picked in mformat.c man page
+       - document how partition types are picked in mpartition.c man page
 v4_0_18        
        Fix for names of iconv encodings on AIX
        Fix mt_size_t on NetBSD
index e3a2116..2e9ad7f 100755 (executable)
@@ -1,14 +1,12 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-#   Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2009-06-10'
+timestamp='2016-10-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -17,26 +15,22 @@ timestamp='2009-06-10'
 # 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., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# Please send patches to <config-patches@gnu.org>.
+
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,8 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -139,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+       # If the system lacks a compiler, then just pick glibc.
+       # We could probably try harder.
+       LIBC=gnu
+
+       eval $set_cc_for_build
+       cat <<-EOF > $dummy.c
+       #include <features.h>
+       #if defined(__UCLIBC__)
+       LIBC=uclibc
+       #elif defined(__dietlibc__)
+       LIBC=dietlibc
+       #else
+       LIBC=gnu
+       #endif
+       EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+       ;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
        # NetBSD (nbsd) targets should (where applicable) match one or
-       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
        # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
        # switched to ELF, *-*-netbsd* would select the old
        # object file format.  This provides both forward
@@ -154,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        # Note: NetBSD doesn't particularly care about the vendor
        # portion of the name.  We always set it to "unknown".
        sysctl="sysctl -n hw.machine_arch"
-       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+           /sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || \
+           echo unknown)`
        case "${UNAME_MACHINE_ARCH}" in
            armeb) machine=armeb-unknown ;;
            arm*) machine=arm-unknown ;;
            sh3el) machine=shl-unknown ;;
            sh3eb) machine=sh-unknown ;;
            sh5el) machine=sh5le-unknown ;;
+           earmv*)
+               arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+               endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+               machine=${arch}${endian}-unknown
+               ;;
            *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
        esac
        # The Operating System including object format, if it has switched
-       # to ELF recently, or will in the future.
+       # to ELF recently (or will in the future) and ABI.
        case "${UNAME_MACHINE_ARCH}" in
+           earm*)
+               os=netbsdelf
+               ;;
            arm*|i386|m68k|ns32k|sh3*|sparc|vax)
                eval $set_cc_for_build
                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -180,7 +204,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                fi
                ;;
            *)
-               os=netbsd
+               os=netbsd
+               ;;
+       esac
+       # Determine ABI tags.
+       case "${UNAME_MACHINE_ARCH}" in
+           earm*)
+               expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+               abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
                ;;
        esac
        # The OS release
@@ -193,18 +224,26 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                release='-gnu'
                ;;
            *)
-               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
                ;;
        esac
        # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
        # contains redundant information, the shorter form:
        # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-       echo "${machine}-${os}${release}"
+       echo "${machine}-${os}${release}${abi}"
+       exit ;;
+    *:Bitrig:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
        exit ;;
     *:OpenBSD:*:*)
        UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
        echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
        exit ;;
+    *:LibertyBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+       exit ;;
     *:ekkoBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
        exit ;;
@@ -217,13 +256,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:MirBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
        exit ;;
+    *:Sortix:*:*)
+       echo ${UNAME_MACHINE}-unknown-sortix
+       exit ;;
     alpha:OSF1:*:*)
        case $UNAME_RELEASE in
        *4.0)
                UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
                ;;
        *5.*)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
                ;;
        esac
        # According to Compaq, /usr/sbin/psrinfo has been available on
@@ -233,43 +275,46 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
        case "$ALPHA_CPU_TYPE" in
            "EV4 (21064)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "EV4.5 (21064)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "LCA4 (21066/21068)")
-               UNAME_MACHINE="alpha" ;;
+               UNAME_MACHINE=alpha ;;
            "EV5 (21164)")
-               UNAME_MACHINE="alphaev5" ;;
+               UNAME_MACHINE=alphaev5 ;;
            "EV5.6 (21164A)")
-               UNAME_MACHINE="alphaev56" ;;
+               UNAME_MACHINE=alphaev56 ;;
            "EV5.6 (21164PC)")
-               UNAME_MACHINE="alphapca56" ;;
+               UNAME_MACHINE=alphapca56 ;;
            "EV5.7 (21164PC)")
-               UNAME_MACHINE="alphapca57" ;;
+               UNAME_MACHINE=alphapca57 ;;
            "EV6 (21264)")
-               UNAME_MACHINE="alphaev6" ;;
+               UNAME_MACHINE=alphaev6 ;;
            "EV6.7 (21264A)")
-               UNAME_MACHINE="alphaev67" ;;
+               UNAME_MACHINE=alphaev67 ;;
            "EV6.8CB (21264C)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.8AL (21264B)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.8CX (21264D)")
-               UNAME_MACHINE="alphaev68" ;;
+               UNAME_MACHINE=alphaev68 ;;
            "EV6.9A (21264/EV69A)")
-               UNAME_MACHINE="alphaev69" ;;
+               UNAME_MACHINE=alphaev69 ;;
            "EV7 (21364)")
-               UNAME_MACHINE="alphaev7" ;;
+               UNAME_MACHINE=alphaev7 ;;
            "EV7.9 (21364A)")
-               UNAME_MACHINE="alphaev79" ;;
+               UNAME_MACHINE=alphaev79 ;;
        esac
        # A Pn.n version is a patched version.
        # A Vn.n version is a released version.
        # A Tn.n version is a released field test version.
        # A Xn.n version is an unreleased experimental baselevel.
        # 1.2 uses "1.2" for uname -r.
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       exit ;;
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+       # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+       exitcode=$?
+       trap '' 0
+       exit $exitcode ;;
     Alpha\ *:Windows_NT*:*)
        # How do we know it's Interix rather than the generic POSIX subsystem?
        # Should we change UNAME_MACHINE based on the output of uname instead
@@ -295,12 +340,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        echo s390-ibm-zvmoe
        exit ;;
     *:OS400:*:*)
-        echo powerpc-ibm-os400
+       echo powerpc-ibm-os400
        exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
        exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
        echo arm-unknown-riscos
        exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -333,18 +378,21 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+       echo i386-pc-auroraux${UNAME_RELEASE}
+       exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
        eval $set_cc_for_build
-       SUN_ARCH="i386"
+       SUN_ARCH=i386
        # If there is a compiler, see if it is configured for 64-bit objects.
        # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
        # This test works for both compilers.
-       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+       if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
            if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
                grep IS_64BIT_ARCH >/dev/null
            then
-               SUN_ARCH="x86_64"
+               SUN_ARCH=x86_64
            fi
        fi
        echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -369,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        exit ;;
     sun*:*:4.2BSD:*)
        UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
        case "`/bin/arch`" in
            sun3)
                echo m68k-sun-sunos${UNAME_RELEASE}
@@ -391,23 +439,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+       echo m68k-atari-mint${UNAME_RELEASE}
        exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+       exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+       echo m68k-atari-mint${UNAME_RELEASE}
        exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+       echo m68k-milan-mint${UNAME_RELEASE}
+       exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+       echo m68k-hades-mint${UNAME_RELEASE}
+       exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
+       echo m68k-unknown-mint${UNAME_RELEASE}
+       exit ;;
     m68k:machten:*:*)
        echo m68k-apple-machten${UNAME_RELEASE}
        exit ;;
@@ -477,8 +525,8 @@ EOF
        echo m88k-motorola-sysv3
        exit ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
        if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
        then
            if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -491,7 +539,7 @@ EOF
        else
            echo i586-dg-dgux${UNAME_RELEASE}
        fi
-       exit ;;
+       exit ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
        echo m88k-dolphin-sysv3
        exit ;;
@@ -548,15 +596,16 @@ EOF
                echo rs6000-ibm-aix3.2
        fi
        exit ;;
-    *:AIX:*:[456])
+    *:AIX:*:[4567])
        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
        if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
                IBM_ARCH=rs6000
        else
                IBM_ARCH=powerpc
        fi
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
+       if [ -x /usr/bin/lslpp ] ; then
+               IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+                          awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
        else
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
@@ -591,58 +640,58 @@ EOF
            9000/[678][0-9][0-9])
                if [ -x /usr/bin/getconf ]; then
                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   case "${sc_cpu_version}" in
+                     523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
+                     532)                      # CPU_PA_RISC2_0
+                       case "${sc_kernel_bits}" in
+                         32) HP_ARCH=hppa2.0n ;;
+                         64) HP_ARCH=hppa2.0w ;;
+                         '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
+                       esac ;;
+                   esac
                fi
                if [ "${HP_ARCH}" = "" ]; then
                    eval $set_cc_for_build
-                   sed 's/^              //' << EOF >$dummy.c
+                   sed 's/^            //' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+               #include <unistd.h>
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+               int main ()
+               {
+               #if defined(_SC_KERNEL_BITS)
+                   long bits = sysconf(_SC_KERNEL_BITS);
+               #endif
+                   long cpu  = sysconf (_SC_CPU_VERSION);
 
-                  switch (cpu)
-               {
-               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-               case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-                   switch (bits)
-                       {
-                       case 64: puts ("hppa2.0w"); break;
-                       case 32: puts ("hppa2.0n"); break;
-                       default: puts ("hppa2.0"); break;
-                       } break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-                   puts ("hppa2.0"); break;
-              #endif
-               default: puts ("hppa1.0"); break;
-               }
-                  exit (0);
-              }
+                   switch (cpu)
+                       {
+                       case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+                       case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+                       case CPU_PA_RISC2_0:
+               #if defined(_SC_KERNEL_BITS)
+                           switch (bits)
+                               {
+                               case 64: puts ("hppa2.0w"); break;
+                               case 32: puts ("hppa2.0n"); break;
+                               default: puts ("hppa2.0"); break;
+                               } break;
+               #else  /* !defined(_SC_KERNEL_BITS) */
+                           puts ("hppa2.0"); break;
+               #endif
+                       default: puts ("hppa1.0"); break;
+                       }
+                   exit (0);
+               }
 EOF
-                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
                    test -z "$HP_ARCH" && HP_ARCH=hppa
                fi ;;
        esac
-       if [ ${HP_ARCH} = "hppa2.0w" ]
+       if [ ${HP_ARCH} = hppa2.0w ]
        then
            eval $set_cc_for_build
 
@@ -655,12 +704,12 @@ EOF
            # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
            # => hppa64-hp-hpux11.23
 
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+           if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
                grep -q __LP64__
            then
-               HP_ARCH="hppa2.0w"
+               HP_ARCH=hppa2.0w
            else
-               HP_ARCH="hppa64"
+               HP_ARCH=hppa64
            fi
        fi
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -727,22 +776,22 @@ EOF
        exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
        echo c1-convex-bsd
-        exit ;;
+       exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-        exit ;;
+       exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
        echo c34-convex-bsd
-        exit ;;
+       exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
        echo c38-convex-bsd
-        exit ;;
+       exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
        echo c4-convex-bsd
-        exit ;;
+       exit ;;
     CRAY*Y-MP:*:*:*)
        echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit ;;
@@ -765,15 +814,15 @@ EOF
        echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
+       FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+       echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
     5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+       echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
        exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
        echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -785,34 +834,39 @@ EOF
        echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
        exit ;;
     *:FreeBSD:*:*)
-       case ${UNAME_MACHINE} in
-           pc98)
-               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       case ${UNAME_PROCESSOR} in
            amd64)
                echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
            *)
-               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+               echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
        esac
        exit ;;
     i*:CYGWIN*:*)
        echo ${UNAME_MACHINE}-pc-cygwin
        exit ;;
+    *:MINGW64*:*)
+       echo ${UNAME_MACHINE}-pc-mingw64
+       exit ;;
     *:MINGW*:*)
        echo ${UNAME_MACHINE}-pc-mingw32
        exit ;;
+    *:MSYS*:*)
+       echo ${UNAME_MACHINE}-pc-msys
+       exit ;;
     i*:windows32*:*)
-       # uname -m includes "-pc" on this system.
-       echo ${UNAME_MACHINE}-mingw32
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
        exit ;;
     i*:PW*:*)
        echo ${UNAME_MACHINE}-pc-pw32
        exit ;;
-    *:Interix*:[3456]*)
-       case ${UNAME_MACHINE} in
+    *:Interix*:*)
+       case ${UNAME_MACHINE} in
            x86)
                echo i586-pc-interix${UNAME_RELEASE}
                exit ;;
-           EM64T | authenticamd | genuineintel)
+           authenticamd | genuineintel | EM64T)
                echo x86_64-unknown-interix${UNAME_RELEASE}
                exit ;;
            IA64)
@@ -845,45 +899,87 @@ EOF
        exit ;;
     *:GNU:*:*)
        # the GNU system
-       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
        exit ;;
     *:GNU/*:*:*)
        # other systems with GNU libc and userland
-       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
        exit ;;
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
        exit ;;
+    aarch64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    aarch64_be:Linux:*:*)
+       UNAME_MACHINE=aarch64_be
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+       esac
+       objdump --private-headers /bin/sh | grep -q ld.so.1
+       if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
     arm*:Linux:*:*)
        eval $set_cc_for_build
        if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
            | grep -q __ARM_EABI__
        then
-           echo ${UNAME_MACHINE}-unknown-linux-gnu
+           echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        else
-           echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+           if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+               | grep -q __ARM_PCS_VFP
+           then
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+           else
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+           fi
        fi
        exit ;;
     avr32*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     cris:Linux:*:*)
-       echo cris-axis-linux-gnu
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
        exit ;;
     crisv32:Linux:*:*)
-       echo crisv32-axis-linux-gnu
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+       exit ;;
+    e2k:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     frv:Linux:*:*)
-       echo frv-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    hexagon:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    i*86:Linux:*:*)
+       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
        exit ;;
     ia64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    k1om:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     m32r*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     m68*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
        eval $set_cc_for_build
@@ -901,123 +997,71 @@ EOF
        #endif
        #endif
 EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-           /^CPU/{
-               s: ::g
-               p
-           }'`"
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
        ;;
-    or32:Linux:*:*)
-       echo or32-unknown-linux-gnu
-       exit ;;
-    ppc:Linux:*:*)
-       echo powerpc-unknown-linux-gnu
+    mips64el:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
-    ppc64:Linux:*:*)
-       echo powerpc64-unknown-linux-gnu
+    openrisc*:Linux:*:*)
+       echo or1k-unknown-linux-${LIBC}
        exit ;;
-    alpha:Linux:*:*)
-       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-         EV5)   UNAME_MACHINE=alphaev5 ;;
-         EV56)  UNAME_MACHINE=alphaev56 ;;
-         PCA56) UNAME_MACHINE=alphapca56 ;;
-         PCA57) UNAME_MACHINE=alphapca56 ;;
-         EV6)   UNAME_MACHINE=alphaev6 ;;
-         EV67)  UNAME_MACHINE=alphaev67 ;;
-         EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-       objdump --private-headers /bin/sh | grep -q ld.so.1
-       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+    or32:Linux:*:* | or1k*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     padre:Linux:*:*)
-       echo sparc-unknown-linux-gnu
+       echo sparc-unknown-linux-${LIBC}
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-${LIBC}
        exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-         PA7*) echo hppa1.1-unknown-linux-gnu ;;
-         PA8*) echo hppa2.0-unknown-linux-gnu ;;
-         *)    echo hppa-unknown-linux-gnu ;;
+         PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+         PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+         *)    echo hppa-unknown-linux-${LIBC} ;;
        esac
        exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-${LIBC}
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-${LIBC}
+       exit ;;
+    ppc64le:Linux:*:*)
+       echo powerpc64le-unknown-linux-${LIBC}
+       exit ;;
+    ppcle:Linux:*:*)
+       echo powerpcle-unknown-linux-${LIBC}
+       exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-       echo ${UNAME_MACHINE}-ibm-linux
+       echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
        exit ;;
     sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     sh*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       exit ;;
+    tile*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
     vax:Linux:*:*)
-       echo ${UNAME_MACHINE}-dec-linux-gnu
+       echo ${UNAME_MACHINE}-dec-linux-${LIBC}
        exit ;;
     x86_64:Linux:*:*)
-       echo x86_64-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
        exit ;;
     xtensa*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
        exit ;;
-    i*86:Linux:*:*)
-       # The BFD linker knows what the default object file format is, so
-       # first see if it will tell us. cd to the root directory to prevent
-       # problems with other programs or directories called `ld' in the path.
-       # Set LC_ALL=C to ensure ld outputs messages in English.
-       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-                        | sed -ne '/supported targets:/!d
-                                   s/[         ][      ]*/ /g
-                                   s/.*supported targets: *//
-                                   s/ .*//
-                                   p'`
-        case "$ld_supported_targets" in
-         elf32-i386)
-               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-               ;;
-       esac
-       # Determine whether the default compiler is a.out or elf
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #include <features.h>
-       #ifdef __ELF__
-       # ifdef __GLIBC__
-       #  if __GLIBC__ >= 2
-       LIBC=gnu
-       #  else
-       LIBC=gnulibc1
-       #  endif
-       # else
-       LIBC=gnulibc1
-       # endif
-       #else
-       #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-       LIBC=gnu
-       #else
-       LIBC=gnuaout
-       #endif
-       #endif
-       #ifdef __dietlibc__
-       LIBC=dietlibc
-       #endif
-EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-           /^LIBC/{
-               s: ::g
-               p
-           }'`"
-       test x"${LIBC}" != x && {
-               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-               exit
-       }
-       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-       ;;
     i*86:DYNIX/ptx:4*:*)
        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
        # earlier versions are messed up and put the nodename in both
@@ -1025,11 +1069,11 @@ EOF
        echo i386-sequent-sysv4
        exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+       # Unixware is an offshoot of SVR4, but it has its own version
+       # number series starting with 2...
+       # I am not positive that other SVR4 systems won't match this,
        # I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+       # Use sysv4.2uw... so that sysv4* matches it.
        echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
        exit ;;
     i*86:OS/2:*:*)
@@ -1061,7 +1105,7 @@ EOF
        fi
        exit ;;
     i*86:*:5:[678]*)
-       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
        case `/bin/uname -X | grep "^Machine"` in
            *486*)           UNAME_MACHINE=i486 ;;
            *Pentium)        UNAME_MACHINE=i586 ;;
@@ -1089,13 +1133,13 @@ EOF
        exit ;;
     pc:*:*:*)
        # Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i586.
+       # uname -m prints for DJGPP always 'pc', but it prints nothing about
+       # the processor, so we play safe by assuming i586.
        # Note: whatever this is, it MUST be the same as what config.sub
-       # prints for the "djgpp" host, or else GDB configury will decide that
+       # prints for the "djgpp" host, or else GDB configure will decide that
        # this is a cross-build.
        echo i586-pc-msdosdjgpp
-        exit ;;
+       exit ;;
     Intel:Mach:3*:*)
        echo i386-pc-mach3
        exit ;;
@@ -1130,8 +1174,8 @@ EOF
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
          && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
        OS_REL='.3'
        test -r /etc/.relid \
@@ -1174,10 +1218,10 @@ EOF
                echo ns32k-sni-sysv
        fi
        exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
+    PENTIUM:*:4.0*:*)  # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                       # says <Richard.M.Bartel@ccMail.Census.GOV>
+       echo i586-unisys-sysv4
+       exit ;;
     *:UNIX_System_V:4*:FTX*)
        # From Gerald Hewes <hewes@openmarket.com>.
        # How about differentiating between stratus architectures? -djm
@@ -1203,11 +1247,11 @@ EOF
        exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
        if [ -d /usr/nec ]; then
-               echo mips-nec-sysv${UNAME_RELEASE}
+               echo mips-nec-sysv${UNAME_RELEASE}
        else
-               echo mips-unknown-sysv${UNAME_RELEASE}
+               echo mips-unknown-sysv${UNAME_RELEASE}
        fi
-        exit ;;
+       exit ;;
     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
        echo powerpc-be-beos
        exit ;;
@@ -1220,6 +1264,9 @@ EOF
     BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
        echo i586-pc-haiku
        exit ;;
+    x86_64:Haiku:*:*)
+       echo x86_64-unknown-haiku
+       exit ;;
     SX-4:SUPER-UX:*:*)
        echo sx4-nec-superux${UNAME_RELEASE}
        exit ;;
@@ -1238,6 +1285,9 @@ EOF
     SX-8R:SUPER-UX:*:*)
        echo sx8r-nec-superux${UNAME_RELEASE}
        exit ;;
+    SX-ACE:SUPER-UX:*:*)
+       echo sxace-nec-superux${UNAME_RELEASE}
+       exit ;;
     Power*:Rhapsody:*:*)
        echo powerpc-apple-rhapsody${UNAME_RELEASE}
        exit ;;
@@ -1246,14 +1296,36 @@ EOF
        exit ;;
     *:Darwin:*:*)
        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-       case $UNAME_PROCESSOR in
-           unknown) UNAME_PROCESSOR=powerpc ;;
-       esac
+       eval $set_cc_for_build
+       if test "$UNAME_PROCESSOR" = unknown ; then
+           UNAME_PROCESSOR=powerpc
+       fi
+       if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+           if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+               if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+                   grep IS_64BIT_ARCH >/dev/null
+               then
+                   case $UNAME_PROCESSOR in
+                       i386) UNAME_PROCESSOR=x86_64 ;;
+                       powerpc) UNAME_PROCESSOR=powerpc64 ;;
+                   esac
+               fi
+           fi
+       elif test "$UNAME_PROCESSOR" = i386 ; then
+           # Avoid executing cc on OS X 10.9, as it ships with a stub
+           # that puts up a graphical alert prompting to install
+           # developer tools.  Any system running Mac OS X 10.7 or
+           # later (Darwin 11 and later) is required to have a 64-bit
+           # processor. This is not true of the ARM version of Darwin
+           # that Apple uses in portable devices.
+           UNAME_PROCESSOR=x86_64
+       fi
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
        exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
        UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
+       if test "$UNAME_PROCESSOR" = x86; then
                UNAME_PROCESSOR=i386
                UNAME_MACHINE=pc
        fi
@@ -1262,7 +1334,10 @@ EOF
     *:QNX:*:4*)
        echo i386-pc-qnx
        exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NEO-?:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSE-*:NONSTOP_KERNEL:*:*)
        echo nse-tandem-nsk${UNAME_RELEASE}
        exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1281,7 +1356,7 @@ EOF
        # "uname -m" is not consistent, so use $cputype instead. 386
        # is converted to i386 for consistency with other x86
        # operating systems.
-       if test "$cputype" = "386"; then
+       if test "$cputype" = 386; then
            UNAME_MACHINE=i386
        else
            UNAME_MACHINE="$cputype"
@@ -1307,13 +1382,13 @@ EOF
        echo pdp10-unknown-its
        exit ;;
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
+       echo mips-sei-seiux${UNAME_RELEASE}
        exit ;;
     *:DragonFly:*:*)
        echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
        exit ;;
     *:*VMS:*:*)
-       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
        case "${UNAME_MACHINE}" in
            A*) echo alpha-dec-vms ; exit ;;
            I*) echo ia64-dec-vms ; exit ;;
@@ -1323,7 +1398,7 @@ EOF
        echo i386-pc-xenix
        exit ;;
     i*86:skyos:*:*)
-       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
        exit ;;
     i*86:rdos:*:*)
        echo ${UNAME_MACHINE}-pc-rdos
@@ -1331,174 +1406,28 @@ EOF
     i*86:AROS:*:*)
        echo ${UNAME_MACHINE}-pc-aros
        exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-         ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-       printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-       printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-       { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-       echo c1-convex-bsd
-       exit ;;
-    c2*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
+    x86_64:VMkernel:*:*)
+       echo ${UNAME_MACHINE}-unknown-esx
        exit ;;
-    c34*)
-       echo c34-convex-bsd
+    amd64:Isilon\ OneFS:*:*)
+       echo x86_64-unknown-onefs
        exit ;;
-    c38*)
-       echo c38-convex-bsd
-       exit ;;
-    c4*)
-       echo c4-convex-bsd
-       exit ;;
-    esac
-fi
+esac
 
 cat >&2 <<EOF
 $0: unable to guess system type
 
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
 
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
 
 config.guess timestamp = $timestamp
 
index eb0389a..dd2ca93 100755 (executable)
@@ -1,44 +1,40 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-#   Free Software Foundation, Inc.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
 
-timestamp='2009-06-11'
+timestamp='2016-11-04'
 
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  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., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -57,8 +53,7 @@ timestamp='2009-06-11'
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
 
 Canonicalize a configuration name.
 
@@ -72,8 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -120,13 +114,18 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+  kopensolaris*-gnu* | cloudabi*-eabi* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -149,12 +148,12 @@ case $os in
        -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple | -axis | -knuth | -cray)
+       -apple | -axis | -knuth | -cray | -microblaze*)
                os=
                basic_machine=$1
                ;;
-        -bluegene*)
-               os=-cnk
+       -bluegene*)
+               os=-cnk
                ;;
        -sim | -cisco | -oki | -wec | -winbond)
                os=
@@ -170,10 +169,10 @@ case $os in
                os=-chorusos
                basic_machine=$1
                ;;
-       -chorusrdb)
-               os=-chorusrdb
+       -chorusrdb)
+               os=-chorusrdb
                basic_machine=$1
-               ;;
+               ;;
        -hiux*)
                os=-hiuxwe2
                ;;
@@ -218,6 +217,12 @@ case $os in
        -isc*)
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
+       -lynx*178)
+               os=-lynxos178
+               ;;
+       -lynx*5)
+               os=-lynxos5
+               ;;
        -lynx*)
                os=-lynxos
                ;;
@@ -242,20 +247,29 @@ case $basic_machine in
        # Some are omitted here because they have special meanings below.
        1750a | 580 \
        | a29k \
+       | aarch64 | aarch64_be \
        | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
        | am33_2.0 \
-       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+       | arc | arceb \
+       | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+       | avr | avr32 \
+       | ba \
+       | be32 | be64 \
        | bfin \
-       | c4x | clipper \
+       | c4x | c8051 | clipper \
        | d10v | d30v | dlx | dsp16xx \
-       | fido | fr30 | frv \
+       | e2k | epiphany \
+       | fido | fr30 | frv | ft32 \
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | hexagon \
        | i370 | i860 | i960 | ia64 \
        | ip2k | iq2000 \
+       | k1om \
+       | le32 | le64 \
        | lm32 \
        | m32c | m32r | m32rle | m68000 | m68k | m88k \
-       | maxq | mb | microblaze | mcore | mep | metag \
+       | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
        | mips | mipsbe | mipseb | mipsel | mipsle \
        | mips16 \
        | mips64 | mips64el \
@@ -269,36 +283,56 @@ case $basic_machine in
        | mips64vr5900 | mips64vr5900el \
        | mipsisa32 | mipsisa32el \
        | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa32r6 | mipsisa32r6el \
        | mipsisa64 | mipsisa64el \
        | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64r6 | mipsisa64r6el \
        | mipsisa64sb1 | mipsisa64sb1el \
        | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipsr5900 | mipsr5900el \
        | mipstx39 | mipstx39el \
        | mn10200 | mn10300 \
        | moxie \
        | mt \
        | msp430 \
-       | nios | nios2 \
+       | nds32 | nds32le | nds32be \
+       | nios | nios2 | nios2eb | nios2el \
        | ns16k | ns32k \
-       | or32 \
+       | open8 | or1k | or1knd | or32 \
        | pdp10 | pdp11 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | powerpc | powerpc64 | powerpc64le | powerpcle \
+       | pru \
        | pyramid \
+       | riscv32 | riscv64 \
+       | rl78 | rx \
        | score \
-       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-       | spu | strongarm \
-       | tahoe | thumb | tic4x | tic80 | tron \
-       | v850 | v850e \
+       | spu \
+       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+       | ubicom32 \
+       | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+       | visium \
        | we32k \
-       | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | x86 | xc16x | xstormy16 | xtensa \
        | z8k | z80)
                basic_machine=$basic_machine-unknown
                ;;
-       m6811 | m68hc11 | m6812 | m68hc12)
-               # Motorola 68HC11/12.
+       c54x)
+               basic_machine=tic54x-unknown
+               ;;
+       c55x)
+               basic_machine=tic55x-unknown
+               ;;
+       c6x)
+               basic_machine=tic6x-unknown
+               ;;
+       leon|leon[3-9])
+               basic_machine=sparc-$basic_machine
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
                basic_machine=$basic_machine-unknown
                os=-none
                ;;
@@ -308,6 +342,21 @@ case $basic_machine in
                basic_machine=mt-unknown
                ;;
 
+       strongarm | thumb | xscale)
+               basic_machine=arm-unknown
+               ;;
+       xgate)
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       xscaleeb)
+               basic_machine=armeb-unknown
+               ;;
+
+       xscaleel)
+               basic_machine=armel-unknown
+               ;;
+
        # We use `pc' rather than `unknown'
        # because (1) that's what they normally are, and
        # (2) the word "unknown" tends to confuse beginning users.
@@ -322,25 +371,32 @@ case $basic_machine in
        # Recognize the basic CPU types with company name.
        580-* \
        | a29k-* \
+       | aarch64-* | aarch64_be-* \
        | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
        | avr-* | avr32-* \
+       | ba-* \
+       | be32-* | be64-* \
        | bfin-* | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-       | clipper-* | craynv-* | cydra-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* \
+       | c8051-* | clipper-* | craynv-* | cydra-* \
        | d10v-* | d30v-* | dlx-* \
-       | elxsi-* \
+       | e2k-* | elxsi-* \
        | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
        | h8300-* | h8500-* \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | hexagon-* \
        | i*86-* | i860-* | i960-* | ia64-* \
        | ip2k-* | iq2000-* \
+       | k1om-* \
+       | le32-* | le64-* \
        | lm32-* \
        | m32c-* | m32r-* | m32rle-* \
        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
        | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+       | microblaze-* | microblazeel-* \
        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
        | mips16-* \
        | mips64-* | mips64el-* \
@@ -354,32 +410,44 @@ case $basic_machine in
        | mips64vr5900-* | mips64vr5900el-* \
        | mipsisa32-* | mipsisa32el-* \
        | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa32r6-* | mipsisa32r6el-* \
        | mipsisa64-* | mipsisa64el-* \
        | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64r6-* | mipsisa64r6el-* \
        | mipsisa64sb1-* | mipsisa64sb1el-* \
        | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipsr5900-* | mipsr5900el-* \
        | mipstx39-* | mipstx39el-* \
        | mmix-* \
        | mt-* \
        | msp430-* \
-       | nios-* | nios2-* \
+       | nds32-* | nds32le-* | nds32be-* \
+       | nios-* | nios2-* | nios2eb-* | nios2el-* \
        | none-* | np1-* | ns16k-* | ns32k-* \
+       | open8-* \
+       | or1k*-* \
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+       | pru-* \
        | pyramid-* \
-       | romp-* | rs6000-* \
+       | riscv32-* | riscv64-* \
+       | rl78-* | romp-* | rs6000-* | rx-* \
        | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
        | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
        | sparclite-* \
-       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-       | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
+       | tahoe-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tile*-* \
        | tron-* \
-       | v850-* | v850e-* | vax-* \
+       | ubicom32-* \
+       | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+       | vax-* \
+       | visium-* \
        | we32k-* \
-       | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* \
        | xstormy16-* | xtensa*-* \
        | ymp-* \
        | z8k-* | z80-*)
@@ -404,7 +472,7 @@ case $basic_machine in
                basic_machine=a29k-amd
                os=-udi
                ;;
-       abacus)
+       abacus)
                basic_machine=abacus-unknown
                ;;
        adobe68k)
@@ -454,6 +522,9 @@ case $basic_machine in
                basic_machine=i386-pc
                os=-aros
                ;;
+       asmjs)
+               basic_machine=asmjs-unknown
+               ;;
        aux)
                basic_machine=m68k-apple
                os=-aux
@@ -474,11 +545,20 @@ case $basic_machine in
                basic_machine=powerpc-ibm
                os=-cnk
                ;;
+       c54x-*)
+               basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c55x-*)
+               basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c6x-*)
+               basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        c90)
                basic_machine=c90-cray
                os=-unicos
                ;;
-        cegcc)
+       cegcc)
                basic_machine=arm-unknown
                os=-cegcc
                ;;
@@ -510,7 +590,7 @@ case $basic_machine in
                basic_machine=craynv-cray
                os=-unicosmp
                ;;
-       cr16)
+       cr16 | cr16-*)
                basic_machine=cr16-unknown
                os=-elf
                ;;
@@ -565,6 +645,14 @@ case $basic_machine in
                basic_machine=m68k-bull
                os=-sysv3
                ;;
+       e500v[12])
+               basic_machine=powerpc-unknown
+               os=$os"spe"
+               ;;
+       e500v[12]-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=$os"spe"
+               ;;
        ebmon29k)
                basic_machine=a29k-amd
                os=-ebmon
@@ -668,7 +756,6 @@ case $basic_machine in
        i370-ibm* | ibm*)
                basic_machine=i370-ibm
                ;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
        i*86v32)
                basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
                os=-sysv32
@@ -707,6 +794,9 @@ case $basic_machine in
                basic_machine=m68k-isi
                os=-sysv
                ;;
+       leon-*|leon[3-9]-*)
+               basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+               ;;
        m68knommu)
                basic_machine=m68k-unknown
                os=-linux
@@ -726,8 +816,15 @@ case $basic_machine in
                basic_machine=ns32k-utek
                os=-sysv
                ;;
+       microblaze*)
+               basic_machine=microblaze-xilinx
+               ;;
+       mingw64)
+               basic_machine=x86_64-pc
+               os=-mingw64
+               ;;
        mingw32)
-               basic_machine=i386-pc
+               basic_machine=i686-pc
                os=-mingw32
                ;;
        mingw32ce)
@@ -755,6 +852,10 @@ case $basic_machine in
                basic_machine=powerpc-unknown
                os=-morphos
                ;;
+       moxiebox)
+               basic_machine=moxie-unknown
+               os=-moxiebox
+               ;;
        msdos)
                basic_machine=i386-pc
                os=-msdos
@@ -762,10 +863,18 @@ case $basic_machine in
        ms1-*)
                basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
                ;;
+       msys)
+               basic_machine=i686-pc
+               os=-msys
+               ;;
        mvs)
                basic_machine=i370-ibm
                os=-mvs
                ;;
+       nacl)
+               basic_machine=le32-unknown
+               os=-nacl
+               ;;
        ncr3000)
                basic_machine=i486-ncr
                os=-sysv4
@@ -830,6 +939,12 @@ case $basic_machine in
        np1)
                basic_machine=np1-gould
                ;;
+       neo-tandem)
+               basic_machine=neo-tandem
+               ;;
+       nse-tandem)
+               basic_machine=nse-tandem
+               ;;
        nsr-tandem)
                basic_machine=nsr-tandem
                ;;
@@ -912,11 +1027,12 @@ case $basic_machine in
                ;;
        power)  basic_machine=power-ibm
                ;;
-       ppc)    basic_machine=powerpc-unknown
+       ppc | ppcbe)    basic_machine=powerpc-unknown
                ;;
-       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+       ppc-* | ppcbe-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
+       ppcle | powerpclittle)
                basic_machine=powerpcle-unknown
                ;;
        ppcle-* | powerpclittle-*)
@@ -926,7 +1042,7 @@ case $basic_machine in
                ;;
        ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+       ppc64le | powerpc64little)
                basic_machine=powerpc64le-unknown
                ;;
        ppc64le-* | powerpc64little-*)
@@ -939,7 +1055,11 @@ case $basic_machine in
                basic_machine=i586-unknown
                os=-pw32
                ;;
-       rdos)
+       rdos | rdos64)
+               basic_machine=x86_64-pc
+               os=-rdos
+               ;;
+       rdos32)
                basic_machine=i386-pc
                os=-rdos
                ;;
@@ -1008,6 +1128,9 @@ case $basic_machine in
                basic_machine=i860-stratus
                os=-sysv4
                ;;
+       strongarm-* | thumb-*)
+               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        sun2)
                basic_machine=m68000-sun
                ;;
@@ -1064,20 +1187,8 @@ case $basic_machine in
                basic_machine=t90-cray
                os=-unicos
                ;;
-       tic54x | c54x*)
-               basic_machine=tic54x-unknown
-               os=-coff
-               ;;
-       tic55x | c55x*)
-               basic_machine=tic55x-unknown
-               os=-coff
-               ;;
-       tic6x | c6x*)
-               basic_machine=tic6x-unknown
-               os=-coff
-               ;;
        tile*)
-               basic_machine=tile-unknown
+               basic_machine=$basic_machine-unknown
                os=-linux-gnu
                ;;
        tx39)
@@ -1147,6 +1258,9 @@ case $basic_machine in
        xps | xps100)
                basic_machine=xps100-honeywell
                ;;
+       xscale-* | xscalee[bl]-*)
+               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               ;;
        ymp)
                basic_machine=ymp-cray
                os=-unicos
@@ -1244,9 +1358,12 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+       # First match some system type aliases
+       # that might get confused with valid system types.
        # -solaris* is a basic system type, with this one exception.
+       -auroraux)
+               os=-auroraux
+               ;;
        -solaris1 | -solaris1.*)
                os=`echo $os | sed -e 's|solaris1|sunos4|'`
                ;;
@@ -1268,29 +1385,31 @@ case $os in
        # -sysv* is not here because it comes later, after sysvr4.
        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
              | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
-             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-             | -kopensolaris* \
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* | -plan9* \
              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* | -aros* \
+             | -aos* | -aros* | -cloudabi* | -sortix* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
              | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-             | -openbsd* | -solidbsd* \
+             | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
              | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
              | -chorusos* | -chorusrdb* | -cegcc* \
-             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
-             | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+             | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
              | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
              | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+             | -onefs* | -tirtos* | -phoenix* | -fuchsia*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1329,7 +1448,7 @@ case $os in
        -opened*)
                os=-openedition
                ;;
-        -os400*)
+       -os400*)
                os=-os400
                ;;
        -wince*)
@@ -1378,7 +1497,7 @@ case $os in
        -sinix*)
                os=-sysv4
                ;;
-        -tpf*)
+       -tpf*)
                os=-tpf
                ;;
        -triton*)
@@ -1414,15 +1533,16 @@ case $os in
        -aros*)
                os=-aros
                ;;
-       -kaos*)
-               os=-kaos
-               ;;
        -zvmoe)
                os=-zvmoe
                ;;
        -dicos*)
                os=-dicos
                ;;
+       -nacl*)
+               ;;
+       -ios)
+               ;;
        -none)
                ;;
        *)
@@ -1445,10 +1565,10 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
+       score-*)
                os=-elf
                ;;
-        spu-*)
+       spu-*)
                os=-elf
                ;;
        *-acorn)
@@ -1460,8 +1580,23 @@ case $basic_machine in
        arm*-semi)
                os=-aout
                ;;
-        c4x-* | tic4x-*)
-               os=-coff
+       c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       c8051-*)
+               os=-elf
+               ;;
+       hexagon-*)
+               os=-elf
+               ;;
+       tic54x-*)
+               os=-coff
+               ;;
+       tic55x-*)
+               os=-coff
+               ;;
+       tic6x-*)
+               os=-coff
                ;;
        # This must come before the *-dec entry.
        pdp10-*)
@@ -1481,14 +1616,11 @@ case $basic_machine in
                ;;
        m68000-sun)
                os=-sunos3
-               # This also exists in the configure program, but was not the
-               # default.
-               # os=-sunos4
                ;;
        m68*-cisco)
                os=-aout
                ;;
-        mep-*)
+       mep-*)
                os=-elf
                ;;
        mips*-cisco)
@@ -1515,7 +1647,7 @@ case $basic_machine in
        *-ibm)
                os=-aix
                ;;
-       *-knuth)
+       *-knuth)
                os=-mmixware
                ;;
        *-wec)
index 1810eff..a942066 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,11 +1,9 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -212,21 +236,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-       # neutralization value for shells without unset; and this also
-       # works around shells that cannot unset nonexistent variables.
-       # Preserve -v and -x to the replacement shell.
-       BASH_ENV=/dev/null
-       ENV=/dev/null
-       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-       export CONFIG_SHELL
-       case $- in # ((((
-         *v*x* | *x*v* ) as_opts=-vx ;;
-         *v* ) as_opts=-v ;;
-         *x* ) as_opts=-x ;;
-         * ) as_opts= ;;
-       esac
-       exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -328,6 +356,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -449,6 +485,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -483,16 +523,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -504,28 +544,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-       test -d "$1/.";
-      else
-       case $1 in #(
-       -*)set "./$1";;
-       esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-       ???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -659,6 +679,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -737,6 +758,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -989,6 +1011,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1126,7 +1157,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir
+               libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1154,8 +1185,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1281,6 +1310,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1407,9 +1437,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 configure
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1682,7 +1712,7 @@ $as_echo "$ac_try_echo"; } >&5
         test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
         test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
+        test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1772,7 +1802,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1788,7 +1819,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1814,7 +1846,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1830,7 +1863,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1864,7 +1898,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2004,7 +2039,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2377,7 +2412,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2417,7 +2452,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2470,7 +2505,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2511,7 +2546,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -2569,7 +2604,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2613,7 +2648,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3059,8 +3094,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3300,7 +3334,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -3366,7 +3400,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -3522,7 +3556,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+       if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
          if test $ac_prog = install &&
            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
            # AIX install.  It has an incompatible calling convention.
@@ -3608,7 +3642,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_INSTALL_INFO="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3791,8 +3825,8 @@ else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#        define __EXTENSIONS__ 1
-         $ac_includes_default
+#         define __EXTENSIONS__ 1
+          $ac_includes_default
 int
 main ()
 {
@@ -3945,11 +3979,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -3966,8 +4000,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -3983,10 +4018,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -4547,11 +4582,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -4568,8 +4603,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -4585,10 +4621,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -6349,16 +6385,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -6418,28 +6454,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-       test -d "$1/.";
-      else
-       case $1 in #(
-       -*)set "./$1";;
-       esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-       ???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -6461,7 +6485,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -6523,10 +6547,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -6615,7 +6639,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
diff --git a/configure-stamp b/configure-stamp
deleted file mode 100644 (file)
index e69de29..0000000
index 6a90040..074a925 100644 (file)
@@ -1,3 +1,16 @@
+mtools (4.0.19) stable; urgency=low
+  * Fix for short file names starting with character 0xE5
+  (by remapping it to 0x5)
+  * mpartition: Partition types closer to what Microsoft uses
+  * mformat: figure out LBA geometry as last resort if geometry
+  * is neither specified in config and/or commandline, nor can be
+  * queried from the device
+  * mformat: use same default cluster size by size as Microsoft
+  for FAT32
+  * additional sanity checks
+  * document how cluster size is picked in mformat.c man page
+  * document how partition types are picked in mpartition.c man page
+ -- Alain Knaff <alain@knaff.lu>  Thu, 29 Sep 2018 12:00:00 +0200
 mtools (4.0.18) stable; urgency=low
   * Fix for names of iconv encodings on AIX
   * Fix mt_size_t on NetBSD
index aaaea24..196fb91 100755 (executable)
@@ -48,7 +48,6 @@ mtools: build install
        dh_installexamples -pmtools mtools.conf
        dh_installman
        dh_installinfo -pmtools mtools.info
-       dh_undocumented -pmtools mcheck.1 mcomp.1 mxtar.1
        dh_installchangelogs
        dh_strip
        dh_link -pmtools /usr/share/man/man5/mtools.5 /usr/share/man/man5/mtools.conf.5
index 963a137..3930226 100644 (file)
@@ -161,6 +161,8 @@ wchar_t *unix_name(doscp_t *dosCp,
        tname[8] = '\0';
        if ((s = strchr(tname, ' ')))
                *s = '\0';
+       if (tname[0] == '\x05')
+               tname[0] = '\xE5';
 
        if(!(Case & (BASECASE | EXTCASE)) && mtools_ignore_short_case)
                Case |= BASECASE | EXTCASE;
index 5c5edfb..9d1151c 100644 (file)
--- a/floppyd.1
+++ b/floppyd.1
@@ -1,5 +1,5 @@
 '\" t
-.TH floppyd 1 "09Jan13" mtools-4.0.18
+.TH floppyd 1 "29Sep18" mtools-4.0.19
 .SH Name
 floppyd - floppy daemon for remote access to floppy drive
 '\" t
index 80dac2c..e446561 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH floppyd_installtest 1 "09Jan13" mtools-4.0.18
+.TH floppyd_installtest 1 "29Sep18" mtools-4.0.19
 .SH Name
 floppyd_installtest - tests whether floppyd is installed and running
 '\" t
index 85acb64..5a25f6a 100644 (file)
--- a/mattrib.1
+++ b/mattrib.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mattrib 1 "09Jan13" mtools-4.0.18
+.TH mattrib 1 "29Sep18" mtools-4.0.19
 .SH Name
 mattrib - change MSDOS file attribute flags
 '\" t
index 3e66662..81dfae6 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mbadblocks 1 "09Jan13" mtools-4.0.18
+.TH mbadblocks 1 "29Sep18" mtools-4.0.19
 .SH Name
 mbadblocks - tests a floppy disk, and marks the bad blocks in the FAT
 '\" t
diff --git a/mcat.1 b/mcat.1
index 74a9f02..bf262fa 100644 (file)
--- a/mcat.1
+++ b/mcat.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mcat 1 "09Jan13" mtools-4.0.18
+.TH mcat 1 "29Sep18" mtools-4.0.19
 .SH Name
 mcat - dump raw disk image
 '\" t
diff --git a/mcd.1 b/mcd.1
index 6f7b935..1a69104 100644 (file)
--- a/mcd.1
+++ b/mcd.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mcd 1 "09Jan13" mtools-4.0.18
+.TH mcd 1 "29Sep18" mtools-4.0.19
 .SH Name
 mcd - change MSDOS directory
 '\" t
index 19dc9af..d0692ad 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mclasserase 1 "09Jan13" mtools-4.0.18
+.TH mclasserase 1 "29Sep18" mtools-4.0.19
 .SH Name
 mclasserase - erase memory cards
 '\" t
diff --git a/mcopy.1 b/mcopy.1
index 57347bc..f73715e 100644 (file)
--- a/mcopy.1
+++ b/mcopy.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mcopy 1 "09Jan13" mtools-4.0.18
+.TH mcopy 1 "29Sep18" mtools-4.0.19
 .SH Name
 mcopy - copy MSDOS files to/from Unix
 '\" t
diff --git a/mdel.1 b/mdel.1
index 10fec95..b0620f2 100644 (file)
--- a/mdel.1
+++ b/mdel.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mdel 1 "09Jan13" mtools-4.0.18
+.TH mdel 1 "29Sep18" mtools-4.0.19
 .SH Name
 mdel - delete an MSDOS file
 '\" t
index a436484..2a4a7e3 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mdeltree 1 "09Jan13" mtools-4.0.18
+.TH mdeltree 1 "29Sep18" mtools-4.0.19
 .SH Name
 mdeltree - recursively delete an MSDOS directory and its contents
 '\" t
diff --git a/mdir.1 b/mdir.1
index acdd9dd..71f334b 100644 (file)
--- a/mdir.1
+++ b/mdir.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mdir 1 "09Jan13" mtools-4.0.18
+.TH mdir 1 "29Sep18" mtools-4.0.19
 .SH Name
 mdir - display an MSDOS directory
 '\" t
diff --git a/mdir.c b/mdir.c
index 549e0e9..bbf1c31 100644 (file)
--- a/mdir.c
+++ b/mdir.c
@@ -398,7 +398,12 @@ static int list_file(direntry_t *entry, MainParam_t *mp UNUSEDP)
                        ext[i] = towlower(ext[i]);
        }
        ext[3] = '\0';
-       dos_to_wchar(cp, entry->dir.name, name, 8);
+       if (entry->dir.name[0] == '\x05') {
+               dos_to_wchar(cp, "\xE5", name, 1);
+               dos_to_wchar(cp, entry->dir.name+1, name+1, 7);
+       } else {
+               dos_to_wchar(cp, entry->dir.name, name, 8);
+       }
        if(Case & BASECASE){
                for(i=0; i<8;i++)
                        name[i] = towlower(name[i]);
diff --git a/mdu.1 b/mdu.1
index 7ead711..3504228 100644 (file)
--- a/mdu.1
+++ b/mdu.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mdu 1 "09Jan13" mtools-4.0.18
+.TH mdu 1 "29Sep18" mtools-4.0.19
 .SH Name
 mdu - display the amount of space occupied by an MSDOS directory
 '\" t
index fcd47a5..3bdd694 100644 (file)
--- a/mformat.1
+++ b/mformat.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mformat 1 "09Jan13" mtools-4.0.18
+.TH mformat 1 "29Sep18" mtools-4.0.19
 .SH Name
 mformat - add an MSDOS filesystem to a low-level formatted floppy disk
 '\" t
@@ -184,7 +184,9 @@ I can include the correct value in future versions of mtools.
 \&\fR\&\f(CWc\fR\ 
 Sets the size of a cluster (in sectors).  If this cluster size would
 generate a FAT that too big for its number of bits, mtools automatically
-increases the cluster size, until the FAT is small enough.
+increases the cluster size, until the FAT is small enough. If no
+cluster size is specified explicitly, mtools uses a default value as
+described in section ``Number of sectors per cluster'' below.
 .TP
 \&\fR\&\f(CWd\fR\ 
 Sets the number of FAT copies. Default is 2. This setting can also be
@@ -228,6 +230,41 @@ default.
 It doesn't record bad block information to the Fat, use
 \&\fR\&\f(CWmbadblocks\fR for that.
 .PP
+.SH Number\ of\ sectors\ per\ cluster
+.PP
+If the user indicates no cluster size, mformat figures out a default
+value for it.
+.PP
+For FAT32 it uses the following table to determine the number of
+sectors per cluster, depending on the total number of sectors on the
+filesystem.
+.PP
+more than 32*1024*1024*2: 64 sectors
+.br
+between 16*1024*1024*2 and 32*1024*1024*2: 32 sectors
+.br
+between 8*1024*1024*2 and 16*1024*1024*2: 16 sectors
+.br
+between 260*1024*2 and 81024*1024*2: 1 sectors
+.br
+.PP
+This is derived from information on page 20 of Microsoft's
+\&\fR\&\f(CWfatgen103\fR document, which currently can be found at the
+following address:
+.PP
+\&\fR\&\f(CWhttps://staff.washington.edu/dittrich/misc/fatgen103.pdf\fR
+.PP
+For FAT12 and FAT16, mformat uses an iterative approach, where it
+starts with a set value, which it doubles until it is able to fill up
+the disk using that cluster size and a number of cluster less than the
+maximum allowed.
+.PP
+The starting value is 1 for disks with one head or less than 2000
+sectors, and 2 for disks with more than one head, and more than 2000
+sectors.
+.PP
+The number of sectors per cluster cannot go beyond 128.
+.PP
 .SH See\ Also
 Mtools' texinfo doc
 .SH Viewing\ the\ texi\ doc
index 89b27a3..0df40b2 100644 (file)
--- a/mformat.c
+++ b/mformat.c
@@ -207,16 +207,16 @@ static int comp_fat_bits(Fs_t *Fs, int estimate,
  * According to Microsoft "Hardware White Paper", "Microsoft
  * Extensible Formware Initiative", "FAT32 File System Specification",
  * Version 1.03, December 6, 2000:
- * If (CountofClusters < 4085) {
+ * If (CountofClusters < 4085) { // 0x0ff5
  *  // Volume is FAT12
- * } else if (CountofClusters < 65525) {
+ * } else if (CountofClusters < 65525) { // 0xfff5
  *  // Volume is FAT16
  * } else {
  *  //Volume is FAT32
  * }
  *
- * This document can be found at the following URL
- * http://www.microsoft.com/hwdev/download/hardware/fatgen103.pdf
+ * This document can be found at the following URL:
+ * https://staff.washington.edu/dittrich/misc/fatgen103.pdf
  * The relevant passus is on page 15.
  *
  * Actually, experimentations with Windows NT 4 show that the
@@ -541,11 +541,23 @@ static void calc_cluster_size(struct Fs_t *Fs, unsigned long tot_sectors,
                                FAT_SIZE(16, Fs->sector_size, max_clusters);
                        break;
                case 32:
-                       Fs->cluster_size = 8;
-                       /* According to
-                        * http://support.microsoft.com/support/kb/articles/q154/9/97.asp
-                        * Micro$oft does not support FAT32 with less than 4K
+                       /*
+                          FAT32 cluster sizes for disks with 512 block size
+                          according to Microsoft specification fatgen103.doc:
+                       
+                          32.5 MB - 260 MB   cluster_size =  1
+                           260 MB -   8 GB   cluster_size =  8
+                             8 GB -  16 GB   cluster_size = 16
+                            16 GB -  32 GB   cluster_size = 32
+                            32 GB -   2 TB   cluster_size = 64
+                       
+                          Below calculation is generalized and does not depend
+                          on 512 block size.
                         */
+                       Fs->cluster_size = tot_sectors > 32*1024*1024*2 ? 64 :
+                                          tot_sectors > 16*1024*1024*2 ? 32 :
+                                          tot_sectors >  8*1024*1024*2 ? 16 :
+                                          tot_sectors >     260*1024*2 ? 8 : 1;
                        return;
                default:
                        fprintf(stderr,"Bad fat size\n");
@@ -680,15 +692,16 @@ static void calc_fs_parameters_32(unsigned long tot_sectors,
                boot->boot.descr = 0xf8;
        else
                boot->boot.descr = 0xf0;
-       if(!Fs->cluster_size)
-               /* According to
-                * http://www.microsoft.com/kb/articles/q154/9/97.htm,
-                * Micro$oft does not support FAT32 with less than 4K
-                */
-               Fs->cluster_size = 8;
 
+       if(!Fs->cluster_size)
+               calc_cluster_size(Fs, tot_sectors, 32);
        Fs->dir_len = 0;
        Fs->num_clus = tot_sectors / Fs->cluster_size;
+       /* Maximal number of clusters on FAT32 is 0xffffff6 */
+       if (Fs->num_clus > 0xffffff6) {
+               fprintf(stderr, "Too many clusters\n");
+               exit(1);
+       }
        set_fat32(Fs);
        calc_fat_size(Fs, tot_sectors);
        set_word(boot->boot.fatlen, 0);
@@ -719,8 +732,23 @@ static void usage(int ret)
 }
 
 #ifdef OS_linux
+static int get_sector_size(int fd, char *errmsg) {
+       int sec_size;
+       if (ioctl(fd, BLKSSZGET, &sec_size) != 0 || sec_size <= 0) {
+               sprintf(errmsg, "Could not get sector size of device (%s)",
+                       strerror(errno));
+               return -1;
+       }
+
+       /* Cap sector size at 4096 */
+       if(sec_size > 4096)
+               sec_size = 4096;
+       return sec_size;
+}
+
 static int get_block_geom(int fd, struct device *dev, char *errmsg) {
        struct hd_geometry geom;
+       int sec_size;
        long size;
        int heads=dev->heads;
        int sectors=dev->sectors;
@@ -738,6 +766,14 @@ static int get_block_geom(int fd, struct device *dev, char *errmsg) {
                return -1;
        }
 
+       sec_size = get_sector_size(fd, errmsg);
+       if(sec_size < 0)
+               return -1;
+       
+       dev->ssize = 0;
+       while (dev->ssize < 0x7F && (128 << dev->ssize) < sec_size)
+               dev->ssize++;
+
        if(!heads)
                heads = geom.heads;
        if(!sectors)
@@ -763,6 +799,92 @@ static int get_block_geom(int fd, struct device *dev, char *errmsg) {
 }
 #endif
 
+static int get_lba_geom(Stream_t *Direct, unsigned long tot_sectors, struct device *dev, char *errmsg) {
+       int sect_per_track;
+       unsigned long tracks;
+
+       /* if one value is already specified we do not want to overwrite it */
+       if (dev->heads || dev->sectors || dev->tracks) {
+               sprintf(errmsg, "Number of heads or sectors or tracks was already specified");
+               return -1;
+       }
+
+       if (!tot_sectors) {
+#ifdef OS_linux
+               int fd;
+               int sec_size;
+               long size;
+               struct MT_STAT stbuf;
+
+               fd = get_fd(Direct);
+               if (MT_FSTAT(fd, &stbuf) < 0) {
+                       sprintf(errmsg, "Could not stat file (%s)", strerror(errno));
+                       return -1;
+               }
+
+               if (S_ISBLK(stbuf.st_mode)) {
+                       if (ioctl(fd, BLKGETSIZE, &size) != 0) {
+                               sprintf(errmsg, "Could not get size of device (%s)",
+                                       strerror(errno));
+                               return -1;
+                       }
+                       sec_size = get_sector_size(fd, errmsg);
+                       if(sec_size < 0)
+                               return -1;
+
+                       if (!(dev->ssize & 0x80)) {
+                               dev->ssize = 0;
+                               while (dev->ssize < 0x7F && (128 << dev->ssize) < sec_size)
+                               dev->ssize++;
+                       }
+                       if ((dev->ssize & 0x7f) > 2)
+                               tot_sectors = size >> ((dev->ssize & 0x7f) - 2);
+                       else
+                               tot_sectors = size << (2 - (dev->ssize & 0x7f));
+               } else if (S_ISREG(stbuf.st_mode)) {
+                       tot_sectors = stbuf.st_size >> ((dev->ssize & 0x7f) + 7);
+               } else {
+                       sprintf(errmsg, "Could not get size of device (%s)",
+                               "No method available");
+                       return -1;
+               }
+#else
+               mt_size_t size;
+               GET_DATA(Direct, 0, &size, 0, 0);
+               if (size == 0) {
+                       sprintf(errmsg, "Could not get size of device (%s)",
+                               "No method available");
+                       return -1;
+               }
+               tot_sectors = size >> ((dev->ssize & 0x7f) + 7);
+#endif
+       }
+
+       dev->sectors = 63;
+
+       if (tot_sectors < 16*63*1024)
+               dev->heads = 16;
+       else if (tot_sectors < 32*63*1024)
+               dev->heads = 32;
+       else if (tot_sectors < 64*63*1024)
+               dev->heads = 64;
+       else if (tot_sectors < 128*63*1024)
+               dev->heads = 128;
+       else
+               dev->heads = 255;
+
+       sect_per_track = dev->heads * dev->sectors;
+       tracks = (tot_sectors + dev->hidden % sect_per_track) / sect_per_track;
+       if (tracks > 0xFFFFFFFF) {
+               sprintf(errmsg, "Device is too big, it has too many tracks");
+               return -1;
+       }
+
+       dev->tracks = tracks;
+
+       return 0;
+}
+
 void mformat(int argc, char **argv, int dummy)
 {
        int r; /* generic return value */
@@ -1115,21 +1237,29 @@ void mformat(int argc, char **argv, int dummy)
                                continue;
                        }
 
-                       if (S_ISBLK(stbuf.st_mode) &&
-                           get_block_geom(fd, &used_dev, errmsg) < 0)
-                               continue;
+                       if (S_ISBLK(stbuf.st_mode))
+                           /* If the following get_block_geom fails, do not 
+                            * continue to next drive description, but allow
+                            * get_lba_geom to kick in
+                            */
+                           get_block_geom(fd, &used_dev, errmsg);
                }
 #endif
 
-               /* no way to find out geometry */
                if ((!used_dev.tracks && !tot_sectors) ||
                     !used_dev.heads || !used_dev.sectors){
-                       sprintf(errmsg,
-                               "Unknown geometry "
-                               "(You must tell the complete geometry "
-                               "of the disk, \neither in /etc/mtools.conf or "
-                               "on the command line) ");
-                       continue;
+                       if (get_lba_geom(Fs.Direct, tot_sectors, &used_dev,
+                                        errmsg) < 0) {
+                               sprintf(errmsg, "%s: "
+                                       "Complete geometry of the disk "
+                                       "was not specified, \n"
+                                       "neither in /etc/mtools.conf nor "
+                                       "on the command line. \n"
+                                       "LBA Assist Translation for "
+                                       "calculating CHS geometry "
+                                       "of the disk failed.\n", argv[0]);
+                               continue;
+                       }
                }
 
 #if 0
@@ -1189,6 +1319,11 @@ void mformat(int argc, char **argv, int dummy)
        if(tot_sectors == 0) {
                unsigned long sect_per_track = used_dev.heads*used_dev.sectors;
                tot_sectors = used_dev.tracks*sect_per_track - used_dev.hidden%sect_per_track;
+               /* Number of sectors must fit into 32bit value */
+               if (tot_sectors > 0xFFFFFFFF) {
+                       fprintf(stderr, "Too few sectors\n");
+                       exit(1);
+               }
        }
 
        /* create the image file if needed */
@@ -1214,17 +1349,8 @@ void mformat(int argc, char **argv, int dummy)
                keepBoot = 1;
                close(fd);
        }
-       if(!keepBoot && !(used_dev.use_2m & 0x7f)) {
+       if(!keepBoot && !(used_dev.use_2m & 0x7f))
                memset(boot.characters, '\0', Fs.sector_size);
-               if(Fs.sector_size == 512 && !used_dev.partition) {
-                       /* install fake partition table pointing to itself */
-                       struct partition *partTable=(struct partition *)
-                               (&boot.bytes[0x1ae]);
-                       setBeginEnd(&partTable[1], 0,
-                                               used_dev.heads * used_dev.sectors * used_dev.tracks,
-                                               used_dev.heads, used_dev.sectors, 1, 0);
-               }
-       }
        set_dword(boot.boot.nhs, used_dev.hidden);
 
        Fs.Next = buf_init(Fs.Direct,
@@ -1243,6 +1369,19 @@ void mformat(int argc, char **argv, int dummy)
 
        used_dev.fat_bits = comp_fat_bits(&Fs,used_dev.fat_bits, tot_sectors, fat32);
 
+       if(!keepBoot && !(used_dev.use_2m & 0x7f)) {
+               if(!used_dev.partition) {
+                       /* install fake partition table pointing to itself */
+                       struct partition *partTable=(struct partition *)
+                               (&boot.bytes[0x1ae]);
+                       setBeginEnd(&partTable[1], 0,
+                                   used_dev.heads * used_dev.sectors *
+                                   used_dev.tracks,
+                                   used_dev.heads, used_dev.sectors, 1, 0,
+                                   used_dev.fat_bits);
+               }
+       }
+
        if(used_dev.fat_bits == 32) {
                Fs.primaryFat = 0;
                Fs.writeAllFats = 1;
diff --git a/minfo.1 b/minfo.1
index b8838b7..bea7f06 100644 (file)
--- a/minfo.1
+++ b/minfo.1
@@ -1,5 +1,5 @@
 '\" t
-.TH minfo 1 "09Jan13" mtools-4.0.18
+.TH minfo 1 "29Sep18" mtools-4.0.19
 .SH Name
 minfo - print the parameters of a MSDOS filesystem
 '\" t
index cba1846..a9b5a2c 100644 (file)
@@ -47,6 +47,8 @@ static __inline__ int convert_to_shortname(doscp_t *cp, ClashHandling_t *ch,
        /* Then do conversion to dn */
        ch->name_converter(cp, un, 0, &mangled, dn);
        dn->sentinel = '\0';
+       if (dn->base[0] == '\xE5')
+               dn->base[0] = '\x05';
        return mangled;
 }
 
index 7154116..a6b5a5a 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mkmanifest 1 "09Jan13" mtools-4.0.18
+.TH mkmanifest 1 "29Sep18" mtools-4.0.19
 .SH Name
 mkmanifest - makes list of file names and their DOS 8+3 equivalent
 '\" t
index 2f8db30..4f92705 100644 (file)
--- a/mlabel.1
+++ b/mlabel.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mlabel 1 "09Jan13" mtools-4.0.18
+.TH mlabel 1 "29Sep18" mtools-4.0.19
 .SH Name
 mlabel - make an MSDOS volume label
 '\" t
diff --git a/mmd.1 b/mmd.1
index 8b65fd9..d901e15 100644 (file)
--- a/mmd.1
+++ b/mmd.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mmd 1 "09Jan13" mtools-4.0.18
+.TH mmd 1 "29Sep18" mtools-4.0.19
 .SH Name
 mmd - make an MSDOS subdirectory
 '\" t
index d232cb4..2673fb2 100644 (file)
--- a/mmount.1
+++ b/mmount.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mmount 1 "09Jan13" mtools-4.0.18
+.TH mmount 1 "29Sep18" mtools-4.0.19
 .SH Name
 mmount - mount an MSDOS disk
 '\" t
diff --git a/mmove.1 b/mmove.1
index 65a49af..b4214ee 100644 (file)
--- a/mmove.1
+++ b/mmove.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mmove 1 "09Jan13" mtools-4.0.18
+.TH mmove 1 "29Sep18" mtools-4.0.19
 .SH Name
 mmove - move or rename an MSDOS file or subdirectory
 '\" t
index 1796fc8..b3f1c16 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mpartition 1 "09Jan13" mtools-4.0.18
+.TH mpartition 1 "29Sep18" mtools-4.0.19
 .SH Name
 mpartition - partition an MSDOS hard disk
 '\" t
@@ -122,6 +122,48 @@ The following option is available for partition table initialization:
 \&\fR\&\f(CWB\ \fIbootSector\fR\&\f(CW\fR\ 
 Reads the template master boot record from file \fIbootSector\fR.
 .PP
+.SH Choice\ of\ partition\ type
+.PP
+Mpartition proceeds as follows to pick a type for the partition:
+.TP
+-\ \ 
+FAT32 partitions are assigned type 0x0C (``\fR\&\f(CWWin95 FAT32, LBA\fR'')
+.TP
+-\ \ 
+For all others, if the partition fits entirely within the 65536 sector of the disk, assign 0x01 (``\fR\&\f(CWDOS FAT12, CHS\fR'') for FAT12 partition and 0x04 (``\fR\&\f(CWDOS FAT16, CHS\fR'') for FAT16 partitions
+.TP
+-\ \ 
+If not covered by the above, assign 0x06 (``\fR\&\f(CWDOS BIG FAT16 CHS\fR'') if partition fits entirely within the first 1024 cylinders (CHS mode)
+.TP
+-\ \ 
+All remaining cases get 0x0E (``\fR\&\f(CWWin95 BIG FAT16, LBA\fR'')
+.PP
+If number of fat bits is not known (not specified in drive's
+definition), then FAT12 is assumed for all drives with less than 4096
+sectors, and FAT16 for those with more than 4096 sectors.
+.PP
+This corresponds more or less to the definitions outlined at \fR\&\f(CWhttps://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs\fR
+and
+\&\fR\&\f(CWhttps://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc977219(v=technet.10)\fR,
+with two notable differences:
+.TP
+-\ \ 
+If fat bits are unknown, the reference documents consider drives with
+less than 32680 sectors to be FAT12. Mtools uses 4096 sectors as the
+cutoff point, as older versions of DOS only support FAT12 on disks
+with less than 4096 sectors (and these older versions are the ones
+which would be most likely to use FAT12 in the first place).
+.TP
+-\ \ 
+The reference documents use a 8GB (wikipedia) or a 4GB (Microsoft)
+cutoff between 0x06 (\fR\&\f(CWDOS BIG FAT16 CHS\fR) and 0x0E. Mtools uses
+1024 cylinders. This is because any partition beyond 1024 cylinders
+must be LBA and cannot be CHS. 8GB works out to be the biggest
+capacity which can be represented as CHS (63 sectors, 255 heads and
+1024 cylinders). 4GB is the capacity limit for windows 2000, so it
+makes sense that a documentation for windows 2000 would specify this
+as the upper limit for any partition type.
+.PP
 .SH See\ Also
 Mtools' texinfo doc
 .SH Viewing\ the\ texi\ doc
index 24ac840..eeded93 100644 (file)
@@ -46,7 +46,7 @@
 
 static __inline__ void print_hsc(hsc *h)
 {
-       printf(" h=%d s=%d c=%d\n", 
+       printf(" h=%d s=%d c=%d\n",
               head(*h), sector(*h), cyl(*h));
 }
 
@@ -70,8 +70,10 @@ static void set_offset(hsc *h, int offset, int heads, int sectors)
        h->cyl = cyl & 0xff;
 }
 
-void setBeginEnd(struct partition *partTable, int begin, int end,
-                int heads, int sectors, int activate, int type)
+void setBeginEnd(struct partition *partTable,
+                unsigned int begin, unsigned int end,
+                unsigned int heads, unsigned int sectors,
+                int activate, int type, int fat_bits)
 {
        set_offset(&partTable->start, begin, heads, sectors);
        set_offset(&partTable->end, end-1, heads, sectors);
@@ -82,24 +84,67 @@ void setBeginEnd(struct partition *partTable, int begin, int end,
        else
                partTable->boot_ind = 0;
        if(!type) {
-               if(end-begin < 4096)
-                       type = 1; /* DOS 12-bit FAT */
-               else if(end-begin<32*2048)
-                       type = 4; /* DOS 16-bit FAT, <32M */
+               if (fat_bits == 0) {
+                       /**
+                        * Fat bits unknown / not specified. We look
+                        * at size to get a rough estimate what FAT
+                        * bits are used.  Note: this is only an
+                        * estimate, the precise calculation would
+                        * involve the number of clusters, which is
+                        * not necessarily known here.
+                        */
+                       /* cc977219 would have a cutoff number of 32680,
+                        * corresponding to a FAT12 partition with 4K
+                        * clusters, however other information hints that
+                        * only partitions with less than 4096 sectors are
+                        * considered */
+                       if(end-begin < 4096)
+                               fat_bits = 12;
+                       else
+                               fat_bits = 16;
+               }
+
+               /* Description of various partition types in
+                * https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs
+                * and
+                * https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc977219(v=technet.10)
+                */
+               if (fat_bits == 32)
+                       /* FAT 32 partition. For now, we disregard the
+                        * possibility of FAT 32 CHS partitions */
+                       type = 0x0C; /* Win95 FAT32, LBA */
+               else if (end < 65536) {
+                       /* FAT 12 or FAT 16 partitions which fit entirely below
+                          the 32M mark */
+                       /* The 32M restriction doesn't apply to logical
+                          partitions within an extended partition, but for the
+                          moment mpartition only makes primary partitions */
+                       if(fat_bits == 12)
+                               /* FAT 12 partition */
+                               type = 0x01; /* DOS FAT12, CHS */
+                       else if (fat_bits == 16)
+                               /* FAT 16 partition */
+                               type = 0x04; /* DOS FAT16, CHS */
+               } else if (end <  sectors * heads * 1024)
+                       /* FAT 12 or FAT16 partition above the 32M
+                        * mark but below the 1024 cylinder mark.
+                        * Indeed, there can be no CHS partition
+                        * beyond 1024 cylinders */
+                       type = 0x06; /* DOS BIG FAT16 or FAT12, CHS */
                else
-                       type = 6; /* DOS 16-bit FAT >= 32M */
+                       type = 0x0E; /* Win95 BIG FAT16, LBA */
        }
        partTable->sys_ind = type;
 }
 
 int consistencyCheck(struct partition *partTable, int doprint, int verbose,
                     int *has_activated, unsigned int *last_end,
-                    unsigned int *j, 
+                    unsigned int *j,
                     struct device *used_dev, int target_partition)
 {
        unsigned int i;
        unsigned int inconsistency;
-       
+
        *j = 0;
        *last_end = 1;
 
@@ -111,7 +156,7 @@ int consistencyCheck(struct partition *partTable, int doprint, int verbose,
                        continue;
                if(partTable[i].boot_ind)
                        (*has_activated)++;
-               if((used_dev && 
+               if((used_dev &&
                    (used_dev->heads != head(partTable[i].end)+1 ||
                     used_dev->sectors != sector(partTable[i].end))) ||
                   sector(partTable[i].start) != 1){
@@ -120,15 +165,15 @@ int consistencyCheck(struct partition *partTable, int doprint, int verbose,
                                i);
                        inconsistency=1;
                }
-               
-               if(*j && 
+
+               if(*j &&
                   *last_end > BEGIN(partTable[i])) {
                        fprintf(stderr,
                                "Partitions %d and %d badly ordered or overlapping\n",
                                *j,i);
                        inconsistency=1;
                }
-                       
+
                *last_end = END(partTable[i]);
                *j = i;
 
@@ -194,7 +239,7 @@ int consistencyCheck(struct partition *partTable, int doprint, int verbose,
  * Information technology -
  * SCSI-2 Common access method
  * transport and SCSI interface module
- * 
+ *
  * ANNEX A :
  *
  * setsize() converts a read capacity value to int 13h
@@ -204,37 +249,37 @@ int consistencyCheck(struct partition *partTable, int doprint, int verbose,
  * will not fit in 4 bits (or 6 bits). This algorithm also
  * minimizes the number of sectors that will be unused at the end
  * of the disk while allowing for very large disks to be
- * accommodated. This algorithm does not use physical geometry. 
+ * accommodated. This algorithm does not use physical geometry.
  */
 
 static int setsize(unsigned long capacity,unsigned int *cyls,unsigned int *hds,
-    unsigned int *secs) { 
-    unsigned int rv = 0; 
-    unsigned long heads, sectors, cylinders, temp; 
+    unsigned int *secs) {
+    unsigned int rv = 0;
+    unsigned long heads, sectors, cylinders, temp;
 
-    cylinders = 1024L;                 /* Set number of cylinders to max */ 
-    sectors = 62L;                     /* Maximize sectors per track */ 
+    cylinders = 1024L;                 /* Set number of cylinders to max */
+    sectors = 62L;                     /* Maximize sectors per track */
 
-    temp = cylinders * sectors;                /* Compute divisor for heads */ 
+    temp = cylinders * sectors;                /* Compute divisor for heads */
     heads = capacity / temp;           /* Compute value for number of heads */
-    if (capacity % temp) {             /* If no remainder, done! */ 
-       heads++;                        /* Else, increment number of heads */ 
-       temp = cylinders * heads;       /* Compute divisor for sectors */ 
+    if (capacity % temp) {             /* If no remainder, done! */
+       heads++;                        /* Else, increment number of heads */
+       temp = cylinders * heads;       /* Compute divisor for sectors */
        sectors = capacity / temp;      /* Compute value for sectors per
-                                              track */ 
-       if (capacity % temp) {          /* If no remainder, done! */ 
-           sectors++;                  /* Else, increment number of sectors */ 
+                                              track */
+       if (capacity % temp) {          /* If no remainder, done! */
+           sectors++;                  /* Else, increment number of sectors */
            temp = heads * sectors;     /* Compute divisor for cylinders */
-           cylinders = capacity / temp;/* Compute number of cylinders */ 
-       } 
-    } 
-    if (cylinders == 0) rv=(unsigned)-1;/* Give error if 0 cylinders */ 
-
-    *cyls = (unsigned int) cylinders;  /* Stuff return values */ 
-    *secs = (unsigned int) sectors; 
-    *hds  = (unsigned int) heads; 
-    return(rv); 
-} 
+           cylinders = capacity / temp;/* Compute number of cylinders */
+       }
+    }
+    if (cylinders == 0) rv=(unsigned)-1;/* Give error if 0 cylinders */
+
+    *cyls = (unsigned int) cylinders;  /* Stuff return values */
+    *secs = (unsigned int) sectors;
+    *hds  = (unsigned int) heads;
+    return(rv);
+}
 
 static void setsize0(unsigned long capacity,unsigned int *cyls,
                     unsigned int *hds, unsigned int *secs)
@@ -264,9 +309,9 @@ static void setsize0(unsigned long capacity,unsigned int *cyls,
 static void usage(int ret) NORETURN;
 static void usage(int ret)
 {
-       fprintf(stderr, 
+       fprintf(stderr,
                "Mtools version %s, dated %s\n", mversion, mdate);
-       fprintf(stderr, 
+       fprintf(stderr,
                "Usage: %s [-pradcv] [-I] [-B bootsect-template] [-s sectors] "
                        "[-t cylinders] "
                "[-h heads] [-T type] [-b begin] [-l length] "
@@ -286,7 +331,7 @@ void mpartition(int argc, char **argv, int dummy)
        int verbose = 0;
        int create = 0;
        int force = 0;
-       int length = 0;
+       unsigned int length = 0;
        int do_remove = 0;
        int initialize = 0;
        unsigned int tot_sectors=0;
@@ -298,12 +343,12 @@ void mpartition(int argc, char **argv, int dummy)
        int activate = 0;
        int has_activated = 0;
        int inconsistency=0;
-       int begin=0;
-       int end=0;
+       unsigned int begin=0;
+       unsigned int end=0;
        int sizetest=0;
        int dirty = 0;
        int open2flags = NO_OFFSET;
-       
+
        int c;
        struct device used_dev;
        int argtracks, argheads, argsectors;
@@ -350,7 +395,7 @@ void mpartition(int argc, char **argv, int dummy)
                                dirty = 1;
                                break;
                        case 'I':
-                               /* could be abused to nuke all other 
+                               /* could be abused to nuke all other
                                 * partitions */
                                open2flags |= NO_PRIV;
                                initialize = 1;
@@ -399,11 +444,11 @@ void mpartition(int argc, char **argv, int dummy)
                                break;
                        case 'b':
                                begin_set = 1;
-                               begin = atoi(optarg);
+                               begin = strtoul(optarg, NULL, 10);
                                break;
                        case 'l':
                                size_set = 1;
-                               length = atoi(optarg);
+                               length = strtoul(optarg, NULL, 10);
                                break;
 
                        default:
@@ -414,10 +459,10 @@ void mpartition(int argc, char **argv, int dummy)
        if (argc - optind != 1 ||
            !argv[optind][0] || argv[optind][1] != ':')
                usage(1);
-       
+
        drive = toupper(argv[optind][0]);
 
-       /* check out a drive whose letter and parameters match */       
+       /* check out a drive whose letter and parameters match */
        sprintf(errmsg, "Drive '%c:' not supported", drive);
        Stream = 0;
        for(dev=devices;dev->drive;dev++) {
@@ -428,8 +473,8 @@ void mpartition(int argc, char **argv, int dummy)
                if (dev->drive != drive)
                        continue;
                if (dev->partition < 1 || dev->partition > 4) {
-                       sprintf(errmsg, 
-                               "Drive '%c:' is not a partition", 
+                       sprintf(errmsg,
+                               "Drive '%c:' is not a partition",
                                drive);
                        continue;
                }
@@ -438,7 +483,7 @@ void mpartition(int argc, char **argv, int dummy)
                SET_INT(used_dev.tracks, argtracks);
                SET_INT(used_dev.heads, argheads);
                SET_INT(used_dev.sectors, argsectors);
-               
+
                expand(dev->name, name);
 
                mode = dirty ? O_RDWR : O_RDONLY;
@@ -448,7 +493,7 @@ void mpartition(int argc, char **argv, int dummy)
 #ifdef USING_NEW_VOLD
                strcpy(name, getVoldName(dev, name));
 #endif
-               Stream = SimpleFileOpen(&used_dev, dev, name, mode, 
+               Stream = SimpleFileOpen(&used_dev, dev, name, mode,
                                        errmsg, open2flags, 1, 0);
 
                if (!Stream) {
@@ -458,7 +503,7 @@ void mpartition(int argc, char **argv, int dummy)
                        sprintf(errmsg,"init: open: %s", strerror(errno));
 #endif
                        continue;
-               }                       
+               }
 
 
                /* try to find out the size */
@@ -472,7 +517,7 @@ void mpartition(int argc, char **argv, int dummy)
                        memset ((void *) &data[0], 137, 10);
                        scsi_cmd(get_fd(Stream), cmd, 10, SCSI_IO_READ,
                                 data, 10, get_extra_data(Stream));
-                       
+
                        tot_sectors = 1 +
                                (data[0] << 24) +
                                (data[1] << 16) +
@@ -506,7 +551,7 @@ void mpartition(int argc, char **argv, int dummy)
                break;
        }
 
-       /* print error msg if needed */ 
+       /* print error msg if needed */
        if ( dev->drive == 0 ){
                FREE(&Stream);
                fprintf(stderr,"%s: %s\n", argv[0],errmsg);
@@ -544,7 +589,7 @@ void mpartition(int argc, char **argv, int dummy)
                        "Use the -I flag to initialize the partition table, and set the boot signature\n");
                inconsistency = 1;
        }
-       
+
        if(do_remove){
                if(!partTable[dev->partition].sys_ind)
                        fprintf(stderr,
@@ -575,7 +620,7 @@ void mpartition(int argc, char **argv, int dummy)
        for(i=1; i<5; i++){
                if(!partTable[i].sys_ind)
                        continue;
-               
+
                if(partTable[i].boot_ind)
                        has_activated++;
 
@@ -624,7 +669,7 @@ void mpartition(int argc, char **argv, int dummy)
                        end = tot_sectors - tot_sectors % sec_per_cyl;
                        end_set = 1;
                }
-               
+
                /* if the partition starts right at the beginning of
                 * the disk, keep one track unused to allow place for
                 * the master boot record */
@@ -655,8 +700,9 @@ void mpartition(int argc, char **argv, int dummy)
                }
 
                setBeginEnd(&partTable[dev->partition], begin, end,
-                                       used_dev.heads, used_dev.sectors, 
-                                       !has_activated, type);
+                           used_dev.heads, used_dev.sectors,
+                           !has_activated, type,
+                           dev->fat_bits);
        }
 
        if(activate) {
@@ -682,11 +728,11 @@ void mpartition(int argc, char **argv, int dummy)
                                          &used_dev, dev->partition);
 
        if(doprint && !inconsistency && partTable[dev->partition].sys_ind) {
-               printf("The following command will recreate the partition for drive %c:\n", 
+               printf("The following command will recreate the partition for drive %c:\n",
                       drive);
-               used_dev.tracks = 
+               used_dev.tracks =
                        (_DWORD(partTable[dev->partition].nr_sects) +
-                        (BEGIN(partTable[dev->partition]) % sec_per_cyl)) / 
+                        (BEGIN(partTable[dev->partition]) % sec_per_cyl)) /
                        sec_per_cyl;
                printf("mpartition -c -t %d -h %d -s %d -b %u %c:\n",
                       used_dev.tracks, used_dev.heads, used_dev.sectors,
@@ -700,7 +746,7 @@ void mpartition(int argc, char **argv, int dummy)
                exit(1);
        }
 
-       
+
        switch(has_activated) {
                case 0:
                        fprintf(stderr,
@@ -716,7 +762,7 @@ void mpartition(int argc, char **argv, int dummy)
                                "Usually, a disk should have exactly one active partition\n");
                        break;
        }
-       
+
        if(inconsistency && !force) {
                fprintf(stderr,
                        "inconsistency detected!\n" );
diff --git a/mrd.1 b/mrd.1
index 9b4afc3..0ae6ef7 100644 (file)
--- a/mrd.1
+++ b/mrd.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mrd 1 "09Jan13" mtools-4.0.18
+.TH mrd 1 "29Sep18" mtools-4.0.19
 .SH Name
 mrd - remove an MSDOS subdirectory
 '\" t
diff --git a/mren.1 b/mren.1
index 721f2ee..3098ac3 100644 (file)
--- a/mren.1
+++ b/mren.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mren 1 "09Jan13" mtools-4.0.18
+.TH mren 1 "29Sep18" mtools-4.0.19
 .SH Name
 mren - rename an existing MSDOS file
 '\" t
diff --git a/msdos.h b/msdos.h
index c060455..b37a0b2 100644 (file)
--- a/msdos.h
+++ b/msdos.h
@@ -214,15 +214,16 @@ extern struct OldDos_t {
 
 /* max FAT12/FAT16 sizes, according to
    
- http://www.microsoft.com/hwdev/download/hardware/fatgen103.pdf
+ https://staff.washington.edu/dittrich/misc/fatgen103.pdf
+ https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/fatgen103.doc
 
  interestingly enough, another Microsoft document 
  [http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b67321]
  gives different values, but the first seems to be more sure about
  itself, so we believe that one ;-)
 */
-#define FAT12 4085 /* max. number of clusters described by a 12 bit FAT */
-#define FAT16 65525 /* max number of clusters for a 16 bit FAT */
+#define FAT12 0x0ff5 /* max. number + 1 of clusters described by a 12 bit FAT */
+#define FAT16 0xfff5 /* max number + 1 of clusters for a 16 bit FAT */
 
 #define ATTR_ARCHIVE 0x20
 #define ATTR_DIR 0x10
index b85043f..65dfb78 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mshortname 1 "09Jan13" mtools-4.0.18
+.TH mshortname 1 "29Sep18" mtools-4.0.19
 .SH Name
 mshortname - shows short name of a file
 '\" t
index 75ac8c0..eb3ab23 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mshowfat 1 "09Jan13" mtools-4.0.18
+.TH mshowfat 1 "29Sep18" mtools-4.0.19
 .SH Name
 mshowfat - shows FAT clusters allocated to file
 '\" t
index 7d416d4..1d785cf 100644 (file)
--- a/mtools.1
+++ b/mtools.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mtools 1 "09Jan13" mtools-4.0.18
+.TH mtools 1 "29Sep18" mtools-4.0.19
 .SH Name
 mtools - utilities to access DOS disks in Unix.
 '\" t
@@ -36,10 +36,10 @@ Mtools can be found at the following places (and their mirrors):
 .nf
 .ft 3
 .in +0.3i
-http://ftp.gnu.org/gnu/mtools/mtools-4.0.18.tar.gz
-http://mtools.linux.lu/mtools-4.0.18.tar.gz
-ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.18.tar.gz
-ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.18.tar.gz
+http://ftp.gnu.org/gnu/mtools/mtools-4.0.19.tar.gz
+http://mtools.linux.lu/mtools-4.0.19.tar.gz
+ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.19.tar.gz
+ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.19.tar.gz
 .fi
 .in -0.3i
 .ft R
index 06f54b8..385cf13 100644 (file)
--- a/mtools.5
+++ b/mtools.5
@@ -1,5 +1,5 @@
 '\" t
-.TH mtools 5 "09Jan13" MTOOLS MTOOLS
+.TH mtools 5 "29Sep18" MTOOLS MTOOLS
 .SH Name
 mtools.conf - mtools configuration files
 '\" t
@@ -13,7 +13,7 @@ mtools.conf - mtools configuration files
 .tr \(if`
 .tr \(pd"
 
-.ds St Mtools\ 4.0.18
+.ds St Mtools\ 4.0.19
 .oh '\\*(St''%'
 .eh '%''\\*(St'
 .PP
index 332b042..3ab13ee 100644 (file)
@@ -1,6 +1,6 @@
-This is mtools.info, produced by makeinfo version 4.13 from mtools.texi.
+This is mtools.info, produced by makeinfo version 6.3 from mtools.texi.
 
-This manual is for Mtools (version 4.0.18, January 2013), which is a
+This manual is for Mtools (version 4.0.19, September 2018), which is a
 collection of tools to allow Unix systems to manipulate MS-DOS files.
 
    Copyright (C) 2007, 2009 Free Software Foundation, Inc.  Copyright
@@ -10,9 +10,8 @@ collection of tools to allow Unix systems to manipulate MS-DOS files.
      document under the terms of the GNU Free Documentation License,
      Version 1.3 or any later version published by the Free Software
      Foundation; with no Invariant Sections, with no Front-Cover Texts,
-     and with no Back-Cover Texts.  A copy of the license is included
-     in the section entitled "GNU Free Documentation License".
-
+     and with no Back-Cover Texts.  A copy of the license is included in
+     the section entitled "GNU Free Documentation License".
 INFO-DIR-SECTION DOS
 START-INFO-DIR-ENTRY
 * Mtools: (mtools).        Mtools: utilities to access DOS disks in Unix.
@@ -32,18 +31,18 @@ Introduction
 Mtools is a collection of tools to allow Unix systems to manipulate
 MS-DOS files: read, write, and move around files on an MS-DOS file
 system (typically a floppy disk).  Where reasonable, each program
-attempts to emulate the MS-DOS equivalent command. However, unnecessary
-restrictions and oddities of DOS are not emulated. For instance, it is
+attempts to emulate the MS-DOS equivalent command.  However, unnecessary
+restrictions and oddities of DOS are not emulated.  For instance, it is
 possible to move subdirectories from one subdirectory to another.
 
    Mtools is sufficient to give access to MS-DOS file systems.  For
-instance, commands such as `mdir a:' work on the `a:' floppy without
-any preliminary mounting or initialization (assuming the default
-`/etc/mtools.conf' works on your machine).  With mtools, one can change
+instance, commands such as 'mdir a:' work on the 'a:' floppy without any
+preliminary mounting or initialization (assuming the default
+'/etc/mtools.conf' works on your machine).  With mtools, one can change
 floppies too without unmounting and mounting.
 
-   This manual is for Mtools (version 4.0.18, January 2013), which is a
-collection of tools to allow Unix systems to manipulate MS-DOS files.
+   This manual is for Mtools (version 4.0.19, September 2018), which is
+collection of tools to allow Unix systems to manipulate MS-DOS files.
 
    Copyright (C) 2007, 2009 Free Software Foundation, Inc.  Copyright
 (C) 1996-2005,2007-2011,2013 Alain Knaff.
@@ -52,8 +51,8 @@ collection of tools to allow Unix systems to manipulate MS-DOS files.
      document under the terms of the GNU Free Documentation License,
      Version 1.3 or any later version published by the Free Software
      Foundation; with no Invariant Sections, with no Front-Cover Texts,
-     and with no Back-Cover Texts.  A copy of the license is included
-     in the section entitled "GNU Free Documentation License".
+     and with no Back-Cover Texts.  A copy of the license is included in
+     the section entitled "GNU Free Documentation License".
 
 * Menu:
 
@@ -76,10 +75,10 @@ File: mtools.info,  Node: Location,  Next: Common features,  Prev: Top,  Up: Top
 *********************
 
 Mtools can be found at the following places (and their mirrors):
-     http://ftp.gnu.org/gnu/mtools/mtools-4.0.18.tar.gz
-     http://mtools.linux.lu/mtools-4.0.18.tar.gz
-     ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.18.tar.gz
-     ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.18.tar.gz
+     http://ftp.gnu.org/gnu/mtools/mtools-4.0.19.tar.gz
+     http://mtools.linux.lu/mtools-4.0.19.tar.gz
+     ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.19.tar.gz
+     ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.19.tar.gz
 
    Before reporting a bug, make sure that it has not yet been fixed in
 the Alpha patches which can be found at:
@@ -87,16 +86,16 @@ the Alpha patches which can be found at:
      http://mtools.linux.lu/
      ftp://www.tux.org/pub/knaff/mtools
 
-   These patches are named `mtools-'VERSION`-'DDMM`.taz', where version
-stands for the base version, DD for the day and MM for the month. Due
+   These patches are named 'mtools-'VERSION'-'DDMM'.taz', where version
+stands for the base version, DD for the day and MM for the month.  Due
 to a lack of space, I usually leave only the most recent patch.
 
    There is an mtools mailing list at mtools @ tux.org .  Please send
 all bug reports to this list.  You may subscribe to the list by sending
 a message with 'subscribe mtools @ tux.org' in its body to majordomo @
-tux.org . (N.B. Please remove the spaces around the "@" both times. I
-left them there in order to fool spambots.)  Announcements of new
-mtools versions will also be sent to the list, in addition to the Linux
+tux.org .  (N.B. Please remove the spaces around the "@" both times.  I
+left them there in order to fool spambots.)  Announcements of new mtools
+versions will also be sent to the list, in addition to the Linux
 announce newsgroups.  The mailing list is archived at
 http://lists.gnu.org/pipermail/info-mtools/
 
@@ -127,31 +126,31 @@ File: mtools.info,  Node: arguments,  Next: drive letters,  Prev: Common feature
 =========================
 
 MS-DOS filenames are composed of a drive letter followed by a colon, a
-subdirectory, and a filename. Only the filename part is mandatory, the
-drive letter and the subdirectory are optional. Filenames without a
-drive letter refer to Unix files. Subdirectory names can use either the
-'`/'' or '`\'' separator.  The use of the '`\'' separator or wildcards
+subdirectory, and a filename.  Only the filename part is mandatory, the
+drive letter and the subdirectory are optional.  Filenames without a
+drive letter refer to Unix files.  Subdirectory names can use either the
+''/'' or ''\'' separator.  The use of the ''\'' separator or wildcards
 requires the names to be enclosed in quotes to protect them from the
-shell. However, wildcards in Unix filenames should not be enclosed in
+shell.  However, wildcards in Unix filenames should not be enclosed in
 quotes, because here we *want* the shell to expand them.
 
    The regular expression "pattern matching" routines follow the
-Unix-style rules.  For example, ``*'' matches all MS-DOS files in lieu
-of ``*.*''.  The archive, hidden, read-only and system attribute bits
+Unix-style rules.  For example, ''*'' matches all MS-DOS files in lieu
+of ''*.*''.  The archive, hidden, read-only and system attribute bits
 are ignored during pattern matching.
 
-   All options use the `-' (minus) as their first character, not `/' as
+   All options use the '-' (minus) as their first character, not '/' as
 you'd expect in MS-DOS.
 
    Most mtools commands allow multiple filename parameters, which
 doesn't follow MS-DOS conventions, but which is more user-friendly.
 
    Most mtools commands allow options that instruct them how to handle
-file name clashes. *Note name clashes::, for more details on these. All
-commands accept the `-V' flags which prints the version, and most
-accept the `-v' flag, which switches on verbose mode. In verbose mode,
+file name clashes.  *Note name clashes::, for more details on these.
+All commands accept the '-V' flags which prints the version, and most
+accept the '-v' flag, which switches on verbose mode.  In verbose mode,
 these commands print out the name of the MS-DOS files upon which they
-act, unless stated otherwise. *Note Commands::, for a description of
+act, unless stated otherwise.  *Note Commands::, for a description of
 the options which are specific to each command.
 
 \1f
@@ -167,21 +166,21 @@ Jaz drive (if available), and drive Z is a Zip drive (if available).  On
 those systems where the device name is derived from the SCSI id, the Jaz
 drive is assumed to be at SCSI target 4, and the Zip at SCSI target 5
 (factory default settings).  On Linux, both drives are assumed to be the
-second drive on the SCSI bus (/dev/sdb). The default settings can be
+second drive on the SCSI bus (/dev/sdb).  The default settings can be
 changes using a configuration file (*note Configuration::).
 
-   The drive letter : (colon) has a special meaning. It is used to
+   The drive letter : (colon) has a special meaning.  It is used to
 access image files which are directly specified on the command line
-using the `-i' options.
+using the '-i' options.
 
    Example:
       mcopy -i my-image-file.bin ::file1 ::file2 .
 
-   This copies `file1' and `file2' from the image file
-(`my-image-file.bin') to the `/tmp' directory.
+   This copies 'file1' and 'file2' from the image file
+('my-image-file.bin') to the '/tmp' directory.
 
    You can also supply an offset within the image file by including
-`@@'OFFSET into the file name.
+'@@'OFFSET into the file name.
 
    Example:
       mcopy -i my-image-file.bin@@1M ::file1 ::file2 .
@@ -195,9 +194,9 @@ File: mtools.info,  Node: directory,  Next: long names,  Prev: drive letters,  U
 2.3 Current working directory
 =============================
 
-The `mcd' command (*note mcd::) is used to establish the device and the
+The 'mcd' command (*note mcd::) is used to establish the device and the
 current working directory (relative to the MS-DOS file system),
-otherwise the default is assumed to be `A:/'. However, unlike MS-DOS,
+otherwise the default is assumed to be 'A:/'.  However, unlike MS-DOS,
 there is only one working directory for all drives, and not one per
 drive.
 
@@ -207,9 +206,9 @@ File: mtools.info,  Node: long names,  Next: name clashes,  Prev: directory,  Up
 2.4 VFAT-style long file names
 ==============================
 
-This version of mtools supports VFAT style long filenames. If a Unix
+This version of mtools supports VFAT style long filenames.  If a Unix
 filename is too long to fit in a short DOS name, it is stored as a VFAT
-long name, and a companion short name is generated. This short name is
+long name, and a companion short name is generated.  This short name is
 what you see when you examine the disk with a pre-7.0 version of DOS.
 The following table shows some examples of short names:
 
@@ -223,14 +222,11 @@ The following table shows some examples of short names:
 
    As you see, the following transformations happen to derive a short
 name:
-   * Illegal characters are replaced by underscores. The illegal
-     characters are `;+=[]',\"*\\<>/?:|'.
-
+   * Illegal characters are replaced by underscores.  The illegal
+     characters are ';+=[]',\"*\\<>/?:|'.
    * Extra dots, which cannot be interpreted as a main name/extension
      separator are removed
-
-   * A `~'N number is generated,
-
+   * A '~'N number is generated,
    * The name is shortened so as to fit in the 8+3 limitation
 
    The initial Unix-style file name (whether long or short) is also
@@ -239,12 +235,12 @@ called the "primary" name, and the derived short name is also called the
 
    Example:
       mcopy /etc/motd a:Reallylongname
-    Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as
-a short name. Reallylongname is the primary name, and REALLYLO is the
+   Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as
+a short name.  Reallylongname is the primary name, and REALLYLO is the
 secondary name.
       mcopy /etc/motd a:motd
-    Motd fits into the DOS filename limits. Mtools doesn't need to
-derivate another name. Motd is the primary name, and there is no
+   Motd fits into the DOS filename limits.  Mtools doesn't need to
+derivate another name.  Motd is the primary name, and there is no
 secondary name.
 
    In a nutshell: The primary name is the long name, if one exists, or
@@ -252,7 +248,7 @@ the short name if there is no long name.
 
    Although VFAT is much more flexible than FAT, there are still names
 that are not acceptable, even in VFAT. There are still some illegal
-characters left (`\"*\\<>/?:|'), and device names are still reserved.
+characters left ('\"*\\<>/?:|'), and device names are still reserved.
 
      Unix name       Long name       Reason for the change
      ---------       ----------      ---------------------
@@ -262,8 +258,7 @@ characters left (`\"*\\<>/?:|'), and device names are still reserved.
    As you see, the following transformations happen if a long name is
 illegal:
    * Illegal characters are replaces by underscores,
-
-   * A `-'N number is generated,
+   * A '-'N number is generated,
 
 \1f
 File: mtools.info,  Node: name clashes,  Next: case sensitivity,  Prev: long names,  Up: Common features
@@ -272,23 +267,21 @@ File: mtools.info,  Node: name clashes,  Next: case sensitivity,  Prev: long nam
 ================
 
 When writing a file to disk, its long name or short name may collide
-with an already existing file or directory. This may happen for all
-commands which create new directory entries, such as `mcopy', `mmd',
-`mren', `mmove'. When a name clash happens, mtools asks you what it
-should do. It offers several choices:
+with an already existing file or directory.  This may happen for all
+commands which create new directory entries, such as 'mcopy', 'mmd',
+'mren', 'mmove'.  When a name clash happens, mtools asks you what it
+should do.  It offers several choices:
 
-`overwrite'
-     Overwrites the existing file. It is not possible to overwrite a
+'overwrite'
+     Overwrites the existing file.  It is not possible to overwrite a
      directory with a file.
-
-`rename'
-     Renames the newly created file. Mtools prompts for the new filename
-
-`autorename'
-     Renames the newly created file. Mtools chooses a name by itself,
+'rename'
+     Renames the newly created file.  Mtools prompts for the new
+     filename
+'autorename'
+     Renames the newly created file.  Mtools chooses a name by itself,
      without prompting
-
-`skip'
+'skip'
      Gives up on this file, and moves on to the next (if any)
 
    To chose one of these actions, type its first letter at the prompt.
@@ -299,34 +292,25 @@ and you won't be prompted again.
    You may also chose actions (for all files) on the command line, when
 invoking mtools:
 
-`-D o'
+'-D o'
      Overwrites primary names by default.
-
-`-D O'
+'-D O'
      Overwrites secondary names by default.
-
-`-D r'
+'-D r'
      Renames primary name by default.
-
-`-D R'
+'-D R'
      Renames secondary name by default.
-
-`-D a'
+'-D a'
      Autorenames primary name by default.
-
-`-D A'
+'-D A'
      Autorenames secondary name by default.
-
-`-D s'
+'-D s'
      Skip primary name by default.
-
-`-D S'
+'-D S'
      Skip secondary name by default.
-
-`-D m'
+'-D m'
      Ask user what to do with primary name.
-
-`-D M'
+'-D M'
      Ask user what to do with secondary name.
 
    Note that for command line switches lower/upper differentiates
@@ -334,8 +318,8 @@ between primary/secondary name whereas for interactive choices,
 lower/upper differentiates between just-this-time/always.
 
    The primary name is the name as displayed in Windows 95 or Windows
-NT: i.e. the long name if it exists, and the short name otherwise.  The
-secondary name is the "hidden" name, i.e. the short name if a long name
+NT: i.e.  the long name if it exists, and the short name otherwise.  The
+secondary name is the "hidden" name, i.e.  the short name if a long name
 exists.
 
    By default, the user is prompted if the primary name clashes, and the
@@ -352,21 +336,21 @@ File: mtools.info,  Node: case sensitivity,  Next: high capacity formats,  Prev:
 
 The VFAT file system is able to remember the case of the filenames.
 However, filenames which differ only in case are not allowed to coexist
-in the same directory. For example if you store a file called
+in the same directory.  For example if you store a file called
 LongFileName on a VFAT file system, mdir shows this file as
-LongFileName, and not as Longfilename. However, if you then try to add
+LongFileName, and not as Longfilename.  However, if you then try to add
 LongFilename to the same directory, it is refused, because case is
 ignored for clash checks.
 
    The VFAT file system allows to store the case of a filename in the
 attribute byte, if all letters of the filename are the same case, and if
-all letters of the extension are the same case too. Mtools uses this
+all letters of the extension are the same case too.  Mtools uses this
 information when displaying the files, and also to generate the Unix
-filename when mcopying to a Unix directory. This may have unexpected
+filename when mcopying to a Unix directory.  This may have unexpected
 results when applied to files written using an pre-7.0 version of DOS:
-Indeed, the old style filenames map to all upper case. This is different
-from the behavior of the old version of mtools which used to generate
-lower case Unix filenames.
+Indeed, the old style filenames map to all upper case.  This is
+different from the behavior of the old version of mtools which used to
+generate lower case Unix filenames.
 
 \1f
 File: mtools.info,  Node: high capacity formats,  Next: exit codes,  Prev: case sensitivity,  Up: Common features
@@ -375,18 +359,18 @@ File: mtools.info,  Node: high capacity formats,  Next: exit codes,  Prev: case
 =========================
 
 Mtools supports a number of formats which allow to store more data on
-disk as usual. Due to different operating system abilities, these
-formats are not supported on all operating systems. Mtools recognizes
+disk as usual.  Due to different operating system abilities, these
+formats are not supported on all operating systems.  Mtools recognizes
 these formats transparently where supported.
 
    In order to format these disks, you need to use an operating system
-specific tool. For Linux, suitable floppy tools can be found in the
-`fdutils' package at the following locations~:
-     `ftp://www.tux.org/pub/knaff/fdutils/'.
-     `ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/fdutils-*'
+specific tool.  For Linux, suitable floppy tools can be found in the
+'fdutils' package at the following locations~:
+     ftp://www.tux.org/pub/knaff/fdutils/.
+     ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/fdutils-*
 
    See the manual pages included in that package for further detail: Use
-`superformat' to format all formats except XDF, and use `xdfcopy' to
+'superformat' to format all formats except XDF, and use 'xdfcopy' to
 format XDF.
 
 * Menu:
@@ -403,18 +387,18 @@ File: mtools.info,  Node: more sectors,  Next: bigger sectors,  Prev: high capac
 ------------------
 
 The oldest method of fitting more data on a disk is to use more sectors
-and more cylinders. Although the standard format uses 80 cylinders and
+and more cylinders.  Although the standard format uses 80 cylinders and
 18 sectors (on a 3 1/2 high density disk), it is possible to use up to
-83 cylinders (on most drives) and up to 21 sectors. This method allows
-to store up to 1743K on a 3 1/2 HD disk. However, 21 sector disks are
+83 cylinders (on most drives) and up to 21 sectors.  This method allows
+to store up to 1743K on a 3 1/2 HD disk.  However, 21 sector disks are
 twice as slow as the standard 18 sector disks because the sectors are
-packed so close together that we need to interleave them. This problem
+packed so close together that we need to interleave them.  This problem
 doesn't exist for 20 sector formats.
 
    These formats are supported by numerous DOS shareware utilities such
-as `fdformat' and `vgacopy'. In his infinite hubris, Bill Gate$
-believed that he invented this, and called it `DMF disks', or `Windows
-formatted disks'. But in reality, it has already existed years before!
+as 'fdformat' and 'vgacopy'.  In his infinite hubris, Bill Gate$
+believed that he invented this, and called it 'DMF disks', or 'Windows
+formatted disks'.  But in reality, it has already existed years before!
 Mtools supports these formats on Linux, on SunOS and on the DELL Unix
 PC.
 
@@ -425,12 +409,12 @@ File: mtools.info,  Node: bigger sectors,  Next: 2m,  Prev: more sectors,  Up: h
 --------------------
 
 By using bigger sectors it is possible to go beyond the capacity which
-can be obtained by the standard 512-byte sectors. This is because of the
-sector header. The sector header has the same size, regardless of how
-many data bytes are in the sector. Thus, we save some space by using
-_fewer_, but bigger sectors. For example, 1 sector of 4K only takes up
-header space once, whereas 8 sectors of 512 bytes have also 8 headers,
-for the same amount of useful data.
+can be obtained by the standard 512-byte sectors.  This is because of
+the sector header.  The sector header has the same size, regardless of
+how many data bytes are in the sector.  Thus, we save some space by
+using _fewer_, but bigger sectors.  For example, 1 sector of 4K only
+takes up header space once, whereas 8 sectors of 512 bytes have also 8
+headers, for the same amount of useful data.
 
    This method allows to store up to 1992K on a 3 1/2 HD disk.
 
@@ -442,7 +426,7 @@ File: mtools.info,  Node: 2m,  Next: XDF,  Prev: bigger sectors,  Up: high capac
 2.7.3 2m
 --------
 
-The 2m format was originally invented by Ciriaco Garcia de Celis. It
+The 2m format was originally invented by Ciriaco Garcia de Celis.  It
 also uses bigger sectors than usual in order to fit more data on the
 disk.  However, it uses the standard format (18 sectors of 512 bytes
 each) on the first cylinder, in order to make these disks easier to
@@ -451,8 +435,8 @@ sector, which contains a description of how the rest of the disk should
 be read.
 
    However, the drawback of this is that the first cylinder can hold
-less data than the others. Unfortunately, DOS can only handle disks
-where each track contains the same amount of data. Thus 2m hides the
+less data than the others.  Unfortunately, DOS can only handle disks
+where each track contains the same amount of data.  Thus 2m hides the
 fact that the first track contains less data by using a "shadow FAT".
 (Usually, DOS stores the FAT in two identical copies, for additional
 safety.  XDF stores only one copy, but tells DOS that it stores two.
@@ -468,14 +452,14 @@ File: mtools.info,  Node: XDF,  Prev: 2m,  Up: high capacity formats
 2.7.4 XDF
 ---------
 
-XDF is a high capacity format used by OS/2. It can hold 1840 K per
-disk. That's lower than the best 2m formats, but its main advantage is
-that it is fast: 600 milliseconds per track. That's faster than the 21
-sector format, and almost as fast as the standard 18 sector format. In
+XDF is a high capacity format used by OS/2.  It can hold 1840 K per
+disk.  That's lower than the best 2m formats, but its main advantage is
+that it is fast: 600 milliseconds per track.  That's faster than the 21
+sector format, and almost as fast as the standard 18 sector format.  In
 order to access these disks, make sure mtools has been compiled with XDF
-support, and set the `use_xdf' variable for the drive in the
-configuration file. *Note Compiling mtools::, and *note miscellaneous
-variables::, for details on how to do this. Fast XDF access is only
+support, and set the 'use_xdf' variable for the drive in the
+configuration file.  *Note Compiling mtools::, and *note miscellaneous
+variables::, for details on how to do this.  Fast XDF access is only
 available for Linux kernels which are more recent than 1.1.34.
 
    Mtools supports this format only on Linux.
@@ -483,9 +467,9 @@ available for Linux kernels which are more recent than 1.1.34.
    *Caution / Attention distributors*: If mtools is compiled on a Linux
 kernel more recent than 1.3.34, it won't run on an older kernel.
 However, if it has been compiled on an older kernel, it still runs on a
-newer kernel, except that XDF access is slower. It is recommended that
+newer kernel, except that XDF access is slower.  It is recommended that
 distribution authors only include mtools binaries compiled on kernels
-older than 1.3.34 until 2.0 comes out. When 2.0 will be out, mtools
+older than 1.3.34 until 2.0 comes out.  When 2.0 will be out, mtools
 binaries compiled on newer kernels may (and should) be distributed.
 Mtools binaries compiled on kernels older than 1.3.34 won't run on any
 2.1 kernel or later.
@@ -496,14 +480,13 @@ File: mtools.info,  Node: exit codes,  Next: bugs,  Prev: high capacity formats,
 2.8 Exit codes
 ==============
 
-All the Mtools commands return 0 on success, 1 on utter failure, or 2
-on partial failure.  All the Mtools commands perform a few sanity
-checks before going ahead, to make sure that the disk is indeed an
-MS-DOS disk (as opposed to, say an ext2 or MINIX disk). These checks
-may reject partially corrupted disks, which might otherwise still be
-readable. To avoid these checks, set the MTOOLS_SKIP_CHECK
-environmental variable or the corresponding configuration file variable
-(*note global variables::)
+All the Mtools commands return 0 on success, 1 on utter failure, or 2 on
+partial failure.  All the Mtools commands perform a few sanity checks
+before going ahead, to make sure that the disk is indeed an MS-DOS disk
+(as opposed to, say an ext2 or MINIX disk).  These checks may reject
+partially corrupted disks, which might otherwise still be readable.  To
+avoid these checks, set the MTOOLS_SKIP_CHECK environmental variable or
+the corresponding configuration file variable (*note global variables::)
 
 \1f
 File: mtools.info,  Node: bugs,  Prev: exit codes,  Up: Common features
@@ -516,7 +499,7 @@ multiple disk capacities are supported) is an occasional error message
 from the device driver.  These can be safely ignored.
 
    The fat checking code chokes on 1.72 Mb disks mformatted with
-pre-2.0.7 mtools. Set the environmental variable
+pre-2.0.7 mtools.  Set the environmental variable
 MTOOLS_FAT_COMPATIBILITY (or the corresponding configuration file
 variable, *note global variables::) to bypass the fat checking.
 
@@ -530,13 +513,12 @@ File: mtools.info,  Node: Configuration,  Next: Commands,  Prev: Common features
 ===============
 
 This sections explains the syntax of the configurations files for
-mtools. The configuration files are called `/etc/mtools.conf' and
-`~/.mtoolsrc'. If the environmental variable `MTOOLSRC' is set, its
-contents is used as the filename for a third configuration file. These
+mtools.  The configuration files are called '/etc/mtools.conf' and
+'~/.mtoolsrc'.  If the environmental variable 'MTOOLSRC' is set, its
+contents is used as the filename for a third configuration file.  These
 configuration files describe the following items:
 
    * Global configuration flags and variables
-
    * Per drive flags and variables
 
 * Menu:
@@ -555,11 +537,11 @@ File: mtools.info,  Node: configuration file location,  Next: general syntax,  P
 3.2 Location of the configuration files
 =======================================
 
-`/etc/mtools.conf' is the system-wide configuration file, and
-`~/.mtoolsrc' is the user's private configuration file.
+'/etc/mtools.conf' is the system-wide configuration file, and
+'~/.mtoolsrc' is the user's private configuration file.
 
    On some systems, the system-wide configuration file is called
-`/etc/default/mtools.conf' instead.
+'/etc/default/mtools.conf' instead.
 
 \1f
 File: mtools.info,  Node: general syntax,  Next: default values,  Prev: configuration file location,  Up: Configuration
@@ -567,17 +549,17 @@ File: mtools.info,  Node: general syntax,  Next: default values,  Prev: configur
 3.2.1 General configuration file syntax
 ---------------------------------------
 
-The configuration files is made up of sections. Each section starts
-with a keyword identifying the section followed by a colon.  Then
-follow variable assignments and flags. Variable assignments take the
-following form:
+The configuration files is made up of sections.  Each section starts
+with a keyword identifying the section followed by a colon.  Then follow
+variable assignments and flags.  Variable assignments take the following
+form:
      name=value
    Flags are lone keywords without an equal sign and value following
 them.  A section either ends at the end of the file or where the next
 section begins.
 
-   Lines starting with a hash (`#') are comments. Newline characters
-are equivalent to whitespace (except where ending a comment). The
+   Lines starting with a hash ('#') are comments.  Newline characters
+are equivalent to whitespace (except where ending a comment).  The
 configuration file is case insensitive, except for item enclosed in
 quotes (such as filenames).
 
@@ -590,7 +572,7 @@ File: mtools.info,  Node: default values,  Next: global variables,  Prev: genera
 For most platforms, mtools contains reasonable compiled-in defaults for
 physical floppy drives.  Thus, you usually don't need to bother with the
 configuration file, if all you want to do with mtools is to access your
-floppy drives. On the other hand, the configuration file is needed if
+floppy drives.  On the other hand, the configuration file is needed if
 you also want to use mtools to access your hard disk partitions and
 DOSEMU image files.
 
@@ -604,38 +586,32 @@ Global flags may be set to 1 or to 0.
 
    The following global flags are recognized:
 
-`MTOOLS_SKIP_CHECK'
-     If this is set to 1, mtools skips most of its sanity checks. This
+'MTOOLS_SKIP_CHECK'
+     If this is set to 1, mtools skips most of its sanity checks.  This
      is needed to read some Atari disks which have been made with the
      earlier ROMs, and which would not be recognized otherwise.
-
-`MTOOLS_FAT_COMPATIBILITY'
-     If this is set to 1, mtools skips the fat size checks. Some disks
-     have a bigger FAT than they really need to. These are rejected if
+'MTOOLS_FAT_COMPATIBILITY'
+     If this is set to 1, mtools skips the fat size checks.  Some disks
+     have a bigger FAT than they really need to.  These are rejected if
      this option is not set.
-
-`MTOOLS_LOWER_CASE'
-     If this is set to 1, mtools displays all-upper-case short
-     filenames as lowercase. This has been done to allow a behavior
-     which is consistent with older versions of mtools which didn't
-     know about the case bits.
-
-`MTOOLS_NO_VFAT'
+'MTOOLS_LOWER_CASE'
+     If this is set to 1, mtools displays all-upper-case short filenames
+     as lowercase.  This has been done to allow a behavior which is
+     consistent with older versions of mtools which didn't know about
+     the case bits.
+'MTOOLS_NO_VFAT'
      If this is set to 1, mtools won't generate VFAT entries for
      filenames which are mixed-case, but otherwise legal dos filenames.
-     This is useful when working with DOS versions which can't grok
-     VFAT long names, such as FreeDOS.
-
-`MTOOLS_DOTTED_DIR'
+     This is useful when working with DOS versions which can't grok VFAT
+     long names, such as FreeDOS.
+'MTOOLS_DOTTED_DIR'
      In a wide directory, prints the short name with a dot instead of
      spaces separating the basename and the extension.
-
-`MTOOLS_NAME_NUMERIC_TAIL'
+'MTOOLS_NAME_NUMERIC_TAIL'
      If this is set to one (default), generate numeric tails for all
      long names (~1).  If set to zero, only generate numeric tails if
      otherwise a clash would have happened.
-
-`MTOOLS_TWENTY_FOUR_HOUR_CLOCK'
+'MTOOLS_TWENTY_FOUR_HOUR_CLOCK'
      If 1, uses the European notation for times (twenty four hour
      clock), else uses the UK/US notation (am/pm)
 
@@ -647,7 +623,7 @@ instructs mtools to skip the sanity checks:
        export MTOOLS_SKIP_CHECK=1
 
    Global string variables may be set to any value:
-`MTOOLS_DATE_STRING'
+'MTOOLS_DATE_STRING'
      The format used for printing dates of files.  By default, is
      dd-mm-yyyy.
 
@@ -676,8 +652,8 @@ File: mtools.info,  Node: general information,  Next: location information,  Pre
 3.5.1 General information
 -------------------------
 
-Per drive flags and values may be described in a drive section. A drive
-section starts with `drive' "DRIVELETTER" :
+Per drive flags and values may be described in a drive section.  A drive
+section starts with 'drive' "DRIVELETTER" :
 
    Then follow variable-value pairs and flags.
 
@@ -691,31 +667,31 @@ File: mtools.info,  Node: location information,  Next: geometry description,  Pr
 3.5.2 Location information
 --------------------------
 
-For each drive, you need to describe where its data is physically
-stored (image file, physical device, partition, offset).
+For each drive, you need to describe where its data is physically stored
+(image file, physical device, partition, offset).
 
-`file'
-     The name of the file or device holding the disk image. This is
-     mandatory. The file name should be enclosed in quotes.
+'file'
+     The name of the file or device holding the disk image.  This is
+     mandatory.  The file name should be enclosed in quotes.
 
-`partition'
-     Tells mtools to treat the drive as a partitioned device, and to
-     use the given partition. Only primary partitions are accessible
-     using this method, and they are numbered from 1 to 4. For logical
-     partitions, use the more general `offset' variable. The
-     `partition' variable is intended for removable media such as
-     Syquest disks, ZIP drives, and magneto-optical disks. Although
+'partition'
+     Tells mtools to treat the drive as a partitioned device, and to use
+     the given partition.  Only primary partitions are accessible using
+     this method, and they are numbered from 1 to 4.  For logical
+     partitions, use the more general 'offset' variable.  The
+     'partition' variable is intended for removable media such as
+     Syquest disks, ZIP drives, and magneto-optical disks.  Although
      traditional DOS sees Syquest disks and magneto-optical disks as
-     `giant floppy disks' which are unpartitioned, OS/2 and Windows NT
-     treat them like hard disks, i.e. partitioned devices. The
-     `partition' flag is also useful DOSEMU hdimages. It is not
-     recommended for hard disks for which direct access to partitions
-     is available through mounting.
-
-`offset'
-     Describes where in the file the MS-DOS file system starts. This is
-     useful for logical partitions in DOSEMU hdimages, and for ATARI
-     ram disks. By default, this is zero, meaning that the file system
+     'giant floppy disks' which are unpartitioned, OS/2 and Windows NT
+     treat them like hard disks, i.e.  partitioned devices.  The
+     'partition' flag is also useful DOSEMU hdimages.  It is not
+     recommended for hard disks for which direct access to partitions is
+     available through mounting.
+
+'offset'
+     Describes where in the file the MS-DOS file system starts.  This is
+     useful for logical partitions in DOSEMU hdimages, and for ATARI ram
+     disks.  By default, this is zero, meaning that the file system
      starts right at the beginning of the device or file.
 
 \1f
@@ -725,45 +701,44 @@ File: mtools.info,  Node: geometry description,  Next: open flags,  Prev: locati
 ---------------------------------
 
 Geometry information describes the physical characteristics about the
-disk. Its has three purposes:
+disk.  Its has three purposes:
 
 formatting
      The geometry information is written into the boot sector of the
-     newly made disk. However, you may also describe the geometry
-     information on the command line. *Note mformat::, for details.
-
+     newly made disk.  However, you may also describe the geometry
+     information on the command line.  *Note mformat::, for details.
 filtering
      On some Unixes there are device nodes which only support one
-     physical geometry. For instance, you might need a different node
-     to access a disk as high density or as low density. The geometry
+     physical geometry.  For instance, you might need a different node
+     to access a disk as high density or as low density.  The geometry
      is compared to the actual geometry stored on the boot sector to
-     make sure that this device node is able to correctly read the
-     disk. If the geometry doesn't match, this drive entry fails, and
-     the next drive entry bearing the same drive letter is tried. *Note
-     multiple descriptions::, for more details on supplying several
-     descriptions for one drive letter.
+     make sure that this device node is able to correctly read the disk.
+     If the geometry doesn't match, this drive entry fails, and the next
+     drive entry bearing the same drive letter is tried.  *Note multiple
+     descriptions::, for more details on supplying several descriptions
+     for one drive letter.
 
      If no geometry information is supplied in the configuration file,
-     all disks are accepted. On Linux (and on SPARC) there exist device
-     nodes with configurable geometry (`/dev/fd0', `/dev/fd1' etc), and
+     all disks are accepted.  On Linux (and on SPARC) there exist device
+     nodes with configurable geometry ('/dev/fd0', '/dev/fd1' etc), and
      thus filtering is not needed (and ignored) for disk drives.
      (Mtools still does do filtering on plain files (disk images) in
      Linux: this is mainly intended for test purposes, as I don't have
      access to a Unix which would actually need filtering).
 
      If you do not need filtering, but want still a default geometry for
-     mformatting, you may switch off filtering using the `mformat_only'
+     mformatting, you may switch off filtering using the 'mformat_only'
      flag.
 
-     If you want filtering, you should supply the `filter' flag.  If you
+     If you want filtering, you should supply the 'filter' flag.  If you
      supply a geometry, you must supply one of both flags.
 
 initial geometry
      On devices that support it (usually floppy devices), the geometry
-     information is also used to set the initial geometry. This initial
+     information is also used to set the initial geometry.  This initial
      geometry is applied while reading the boot sector, which contains
      the real geometry.  If no geometry information is supplied in the
-     configuration file, or if the `mformat_only' flag is supplied, no
+     configuration file, or if the 'mformat_only' flag is supplied, no
      initial configuration is done.
 
      On Linux, initial geometry is not really needed, as the
@@ -771,21 +746,19 @@ initial geometry
      accurately enough (for most common formats) to read the boot
      sector.
 
-   Wrong geometry information may lead to very bizarre errors. That's
-why I strongly recommend that you add the `mformat_only' flag to your
+   Wrong geometry information may lead to very bizarre errors.  That's
+why I strongly recommend that you add the 'mformat_only' flag to your
 drive description, unless you really need filtering or initial geometry.
 
    The following geometry related variables are available:
 
-`cylinders'
-`tracks'
-     The number of cylinders. (`cylinders' is the preferred form,
-     `tracks' is considered obsolete)
-
-`heads'
+'cylinders'
+'tracks'
+     The number of cylinders.  ('cylinders' is the preferred form,
+     'tracks' is considered obsolete)
+'heads'
      The number of heads (sides).
-
-`sectors'
+'sectors'
      The number of sectors per track.
 
    Example: the following drive section describes a 1.44M drive:
@@ -798,24 +771,21 @@ drive description, unless you really need filtering or initial geometry.
 
    The following shorthand geometry descriptions are available:
 
-`1.44m'
-     high density 3 1/2 disk. Equivalent to: `fat_bits=12 cylinders=80
+'1.44m'
+     high density 3 1/2 disk.  Equivalent to: 'fat_bits=12 cylinders=80
      heads=2 sectors=18'
-
-`1.2m'
-     high density 5 1/4 disk. Equivalent to: `fat_bits=12 cylinders=80
+'1.2m'
+     high density 5 1/4 disk.  Equivalent to: 'fat_bits=12 cylinders=80
      heads=2 sectors=15'
-
-`720k'
-     double density 3 1/2 disk. Equivalent to: `fat_bits=12
+'720k'
+     double density 3 1/2 disk.  Equivalent to: 'fat_bits=12
      cylinders=80 heads=2 sectors=9'
-
-`360k'
-     double density 5 1/4 disk. Equivalent to: `fat_bits=12
+'360k'
+     double density 5 1/4 disk.  Equivalent to: 'fat_bits=12
      cylinders=40 heads=2 sectors=9'
 
-   The shorthand format descriptions may be amended. For example, `360k
-sectors=8' describes a 320k disk and is equivalent to: `fat_bits=12
+   The shorthand format descriptions may be amended.  For example, '360k
+sectors=8' describes a 320k disk and is equivalent to: 'fat_bits=12
 cylinders=40 heads=2 sectors=8'
 
 \1f
@@ -826,16 +796,14 @@ File: mtools.info,  Node: open flags,  Next: miscellaneous variables,  Prev: geo
 
 Moreover, the following flags are available:
 
-`sync'
+'sync'
      All i/o operations are done synchronously
-
-`nodelay'
-     The device or file is opened with the O_NDELAY flag. This is
+'nodelay'
+     The device or file is opened with the O_NDELAY flag.  This is
      needed on some non-Linux architectures.
-
-`exclusive'
-     The device or file is opened with the O_EXCL flag. On Linux, this
-     ensures exclusive access to the floppy drive. On most other
+'exclusive'
+     The device or file is opened with the O_EXCL flag.  On Linux, this
+     ensures exclusive access to the floppy drive.  On most other
      architectures, and for plain files it has no effect at all.
 
 \1f
@@ -848,39 +816,36 @@ The following general purpose drive variables are available.  Depending
 to their type, these variables can be set to a string (precmd) or an
 integer (all others)
 
-`fat_bits'
-     The number of FAT bits. This may be 12 or 16. This is very rarely
+'fat_bits'
+     The number of FAT bits.  This may be 12 or 16.  This is very rarely
      needed, as it can almost always be deduced from information in the
-     boot sector. On the contrary, describing the number of fat bits may
-     actually be harmful if you get it wrong. You should only use it if
-     mtools gets the auto-detected number of fat bits wrong, or if you
-     want to mformat a disk with a weird number of fat bits.
-
-`codepage'
-     Describes the DOS code page used for short filenames. This is a
-     number between 1 and 999. By default, code page 850 is used. The
+     boot sector.  On the contrary, describing the number of fat bits
+     may actually be harmful if you get it wrong.  You should only use
+     it if mtools gets the auto-detected number of fat bits wrong, or if
+     you want to mformat a disk with a weird number of fat bits.
+'codepage'
+     Describes the DOS code page used for short filenames.  This is a
+     number between 1 and 999.  By default, code page 850 is used.  The
      reason for this is because this code page contains most of the
-     characters that are also available in ISO-Latin-1. You may also
+     characters that are also available in ISO-Latin-1.  You may also
      specify a global code page for all drives by using the global
-     `default_codepage' parameter (outside of any drive description).
+     'default_codepage' parameter (outside of any drive description).
      This parameters exists starting at version 4.0.0
-
-`precmd'
+'precmd'
      On some variants of Solaris, it is necessary to call 'volcheck -v'
      before opening a floppy device, in order for the system to notice
-     that there is indeed a disk in the drive. `precmd="volcheck -v"'
+     that there is indeed a disk in the drive.  'precmd="volcheck -v"'
      in the drive clause establishes the desired behavior.
 
-`blocksize'
-     This parameter represents a default block size to be always used
-     on this device.  All I/O is done with multiples of this block size,
+'blocksize'
+     This parameter represents a default block size to be always used on
+     this device.  All I/O is done with multiples of this block size,
      independently of the sector size registered in the file system's
      boot sector.  This is useful for character devices whose sector
      size is not 512, such as for example CD-ROM drives on Solaris.
 
-
-   Only the `file' variable is mandatory. The other parameters may be
-left out. In that case a default value or an auto-detected value is
+   Only the 'file' variable is mandatory.  The other parameters may be
+left out.  In that case a default value or an auto-detected value is
 used.
 
 \1f
@@ -889,81 +854,82 @@ File: mtools.info,  Node: miscellaneous flags,  Next: multiple descriptions,  Pr
 3.5.6 General Purpose Drive Flags
 ---------------------------------
 
-A flag can either be set to 1 (enabled) or 0 (disabled). If the value is
-omitted, it is enabled.  For example, `scsi' is equivalent to `scsi=1'
+A flag can either be set to 1 (enabled) or 0 (disabled).  If the value
+is omitted, it is enabled.  For example, 'scsi' is equivalent to
+'scsi=1'
 
-`nolock'
+'nolock'
      Instruct mtools to not use locking on this drive.  This is needed
      on systems with buggy locking semantics.  However, enabling this
      makes operation less safe in cases where several users may access
      the same drive at the same time.
 
-`scsi'
-     When set to 1, this option tells mtools to use raw SCSI I/O
-     instead of the standard read/write calls to access the device.
-     Currently, this is supported on HP-UX, Solaris and SunOS.  This is
-     needed because on some architectures, such as SunOS or Solaris, PC
-     media can't be accessed using the `read' and `write' system calls,
+'scsi'
+     When set to 1, this option tells mtools to use raw SCSI I/O instead
+     of the standard read/write calls to access the device.  Currently,
+     this is supported on HP-UX, Solaris and SunOS. This is needed
+     because on some architectures, such as SunOS or Solaris, PC media
+     can't be accessed using the 'read' and 'write' system calls,
      because the OS expects them to contain a Sun specific "disk label".
 
      As raw SCSI access always uses the whole device, you need to
      specify the "partition" flag in addition
 
      On some architectures, such as Solaris, mtools needs root
-     privileges to be able to use the `scsi' option.  Thus mtools
-     should be installed setuid root on Solaris if you want to access
-     Zip/Jaz drives.  Thus, if the `scsi' flag is given, `privileged'
-     is automatically implied, unless explicitly disabled by
-     `privileged=0'
+     privileges to be able to use the 'scsi' option.  Thus mtools should
+     be installed setuid root on Solaris if you want to access Zip/Jaz
+     drives.  Thus, if the 'scsi' flag is given, 'privileged' is
+     automatically implied, unless explicitly disabled by 'privileged=0'
 
      Mtools uses its root privileges to open the device, and to issue
-     the actual SCSI I/O calls.  Moreover, root privileges are only
-     used for drives described in a system-wide configuration file such
-     as `/etc/mtools.conf', and not for those described in
-     `~/.mtoolsrc' or `$MTOOLSRC'.
+     the actual SCSI I/O calls.  Moreover, root privileges are only used
+     for drives described in a system-wide configuration file such as
+     '/etc/mtools.conf', and not for those described in '~/.mtoolsrc' or
+     '$MTOOLSRC'.
 
-`privileged'
+'privileged'
      When set to 1, this instructs mtools to use its setuid and setgid
      privileges for opening the given drive.  This option is only valid
      for drives described in the system-wide configuration files (such
-     as `/etc/mtools.conf', not `~/.mtoolsrc' or `$MTOOLSRC').
+     as '/etc/mtools.conf', not '~/.mtoolsrc' or '$MTOOLSRC').
      Obviously, this option is also a no op if mtools is not installed
      setuid or setgid.  This option is implied by 'scsi=1', but again
      only for drives defined in system-wide configuration files.
-     Privileged may also be set explicitly to 0, in order to tell
-     mtools not to use its privileges for a given drive even if
-     `scsi=1' is set.
+     Privileged may also be set explicitly to 0, in order to tell mtools
+     not to use its privileges for a given drive even if 'scsi=1' is
+     set.
 
      Mtools only needs to be installed setuid if you use the
-     `privileged' or `scsi' drive variables.  If you do not use these
-     options, mtools works perfectly well even when not installed
-     setuid root.
+     'privileged' or 'scsi' drive variables.  If you do not use these
+     options, mtools works perfectly well even when not installed setuid
+     root.
+
+'vold'
 
-`vold'
      Instructs mtools to interpret the device name as a vold identifier
      rather than as a filename.  The vold identifier is translated into
-     a real filename using the `media_findname()' and
-     `media_oldaliases()' functions of the `volmgt' library.  This flag
+     a real filename using the 'media_findname()' and
+     'media_oldaliases()' functions of the 'volmgt' library.  This flag
      is only available if you configured mtools with the
-     `--enable-new-vold' option before compilation.
+     '--enable-new-vold' option before compilation.
+
+'swap'
 
-`swap'
      Consider the media as a word-swapped Atari disk.
 
-`use_xdf'
+'use_xdf'
      If this is set to a non-zero value, mtools also tries to access
-     this disk as an XDF disk. XDF is a high capacity format used by
-     OS/2. This is off by default. *Note XDF::, for more details.
-
-`mformat_only'
+     this disk as an XDF disk.  XDF is a high capacity format used by
+     OS/2.  This is off by default.  *Note XDF::, for more details.
+'mformat_only'
      Tells mtools to use the geometry for this drive only for
      mformatting and not for filtering.
 
-`filter'
+'filter'
      Tells mtools to use the geometry for this drive both for
      mformatting and filtering.
 
-`remote'
+'remote'
      Tells mtools to connect to floppyd (*note floppyd::).
 
 \1f
@@ -972,14 +938,12 @@ File: mtools.info,  Node: multiple descriptions,  Prev: miscellaneous flags,  Up
 3.5.7 Supplying multiple descriptions for a drive
 -------------------------------------------------
 
-It is possible to supply multiple descriptions for a drive. In that
+It is possible to supply multiple descriptions for a drive.  In that
 case, the descriptions are tried in order until one is found that fits.
 Descriptions may fail for several reasons:
 
   1. because the geometry is not appropriate,
-
   2. because there is no disk in the drive,
-
   3. or because of other problems.
 
    Multiple definitions are useful when using physical devices which are
@@ -988,7 +952,7 @@ only able to support one single disk geometry.  Example:
        drive a: file="/dev/fd0H720" 720k
 
    This instructs mtools to use /dev/fd0H1440 for 1.44m (high density)
-disks and /dev/fd0H720 for 720k (double density) disks. On Linux, this
+disks and /dev/fd0H720 for 720k (double density) disks.  On Linux, this
 feature is not really needed, as the /dev/fd0 device is able to handle
 any geometry.
 
@@ -998,15 +962,15 @@ physical drives through one drive letter:
        drive z: file="/dev/fd0"
        drive z: file="/dev/fd1"
 
-   With this description, `mdir z:' accesses your first physical drive
-if it contains a disk. If the first drive doesn't contain a disk,
+   With this description, 'mdir z:' accesses your first physical drive
+if it contains a disk.  If the first drive doesn't contain a disk,
 mtools checks the second drive.
 
    When using multiple configuration files, drive descriptions in the
 files parsed last override descriptions for the same drive in earlier
-files. In order to avoid this, use the `drive+' or `+drive' keywords
-instead of `drive'. The first adds a description to the end of the list
-(i.e. it will be tried last), and the first adds it to the start of the
+files.  In order to avoid this, use the 'drive+' or '+drive' keywords
+instead of 'drive'.  The first adds a description to the end of the list
+(i.e.  it will be tried last), and the first adds it to the start of the
 list.
 
 \1f
@@ -1017,22 +981,19 @@ File: mtools.info,  Node: parsing order,  Next: old style configuration,  Prev:
 
 The configuration files are parsed in the following order:
   1. compiled-in defaults
-
-  2. `/etc/mtools.conf'
-
-  3. `~/.mtoolsrc'.
-
-  4. `$MTOOLSRC' (file pointed by the `MTOOLSRC' environmental variable)
+  2. '/etc/mtools.conf'
+  3. '~/.mtoolsrc'.
+  4. '$MTOOLSRC' (file pointed by the 'MTOOLSRC' environmental variable)
 
    Options described in the later files override those described in the
-earlier files. Drives defined in earlier files persist if they are not
-overridden in the later files. For instance, drives A and B may be
-defined in `/etc/mtools.conf' and drives C and D may be defined in
-`~/.mtoolsrc' However, if `~/.mtoolsrc' also defines drive A, this new
+earlier files.  Drives defined in earlier files persist if they are not
+overridden in the later files.  For instance, drives A and B may be
+defined in '/etc/mtools.conf' and drives C and D may be defined in
+'~/.mtoolsrc' However, if '~/.mtoolsrc' also defines drive A, this new
 description would override the description of drive A in
-`/etc/mtools.conf' instead of adding to it. If you want to add a new
-description to a drive already described in an earlier file, you need
-to use either the `+drive' or `drive+' keyword.
+'/etc/mtools.conf' instead of adding to it.  If you want to add a new
+description to a drive already described in an earlier file, you need to
+use either the '+drive' or 'drive+' keyword.
 
 \1f
 File: mtools.info,  Node: old style configuration,  Prev: parsing order,  Up: Configuration
@@ -1040,11 +1001,11 @@ File: mtools.info,  Node: old style configuration,  Prev: parsing order,  Up: Co
 3.7 Backwards compatibility with old configuration file syntax
 ==============================================================
 
-The syntax described herein is new for version `mtools-3.0'. The old
-line-oriented syntax is still supported. Each line beginning with a
+The syntax described herein is new for version 'mtools-3.0'.  The old
+line-oriented syntax is still supported.  Each line beginning with a
 single letter is considered to be a drive description using the old
-syntax. Old style and new style drive sections may be mixed within the
-same configuration file, in order to make upgrading easier. Support for
+syntax.  Old style and new style drive sections may be mixed within the
+same configuration file, in order to make upgrading easier.  Support for
 the old syntax will be phased out eventually, and in order to discourage
 its use, I purposefully omit its description here.
 
@@ -1055,7 +1016,7 @@ File: mtools.info,  Node: Commands,  Next: Compiling mtools,  Prev: Configuratio
 **************
 
 This section describes the available mtools commands, and the command
-line parameters that each of them accepts. Options which are common to
+line parameters that each of them accepts.  Options which are common to
 all mtools commands are not described here, *note arguments:: for a
 description of those.
 
@@ -1095,102 +1056,99 @@ File: mtools.info,  Node: floppyd,  Next: floppyd_installtest,  Prev: Commands,
 4.1 Floppyd
 ===========
 
-`Floppyd' is used as a server to grant access to the floppy drive to
+'Floppyd' is used as a server to grant access to the floppy drive to
 clients running on a remote machine, just as an X server grants access
 to the display to remote clients.  It has the following syntax:
 
-   `floppyd' [`-d'] [`-l'] [`-s' PORT] [`-r' USER] [`-b' IPADDR] [`-x'
+   'floppyd' ['-d'] ['-l'] ['-s' PORT] ['-r' USER] ['-b' IPADDR] ['-x'
 DISPLAY] DEVICENAMES
 
-   `floppyd' is always associated with an X server.  It runs on the
-same machine as its X server, and listens on port 5703 and above.
+   'floppyd' is always associated with an X server.  It runs on the same
+machine as its X server, and listens on port 5703 and above.
 
 4.1.1 Authentication
 --------------------
 
-`floppyd' authenticates remote clients using the `Xauthority' protocol.
-Xhost authentication is not supported. Each floppyd is associated with
+'floppyd' authenticates remote clients using the 'Xauthority' protocol.
+Xhost authentication is not supported.  Each floppyd is associated with
 an X server.  When a remote client attempts to connect to floppyd, it
 sends floppyd the X authority record corresponding to floppyd's X
 server.  Floppyd in turn then tries to open up a connection to the X
 server in order to verify the authenticity of the xauth record.  If the
 connection to the X server succeeds, the client is granted access.
-`DISPLAY'.
+'DISPLAY'.
 
    *Caution*: In order to make authentication work correctly, the local
-host should *not* be listed in the `xhost' list of allowed hosts.
-Indeed, hosts listed in `xhost' do not need a correct `Xauthority'
-cookie to connect to the X server. As `floppyd' runs on the same host
-as the X server, all its probe connection would succeed even for
-clients who supplied a bad cookie.  This means that your floppy drive
-would be open to the world, i.e. a huge security hole.   If your X
-server does not allow you to remove `localhost:0' and `:0' from the
-`xhost' list, you can prevent floppyd from probing those display names
-with the `-l' option.
+host should *not* be listed in the 'xhost' list of allowed hosts.
+Indeed, hosts listed in 'xhost' do not need a correct 'Xauthority'
+cookie to connect to the X server.  As 'floppyd' runs on the same host
+as the X server, all its probe connection would succeed even for clients
+who supplied a bad cookie.  This means that your floppy drive would be
+open to the world, i.e.  a huge security hole.  If your X server does
+not allow you to remove 'localhost:0' and ':0' from the 'xhost' list,
+you can prevent floppyd from probing those display names with the '-l'
+option.
 
 4.1.2 Command line options
 --------------------------
 
-`d'
-     Daemon mode. Floppyd runs its own server loop.  Do not supply this
-     if you start floppyd from `inetd.conf'
-
-`s  PORT'
+'d'
+     Daemon mode.  Floppyd runs its own server loop.  Do not supply this
+     if you start floppyd from 'inetd.conf'
+'s PORT'
      Port number for daemon mode.  Default is 5703 + DISPLAYNUMBER.
      This flag implies daemon mode.  For example, for display
-     `hitchhiker:5', the port would be 5708.
-
-`b  IPADDR'
-     Bind address (for multi homed hosts). This flag implies daemon mode
-
-`r USER'
+     'hitchhiker:5', the port would be 5708.
+'b IPADDR'
+     Bind address (for multi homed hosts).  This flag implies daemon
+     mode
+'r USER'
      Run the server under as the given user
-
-`x DISPLAY'
-     X display to use for authentication. By default, this is taken
-     from the `DISPLAY' variable. If neither the `x' attribute is
-     present nor `DISPLAY' is set, floppyd uses `:0.0'.
+'x DISPLAY'
+     X display to use for authentication.  By default, this is taken
+     from the 'DISPLAY' variable.  If neither the 'x' attribute is
+     present nor 'DISPLAY' is set, floppyd uses ':0.0'.
 
    DEVICENAMES is a list of device nodes to be opened.  Default is
-`/dev/fd0'. Multiple devices are only supported on mtools versions
+'/dev/fd0'.  Multiple devices are only supported on mtools versions
 newer than 3.9.11.
 
 4.1.3 Connecting to floppyd
 ---------------------------
 
-In order to use floppyd, add the flag `remote' to the device
-description in your `~/.mtoolsrc' file.  If the flag `remote' is given,
-the `file' parameter of the device description is taken to be a remote
-address.  It's format is the following:
-HOSTNAME`:'DISPLAYNUMBER[`/'[BASEPORT][`/'DRIVE]]. When using this
-entry, mtools connects to port BASEPORT+DISPLAYNUMBER at HOSTNAME. By
-default BASEPORT is 5703. The drive parameter is to distinguish among
+In order to use floppyd, add the flag 'remote' to the device description
+in your '~/.mtoolsrc' file.  If the flag 'remote' is given, the 'file'
+parameter of the device description is taken to be a remote address.
+It's format is the following:
+HOSTNAME':'DISPLAYNUMBER['/'[BASEPORT]['/'DRIVE]].  When using this
+entry, mtools connects to port BASEPORT+DISPLAYNUMBER at HOSTNAME.  By
+default BASEPORT is 5703.  The drive parameter is to distinguish among
 multiple drives associated with a single display (only mtools versions
 more recent than 3.9.11)
 
 4.1.4 Examples:
 ---------------
 
-The following starts a floppy daemon giving access to `/dev/fd0',
+The following starts a floppy daemon giving access to '/dev/fd0',
 listening on the default port 5703, tied to the default X servers:
 
      floppyd -d /dev/fd0
 
    Each of the following starts a floppy daemon giving access to
-`/dev/fd1', tied to the :1 local X servers, and listening on port 5704.
-We assume that the local host is named `hitchhiker'.
+'/dev/fd1', tied to the :1 local X servers, and listening on port 5704.
+We assume that the local host is named 'hitchhiker'.
 
      floppyd -d /dev/fd0
      floppyd -d -x :1 -p 5704 /dev/fd0
 
-   If you want to start floppyd by `inetd' instead of running it as a
-daemon, insert the following lines into `/etc/services':
+   If you want to start floppyd by 'inetd' instead of running it as a
+daemon, insert the following lines into '/etc/services':
      # floppy daemon
      floppyd-0    5703/tcp    # floppy daemon for X server :0
      floppyd-1    5704/tcp    # floppy daemon for X server :1
 
-   And insert the following into `/etc/inetd.conf' (assuming that you
-have defined a user named floppy in your `/etc/passwd'):
+   And insert the following into '/etc/inetd.conf' (assuming that you
+have defined a user named floppy in your '/etc/passwd'):
 
      # floppy daemon
      floppyd-0 stream  tcp  wait  floppy  /usr/sbin/floppyd floppyd /dev/fd0
@@ -1200,7 +1158,7 @@ have defined a user named floppy in your `/etc/passwd'):
 floppyd.  This is because the port is opened by inetd.conf, and hence
 floppyd cannot know its number to interfere the display number.
 
-   On the client side, insert the following into your `~/.mtoolsrc' to
+   On the client side, insert the following into your '~/.mtoolsrc' to
 define a drive letter accessing floppy drive in your X terminal:
      drive x: file="$DISPLAY" remote
 
@@ -1215,17 +1173,17 @@ File: mtools.info,  Node: floppyd_installtest,  Next: mattrib,  Prev: floppyd,
 4.2 Floppyd_installtest
 =======================
 
-`Floppyd_installtest' is used to check for the presence of a running
-floppyd daemon. This is useful, if you have a small front-end script to
+'Floppyd_installtest' is used to check for the presence of a running
+floppyd daemon.  This is useful, if you have a small front-end script to
 mtools, which decides whether to use floppyd or not.
 
-   `floppyd_installtest' [`-f']  Connect-String
+   'floppyd_installtest' ['-f'] Connect-String
 
-   If the `-f' option is specified, `floppyd_installtest' does a full
+   If the '-f' option is specified, 'floppyd_installtest' does a full
 X-Cookie authentication and complains if this does not work.
 
    The connect-String has the format described in the floppyd-section:
-HOSTNAME`:'DISPLAYNUMBER[`/'BASEPORT]
+HOSTNAME':'DISPLAYNUMBER['/'BASEPORT]
 
 \1f
 File: mtools.info,  Node: mattrib,  Next: mbadblocks,  Prev: floppyd_installtest,  Up: Commands
@@ -1233,49 +1191,44 @@ File: mtools.info,  Node: mattrib,  Next: mbadblocks,  Prev: floppyd_installtest
 4.3 Mattrib
 ===========
 
-`Mattrib' is used to change MS-DOS file attribute flags. It has the
+'Mattrib' is used to change MS-DOS file attribute flags.  It has the
 following syntax:
 
-   `mattrib' [`-a|+a'] [`-h|+h'] [`-r|+r'] [`-s|+s'] [`-/']  [`-p']
-[`-X'] MSDOSFILE [ MSDOSFILES ... ]
+   'mattrib' ['-a|+a'] ['-h|+h'] ['-r|+r'] ['-s|+s'] ['-/'] ['-p']
+['-X'] MSDOSFILE [ MSDOSFILES ... ]
 
-   `Mattrib' adds attribute flags to an MS-DOS file (with the ``+''
-operator) or remove attribute flags (with the ``-'' operator).
+   'Mattrib' adds attribute flags to an MS-DOS file (with the ''+''
+operator) or remove attribute flags (with the ''-'' operator).
 
-   `Mattrib' supports the following attribute bits:
+   'Mattrib' supports the following attribute bits:
 
-`a'
+'a'
      Archive bit.  Used by some backup programs to indicate a new file.
-
-`r'
-     Read-only bit.  Used to indicate a read-only file.  Files with
-     this bit set cannot be erased by `DEL' nor modified.
-
-`s'
+'r'
+     Read-only bit.  Used to indicate a read-only file.  Files with this
+     bit set cannot be erased by 'DEL' nor modified.
+'s'
      System bit.  Used by MS-DOS to indicate a operating system file.
+'h'
+     Hidden bit.  Used to make files hidden from 'DIR'.
 
-`h'
-     Hidden bit.  Used to make files hidden from `DIR'.
-
-   `Mattrib' supports the following command line flags:
-`/'
+   'Mattrib' supports the following command line flags:
+'/'
      Recursive.  Recursively list the attributes of the files in the
      subdirectories.
-
-`X'
-     Concise. Prints the attributes without any whitespace padding.  If
+'X'
+     Concise.  Prints the attributes without any whitespace padding.  If
      neither the "/" option is given, nor the MSDOSFILE contains a
      wildcard, and there is only one MS-DOS file parameter on the
      command line, only the attribute is printed, and not the filename.
      This option is convenient for scripts
-
-`p'
+'p'
      Replay mode.  Outputs a series of mformat commands that will
      reproduce the current situation, starting from a situation as left
      by untarring the MS-DOS file system.  Commands are only output for
      attribute settings that differ from the default (archive bit set
      for files, unset for directories).  This option is intended to be
-     used in addition to tar. The `readonly' attribute is not taken
+     used in addition to tar.  The 'readonly' attribute is not taken
      into account, as tar can set that one itself.
 
 \1f
@@ -1284,39 +1237,37 @@ File: mtools.info,  Node: mbadblocks,  Next: mcat,  Prev: mattrib,  Up: Commands
 4.4 Mbadblocks
 ==============
 
-The `mbadblocks' command is used to mark some clusters on an MS-DOS
-filesystem bad. It has the following syntax:
+The 'mbadblocks' command is used to mark some clusters on an MS-DOS
+filesystem bad.  It has the following syntax:
 
-   `mbadblocks' [`-s' SECTORLIST|`-c' CLUSTERLIST|-w] DRIVE`:'
+   'mbadblocks' ['-s' SECTORLIST|'-c' CLUSTERLIST|-w] DRIVE':'
 
-   If no command line flags are supplied, `Mbadblocks' scans an MS-DOS
-filesystem for bad blocks by simply trying to read them and flag them
-if read fails. All blocks that are unused are scanned, and if detected
-bad are marked as such in the FAT.
+   If no command line flags are supplied, 'Mbadblocks' scans an MS-DOS
+filesystem for bad blocks by simply trying to read them and flag them if
+read fails.  All blocks that are unused are scanned, and if detected bad
+are marked as such in the FAT.
 
-   This command is intended to be used right after `mformat'.  It is
-not intended to salvage data from bad disks.
+   This command is intended to be used right after 'mformat'.  It is not
+intended to salvage data from bad disks.
 
 4.4.1 Command line options
 --------------------------
 
-`c FILE'
+'c FILE'
      Use a list of bad clusters, rather than scanning for bad clusters
      itself.
-
-`s FILE'
+'s FILE'
      Use a list of bad sectors (counted from beginning of filesystem),
      rather than trying for bad clusters itself.
-
-`w'
+'w'
      Write a random pattern to each cluster, then read it back and flag
-     cluster as bad if mismatch. Only free clusters are tested in such a
-     way, so any file data is preserved.
+     cluster as bad if mismatch.  Only free clusters are tested in such
+     way, so any file data is preserved.
 
 4.4.2 Bugs
 ----------
 
-`Mbadblocks' should (but doesn't yet :-( ) also try to salvage bad
+'Mbadblocks' should (but doesn't yet :-( ) also try to salvage bad
 blocks which are in use by reading them repeatedly, and then mark them
 bad.
 
@@ -1326,20 +1277,20 @@ File: mtools.info,  Node: mcat,  Next: mcd,  Prev: mbadblocks,  Up: Commands
 4.5 Mcat
 ========
 
-The `mcat' command is used to copy an entire disk image from or to the
-floppy device. It uses the following syntax:
+The 'mcat' command is used to copy an entire disk image from or to the
+floppy device.  It uses the following syntax:
 
-   `mcat' [`-w'] DRIVE`:' 
+   'mcat' ['-w'] DRIVE':'
 
-   `Mcat' performs the same task as the Unix `cat' command. It is
-included into the mtools package, since `cat' cannot access remote
+   'Mcat' performs the same task as the Unix 'cat' command.  It is
+included into the mtools package, since 'cat' cannot access remote
 floppy devices offered by the mtools floppy daemon.  Now it is possible
 to create boot floppies remotely.
 
-   The default operation is reading. The output is written to stdout.
+   The default operation is reading.  The output is written to stdout.
 
-   If the `-w' option is specified, mcat reads a disk-image from stdin
-and writes it to the given device.  *Use this carefully!* Because of
+   If the '-w' option is specified, mcat reads a disk-image from stdin
+and writes it to the given device.  *Use this carefully!*  Because of
 the low-level nature of this command, it will happily destroy any data
 written before on the disk without warning!
 
@@ -1349,24 +1300,24 @@ File: mtools.info,  Node: mcd,  Next: mclasserase,  Prev: mcat,  Up: Commands
 4.6 Mcd
 =======
 
-The `mcd' command is used to change the mtools working directory on the
-MS-DOS disk. It uses the following syntax:
+The 'mcd' command is used to change the mtools working directory on the
+MS-DOS disk.  It uses the following syntax:
 
-     `mcd' [MSDOSDIRECTORY]
+     mcd [MSDOSDIRECTORY]
 
-   Without arguments, `mcd' reports the current device and working
-directory.  Otherwise, `mcd' changes the current device and current
+   Without arguments, 'mcd' reports the current device and working
+directory.  Otherwise, 'mcd' changes the current device and current
 working directory relative to an MS-DOS file system.
 
-   The environmental variable `MCWD' may be used to locate the file
+   The environmental variable 'MCWD' may be used to locate the file
 where the device and current working directory information is stored.
-The default is `$HOME/.mcwd'.  Information in this file is ignored if
+The default is '$HOME/.mcwd'.  Information in this file is ignored if
 the file is more than 6 hours old.
 
-   `Mcd' returns 0 on success or 1 on failure.
+   'Mcd' returns 0 on success or 1 on failure.
 
-   Unlike MS-DOS versions of `CD', `mcd' can be used to change to
-another device. It may be wise to remove old `.mcwd' files at logout.
+   Unlike MS-DOS versions of 'CD', 'mcd' can be used to change to
+another device.  It may be wise to remove old '.mcwd' files at logout.
 
 \1f
 File: mtools.info,  Node: mclasserase,  Next: mcopy,  Prev: mcd,  Up: Commands
@@ -1374,24 +1325,23 @@ File: mtools.info,  Node: mclasserase,  Next: mcopy,  Prev: mcd,  Up: Commands
 4.7 Mclasserase
 ===============
 
-The `mclasserase' command is used to wipe memory cards by overwriting
-it three times: first with `0xff', then with `0x00', then with `0xff'
-again. The command uses the following syntax:
+The 'mclasserase' command is used to wipe memory cards by overwriting it
+three times: first with '0xff', then with '0x00', then with '0xff'
+again.  The command uses the following syntax:
 
-     `mclasserase' [`-d'] MSDOSDRIVE
+     mclasserase [-d] MSDOSDRIVE
 
-   MS-DOS drive is optional, if none is specified, use `A:'. If more
+   MS-DOS drive is optional, if none is specified, use 'A:'.  If more
 than one drive are specified, all but the last are ignored.
 
-   `Mclasserase' accepts the following command line options:
+   'Mclasserase' accepts the following command line options:
 
-`d'
+'d'
      Stop after each erase cycle, for testing purposes
-
-`p'
+'p'
      Not yet implemented
 
-   `Mclasserase' returns 0 on success or -1 on failure.
+   'Mclasserase' returns 0 on success or -1 on failure.
 
 \1f
 File: mtools.info,  Node: mcopy,  Next: mdel,  Prev: mclasserase,  Up: Commands
@@ -1399,14 +1349,14 @@ File: mtools.info,  Node: mcopy,  Next: mdel,  Prev: mclasserase,  Up: Commands
 4.8 Mcopy
 =========
 
-The `mcopy' command is used to copy MS-DOS files to and from Unix. It
+The 'mcopy' command is used to copy MS-DOS files to and from Unix.  It
 uses the following syntax:
 
-     `mcopy' [`-bspanvmQT'] [`-D' CLASH_OPTION] SOURCEFILE TARGETFILE
-     `mcopy' [`-bspanvmQT'] [`-D' CLASH_OPTION] SOURCEFILE [ SOURCEFILES... ] TARGETDIRECTORY
-     `mcopy' [`-tnvm'] MSDOSSOURCEFILE
+     mcopy [-bspanvmQT] [-D CLASH_OPTION] SOURCEFILE TARGETFILE
+     mcopy [-bspanvmQT] [-D CLASH_OPTION] SOURCEFILE [ SOURCEFILES... ] TARGETDIRECTORY
+     mcopy [-tnvm] MSDOSSOURCEFILE
 
-   `Mcopy' copies the specified file to the named file, or copies
+   'Mcopy' copies the specified file to the named file, or copies
 multiple files to the named directory.  The source and target can be
 either MS-DOS or Unix files.
 
@@ -1414,66 +1364,57 @@ either MS-DOS or Unix files.
 example, determines the direction of the transfer.  A missing drive
 designation implies a Unix file whose path starts in the current
 directory.  If a source drive letter is specified with no attached file
-name (e.g. `mcopy a: .'), all files are copied from that drive.
+name (e.g.  'mcopy a: .'), all files are copied from that drive.
 
-   If only a single, MS-DOS source parameter is provided (e.g. "mcopy
-a:foo.exe"), an implied destination of the current directory (``.'') is
+   If only a single, MS-DOS source parameter is provided (e.g.  "mcopy
+a:foo.exe"), an implied destination of the current directory (''.'') is
 assumed.
 
-   A filename of ``-'' means standard input or standard output,
+   A filename of ''-'' means standard input or standard output,
 depending on its position on the command line.
 
-   `Mcopy' accepts the following command line options:
+   'Mcopy' accepts the following command line options:
 
-`t'
+'t'
      Text file transfer.  Mcopy translates incoming carriage return/line
      feeds to line feeds when copying from MS-DOS to Unix, and
      vice-versa when copying from Unix to MS-DOS.
-
-`b'
-     Batch mode. Optimized for huge recursive copies, but less secure
+'b'
+     Batch mode.  Optimized for huge recursive copies, but less secure
      if a crash happens during the copy.
-
-`s'
+'s'
      Recursive copy.  Also copies directories and their contents
-
-`p'
+'p'
      Preserves the attributes of the copied files
-
-`Q'
+'Q'
      When mcopying multiple files, quits as soon as one copy fails (for
      example due to lacking storage space on the target disk)
-
-`a'
-     Text (ASCII) file transfer.  `ASCII' translates incoming carriage
+'a'
+     Text (ASCII) file transfer.  'ASCII' translates incoming carriage
      return/line feeds to line feeds.
-
-`T'
+'T'
      Text (ASCII) file transfer with character set conversion.  Differs
-     from `-a' in the `ASCII' also translates incoming PC-8 characters
+     from '-a' in the 'ASCII' also translates incoming PC-8 characters
      to ISO-8859-1 equivalents as far as possible.  When reading DOS
-     files, untranslatable characters are replaced by '`#''; when
-     writing DOS files, untranslatable characters are replaced by '`.''.
-
-`n'
-     No confirmation when overwriting Unix files.  `ASCII' doesn't warn
-     the user when overwriting an existing Unix file. If the target
-     file already exists, and the `-n' option is not in effect, `mcopy'
-     asks whether to overwrite the file or to rename the new file
-     (*note name clashes::) for details).  In order to switch off
-     confirmation for DOS files, use `-o'.
-
-`m'
+     files, untranslatable characters are replaced by ''#''; when
+     writing DOS files, untranslatable characters are replaced by ''.''.
+'n'
+     No confirmation when overwriting Unix files.  'ASCII' doesn't warn
+     the user when overwriting an existing Unix file.  If the target
+     file already exists, and the '-n' option is not in effect, 'mcopy'
+     asks whether to overwrite the file or to rename the new file (*note
+     name clashes::) for details).  In order to switch off confirmation
+     for DOS files, use '-o'.
+'m'
      Preserve the file modification time.
-
-`v'
-     Verbose. Displays the name of each file as it is copied.
+'v'
+     Verbose.  Displays the name of each file as it is copied.
 
 4.8.1 Bugs
 ----------
 
 Unlike MS-DOS, the '+' operator (append) from MS-DOS is not supported.
-However, you may use `mtype' to produce the same effect:
+However, you may use 'mtype' to produce the same effect:
      mtype a:file1 a:file2 a:file3 >unixfile
      mtype a:file1 a:file2 a:file3 | mcopy - a:msdosfile
 
@@ -1483,13 +1424,13 @@ File: mtools.info,  Node: mdel,  Next: mdeltree,  Prev: mcopy,  Up: Commands
 4.9 Mdel
 ========
 
-The `mdel' command is used to delete an MS-DOS file. Its syntax is:
+The 'mdel' command is used to delete an MS-DOS file.  Its syntax is:
 
-     `mdel' [`-v'] MSDOSFILE [ MSDOSFILES ...  ]
+     'mdel' ['-v'] MSDOSFILE [ MSDOSFILES ...  ]
 
-   `Mdel' deletes files on an MS-DOS file system.
+   'Mdel' deletes files on an MS-DOS file system.
 
-   `Mdel' asks for verification prior to removing a read-only file.
+   'Mdel' asks for verification prior to removing a read-only file.
 
 \1f
 File: mtools.info,  Node: mdeltree,  Next: mdir,  Prev: mdel,  Up: Commands
@@ -1497,13 +1438,13 @@ File: mtools.info,  Node: mdeltree,  Next: mdir,  Prev: mdel,  Up: Commands
 4.10 Mdeltree
 =============
 
-The `mdeltree' command is used to delete an MS-DOS file. Its syntax is:
+The 'mdeltree' command is used to delete an MS-DOS file.  Its syntax is:
 
-     `mdeltree' [`-v'] MSDOSDIRECTORY [MSDOSDIRECTORIES...]
+     'mdeltree' ['-v'] MSDOSDIRECTORY [MSDOSDIRECTORIES...]
 
-   `Mdeltree' removes a directory and all the files and subdirectories
-it contains from an MS-DOS file system. An error occurs if the directory
-to be removed does not exist.
+   'Mdeltree' removes a directory and all the files and subdirectories
+it contains from an MS-DOS file system.  An error occurs if the
+directory to be removed does not exist.
 
 \1f
 File: mtools.info,  Node: mdir,  Next: mdu,  Prev: mdeltree,  Up: Commands
@@ -1511,37 +1452,33 @@ File: mtools.info,  Node: mdir,  Next: mdu,  Prev: mdeltree,  Up: Commands
 4.11 Mdir
 =========
 
-The `mdir' command is used to display an MS-DOS directory. Its syntax
+The 'mdir' command is used to display an MS-DOS directory.  Its syntax
 is:
 
-   `mdir' [`-/'] [`-f'] [`-w'] [`-a'] [`-b'] MSDOSFILE [ MSDOSFILES...]
+   'mdir' ['-/'] ['-f'] ['-w'] ['-a'] ['-b'] MSDOSFILE [ MSDOSFILES...]
 
-   `Mdir' displays the contents of MS-DOS directories, or the entries
+   'Mdir' displays the contents of MS-DOS directories, or the entries
 for some MS-DOS files.
 
-   `Mdir' supports the following command line options:
-
-`/'
-     Recursive output, just like MS-DOS' `-s' option
+   'Mdir' supports the following command line options:
 
-`w'
-     Wide output.  With this option, `mdir' prints the filenames across
+'/'
+     Recursive output, just like MS-DOS' '-s' option
+'w'
+     Wide output.  With this option, 'mdir' prints the filenames across
      the page without displaying the file size or creation date.
-
-`a'
+'a'
      Also list hidden files.
-
-`f'
-     Fast.  Do not try to find out free space.  On larger disks,
-     finding out the amount of free space takes up some non trivial
-     amount of time, as the whole FAT must be read in and scanned.  The
-     `-f' flag bypasses this step.  This flag is not needed on FAT32
-     file systems, which store the size explicitly.
-
-`b'
-     Concise listing. Lists each directory name or filename, one per
-     line (including the filename extension). This switch displays no
-     heading information and no summary. Only a newline separated list
+'f'
+     Fast.  Do not try to find out free space.  On larger disks, finding
+     out the amount of free space takes up some non trivial amount of
+     time, as the whole FAT must be read in and scanned.  The '-f' flag
+     bypasses this step.  This flag is not needed on FAT32 file systems,
+     which store the size explicitly.
+'b'
+     Concise listing.  Lists each directory name or filename, one per
+     line (including the filename extension).  This switch displays no
+     heading information and no summary.  Only a newline separated list
      of pathnames is displayed.
 
    An error occurs if a component of the path is not a directory.
@@ -1552,17 +1489,16 @@ File: mtools.info,  Node: mdu,  Next: mformat,  Prev: mdir,  Up: Commands
 4.12 Mdu
 ========
 
-`Mdu' is used to list the space occupied by a directory, its
-subdirectories and its files. It is similar to the `du' command on
+'Mdu' is used to list the space occupied by a directory, its
+subdirectories and its files.  It is similar to the 'du' command on
 Unix.  The unit used are clusters.  Use the minfo command to find out
 the cluster size.
 
-   `mdu' [`-a'] [ MSDOSFILES ... ]
+   'mdu' ['-a'] [ MSDOSFILES ... ]
 
-`a'
+'a'
      All files.  List also the space occupied for individual files.
-
-`s'
+'s'
      Only list the total space, don't give details for each
      subdirectory.
 
@@ -1572,27 +1508,27 @@ File: mtools.info,  Node: mformat,  Next: mkmanifest,  Prev: mdu,  Up: Commands
 4.13 Mformat
 ============
 
-The `mformat' command is used to add an MS-DOS file system to a
-low-level formatted diskette. Its syntax is:
-
-     `mformat' [`-t' CYLINDERS|`-T' TOT_SECTORS] [`-h' HEADS] [`-s' SECTORS]
-       [`-f' SIZE] [`-1'] [`-4'] [`-8']
-       [`-v' VOLUME_LABEL]
-       [`-F'] [`-S' SIZECODE]
-       [`-M' SOFTWARE_SECTOR_SIZE]
-       [`-N' SERIAL_NUMBER] [`-a']
-       [`-C'] [`-H' HIDDEN_SECTORS] [`-I' FSVERSION]
-       [`-r' ROOT_SECTORS] [`-L' FAT_LEN]
-       [`-B' BOOT_SECTOR] [`-k']
-       [`-m' MEDIA_DESCRIPTOR]
-       [`-K' BACKUP_BOOT]
-       [`-c' CLUSTERS_PER_SECTOR]
-       [`-d' FAT_COPIES]
-       [`-X'] [`-2' SECTORS_ON_TRACK_0] [`-3']
-       [`-0' RATE_ON_TRACK_0] [`-A' RATE_ON_OTHER_TRACKS]
+The 'mformat' command is used to add an MS-DOS file system to a
+low-level formatted diskette.  Its syntax is:
+
+     'mformat' ['-t' CYLINDERS|'-T' TOT_SECTORS] ['-h' HEADS] ['-s' SECTORS]
+       ['-f' SIZE] ['-1'] ['-4'] ['-8']
+       ['-v' VOLUME_LABEL]
+       ['-F'] ['-S' SIZECODE]
+       ['-M' SOFTWARE_SECTOR_SIZE]
+       ['-N' SERIAL_NUMBER] ['-a']
+       ['-C'] ['-H' HIDDEN_SECTORS] ['-I' FSVERSION]
+       ['-r' ROOT_SECTORS] ['-L' FAT_LEN]
+       ['-B' BOOT_SECTOR] ['-k']
+       ['-m' MEDIA_DESCRIPTOR]
+       ['-K' BACKUP_BOOT]
+       ['-c' CLUSTERS_PER_SECTOR]
+       ['-d' FAT_COPIES]
+       ['-X'] ['-2' SECTORS_ON_TRACK_0] ['-3']
+       ['-0' RATE_ON_TRACK_0] ['-A' RATE_ON_OTHER_TRACKS]
        DRIVE:
 
-   `Mformat' adds a minimal MS-DOS file system (boot sector, FAT, and
+   'Mformat' adds a minimal MS-DOS file system (boot sector, FAT, and
 root directory) to a diskette that has already been formatted by a Unix
 low-level format.
 
@@ -1602,213 +1538,217 @@ option)
 
    The following options are the same as for MS-DOS's format command:
 
-`v'
-     Specifies the volume label. A volume label identifies the disk and
-     can be a maximum of 11 characters. If you omit the -v switch,
+'v'
+     Specifies the volume label.  A volume label identifies the disk and
+     can be a maximum of 11 characters.  If you omit the -v switch,
      mformat will assign no label to the disk.
-
-`f'
-     Specifies the size of the DOS file system to format. Only a certain
-     number of predefined sizes are supported by this flag; for others
-     use the -h/-t/-s flags. The following sizes are supported:
-    160
+'f'
+     Specifies the size of the DOS file system to format.  Only a
+     certain number of predefined sizes are supported by this flag; for
+     others use the -h/-t/-s flags.  The following sizes are supported:
+     160
           160K, single-sided, 8 sectors per track, 40 cylinders (for 5
           1/4 DD)
-
-    180
+     180
           160K, single-sided, 9 sectors per track, 40 cylinders (for 5
           1/4 DD)
-
-    320
+     320
           320K, double-sided, 8 sectors per track, 40 cylinders (for 5
           1/4 DD)
-
-    360
+     360
           360K, double-sided, 9 sectors per track, 40 cylinders (for 5
           1/4 DD)
-
-    720
+     720
           720K, double-sided, 9 sectors per track, 80 cylinders (for 3
           1/2 DD)
-
-    1200
-          1200K, double-sided, 15 sectors per track, 80 cylinders (for
-          5 1/4 HD)
-
-    1440
-          1440K, double-sided, 18 sectors per track, 80 cylinders (for
-          3 1/2 HD)
-
-    2880
-          2880K, double-sided, 36 sectors per track, 80 cylinders (for
-          3 1/2 ED)
-
-`t'
+     1200
+          1200K, double-sided, 15 sectors per track, 80 cylinders (for 5
+          1/4 HD)
+     1440
+          1440K, double-sided, 18 sectors per track, 80 cylinders (for 3
+          1/2 HD)
+     2880
+          2880K, double-sided, 36 sectors per track, 80 cylinders (for 3
+          1/2 ED)
+
+'t'
      Specifies the number of tracks on the disk.
-
-`T'
-     Specifies the number of total sectors on the disk. Only one of
+'T'
+     Specifies the number of total sectors on the disk.  Only one of
      these 2 options may be specified (tracks or total sectors)
-
-`h'
+'h'
      The number of heads (sides).
-
-`s'
-     Specifies the number of sectors per track. If the 2m option is
+'s'
+     Specifies the number of sectors per track.  If the 2m option is
      given, number of 512-byte sector equivalents on generic tracks
-     (i.e. not head 0 track 0).  If the 2m option is not given, number
+     (i.e.  not head 0 track 0).  If the 2m option is not given, number
      of physical sectors per track (which may be bigger than 512 bytes).
 
-`1'
+'1'
      Formats a single side (equivalent to -h 1)
 
-`4'
-     Formats a 360K double-sided disk (equivalent to -f 360). When used
+'4'
+     Formats a 360K double-sided disk (equivalent to -f 360).  When used
      together with -the 1 switch, this switch formats a 180K disk
 
-`8'
+'8'
      Formats a disk with 8 sectors per track.
 
-
-   MS-DOS format's `q', `u' and `b' options are not supported, and `s'
+   MS-DOS format's 'q', 'u' and 'b' options are not supported, and 's'
 has a different meaning.
 
    The following options are specific to mtools:
 
-`F'
+'F'
      Format the partition as FAT32.
 
-`S'
-     The size code. The size of the sector is 2 ^ (sizecode + 7).
-
-`X'
-     formats the disk as an XDF disk. *Note XDF::, for more details.
+'S'
+     The size code.  The size of the sector is 2 ^ (sizecode + 7).
+'X'
+     formats the disk as an XDF disk.  *Note XDF::, for more details.
      The disk has first to be low-level formatted using the xdfcopy
-     utility included in the fdutils package. XDF disks are used for
+     utility included in the fdutils package.  XDF disks are used for
      instance for OS/2 install disks.
-
-`2'
-     2m format. The parameter to this option describes the number of
-     sectors on track 0, head 0. This option is recommended for sectors
+'2'
+     2m format.  The parameter to this option describes the number of
+     sectors on track 0, head 0.  This option is recommended for sectors
      bigger than normal.
-
-`3'
+'3'
      don't use a 2m format, even if the current geometry of the disk is
      a 2m geometry.
-
-`0'
+'0'
      Data transfer rate on track 0
-
-`A'
+'A'
      Data transfer rate on tracks other than 0
-
-`M'
-     software sector size. This parameter describes the sector size in
-     bytes used by the MS-DOS file system. By default it is the
+'M'
+     software sector size.  This parameter describes the sector size in
+     bytes used by the MS-DOS file system.  By default it is the
      physical sector size.
-
-`N'
+'N'
      Uses the requested serial number, instead of generating one
      automatically
-
-`a'
+'a'
      If this option is given, an Atari style serial number is generated.
      Ataris store their serial number in the OEM label.
-
-`C'
+'C'
      creates the disk image file to install the MS-DOS file system on
-     it. Obviously, this is useless on physical devices such as floppies
-     and hard disk partitions, but is interesting for image files.
-
-`H'
-     number of hidden sectors. This parameter is useful for formatting
+     it.  Obviously, this is useless on physical devices such as
+     floppies and hard disk partitions, but is interesting for image
+     files.
+'H'
+     number of hidden sectors.  This parameter is useful for formatting
      hard disk partition, which are not aligned on track boundaries
-     (i.e. first head of first track doesn't belong to the partition,
-     but contains a partition table). In that case the number of hidden
-     sectors is in general the number of sectors per cylinder. This is
+     (i.e.  first head of first track doesn't belong to the partition,
+     but contains a partition table).  In that case the number of hidden
+     sectors is in general the number of sectors per cylinder.  This is
      untested.
-
-`I'
+'I'
      Sets the fsVersion id when formatting a FAT32 drive.  In order to
      find this out, run minfo on an existing FAT32 drive, and mail me
      about it, so I can include the correct value in future versions of
      mtools.
-
-`c'
+'c'
      Sets the size of a cluster (in sectors).  If this cluster size
      would generate a FAT that too big for its number of bits, mtools
      automatically increases the cluster size, until the FAT is small
-     enough.
-
-`d'
-     Sets the number of FAT copies. Default is 2. This setting can also
-     be specified using the `MTOOLS_NFATS' environment variable.
-
-`r'
+     enough.  If no cluster size is specified explicitly, mtools uses a
+     default value as described in section "Number of sectors per
+     cluster" below.
+'d'
+     Sets the number of FAT copies.  Default is 2.  This setting can
+     also be specified using the 'MTOOLS_NFATS' environment variable.
+'r'
      Sets the size of the root directory (in sectors).  Only applicable
-     to 12 and 16 bit FATs. This setting can also be specified using the
-     `MTOOLS_DIR_LEN' environment variable.
-
-`L'
+     to 12 and 16 bit FATs.  This setting can also be specified using
+     the 'MTOOLS_DIR_LEN' environment variable.
+'L'
      Sets the length of the FAT.
-
-`B'
+'B'
      Use the boot sector stored in the given file or device, instead of
      using its own.  Only the geometry fields are updated to match the
      target disks parameters.
-
-`k'
+'k'
      Keep the existing boot sector as much as possible.  Only the
      geometry fields and other similar file system data are updated to
      match the target disks parameters.
-
-`K'
+'K'
      Sets the sector number where the backup of the boot sector should
      be stored (only relevant on FAT32).
 
-`m'
-     Use a non-standard media descriptor byte for this disk. The media
+'m'
+     Use a non-standard media descriptor byte for this disk.  The media
      descriptor is stored at position 21 of the boot sector, and as
-     first byte in each FAT copy. Using this option may confuse DOS or
-     older mtools version, and may make the disk unreadable. Only use
+     first byte in each FAT copy.  Using this option may confuse DOS or
+     older mtools version, and may make the disk unreadable.  Only use
      if you know what you are doing.
 
-
    To format a diskette at a density other than the default, you must
 supply (at least) those command line parameters that are different from
 the default.
 
-   `Mformat' returns 0 on success or 1 on failure.
+   'Mformat' returns 0 on success or 1 on failure.
 
-   It doesn't record bad block information to the Fat, use `mbadblocks'
+   It doesn't record bad block information to the Fat, use 'mbadblocks'
 for that.
 
+4.13.1 Number of sectors per cluster
+------------------------------------
+
+If the user indicates no cluster size, mformat figures out a default
+value for it.
+
+   For FAT32 it uses the following table to determine the number of
+sectors per cluster, depending on the total number of sectors on the
+filesystem.
+
+   more than 32*1024*1024*2: 64 sectors
+between 16*1024*1024*2 and 32*1024*1024*2: 32 sectors
+between 8*1024*1024*2 and 16*1024*1024*2: 16 sectors
+between 260*1024*2 and 81024*1024*2: 1 sectors
+
+   This is derived from information on page 20 of Microsoft's
+'fatgen103' document, which currently can be found at the following
+address:
+
+   'https://staff.washington.edu/dittrich/misc/fatgen103.pdf'
+
+   For FAT12 and FAT16, mformat uses an iterative approach, where it
+starts with a set value, which it doubles until it is able to fill up
+the disk using that cluster size and a number of cluster less than the
+maximum allowed.
+
+   The starting value is 1 for disks with one head or less than 2000
+sectors, and 2 for disks with more than one head, and more than 2000
+sectors.
+
+   The number of sectors per cluster cannot go beyond 128.
+
 \1f
 File: mtools.info,  Node: mkmanifest,  Next: minfo,  Prev: mformat,  Up: Commands
 
 4.14 Mkmanifest
 ===============
 
-The `mkmanifest' command is used to create a shell script (packing
-list) to restore Unix filenames. Its syntax is:
+The 'mkmanifest' command is used to create a shell script (packing list)
+to restore Unix filenames.  Its syntax is:
 
-   `mkmanifest' [ FILES ]
+   'mkmanifest' [ FILES ]
 
-   `Mkmanifest' creates a shell script that aids in the restoration of
+   'Mkmanifest' creates a shell script that aids in the restoration of
 Unix filenames that got clobbered by the MS-DOS filename restrictions.
 MS-DOS filenames are restricted to 8 character names, 3 character
 extensions, upper case only, no device names, and no illegal characters.
 
-   The mkmanifest program is compatible with the methods used in
-`pcomm, arc,' and `mtools' to change perfectly good Unix filenames to
-fit the MS-DOS restrictions. This command is only useful if the target
-system which will read the diskette cannot handle VFAT long names.
+   The mkmanifest program is compatible with the methods used in 'pcomm,
+arc,' and 'mtools' to change perfectly good Unix filenames to fit the
+MS-DOS restrictions.  This command is only useful if the target system
+which will read the diskette cannot handle VFAT long names.
 
 4.14.1 Example
 --------------
 
 You want to copy the following Unix files to a MS-DOS diskette (using
-the `mcopy' command).
+the 'mcopy' command).
 
        very_long_name
        2.many.dots
@@ -1817,7 +1757,7 @@ the `mcopy' command).
        prn.dev
        Capital
 
-   `ASCII' converts the names to:
+   'ASCII' converts the names to:
 
        very_lon
        2xmany.dot
@@ -1846,7 +1786,7 @@ files, it could be used to convert the filenames.
 4.14.2 Bugs
 -----------
 
-The short names generated by `mkmanifest' follow the old convention
+The short names generated by 'mkmanifest' follow the old convention
 (from mtools-2.0.7) and not the one from Windows 95 and mtools-3.0.
 
 \1f
@@ -1855,15 +1795,15 @@ File: mtools.info,  Node: minfo,  Next: mlabel,  Prev: mkmanifest,  Up: Commands
 4.15 Minfo
 ==========
 
-The `minfo' command prints the parameters of a MS-DOS file system, such
+The 'minfo' command prints the parameters of a MS-DOS file system, such
 as number of sectors, heads and cylinders.  It also prints an mformat
 command line which can be used to create a similar MS-DOS file system on
 another media.  However, this doesn't work with 2m or XDF media, and
 with MS-DOS 1.0 file systems
-     `minfo' DRIVE:
+     'minfo' DRIVE:
 
    Minfo supports the following option:
-`v'
+'v'
      Prints a hexdump of the boot sector, in addition to the other
      information
 
@@ -1873,34 +1813,31 @@ File: mtools.info,  Node: mlabel,  Next: mmd,  Prev: minfo,  Up: Commands
 4.16 Mlabel
 ===========
 
-The `mlabel' command adds a volume label to a disk. Its syntax is:
-     `mlabel' [`-vcsn'] [`-N' SERIAL] DRIVE:[NEW_LABEL]
+The 'mlabel' command adds a volume label to a disk.  Its syntax is:
+     'mlabel' ['-vcsn'] ['-N' SERIAL] DRIVE:[NEW_LABEL]
 
-   `Mlabel' displays the current volume label, if present. If NEW_LABEL
-is not given, and if neither the `c' nor the `s' options are set, it
+   'Mlabel' displays the current volume label, if present.  If NEW_LABEL
+is not given, and if neither the 'c' nor the 's' options are set, it
 prompts the user for a new volume label.  To delete an existing volume
 label, press return at the prompt.
 
    The label is limited to 11 single-byte characters, e.g.
-`Name1234567'.
+'Name1234567'.
 
    Reasonable care is taken to create a valid MS-DOS volume label.  If
-an invalid label is specified, `mlabel' changes the label (and displays
-the new label if the verbose mode is set). `Mlabel' returns 0 on
+an invalid label is specified, 'mlabel' changes the label (and displays
+the new label if the verbose mode is set).  'Mlabel' returns 0 on
 success or 1 on failure.
 
    Mlabel supports the following options:
-`c'
+'c'
      Clears an existing label, without prompting the user
-
-`s'
+'s'
      Shows the existing label, without prompting the user.
-
-`n'
+'n'
      Assigns a new (random) serial number to the disk
-
-`N SERIAL'
-     Sets the supplied serial number. The serial number should be
+'N SERIAL'
+     Sets the supplied serial number.  The serial number should be
      supplied as an 8 digit hexadecimal number, without spaces
 
 \1f
@@ -1909,12 +1846,13 @@ File: mtools.info,  Node: mmd,  Next: mmount,  Prev: mlabel,  Up: Commands
 4.17 Mmd
 ========
 
-The `mmd' command is used to make an MS-DOS subdirectory. Its syntax is:
+The 'mmd' command is used to make an MS-DOS subdirectory.  Its syntax
+is:
 
-   `mmd' [`-D' CLASH_OPTION] MSDOSDIRECTORY [ MSDOSDIRECTORIES... ]
+   'mmd' ['-D' CLASH_OPTION] MSDOSDIRECTORY [ MSDOSDIRECTORIES... ]
 
-   `Mmd' makes a new directory on an MS-DOS file system. An error occurs
-if the directory already exists.
+   'Mmd' makes a new directory on an MS-DOS file system.  An error
+occurs if the directory already exists.
 
 \1f
 File: mtools.info,  Node: mmount,  Next: mmove,  Prev: mmd,  Up: Commands
@@ -1922,15 +1860,15 @@ File: mtools.info,  Node: mmount,  Next: mmove,  Prev: mmd,  Up: Commands
 4.18 Mmount
 ===========
 
-The `mmount' command is used to mount an MS-DOS disk. It is only
+The 'mmount' command is used to mount an MS-DOS disk.  It is only
 available on Linux, as it is only useful if the OS kernel allows to
-configure the disk geometry. Its syntax is:
+configure the disk geometry.  Its syntax is:
 
-   `mmount' MSDOSDRIVE [MOUNTARGS]
+   'mmount' MSDOSDRIVE [MOUNTARGS]
 
-   `Mmount' reads the boot sector of an MS-DOS disk, configures the
-drive geometry, and finally mounts it passing `mountargs' to `mount. '
-If no mount arguments are specified, the name of the device is used. If
+   'Mmount' reads the boot sector of an MS-DOS disk, configures the
+drive geometry, and finally mounts it passing 'mountargs' to 'mount. '
+If no mount arguments are specified, the name of the device is used.  If
 the disk is write protected, it is automatically mounted read only.
 
 \1f
@@ -1939,17 +1877,17 @@ File: mtools.info,  Node: mmove,  Next: mpartition,  Prev: mmount,  Up: Commands
 4.19 Mmove
 ==========
 
-The `mmove' command is used to moves or renames an existing MS-DOS file
+The 'mmove' command is used to moves or renames an existing MS-DOS file
 or subdirectory.
-     `mmove' [`-v'] [`-D' CLASH_OPTION] SOURCEFILE TARGETFILE
-     `mmove' [`-v']  [`-D' CLASH_OPTION] SOURCEFILE [ SOURCEFILES... ] TARGETDIRECTORY
-   `Mmove' moves or renames an existing MS-DOS file or subdirectory.
-Unlike the MS-DOS version of `MOVE', `mmove' is able to move
+     'mmove' ['-v'] ['-D' CLASH_OPTION] SOURCEFILE TARGETFILE
+     'mmove' ['-v']  ['-D' CLASH_OPTION] SOURCEFILE [ SOURCEFILES... ] TARGETDIRECTORY
+   'Mmove' moves or renames an existing MS-DOS file or subdirectory.
+Unlike the MS-DOS version of 'MOVE', 'mmove' is able to move
 subdirectories.  Files or directories can only be moved within one file
-system. Data cannot be moved from MS-DOS to Unix or vice-versa.  If you
-omit the drive letter from the target file or directory, the same
-letter as for the source is assumed.  If you omit the drive letter from
-all parameters, drive a: is assumed by default.
+system.  Data cannot be moved from MS-DOS to Unix or vice-versa.  If you
+omit the drive letter from the target file or directory, the same letter
+as for the source is assumed.  If you omit the drive letter from all
+parameters, drive a: is assumed by default.
 
 \1f
 File: mtools.info,  Node: mpartition,  Next: mrd,  Prev: mmove,  Up: Commands
@@ -1957,68 +1895,60 @@ File: mtools.info,  Node: mpartition,  Next: mrd,  Prev: mmove,  Up: Commands
 4.20 Mpartition
 ===============
 
-The `mpartition' command is used to create MS-DOS file systems as
+The 'mpartition' command is used to create MS-DOS file systems as
 partitions.  This is intended to be used on non-Linux systems, i.e.
 systems where fdisk and easy access to SCSI devices are not available.
 This command only works on drives whose partition variable is set.
 
-     `mpartition' `-p' DRIVE
-     `mpartition' `-r' DRIVE
-     `mpartition' `-I' [`-B' BOOTSECTOR] DRIVE
-     `mpartition' `-a' DRIVE
-     `mpartition' `-d' DRIVE
-     `mpartition' `-c' [`-s' SECTORS] [`-h' HEADS]
-     [`-t' CYLINDERS] [`-v' [`-T' TYPE] [`-b'
-     BEGIN] [`-l' length] [`-f']
+     'mpartition' '-p' DRIVE
+     'mpartition' '-r' DRIVE
+     'mpartition' '-I' ['-B' BOOTSECTOR] DRIVE
+     'mpartition' '-a' DRIVE
+     'mpartition' '-d' DRIVE
+     'mpartition' '-c' ['-s' SECTORS] ['-h' HEADS]
+     ['-t' CYLINDERS] ['-v' ['-T' TYPE] ['-b'
+     BEGIN] ['-l' length] ['-f']
+
 
    Mpartition supports the following operations:
 
-`p'
+'p'
      Prints a command line to recreate the partition for the drive.
      Nothing is printed if the partition for the drive is not defined,
-     or an inconsistency has been detected.  If verbose (`-v') is also
+     or an inconsistency has been detected.  If verbose ('-v') is also
      set, prints the current partition table.
-
-`r'
+'r'
      Removes the partition described by DRIVE.
-
-`I'
+'I'
      Initializes the partition table, and removes all partitions.
-
-`c'
+'c'
      Creates the partition described by DRIVE.
-
-`a'
-     "Activates" the partition, i.e. makes it bootable.  Only one
+'a'
+     "Activates" the partition, i.e.  makes it bootable.  Only one
      partition can be bootable at a time.
-
-`d'
-     "Deactivates" the partition, i.e. makes it unbootable.
+'d'
+     "Deactivates" the partition, i.e.  makes it unbootable.
 
    If no operation is given, the current settings are printed.
 
    For partition creations, the following options are available:
-`s SECTORS'
+'s SECTORS'
      The number of sectors per track of the partition (which is also the
      number of sectors per track for the whole drive).
-
-`h HEADS'
+'h HEADS'
      The number of heads of the partition (which is also the number of
      heads for the whole drive).  By default, the geometry information
      (number of sectors and heads) is figured out from neighboring
      partition table entries, or guessed from the size.
-
-`t CYLINDERS'
+'t CYLINDERS'
      The number of cylinders of the partition (not the number of
      cylinders of the whole drive.
-
-`b BEGIN'
-     The starting offset of the partition, expressed in sectors. If
+'b BEGIN'
+     The starting offset of the partition, expressed in sectors.  If
      begin is not given, mpartition lets the partition begin at the
      start of the disk (partition number 1), or immediately after the
      end of the previous partition.
-
-`l LENGTH'
+'l LENGTH'
      The size (length) of the partition, expressed in sectors.  If end
      is not given, mpartition figures out the size from the number of
      sectors, heads and cylinders.  If these are not given either, it
@@ -2027,40 +1957,79 @@ This command only works on drives whose partition variable is set.
 
    The following option is available for all operation which modify the
 partition table:
-`f'
+'f'
      Usually, before writing back any changes to the partition,
      mpartition performs certain consistency checks, such as checking
      for overlaps and proper alignment of the partitions.  If any of
-     these checks fails, the partition table is not changes.  The `-f'
+     these checks fails, the partition table is not changes.  The '-f'
      allows you to override these safeguards.
 
    The following options are available for all operations:
-`v'
-     Together with `-p' prints the partition table as it is now (no
+'v'
+     Together with '-p' prints the partition table as it is now (no
      change operation), or as it is after it is modified.
-
-`vv'
+'vv'
      If the verbosity flag is given twice, mpartition will print out a
      hexdump of the partition table when reading it from and writing it
      to the device.
 
    The following option is available for partition table initialization:
-`B BOOTSECTOR'
+'B BOOTSECTOR'
      Reads the template master boot record from file BOOTSECTOR.
 
+4.20.1 Choice of partition type
+-------------------------------
+
+Mpartition proceeds as follows to pick a type for the partition:
+
+   - FAT32 partitions are assigned type 0x0C ("'Win95 FAT32, LBA'")
+
+   - For all others, if the partition fits entirely within the 65536
+     sector of the disk, assign 0x01 ("'DOS FAT12, CHS'") for FAT12
+     partition and 0x04 ("'DOS FAT16, CHS'") for FAT16 partitions
+
+   - If not covered by the above, assign 0x06 ("'DOS BIG FAT16 CHS'") if
+     partition fits entirely within the first 1024 cylinders (CHS mode)
+
+   - All remaining cases get 0x0E ("'Win95 BIG FAT16, LBA'")
+
+   If number of fat bits is not known (not specified in drive's
+definition), then FAT12 is assumed for all drives with less than 4096
+sectors, and FAT16 for those with more than 4096 sectors.
+
+   This corresponds more or less to the definitions outlined at
+'https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs' and
+'https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc977219(v=technet.10)',
+with two notable differences:
+
+   - If fat bits are unknown, the reference documents consider drives
+     with less than 32680 sectors to be FAT12.  Mtools uses 4096 sectors
+     as the cutoff point, as older versions of DOS only support FAT12 on
+     disks with less than 4096 sectors (and these older versions are the
+     ones which would be most likely to use FAT12 in the first place).
+
+   - The reference documents use a 8GB (wikipedia) or a 4GB (Microsoft)
+     cutoff between 0x06 ('DOS BIG FAT16 CHS') and 0x0E. Mtools uses
+     1024 cylinders.  This is because any partition beyond 1024
+     cylinders must be LBA and cannot be CHS. 8GB works out to be the
+     biggest capacity which can be represented as CHS (63 sectors, 255
+     heads and 1024 cylinders).  4GB is the capacity limit for windows
+     2000, so it makes sense that a documentation for windows 2000 would
+     specify this as the upper limit for any partition type.
+
 \1f
 File: mtools.info,  Node: mrd,  Next: mren,  Prev: mpartition,  Up: Commands
 
 4.21 Mrd
 ========
 
-The `mrd' command is used to remove an MS-DOS subdirectory. Its syntax
+The 'mrd' command is used to remove an MS-DOS subdirectory.  Its syntax
 is:
 
-     `mrd' [`-v'] MSDOSDIRECTORY [ MSDOSDIRECTORIES... ]
+     'mrd' ['-v'] MSDOSDIRECTORY [ MSDOSDIRECTORIES... ]
 
-   `Mrd' removes a directory from an MS-DOS file system. An error occurs
-if the directory does not exist or is not empty.
+   'Mrd' removes a directory from an MS-DOS file system.  An error
+occurs if the directory does not exist or is not empty.
 
 \1f
 File: mtools.info,  Node: mren,  Next: mshortname,  Prev: mrd,  Up: Commands
@@ -2068,21 +2037,21 @@ File: mtools.info,  Node: mren,  Next: mshortname,  Prev: mrd,  Up: Commands
 4.22 Mren
 =========
 
-The `mren' command is used to rename or move an existing MS-DOS file or
-subdirectory. Its syntax is:
+The 'mren' command is used to rename or move an existing MS-DOS file or
+subdirectory.  Its syntax is:
 
-     `mren' [`-voOsSrRA'] SOURCEFILE TARGETFILE
+     'mren' ['-voOsSrRA'] SOURCEFILE TARGETFILE
 
-   `Mren' renames an existing file on an MS-DOS file system.
+   'Mren' renames an existing file on an MS-DOS file system.
 
-   In verbose mode, `Mren' displays the new filename if the name
+   In verbose mode, 'Mren' displays the new filename if the name
 supplied is invalid.
 
    If the first syntax is used (only one source file), and if the target
 name doesn't contain any slashes or colons, the file (or subdirectory)
 is renamed in the same directory, instead of being moved to the current
-`mcd' directory as would be the case with `mmove'. Unlike the MS-DOS
-version of `REN', `mren' can be used to rename directories.
+'mcd' directory as would be the case with 'mmove'.  Unlike the MS-DOS
+version of 'REN', 'mren' can be used to rename directories.
 
 \1f
 File: mtools.info,  Node: mshortname,  Next: mshowfat,  Prev: mren,  Up: Commands
@@ -2090,10 +2059,10 @@ File: mtools.info,  Node: mshortname,  Next: mshowfat,  Prev: mren,  Up: Command
 4.23 Mshortname
 ===============
 
-The `mshortname' command is used to display the short name of a file.
+The 'mshortname' command is used to display the short name of a file.
 Syntax:
 
-     `mshortname' FILES
+     'mshortname' FILES
 
    The shortname is displayed as it is stored in raw format on disk,
 without any character set conversion.
@@ -2104,13 +2073,13 @@ File: mtools.info,  Node: mshowfat,  Next: mtoolstest,  Prev: mshortname,  Up: C
 4.24 Mshowfat
 =============
 
-The `mshowfat' command is used to display the FAT entries for a file.
+The 'mshowfat' command is used to display the FAT entries for a file.
 Syntax:
 
-     `mshowfat' [`-o' OFFSET] FILES
+     'mshowfat' ['-o' OFFSET] FILES
 
    If no offset is given, a list of all clusters occupied by the file is
-printed. If an offset is given, only the number of the cluster
+printed.  If an offset is given, only the number of the cluster
 containing that offset is printed.
 
 \1f
@@ -2119,10 +2088,10 @@ File: mtools.info,  Node: mtoolstest,  Next: mtype,  Prev: mshowfat,  Up: Comman
 4.25 Mtoolstest
 ===============
 
-The `mtoolstest' command is used to tests the mtools configuration
-files. To invoke it, just type `mtoolstest' without any arguments.
-`Mtoolstest' reads the mtools configuration files, and prints the
-cumulative configuration to `stdout'. The output can be used as a
+The 'mtoolstest' command is used to tests the mtools configuration
+files.  To invoke it, just type 'mtoolstest' without any arguments.
+'Mtoolstest' reads the mtools configuration files, and prints the
+cumulative configuration to 'stdout'.  The output can be used as a
 configuration file itself (although you might want to remove redundant
 clauses).  You may use this program to convert old-style configuration
 files into new style configuration files.
@@ -2133,31 +2102,29 @@ File: mtools.info,  Node: mtype,  Next: mzip,  Prev: mtoolstest,  Up: Commands
 4.26 Mtype
 ==========
 
-The `mtype' command is used to display contents of an MS-DOS file. Its
+The 'mtype' command is used to display contents of an MS-DOS file.  Its
 syntax is:
 
-     `mtype' [`-ts'] MSDOSFILE [ MSDOSFILES... ]
+     'mtype' ['-ts'] MSDOSFILE [ MSDOSFILES... ]
 
-   `Mtype' displays the specified MS-DOS file on the screen.
+   'Mtype' displays the specified MS-DOS file on the screen.
 
-   In addition to the standard options, `Mtype' allows the following
+   In addition to the standard options, 'Mtype' allows the following
 command line options:
 
-`t'
-     Text file viewing.  `Mtype' translates incoming carriage
+'t'
+     Text file viewing.  'Mtype' translates incoming carriage
      return/line feeds to line feeds.
+'s'
+     'Mtype' strips the high bit from the data.
 
-`s'
-     `Mtype' strips the high bit from the data.
+   The 'mcd' command may be used to establish the device and the current
+working directory (relative to MS-DOS), otherwise the default is 'A:/'.
 
-   The `mcd' command may be used to establish the device and the
-current working directory (relative to MS-DOS), otherwise the default is
-`A:/'.
-
-   `Mtype' returns 0 on success, 1 on utter failure, or 2 on partial
+   'Mtype' returns 0 on success, 1 on utter failure, or 2 on partial
 failure.
 
-   Unlike the MS-DOS version of `TYPE', `mtype' allows multiple
+   Unlike the MS-DOS version of 'TYPE', 'mtype' allows multiple
 arguments.
 
 \1f
@@ -2166,73 +2133,67 @@ File: mtools.info,  Node: mzip,  Prev: mtype,  Up: Commands
 4.27 Mzip
 =========
 
-The `mzip' command is used to issue ZIP disk specific commands on
-Linux, Solaris or HP-UX. Its syntax is:
+The 'mzip' command is used to issue ZIP disk specific commands on Linux,
+Solaris or HP-UX. Its syntax is:
 
-     `mzip' [`-epqrwx']
+     'mzip' ['-epqrwx']
 
-   `Mzip' allows the following command line options:
+   'Mzip' allows the following command line options:
 
-`e'
+'e'
      Ejects the disk.
-
-`f'
+'f'
      Force eject even if the disk is mounted (must be given in addition
-     to `-e').
-
-`r'
+     to '-e').
+'r'
      Write protect the disk.
-
-`w'
+'w'
      Remove write protection.
-
-`p'
+'p'
      Password write protect.
-
-`x'
+'x'
      Password protect
-
-`u'
+'u'
      Temporarily unprotect the disk until it is ejected.  The disk
      becomes writable, and reverts back to its old state when ejected.
-
-`q'
+'q'
      Queries the status
 
-   To remove the password, set it to one of the password-less modes
-`-r' or `-w': mzip will then ask you for the password, and unlock the
-disk.  If you have forgotten the password, you can get rid of it by
-low-level formatting the disk (using your SCSI adapter's BIOS setup).
+   To remove the password, set it to one of the password-less modes '-r'
+or '-w': mzip will then ask you for the password, and unlock the disk.
+If you have forgotten the password, you can get rid of it by low-level
+formatting the disk (using your SCSI adapter's BIOS setup).
 
    The ZipTools disk shipped with the drive is also password protected.
 On MS-DOS or on a Mac, this password is automatically removed once the
 ZipTools have been installed.  From various articles posted to Usenet, I
-learned that the password for the tools disk is
-`APlaceForYourStuff'(1).  Mzip knows about this password, and tries it
-first, before prompting you for a password.  Thus `mzip -w z:' unlocks
-the tools disk(2).  The tools disk is formatted in a special way so as
-to be usable both in a PC and in a Mac.  On a PC, the Mac file system
-appears as a hidden file named `partishn.mac'.  You may erase it to
-reclaim the 50 Megs of space taken up by the Mac file system.
+learned that the password for the tools disk is 'APlaceForYourStuff'(1).
+Mzip knows about this password, and tries it first, before prompting you
+for a password.  Thus 'mzip -w z:' unlocks the tools disk(2).  The tools
+disk is formatted in a special way so as to be usable both in a PC and
+in a Mac.  On a PC, the Mac file system appears as a hidden file named
+'partishn.mac'.  You may erase it to reclaim the 50 Megs of space taken
+up by the Mac file system.
 
 4.27.1 Bugs
 -----------
 
 This command is a big kludge.  A proper implementation would take a
 rework of significant parts of mtools, but unfortunately I don't have
-the time for this right now. The main downside of this implementation is
-that it is inefficient on some architectures (several successive calls
-to mtools, which defeats mtools' caching).
+the time for this right now.  The main downside of this implementation
+is that it is inefficient on some architectures (several successive
+calls to mtools, which defeats mtools' caching).
 
    ---------- Footnotes ----------
 
-   (1) To see the articles, search for `APlaceForYourStuff' using
-Google Groups
+   (1) To see the articles, search for 'APlaceForYourStuff' using Google
+Groups
 
    (2) I didn't know about this yet when I bought my own Zip drive.
 Thus I ended up reformatting my tools disk, and hence I haven't had the
 opportunity to test the password yet.  If anybody still has their tools
-disk with the original password, could you try it out? Thanks in advance
+disk with the original password, could you try it out?  Thanks in
+advance
 
 \1f
 File: mtools.info,  Node: Compiling mtools,  Next: Porting mtools,  Prev: Commands,  Up: Top
@@ -2240,28 +2201,27 @@ File: mtools.info,  Node: Compiling mtools,  Next: Porting mtools,  Prev: Comman
 5 Architecture specific compilation flags
 *****************************************
 
-To compile mtools, first invoke `./configure' before `make'. In
-addition to the standard `autoconfigure' flags, there are two
+To compile mtools, first invoke './configure' before 'make'.  In
+addition to the standard 'autoconfigure' flags, there are two
 architecture specific flags available.
 
-`./configure --enable-xdf'
-`./configure --disable-xdf'
-     Enables support for XDF disks. This is on by default. *Note XDF::,
-     for details.
-
-`./configure --enable-vold'
-`./configure --disable-vold'
-     Enables support for vold on Solaris. When used in conjunction with
+'./configure --enable-xdf'
+'./configure --disable-xdf'
+     Enables support for XDF disks.  This is on by default.  *Note
+     XDF::, for details.
+'./configure --enable-vold'
+'./configure --disable-vold'
+     Enables support for vold on Solaris.  When used in conjunction with
      vold, mtools should use different device nodes than for direct
      access.
 
-`./configure --enable-new-vold'
-`./configure --disable-new-vold'
-     Enables new support for vold on Solaris. This is supposed to work
+'./configure --enable-new-vold'
+'./configure --disable-new-vold'
+     Enables new support for vold on Solaris.  This is supposed to work
      more smoothly than the old support.
 
-`./configure --enable-floppyd'
-`./configure --disable-floppyd'
+'./configure --enable-floppyd'
+'./configure --disable-floppyd'
      Enables support for floppyd.  By default, floppyd support is
      enabled as long as the necessary X includes and libraries are
      available.
@@ -2272,25 +2232,23 @@ File: mtools.info,  Node: Porting mtools,  Next: Command Index,  Prev: Compiling
 6 Porting mtools to architectures which are not supported yet
 *************************************************************
 
-This chapter is only interesting for those who want to port mtools to
-an architecture which is not yet supported. For most common systems,
-default drives are already defined. If you want to add default drives
+This chapter is only interesting for those who want to port mtools to an
+architecture which is not yet supported.  For most common systems,
+default drives are already defined.  If you want to add default drives
 for a still unsupported system, run configuration.guess, to see which
-identification autoconf uses for that system. This identification is of
-the form cpu-vendor-os (for example sparc-sun-sunos). The cpu and the
-OS parts are passed to the compiler as preprocessor flags.   The OS
-part is passed to the compiler in three forms.
+identification autoconf uses for that system.  This identification is of
+the form cpu-vendor-os (for example sparc-sun-sunos).  The cpu and the
+OS parts are passed to the compiler as preprocessor flags.  The OS part
+is passed to the compiler in three forms.
   1. The complete OS name, with dots replaced by underscores.  SCO3.2v2
      would yield sco3_2v2
-
-  2. The base OS name. SCO3.2v2 would yield Sco
-
-  3. The base OS name plus its major version. SCO3.2v2 would yield Sco3
+  2. The base OS name.  SCO3.2v2 would yield Sco
+  3. The base OS name plus its major version.  SCO3.2v2 would yield Sco3
 
    All three versions are passed, if they are different.
 
    To define the devices, use the entries for the systems that are
-already present as templates. In general, they have the following form:
+already present as templates.  In general, they have the following form:
 
      #if (defined (my_cpu) && defined(my_os))
      #define predefined_devices
@@ -2303,90 +2261,74 @@ already present as templates. In general, they have the following form:
      #endif
 
    "/dev/first_drive" is the name of the device or image file
-representing the drive. Drive_letter is a letter ranging from a to z
-giving access to the drive. Drive_description describes the type of the
+representing the drive.  Drive_letter is a letter ranging from a to z
+giving access to the drive.  Drive_description describes the type of the
 drive:
-`ED312'
+'ED312'
      extra density (2.88M) 3 1/2 disk
-
-`HD312'
+'HD312'
      high density 3 1/2 disk
-
-`DD312'
+'DD312'
      double density 3 1/2 disk
-
-`HD514'
+'HD514'
      high density 5 1/4 disk
-
-`DD514'
+'DD514'
      double density 5 1/4 disk
-
-`DDsmall'
+'DDsmall'
      8 sector double density 5 1/4 disk
-
-`SS514'
+'SS514'
      single sided double density 5 1/4 disk
-
-`SSsmall'
+'SSsmall'
      single sided 8 sector double density 5 1/4 disk
-
-`GENFD'
+'GENFD'
      generic floppy drive (12 bit FAT)
-
-`GENHD'
+'GENHD'
      generic hard disk (16 bit FAT)
-
-`GEN'
+'GEN'
      generic device (all parameters match)
-
-`ZIPJAZ(flags)'
-     generic ZIP drive using normal access. This uses partition 4.
-     `Flags' are any special flags to be passed to open.
-
-`RZIPJAZ(flags)'
-     generic ZIP drive using raw SCSI access. This uses partition 4.
-     `Flags' are any special flags to be passed to open.
-
-`REMOTE'
+'ZIPJAZ(flags)'
+     generic ZIP drive using normal access.  This uses partition 4.
+     'Flags' are any special flags to be passed to open.
+'RZIPJAZ(flags)'
+     generic ZIP drive using raw SCSI access.  This uses partition 4.
+     'Flags' are any special flags to be passed to open.
+'REMOTE'
      the remote drive used for floppyd.  Unlike the other items, this
      macro also includes the file name ($DISPLAY) and the drive letter
      (X)
 
    Entries may be described in more detail:
       fat_bits,open_flags,cylinders,heads,sectors,DEF_ARG
-    or, if you need to describe an offset (file system doesn't start at
+   or, if you need to describe an offset (file system doesn't start at
 beginning of file system)
       fat_bits, open_flags, cylinders, heads, sectors, offset, DEF_ARG0
 
-`fat_bits'
-     is either 12, 16 or 0. 0 means that the device accepts both types
+'fat_bits'
+     is either 12, 16 or 0.  0 means that the device accepts both types
      of FAT.
-
-`open_flags'
+'open_flags'
      may include flags such as O_NDELAY, or O_RDONLY, which might be
-     necessary to open the device. 0 means no special flags are needed.
-
-`cylinders,heads,sectors'
-     describe the geometry of the disk. If cylinders is 0, the heads
+     necessary to open the device.  0 means no special flags are needed.
+'cylinders,heads,sectors'
+     describe the geometry of the disk.  If cylinders is 0, the heads
      and sectors parameters are ignored, and the drive accepts any
      geometry.
-
-`offset'
+'offset'
      is used if the DOS file system doesn't begin at the start of the
-     device or image file. This is mostly useful for Atari Ram disks
-     (which contain their device driver at the beginning of the file)
-     or for DOS emulator images (which may represent a partitioned
-     device.
+     device or image file.  This is mostly useful for Atari Ram disks
+     (which contain their device driver at the beginning of the file) or
+     for DOS emulator images (which may represent a partitioned device.
 
    Definition of defaults in the devices file should only be done if
 these same devices are found on a large number of hosts of this type.
 In that case, could you also let me know about your new definitions, so
 that I can include them into the next release.  For purely local file, I
-recommend that you use the `/etc/mtools.conf' and `~/.mtoolsrc'
+recommend that you use the '/etc/mtools.conf' and '~/.mtoolsrc'
 configuration files.
 
    However, the devices files also allows to supply geometry setting
-routines. These are necessary if you want to access high capacity disks.
+routines.  These are necessary if you want to access high capacity
+disks.
 
    Two routines should be supplied:
 
@@ -2394,40 +2336,37 @@ routines. These are necessary if you want to access high capacity disks.
           static inline int get_parameters(int fd, struct generic_floppy_struct *floppy)
 
      This probes the current configured geometry, and return it in the
-     structure generic_floppy_struct (which must also be declared).
-     Fd is an open file descriptor for the device, and buf is an already
-     filled in stat structure, which may be useful.   This routine
-     should return 1 if the probing fails, and 0 otherwise.
+     structure generic_floppy_struct (which must also be declared).  Fd
+     is an open file descriptor for the device, and buf is an already
+     filled in stat structure, which may be useful.  This routine should
+     return 1 if the probing fails, and 0 otherwise.
 
   2. Setting new parameters
           static inline int set_parameters(int fd, struct generic_floppy_struct *floppy)
                                            struct stat *buf)
-      This configures the geometry contained in floppy on the file
-     descriptor fd. Buf is the result of a stat call (already filled
+     This configures the geometry contained in floppy on the file
+     descriptor fd.  Buf is the result of a stat call (already filled
      in).  This should return 1 if the new geometry cannot be
      configured, and 0 otherwise.
 
    A certain number of preprocessor macros should also be supplied:
 
-`TRACKS(floppy)'
+'TRACKS(floppy)'
      refers to the track field in the floppy structure
-
-`HEADS(floppy)'
+'HEADS(floppy)'
      refers to the heads field in the floppy structure
-
-`SECTORS(floppy)'
+'SECTORS(floppy)'
      refers to the sectors per track field in the floppy structure
-
-`SECTORS_PER_DISK(floppy)'
+'SECTORS_PER_DISK(floppy)'
      refers to the sectors per disk field in the floppy structure (if
      applicable, otherwise leave undefined)
 
-`BLOCK_MAJOR'
+'BLOCK_MAJOR'
      major number of the floppy device, when viewed as a block device
 
-`CHAR_MAJOR'
+'CHAR_MAJOR'
      major number of the floppy device, when viewed as a character
-     device (a.k.a. "raw" device, used for fsck) (leave this undefined,
+     device (a.k.a.  "raw" device, used for fsck) (leave this undefined,
      if your OS doesn't have raw devices)
 
    For the truly high capacity formats (XDF, 2m, etc), there is no clean
@@ -2439,8 +2378,6 @@ File: mtools.info,  Node: Command Index,  Next: Variable Index,  Prev: Porting m
 Command Index
 *************
 
-\0\b[index\0\b]
-* Menu:
 \1f
 File: mtools.info,  Node: Variable Index,  Next: Concept Index,  Prev: Command Index,  Up: Top
 
@@ -2450,25 +2387,25 @@ Variable index
 \0\b[index\0\b]
 * Menu:
 
-* cylinders:                             geometry description. (line 61)
+* cylinders:                             geometry description. (line 60)
 * drive:                                 general information.  (line  6)
 * exclusive:                             open flags.           (line  6)
 * fat_bits:                              miscellaneous variables.
                                                                (line 11)
 * file:                                  location information. (line 10)
-* filter:                                miscellaneous flags.  (line 77)
-* heads:                                 geometry description. (line 65)
-* mformat_only:                          miscellaneous flags.  (line 73)
+* filter:                                miscellaneous flags.  (line 78)
+* heads:                                 geometry description. (line 63)
+* mformat_only:                          miscellaneous flags.  (line 74)
+* MTOOLSRC:                              Configuration.        (line  9)
 * MTOOLS_FAT_COMPATIBILITY:              global variables.     (line  6)
 * MTOOLS_LOWER_CASE:                     global variables.     (line  6)
 * MTOOLS_NO_VFAT:                        global variables.     (line  6)
 * MTOOLS_SKIP_CHECK:                     global variables.     (line  6)
-* MTOOLSRC:                              Configuration.        (line  9)
 * nodelay:                               open flags.           (line  6)
-* sectors:                               geometry description. (line 68)
+* sectors:                               geometry description. (line 65)
 * sync:                                  open flags.           (line  6)
-* tracks:                                geometry description. (line 61)
-* use_xdf:                               miscellaneous flags.  (line 68)
+* tracks:                                geometry description. (line 60)
+* use_xdf:                               miscellaneous flags.  (line 70)
 
 \1f
 File: mtools.info,  Node: Concept Index,  Prev: Variable Index,  Up: Top
@@ -2483,19 +2420,19 @@ Concept index
 * ALPHA patches:                         Location.             (line  6)
 * APlaceForYourStuff:                    mzip.                 (line  6)
 * Archive bit:                           mattrib.              (line  6)
-* Atari:                                 miscellaneous flags.  (line 65)
+* Atari:                                 miscellaneous flags.  (line 66)
 * Atari Ram disk:                        location information. (line 28)
 * Backwards compatibility:               old style configuration.
                                                                (line  6)
 * Bad blocks:                            mbadblocks.           (line  6)
 * bigger sectors:                        bigger sectors.       (line  6)
 * blocksize:                             miscellaneous variables.
-                                                               (line 34)
+                                                               (line 32)
 * bugs:                                  Location.             (line  6)
 * Case sensitivity:                      case sensitivity.     (line  6)
 * Changing file attributes:              mattrib.              (line  6)
 * character devices:                     miscellaneous variables.
-                                                               (line 34)
+                                                               (line 32)
 * Checking configuration file:           mtoolstest.           (line  6)
 * Clusters of a file:                    mshowfat.             (line  6)
 * Command list:                          Commands.             (line  6)
@@ -2532,7 +2469,7 @@ Concept index
 * Directory creation:                    mmd.                  (line  6)
 * Directory listing:                     mdir.                 (line  6)
 * Directory removing:                    mrd.                  (line  6)
-* disable locking:                       miscellaneous flags.  (line 10)
+* disable locking:                       miscellaneous flags.  (line 11)
 * Disk Geometry:                         geometry description. (line  6)
 * Disk image:                            mcat.                 (line  9)
 * Disk label:                            mlabel.               (line  6)
@@ -2552,7 +2489,7 @@ Concept index
 * erasing MS-DOS files:                  mdel.                 (line  6)
 * exclusive access to a drive:           open flags.           (line  6)
 * Executing commands before opening the device: miscellaneous variables.
-                                                               (line 28)
+                                                               (line 26)
 * Fat:                                   mshowfat.             (line  6)
 * fdformat:                              more sectors.         (line  6)
 * File name of device node:              location information. (line 10)
@@ -2579,7 +2516,7 @@ Concept index
 * Jaz disk (utilities):                  mzip.                 (line  6)
 * Jaz disks (partitioning them):         mpartition.           (line  6)
 * Jaz disks (partitions):                location information. (line 14)
-* Jaz disks (raw SCSI access):           miscellaneous flags.  (line 16)
+* Jaz disks (raw SCSI access):           miscellaneous flags.  (line 17)
 * Labeling a disk:                       mlabel.               (line  6)
 * Linux enhancements (High Capacity Formats): high capacity formats.
                                                                (line  6)
@@ -2591,7 +2528,7 @@ Concept index
                                                                (line  6)
 * Location of configuration files (parsing order): parsing order.
                                                                (line  6)
-* locking (disabling it):                miscellaneous flags.  (line 10)
+* locking (disabling it):                miscellaneous flags.  (line 11)
 * Long file name:                        long names.           (line  6)
 * Low density disk:                      geometry description. (line  6)
 * Magneto-optical disks:                 location information. (line 14)
@@ -2652,39 +2589,39 @@ Concept index
 * password protected Zip disks:          mzip.                 (line  6)
 * patches:                               Location.             (line  6)
 * Physically erase:                      mclasserase.          (line  6)
-* plain floppy: device xxx busy:         miscellaneous flags.  (line 10)
+* plain floppy: device xxx busy:         miscellaneous flags.  (line 11)
 * Porting:                               Porting mtools.       (line  6)
 * Primary file name (long names):        long names.           (line  6)
 * Primary file name (name clashes):      name clashes.         (line  6)
 * Ram disk:                              location information. (line 28)
 * raw device:                            miscellaneous variables.
-                                                               (line 34)
+                                                               (line 32)
 * Read errors:                           mbadblocks.           (line  6)
 * Read-only files (changing the attribute): mattrib.           (line  6)
 * Read-only files (listing them):        mdir.                 (line  6)
 * Reading MS-DOS files:                  mcopy.                (line  6)
 * recursively removing an MS-DOS directory: mdeltree.          (line  6)
-* remote floppy access <1>:              floppyd_installtest.  (line  6)
 * remote floppy access:                  floppyd.              (line  6)
+* remote floppy access <1>:              floppyd_installtest.  (line  6)
 * Removable media:                       location information. (line 14)
 * Removing a directory:                  mrd.                  (line  6)
 * removing an MS-DOS directory recursively: mdeltree.          (line  6)
 * removing MS-DOS files:                 mdel.                 (line  6)
 * Renaming files (mmove):                mmove.                (line  6)
 * Renaming files (mren):                 mren.                 (line  6)
-* SCSI devices:                          miscellaneous flags.  (line 16)
+* SCSI devices:                          miscellaneous flags.  (line 17)
 * Secondary file name (long names):      long names.           (line  6)
 * Secondary file name (name clashes):    name clashes.         (line  6)
 * setgid installation:                   miscellaneous flags.  (line 40)
 * setuid installation:                   miscellaneous flags.  (line 40)
 * setuid installation (needed for raw SCSI I/O): miscellaneous flags.
-                                                               (line 16)
+                                                               (line 17)
 * Solaris (compile time configuration of vold): Compiling mtools.
                                                                (line  6)
 * Solaris (Raw access to SCSI devices such as Zip & Jaz): miscellaneous flags.
-                                                               (line 16)
+                                                               (line 17)
 * Solaris (volcheck):                    miscellaneous variables.
-                                                               (line 28)
+                                                               (line 26)
 * Solaris (vold):                        miscellaneous flags.  (line 57)
 * Space occupied by directories and files: mdu.                (line  6)
 * Special formats:                       high capacity formats.
@@ -2692,11 +2629,11 @@ Concept index
 * Subdirectory creation:                 mmd.                  (line  6)
 * Subdirectory removing:                 mrd.                  (line  6)
 * SunOS (Raw access to SCSI devices such as Zip & Jaz): miscellaneous flags.
-                                                               (line 16)
+                                                               (line 17)
 * synchronous writing:                   open flags.           (line  6)
 * Syntax of the configuration file:      general syntax.       (line  6)
 * Syquest disks:                         location information. (line 14)
-* Syquest disks (raw SCSI access):       miscellaneous flags.  (line 16)
+* Syquest disks (raw SCSI access):       miscellaneous flags.  (line 17)
 * System files:                          mattrib.              (line  6)
 * Testing configuration file for correctness: mtoolstest.      (line  6)
 * Text files:                            mcopy.                (line  6)
@@ -2712,90 +2649,90 @@ Concept index
 * Windows 95-style file names:           long names.           (line  6)
 * Windows NT (layout of removable media): location information.
                                                                (line 14)
-* Wordswapped:                           miscellaneous flags.  (line 65)
-* Working directory <1>:                 mcd.                  (line  6)
+* Wordswapped:                           miscellaneous flags.  (line 66)
 * Working directory:                     directory.            (line  6)
+* Working directory <1>:                 mcd.                  (line  6)
 * Write protecting a Zip/Jaz disk:       mzip.                 (line  6)
 * Writing MS-DOS files:                  mcopy.                (line  6)
-* X terminal <1>:                        floppyd_installtest.  (line  6)
 * X terminal:                            floppyd.              (line  6)
+* X terminal <1>:                        floppyd_installtest.  (line  6)
 * XDF disks:                             XDF.                  (line  6)
 * XDF disks (compile time configuration): Compiling mtools.    (line  6)
-* XDF disks (how to configure):          miscellaneous flags.  (line 68)
+* XDF disks (how to configure):          miscellaneous flags.  (line 70)
 * Zip disk (utilities):                  mzip.                 (line  6)
 * Zip disks (partitioning them):         mpartition.           (line  6)
 * Zip disks (partitions):                location information. (line 14)
-* Zip disks (raw SCSI access):           miscellaneous flags.  (line 16)
+* Zip disks (raw SCSI access):           miscellaneous flags.  (line 17)
 * ZipTools disk:                         mzip.                 (line  6)
 
 
 \1f
 Tag Table:
 Node: Top\7f873
-Node: Location\7f2958
-Node: Common features\7f4344
-Node: arguments\7f5108
-Node: drive letters\7f6762
-Node: directory\7f8114
-Node: long names\7f8559
-Node: name clashes\7f11105
-Node: case sensitivity\7f13388
-Node: high capacity formats\7f14617
-Node: more sectors\7f15736
-Node: bigger sectors\7f16785
-Node: 2m\7f17507
-Node: XDF\7f18686
-Node: exit codes\7f20021
-Node: bugs\7f20657
-Node: Configuration\7f21189
-Node: configuration file location\7f22324
-Node: general syntax\7f22748
-Node: default values\7f23575
-Node: global variables\7f24102
-Node: per drive variables\7f26183
-Node: general information\7f27018
-Node: location information\7f27459
-Node: geometry description\7f28977
-Node: open flags\7f32829
-Node: miscellaneous variables\7f33428
-Node: miscellaneous flags\7f35496
-Node: multiple descriptions\7f39126
-Node: parsing order\7f40796
-Node: old style configuration\7f41827
-Node: Commands\7f42522
-Node: floppyd\7f44443
-Node: floppyd_installtest\7f49228
-Node: mattrib\7f49859
-Node: mbadblocks\7f51655
-Node: mcat\7f52948
-Node: mcd\7f53759
-Node: mclasserase\7f54620
-Node: mcopy\7f55299
-Node: mdel\7f58332
-Node: mdeltree\7f58670
-Node: mdir\7f59087
-Node: mdu\7f60363
-Node: mformat\7f60869
-Node: mkmanifest\7f67805
-Node: minfo\7f69777
-Node: mlabel\7f70347
-Node: mmd\7f71499
-Node: mmount\7f71846
-Node: mmove\7f72442
-Node: mpartition\7f73248
-Node: mrd\7f76769
-Node: mren\7f77125
-Node: mshortname\7f77872
-Node: mshowfat\7f78202
-Node: mtoolstest\7f78610
-Node: mtype\7f79180
-Node: mzip\7f80031
-Ref: mzip-Footnote-1\7f82064
-Ref: mzip-Footnote-2\7f82145
-Node: Compiling mtools\7f82431
-Node: Porting mtools\7f83526
-Node: Command Index\7f89441
-Node: Variable Index\7f89589
-Node: Concept Index\7f91120
+Node: Location\7f2962
+Node: Common features\7f4351
+Node: arguments\7f5115
+Node: drive letters\7f6776
+Node: directory\7f8130
+Node: long names\7f8576
+Node: name clashes\7f11122
+Node: case sensitivity\7f13406
+Node: high capacity formats\7f14640
+Node: more sectors\7f15758
+Node: bigger sectors\7f16813
+Node: 2m\7f17539
+Node: XDF\7f18721
+Node: exit codes\7f20064
+Node: bugs\7f20702
+Node: Configuration\7f21235
+Node: configuration file location\7f22372
+Node: general syntax\7f22796
+Node: default values\7f23627
+Node: global variables\7f24155
+Node: per drive variables\7f26234
+Node: general information\7f27069
+Node: location information\7f27511
+Node: geometry description\7f29040
+Node: open flags\7f32901
+Node: miscellaneous variables\7f33501
+Node: miscellaneous flags\7f35577
+Node: multiple descriptions\7f39207
+Node: parsing order\7f40881
+Node: old style configuration\7f41912
+Node: Commands\7f42611
+Node: floppyd\7f44533
+Node: floppyd_installtest\7f49326
+Node: mattrib\7f49957
+Node: mbadblocks\7f51750
+Node: mcat\7f53044
+Node: mcd\7f53858
+Node: mclasserase\7f54719
+Node: mcopy\7f55395
+Node: mdel\7f58409
+Node: mdeltree\7f58748
+Node: mdir\7f59167
+Node: mdu\7f60443
+Node: mformat\7f60949
+Node: mkmanifest\7f69183
+Node: minfo\7f71157
+Node: mlabel\7f71727
+Node: mmd\7f72880
+Node: mmount\7f73229
+Node: mmove\7f73828
+Node: mpartition\7f74635
+Node: mrd\7f80148
+Node: mren\7f80506
+Node: mshortname\7f81255
+Node: mshowfat\7f81585
+Node: mtoolstest\7f81994
+Node: mtype\7f82566
+Node: mzip\7f83417
+Ref: mzip-Footnote-1\7f85442
+Ref: mzip-Footnote-2\7f85523
+Node: Compiling mtools\7f85810
+Node: Porting mtools\7f86909
+Node: Command Index\7f92813
+Node: Variable Index\7f92941
+Node: Concept Index\7f94472
 \1f
 End Tag Table
index 1fc62b4..7fc29ef 100644 (file)
@@ -1,7 +1,7 @@
 %define _binary_payload w9.gzdio
 Name:           mtools
 Summary:        mtools, read/write/list/format DOS disks under Unix
-Version:        4.0.18
+Version:        4.0.19
 Release:        1
 License:        GPLv3+
 Group:          Utilities/System
index 1085789..8b675b7 100644 (file)
@@ -1883,7 +1883,9 @@ I can include the correct value in future versions of mtools.
 @item c
 Sets the size of a cluster (in sectors).  If this cluster size would
 generate a FAT that too big for its number of bits, mtools automatically
-increases the cluster size, until the FAT is small enough.
+increases the cluster size, until the FAT is small enough. If no
+cluster size is specified explicitly, mtools uses a default value as
+described in section ``Number of sectors per cluster'' below.
 @item d
 Sets the number of FAT copies. Default is 2. This setting can also be
 specified using the @code{MTOOLS_NFATS} environment variable.
@@ -1923,6 +1925,37 @@ default.
 It doesn't record bad block information to the Fat, use
 @code{mbadblocks} for that.
 
+@subsection Number of sectors per cluster
+
+If the user indicates no cluster size, mformat figures out a default
+value for it.
+
+For FAT32 it uses the following table to determine the number of
+sectors per cluster, depending on the total number of sectors on the
+filesystem.
+
+more than 32*1024*1024*2: 64 sectors@*
+between 16*1024*1024*2 and 32*1024*1024*2: 32 sectors@*
+between 8*1024*1024*2 and 16*1024*1024*2: 16 sectors@*
+between 260*1024*2 and 81024*1024*2: 1 sectors@*
+
+This is derived from information on page 20 of Microsoft's
+@code{fatgen103} document, which currently can be found at the
+following address:
+
+@code{https://staff.washington.edu/dittrich/misc/fatgen103.pdf}
+
+For FAT12 and FAT16, mformat uses an iterative approach, where it
+starts with a set value, which it doubles until it is able to fill up
+the disk using that cluster size and a number of cluster less than the
+maximum allowed.
+
+The starting value is 1 for disks with one head or less than 2000
+sectors, and 2 for disks with more than one head, and more than 2000
+sectors.
+
+The number of sectors per cluster cannot go beyond 128.
+
 @node mkmanifest, minfo, mformat, Commands
 @section Mkmanifest
 @pindex mkmanifest
@@ -2219,6 +2252,53 @@ The following option is available for partition table initialization:
 Reads the template master boot record from file @var{bootSector}.
 @end table
 
+@subsection Choice of partition type
+
+Mpartition proceeds as follows to pick a type for the partition:
+
+@itemize - 
+@item
+FAT32 partitions are assigned type 0x0C (``@code{Win95 FAT32, LBA}'')
+
+@item
+For all others, if the partition fits entirely within the 65536 sector of the disk, assign 0x01 (``@code{DOS FAT12, CHS}'') for FAT12 partition and 0x04 (``@code{DOS FAT16, CHS}'') for FAT16 partitions
+
+@item
+If not covered by the above, assign 0x06 (``@code{DOS BIG FAT16 CHS}'') if partition fits entirely within the first 1024 cylinders (CHS mode)
+
+@item
+All remaining cases get 0x0E (``@code{Win95 BIG FAT16, LBA}'')
+
+@end itemize
+
+If number of fat bits is not known (not specified in drive's
+definition), then FAT12 is assumed for all drives with less than 4096
+sectors, and FAT16 for those with more than 4096 sectors.
+
+This corresponds more or less to the definitions outlined at @code{https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs}
+and
+@code{https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc977219(v=technet.10)},
+with two notable differences:
+
+@itemize -
+@item
+If fat bits are unknown, the reference documents consider drives with
+less than 32680 sectors to be FAT12. Mtools uses 4096 sectors as the
+cutoff point, as older versions of DOS only support FAT12 on disks
+with less than 4096 sectors (and these older versions are the ones
+which would be most likely to use FAT12 in the first place).
+
+@item
+The reference documents use a 8GB (wikipedia) or a 4GB (Microsoft)
+cutoff between 0x06 (@code{DOS BIG FAT16 CHS}) and 0x0E. Mtools uses
+1024 cylinders. This is because any partition beyond 1024 cylinders
+must be LBA and cannot be CHS. 8GB works out to be the biggest
+capacity which can be represented as CHS (63 sectors, 255 heads and
+1024 cylinders). 4GB is the capacity limit for windows 2000, so it
+makes sense that a documentation for windows 2000 would specify this
+as the upper limit for any partition type.
+
+@end itemize
 
 @node mrd, mren, mpartition, Commands
 @section Mrd
index 8b62542..d9ed267 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mtools 1 "09Jan13" mtools-4.0.18
+.TH mtools 1 "29Sep18" mtools-4.0.19
 .SH Name
 mtools - utilities to access DOS disks in Unix.
 '\" t
@@ -36,10 +36,10 @@ Mtools can be found at the following places (and their mirrors):
 .nf
 .ft 3
 .in +0.3i
-http://ftp.gnu.org/gnu/mtools/mtools-4.0.18.tar.gz
-http://mtools.linux.lu/mtools-4.0.18.tar.gz
-ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.18.tar.gz
-ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.18.tar.gz
+http://ftp.gnu.org/gnu/mtools/mtools-4.0.19.tar.gz
+http://mtools.linux.lu/mtools-4.0.19.tar.gz
+ftp://www.tux.org/pub/knaff/mtools/mtools-4.0.19.tar.gz
+ftp://ibiblio.unc.edu/pub/Linux/utils/disk-management/mtools-4.0.19.tar.gz
 .fi
 .in -0.3i
 .ft R
index 565fdd7..ad1d5b8 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mtools 5 "09Jan13" MTOOLS MTOOLS
+.TH mtools 5 "29Sep18" MTOOLS MTOOLS
 .SH Name
 mtools.conf - mtools configuration files
 '\" t
@@ -13,7 +13,7 @@ mtools.conf - mtools configuration files
 .tr \(if`
 .tr \(pd"
 
-.ds St Mtools\ 4.0.18
+.ds St Mtools\ 4.0.19
 .oh '\\*(St''%'
 .eh '%''\\*(St'
 .PP
index e56f68d..fac3d0d 100644 (file)
@@ -1,5 +1,5 @@
 '\" t
-.TH mtoolstest 1 "09Jan13" mtools-4.0.18
+.TH mtoolstest 1 "29Sep18" mtools-4.0.19
 .SH Name
 mtoolstest - tests and displays the configuration
 '\" t
diff --git a/mtype.1 b/mtype.1
index 9e40fc5..fd483da 100644 (file)
--- a/mtype.1
+++ b/mtype.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mtype 1 "09Jan13" mtools-4.0.18
+.TH mtype 1 "29Sep18" mtools-4.0.19
 .SH Name
 mtype - display contents of an MSDOS file
 '\" t
diff --git a/mzip.1 b/mzip.1
index 2b54063..292e39a 100644 (file)
--- a/mzip.1
+++ b/mzip.1
@@ -1,5 +1,5 @@
 '\" t
-.TH mzip 1 "09Jan13" mtools-4.0.18
+.TH mzip 1 "29Sep18" mtools-4.0.19
 .SH Name
 mzip - change protection mode and eject disk on Zip/Jaz drive
 '\" t
index 5c43739..c4da1af 100644 (file)
@@ -45,5 +45,7 @@ int consistencyCheck(struct partition *partTable, int doprint, int verbose,
                     unsigned int *j, 
                     struct device *used_dev, int target_partition);
 
-void setBeginEnd(struct partition *partTable, int begin, int end,
-                                int heads, int sector, int activate, int type);
+void setBeginEnd(struct partition *partTable,
+                unsigned int begin, unsigned int end,
+                unsigned int heads, unsigned int sector,
+                int activate, int type, int fat_bits);
index cfcbeee..0871038 100644 (file)
  *  along with Mtools.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-const char *mversion="4.0.18";
+const char *mversion="4.0.19";
 
 /* Multiple releases on same day should be marked with (b), (cd), (d) after
  * date string below */
-const char *mdate = "January 9th, 2013";
+const char *mdate = "September 29th, 2018";
 
-const char *mformat_banner = "MTOO4018";
+const char *mformat_banner = "MTOO4019";
index bd18a11..a774790 100644 (file)
@@ -3,11 +3,12 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2012-11-08.11}
+\def\texinfoversion{2017-08-23.19}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
+% Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
 \everyjob{\message{[Texinfo version \texinfoversion]}%
   \catcode`+=\active \catcode`\_=\active}
 
+% LaTeX's \typeout.  This ensures that the messages it is used for
+% are identical in format to the corresponding ones from latex/pdflatex.
+\def\typeout{\immediate\write17}%
+
 \chardef\other=12
 
 % We never want plain's \outer definition of \+ in Texinfo.
 \let\ptexraggedright=\raggedright
 \let\ptexrbrace=\}
 \let\ptexslash=\/
+\let\ptexsp=\sp
 \let\ptexstar=\*
+\let\ptexsup=\sup
 \let\ptext=\t
 \let\ptextop=\top
 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
 \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
 \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
 
-% Since the category of space is not known, we have to be careful.
-\chardef\spacecat = 10
-\def\spaceisspace{\catcode`\ =\spacecat}
+% Give the space character the catcode for a space.
+\def\spaceisspace{\catcode`\ =10\relax}
+
+% Likewise for ^^M, the end of line character.
+\def\endlineisspace{\catcode13=10\relax}
 
-% sometimes characters are active, so we need control sequences.
-\chardef\ampChar   = `\&
-\chardef\colonChar = `\:
-\chardef\commaChar = `\,
 \chardef\dashChar  = `\-
-\chardef\dotChar   = `\.
-\chardef\exclamChar= `\!
-\chardef\hashChar  = `\#
-\chardef\lquoteChar= `\`
-\chardef\questChar = `\?
-\chardef\rquoteChar= `\'
-\chardef\semiChar  = `\;
 \chardef\slashChar = `\/
 \chardef\underChar = `\_
 
   wide-spread wrap-around
 }
 
-% Margin to add to right of even pages, to left of odd pages.
-\newdimen\bindingoffset
-\newdimen\normaloffset
-\newdimen\pagewidth \newdimen\pageheight
-
-% For a final copy, take out the rectangles
-% that mark overfull boxes (in case you have decided
-% that the text looks ok even though it passes the margin).
-%
-\def\finalout{\overfullrule=0pt }
-
 % Sometimes it is convenient to have everything in the transcript file
 % and nothing on the terminal.  We don't just call \tracingall here,
 % since that produces some useless output on the terminal.  We also make
 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
   \removelastskip\penalty-200\bigskip\fi\fi}
 
+%\f Output routine
+%
+
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+%
+\def\finalout{\overfullrule=0pt }
+
 % Do @cropmarks to get crop marks.
 %
 \newif\ifcropmarks
 %
 % Another complication is to let the user choose whether \thischapter
 % (\thissection) refers to the chapter (section) in effect at the top
-% of a page, or that at the bottom of a page.  The solution is
-% described on page 260 of The TeXbook.  It involves outputting two
-% marks for the sectioning macros, one before the section break, and
-% one after.  I won't pretend I can describe this better than DEK...
+% of a page, or that at the bottom of a page.
+
+% \domark is called twice inside \chapmacro, to add one
+% mark before the section break, and one after.
+%   In the second call \prevchapterdefs is the same as \lastchapterdefs,
+% and \prevsectiondefs is the same as \lastsectiondefs.
+%   Then if the page is not broken at the mark, some of the previous
+% section appears on the page, and we can get the name of this section
+% from \firstmark for @everyheadingmarks top.
+%   @everyheadingmarks bottom uses \botmark.
+%
+% See page 260 of The TeXbook.
 \def\domark{%
   \toks0=\expandafter{\lastchapterdefs}%
   \toks2=\expandafter{\lastsectiondefs}%
   \toks6=\expandafter{\prevsectiondefs}%
   \toks8=\expandafter{\lastcolordefs}%
   \mark{%
-                   \the\toks0 \the\toks2
-      \noexpand\or \the\toks4 \the\toks6
-    \noexpand\else \the\toks8
+                   \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
+      \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
+    \noexpand\else \the\toks8             % 2: color marks
   }%
 }
+
+% \gettopheadingmarks, \getbottomheadingmarks,
+% \getcolormarks - extract needed part of mark.
+%
 % \topmark doesn't work for the very first chapter (after the title
 % page or the contents), so we use \firstmark there -- this gets us
 % the mark with the chapter defs, unless the user sneaks in, e.g.,
 % Avoid "undefined control sequence" errors.
 \def\lastchapterdefs{}
 \def\lastsectiondefs{}
+\def\lastsection{}
 \def\prevchapterdefs{}
 \def\prevsectiondefs{}
 \def\lastcolordefs{}
 
+% Margin to add to right of even pages, to left of odd pages.
+\newdimen\bindingoffset
+\newdimen\normaloffset
+\newdimen\txipagewidth \newdimen\txipageheight
+
 % Main output routine.
+%
 \chardef\PAGE = 255
 \output = {\onepageout{\pagecontents\PAGE}}
 
 \newbox\headlinebox
 \newbox\footlinebox
 
-% \onepageout takes a vbox as an argument.  Note that \pagecontents
-% does insertions, but you have to call it yourself.
+% \onepageout takes a vbox as an argument.
+% \shipout a vbox for a single page, adding an optional header, footer,
+% cropmarks, and footnote.  This also causes index entries for this page
+% to be written to the auxiliary files.
+%
 \def\onepageout#1{%
   \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
   %
   \ifodd\pageno  \advance\hoffset by \bindingoffset
   \else \advance\hoffset by -\bindingoffset\fi
   %
+  % Common context changes for both heading and footing.
   % Do this outside of the \shipout so @code etc. will be expanded in
   % the headline as they should be, not taken literally (outputting ''code).
+  \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
+  %
+  % Retrieve the information for the headings from the marks in the page,
+  % and call Plain TeX's \makeheadline and \makefootline, which use the
+  % values in \headline and \footline.
+  %
+  % This is used to check if we are on the first page of a chapter.
+  \ifcase1\topmark\fi
+  \let\prevchaptername\thischaptername
+  \ifcase0\firstmark\fi
+  \let\curchaptername\thischaptername
+  %
   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
-  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
-  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
+  %
+  \ifx\curchaptername\prevchaptername
+    \let\thischapterheading\thischapter
+  \else
+    % \thischapterheading is the same as \thischapter except it is blank
+    % for the first page of a chapter.  This is to prevent the chapter name 
+    % being shown twice.
+    \def\thischapterheading{}%
+  \fi
+  %
+  \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
+  \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
   %
   {%
+    % Set context for writing to auxiliary files like index files.
     % Have to do this stuff outside the \shipout because we want it to
     % take effect in \write's, yet the group defined by the \vbox ends
     % before the \shipout runs.
     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
                % the page break happens to be in the middle of an example.
                % We don't want .vr (or whatever) entries like this:
-               % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
+               % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
                % "\acronym" won't work when it's read back in;
                % it needs to be
-               % {\code {{\tt \backslashcurfont }acronym}
+               % {\code {{\backslashcurfont }acronym}
     \shipout\vbox{%
       % Do this early so pdf references go to the beginning of the page.
       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
 
 \newinsert\margin \dimen\margin=\maxdimen
 
-\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
+% Main part of page, including any footnotes
+\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
 {\catcode`\@ =11
 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
 % marginal hacks, juha@viisa.uucp (Juha Takala)
 \def\nsbot{\vbox
   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
 
+
+% Argument parsing
+
 % Parse an argument, then pass it to #1.  The argument is the rest of
 % the input line (except we remove a trailing comment).  #1 should be a
 % macro which expects an ordinary undelimited TeX argument.
+% For example, \def\foo{\parsearg\fooxxx}.
 %
 \def\parsearg{\parseargusing{}}
 \def\parseargusing#1#2{%
   }%
 }
 
-% First remove any @comment, then any @c comment.
+% First remove any @comment, then any @c comment.  Also remove a @texinfoc
+% comment (see \scanmacro for details).  Pass the result on to \argcheckspaces.
 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
-\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
+\def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
 
 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
 %
 %
 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
 
+
+% \parseargdef - define a command taking an argument on the line
+%
 % \parseargdef\foo{...}
 %      is roughly equivalent to
 % \def\foo{\parsearg\Xfoo}
 % \def\Xfoo#1{...}
-%
-% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
-% favourite TeX trick.  --kasal, 16nov03
-
 \def\parseargdef#1{%
   \expandafter \doparseargdef \csname\string#1\endcsname #1%
 }
     \endgraf % Not \par, as it may have been set to \lisppar.
     \global\dimen1 = \prevdepth
   \egroup           % End the \vtop.
+  \addgroupbox
+  \prevdepth = \dimen1
+  \checkinserts
+}
+
+\def\addgroupbox{
   % \dimen0 is the vertical size of the group's box.
   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
   % \dimen2 is how much space is left on the page (more or less).
-  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
+  \dimen2 = \txipageheight   \advance\dimen2 by -\pagetotal
   % if the group doesn't fit on the current page, and it's a big big
   % group, force a page break.
   \ifdim \dimen0 > \dimen2
-    \ifdim \pagetotal < \vfilllimit\pageheight
+    \ifdim \pagetotal < \vfilllimit\txipageheight
       \page
     \fi
   \fi
   \box\groupbox
-  \prevdepth = \dimen1
-  \checkinserts
 }
+
 %
 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
 % message, so this ends up printing `@group can only ...'.
@@ -812,36 +865,6 @@ where each line of input produces a line of output.}
   \temp
 }
 
-% @| inserts a changebar to the left of the current line.  It should
-% surround any changed text.  This approach does *not* work if the
-% change spans more than two lines of output.  To handle that, we would
-% have adopt a much more difficult approach (putting marks into the main
-% vertical list for the beginning and end of each change).  This command
-% is not documented, not supported, and doesn't work.
-%
-\def\|{%
-  % \vadjust can only be used in horizontal mode.
-  \leavevmode
-  %
-  % Append this vertical mode material after the current line in the output.
-  \vadjust{%
-    % We want to insert a rule with the height and depth of the current
-    % leading; that is exactly what \strutbox is supposed to record.
-    \vskip-\baselineskip
-    %
-    % \vadjust-items are inserted at the left edge of the type.  So
-    % the \llap here moves out into the left-hand margin.
-    \llap{%
-      %
-      % For a thicker or thinner bar, change the `1pt'.
-      \vrule height\baselineskip width1pt
-      %
-      % This is the space between the bar and the text.
-      \hskip 12pt
-    }%
-  }%
-}
-
 % @include FILE -- \input text of FILE.
 %
 \def\include{\parseargusing\filenamecatcodes\includezzz}
@@ -930,13 +953,14 @@ where each line of input produces a line of output.}
 % @comment ...line which is ignored...
 % @c is the same as @comment
 % @ignore ... @end ignore  is another way to write a comment
-%
-\def\comment{\begingroup \catcode`\^^M=\other%
+
+
+\def\c{\begingroup \catcode`\^^M=\active%
 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
-\commentxxx}
-{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
+\cxxx}
+{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
 %
-\let\c=\comment
+\let\comment\c
 
 % @paragraphindent NCHARS
 % We'll use ems for NCHARS, close enough.
@@ -1007,69 +1031,23 @@ where each line of input produces a line of output.}
 % paragraph.
 %
 \gdef\dosuppressfirstparagraphindent{%
-  \gdef\indent{%
-    \restorefirstparagraphindent
-    \indent
-  }%
-  \gdef\noindent{%
-    \restorefirstparagraphindent
-    \noindent
-  }%
-  \global\everypar = {%
-    \kern -\parindent
-    \restorefirstparagraphindent
-  }%
+  \gdef\indent  {\restorefirstparagraphindent \indent}%
+  \gdef\noindent{\restorefirstparagraphindent \noindent}%
+  \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
 }
-
+%
 \gdef\restorefirstparagraphindent{%
-  \global \let \indent = \ptexindent
-  \global \let \noindent = \ptexnoindent
-  \global \everypar = {}%
+  \global\let\indent = \ptexindent
+  \global\let\noindent = \ptexnoindent
+  \global\everypar = {}%
 }
 
 
 % @refill is a no-op.
 \let\refill=\relax
 
-% If working on a large document in chapters, it is convenient to
-% be able to disable indexing, cross-referencing, and contents, for test runs.
-% This is done with @novalidate (before @setfilename).
-%
-\newif\iflinks \linkstrue % by default we want the aux files.
-\let\novalidate = \linksfalse
-
-% @setfilename is done at the beginning of every texinfo file.
-% So open here the files we need to have open while reading the input.
-% This makes it possible to make a .fmt file for texinfo.
-\def\setfilename{%
-   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
-   \iflinks
-     \tryauxfile
-     % Open the new aux file.  TeX will close it automatically at exit.
-     \immediate\openout\auxfile=\jobname.aux
-   \fi % \openindices needs to do some work in any case.
-   \openindices
-   \let\setfilename=\comment % Ignore extra @setfilename cmds.
-   %
-   % If texinfo.cnf is present on the system, read it.
-   % Useful for site-wide @afourpaper, etc.
-   \openin 1 texinfo.cnf
-   \ifeof 1 \else \input texinfo.cnf \fi
-   \closein 1
-   %
-   \comment % Ignore the actual filename.
-}
-
-% Called from \setfilename.
-%
-\def\openindices{%
-  \newindex{cp}%
-  \newcodeindex{fn}%
-  \newcodeindex{vr}%
-  \newcodeindex{tp}%
-  \newcodeindex{ky}%
-  \newcodeindex{pg}%
-}
+% @setfilename INFO-FILENAME - ignored
+\let\setfilename=\comment
 
 % @bye.
 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
@@ -1087,10 +1065,91 @@ where each line of input produces a line of output.}
 \newtoks\toksC
 \newtoks\toksD
 \newbox\boxA
+\newbox\boxB
 \newcount\countA
 \newif\ifpdf
 \newif\ifpdfmakepagedest
 
+%
+% For LuaTeX
+%
+
+\newif\iftxiuseunicodedestname
+\txiuseunicodedestnamefalse % For pdfTeX etc.
+
+\ifx\luatexversion\thisisundefined
+\else
+  % Use Unicode destination names
+  \txiuseunicodedestnametrue
+  % Escape PDF strings with converting UTF-16 from UTF-8
+  \begingroup
+    \catcode`\%=12
+    \directlua{
+      function UTF16oct(str)
+        tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
+        for c in string.utfvalues(str) do
+          if c < 0x10000 then
+            tex.sprint(
+              string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
+                            string.char(0x5c) .. string.char(0x25) .. '03o',
+                            (c / 256), (c % 256)))
+          else
+            c = c - 0x10000
+            local c_hi = c / 1024 + 0xd800
+            local c_lo = c % 1024 + 0xdc00
+            tex.sprint(
+              string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
+                            string.char(0x5c) .. string.char(0x25) .. '03o' ..
+                            string.char(0x5c) .. string.char(0x25) .. '03o' ..
+                            string.char(0x5c) .. string.char(0x25) .. '03o',
+                            (c_hi / 256), (c_hi % 256),
+                            (c_lo / 256), (c_lo % 256)))
+          end
+        end
+      end
+    }
+  \endgroup
+  \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
+  % Escape PDF strings without converting
+  \begingroup
+    \directlua{
+      function PDFescstr(str)
+        for c in string.bytes(str) do
+          if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
+            tex.sprint(
+              string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
+                            c))
+          else
+            tex.sprint(string.char(c))
+          end
+        end
+      end
+    }
+  \endgroup
+  \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
+  \ifnum\luatexversion>84
+    % For LuaTeX >= 0.85
+    \def\pdfdest{\pdfextension dest}
+    \let\pdfoutput\outputmode
+    \def\pdfliteral{\pdfextension literal}
+    \def\pdfcatalog{\pdfextension catalog}
+    \def\pdftexversion{\numexpr\pdffeedback version\relax}
+    \let\pdfximage\saveimageresource
+    \let\pdfrefximage\useimageresource
+    \let\pdflastximage\lastsavedimageresourceindex
+    \def\pdfendlink{\pdfextension endlink\relax}
+    \def\pdfoutline{\pdfextension outline}
+    \def\pdfstartlink{\pdfextension startlink}
+    \def\pdffontattr{\pdfextension fontattr}
+    \def\pdfobj{\pdfextension obj}
+    \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
+    \let\pdfpagewidth\pagewidth
+    \let\pdfpageheight\pageheight
+    \edef\pdfhorigin{\pdfvariable horigin}
+    \edef\pdfvorigin{\pdfvariable vorigin}
+  \fi
+\fi
+
 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
 % can be set).  So we test for \relax and 0 as well as being undefined.
 \ifx\pdfoutput\thisisundefined
@@ -1121,12 +1180,21 @@ where each line of input produces a line of output.}
   \ifx\pdfescapestring\thisisundefined
     % No primitive available; should we give a warning or log?
     % Many times it won't matter.
+    \xdef#1{#1}%
   \else
     % The expandable \pdfescapestring primitive escapes parentheses,
     % backslashes, and other special chars.
     \xdef#1{\pdfescapestring{#1}}%
   \fi
 }
+\def\txiescapepdfutfsixteen#1{%
+  \ifx\pdfescapestrutfsixteen\thisisundefined
+    % No UTF-16 converting macro available.
+    \txiescapepdf{#1}%
+  \else
+    \xdef#1{\pdfescapestrutfsixteen{#1}}%
+  \fi
+}
 
 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
 with PDF output, and none of those formats could be found.  (.eps cannot
@@ -1135,15 +1203,17 @@ output) for that.)}
 
 \ifpdf
   %
-  % Color manipulation macros based on pdfcolor.tex,
+  % Color manipulation macros using ideas from pdfcolor.tex,
   % except using rgb instead of cmyk; the latter is said to render as a
   % very dark gray on-screen and a very dark halftone in print, instead
-  % of actual black.
+  % of actual black. The dark red here is dark enough to print on paper as
+  % nearly black, but still distinguishable for online viewing.  We use
+  % black by default, though.
   \def\rgbDarkRed{0.50 0.09 0.12}
   \def\rgbBlack{0 0 0}
   %
-  % k sets the color for filling (usual text, etc.);
-  % K sets the color for stroking (thin rules, e.g., normal _'s).
+  % rg sets the color for filling (usual text, etc.);
+  % RG sets the color for stroking (thin rules, e.g., normal _'s).
   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
   %
   % Set color, and create a mark which defines \thiscolor accordingly,
@@ -1234,24 +1304,83 @@ output) for that.)}
       \pdfrefximage \pdflastximage
     \fi}
   %
-  \def\pdfmkdest#1{{%
+  \def\setpdfdestname#1{{%
     % We have to set dummies so commands such as @code, and characters
     % such as \, aren't expanded when present in a section title.
     \indexnofonts
-    \turnoffactive
     \makevalueexpandable
+    \turnoffactive
+    \iftxiuseunicodedestname
+      \ifx \declaredencoding \latone
+        % Pass through Latin-1 characters.
+        % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
+      \else
+        \ifx \declaredencoding \utfeight
+          % Pass through Unicode characters.
+        \else
+          % Use ASCII approximations in destination names.
+          \passthroughcharsfalse
+        \fi
+      \fi
+    \else
+      % Use ASCII approximations in destination names.
+      \passthroughcharsfalse
+    \fi
     \def\pdfdestname{#1}%
     \txiescapepdf\pdfdestname
-    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   }}
   %
+  \def\setpdfoutlinetext#1{{%
+    \indexnofonts
+    \makevalueexpandable
+    \turnoffactive
+    \ifx \declaredencoding \latone
+      % The PDF format can use an extended form of Latin-1 in bookmark
+      % strings.  See Appendix D of the PDF Reference, Sixth Edition, for
+      % the "PDFDocEncoding".
+      \passthroughcharstrue
+      % Pass through Latin-1 characters.
+      %   LuaTeX: Convert to Unicode
+      %   pdfTeX: Use Latin-1 as PDFDocEncoding
+      \def\pdfoutlinetext{#1}%
+    \else
+      \ifx \declaredencoding \utfeight
+        \ifx\luatexversion\thisisundefined
+          % For pdfTeX  with UTF-8.
+          % TODO: the PDF format can use UTF-16 in bookmark strings,
+          % but the code for this isn't done yet.
+          % Use ASCII approximations.
+          \passthroughcharsfalse
+          \def\pdfoutlinetext{#1}%
+        \else
+          % For LuaTeX with UTF-8.
+          % Pass through Unicode characters for title texts.
+          \passthroughcharstrue
+          \def\pdfoutlinetext{#1}%
+        \fi
+      \else
+        % For non-Latin-1 or non-UTF-8 encodings.
+        % Use ASCII approximations.
+        \passthroughcharsfalse
+        \def\pdfoutlinetext{#1}%
+      \fi
+    \fi
+    % LuaTeX: Convert to UTF-16
+    % pdfTeX: Use Latin-1 as PDFDocEncoding
+    \txiescapepdfutfsixteen\pdfoutlinetext
+  }}
+  %
+  \def\pdfmkdest#1{%
+    \setpdfdestname{#1}%
+    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
+  }
+  %
   % used to mark target names; must be expandable.
   \def\pdfmkpgn#1{#1}
   %
-  % by default, use a color that is dark enough to print on paper as
-  % nearly black, but still distinguishable for online viewing.
-  \def\urlcolor{\rgbDarkRed}
-  \def\linkcolor{\rgbDarkRed}
+  % by default, use black for everything.
+  \def\urlcolor{\rgbBlack}
+  \def\linkcolor{\rgbBlack}
   \def\endlink{\setcolor{\maincolor}\pdfendlink}
   %
   % Adding outlines to PDF; macros for calculating structure of outlines
@@ -1273,18 +1402,13 @@ output) for that.)}
     % page number.  We could generate a destination for the section
     % text in the case where a section has no node, but it doesn't
     % seem worth the trouble, since most documents are normally structured.
-    \edef\pdfoutlinedest{#3}%
-    \ifx\pdfoutlinedest\empty
-      \def\pdfoutlinedest{#4}%
-    \else
-      \txiescapepdf\pdfoutlinedest
+    \setpdfoutlinetext{#1}
+    \setpdfdestname{#3}
+    \ifx\pdfdestname\empty
+      \def\pdfdestname{#4}%
     \fi
     %
-    % Also escape PDF chars in the display string.
-    \edef\pdfoutlinetext{#1}%
-    \txiescapepdf\pdfoutlinetext
-    %
-    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
+    \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
   }
   %
   \def\pdfmakeoutlines{%
@@ -1439,41 +1563,297 @@ output) for that.)}
   \let\pdfmakeoutlines = \relax
 \fi  % \ifx\pdfoutput
 
-
-\message{fonts,}
-
-% Change the current font style to #1, remembering it in \curfontstyle.
-% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
-% italics, not bold italics.
 %
-\def\setfontstyle#1{%
-  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
-  \csname ten#1\endcsname  % change the current font
-}
-
-% Select #1 fonts with the current style.
+% For XeTeX
 %
-\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
-
-\def\rm{\fam=0 \setfontstyle{rm}}
-\def\it{\fam=\itfam \setfontstyle{it}}
-\def\sl{\fam=\slfam \setfontstyle{sl}}
-\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
-\def\tt{\fam=\ttfam \setfontstyle{tt}}
-
-% Unfortunately, we have to override this for titles and the like, since
-% in those cases "rm" is bold.  Sigh.
-\def\rmisbold{\rm\def\curfontstyle{bf}}
+\ifx\XeTeXrevision\thisisundefined
+\else
+  %
+  % XeTeX version check
+  %
+  \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
+    % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
+    % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
+    % For avoiding PDF destination name replacement, we use this special
+    % instead of xdvipdfmx's command line option `-C 0x0010'.
+    \special{dvipdfmx:config C 0x0010}
+    % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
+    % It can handle Unicode destination names for PDF.
+    \txiuseunicodedestnametrue
+  \else
+    % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
+    % `dvipdfmx:config' special.
+    % So for avoiding PDF destination name replacement,
+    % xdvipdfmx's command line option `-C 0x0010' is necessary.
+    %
+    % XeTeX < 0.99995 can not handle Unicode destination names for PDF
+    % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
+    % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
+    \txiuseunicodedestnamefalse
+  \fi
+  %
+  % Color support
+  %
+  \def\rgbDarkRed{0.50 0.09 0.12}
+  \def\rgbBlack{0 0 0}
+  %
+  \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
+  %
+  % Set color, and create a mark which defines \thiscolor accordingly,
+  % so that \makeheadline knows which color to restore.
+  \def\setcolor#1{%
+    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
+    \domark
+    \pdfsetcolor{#1}%
+  }
+  %
+  \def\maincolor{\rgbBlack}
+  \pdfsetcolor{\maincolor}
+  \edef\thiscolor{\maincolor}
+  \def\lastcolordefs{}
+  %
+  \def\makefootline{%
+    \baselineskip24pt
+    \line{\pdfsetcolor{\maincolor}\the\footline}%
+  }
+  %
+  \def\makeheadline{%
+    \vbox to 0pt{%
+      \vskip-22.5pt
+      \line{%
+        \vbox to8.5pt{}%
+        % Extract \thiscolor definition from the marks.
+        \getcolormarks
+        % Typeset the headline with \maincolor, then restore the color.
+        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
+      }%
+      \vss
+    }%
+    \nointerlineskip
+  }
+  %
+  % PDF outline support
+  %
+  % Emulate pdfTeX primitive
+  \def\pdfdest name#1 xyz{%
+    \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
+  }
+  %
+  \def\setpdfdestname#1{{%
+    % We have to set dummies so commands such as @code, and characters
+    % such as \, aren't expanded when present in a section title.
+    \indexnofonts
+    \makevalueexpandable
+    \turnoffactive
+    \iftxiuseunicodedestname
+      % Pass through Unicode characters.
+    \else
+      % Use ASCII approximations in destination names.
+      \passthroughcharsfalse
+    \fi
+    \def\pdfdestname{#1}%
+    \txiescapepdf\pdfdestname
+  }}
+  %
+  \def\setpdfoutlinetext#1{{%
+    \turnoffactive
+    % Always use Unicode characters in title texts.
+    \def\pdfoutlinetext{#1}%
+    % For XeTeX, xdvipdfmx converts to UTF-16.
+    % So we do not convert.
+    \txiescapepdf\pdfoutlinetext
+  }}
+  %
+  \def\pdfmkdest#1{%
+    \setpdfdestname{#1}%
+    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
+  }
+  %
+  % by default, use black for everything.
+  \def\urlcolor{\rgbBlack}
+  \def\linkcolor{\rgbBlack}
+  \def\endlink{\setcolor{\maincolor}\pdfendlink}
+  %
+  \def\dopdfoutline#1#2#3#4{%
+    \setpdfoutlinetext{#1}
+    \setpdfdestname{#3}
+    \ifx\pdfdestname\empty
+      \def\pdfdestname{#4}%
+    \fi
+    %
+    \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
+      << /S /GoTo /D (\pdfdestname) >> >> }%
+  }
+  %
+  \def\pdfmakeoutlines{%
+    \begingroup
+      %
+      % For XeTeX, counts of subentries are not necessary.
+      % Therefore, we read toc only once.
+      %
+      % We use node names as destinations.
+      \def\partentry##1##2##3##4{}% ignore parts in the outlines
+      \def\numchapentry##1##2##3##4{%
+        \dopdfoutline{##1}{1}{##3}{##4}}%
+      \def\numsecentry##1##2##3##4{%
+        \dopdfoutline{##1}{2}{##3}{##4}}%
+      \def\numsubsecentry##1##2##3##4{%
+        \dopdfoutline{##1}{3}{##3}{##4}}%
+      \def\numsubsubsecentry##1##2##3##4{%
+        \dopdfoutline{##1}{4}{##3}{##4}}%
+      %
+      \let\appentry\numchapentry%
+      \let\appsecentry\numsecentry%
+      \let\appsubsecentry\numsubsecentry%
+      \let\appsubsubsecentry\numsubsubsecentry%
+      \let\unnchapentry\numchapentry%
+      \let\unnsecentry\numsecentry%
+      \let\unnsubsecentry\numsubsecentry%
+      \let\unnsubsubsecentry\numsubsubsecentry%
+      %
+      % For XeTeX, xdvipdfmx converts strings to UTF-16.
+      % Therefore, the encoding and the language may not be considered.
+      %
+      \indexnofonts
+      \setupdatafile
+      % We can have normal brace characters in the PDF outlines, unlike
+      % Texinfo index files.  So set that up.
+      \def\{{\lbracecharliteral}%
+      \def\}{\rbracecharliteral}%
+      \catcode`\\=\active \otherbackslash
+      \input \tocreadfilename
+    \endgroup
+  }
+  {\catcode`[=1 \catcode`]=2
+   \catcode`{=\other \catcode`}=\other
+   \gdef\lbracecharliteral[{]%
+   \gdef\rbracecharliteral[}]%
+  ]
 
-% Texinfo sort of supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf.
-\newfam\sffam
-\def\sf{\fam=\sffam \setfontstyle{sf}}
-\let\li = \sf % Sometimes we call it \li, not \sf.
+  \special{pdf:docview << /PageMode /UseOutlines >> }
+  % ``\special{pdf:tounicode ...}'' is not necessary
+  % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
+  % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
+  % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
+  % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
+%
+  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
+    \ifx\PP\D\let\nextsp\relax
+    \else\let\nextsp\skipspaces
+      \addtokens{\filename}{\PP}%
+      \advance\filenamelength by 1
+    \fi
+    \nextsp}
+  \def\getfilename#1{%
+    \filenamelength=0
+    % If we don't expand the argument now, \skipspaces will get
+    % snagged on things like "@value{foo}".
+    \edef\temp{#1}%
+    \expandafter\skipspaces\temp|\relax
+  }
+  % make a live url in pdf output.
+  \def\pdfurl#1{%
+    \begingroup
+      % it seems we really need yet another set of dummies; have not
+      % tried to figure out what each command should do in the context
+      % of @url.  for now, just make @/ a no-op, that's the only one
+      % people have actually reported a problem with.
+      %
+      \normalturnoffactive
+      \def\@{@}%
+      \let\/=\empty
+      \makevalueexpandable
+      % do we want to go so far as to use \indexnofonts instead of just
+      % special-casing \var here?
+      \def\var##1{##1}%
+      %
+      \leavevmode\setcolor{\urlcolor}%
+      \special{pdf:bann << /Border [0 0 0]
+        /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
+    \endgroup}
+  \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
+  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
+  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
+  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
+  \def\maketoks{%
+    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
+    \ifx\first0\adn0
+    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
+    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
+    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
+    \else
+      \ifnum0=\countA\else\makelink\fi
+      \ifx\first.\let\next=\done\else
+        \let\next=\maketoks
+        \addtokens{\toksB}{\the\toksD}
+        \ifx\first,\addtokens{\toksB}{\space}\fi
+      \fi
+    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+    \next}
+  \def\makelink{\addtokens{\toksB}%
+    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
+  \def\pdflink#1{%
+    \special{pdf:bann << /Border [0 0 0]
+      /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
+    \setcolor{\linkcolor}#1\endlink}
+  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+%
+  %
+  % @image support
+  %
+  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
+  \def\doxeteximage#1#2#3{%
+    \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
+    \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
+    %
+    % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
+    % others).  Let's try in that order, PDF first since if
+    % someone has a scalable image, presumably better to use that than a
+    % bitmap.
+    \let\xeteximgext=\empty
+    \begingroup
+      \openin 1 #1.pdf \ifeof 1
+        \openin 1 #1.PDF \ifeof 1
+          \openin 1 #1.png \ifeof 1
+            \openin 1 #1.jpg \ifeof 1
+              \openin 1 #1.jpeg \ifeof 1
+                \openin 1 #1.JPG \ifeof 1
+                  \errmessage{Could not find image file #1 for XeTeX}%
+                \else \gdef\xeteximgext{JPG}%
+                \fi
+              \else \gdef\xeteximgext{jpeg}%
+              \fi
+            \else \gdef\xeteximgext{jpg}%
+            \fi
+          \else \gdef\xeteximgext{png}%
+          \fi
+        \else \gdef\xeteximgext{PDF}%
+        \fi
+      \else \gdef\xeteximgext{pdf}%
+      \fi
+      \closein 1
+    \endgroup
+    %
+    \def\xetexpdfext{pdf}%
+    \ifx\xeteximgext\xetexpdfext
+      \XeTeXpdffile "#1".\xeteximgext ""
+    \else
+      \def\xetexpdfext{PDF}%
+      \ifx\xeteximgext\xetexpdfext
+        \XeTeXpdffile "#1".\xeteximgext ""
+      \else
+        \XeTeXpicfile "#1".\xeteximgext ""
+      \fi
+    \fi
+    \ifdim \wd0 >0pt width \xeteximagewidth \fi
+    \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
+  }
+\fi
 
-% We don't need math for this font style.
-\def\ttsl{\setfontstyle{ttsl}}
 
+%
+\message{fonts,}
 
 % Set the baselineskip to #1, and the lineskip and strut size
 % correspondingly.  There is no deep meaning behind these magic numbers
@@ -1822,8 +2202,10 @@ end
 % A few fonts for @defun names and args.
 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
+\setfont\defsl\slshape{10}{\magstep1}{OT1TT}
 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
+\def\df{\let\ttfont=\deftt \let\bffont = \defbf
+\let\ttslfont=\defttsl \let\slfont=\defsl \bf}
 
 % Fonts for indices, footnotes, small examples (9pt).
 \def\smallnominalsize{9pt}
@@ -1884,6 +2266,7 @@ end
 % Section fonts (14.4pt).
 \def\secnominalsize{14pt}
 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
+\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
@@ -1909,7 +2292,7 @@ end
 \font\ssecsy=cmsy10 scaled 1315
 \def\ssececsize{1200}
 
-% Reduced fonts for @acro in text (10pt).
+% Reduced fonts for @acronym in text (10pt).
 \def\reducednominalsize{10pt}
 \setfont\reducedrm\rmshape{10}{1000}{OT1}
 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
@@ -1953,8 +2336,10 @@ end
 % A few fonts for @defun names and args.
 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
+\setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
+\def\df{\let\ttfont=\deftt \let\bffont = \defbf
+\let\slfont=\defsl \let\ttslfont=\defttsl \bf}
 
 % Fonts for indices, footnotes, small examples (9pt).
 \def\smallnominalsize{9pt}
@@ -2040,7 +2425,7 @@ end
 \font\ssecsy=cmsy10
 \def\ssececsize{1000}
 
-% Reduced fonts for @acro in text (9pt).
+% Reduced fonts for @acronym in text (9pt).
 \def\reducednominalsize{9pt}
 \setfont\reducedrm\rmshape{9}{1000}{OT1}
 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
@@ -2060,6 +2445,12 @@ end
 \rm
 } % end of 10pt text font size definitions, \definetextfontsizex
 
+% Fonts for short table of contents.
+\setfont\shortcontrm\rmshape{12}{1000}{OT1}
+\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
+\setfont\shortcontsl\slshape{12}{1000}{OT1}
+\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
+
 
 % We provide the user-level command
 %   @fonttextsize 10
@@ -2086,102 +2477,111 @@ end
  \endgroup
 }
 
+%
+% Change the current font style to #1, remembering it in \curfontstyle.
+% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
+% italics, not bold italics.
+%
+\def\setfontstyle#1{%
+  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
+  \csname #1font\endcsname  % change the current font
+}
+
+\def\rm{\fam=0 \setfontstyle{rm}}
+\def\it{\fam=\itfam \setfontstyle{it}}
+\def\sl{\fam=\slfam \setfontstyle{sl}}
+\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
+\def\tt{\fam=\ttfam \setfontstyle{tt}}
+
+% Texinfo sort of supports the sans serif font style, which plain TeX does not.
+% So we set up a \sf.
+\newfam\sffam
+\def\sf{\fam=\sffam \setfontstyle{sf}}
+
+% We don't need math for this font style.
+\def\ttsl{\setfontstyle{ttsl}}
+
 
 % In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families.  Since
-% texinfo doesn't allow for producing subscripts and superscripts except
-% in the main text, we don't bother to reset \scriptfont and
-% \scriptscriptfont (which would also require loading a lot more fonts).
+% we have to define the \textfont of the standard families.  We don't
+% bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
 %
 \def\resetmathfonts{%
-  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
-  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
-  \textfont\ttfam=\tentt \textfont\sffam=\tensf
+  \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
+  \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
+  \textfont\ttfam=\ttfont \textfont\sffam=\sffont
 }
 
-% The font-changing commands redefine the meanings of \tenSTYLE, instead
-% of just \STYLE.  We do this because \STYLE needs to also set the
-% current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
-% \tenSTYLE to set the current font.
+%
+
+% The font-changing commands (all called \...fonts) redefine the meanings
+% of \STYLEfont, instead of just \STYLE.  We do this because \STYLE needs
+% to also set the current \fam for math mode.  Our \STYLE (e.g., \rm)
+% commands hardwire \STYLEfont to set the current font.
 %
 % Each font-changing command also sets the names \lsize (one size lower)
-% and \lllsize (three sizes lower).  These relative commands are used in
-% the LaTeX logo and acronyms.
+% and \lllsize (three sizes lower).  These relative commands are used
+% in, e.g., the LaTeX logo and acronyms.
 %
 % This all needs generalizing, badly.
 %
-\def\textfonts{%
-  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
-  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
-  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
-  \let\tenttsl=\textttsl
-  \def\curfontsize{text}%
-  \def\lsize{reduced}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{\textleading}}
-\def\titlefonts{%
-  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
-  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
-  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
-  \let\tenttsl=\titlettsl
-  \def\curfontsize{title}%
-  \def\lsize{chap}\def\lllsize{subsec}%
-  \resetmathfonts \setleading{27pt}}
-\def\titlefont#1{{\titlefonts\rmisbold #1}}
-\def\chapfonts{%
-  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
-  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
-  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
-  \let\tenttsl=\chapttsl
-  \def\curfontsize{chap}%
-  \def\lsize{sec}\def\lllsize{text}%
-  \resetmathfonts \setleading{19pt}}
-\def\secfonts{%
-  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
-  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
-  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
-  \let\tenttsl=\secttsl
-  \def\curfontsize{sec}%
-  \def\lsize{subsec}\def\lllsize{reduced}%
-  \resetmathfonts \setleading{16pt}}
-\def\subsecfonts{%
-  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
-  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
-  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
-  \let\tenttsl=\ssecttsl
-  \def\curfontsize{ssec}%
-  \def\lsize{text}\def\lllsize{small}%
-  \resetmathfonts \setleading{15pt}}
-\let\subsubsecfonts = \subsecfonts
-\def\reducedfonts{%
-  \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
-  \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
-  \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
-  \let\tenttsl=\reducedttsl
-  \def\curfontsize{reduced}%
-  \def\lsize{small}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{10.5pt}}
-\def\smallfonts{%
-  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
-  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
-  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
-  \let\tenttsl=\smallttsl
-  \def\curfontsize{small}%
-  \def\lsize{smaller}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{10.5pt}}
-\def\smallerfonts{%
-  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
-  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
-  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
-  \let\tenttsl=\smallerttsl
-  \def\curfontsize{smaller}%
-  \def\lsize{smaller}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{9.5pt}}
 
-% Fonts for short table of contents.
-\setfont\shortcontrm\rmshape{12}{1000}{OT1}
-\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
-\setfont\shortcontsl\slshape{12}{1000}{OT1}
-\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
+\def\assignfonts#1{%
+  \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
+  \expandafter\let\expandafter\itfont\csname #1it\endcsname
+  \expandafter\let\expandafter\slfont\csname #1sl\endcsname
+  \expandafter\let\expandafter\bffont\csname #1bf\endcsname
+  \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
+  \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
+  \expandafter\let\expandafter\sffont  \csname #1sf\endcsname
+  \expandafter\let\expandafter\ifont   \csname #1i\endcsname
+  \expandafter\let\expandafter\syfont  \csname #1sy\endcsname
+  \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
+}
+
+\newif\ifrmisbold
+
+% Select smaller font size with the current style.  Used to change font size
+% in, e.g., the LaTeX logo and acronyms.  If we are using bold fonts for
+% normal roman text, also use bold fonts for roman text in the smaller size.
+\def\switchtolllsize{%
+   \expandafter\assignfonts\expandafter{\lllsize}%
+   \ifrmisbold
+     \let\rmfont\bffont
+   \fi
+   \csname\curfontstyle\endcsname
+}%
+
+\def\switchtolsize{%
+   \expandafter\assignfonts\expandafter{\lsize}%
+   \ifrmisbold
+     \let\rmfont\bffont
+   \fi
+   \csname\curfontstyle\endcsname
+}%
+
+\def\definefontsetatsize#1#2#3#4#5{%
+\expandafter\def\csname #1fonts\endcsname{%
+  \def\curfontsize{#1}%
+  \def\lsize{#2}\def\lllsize{#3}%
+  \csname rmisbold#5\endcsname
+  \assignfonts{#1}%
+  \resetmathfonts
+  \setleading{#4}%
+}}
+
+\definefontsetatsize{text}   {reduced}{smaller}{\textleading}{false}
+\definefontsetatsize{title}  {chap}   {subsec} {27pt}  {true}
+\definefontsetatsize{chap}   {sec}    {text}   {19pt}  {true}
+\definefontsetatsize{sec}    {subsec} {reduced}{17pt}  {true}
+\definefontsetatsize{ssec}   {text}   {small}  {15pt}  {true}
+\definefontsetatsize{reduced}{small}  {smaller}{10.5pt}{false}
+\definefontsetatsize{small}  {smaller}{smaller}{10.5pt}{false}
+\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
+
+\def\titlefont#1{{\titlefonts\rm #1}}
+\let\subsecfonts = \ssecfonts
+\let\subsubsecfonts = \ssecfonts
 
 % Define these just so they can be easily changed for other fonts.
 \def\angleleft{$\langle$}
@@ -2377,8 +2777,10 @@ end
   \ifx\next,%
   \else\ifx\next-%
   \else\ifx\next.%
+  \else\ifx\next\.%
+  \else\ifx\next\comma%
   \else\ptexslash
-  \fi\fi\fi
+  \fi\fi\fi\fi\fi
   \aftersmartic
 }
 
@@ -2426,8 +2828,8 @@ end
 %
 \catcode`@=11
   \def\plainfrenchspacing{%
-    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
-    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
+    \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
+    \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
     \def\endofsentencespacefactor{1000}% for @. and friends
   }
   \def\plainnonfrenchspacing{%
@@ -2475,14 +2877,14 @@ end
 }
 
 % We *must* turn on hyphenation at `-' and `_' in @code.
+% (But see \codedashfinish below.)
 % Otherwise, it is too hard to avoid overfull hboxes
 % in the Emacs manual, the Library manual, etc.
 %
 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
 % both hyphenation at - and hyphenation within words.
 % We must therefore turn them both off (\tclose does that)
-% and arrange explicitly to hyphenate at a dash.
-%  -- rms.
+% and arrange explicitly to hyphenate at a dash. -- rms.
 {
   \catcode`\-=\active \catcode`\_=\active
   \catcode`\'=\active \catcode`\`=\active
@@ -2496,17 +2898,38 @@ end
      \let-\codedash
      \let_\codeunder
     \else
-     \let-\realdash
+     \let-\normaldash
      \let_\realunder
     \fi
+    % Given -foo (with a single dash), we do not want to allow a break
+    % after the hyphen.
+    \global\let\codedashprev=\codedash
+    %
     \codex
   }
+  %
+  \gdef\codedash{\futurelet\next\codedashfinish}
+  \gdef\codedashfinish{%
+    \normaldash % always output the dash character itself.
+    % 
+    % Now, output a discretionary to allow a line break, unless
+    % (a) the next character is a -, or
+    % (b) the preceding character is a -.
+    % E.g., given --posix, we do not want to allow a break after either -.
+    % Given --foo-bar, we do want to allow a break between the - and the b.
+    \ifx\next\codedash \else
+      \ifx\codedashprev\codedash 
+      \else \discretionary{}{}{}\fi
+    \fi
+    % we need the space after the = for the case when \next itself is a
+    % space token; it would get swallowed otherwise.  As in @code{- a}.
+    \global\let\codedashprev= \next
+  }
 }
-
+\def\normaldash{-}
+%
 \def\codex #1{\tclose{#1}\endgroup}
 
-\def\realdash{-}
-\def\codedash{-\discretionary{}{}{}}
 \def\codeunder{%
   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
@@ -2520,9 +2943,9 @@ end
 }
 
 % An additional complication: the above will allow breaks after, e.g.,
-% each of the four underscores in __typeof__.  This is undesirable in
-% some manuals, especially if they don't have long identifiers in
-% general.  @allowcodebreaks provides a way to control this.
+% each of the four underscores in __typeof__.  This is bad.
+% @allowcodebreaks provides a document-level way to turn breaking at -
+% and _ on and off.
 %
 \newif\ifallowcodebreaks  \allowcodebreakstrue
 
@@ -2548,37 +2971,21 @@ end
 \let\file=\code
 \let\option=\code
 
-% @uref (abbreviation for `urlref') takes an optional (comma-separated)
-% second argument specifying the text to display and an optional third
-% arg as text to display instead of (rather than in addition to) the url
-% itself.  First (mandatory) arg is the url.
-% (This \urefnobreak definition isn't used now, leaving it for a while
-% for comparison.)
-\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
-\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
-  \unsepspaces
-  \pdfurl{#1}%
-  \setbox0 = \hbox{\ignorespaces #3}%
-  \ifdim\wd0 > 0pt
-    \unhbox0 % third arg given, show only that
-  \else
-    \setbox0 = \hbox{\ignorespaces #2}%
-    \ifdim\wd0 > 0pt
-      \ifpdf
-        \unhbox0             % PDF: 2nd arg given, show only it
-      \else
-        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
-      \fi
-    \else
-      \code{#1}% only url given, so show it
-    \fi
-  \fi
-  \endlink
-\endgroup}
+% @uref (abbreviation for `urlref') aka @url takes an optional
+% (comma-separated) second argument specifying the text to display and
+% an optional third arg as text to display instead of (rather than in
+% addition to) the url itself.  First (mandatory) arg is the url.
 
-% This \urefbreak definition is the active one.
+% TeX-only option to allow changing PDF output to show only the second
+% arg (if given), and not the url (which is then just the link target).
+\newif\ifurefurlonlylink
+
+% The main macro is \urefbreak, which allows breaking at expected
+% places within the url.  (There used to be another version, which
+% didn't support automatic breaking.)
 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
 \let\uref=\urefbreak
+%
 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
   \unsepspaces
@@ -2587,12 +2994,32 @@ end
   \ifdim\wd0 > 0pt
     \unhbox0 % third arg given, show only that
   \else
-    \setbox0 = \hbox{\ignorespaces #2}%
+    \setbox0 = \hbox{\ignorespaces #2}% look for second arg
     \ifdim\wd0 > 0pt
       \ifpdf
-        \unhbox0             % PDF: 2nd arg given, show only it
+        % For pdfTeX and LuaTeX
+        \ifurefurlonlylink
+          % PDF plus option to not display url, show just arg
+          \unhbox0             
+        \else
+          % PDF, normally display both arg and url for consistency,
+          % visibility, if the pdf is eventually used to print, etc.
+          \unhbox0\ (\urefcode{#1})%
+        \fi
       \else
-        \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
+        \ifx\XeTeXrevision\thisisundefined
+          \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
+        \else
+          % For XeTeX
+          \ifurefurlonlylink
+            % PDF plus option to not display url, show just arg
+            \unhbox0             
+          \else
+            % PDF, normally display both arg and url for consistency,
+            % visibility, if the pdf is eventually used to print, etc.
+            \unhbox0\ (\urefcode{#1})%
+          \fi
+        \fi
       \fi
     \else
       \urefcode{#1}% only url given, so show it
@@ -2603,9 +3030,9 @@ end
 
 % Allow line breaks around only a few characters (only).
 \def\urefcatcodes{%
-  \catcode\ampChar=\active   \catcode\dotChar=\active
-  \catcode\hashChar=\active  \catcode\questChar=\active
-  \catcode\slashChar=\active
+  \catcode`\&=\active \catcode`\.=\active
+  \catcode`\#=\active \catcode`\?=\active
+  \catcode`\/=\active
 }
 {
   \urefcatcodes
@@ -2632,8 +3059,10 @@ end
 % we put a little stretch before and after the breakable chars, to help
 % line breaking of long url's.  The unequal skips make look better in
 % cmtt at least, especially for dots.
-\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
-\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
+\def\urefprestretchamount{.13em}
+\def\urefpoststretchamount{.1em}
+\def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
+\def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
 %
 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
 \def\urefcodedot{\urefprestretch .\urefpoststretch}
@@ -2691,7 +3120,18 @@ end
     \endlink
   \endgroup}
 \else
-  \let\email=\uref
+  \ifx\XeTeXrevision\thisisundefined
+    \let\email=\uref
+  \else
+    \def\email#1{\doemail#1,,\finish}
+    \def\doemail#1,#2,#3\finish{\begingroup
+      \unsepspaces
+      \pdfurl{mailto:#1}%
+      \setbox0 = \hbox{\ignorespaces #2}%
+      \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
+      \endlink
+    \endgroup}
+  \fi
 \fi
 
 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
@@ -2760,18 +3200,13 @@ end
 %
 \def\dmn#1{\thinspace #1}
 
-% @l was never documented to mean ``switch to the Lisp font'',
-% and it is not used as such in any manual I can find.  We need it for
-% Polish suppressed-l.  --karl, 22sep96.
-%\def\l#1{{\li #1}\null}
-
 % @acronym for "FBI", "NATO", and the like.
 % We print this one point size smaller, since it's intended for
 % all-uppercase.
 %
 \def\acronym#1{\doacronym #1,,\finish}
 \def\doacronym#1,#2,#3\finish{%
-  {\selectfonts\lsize #1}%
+  {\switchtolsize #1}%
   \def\temp{#2}%
   \ifx\temp\empty \else
     \space ({\unsepspaces \ignorespaces \temp \unskip})%
@@ -2817,21 +3252,24 @@ end
 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
 %
 \def\math{%
-  \tex
-  \mathunderscore
-  \let\\ = \mathbackslash
-  \mathactive
-  % make the texinfo accent commands work in math mode
-  \let\"=\ddot
-  \let\'=\acute
-  \let\==\bar
-  \let\^=\hat
-  \let\`=\grave
-  \let\u=\breve
-  \let\v=\check
-  \let\~=\tilde
-  \let\dotaccent=\dot
-  $\finishmath
+  \ifmmode\else % only go into math if not in math mode already
+    \tex
+    \mathunderscore
+    \let\\ = \mathbackslash
+    \mathactive
+    % make the texinfo accent commands work in math mode
+    \let\"=\ddot
+    \let\'=\acute
+    \let\==\bar
+    \let\^=\hat
+    \let\`=\grave
+    \let\u=\breve
+    \let\v=\check
+    \let\~=\tilde
+    \let\dotaccent=\dot
+    % have to provide another name for sup operator
+    \let\mathopsup=\sup
+  $\expandafter\finishmath\fi
 }
 \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
 
@@ -2854,8 +3292,17 @@ end
   }
 }
 
-% ctrl is no longer a Texinfo command, but leave this definition for fun.
-\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+% for @sub and @sup, if in math mode, just do a normal sub/superscript.
+% If in text, use math to place as sub/superscript, but switch
+% into text mode, with smaller fonts.  This is a different font than the
+% one used for real math sub/superscripts (8pt vs. 7pt), but let's not
+% fix it (significant additions to font machinery) until someone notices.
+%
+\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
+\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
+%
+\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
+\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
 
 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
@@ -2868,6 +3315,15 @@ end
   \def\inlinefmtname{#1}%
   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
 }
+% 
+% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
+% FMTNAME is tex, else ELSE-TEXT.
+\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
+\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
+  \def\inlinefmtname{#1}%
+  \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
+}
+%
 % For raw, must switch into @tex before parsing the argument, to avoid
 % setting catcodes prematurely.  Doing it this way means that, for
 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
@@ -2884,6 +3340,23 @@ end
   \endgroup % close group opened by \tex.
 }
 
+% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
+%
+\long\def\inlineifset#1{\doinlineifset #1,\finish}
+\long\def\doinlineifset#1,#2,\finish{%
+  \def\inlinevarname{#1}%
+  \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
+  \else\ignorespaces#2\fi
+}
+
+% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
+%
+\long\def\inlineifclear#1{\doinlineifclear #1,\finish}
+\long\def\doinlineifclear#1,#2,\finish{%
+  \def\inlinevarname{#1}%
+  \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
+}
+
 
 \message{glyphs,}
 % and logos.
@@ -2893,23 +3366,10 @@ end
 \let\atchar=\@
 
 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
-% Unless we're in typewriter, use \ecfont because the CM text fonts do
-% not have braces, and we don't want to switch into math.
-\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
-\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
-\let\{=\mylbrace \let\lbracechar=\{
-\let\}=\myrbrace \let\rbracechar=\}
-\begingroup
-  % Definitions to produce \{ and \} commands for indices,
-  % and @{ and @} for the aux/toc files.
-  \catcode`\{ = \other \catcode`\} = \other
-  \catcode`\[ = 1 \catcode`\] = 2
-  \catcode`\! = 0 \catcode`\\ = \other
-  !gdef!lbracecmd[\{]%
-  !gdef!rbracecmd[\}]%
-  !gdef!lbraceatcmd[@{]%
-  !gdef!rbraceatcmd[@}]%
-!endgroup
+\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
+\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
+\let\{=\lbracechar
+\let\}=\rbracechar
 
 % @comma{} to avoid , parsing problems.
 \let\comma = ,
@@ -2927,8 +3387,8 @@ end
 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
 \def\questiondown{?`}
 \def\exclamdown{!`}
-\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
-\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
+\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
+\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
 
 % Dotless i and dotless j, used for accents.
 \def\imacro{i}
@@ -2957,12 +3417,12 @@ end
   {\setbox0=\hbox{T}%
    \vbox to \ht0{\hbox{%
      \ifx\textnominalsize\xwordpt
-       % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
+       % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
        % Revert to plain's \scriptsize, which is 7pt.
        \count255=\the\fam $\fam\count255 \scriptstyle A$%
      \else
        % For 11pt, we can use our lllsize.
-       \selectfonts\lllsize A%
+       \switchtolllsize A%
      \fi
      }%
      \vss
@@ -2971,11 +3431,16 @@ end
   \TeX
 }
 
-% Some math mode symbols.
-\def\bullet{$\ptexbullet$}
-\def\geq{\ifmmode \ge\else $\ge$\fi}
-\def\leq{\ifmmode \le\else $\le$\fi}
-\def\minus{\ifmmode -\else $-$\fi}
+% Some math mode symbols.  Define \ensuremath to switch into math mode
+% unless we are already there.  Expansion tricks may not be needed here,
+% but safer, and can't hurt.
+\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
+\def\ensuredmath#1{$\relax#1$}
+%
+\def\bullet{\ensuremath\ptexbullet}
+\def\geq{\ensuremath\ge}
+\def\leq{\ensuremath\le}
+\def\minus{\ensuremath-}
 
 % @dots{} outputs an ellipsis using the current font.
 % We do .5em per period so that it has the same spacing in the cm
@@ -3023,7 +3488,7 @@ end
 %
 \newbox\errorbox
 %
-{\tentt \global\dimen0 = 3em}% Width of the box.
+{\ttfont \global\dimen0 = 3em}% Width of the box.
 \dimen2 = .55pt % Thickness of rules
 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
@@ -3139,8 +3604,15 @@ end
 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
 %
-% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
-\def\ecfont{%
+% Use the European Computer Modern fonts (cm-super in outline format)
+% for non-CM glyphs.  That is ec* for regular text and tc* for the text
+% companion symbols (LaTeX TS1 encoding).  Both are part of the ec
+% package and follow the same conventions.
+% 
+\def\ecfont{\etcfont{e}}
+\def\tcfont{\etcfont{t}}
+%
+\def\etcfont#1{%
   % We can't distinguish serif/sans and italic/slanted, but this
   % is used for crude hacks anyway (like adding French and German
   % quotes to documents typeset with CM, where we lose kerning), so
@@ -3149,14 +3621,14 @@ end
   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
   \ifmonospace
     % typewriter:
-    \font\thisecfont = ectt\ecsize \space at \nominalsize
+    \font\thisecfont = #1ctt\ecsize \space at \nominalsize
   \else
     \ifx\curfontstyle\bfstylename
       % bold:
-      \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
+      \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
     \else
       % regular:
-      \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+      \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
     \fi
   \fi
   \thisecfont
@@ -3167,7 +3639,7 @@ end
 % Adapted from the plain.tex definition of \copyright.
 %
 \def\registeredsymbol{%
-  $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
+  $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
                \hfil\crcr\Orb}}%
     }$%
 }
@@ -3200,13 +3672,16 @@ end
 \newif\ifseenauthor
 \newif\iffinishedtitlepage
 
-% Do an implicit @contents or @shortcontents after @end titlepage if the
-% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
-%
-\newif\ifsetcontentsaftertitlepage
- \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
-\newif\ifsetshortcontentsaftertitlepage
- \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
+% @setcontentsaftertitlepage used to do an implicit @contents or
+% @shortcontents after @end titlepage, but it is now obsolete.
+\def\setcontentsaftertitlepage{%
+  \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
+              command; move your @contents command if you want the contents
+              after the title page.}}%
+\def\setshortcontentsaftertitlepage{%
+  \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
+              command; move your @shortcontents and @contents commands if you 
+              want the contents after the title page.}}%
 
 \parseargdef\shorttitlepage{%
   \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
@@ -3248,20 +3723,6 @@ end
   % Need this before the \...aftertitlepage checks so that if they are
   % in effect the toc pages will come out with page numbers.
   \HEADINGSon
-  %
-  % If they want short, they certainly want long too.
-  \ifsetshortcontentsaftertitlepage
-    \shortcontents
-    \contents
-    \global\let\shortcontents = \relax
-    \global\let\contents = \relax
-  \fi
-  %
-  \ifsetcontentsaftertitlepage
-    \contents
-    \global\let\contents = \relax
-    \global\let\shortcontents = \relax
-  \fi
 }
 
 \def\finishtitlepage{%
@@ -3272,12 +3733,11 @@ end
 
 % Settings used for typesetting titles: no hyphenation, no indentation,
 % don't worry much about spacing, ragged right.  This should be used
-% inside a \vbox, and fonts need to be set appropriately first.  Because
-% it is always used for titles, nothing else, we call \rmisbold.  \par
-% should be specified before the end of the \vbox, since a vbox is a group.
+% inside a \vbox, and fonts need to be set appropriately first. \par should
+% be specified before the end of the \vbox, since a vbox is a group.
 % 
 \def\raggedtitlesettings{%
-  \rmisbold
+  \rm
   \hyphenpenalty=10000
   \parindent=0pt
   \tolerance=5000
@@ -3286,7 +3746,7 @@ end
 
 % Macros to be used within @titlepage:
 
-\let\subtitlerm=\tenrm
+\let\subtitlerm=\rmfont
 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
 
 \parseargdef\title{%
@@ -3312,7 +3772,7 @@ end
   \else
     \checkenv\titlepage
     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
-    {\secfonts\rmisbold \leftline{#1}}%
+    {\secfonts\rm \leftline{#1}}%
   \fi
 }
 
@@ -3326,7 +3786,7 @@ end
 \newtoks\evenfootline    % footline on even pages
 \newtoks\oddfootline     % footline on odd pages
 
-% Now make TeX use those variables
+% Now make \makeheadline and \makefootline in Plain TeX use those variables
 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
                             \else \the\evenheadline \fi}}
 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
@@ -3365,7 +3825,7 @@ end
   %
   % Leave some space for the footline.  Hopefully ok to assume
   % @evenfooting will not be used by itself.
-  \global\advance\pageheight by -12pt
+  \global\advance\txipageheight by -12pt
   \global\advance\vsize by -12pt
 }
 
@@ -3382,13 +3842,17 @@ end
 % @everyheadingmarks
 % @everyfootingmarks
 
+% These define \getoddheadingmarks, \getevenheadingmarks,
+% \getoddfootingmarks, and \getevenfootingmarks, each to one of
+% \gettopheadingmarks, \getbottomheadingmarks.
+%
 \def\evenheadingmarks{\headingmarks{even}{heading}}
 \def\oddheadingmarks{\headingmarks{odd}{heading}}
 \def\evenfootingmarks{\headingmarks{even}{footing}}
 \def\oddfootingmarks{\headingmarks{odd}{footing}}
-\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
+\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
                           \headingmarks{odd}{heading}{#1} }
-\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
+\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
                           \headingmarks{odd}{footing}{#1} }
 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
 \def\headingmarks#1#2#3 {%
@@ -3409,7 +3873,7 @@ end
 % By default, they are off at the start of a document,
 % and turned `on' after @end titlepage.
 
-\def\headings #1 {\csname HEADINGS#1\endcsname}
+\parseargdef\headings{\csname HEADINGS#1\endcsname}
 
 \def\headingsoff{% non-global headings elimination
   \evenheadline={\hfil}\evenfootline={\hfil}%
@@ -3429,7 +3893,7 @@ end
 \global\evenfootline={\hfil}
 \global\oddfootline={\hfil}
 \global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapterheading\hfil\folio}}
 \global\let\contentsalignmacro = \chapoddpage
 }
 \let\contentsalignmacro = \chappager
@@ -3440,8 +3904,8 @@ end
 \global\pageno=1
 \global\evenfootline={\hfil}
 \global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\evenheadline={\line{\thischapterheading\hfil\folio}}
+\global\oddheadline={\line{\thischapterheading\hfil\folio}}
 \global\let\contentsalignmacro = \chappager
 }
 \def\HEADINGSon{\HEADINGSdouble}
@@ -3452,7 +3916,7 @@ end
 \global\evenfootline={\hfil}
 \global\oddfootline={\hfil}
 \global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapterheading\hfil\folio}}
 \global\let\contentsalignmacro = \chapoddpage
 }
 
@@ -3460,8 +3924,8 @@ end
 \def\HEADINGSsinglex{%
 \global\evenfootline={\hfil}
 \global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\evenheadline={\line{\thischapterheading\hfil\folio}}
+\global\oddheadline={\line{\thischapterheading\hfil\folio}}
 \global\let\contentsalignmacro = \chappager
 }
 
@@ -3639,7 +4103,7 @@ end
   \parskip=\smallskipamount
   \ifdim\parskip=0pt \parskip=2pt \fi
   %
-  % Try typesetting the item mark that if the document erroneously says
+  % Try typesetting the item mark so that if the document erroneously says
   % something like @itemize @samp (intending @table), there's an error
   % right away at the @itemize.  It's not the best error message in the
   % world, but it's better than leaving it to the @item.  This means if
@@ -3671,7 +4135,12 @@ end
    \noindent
    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
    %
-   \vadjust{\penalty 1200}}% not good to break after first line of item.
+   \ifinner\else
+     \vadjust{\penalty 1200}% not good to break after first line of item.
+   \fi
+   % We can be in inner vertical mode in a footnote, although an
+   % @itemize looks awful there.
+  }%
   \flushcr
 }
 
@@ -3889,19 +4358,23 @@ end
 }
 
 % multitable-only commands.
-%
-% @headitem starts a heading row, which we typeset in bold.
-% Assignments have to be global since we are inside the implicit group
-% of an alignment entry.  \everycr resets \everytab so we don't have to
+% 
+% @headitem starts a heading row, which we typeset in bold.  Assignments
+% have to be global since we are inside the implicit group of an
+% alignment entry.  \everycr below resets \everytab so we don't have to
 % undo it ourselves.
 \def\headitemfont{\b}% for people to use in the template row; not changeable
 \def\headitem{%
   \checkenv\multitable
   \crcr
+  \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
   \the\everytab % for the first item
 }%
 %
+% default for tables with no headings.
+\let\headitemcrhook=\relax
+%
 % A \tab used to include \hskip1sp.  But then the space in a template
 % line is not enough.  That is bad.  So let's go back to just `&' until
 % we again encounter the problem the 1sp was intended to solve.
@@ -3932,15 +4405,15 @@ end
   %
   \everycr = {%
     \noalign{%
-      \global\everytab={}%
+      \global\everytab={}% Reset from possible headitem.
       \global\colcount=0 % Reset the column counter.
-      % Check for saved footnotes, etc.
+      %
+      % Check for saved footnotes, etc.:
       \checkinserts
-      % Keeps underfull box messages off when table breaks over pages.
-      %\filbreak
-       % Maybe so, but it also creates really weird page breaks when the
-       % table breaks over pages. Wouldn't \vfil be better?  Wait until the
-       % problem manifests itself, so it can be fixed for real --karl.
+      %
+      % Perhaps a \nobreak, then reset:
+      \headitemcrhook
+      \global\let\headitemcrhook=\relax
     }%
   }%
   %
@@ -4179,7 +4652,7 @@ end
 \def\value{\begingroup\makevalueexpandable\valuexxx}
 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
 {
-  \catcode`\- = \active \catcode`\_ = \active
+  \catcode`\-=\active \catcode`\_=\active
   %
   \gdef\makevalueexpandable{%
     \let\value = \expandablevalue
@@ -4188,7 +4661,7 @@ end
     % ..., but we might end up with active ones in the argument if
     % we're called from @code, as @code{@value{foo-bar_}}, though.
     % So \let them to their normal equivalents.
-    \let-\realdash \let_\normalunderscore
+    \let-\normaldash \let_\normalunderscore
   }
 }
 
@@ -4199,7 +4672,12 @@ end
 % variable's value contains other Texinfo commands, it's almost certain
 % it will fail (although perhaps we could fix that with sufficient work
 % to do a one-level expansion on the result, instead of complete).
-%
+% 
+% Unfortunately, this has the consequence that when _ is in the *value*
+% of an @set, it does not print properly in the roman fonts (get the cmr
+% dot accent at position 126 instead).  No fix comes to mind, and it's
+% been this way since 2003 or earlier, so just ignore it.
+% 
 \def\expandablevalue#1{%
   \expandafter\ifx\csname SET#1\endcsname\relax
     {[No value for ``#1'']}%
@@ -4209,10 +4687,36 @@ end
   \fi
 }
 
+% Like \expandablevalue, but completely expandable (the \message in the
+% definition above operates at the execution level of TeX).  Used when
+% writing to auxiliary files, due to the expansion that \write does.
+% If flag is undefined, pass through an unexpanded @value command: maybe it 
+% will be set by the time it is read back in.
+%
+% NB flag names containing - or _ may not work here.
+\def\dummyvalue#1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    \noexpand\value{#1}%
+  \else
+    \csname SET#1\endcsname
+  \fi
+}
+
+% Used for @value's in index entries to form the sort key: expand the @value
+% if possible, otherwise sort late.
+\def\indexnofontsvalue#1{%
+  \expandafter\ifx\csname SET#1\endcsname\relax
+    ZZZZZZZ
+  \else
+    \csname SET#1\endcsname
+  \fi
+}
+
 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
 % with @set.
-%
-% To get special treatment of `@end ifset,' call \makeond and the redefine.
+% 
+% To get the special treatment we need for `@end ifset,' we call
+% \makecond and then redefine.
 %
 \makecond{ifset}
 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
@@ -4283,19 +4787,16 @@ end
 % except not \outer, so it can be used within macros and \if's.
 \edef\newwrite{\makecsname{ptexnewwrite}}
 
-% \newindex {foo} defines an index named foo.
-% It automatically defines \fooindex such that
-% \fooindex ...rest of line... puts an entry in the index foo.
-% It also defines \fooindfile to be the number of the output channel for
-% the file that accumulates this index.  The file's extension is foo.
+% \newindex {foo} defines an index named IX.
+% It automatically defines \IXindex such that
+% \IXindex ...rest of line... puts an entry in the index IX.
+% It also defines \IXindfile to be the number of the output channel for
+% the file that accumulates this index.  The file's extension is IX.
 % The name of an index should be no more than 2 characters long
 % for the sake of vms.
 %
 \def\newindex#1{%
-  \iflinks
-    \expandafter\newwrite \csname#1indfile\endcsname
-    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
-  \fi
+  \expandafter\chardef\csname#1indfile\endcsname=0
   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
     \noexpand\doindex{#1}}
 }
@@ -4309,14 +4810,19 @@ end
 \def\defcodeindex{\parsearg\newcodeindex}
 %
 \def\newcodeindex#1{%
-  \iflinks
-    \expandafter\newwrite \csname#1indfile\endcsname
-    \openout \csname#1indfile\endcsname \jobname.#1
-  \fi
+  \expandafter\chardef\csname#1indfile\endcsname=0
   \expandafter\xdef\csname#1index\endcsname{%
     \noexpand\docodeindex{#1}}%
 }
 
+% The default indices:
+\newindex{cp}%      concepts,
+\newcodeindex{fn}%  functions,
+\newcodeindex{vr}%  variables,
+\newcodeindex{tp}%  types,
+\newcodeindex{ky}%  keys
+\newcodeindex{pg}%  and programs.
+
 
 % @synindex foo bar    makes index foo feed into index bar.
 % Do this instead of @defindex foo if you don't want it as a separate index.
@@ -4330,14 +4836,7 @@ end
 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
 % #3 the target index (bar).
 \def\dosynindex#1#2#3{%
-  % Only do \closeout if we haven't already done it, else we'll end up
-  % closing the target index.
-  \expandafter \ifx\csname donesynindex#2\endcsname \relax
-    % The \closeout helps reduce unnecessary open files; the limit on the
-    % Acorn RISC OS is a mere 16 files.
-    \expandafter\closeout\csname#2indfile\endcsname
-    \expandafter\let\csname donesynindex#2\endcsname = 1
-  \fi
+  \requireopenindexfile{#3}%
   % redefine \fooindfile:
   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
   \expandafter\let\csname#2indfile\endcsname=\temp
@@ -4345,108 +4844,72 @@ end
   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
 }
 
-% Define \doindex, the driver for all \fooindex macros.
+% Define \doindex, the driver for all index macros.
 % Argument #1 is generated by the calling \fooindex macro,
-%  and it is "foo", the name of the index.
-
-% \doindex just uses \parsearg; it calls \doind for the actual work.
-% This is because \doind is more useful to call from other macros.
+% and it is the two-letter name of the index.
 
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-
-\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
-\def\singleindexer #1{\doind{\indexname}{#1}}
+\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
+\def\doindexxxx #1{\doind{\indexname}{#1}}
 
 % like the previous two, but they put @code around the argument.
-\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
-\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
+\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
 
-% Take care of Texinfo commands that can appear in an index entry.
-% Since there are some commands we want to expand, and others we don't,
-% we have to laboriously prevent expansion for those that we don't.
+\f
+% Used when writing an index entry out to an index file to prevent
+% expansion of Texinfo commands that can appear in an index entry.
 %
 \def\indexdummies{%
   \escapechar = `\\     % use backslash in output files.
-  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
-  \def\ {\realbackslash\space }%
-  %
-  % Need these unexpandable (because we define \tt as a dummy)
-  % definitions when @{ or @} appear in index entry text.  Also, more
-  % complicated, when \tex is in effect and \{ is a \delimiter again.
-  % We can't use \lbracecmd and \rbracecmd because texindex assumes
-  % braces and backslashes are used only as delimiters.  Perhaps we
-  % should define @lbrace and @rbrace commands a la @comma.
-  \def\{{{\tt\char123}}%
-  \def\}{{\tt\char125}}%
-  %
-  % I don't entirely understand this, but when an index entry is
-  % generated from a macro call, the \endinput which \scanmacro inserts
-  % causes processing to be prematurely terminated.  This is,
-  % apparently, because \indexsorttmp is fully expanded, and \endinput
-  % is an expandable command.  The redefinition below makes \endinput
-  % disappear altogether for that purpose -- although logging shows that
-  % processing continues to some further point.  On the other hand, it
-  % seems \endinput does not hurt in the printed index arg, since that
-  % is still getting written without apparent harm.
-  %
-  % Sample source (mac-idx3.tex, reported by Graham Percival to
-  % help-texinfo, 22may06):
-  % @macro funindex {WORD}
-  % @findex xyz
-  % @end macro
-  % ...
-  % @funindex commtest
-  %
-  % The above is not enough to reproduce the bug, but it gives the flavor.
-  %
-  % Sample whatsit resulting:
-  % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
-  %
-  % So:
-  \let\endinput = \empty
+  \definedummyletter\@%
+  \definedummyletter\ %
+  %
+  % For texindex which always views { and } as separators.
+  \def\{{\lbracechar{}}%
+  \def\}{\rbracechar{}}%
   %
   % Do the redefinitions.
-  \commondummies
+  \definedummies
 }
 
-% For the aux and toc files, @ is the escape character.  So we want to
-% redefine everything using @ as the escape character (instead of
-% \realbackslash, still used for index files).  When everything uses @,
-% this will be simpler.
+% Used for the aux and toc files, where @ is the escape character.
 %
 \def\atdummies{%
-  \def\@{@@}%
-  \def\ {@ }%
-  \let\{ = \lbraceatcmd
-  \let\} = \rbraceatcmd
+  \definedummyletter\@%
+  \definedummyletter\ %
+  \definedummyletter\{%
+  \definedummyletter\}%
   %
   % Do the redefinitions.
-  \commondummies
+  \definedummies
   \otherbackslash
 }
 
-% Called from \indexdummies and \atdummies.
+% \definedummyword defines \#1 as \string\#1\space, thus effectively
+% preventing its expansion.  This is used only for control words,
+% not control letters, because the \space would be incorrect for
+% control characters, but is needed to separate the control word
+% from whatever follows.
 %
-\def\commondummies{%
-  %
-  % \definedummyword defines \#1 as \string\#1\space, thus effectively
-  % preventing its expansion.  This is used only for control words,
-  % not control letters, because the \space would be incorrect for
-  % control characters, but is needed to separate the control word
-  % from whatever follows.
-  %
-  % For control letters, we have \definedummyletter, which omits the
-  % space.
-  %
-  % These can be used both for control words that take an argument and
-  % those that do not.  If it is followed by {arg} in the input, then
-  % that will dutifully get written to the index (or wherever).
-  %
-  \def\definedummyword  ##1{\def##1{\string##1\space}}%
-  \def\definedummyletter##1{\def##1{\string##1}}%
-  \let\definedummyaccent\definedummyletter
+% These can be used both for control words that take an argument and
+% those that do not.  If it is followed by {arg} in the input, then
+% that will dutifully get written to the index (or wherever).
+%
+% For control letters, we have \definedummyletter, which omits the
+% space.
+%
+\def\definedummyword  #1{\def#1{\string#1\space}}%
+\def\definedummyletter#1{\def#1{\string#1}}%
+\let\definedummyaccent\definedummyletter
+
+% Called from \indexdummies and \atdummies, to effectively prevent
+% the expansion of commands.
+%
+\def\definedummies{%
   %
+  \let\commondummyword\definedummyword
+  \let\commondummyletter\definedummyletter
+  \let\commondummyaccent\definedummyaccent
   \commondummiesnofonts
   %
   \definedummyletter\_%
@@ -4487,6 +4950,7 @@ end
   \definedummyword\TeX
   %
   % Assorted special characters.
+  \definedummyword\atchar
   \definedummyword\arrow
   \definedummyword\bullet
   \definedummyword\comma
@@ -4506,6 +4970,7 @@ end
   \definedummyword\guilsinglright
   \definedummyword\lbracechar
   \definedummyword\leq
+  \definedummyword\mathopsup
   \definedummyword\minus
   \definedummyword\ogonek
   \definedummyword\pounds
@@ -4519,88 +4984,136 @@ end
   \definedummyword\quotesinglbase
   \definedummyword\rbracechar
   \definedummyword\result
+  \definedummyword\sub
+  \definedummyword\sup
   \definedummyword\textdegree
   %
   % We want to disable all macros so that they are not expanded by \write.
   \macrolist
+  \let\value\dummyvalue
   %
   \normalturnoffactive
-  %
-  % Handle some cases of @value -- where it does not contain any
-  % (non-fully-expandable) commands.
-  \makevalueexpandable
 }
 
-% \commondummiesnofonts: common to \commondummies and \indexnofonts.
+% \commondummiesnofonts: common to \definedummies and \indexnofonts.
+% Define \commondummyletter, \commondummyaccent and \commondummyword before
+% using.  Used for accents, font commands, and various control letters.
 %
 \def\commondummiesnofonts{%
   % Control letters and accents.
-  \definedummyletter\!%
-  \definedummyaccent\"%
-  \definedummyaccent\'%
-  \definedummyletter\*%
-  \definedummyaccent\,%
-  \definedummyletter\.%
-  \definedummyletter\/%
-  \definedummyletter\:%
-  \definedummyaccent\=%
-  \definedummyletter\?%
-  \definedummyaccent\^%
-  \definedummyaccent\`%
-  \definedummyaccent\~%
-  \definedummyword\u
-  \definedummyword\v
-  \definedummyword\H
-  \definedummyword\dotaccent
-  \definedummyword\ogonek
-  \definedummyword\ringaccent
-  \definedummyword\tieaccent
-  \definedummyword\ubaraccent
-  \definedummyword\udotaccent
-  \definedummyword\dotless
+  \commondummyletter\!%
+  \commondummyaccent\"%
+  \commondummyaccent\'%
+  \commondummyletter\*%
+  \commondummyaccent\,%
+  \commondummyletter\.%
+  \commondummyletter\/%
+  \commondummyletter\:%
+  \commondummyaccent\=%
+  \commondummyletter\?%
+  \commondummyaccent\^%
+  \commondummyaccent\`%
+  \commondummyaccent\~%
+  \commondummyword\u
+  \commondummyword\v
+  \commondummyword\H
+  \commondummyword\dotaccent
+  \commondummyword\ogonek
+  \commondummyword\ringaccent
+  \commondummyword\tieaccent
+  \commondummyword\ubaraccent
+  \commondummyword\udotaccent
+  \commondummyword\dotless
   %
   % Texinfo font commands.
-  \definedummyword\b
-  \definedummyword\i
-  \definedummyword\r
-  \definedummyword\sansserif
-  \definedummyword\sc
-  \definedummyword\slanted
-  \definedummyword\t
+  \commondummyword\b
+  \commondummyword\i
+  \commondummyword\r
+  \commondummyword\sansserif
+  \commondummyword\sc
+  \commondummyword\slanted
+  \commondummyword\t
   %
   % Commands that take arguments.
-  \definedummyword\abbr
-  \definedummyword\acronym
-  \definedummyword\anchor
-  \definedummyword\cite
-  \definedummyword\code
-  \definedummyword\command
-  \definedummyword\dfn
-  \definedummyword\dmn
-  \definedummyword\email
-  \definedummyword\emph
-  \definedummyword\env
-  \definedummyword\file
-  \definedummyword\image
-  \definedummyword\indicateurl
-  \definedummyword\inforef
-  \definedummyword\kbd
-  \definedummyword\key
-  \definedummyword\math
-  \definedummyword\option
-  \definedummyword\pxref
-  \definedummyword\ref
-  \definedummyword\samp
-  \definedummyword\strong
-  \definedummyword\tie
-  \definedummyword\uref
-  \definedummyword\url
-  \definedummyword\var
-  \definedummyword\verb
-  \definedummyword\w
-  \definedummyword\xref
+  \commondummyword\abbr
+  \commondummyword\acronym
+  \commondummyword\anchor
+  \commondummyword\cite
+  \commondummyword\code
+  \commondummyword\command
+  \commondummyword\dfn
+  \commondummyword\dmn
+  \commondummyword\email
+  \commondummyword\emph
+  \commondummyword\env
+  \commondummyword\file
+  \commondummyword\image
+  \commondummyword\indicateurl
+  \commondummyword\inforef
+  \commondummyword\kbd
+  \commondummyword\key
+  \commondummyword\math
+  \commondummyword\option
+  \commondummyword\pxref
+  \commondummyword\ref
+  \commondummyword\samp
+  \commondummyword\strong
+  \commondummyword\tie
+  \commondummyword\U
+  \commondummyword\uref
+  \commondummyword\url
+  \commondummyword\var
+  \commondummyword\verb
+  \commondummyword\w
+  \commondummyword\xref
+}
+
+% For testing: output @{ and @} in index sort strings as \{ and \}.
+\newif\ifusebracesinindexes
+
+\let\indexlbrace\relax
+\let\indexrbrace\relax
+
+{\catcode`\@=0
+\catcode`\\=13
+  @gdef@backslashdisappear{@def\{}}
+}
+
+{
+\catcode`\<=13
+\catcode`\-=13
+\catcode`\`=13
+  \gdef\indexnonalnumdisappear{%
+    \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
+      % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
+      % (Introduced for FSFS 2nd ed.)
+      \let`=\empty
+    \fi
+    %
+    \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
+      \backslashdisappear
+    \fi
+    %
+    \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
+      \def-{}%
+    \fi
+    \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
+      \def<{}%
+    \fi
+    \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
+      \def\@{}%
+    \fi
+  }
+
+  \gdef\indexnonalnumreappear{%
+    \useindexbackslash
+    \let-\normaldash
+    \let<\normalless
+    \def\@{@}%
+  }
 }
 
+
 % \indexnofonts is used when outputting the strings to sort the index
 % by, and when constructing control sequence names.  It eliminates all
 % control sequences and just writes whatever the best ASCII sort string
@@ -4608,12 +5121,11 @@ end
 %
 \def\indexnofonts{%
   % Accent commands should become @asis.
-  \def\definedummyaccent##1{\let##1\asis}%
+  \def\commondummyaccent##1{\let##1\asis}%
   % We can just ignore other control letters.
-  \def\definedummyletter##1{\let##1\empty}%
+  \def\commondummyletter##1{\let##1\empty}%
   % All control words become @asis by default; overrides below.
-  \let\definedummyword\definedummyaccent
-  %
+  \let\commondummyword\commondummyaccent
   \commondummiesnofonts
   %
   % Don't no-op \tt, since it isn't a user-level command
@@ -4626,14 +5138,10 @@ end
   \def\_{\normalunderscore}%
   \def\-{}% @- shouldn't affect sorting
   %
-  % Unfortunately, texindex is not prepared to handle braces in the
-  % content at all.  So for index sorting, we map @{ and @} to strings
-  % starting with |, since that ASCII character is between ASCII { and }.
-  \def\{{|a}%
-  \def\lbracechar{|a}%
-  %
-  \def\}{|b}%
-  \def\rbracechar{|b}%
+  \uccode`\1=`\{ \uppercase{\def\{{1}}%
+  \uccode`\1=`\} \uppercase{\def\}{1}}%
+  \let\lbracechar\{%
+  \let\rbracechar\}%
   %
   % Non-English letters.
   \def\AA{AA}%
@@ -4642,7 +5150,7 @@ end
   \def\L{L}%
   \def\OE{OE}%
   \def\O{O}%
-  \def\TH{ZZZ}%
+  \def\TH{TH}%
   \def\aa{aa}%
   \def\ae{ae}%
   \def\dh{dzz}%
@@ -4654,45 +5162,45 @@ end
   \def\o{o}%
   \def\questiondown{?}%
   \def\ss{ss}%
-  \def\th{zzz}%
+  \def\th{th}%
   %
   \def\LaTeX{LaTeX}%
   \def\TeX{TeX}%
   %
-  % Assorted special characters.
-  % (The following {} will end up in the sort string, but that's ok.)
-  \def\arrow{->}%
-  \def\bullet{bullet}%
-  \def\comma{,}%
-  \def\copyright{copyright}%
-  \def\dots{...}%
-  \def\enddots{...}%
-  \def\equiv{==}%
-  \def\error{error}%
-  \def\euro{euro}%
-  \def\expansion{==>}%
-  \def\geq{>=}%
-  \def\guillemetleft{<<}%
-  \def\guillemetright{>>}%
-  \def\guilsinglleft{<}%
-  \def\guilsinglright{>}%
-  \def\leq{<=}%
-  \def\minus{-}%
-  \def\point{.}%
-  \def\pounds{pounds}%
-  \def\print{-|}%
-  \def\quotedblbase{"}%
-  \def\quotedblleft{"}%
-  \def\quotedblright{"}%
-  \def\quoteleft{`}%
-  \def\quoteright{'}%
-  \def\quotesinglbase{,}%
-  \def\registeredsymbol{R}%
-  \def\result{=>}%
-  \def\textdegree{o}%
-  %
-  \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
-  \else \indexlquoteignore \fi
+  % Assorted special characters.  \defglyph gives the control sequence a
+  % definition that removes the {} that follows its use.
+  \defglyph\atchar{@}%
+  \defglyph\arrow{->}%
+  \defglyph\bullet{bullet}%
+  \defglyph\comma{,}%
+  \defglyph\copyright{copyright}%
+  \defglyph\dots{...}%
+  \defglyph\enddots{...}%
+  \defglyph\equiv{==}%
+  \defglyph\error{error}%
+  \defglyph\euro{euro}%
+  \defglyph\expansion{==>}%
+  \defglyph\geq{>=}%
+  \defglyph\guillemetleft{<<}%
+  \defglyph\guillemetright{>>}%
+  \defglyph\guilsinglleft{<}%
+  \defglyph\guilsinglright{>}%
+  \defglyph\leq{<=}%
+  \defglyph\lbracechar{\{}%
+  \defglyph\minus{-}%
+  \defglyph\point{.}%
+  \defglyph\pounds{pounds}%
+  \defglyph\print{-|}%
+  \defglyph\quotedblbase{"}%
+  \defglyph\quotedblleft{"}%
+  \defglyph\quotedblright{"}%
+  \defglyph\quoteleft{`}%
+  \defglyph\quoteright{'}%
+  \defglyph\quotesinglbase{,}%
+  \defglyph\rbracechar{\}}%
+  \defglyph\registeredsymbol{R}%
+  \defglyph\result{=>}%
+  \defglyph\textdegree{o}%
   %
   % We need to get rid of all macros, leaving only the arguments (if present).
   % Of course this is not nearly correct, but it is the best we can do for now.
@@ -4705,21 +5213,24 @@ end
   % goes to end-of-line is not handled.
   %
   \macrolist
+  \let\value\indexnofontsvalue
 }
+\def\defglyph#1#2{\def#1##1{#2}} % see above
+
+\f
 
-% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
-% ignore left quotes in the sort term.
-{\catcode`\`=\active
- \gdef\indexlquoteignore{\let`=\empty}}
 
-\let\indexbackslash=0  %overridden during \printindex.
 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
 
 % Most index entries go through here, but \dosubind is the general case.
 % #1 is the index name, #2 is the entry text.
 \def\doind#1#2{\dosubind{#1}{#2}{}}
 
-% Workhorse for all \fooindexes.
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+% TODO: Two-level index?  Operation index?
+
+% Workhorse for all indexes.
 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
 % empty if called from \doind, as we usually are (the main exception
 % is with most defuns, which call us directly).
@@ -4727,6 +5238,7 @@ end
 \def\dosubind#1#2#3{%
   \iflinks
   {%
+    \requireopenindexfile{#1}%
     % Store the main index entry text (including the third arg).
     \toks0 = {#2}%
     % If third arg is present, precede it with a space.
@@ -4742,7 +5254,50 @@ end
   \fi
 }
 
-% Write the entry in \toks0 to the index file:
+% Check if an index file has been opened, and if not, open it.
+\def\requireopenindexfile#1{%
+\ifnum\csname #1indfile\endcsname=0
+  \expandafter\newwrite \csname#1indfile\endcsname
+  \edef\suffix{#1}%
+  % A .fls suffix would conflict with the file extension for the output
+  % of -recorder, so use .f1s instead.
+  \ifx\suffix\indexisfl\def\suffix{f1}\fi
+  % Open the file
+  \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
+  % Using \immediate above here prevents an object entering into the current 
+  % box, which could confound checks such as those in \safewhatsit for
+  % preceding skips.
+  \typeout{Writing index file \jobname.\suffix}%
+\fi}
+\def\indexisfl{fl}
+
+% Output \ as {\indexbackslash}, because \ is an escape character in
+% the index files.
+\let\indexbackslash=\relax
+{\catcode`\@=0 \catcode`\\=\active
+  @gdef@useindexbackslash{@def\{{@indexbackslash}}}
+}
+
+% Definition for writing index entry text.
+\def\sortas#1{\ignorespaces}%
+
+% Definition for writing index entry sort key.  Should occur at the at
+% the beginning of the index entry, like
+%     @cindex @sortas{september} \september
+% The \ignorespaces takes care of following space, but there's no way
+% to remove space before it.
+{
+\catcode`\-=13
+\gdef\indexwritesortas{%
+  \begingroup
+  \indexnonalnumreappear
+  \indexwritesortasxxx}
+\gdef\indexwritesortasxxx#1{%
+  \xdef\indexsortkey{#1}\endgroup}
+}
+
+
+% Write the entry in \toks0 to the index file.
 %
 \def\dosubindwrite{%
   % Put the index entry in the margin if desired.
@@ -4752,14 +5307,26 @@ end
   %
   % Remember, we are within a group.
   \indexdummies % Must do this here, since \bf, etc expand at this stage
-  \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
-      % so it will be output as is; and it will print as backslash.
+  \useindexbackslash % \indexbackslash isn't defined now so it will be output 
+                     % as is; and it will print as backslash.
+  % The braces around \indexbrace are recognized by texindex.
   %
-  % Process the index entry with all font commands turned off, to
-  % get the string to sort by.
+  % Get the string to sort by, by processing the index entry with all
+  % font commands turned off.
   {\indexnofonts
-   \edef\temp{\the\toks0}% need full expansion
-   \xdef\indexsorttmp{\temp}%
+   \def\lbracechar{{\indexlbrace}}%
+   \def\rbracechar{{\indexrbrace}}%
+   \let\{=\lbracechar
+   \let\}=\rbracechar
+   \indexnonalnumdisappear
+   \xdef\indexsortkey{}%
+   \let\sortas=\indexwritesortas
+   \edef\temp{\the\toks0}%
+   \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
+   \ifx\indexsortkey\empty
+     \xdef\indexsortkey{\temp}%
+     \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
+   \fi
   }%
   %
   % Set up the complete index entry, with both the sort key and
@@ -4769,10 +5336,11 @@ end
   % sorted result.
   \edef\temp{%
     \write\writeto{%
-      \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
+      \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
   }%
   \temp
 }
+\newbox\dummybox % used above
 
 % Take care of unwanted page breaks/skips around a whatsit:
 %
@@ -4897,52 +5465,113 @@ end
   % \initial {@}
   % as its first line, TeX doesn't complain about mismatched braces
   % (because it thinks @} is a control sequence).
-  \catcode`\@ = 11
-  \openin 1 \jobname.#1s
+  \catcode`\@ = 12
+  % See comment in \requireopenindexfile.
+  \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
+  \openin 1 \jobname.\indexname s
   \ifeof 1
     % \enddoublecolumns gets confused if there is no text in the index,
     % and it loses the chapter title and the aux file entries for the
     % index.  The easiest way to prevent this problem is to make sure
     % there is some text.
     \putwordIndexNonexistent
+    \typeout{No file \jobname.\indexname s.}%
   \else
+    \catcode`\\ = 0
     %
     % If the index file exists but is empty, then \openin leaves \ifeof
     % false.  We have to make TeX try to read something from the file, so
     % it can discover if there is anything in it.
-    \read 1 to \temp
+    \read 1 to \thisline
     \ifeof 1
       \putwordIndexIsEmpty
     \else
       % Index files are almost Texinfo source, but we use \ as the escape
       % character.  It would be better to use @, but that's too big a change
       % to make right now.
-      \def\indexbackslash{\backslashcurfont}%
-      \catcode`\\ = 0
-      \escapechar = `\\
+      \def\indexbackslash{\ttbackslash}%
+      \let\indexlbrace\{   % Likewise, set these sequences for braces
+      \let\indexrbrace\}   % used in the sort key.
       \begindoublecolumns
-      \input \jobname.#1s
+      \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
+      %
+      % Read input from the index file line by line.
+      \loopdo
+        \ifeof1 \else
+          \read 1 to \nextline
+        \fi
+        %
+        \indexinputprocessing
+        \thisline
+        %
+        \ifeof1\else
+        \let\thisline\nextline
+      \repeat
+      %%
       \enddoublecolumns
     \fi
   \fi
   \closein 1
 \endgroup}
+\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
+\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
+
+\def\indexinputprocessing{%
+  \ifeof1
+    \let\firsttoken\relax
+  \else
+    \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
+    \act
+  \fi
+}
+\def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
+\long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
+
 
 % These macros are used by the sorted index file itself.
 % Change them to control the appearance of the index.
 
-\def\initial#1{{%
-  % Some minor font changes for the special characters.
-  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
-  %
+{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
+\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
+\catcode`\$=3
+\gdef\initialglyphs{%
+  % Some changes for non-alphabetic characters.  Using the glyphs from the
+  % math fonts looks more consistent than the typewriter font used elsewhere
+  % for these characters.
+  \def\indexbackslash{\math{\backslash}}%
+  \let\\=\indexbackslash
+  %
+  % Can't get bold backslash so don't use bold forward slash
+  \catcode`\/=13
+  \def/{{\secrmnotbold \normalslash}}%
+  \def-{{\normaldash\normaldash}}% en dash `--'
+  \def^{{\chapbf \normalcaret}}%
+  \def~{{\chapbf \normaltilde}}%
+  \def\_{%
+     \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
+  \def|{$\vert$}%
+  \def<{$\less$}%
+  \def>{$\gtr$}%
+  \def+{$\normalplus$}%
+}}
+
+\def\initial{%
+  \bgroup
+  \initialglyphs
+  \initialx
+}
+
+\def\initialx#1{%
   % Remove any glue we may have, we'll be inserting our own.
   \removelastskip
   %
   % We like breaks before the index initials, so insert a bonus.
+  % The glue before the bonus allows a little bit of space at the
+  % bottom of a column to reduce an increase in inter-line spacing.
   \nobreak
-  \vskip 0pt plus 3\baselineskip
-  \penalty 0
-  \vskip 0pt plus -3\baselineskip
+  \vskip 0pt plus 5\baselineskip
+  \penalty -300 
+  \vskip 0pt plus -5\baselineskip
   %
   % Typeset the initial.  Making this add up to a whole number of
   % baselineskips increases the chance of the dots lining up from column
@@ -4950,63 +5579,45 @@ end
   % we need before each entry, but it's better.
   %
   % No shrink because it confuses \balancecolumns.
-  \vskip 1.67\baselineskip plus .5\baselineskip
-  \leftline{\secbf #1}%
+  \vskip 1.67\baselineskip plus 1\baselineskip
+  \leftline{\secfonts \kern-0.05em \secbf #1}%
+  % \secfonts is inside the argument of \leftline so that the change of
+  % \baselineskip will not affect any glue inserted before the vbox that
+  % \leftline creates.
   % Do our best not to break after the initial.
   \nobreak
   \vskip .33\baselineskip plus .1\baselineskip
-}}
+  \egroup % \initialglyphs
+}
+
+\newdimen\entryrightmargin
+\entryrightmargin=0pt
 
 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
 % then page number (#2) flushed to the right margin.  It is used for index
 % and table of contents entries.  The paragraph is indented by \leftskip.
 %
-% A straightforward implementation would start like this:
-%      \def\entry#1#2{...
-% But this freezes the catcodes in the argument, and can cause problems to
-% @code, which sets - active.  This problem was fixed by a kludge---
-% ``-'' was active throughout whole index, but this isn't really right.
-% The right solution is to prevent \entry from swallowing the whole text.
-%                                 --kasal, 21nov03
 \def\entry{%
   \begingroup
     %
+    % For pdfTeX and XeTeX.
+    % The redefinition of \domark stops marks being added in \pdflink to 
+    % preserve coloured links across page boundaries.  Otherwise the marks
+    % would get in the way of \lastbox in \insertentrybox.
+    \let\domark\relax
+    %
     % Start a new paragraph if necessary, so our assignments below can't
     % affect previous text.
     \par
     %
-    % Do not fill out the last line with white space.
-    \parfillskip = 0in
-    %
     % No extra space above this paragraph.
     \parskip = 0in
     %
-    % Do not prefer a separate line ending with a hyphen to fewer lines.
-    \finalhyphendemerits = 0
-    %
-    % \hangindent is only relevant when the entry text and page number
-    % don't both fit on one line.  In that case, bob suggests starting the
-    % dots pretty far over on the line.  Unfortunately, a large
-    % indentation looks wrong when the entry text itself is broken across
-    % lines.  So we use a small indentation and put up with long leaders.
-    %
-    % \hangafter is reset to 1 (which is the value we want) at the start
-    % of each paragraph, so we need not do anything with that.
-    \hangindent = 2em
-    %
-    % When the entry text needs to be broken, just fill out the first line
-    % with blank space.
-    \rightskip = 0pt plus1fil
-    %
-    % A bit of stretch before each entry for the benefit of balancing
-    % columns.
-    \vskip 0pt plus1pt
-    %
     % When reading the text of entry, convert explicit line breaks
     % from @* into spaces.  The user might give these in long section
     % titles, for instance.
     \def\*{\unskip\space\ignorespaces}%
-    \def\entrybreak{\hfil\break}%
+    \def\entrybreak{\hfil\break}% An undocumented command
     %
     % Swallow the left brace of the text (first parameter):
     \afterassignment\doentry
@@ -5014,45 +5625,168 @@ end
 }
 \def\entrybreak{\unskip\space\ignorespaces}%
 \def\doentry{%
+    % Save the text of the entry
+    \global\setbox\boxA=\hbox\bgroup
     \bgroup % Instead of the swallowed brace.
       \noindent
       \aftergroup\finishentry
       % And now comes the text of the entry.
+      % Not absorbing as a macro argument reduces the chance of problems
+      % with catcodes occurring.
 }
-\def\finishentry#1{%
+{\catcode`\@=11
+\gdef\finishentry#1{%
+    \egroup % end box A
+    \dimen@ = \wd\boxA % Length of text of entry
+    \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
     % #1 is the page number.
     %
-    % The following is kludged to not output a line of dots in the index if
-    % there are no page numbers.  The next person who breaks this will be
-    % cursed by a Unix daemon.
-    \setbox\boxA = \hbox{#1}%
-    \ifdim\wd\boxA = 0pt
-      \ %
+    % Get the width of the page numbers, and only use
+    % leaders if they are present.
+    \global\setbox\boxB = \hbox{#1}%
+    \ifdim\wd\boxB = 0pt
+      \null\nobreak\hfill\ %
     \else
       %
-      % If we must, put the page number on a line of its own, and fill out
-      % this line with blank space.  (The \hfil is overwhelmed with the
-      % fill leaders glue in \indexdotfill if the page number does fit.)
-      \hfil\penalty50
       \null\nobreak\indexdotfill % Have leaders before the page number.
       %
-      % The `\ ' here is removed by the implicit \unskip that TeX does as
-      % part of (the primitive) \par.  Without it, a spurious underfull
-      % \hbox ensues.
       \ifpdf
-       \pdfgettoks#1.%
-       \the\toksA
+        \pdfgettoks#1.%
+        \hskip\skip\thinshrinkable\the\toksA
       \else
-       \ #1%
+        \ifx\XeTeXrevision\thisisundefined
+          \hskip\skip\thinshrinkable #1%
+        \else
+          \pdfgettoks#1.%
+          \hskip\skip\thinshrinkable\the\toksA
+        \fi
       \fi
     \fi
-    \par
+    \egroup % end \boxA
+    \ifdim\wd\boxB = 0pt
+      \global\setbox\entrybox=\vbox{\unhbox\boxA}%
+    \else
+    \global\setbox\entrybox=\vbox\bgroup
+      % We want the text of the entries to be aligned to the left, and the
+      % page numbers to be aligned to the right.
+      %
+      \parindent = 0pt
+      \advance\leftskip by 0pt plus 1fil
+      \advance\leftskip by 0pt plus -1fill
+      \rightskip = 0pt plus -1fil
+      \advance\rightskip by 0pt plus 1fill
+      % Cause last line, which could consist of page numbers on their own
+      % if the list of page numbers is long, to be aligned to the right.
+      \parfillskip=0pt plus -1fill
+      %
+      \advance\rightskip by \entryrightmargin
+      % Determine how far we can stretch into the margin.
+      % This allows, e.g., "Appendix H  GNU Free Documentation License" to
+      % fit on one line in @letterpaper format.
+      \ifdim\entryrightmargin>2.1em
+        \dimen@i=2.1em
+      \else
+        \dimen@i=0em
+      \fi
+      \advance \parfillskip by 0pt minus 1\dimen@i
+      %
+      \dimen@ii = \hsize
+      \advance\dimen@ii by -1\leftskip
+      \advance\dimen@ii by -1\entryrightmargin
+      \advance\dimen@ii by 1\dimen@i
+      \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
+      \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
+        % Try to split the text roughly evenly.  \dimen@ will be the length of 
+        % the first line.
+        \dimen@ = 0.7\dimen@
+        \dimen@ii = \hsize
+        \ifnum\dimen@>\dimen@ii
+          % If the entry is too long (for example, if it needs more than
+          % two lines), use all the space in the first line.
+          \dimen@ = \dimen@ii
+        \fi
+        \advance\leftskip by 0pt plus 1fill % ragged right
+        \advance \dimen@ by 1\rightskip
+        \parshape = 2 0pt \dimen@ 0em \dimen@ii
+        % Ideally we'd add a finite glue at the end of the first line only,
+        % instead of using \parshape with explicit line lengths, but TeX
+        % doesn't seem to provide a way to do such a thing.
+        %
+        % Indent all lines but the first one.
+        \advance\leftskip by 1em
+        \advance\parindent by -1em
+      \fi\fi
+      \indent % start paragraph
+      \unhbox\boxA
+      %
+      % Do not prefer a separate line ending with a hyphen to fewer lines.
+      \finalhyphendemerits = 0
+      %
+      % Word spacing - no stretch
+      \spaceskip=\fontdimen2\font minus \fontdimen4\font
+      %
+      \linepenalty=1000  % Discourage line breaks.
+      \hyphenpenalty=5000  % Discourage hyphenation.
+      %
+      \par % format the paragraph
+    \egroup % The \vbox
+    \fi
   \endgroup
+  \dotheinsertentrybox
+}}
+
+\newskip\thinshrinkable
+\skip\thinshrinkable=.15em minus .15em
+
+\newbox\entrybox
+\def\insertentrybox{%
+  \ourunvbox\entrybox
+}
+
+% default definition
+\let\dotheinsertentrybox\insertentrybox
+
+% Use \lastbox to take apart vbox box by box, and add each sub-box
+% to the current vertical list.
+\def\ourunvbox#1{%
+\bgroup % for local binding of \delayedbox
+  % Remove the last box from box #1
+  \global\setbox#1=\vbox{%
+    \unvbox#1%
+    \unskip % remove any glue
+    \unpenalty
+    \global\setbox\interbox=\lastbox
+  }%
+  \setbox\delayedbox=\box\interbox
+  \ifdim\ht#1=0pt\else
+    \ourunvbox#1 % Repeat on what's left of the box
+    \nobreak
+  \fi
+  \box\delayedbox
+\egroup
+}
+\newbox\delayedbox
+\newbox\interbox
+
+% Used from \printindex.  \firsttoken should be the first token
+% after the \entry.  If it's not another \entry, we are at the last
+% line of a group of index entries, so insert a penalty to discourage
+% widowed index entries.
+\def\dotheinsertentryboxwithpenalty{%
+  \ifx\firsttoken\isentry
+  \else
+    \penalty 9000
+  \fi
+  \insertentrybox
 }
+\def\isentry{\entry}%
 
 % Like plain.tex's \dotfill, except uses up at least 1 em.
+% The filll stretch here overpowers both the fil and fill stretch to push
+% the page number to the right.
 \def\indexdotfill{\cleaders
-  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
+  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
+
 
 \def\primary #1{\line{#1\hfil}}
 
@@ -5066,7 +5800,11 @@ end
   \ifpdf
     \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
   \else
-    #2
+    \ifx\XeTeXrevision\thisisundefined
+      #2
+    \else
+      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+    \fi
   \fi
   \par
 }}
@@ -5074,12 +5812,37 @@ end
 % Define two-column mode, which we use to typeset indexes.
 % Adapted from the TeXbook, page 416, which is to say,
 % the manmac.tex format used to print the TeXbook itself.
-\catcode`\@=11
+\catcode`\@=11  % private names
 
 \newbox\partialpage
 \newdimen\doublecolumnhsize
 
+% Use inside an output routine to save \topmark and \firstmark
+\def\savemarks{%
+  \global\savedtopmark=\expandafter{\topmark }%
+  \global\savedfirstmark=\expandafter{\firstmark }%
+}
+\newtoks\savedtopmark
+\newtoks\savedfirstmark
+
+% Set \topmark and \firstmark for next time \output runs.
+% Can't be run from withinside \output (because any material
+% added while an output routine is active, including 
+% penalties, is saved for after it finishes).  The page so far
+% should be empty, otherwise what's on it will be thrown away.
+\def\restoremarks{%
+  \mark{\the\savedtopmark}%
+  \bgroup\output = {%
+    \setbox\dummybox=\box\PAGE
+  }abc\eject\egroup
+  % "abc" because output routine doesn't fire for a completely empty page.
+  \mark{\the\savedfirstmark}%
+}
+
 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
+  % If not much space left on page, start a new page.
+  \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
+  %
   % Grab any single-column material above us.
   \output = {%
     %
@@ -5099,8 +5862,15 @@ end
       \unvbox\PAGE
       \kern-\topskip \kern\baselineskip
     }%
+    \savemarks
   }%
   \eject % run that output routine to set \partialpage
+  \restoremarks
+  %
+  % We recover the two marks that the last output routine saved in order
+  % to propagate the information in marks added around a chapter heading,
+  % which could be otherwise be lost by the time the final page is output.
+  %
   %
   % Use the double-column output routine for subsequent pages.
   \output = {\doublecolumnout}%
@@ -5126,27 +5896,31 @@ end
     \divide\doublecolumnhsize by 2
   \hsize = \doublecolumnhsize
   %
-  % Double the \vsize as well.  (We don't need a separate register here,
-  % since nobody clobbers \vsize.)
+  % Double the \vsize as well.
+  \advance\vsize by -\ht\partialpage
   \vsize = 2\vsize
+  %
+  % For the benefit of balancing columns
+  \advance\baselineskip by 0pt plus 0.5pt
 }
 
 % The double-column output routine for all double-column pages except
-% the last.
+% the last, which is done by \balancecolumns.
 %
 \def\doublecolumnout{%
+  %
   \splittopskip=\topskip \splitmaxdepth=\maxdepth
   % Get the available space for the double columns -- the normal
   % (undoubled) page height minus any material left over from the
   % previous page.
   \dimen@ = \vsize
   \divide\dimen@ by 2
-  \advance\dimen@ by -\ht\partialpage
   %
   % box0 will be the left-hand column, box2 the right.
-  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
+  \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
+  \global\advance\vsize by 2\ht\partialpage
   \onepageout\pagesofar
-  \unvbox255
+  \unvbox\PAGE
   \penalty\outputpenalty
 }
 %
@@ -5157,10 +5931,11 @@ end
   %
   \hsize = \doublecolumnhsize
   \wd0=\hsize \wd2=\hsize
-  \hbox to\pagewidth{\box0\hfil\box2}%
+  \hbox to\txipagewidth{\box0\hfil\box2}%
 }
-%
-% All done with double columns.
+
+
+% Finished with with double columns.
 \def\enddoublecolumns{%
   % The following penalty ensures that the page builder is exercised
   % _before_ we change the output routine.  This is necessary in the
@@ -5183,7 +5958,7 @@ end
   % goal.  When TeX sees \eject from below which follows the final
   % section, it invokes the new output routine that we've set after
   % \balancecolumns below; \onepageout will try to fit the two columns
-  % and the final section into the vbox of \pageheight (see
+  % and the final section into the vbox of \txipageheight (see
   % \pagebody), causing an overfull box.
   %
   % Note that glue won't work here, because glue does not exercise the
@@ -5191,53 +5966,81 @@ end
   \penalty0
   %
   \output = {%
-    % Split the last of the double-column material.  Leave it on the
-    % current page, no automatic page break.
+    % Split the last of the double-column material.
+    \savemarks
     \balancecolumns
     %
-    % If we end up splitting too much material for the current page,
-    % though, there will be another page break right after this \output
-    % invocation ends.  Having called \balancecolumns once, we do not
+    % Having called \balancecolumns once, we do not
     % want to call it again.  Therefore, reset \output to its normal
-    % definition right away.  (We hope \balancecolumns will never be
-    % called on to balance too much material, but if it is, this makes
-    % the output somewhat more palatable.)
+    % definition right away.
     \global\output = {\onepageout{\pagecontents\PAGE}}%
   }%
   \eject
   \endgroup % started in \begindoublecolumns
+  \restoremarks
+  % Leave the double-column material on the current page, no automatic
+  % page break.
+  \box\balancedcolumns
   %
   % \pagegoal was set to the doubled \vsize above, since we restarted
   % the current page.  We're now back to normal single-column
-  % typesetting, so reset \pagegoal to the normal \vsize (after the
-  % \endgroup where \vsize got restored).
-  \pagegoal = \vsize
+  % typesetting, so reset \pagegoal to the normal \vsize.
+  \global\vsize = \txipageheight %
+  \pagegoal = \txipageheight %
 }
+\newbox\balancedcolumns
+\setbox\balancedcolumns=\vbox{shouldnt see this}%
 %
-% Called at the end of the double column material.
+% Only called for the last of the double column material.  \doublecolumnout 
+% does the others.
 \def\balancecolumns{%
-  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
+  \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
   \dimen@ = \ht0
   \advance\dimen@ by \topskip
   \advance\dimen@ by-\baselineskip
-  \divide\dimen@ by 2 % target to split to
-  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
-  \splittopskip = \topskip
-  % Loop until we get a decent breakpoint.
-  {%
-    \vbadness = 10000
-    \loop
-      \global\setbox3 = \copy0
-      \global\setbox1 = \vsplit3 to \dimen@
-    \ifdim\ht3>\dimen@
-      \global\advance\dimen@ by 1pt
-    \repeat
-  }%
-  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
-  \setbox0=\vbox to\dimen@{\unvbox1}%
-  \setbox2=\vbox to\dimen@{\unvbox3}%
+  \ifdim\dimen@<5\baselineskip
+    % Don't split a short final column in two.
+    \setbox2=\vbox{}%
+  \else
+    \divide\dimen@ by 2 % target to split to
+    \dimen@ii = \dimen@
+    \splittopskip = \topskip
+    % Loop until left column is at least as high as the right column.
+    {%
+      \vbadness = 10000
+      \loop
+        \global\setbox3 = \copy0
+        \global\setbox1 = \vsplit3 to \dimen@
+      \ifdim\ht1<\ht3
+        \global\advance\dimen@ by 1pt
+      \repeat
+    }%
+    % Now the left column is in box 1, and the right column in box 3.
+    % Check whether the left column has come out higher than the page itself.  
+    % (Note that we have doubled \vsize for the double columns, so
+    % the actual height of the page is 0.5\vsize).
+    \ifdim2\ht1>\vsize
+      % Just split the last of the double column material roughly in half.
+      \setbox2=\box0
+      \setbox0 = \vsplit2 to \dimen@ii
+      \setbox0=\vbox to \dimen@ii {\unvbox0\vfill}%
+      \setbox2=\vbox to \dimen@ii {\unvbox2\vfill}%
+    \else
+      % Compare the heights of the two columns.
+      \ifdim4\ht1>5\ht3
+        % Column heights are too different, so don't make their bottoms
+        % flush with each other.
+        \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
+        \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
+      \else
+        % Make column bottoms flush with each other.
+        \setbox2=\vbox to\ht1{\unvbox3\unskip}%
+        \setbox0=\vbox to\ht1{\unvbox1\unskip}%
+      \fi
+    \fi
+  \fi
   %
-  \pagesofar
+  \global\setbox\balancedcolumns=\vbox{\pagesofar}%
 }
 \catcode`\@ = \other
 
@@ -5252,10 +6055,14 @@ end
   \null
   \vskip.3\vsize  % move it down on the page a bit
   \begingroup
-    \noindent \titlefonts\rmisbold #1\par % the text
+    \noindent \titlefonts\rm #1\par % the text
     \let\lastnode=\empty      % no node to associate with
     \writetocentry{part}{#1}{}% but put it in the toc
     \headingsoff              % no headline or footline on the part page
+    % This outputs a mark at the end of the page that clears \thischapter
+    % and \thissection, as is done in \startcontents.
+    \let\pchapsepmacro\relax
+    \chapmacro{}{Yomitfromtoc}{}%
     \chapoddpage
   \endgroup
 }
@@ -5500,9 +6307,6 @@ end
 
 % @centerchap is like @unnumbered, but the heading is centered.
 \outer\parseargdef\centerchap{%
-  % Well, we could do the following in a group, but that would break
-  % an assumption that \chapmacro is called at the outermost level.
-  % Thus we are safer this way:                --kasal, 24feb04
   \let\centerparametersmaybe = \centerparameters
   \unnmhead0{#1}%
   \let\centerparametersmaybe = \relax
@@ -5626,7 +6430,11 @@ end
 
 % Define plain chapter starts, and page on/off switching for it.
 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
+
+% Start a new page
 \def\chappager{\par\vfill\supereject}
+
+% \chapoddpage - start on an odd page for a new chapter
 % Because \domark is called before \chapoddpage, the filler page will
 % get the headings for the next chapter, which is wrong.  But we don't
 % care -- we just disable all headings on the filler page.
@@ -5641,7 +6449,7 @@ end
   \fi
 }
 
-\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
+\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
 
 \def\CHAPPAGoff{%
 \global\let\contentsalignmacro = \chappager
@@ -5662,17 +6470,26 @@ end
 
 \CHAPPAGon
 
-% Chapter opening.
+% \chapmacro - Chapter opening.
 %
 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
 % Yappendix, Yomitfromtoc), #3 the chapter number.
+% Not used for @heading series.
 %
 % To test against our argument.
 \def\Ynothingkeyword{Ynothing}
-\def\Yomitfromtockeyword{Yomitfromtoc}
 \def\Yappendixkeyword{Yappendix}
+\def\Yomitfromtockeyword{Yomitfromtoc}
 %
 \def\chapmacro#1#2#3{%
+  \expandafter\ifx\thisenv\titlepage\else
+    \checkenv{}% chapters, etc., should not start inside an environment.
+  \fi
+  % FIXME: \chapmacro is currently called from inside \titlepage when
+  % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
+  % this should probably be done by \sectionheading with an option to print
+  % in chapter size.
+  %
   % Insert the first mark before the heading break (see notes for \domark).
   \let\prevchapterdefs=\lastchapterdefs
   \let\prevsectiondefs=\lastsectiondefs
@@ -5724,7 +6541,8 @@ end
   \domark
   %
   {%
-    \chapfonts \rmisbold
+    \chapfonts \rm
+    \let\footnote=\errfootnoteheading % give better error message
     %
     % Have to define \lastsection before calling \donoderef, because the
     % xref code eventually uses it.  On the other hand, it has to be called
@@ -5777,30 +6595,6 @@ end
 }
 
 
-% I don't think this chapter style is supported any more, so I'm not
-% updating it with the new noderef stuff.  We'll see.  --karl, 11aug03.
-%
-\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
-%
-\def\unnchfopen #1{%
-  \chapoddpage
-  \vbox{\chapfonts \raggedtitlesettings #1\par}%
-  \nobreak\bigskip\nobreak
-}
-\def\chfopen #1#2{\chapoddpage {\chapfonts
-\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
-\par\penalty 5000 %
-}
-\def\centerchfopen #1{%
-  \chapoddpage
-  \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
-  \nobreak\bigskip \nobreak
-}
-\def\CHAPFopen{%
-  \global\let\chapmacro=\chfopen
-  \global\let\centerchapmacro=\centerchfopen}
-
-
 % Section titles.  These macros combine the section number parts and
 % call the generic \sectionheading to do the printing.
 %
@@ -5818,22 +6612,29 @@ end
 
 % Print any size, any type, section title.
 %
-% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
-% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
-% section number.
+% #1 is the text of the title,
+% #2 is the section level (sec/subsec/subsubsec),
+% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
+% #4 is the section number.
 %
 \def\seckeyword{sec}
 %
 \def\sectionheading#1#2#3#4{%
   {%
-    \checkenv{}% should not be in an environment.
-    %
-    % Switch to the right set of fonts.
-    \csname #2fonts\endcsname \rmisbold
-    %
     \def\sectionlevel{#2}%
     \def\temptype{#3}%
     %
+    % It is ok for the @heading series commands to appear inside an
+    % environment (it's been historically allowed, though the logic is
+    % dubious), but not the others.
+    \ifx\temptype\Yomitfromtockeyword\else
+      \checkenv{}% non-@*heading should not be in an environment.
+    \fi
+    \let\footnote=\errfootnoteheading
+    %
+    % Switch to the right set of fonts.
+    \csname #2fonts\endcsname \rm
+    %
     % Insert first mark before the heading break (see notes for \domark).
     \let\prevsectiondefs=\lastsectiondefs
     \ifx\temptype\Ynothingkeyword
@@ -5885,7 +6686,7 @@ end
     %
     % Now the second mark, after the heading break.  No break points
     % between here and the heading.
-    \let\prevsectiondefs=\lastsectiondefs
+    \global\let\prevsectiondefs=\lastsectiondefs
     \domark
     %
     % Only insert the space after the number if we have a section number.
@@ -5996,7 +6797,14 @@ end
   % 1 and 2 (the page numbers aren't printed), and so are the first
   % two pages of the document.  Thus, we'd have two destinations named
   % `1', and two named `2'.
-  \ifpdf \global\pdfmakepagedesttrue \fi
+  \ifpdf
+    \global\pdfmakepagedesttrue
+  \else
+    \ifx\XeTeXrevision\thisisundefined
+    \else
+      \global\pdfmakepagedesttrue
+    \fi
+  \fi
 }
 
 
@@ -6045,7 +6853,7 @@ end
   \savepageno = \pageno
   \begingroup                  % Set up to handle contents files properly.
     \raggedbottom              % Worry more about breakpoints than the bottom.
-    \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+    \entryrightmargin=\contentsrightmargin % Don't use the full line length.
     %
     % Roman numerals for page numbers.
     \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
@@ -6139,7 +6947,15 @@ end
 % exist, with an empty box.  Let's hope all the numbers have the same width.
 % Also ignore the page number, which is conventionally not printed.
 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
-\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
+\def\partentry#1#2#3#4{%
+  % Add stretch and a bonus for breaking the page before the part heading.
+  % This reduces the chance of the page being broken immediately after the
+  % part heading, before a following chapter heading.
+  \vskip 0pt plus 5\baselineskip
+  \penalty-300
+  \vskip 0pt plus -5\baselineskip
+  \dochapentry{\numeralbox\labelspace#1}{}%
+}
 %
 % Parts, in the short toc.
 \def\shortpartentry#1#2#3#4{%
@@ -6150,7 +6966,7 @@ end
 
 % Chapters, in the main contents.
 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
-%
+
 % Chapters, in the short toc.
 % See comments in \dochapentry re vbox and related settings.
 \def\shortchapentry#1#2#3#4{%
@@ -6165,7 +6981,7 @@ end
   \setbox0 = \hbox{\putwordAppendix{} M}%
   \hbox to \wd0{\putwordAppendix{} #1\hss}}
 %
-\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
+\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
 
 % Unnumbered chapters.
 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
@@ -6198,6 +7014,8 @@ end
 \def\dochapentry#1#2{%
    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
    \begingroup
+     % Move the page numbers slightly to the right
+     \advance\entryrightmargin by -0.05em
      \chapentryfonts
      \tocentry{#1}{\dopageno\bgroup#2\egroup}%
    \endgroup
@@ -6252,14 +7070,14 @@ end
   \catcode `\|=\other
   \catcode `\<=\other
   \catcode `\>=\other
-  \catcode`\`=\other
-  \catcode`\'=\other
-  \escapechar=`\\
+  \catcode `\`=\other
+  \catcode `\'=\other
   %
   % ' is active in math mode (mathcode"8000).  So reset it, and all our
   % other math active characters (just in case), to plain's definitions.
   \mathactive
   %
+  % Inverse of the list at the beginning of the file.
   \let\b=\ptexb
   \let\bullet=\ptexbullet
   \let\c=\ptexc
@@ -6275,9 +7093,11 @@ end
   \let\+=\tabalign
   \let\}=\ptexrbrace
   \let\/=\ptexslash
+  \let\sp=\ptexsp
   \let\*=\ptexstar
+  %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
   \let\t=\ptext
-  \expandafter \let\csname top\endcsname=\ptextop  % outer
+  \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
   \let\frenchspacing=\plainfrenchspacing
   %
   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
@@ -6314,6 +7134,24 @@ end
     \endgraf
     \ifdim\lastskip<\envskipamount
       \removelastskip
+      \ifnum\lastpenalty<10000
+        % Penalize breaking before the environment, because preceding text
+        % often leads into it.
+        \penalty100
+      \fi
+      \vskip\envskipamount
+    \fi
+  \fi
+}}
+
+\def\afterenvbreak{{%
+  % =10000 instead of <10000 because of a special case in \itemzzz and
+  % \sectionheading, q.v.
+  \ifnum \lastpenalty=10000 \else
+    \advance\envskipamount by \parskip
+    \endgraf
+    \ifdim\lastskip<\envskipamount
+      \removelastskip
       % it's not a good place to break if the last penalty was \nobreak
       % or better ...
       \ifnum\lastpenalty<10000 \penalty-50 \fi
@@ -6322,8 +7160,6 @@ end
   \fi
 }}
 
-\let\afterenvbreak = \aboveenvbreak
-
 % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
 % also clear it, so that its embedded environments do the narrowing again.
 \let\nonarrowing=\relax
@@ -6361,15 +7197,13 @@ end
                                % side, and for 6pt waste from
                                % each corner char, and rule thickness
   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
-  % Flag to tell @lisp, etc., not to narrow margin.
-  \let\nonarrowing = t%
   %
   % If this cartouche directly follows a sectioning command, we need the
   % \parskip glue (backspaced over by default) or the cartouche can
   % collide with the section heading.
   \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
   %
-  \vbox\bgroup
+  \setbox\groupbox=\vbox\bgroup
       \baselineskip=0pt\parskip=0pt\lineskip=0pt
       \carttop
       \hbox\bgroup
@@ -6393,6 +7227,7 @@ end
       \egroup
       \cartbot
   \egroup
+  \addgroupbox
   \checkinserts
 }
 
@@ -6402,7 +7237,7 @@ end
 \newdimen\nonfillparindent
 \def\nonfillstart{%
   \aboveenvbreak
-  \hfuzz = 12pt % Don't be fussy
+  \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
   \sepspaces % Make spaces be word-separators rather than space tokens.
   \let\par = \lisppar % don't ignore blank lines
   \obeylines % each line of input is a line of output
@@ -6529,9 +7364,13 @@ end
 
 
 % @raggedright does more-or-less normal line breaking but no right
-% justification.  From plain.tex.
+% justification.  From plain.tex.  Don't stretch around special
+% characters in urls in this environment, since the stretch at the right
+% should be enough.
 \envdef\raggedright{%
-  \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
+  \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
+  \def\urefprestretchamount{0pt}%
+  \def\urefpoststretchamount{0pt}%
 }
 \let\Eraggedright\par
 
@@ -6771,7 +7610,7 @@ end
 % typesetting commands (@smallbook, font changes, etc.) have to be done
 % beforehand -- and a) we want @copying to be done first in the source
 % file; b) letting users define the frontmatter in as flexible order as
-% possible is very desirable.
+% possible is desirable.
 %
 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
@@ -6866,7 +7705,7 @@ end
   \temp
 }
 
-% \domakedefun \deffn \deffnx \deffnheader
+% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
 %
 % Define \deffn and \deffnx, without parameters.
 % \deffnheader has to be defined explicitly.
@@ -7075,7 +7914,7 @@ end
     \fi           % no return type
     #3% output function name
   }%
-  {\rm\enskip}% hskip 0.5 em of \tenrm
+  {\rm\enskip}% hskip 0.5 em of \rmfont
   %
   \boldbrax
   % arguments will be output next, if any.
@@ -7204,34 +8043,41 @@ end
   }
 \fi
 
-\def\scanmacro#1{\begingroup
+% alias because \c means cedilla in @tex or @math
+\let\texinfoc=\c
+
+\newcount\savedcatcodeone
+\newcount\savedcatcodetwo
+
+% Used at the time of macro expansion.
+% Argument is macro body with arguments substituted
+\def\scanmacro#1{%
   \newlinechar`\^^M
-  \let\xeatspaces\eatspaces
+  \def\xeatspaces{\eatspaces}%
   %
-  % Undo catcode changes of \startcontents and \doprintindex
-  % When called from @insertcopying or (short)caption, we need active
-  % backslash to get it printed correctly.  Previously, we had
-  % \catcode`\\=\other instead.  We'll see whether a problem appears
-  % with macro expansion.                              --kasal, 19aug04
-  \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
+  % Temporarily undo catcode changes of \printindex.  Set catcode of @ to
+  % 0 so that @-commands in macro expansions aren't printed literally when 
+  % formatting an index file, where \ is used as the escape character.
+  \savedcatcodeone=\catcode`\@
+  \savedcatcodetwo=\catcode`\\
+  \catcode`\@=0
+  \catcode`\\=\active
   %
-  % ... and for \example:
-  \spaceisspace
+  % Process the macro body under the current catcode regime.
+  \scantokens{#1@texinfoc}%
   %
-  % The \empty here causes a following catcode 5 newline to be eaten as
-  % part of reading whitespace after a control sequence.  It does not
-  % eat a catcode 13 newline.  There's no good way to handle the two
-  % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
-  % would then have different behavior).  See the Macro Details node in
-  % the manual for the workaround we recommend for macros and
-  % line-oriented commands.
-  % 
-  \scantokens{#1\empty}%
-\endgroup}
+  \catcode`\@=\savedcatcodeone
+  \catcode`\\=\savedcatcodetwo
+  %
+  % The \texinfoc is to remove the \newlinechar added by \scantokens, and
+  % can be noticed by \parsearg.
+  %   We avoid surrounding the call to \scantokens with \bgroup and \egroup
+  % to allow macros to open or close groups themselves.
+}
 
+% Used for copying and captions
 \def\scanexp#1{%
-  \edef\temp{\noexpand\scanmacro{#1}}%
-  \temp
+  \expandafter\scanmacro\expandafter{#1}%
 }
 
 \newcount\paramno   % Count of parameters
@@ -7239,7 +8085,7 @@ end
 \newif\ifrecursive  % Is it recursive?
 
 % List of all defined macros in the form
-%    \definedummyword\macro1\definedummyword\macro2...
+%    \commondummyword\macro1\commondummyword\macro2...
 % Currently is also contains all @aliases; the list can be split
 % if there is a need.
 \def\macrolist{}
@@ -7247,7 +8093,7 @@ end
 % Add the macro to \macrolist
 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
 \def\addtomacrolistxxx#1{%
-     \toks0 = \expandafter{\macrolist\definedummyword#1}%
+     \toks0 = \expandafter{\macrolist\commondummyword#1}%
      \xdef\macrolist{\the\toks0}%
 }
 
@@ -7297,48 +8143,45 @@ end
   \catcode`\+=\other
   \catcode`\<=\other
   \catcode`\>=\other
-  \catcode`\@=\other
   \catcode`\^=\other
   \catcode`\_=\other
   \catcode`\|=\other
   \catcode`\~=\other
-  \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
+  \passthroughcharstrue
 }
 
 \def\scanargctxt{% used for copying and captions, not macros.
   \scanctxt
+  \catcode`\@=\other
   \catcode`\\=\other
   \catcode`\^^M=\other
 }
 
 \def\macrobodyctxt{% used for @macro definitions
   \scanctxt
+  \catcode`\ =\other
+  \catcode`\@=\other
   \catcode`\{=\other
   \catcode`\}=\other
   \catcode`\^^M=\other
   \usembodybackslash
 }
 
-\def\macroargctxt{% used when scanning invocations
+% Used when scanning braced macro arguments.  Note, however, that catcode
+% changes here are ineffectual if the macro invocation was nested inside
+% an argument to another Texinfo command.
+\def\macroargctxt{%
   \scanctxt
-  \catcode`\\=0
+  \catcode`\ =\active
+  \catcode`\^^M=\other
+  \catcode`\\=\active
 }
-% why catcode 0 for \ in the above?  To recognize \\ \{ \} as "escapes"
-% for the single characters \ { }.  Thus, we end up with the "commands"
-% that would be written @\ @{ @} in a Texinfo document.
-% 
-% We already have @{ and @}.  For @\, we define it here, and only for
-% this purpose, to produce a typewriter backslash (so, the @\ that we
-% define for @math can't be used with @macro calls):
-%
-\def\\{\normalbackslash}%
-% 
-% We would like to do this for \, too, since that is what makeinfo does.
-% But it is not possible, because Texinfo already has a command @, for a
-% cedilla accent.  Documents must use @comma{} instead.
-%
-% \anythingelse will almost certainly be an error of some kind.
 
+\def\macrolineargctxt{% used for whole-line arguments without braces
+  \scanctxt
+  \catcode`\{=\other
+  \catcode`\}=\other
+}
 
 % \mbodybackslash is the definition of \ in @macro bodies.
 % It maps \foo\ => \csname macarg.foo\endcsname => #N
@@ -7391,7 +8234,7 @@ end
     % Remove the macro name from \macrolist:
     \begingroup
       \expandafter\let\csname#1\endcsname \relax
-      \let\definedummyword\unmacrodo
+      \let\commondummyword\unmacrodo
       \xdef\macrolist{\macrolist}%
     \endgroup
   \else
@@ -7406,61 +8249,40 @@ end
   \ifx #1\relax
     % remove this
   \else
-    \noexpand\definedummyword \noexpand#1%
+    \noexpand\commondummyword \noexpand#1%
   \fi
 }
 
-% This makes use of the obscure feature that if the last token of a
-% <parameter list> is #, then the preceding argument is delimited by
-% an opening brace, and that opening brace is not consumed.
+% \getargs -- Parse the arguments to a @macro line.  Set \macname to
+% the name of the macro, and \argl to the braced argument list.
 \def\getargs#1{\getargsxxx#1{}}
 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
 \def\getmacname#1 #2\relax{\macname={#1}}
 \def\getmacargs#1{\def\argl{#1}}
+% This made use of the feature that if the last token of a
+% <parameter list> is #, then the preceding argument is delimited by
+% an opening brace, and that opening brace is not consumed.
 
-% For macro processing make @ a letter so that we can make Texinfo private macro names.
-\edef\texiatcatcode{\the\catcode`\@}
-\catcode `@=11\relax
-
-% Parse the optional {params} list.  Set up \paramno and \paramlist
-% so \defmacro knows what to do.  Define \macarg.BLAH for each BLAH
-% in the params list to some hook where the argument si to be expanded.  If
-% there are less than 10 arguments that hook is to be replaced by ##N where N
+% Parse the optional {params} list to @macro or @rmacro.
+% Set \paramno to the number of arguments,
+% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
+% three-param macro.)  Define \macarg.BLAH for each BLAH in the params
+% list to some hook where the argument is to be expanded.  If there are
+% less than 10 arguments that hook is to be replaced by ##N where N
 % is the position in that list, that is to say the macro arguments are to be
 % defined `a la TeX in the macro body.  
 %
 % That gets used by \mbodybackslash (above).
 %
-% We need to get `macro parameter char #' into several definitions.
-% The technique used is stolen from LaTeX: let \hash be something
-% unexpandable, insert that wherever you need a #, and then redefine
-% it to # just before using the token list produced.
-%
-% The same technique is used to protect \eatspaces till just before
-% the macro is used.
-%
-% If there are 10 or more arguments, a different technique is used, where the
-% hook remains in the body, and when macro is to be expanded the body is
-% processed again to replace the arguments.
-%
-% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
-% argument N value and then \edef  the body (nothing else will expand because of
-% the catcode regime underwhich the body was input).
+% If there are 10 or more arguments, a different technique is used: see
+% \parsemmanyargdef.
 %
-% If you compile with TeX (not eTeX), and you have macros with 10 or more
-% arguments, you need that no macro has more than 256 arguments, otherwise an
-% error is produced.
 \def\parsemargdef#1;{%
   \paramno=0\def\paramlist{}%
   \let\hash\relax
+  % \hash is redefined to `#' later to get it into definitions
   \let\xeatspaces\relax
   \parsemargdefxxx#1,;,%
-  % In case that there are 10 or more arguments we parse again the arguments
-  % list to set new definitions for the \macarg.BLAH macros corresponding to
-  % each BLAH argument. It was anyhow needed to parse already once this list
-  % in order to count the arguments, and as macros with at most 9 arguments
-  % are by far more frequent than macro with 10 or more arguments, defining
-  % twice the \macarg.BLAH macros does not cost too much processing power.
   \ifnum\paramno<10\relax\else
     \paramno0\relax
     \parsemmanyargdef@@#1,;,% 10 or more arguments
@@ -7475,6 +8297,43 @@ end
     \edef\paramlist{\paramlist\hash\the\paramno,}%
   \fi\next}
 
+% \parsemacbody, \parsermacbody
+%
+% Read recursive and nonrecursive macro bodies. (They're different since
+% rec and nonrec macros end differently.)
+% 
+% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 
+% body to be transformed.
+% Set \macrobody to the body of the macro, and call \defmacro.
+%
+{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
+\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
+{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
+\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
+
+% Make @ a letter, so that we can make private-to-Texinfo macro names.
+\edef\texiatcatcode{\the\catcode`\@}
+\catcode `@=11\relax
+
+%%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
+
+% If there are 10 or more arguments, a different technique is used, where the
+% hook remains in the body, and when macro is to be expanded the body is
+% processed again to replace the arguments.
+%
+% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
+% argument N value and then \edef the body (nothing else will expand because of
+% the catcode regime under which the body was input).
+%
+% If you compile with TeX (not eTeX), and you have macros with 10 or more
+% arguments, no macro can have more than 256 arguments (else error).
+%
+% In case that there are 10 or more arguments we parse again the arguments
+% list to set new definitions for the \macarg.BLAH macros corresponding to
+% each BLAH argument. It was anyhow needed to parse already once this list
+% in order to count the arguments, and as macros with at most 9 arguments
+% are by far more frequent than macro with 10 or more arguments, defining
+% twice the \macarg.BLAH macros does not cost too much processing power.
 \def\parsemmanyargdef@@#1,{%
   \if#1;\let\next=\relax
   \else 
@@ -7490,16 +8349,6 @@ end
     \advance\paramno by 1\relax
   \fi\next}
 
-% These two commands read recursive and nonrecursive macro bodies.
-% (They're different since rec and nonrec macros end differently.)
-%
-
-\catcode `\@\texiatcatcode
-\long\def\parsemacbody#1@end macro%
-{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
-\long\def\parsermacbody#1@end rmacro%
-{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
-\catcode `\@=11\relax
 
 \let\endargs@\relax
 \let\nil@\relax
@@ -7507,7 +8356,7 @@ end
 \long\def\nillm@{\nil@}%
 
 % This macro is expanded during the Texinfo macro expansion, not during its
-% definition.  It gets all the arguments values and assigns them to macros
+% definition.  It gets all the arguments' values and assigns them to macros
 % macarg.ARGNAME
 %
 % #1 is the macro name
@@ -7528,8 +8377,6 @@ end
     \getargvals@@
   \fi
 }
-
-% 
 \def\getargvals@@{%
   \ifx\paramlist\nilm@
       % Some sanity check needed here that \argvaluelist is also empty.
@@ -7573,7 +8420,8 @@ end
 }
 
 % Replace arguments by their values in the macro body, and place the result
-% in macro \@tempa
+% in macro \@tempa.
+% 
 \def\macvalstoargs@{%
   %  To do this we use the property that token registers that are \the'ed
   % within an \edef  expand only once. So we are going to place all argument
@@ -7597,8 +8445,9 @@ end
   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
   }
 
+% Define the named-macro outside of this group and then close this group. 
+% 
 \def\macargexpandinbody@{% 
-  %% Define the named-macro outside of this group and then close this group. 
   \expandafter
   \endgroup
   \macargdeflist@
@@ -7635,14 +8484,8 @@ end
   \next
 }
 
-% Save the token stack pointer into macro #1
-\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
-% Restore the token stack pointer from number in macro #1
-\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
-% newtoks that can be used non \outer .
-\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
-
-% Tailing missing arguments are set to empty
+% Trailing missing arguments are set to empty.
+% 
 \def\setemptyargvalues@{%
   \ifx\paramlist\nilm@
     \let\next\macargexpandinbody@
@@ -7672,99 +8515,191 @@ end
    \long\def#2{#4}%
 }
 
-% This defines a Texinfo @macro. There are eight cases: recursive and
-% nonrecursive macros of zero, one, up to nine, and many arguments.
-% Much magic with \expandafter here.
+
+%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
+
+
+% This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
+%    \macrobody has the body of the macro in it, with placeholders for
+% its parameters, looking like "\xeatspaces{\hash 1}".
+%    \paramno is the number of parameters
+%    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
+% There are four cases: macros of zero, one, up to nine, and many arguments.
 % \xdef is used so that macro definitions will survive the file
-% they're defined in; @include reads the file inside a group.
+% they're defined in: @include reads the file inside a group.
 %
 \def\defmacro{%
   \let\hash=##% convert placeholders to macro parameter chars
-  \ifrecursive
-    \ifcase\paramno
-    % 0
-      \expandafter\xdef\csname\the\macname\endcsname{%
-        \noexpand\scanmacro{\temp}}%
-    \or % 1
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-         \egroup\noexpand\scanmacro{\temp}}%
-    \else
-      \ifnum\paramno<10\relax % at most 9
-        \expandafter\xdef\csname\the\macname\endcsname{%
-           \bgroup\noexpand\macroargctxt
-           \noexpand\csname\the\macname xx\endcsname}%
-        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-        \expandafter\expandafter
-        \expandafter\xdef
-        \expandafter\expandafter
-          \csname\the\macname xxx\endcsname
-            \paramlist{\egroup\noexpand\scanmacro{\temp}}%
-      \else % 10 or more
-        \expandafter\xdef\csname\the\macname\endcsname{%
-          \noexpand\getargvals@{\the\macname}{\argl}%
-        }%    
-        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
-        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
-      \fi
-    \fi
+  \ifnum\paramno=1
+    \def\xeatspaces##1{##1}%
+    % This removes the pair of braces around the argument.  We don't
+    % use \eatspaces, because this can cause ends of lines to be lost
+    % when the argument to \eatspaces is read, leading to line-based
+    % commands like "@itemize" not being read correctly.
   \else
-    \ifcase\paramno
-    % 0
+    \let\xeatspaces\relax % suppress expansion
+  \fi
+  \ifcase\paramno
+  % 0
+    \expandafter\xdef\csname\the\macname\endcsname{%
+      \bgroup
+        \noexpand\spaceisspace
+        \noexpand\endlineisspace
+        \noexpand\expandafter % skip any whitespace after the macro name.
+        \expandafter\noexpand\csname\the\macname @@@\endcsname}%
+    \expandafter\xdef\csname\the\macname @@@\endcsname{%
+      \egroup
+      \noexpand\scanmacro{\macrobody}}%
+  \or % 1
+    \expandafter\xdef\csname\the\macname\endcsname{%
+       \bgroup
+       \noexpand\braceorline
+       \expandafter\noexpand\csname\the\macname @@@\endcsname}%
+    \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
+      \egroup
+      \noexpand\scanmacro{\macrobody}%
+      }%
+  \else % at most 9
+    \ifnum\paramno<10\relax
+      % @MACNAME sets the context for reading the macro argument
+      % @MACNAME@@ gets the argument, processes backslashes and appends a 
+      % comma.
+      % @MACNAME@@@ removes braces surrounding the argument list.
+      % @MACNAME@@@@ scans the macro body with arguments substituted.
       \expandafter\xdef\csname\the\macname\endcsname{%
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
-    \or % 1
+        \bgroup
+        \noexpand\expandafter  % This \expandafter skip any spaces after the
+        \noexpand\macroargctxt % macro before we change the catcode of space.
+        \noexpand\expandafter
+        \expandafter\noexpand\csname\the\macname @@\endcsname}%
+      \expandafter\xdef\csname\the\macname @@\endcsname##1{%
+          \noexpand\passargtomacro
+          \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
+      \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
+          \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
+      \expandafter\expandafter
+      \expandafter\xdef
+      \expandafter\expandafter
+        \csname\the\macname @@@@\endcsname\paramlist{%
+          \egroup\noexpand\scanmacro{\macrobody}}%
+    \else % 10 or more:
       \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-        \egroup
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
-    \else % at most 9
-      \ifnum\paramno<10\relax
-        \expandafter\xdef\csname\the\macname\endcsname{%
-           \bgroup\noexpand\macroargctxt
-           \expandafter\noexpand\csname\the\macname xx\endcsname}%
-        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-        \expandafter\expandafter
-        \expandafter\xdef
-        \expandafter\expandafter
-        \csname\the\macname xxx\endcsname
-        \paramlist{%
-            \egroup
-            \noexpand\norecurse{\the\macname}%
-            \noexpand\scanmacro{\temp}\egroup}%
-      \else % 10 or more:
-        \expandafter\xdef\csname\the\macname\endcsname{%
-          \noexpand\getargvals@{\the\macname}{\argl}%
-        }%
-        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
-        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
-      \fi
+        \noexpand\getargvals@{\the\macname}{\argl}%
+      }%
+      \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
+      \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
     \fi
   \fi}
 
-\catcode `\@\texiatcatcode\relax
+\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
 
 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
 
-% \braceorline decides whether the next nonwhitespace character is a
-% {.  If so it reads up to the closing }, if not, it reads the whole
-% line.  Whatever was read is then fed to the next control sequence
-% as an argument (by \parsebrace or \parsearg).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+{\catcode`\@=0 \catcode`\\=13  % We need to manipulate \ so use @ as escape
+@catcode`@_=11  % private names
+@catcode`@!=11  % used as argument separator
+
+% \passargtomacro#1#2 -
+% Call #1 with a list of tokens #2, with any doubled backslashes in #2
+% compressed to one.
+%
+% This implementation works by expansion, and not execution (so we cannot use 
+% \def or similar).  This reduces the risk of this failing in contexts where 
+% complete expansion is done with no execution (for example, in writing out to 
+% an auxiliary file for an index entry).
+% 
+% State is kept in the input stream: the argument passed to
+% @look_ahead, @gobble_and_check_finish and @add_segment is
+%
+% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN  (... rest of input)
+%
+% where:
+% THE_MACRO - name of the macro we want to call
+% ARG_RESULT - argument list we build to pass to that macro
+% PENDING_BS - either a backslash or nothing
+% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
+
+@gdef@passargtomacro#1#2{%
+  @add_segment #1!{}@relax#2\@_finish\%
+}
+@gdef@_finish{@_finishx} @global@let@_finishx@relax
+
+% #1 - THE_MACRO ARG_RESULT
+% #2 - PENDING_BS
+% #3 - NEXT_TOKEN
+% #4 used to look ahead
+%
+% If the next token is not a backslash, process the rest of the argument; 
+% otherwise, remove the next token.
+@gdef@look_ahead#1!#2#3#4{%
+  @ifx#4\%
+   @expandafter@gobble_and_check_finish 
+  @else
+   @expandafter@add_segment
+  @fi#1!{#2}#4#4%
+}
+
+% #1 - THE_MACRO ARG_RESULT
+% #2 - PENDING_BS
+% #3 - NEXT_TOKEN
+% #4 should be a backslash, which is gobbled.
+% #5 looks ahead
+%
+% Double backslash found.  Add a single backslash, and look ahead.
+@gdef@gobble_and_check_finish#1!#2#3#4#5{%
+  @add_segment#1\!{}#5#5%
+}
+
+@gdef@is_fi{@fi}
+
+% #1 - THE_MACRO ARG_RESULT
+% #2 - PENDING_BS
+% #3 - NEXT_TOKEN
+% #4 is input stream until next backslash
+%
+% Input stream is either at the start of the argument, or just after a 
+% backslash sequence, either a lone backslash, or a doubled backslash.  
+% NEXT_TOKEN contains the first token in the input stream: if it is \finish, 
+% finish; otherwise, append to ARG_RESULT the segment of the argument up until
+% the next backslash.  PENDING_BACKSLASH contains a backslash to represent
+% a backslash just before the start of the input stream that has not been
+% added to ARG_RESULT.
+@gdef@add_segment#1!#2#3#4\{%
+@ifx#3@_finish
+  @call_the_macro#1!%
+@else
+  % append the pending backslash to the result, followed by the next segment
+  @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
+  % this @fi is discarded by @look_ahead.
+  % we can't get rid of it with \expandafter because we don't know how 
+  % long #4 is.
+}
+
+% #1 - THE_MACRO
+% #2 - ARG_RESULT
+% #3 discards the res of the conditional in @add_segment, and @is_fi ends the 
+% conditional.
+@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
+
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% \braceorline MAC is used for a one-argument macro MAC.  It checks
+% whether the next non-whitespace character is a {.  It sets the context
+% for reading the argument (slightly different in the two cases).  Then,
+% to read the argument, in the whole-line case, it then calls the regular
+% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
 % 
 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
 \def\braceorlinexxx{%
-  \ifx\nchar\bgroup\else
-    \expandafter\parsearg
+  \ifx\nchar\bgroup
+    \macroargctxt
+    \expandafter\passargtomacro
+  \else
+    \macrolineargctxt\expandafter\parsearg
   \fi \macnamexxx}
 
 
@@ -7846,7 +8781,10 @@ end
   \pdfmkdest{#1}%
   \iflinks
     {%
+      \requireauxfile
       \atdummies  % preserve commands, but don't expand them
+      % match definition in \xrdef, \refx, \xrefX.
+      \def\value##1{##1}%
       \edef\writexrdef##1##2{%
        \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
          ##1}{##2}}% these are parameters of \writexrdef
@@ -7885,9 +8823,12 @@ end
 % node name, #4 the name of the Info file, #5 the name of the printed
 % manual.  All but the node name can be omitted.
 %
-\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
-\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
-\def\ref#1{\xrefX[#1,,,,,,,]}
+\def\pxref{\putwordsee{} \xrefXX}
+\def\xref{\putwordSee{} \xrefXX}
+\def\ref{\xrefXX}
+
+\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
+\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
 %
 \newbox\toprefbox
 \newbox\printedrefnamebox
@@ -7934,9 +8875,10 @@ end
   %
   % Make link in pdf output.
   \ifpdf
+    % For pdfTeX and LuaTeX
     {\indexnofonts
-     \turnoffactive
      \makevalueexpandable
+     \turnoffactive
      % This expands tokens, so do it after making catcode changes, so _
      % etc. don't get their TeX definitions.  This ignores all spaces in
      % #4, including (wrongly) those in the middle of the filename.
@@ -7944,35 +8886,74 @@ end
      %
      % This (wrongly) does not take account of leading or trailing
      % spaces in #1, which should be ignored.
-     \edef\pdfxrefdest{#1}%
-     \ifx\pdfxrefdest\empty
-       \def\pdfxrefdest{Top}% no empty targets
-     \else
-       \txiescapepdf\pdfxrefdest  % escape PDF special chars
+     \setpdfdestname{#1}%
+     %
+     \ifx\pdfdestname\empty
+       \def\pdfdestname{Top}% no empty targets
      \fi
      %
      \leavevmode
      \startlink attr{/Border [0 0 0]}%
      \ifnum\filenamelength>0
-       goto file{\the\filename.pdf} name{\pdfxrefdest}%
+       goto file{\the\filename.pdf} name{\pdfdestname}%
      \else
-       goto name{\pdfmkpgn{\pdfxrefdest}}%
+       goto name{\pdfmkpgn{\pdfdestname}}%
      \fi
     }%
     \setcolor{\linkcolor}%
+  \else
+    \ifx\XeTeXrevision\thisisundefined
+    \else
+      % For XeTeX
+      {\indexnofonts
+       \makevalueexpandable
+       \turnoffactive
+       % This expands tokens, so do it after making catcode changes, so _
+       % etc. don't get their TeX definitions.  This ignores all spaces in
+       % #4, including (wrongly) those in the middle of the filename.
+       \getfilename{#4}%
+       %
+       % This (wrongly) does not take account of leading or trailing
+       % spaces in #1, which should be ignored.
+       \setpdfdestname{#1}%
+       %
+       \ifx\pdfdestname\empty
+         \def\pdfdestname{Top}% no empty targets
+       \fi
+       %
+       \leavevmode
+       \ifnum\filenamelength>0
+         % With default settings,
+         % XeTeX (xdvipdfmx) replaces link destination names with integers.
+         % In this case, the replaced destination names of
+         % remote PDFs are no longer known.  In order to avoid a replacement,
+         % you can use xdvipdfmx's command line option `-C 0x0010'.
+         % If you use XeTeX 0.99996+ (TeX Live 2016+),
+         % this command line option is no longer necessary
+         % because we can use the `dvipdfmx:config' special.
+         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
+           << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
+       \else
+         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
+           << /S /GoTo /D (\pdfdestname) >> >>}%
+       \fi
+      }%
+      \setcolor{\linkcolor}%
+    \fi
   \fi
-  %
-  % Float references are printed completely differently: "Figure 1.2"
-  % instead of "[somenode], p.3".  We distinguish them by the
-  % LABEL-title being set to a magic string.
   {%
     % Have to otherify everything special to allow the \csname to
     % include an _ in the xref name, etc.
     \indexnofonts
     \turnoffactive
+    \def\value##1{##1}%
     \expandafter\global\expandafter\let\expandafter\Xthisreftitle
       \csname XR#1-title\endcsname
   }%
+  %
+  % Float references are printed completely differently: "Figure 1.2"
+  % instead of "[somenode], p.3".  \iffloat distinguishes them by
+  % \Xthisreftitle being set to a magic string.
   \iffloat\Xthisreftitle
     % If the user specified the print name (third arg) to the ref,
     % print it instead of our usual "Figure 1.2".
@@ -8031,6 +9012,15 @@ end
       %
       % output the `page 3'.
       \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+      % Add a , if xref followed by a space
+      \if\space\noexpand\tokenafterxref ,%
+      \else\ifx\       \tokenafterxref ,% @TAB
+      \else\ifx\*\tokenafterxref ,%   @*
+      \else\ifx\ \tokenafterxref ,%   @SPACE
+      \else\ifx\
+                \tokenafterxref ,%    @NL
+      \else\ifx\tie\tokenafterxref ,% @tie
+      \fi\fi\fi\fi\fi\fi
     \fi\fi
   \fi
   \endlink
@@ -8097,13 +9087,14 @@ end
   \fi\fi\fi
 }
 
-% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
-% If its value is nonempty, SUFFIX is output afterward.
-%
+% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME.  SUFFIX 
+% is output afterwards if non-empty.
 \def\refx#1#2{%
+  \requireauxfile
   {%
     \indexnofonts
     \otherbackslash
+    \def\value##1{##1}%
     \expandafter\global\expandafter\let\expandafter\thisrefX
       \csname XR#1\endcsname
   }%
@@ -8128,20 +9119,28 @@ end
   #2% Output the suffix in any case.
 }
 
-% This is the macro invoked by entries in the aux file.  Usually it's
-% just a \def (we prepend XR to the control sequence name to avoid
-% collisions).  But if this is a float type, we have more work to do.
+% This is the macro invoked by entries in the aux file.  Define a control 
+% sequence for a cross-reference target (we prepend XR to the control sequence 
+% name to avoid collisions).  The value is the page number.  If this is a float 
+% type, we have more work to do.
 %
 \def\xrdef#1#2{%
-  {% The node name might contain 8-bit characters, which in our current
-   % implementation are changed to commands like @'e.  Don't let these
-   % mess up the control sequence name.
+  {% Expand the node or anchor name to remove control sequences.
+   % \turnoffactive stops 8-bit characters being changed to commands
+   % like @'e.  \refx does the same to retrieve the value in the definition.
     \indexnofonts
     \turnoffactive
+    \def\value##1{##1}%
     \xdef\safexrefname{#1}%
   }%
   %
-  \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
+  \bgroup
+    \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
+  \egroup
+  % We put the \gdef inside a group to avoid the definitions building up on 
+  % TeX's save stack, which can cause it to run out of space for aux files with 
+  % thousands of lines.  \gdef doesn't use the save stack, but \csname does
+  % when it defines an unknown control sequence as \relax. 
   %
   % Was that xref control sequence that we just defined for a float?
   \expandafter\iffloat\csname XR\safexrefname\endcsname
@@ -8164,6 +9163,23 @@ end
   \fi
 }
 
+% If working on a large document in chapters, it is convenient to
+% be able to disable indexing, cross-referencing, and contents, for test runs.
+% This is done with @novalidate at the beginning of the file.
+%
+\newif\iflinks \linkstrue % by default we want the aux files.
+\let\novalidate = \linksfalse
+
+% Used when writing to the aux file, or when using data from it.
+\def\requireauxfile{%
+  \iflinks
+    \tryauxfile
+    % Open the new aux file.  TeX will close it automatically at exit.
+    \immediate\openout\auxfile=\jobname.aux
+  \fi
+  \global\let\requireauxfile=\relax   % Only do this once.
+}
+
 % Read the last existing aux file, if any.  No error if none exists.
 %
 \def\tryauxfile{%
@@ -8242,16 +9258,6 @@ end
   % now.  --karl, 15jan04.
   \catcode`\\=\other
   %
-  % Make the characters 128-255 be printing characters.
-  {%
-    \count1=128
-    \def\loop{%
-      \catcode\count1=\other
-      \advance\count1 by 1
-      \ifnum \count1<256 \loop \fi
-    }%
-  }%
-  %
   % @ is our escape character in .aux files, and we need braces.
   \catcode`\{=1
   \catcode`\}=2
@@ -8284,8 +9290,6 @@ end
 %
 % Auto-number footnotes.  Otherwise like plain.
 \gdef\footnote{%
-  \let\indent=\ptexindent
-  \let\noindent=\ptexnoindent
   \global\advance\footnoteno by \@ne
   \edef\thisfootno{$^{\the\footnoteno}$}%
   %
@@ -8309,10 +9313,15 @@ end
 %
 \gdef\dofootnote{%
   \insert\footins\bgroup
+  %
+  % Nested footnotes are not supported in TeX, that would take a lot
+  % more work.  (\startsavinginserts does not suffice.)
+  \let\footnote=\errfootnotenest
+  %
   % We want to typeset this text as a normal paragraph, even if the
   % footnote reference occurs in (for example) a display environment.
   % So reset some parameters.
-  \hsize=\pagewidth
+  \hsize=\txipagewidth
   \interlinepenalty\interfootnotelinepenalty
   \splittopskip\ht\strutbox % top baseline for broken footnotes
   \splitmaxdepth\dp\strutbox
@@ -8346,13 +9355,24 @@ end
 }
 }%end \catcode `\@=11
 
+\def\errfootnotenest{%
+  \errhelp=\EMsimple
+  \errmessage{Nested footnotes not supported in texinfo.tex,
+    even though they work in makeinfo; sorry}
+}
+
+\def\errfootnoteheading{%
+  \errhelp=\EMsimple
+  \errmessage{Footnotes in chapters, sections, etc., are not supported}
+}
+
 % In case a @footnote appears in a vbox, save the footnote text and create
 % the real \insert just after the vbox finished.  Otherwise, the insertion
 % would be lost.
 % Similarly, if a @footnote appears inside an alignment, save the footnote
 % text to a box and make the \insert when a row of the table is finished.
 % And the same can be done for other insert classes.  --kasal, 16nov03.
-
+%
 % Replace the \insert primitive by a cheating macro.
 % Deeper inside, just make sure that the saved insertions are not spilled
 % out prematurely.
@@ -8450,6 +9470,7 @@ end
 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
   \catcode`\^^M = 5     % in case we're inside an example
   \normalturnoffactive  % allow _ et al. in names
+  \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
   % If the image is by itself, center it.
   \ifvmode
     \imagevmodetrue
@@ -8479,12 +9500,21 @@ end
   %
   % Output the image.
   \ifpdf
+    % For pdfTeX and LuaTeX <= 0.80
     \dopdfimage{#1}{#2}{#3}%
   \else
-    % \epsfbox itself resets \epsf?size at each figure.
-    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
-    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
-    \epsfbox{#1.eps}%
+    \ifx\XeTeXrevision\thisisundefined
+      % For epsf.tex
+      % \epsfbox itself resets \epsf?size at each figure.
+      \setbox0 = \hbox{\ignorespaces #2}%
+        \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
+      \setbox0 = \hbox{\ignorespaces #3}%
+        \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
+      \epsfbox{#1.eps}%
+    \else
+      % For XeTeX
+      \doxeteximage{#1}{#2}{#3}%
+    \fi
   \fi
   %
   \ifimagevmode
@@ -8606,7 +9636,7 @@ end
     %
     \ifx\thiscaption\empty \else
       \ifx\floatident\empty \else
-       \appendtomacro\captionline{: }% had ident, so need a colon between
+        \appendtomacro\captionline{: }% had ident, so need a colon between
       \fi
       %
       % caption text.
@@ -8630,32 +9660,20 @@ end
       % \floatlabel-lof.  Besides \floatident, we include the short
       % caption if specified, else the full caption if specified, else nothing.
       {%
+        \requireauxfile
         \atdummies
         %
-        % since we read the caption text in the macro world, where ^^M
-        % is turned into a normal character, we have to scan it back, so
-        % we don't write the literal three characters "^^M" into the aux file.
-       \scanexp{%
-         \xdef\noexpand\gtemp{%
-           \ifx\thisshortcaption\empty
-             \thiscaption
-           \else
-             \thisshortcaption
-           \fi
-         }%
-       }%
+        \ifx\thisshortcaption\empty
+          \def\gtemp{\thiscaption}%
+        \else
+          \def\gtemp{\thisshortcaption}%
+        \fi
         \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
-         \ifx\gtemp\empty \else : \gtemp \fi}}%
+          \ifx\gtemp\empty \else : \gtemp \fi}}%
       }%
     \fi
   \egroup  % end of \vtop
   %
-  % place the captured inserts
-  %
-  % BEWARE: when the floats start floating, we have to issue warning
-  % whenever an insert appears inside a float which could possibly
-  % float. --kasal, 26may04
-  %
   \checkinserts
 }
 
@@ -8769,20 +9787,20 @@ end
 {
   \catcode`\_ = \active
   \globaldefs=1
-\parseargdef\documentlanguage{\begingroup
-  \let_=\normalunderscore  % normal _ character for filenames
+\parseargdef\documentlanguage{%
   \tex % read txi-??.tex file in plain TeX.
     % Read the file by the name they passed if it exists.
+    \let_ = \normalunderscore  % normal _ character for filename test
     \openin 1 txi-#1.tex
     \ifeof 1
-      \documentlanguagetrywithoutunderscore{#1_\finish}%
+      \documentlanguagetrywithoutunderscore #1_\finish
     \else
       \globaldefs = 1  % everything in the txi-LL files needs to persist
       \input txi-#1.tex
     \fi
     \closein 1
   \endgroup % end raw TeX
-\endgroup}
+}
 %
 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
 % try txi-de.tex.
@@ -8830,6 +9848,70 @@ directory should work if nowhere else does.}
   \global\righthyphenmin = #3\relax
 }
 
+% XeTeX and LuaTeX can handle Unicode natively.
+% Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
+% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
+%
+\newif\iftxinativeunicodecapable
+\newif\iftxiusebytewiseio
+
+\ifx\XeTeXrevision\thisisundefined
+  \ifx\luatexversion\thisisundefined
+    \txinativeunicodecapablefalse
+    \txiusebytewiseiotrue
+  \else
+    \txinativeunicodecapabletrue
+    \txiusebytewiseiofalse
+  \fi
+\else
+  \txinativeunicodecapabletrue
+  \txiusebytewiseiofalse
+\fi
+
+% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
+% for non-UTF-8 (byte-wise) encodings.
+%
+\def\setbytewiseio{%
+  \ifx\XeTeXrevision\thisisundefined
+  \else
+    \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
+    \XeTeXinputencoding "bytes"  % For document root file
+    % Unfortunately, there seems to be no corresponding XeTeX command for
+    % output encoding.  This is a problem for auxiliary index and TOC files.
+    % The only solution would be perhaps to write out @U{...} sequences in
+    % place of non-ASCII characters.
+  \fi
+
+  \ifx\luatexversion\thisisundefined
+  \else
+    \directlua{
+    local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
+    local function convert_char (char)
+      return utf8_char(byte(char))
+    end
+
+    local function convert_line (line)
+      return gsub(line, ".", convert_char)
+    end
+
+    callback.register("process_input_buffer", convert_line)
+
+    local function convert_line_out (line)
+      local line_out = ""
+      for c in string.utfvalues(line) do
+         line_out = line_out .. string.char(c)
+      end
+      return line_out
+    end
+
+    callback.register("process_output_buffer", convert_line_out)
+    }
+  \fi
+
+  \txiusebytewiseiotrue
+}
+
+
 % Helpers for encodings.
 % Set the catcode of characters 128 through 255 to the specified number.
 %
@@ -8852,7 +9934,9 @@ directory should work if nowhere else does.}
 % @documentencoding sets the definition of non-ASCII characters
 % according to the specified encoding.
 %
-\parseargdef\documentencoding{%
+\def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
+\def\documentencodingzzz#1{%
+  %
   % Encoding being declared for the document.
   \def\declaredencoding{\csname #1.enc\endcsname}%
   %
@@ -8868,35 +9952,66 @@ directory should work if nowhere else does.}
      \asciichardefs
   %
   \else \ifx \declaredencoding \lattwo
+     \iftxinativeunicodecapable
+       \setbytewiseio
+     \fi
      \setnonasciicharscatcode\active
      \lattwochardefs
   %
   \else \ifx \declaredencoding \latone
+     \iftxinativeunicodecapable
+       \setbytewiseio
+     \fi
      \setnonasciicharscatcode\active
      \latonechardefs
   %
   \else \ifx \declaredencoding \latnine
+     \iftxinativeunicodecapable
+       \setbytewiseio
+     \fi
      \setnonasciicharscatcode\active
      \latninechardefs
   %
   \else \ifx \declaredencoding \utfeight
-     \setnonasciicharscatcode\active
-     \utfeightchardefs
+     \iftxinativeunicodecapable
+       % For native Unicode handling (XeTeX and LuaTeX)
+       \nativeunicodechardefs
+     \else
+       % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
+       \setnonasciicharscatcode\active
+       % since we already invoked \utfeightchardefs at the top level
+       % (below), do not re-invoke it, otherwise our check for duplicated
+       % definitions gets triggered.  Making non-ascii chars active is
+       % sufficient.
+     \fi
   %
   \else
-    \message{Unknown document encoding #1, ignoring.}%
+    \message{Ignoring unknown document encoding: #1.}%
   %
   \fi % utfeight
   \fi % latnine
   \fi % latone
   \fi % lattwo
   \fi % ascii
+  %
+  \ifx\XeTeXrevision\thisisundefined
+  \else
+    \ifx \declaredencoding \utfeight
+    \else
+      \ifx \declaredencoding \ascii
+      \else
+        \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
+        non-ASCII characters in auxiliary files.}%
+      \fi
+    \fi
+  \fi
 }
 
+% emacs-page
 % A message to be logged when using a character that isn't available
 % the default font encoding (OT1).
 %
-\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
+\def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
 
 % Take account of \c (plain) vs. \, (Texinfo) difference.
 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
@@ -8906,111 +10021,119 @@ directory should work if nowhere else does.}
 % macros containing the character definitions.
 \setnonasciicharscatcode\active
 %
+
+\def\gdefchar#1#2{%
+\gdef#1{%
+   \ifpassthroughchars
+     \string#1%
+   \else
+     #2%
+   \fi
+}}
+
 % Latin1 (ISO-8859-1) character definitions.
 \def\latonechardefs{%
-  \gdef^^a0{\tie}
-  \gdef^^a1{\exclamdown}
-  \gdef^^a2{\missingcharmsg{CENT SIGN}}
-  \gdef^^a3{{\pounds}}
-  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
-  \gdef^^a5{\missingcharmsg{YEN SIGN}}
-  \gdef^^a6{\missingcharmsg{BROKEN BAR}}
-  \gdef^^a7{\S}
-  \gdef^^a8{\"{}}
-  \gdef^^a9{\copyright}
-  \gdef^^aa{\ordf}
-  \gdef^^ab{\guillemetleft}
-  \gdef^^ac{$\lnot$}
-  \gdef^^ad{\-}
-  \gdef^^ae{\registeredsymbol}
-  \gdef^^af{\={}}
-  %
-  \gdef^^b0{\textdegree}
-  \gdef^^b1{$\pm$}
-  \gdef^^b2{$^2$}
-  \gdef^^b3{$^3$}
-  \gdef^^b4{\'{}}
-  \gdef^^b5{$\mu$}
-  \gdef^^b6{\P}
-  %
-  \gdef^^b7{$^.$}
-  \gdef^^b8{\cedilla\ }
-  \gdef^^b9{$^1$}
-  \gdef^^ba{\ordm}
-  %
-  \gdef^^bb{\guillemetright}
-  \gdef^^bc{$1\over4$}
-  \gdef^^bd{$1\over2$}
-  \gdef^^be{$3\over4$}
-  \gdef^^bf{\questiondown}
-  %
-  \gdef^^c0{\`A}
-  \gdef^^c1{\'A}
-  \gdef^^c2{\^A}
-  \gdef^^c3{\~A}
-  \gdef^^c4{\"A}
-  \gdef^^c5{\ringaccent A}
-  \gdef^^c6{\AE}
-  \gdef^^c7{\cedilla C}
-  \gdef^^c8{\`E}
-  \gdef^^c9{\'E}
-  \gdef^^ca{\^E}
-  \gdef^^cb{\"E}
-  \gdef^^cc{\`I}
-  \gdef^^cd{\'I}
-  \gdef^^ce{\^I}
-  \gdef^^cf{\"I}
-  %
-  \gdef^^d0{\DH}
-  \gdef^^d1{\~N}
-  \gdef^^d2{\`O}
-  \gdef^^d3{\'O}
-  \gdef^^d4{\^O}
-  \gdef^^d5{\~O}
-  \gdef^^d6{\"O}
-  \gdef^^d7{$\times$}
-  \gdef^^d8{\O}
-  \gdef^^d9{\`U}
-  \gdef^^da{\'U}
-  \gdef^^db{\^U}
-  \gdef^^dc{\"U}
-  \gdef^^dd{\'Y}
-  \gdef^^de{\TH}
-  \gdef^^df{\ss}
-  %
-  \gdef^^e0{\`a}
-  \gdef^^e1{\'a}
-  \gdef^^e2{\^a}
-  \gdef^^e3{\~a}
-  \gdef^^e4{\"a}
-  \gdef^^e5{\ringaccent a}
-  \gdef^^e6{\ae}
-  \gdef^^e7{\cedilla c}
-  \gdef^^e8{\`e}
-  \gdef^^e9{\'e}
-  \gdef^^ea{\^e}
-  \gdef^^eb{\"e}
-  \gdef^^ec{\`{\dotless i}}
-  \gdef^^ed{\'{\dotless i}}
-  \gdef^^ee{\^{\dotless i}}
-  \gdef^^ef{\"{\dotless i}}
-  %
-  \gdef^^f0{\dh}
-  \gdef^^f1{\~n}
-  \gdef^^f2{\`o}
-  \gdef^^f3{\'o}
-  \gdef^^f4{\^o}
-  \gdef^^f5{\~o}
-  \gdef^^f6{\"o}
-  \gdef^^f7{$\div$}
-  \gdef^^f8{\o}
-  \gdef^^f9{\`u}
-  \gdef^^fa{\'u}
-  \gdef^^fb{\^u}
-  \gdef^^fc{\"u}
-  \gdef^^fd{\'y}
-  \gdef^^fe{\th}
-  \gdef^^ff{\"y}
+  \gdefchar^^a0{\tie}
+  \gdefchar^^a1{\exclamdown}
+  \gdefchar^^a2{{\tcfont \char162}} % cent
+  \gdefchar^^a3{\pounds{}}
+  \gdefchar^^a4{{\tcfont \char164}} % currency
+  \gdefchar^^a5{{\tcfont \char165}} % yen
+  \gdefchar^^a6{{\tcfont \char166}} % broken bar
+  \gdefchar^^a7{\S}
+  \gdefchar^^a8{\"{}}
+  \gdefchar^^a9{\copyright{}}
+  \gdefchar^^aa{\ordf}
+  \gdefchar^^ab{\guillemetleft{}}
+  \gdefchar^^ac{\ensuremath\lnot}
+  \gdefchar^^ad{\-}
+  \gdefchar^^ae{\registeredsymbol{}}
+  \gdefchar^^af{\={}}
+  %
+  \gdefchar^^b0{\textdegree}
+  \gdefchar^^b1{$\pm$}
+  \gdefchar^^b2{$^2$}
+  \gdefchar^^b3{$^3$}
+  \gdefchar^^b4{\'{}}
+  \gdefchar^^b5{$\mu$}
+  \gdefchar^^b6{\P}
+  \gdefchar^^b7{\ensuremath\cdot}
+  \gdefchar^^b8{\cedilla\ }
+  \gdefchar^^b9{$^1$}
+  \gdefchar^^ba{\ordm}
+  \gdefchar^^bb{\guillemetright{}}
+  \gdefchar^^bc{$1\over4$}
+  \gdefchar^^bd{$1\over2$}
+  \gdefchar^^be{$3\over4$}
+  \gdefchar^^bf{\questiondown}
+  %
+  \gdefchar^^c0{\`A}
+  \gdefchar^^c1{\'A}
+  \gdefchar^^c2{\^A}
+  \gdefchar^^c3{\~A}
+  \gdefchar^^c4{\"A}
+  \gdefchar^^c5{\ringaccent A}
+  \gdefchar^^c6{\AE}
+  \gdefchar^^c7{\cedilla C}
+  \gdefchar^^c8{\`E}
+  \gdefchar^^c9{\'E}
+  \gdefchar^^ca{\^E}
+  \gdefchar^^cb{\"E}
+  \gdefchar^^cc{\`I}
+  \gdefchar^^cd{\'I}
+  \gdefchar^^ce{\^I}
+  \gdefchar^^cf{\"I}
+  %
+  \gdefchar^^d0{\DH}
+  \gdefchar^^d1{\~N}
+  \gdefchar^^d2{\`O}
+  \gdefchar^^d3{\'O}
+  \gdefchar^^d4{\^O}
+  \gdefchar^^d5{\~O}
+  \gdefchar^^d6{\"O}
+  \gdefchar^^d7{$\times$}
+  \gdefchar^^d8{\O}
+  \gdefchar^^d9{\`U}
+  \gdefchar^^da{\'U}
+  \gdefchar^^db{\^U}
+  \gdefchar^^dc{\"U}
+  \gdefchar^^dd{\'Y}
+  \gdefchar^^de{\TH}
+  \gdefchar^^df{\ss}
+  %
+  \gdefchar^^e0{\`a}
+  \gdefchar^^e1{\'a}
+  \gdefchar^^e2{\^a}
+  \gdefchar^^e3{\~a}
+  \gdefchar^^e4{\"a}
+  \gdefchar^^e5{\ringaccent a}
+  \gdefchar^^e6{\ae}
+  \gdefchar^^e7{\cedilla c}
+  \gdefchar^^e8{\`e}
+  \gdefchar^^e9{\'e}
+  \gdefchar^^ea{\^e}
+  \gdefchar^^eb{\"e}
+  \gdefchar^^ec{\`{\dotless i}}
+  \gdefchar^^ed{\'{\dotless i}}
+  \gdefchar^^ee{\^{\dotless i}}
+  \gdefchar^^ef{\"{\dotless i}}
+  %
+  \gdefchar^^f0{\dh}
+  \gdefchar^^f1{\~n}
+  \gdefchar^^f2{\`o}
+  \gdefchar^^f3{\'o}
+  \gdefchar^^f4{\^o}
+  \gdefchar^^f5{\~o}
+  \gdefchar^^f6{\"o}
+  \gdefchar^^f7{$\div$}
+  \gdefchar^^f8{\o}
+  \gdefchar^^f9{\`u}
+  \gdefchar^^fa{\'u}
+  \gdefchar^^fb{\^u}
+  \gdefchar^^fc{\"u}
+  \gdefchar^^fd{\'y}
+  \gdefchar^^fe{\th}
+  \gdefchar^^ff{\"y}
 }
 
 % Latin9 (ISO-8859-15) encoding character definitions.
@@ -9018,119 +10141,119 @@ directory should work if nowhere else does.}
   % Encoding is almost identical to Latin1.
   \latonechardefs
   %
-  \gdef^^a4{\euro}
-  \gdef^^a6{\v S}
-  \gdef^^a8{\v s}
-  \gdef^^b4{\v Z}
-  \gdef^^b8{\v z}
-  \gdef^^bc{\OE}
-  \gdef^^bd{\oe}
-  \gdef^^be{\"Y}
+  \gdefchar^^a4{\euro{}}
+  \gdefchar^^a6{\v S}
+  \gdefchar^^a8{\v s}
+  \gdefchar^^b4{\v Z}
+  \gdefchar^^b8{\v z}
+  \gdefchar^^bc{\OE}
+  \gdefchar^^bd{\oe}
+  \gdefchar^^be{\"Y}
 }
 
 % Latin2 (ISO-8859-2) character definitions.
 \def\lattwochardefs{%
-  \gdef^^a0{\tie}
-  \gdef^^a1{\ogonek{A}}
-  \gdef^^a2{\u{}}
-  \gdef^^a3{\L}
-  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
-  \gdef^^a5{\v L}
-  \gdef^^a6{\'S}
-  \gdef^^a7{\S}
-  \gdef^^a8{\"{}}
-  \gdef^^a9{\v S}
-  \gdef^^aa{\cedilla S}
-  \gdef^^ab{\v T}
-  \gdef^^ac{\'Z}
-  \gdef^^ad{\-}
-  \gdef^^ae{\v Z}
-  \gdef^^af{\dotaccent Z}
-  %
-  \gdef^^b0{\textdegree}
-  \gdef^^b1{\ogonek{a}}
-  \gdef^^b2{\ogonek{ }}
-  \gdef^^b3{\l}
-  \gdef^^b4{\'{}}
-  \gdef^^b5{\v l}
-  \gdef^^b6{\'s}
-  \gdef^^b7{\v{}}
-  \gdef^^b8{\cedilla\ }
-  \gdef^^b9{\v s}
-  \gdef^^ba{\cedilla s}
-  \gdef^^bb{\v t}
-  \gdef^^bc{\'z}
-  \gdef^^bd{\H{}}
-  \gdef^^be{\v z}
-  \gdef^^bf{\dotaccent z}
-  %
-  \gdef^^c0{\'R}
-  \gdef^^c1{\'A}
-  \gdef^^c2{\^A}
-  \gdef^^c3{\u A}
-  \gdef^^c4{\"A}
-  \gdef^^c5{\'L}
-  \gdef^^c6{\'C}
-  \gdef^^c7{\cedilla C}
-  \gdef^^c8{\v C}
-  \gdef^^c9{\'E}
-  \gdef^^ca{\ogonek{E}}
-  \gdef^^cb{\"E}
-  \gdef^^cc{\v E}
-  \gdef^^cd{\'I}
-  \gdef^^ce{\^I}
-  \gdef^^cf{\v D}
-  %
-  \gdef^^d0{\DH}
-  \gdef^^d1{\'N}
-  \gdef^^d2{\v N}
-  \gdef^^d3{\'O}
-  \gdef^^d4{\^O}
-  \gdef^^d5{\H O}
-  \gdef^^d6{\"O}
-  \gdef^^d7{$\times$}
-  \gdef^^d8{\v R}
-  \gdef^^d9{\ringaccent U}
-  \gdef^^da{\'U}
-  \gdef^^db{\H U}
-  \gdef^^dc{\"U}
-  \gdef^^dd{\'Y}
-  \gdef^^de{\cedilla T}
-  \gdef^^df{\ss}
-  %
-  \gdef^^e0{\'r}
-  \gdef^^e1{\'a}
-  \gdef^^e2{\^a}
-  \gdef^^e3{\u a}
-  \gdef^^e4{\"a}
-  \gdef^^e5{\'l}
-  \gdef^^e6{\'c}
-  \gdef^^e7{\cedilla c}
-  \gdef^^e8{\v c}
-  \gdef^^e9{\'e}
-  \gdef^^ea{\ogonek{e}}
-  \gdef^^eb{\"e}
-  \gdef^^ec{\v e}
-  \gdef^^ed{\'{\dotless{i}}}
-  \gdef^^ee{\^{\dotless{i}}}
-  \gdef^^ef{\v d}
-  %
-  \gdef^^f0{\dh}
-  \gdef^^f1{\'n}
-  \gdef^^f2{\v n}
-  \gdef^^f3{\'o}
-  \gdef^^f4{\^o}
-  \gdef^^f5{\H o}
-  \gdef^^f6{\"o}
-  \gdef^^f7{$\div$}
-  \gdef^^f8{\v r}
-  \gdef^^f9{\ringaccent u}
-  \gdef^^fa{\'u}
-  \gdef^^fb{\H u}
-  \gdef^^fc{\"u}
-  \gdef^^fd{\'y}
-  \gdef^^fe{\cedilla t}
-  \gdef^^ff{\dotaccent{}}
+  \gdefchar^^a0{\tie}
+  \gdefchar^^a1{\ogonek{A}}
+  \gdefchar^^a2{\u{}}
+  \gdefchar^^a3{\L}
+  \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
+  \gdefchar^^a5{\v L}
+  \gdefchar^^a6{\'S}
+  \gdefchar^^a7{\S}
+  \gdefchar^^a8{\"{}}
+  \gdefchar^^a9{\v S}
+  \gdefchar^^aa{\cedilla S}
+  \gdefchar^^ab{\v T}
+  \gdefchar^^ac{\'Z}
+  \gdefchar^^ad{\-}
+  \gdefchar^^ae{\v Z}
+  \gdefchar^^af{\dotaccent Z}
+  %
+  \gdefchar^^b0{\textdegree{}}
+  \gdefchar^^b1{\ogonek{a}}
+  \gdefchar^^b2{\ogonek{ }}
+  \gdefchar^^b3{\l}
+  \gdefchar^^b4{\'{}}
+  \gdefchar^^b5{\v l}
+  \gdefchar^^b6{\'s}
+  \gdefchar^^b7{\v{}}
+  \gdefchar^^b8{\cedilla\ }
+  \gdefchar^^b9{\v s}
+  \gdefchar^^ba{\cedilla s}
+  \gdefchar^^bb{\v t}
+  \gdefchar^^bc{\'z}
+  \gdefchar^^bd{\H{}}
+  \gdefchar^^be{\v z}
+  \gdefchar^^bf{\dotaccent z}
+  %
+  \gdefchar^^c0{\'R}
+  \gdefchar^^c1{\'A}
+  \gdefchar^^c2{\^A}
+  \gdefchar^^c3{\u A}
+  \gdefchar^^c4{\"A}
+  \gdefchar^^c5{\'L}
+  \gdefchar^^c6{\'C}
+  \gdefchar^^c7{\cedilla C}
+  \gdefchar^^c8{\v C}
+  \gdefchar^^c9{\'E}
+  \gdefchar^^ca{\ogonek{E}}
+  \gdefchar^^cb{\"E}
+  \gdefchar^^cc{\v E}
+  \gdefchar^^cd{\'I}
+  \gdefchar^^ce{\^I}
+  \gdefchar^^cf{\v D}
+  %
+  \gdefchar^^d0{\DH}
+  \gdefchar^^d1{\'N}
+  \gdefchar^^d2{\v N}
+  \gdefchar^^d3{\'O}
+  \gdefchar^^d4{\^O}
+  \gdefchar^^d5{\H O}
+  \gdefchar^^d6{\"O}
+  \gdefchar^^d7{$\times$}
+  \gdefchar^^d8{\v R}
+  \gdefchar^^d9{\ringaccent U}
+  \gdefchar^^da{\'U}
+  \gdefchar^^db{\H U}
+  \gdefchar^^dc{\"U}
+  \gdefchar^^dd{\'Y}
+  \gdefchar^^de{\cedilla T}
+  \gdefchar^^df{\ss}
+  %
+  \gdefchar^^e0{\'r}
+  \gdefchar^^e1{\'a}
+  \gdefchar^^e2{\^a}
+  \gdefchar^^e3{\u a}
+  \gdefchar^^e4{\"a}
+  \gdefchar^^e5{\'l}
+  \gdefchar^^e6{\'c}
+  \gdefchar^^e7{\cedilla c}
+  \gdefchar^^e8{\v c}
+  \gdefchar^^e9{\'e}
+  \gdefchar^^ea{\ogonek{e}}
+  \gdefchar^^eb{\"e}
+  \gdefchar^^ec{\v e}
+  \gdefchar^^ed{\'{\dotless{i}}}
+  \gdefchar^^ee{\^{\dotless{i}}}
+  \gdefchar^^ef{\v d}
+  %
+  \gdefchar^^f0{\dh}
+  \gdefchar^^f1{\'n}
+  \gdefchar^^f2{\v n}
+  \gdefchar^^f3{\'o}
+  \gdefchar^^f4{\^o}
+  \gdefchar^^f5{\H o}
+  \gdefchar^^f6{\"o}
+  \gdefchar^^f7{$\div$}
+  \gdefchar^^f8{\v r}
+  \gdefchar^^f9{\ringaccent u}
+  \gdefchar^^fa{\'u}
+  \gdefchar^^fb{\H u}
+  \gdefchar^^fc{\"u}
+  \gdefchar^^fd{\'y}
+  \gdefchar^^fe{\cedilla t}
+  \gdefchar^^ff{\dotaccent{}}
 }
 
 % UTF-8 character definitions.
@@ -9160,38 +10283,94 @@ directory should work if nowhere else does.}
   \fi
 }
 
+% Give non-ASCII bytes the active definitions for processing UTF-8 sequences
 \begingroup
   \catcode`\~13
+  \catcode`\$12
   \catcode`\"12
 
+  % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
+  % substituting ~ and $ with a character token of that value.
   \def\UTFviiiLoop{%
     \global\catcode\countUTFx\active
     \uccode`\~\countUTFx
+    \uccode`\$\countUTFx
     \uppercase\expandafter{\UTFviiiTmp}%
     \advance\countUTFx by 1
     \ifnum\countUTFx < \countUTFy
       \expandafter\UTFviiiLoop
     \fi}
 
+  % For bytes other than the first in a UTF-8 sequence.  Not expected to
+  % be expanded except when writing to auxiliary files.
+  \countUTFx = "80
+  \countUTFy = "C2
+  \def\UTFviiiTmp{%
+    \gdef~{%
+        \ifpassthroughchars $\fi}}%
+  \UTFviiiLoop
+
   \countUTFx = "C2
   \countUTFy = "E0
   \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
+    \gdef~{%
+        \ifpassthroughchars $%
+        \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
   \UTFviiiLoop
 
   \countUTFx = "E0
   \countUTFy = "F0
   \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
+    \gdef~{%
+        \ifpassthroughchars $%
+        \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
   \UTFviiiLoop
 
   \countUTFx = "F0
   \countUTFy = "F4
   \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiFourOctets\string~}}
+    \gdef~{%
+        \ifpassthroughchars $%
+        \else\expandafter\UTFviiiFourOctets\expandafter$\fi
+        }}%
   \UTFviiiLoop
 \endgroup
 
+\def\globallet{\global\let} % save some \expandafter's below
+
+% @U{xxxx} to produce U+xxxx, if we support it.
+\def\U#1{%
+  \expandafter\ifx\csname uni:#1\endcsname \relax
+    \iftxinativeunicodecapable
+      % All Unicode characters can be used if native Unicode handling is
+      % active.  However, if the font does not have the glyph,
+      % letters are missing.
+      \begingroup
+        \uccode`\.="#1\relax
+        \uppercase{.}
+      \endgroup
+    \else
+      \errhelp = \EMsimple     
+      \errmessage{Unicode character U+#1 not supported, sorry}%
+    \fi
+  \else
+    \csname uni:#1\endcsname
+  \fi
+}
+
+% These macros are used here to construct the name of a control
+% sequence to be defined.
+\def\UTFviiiTwoOctetsName#1#2{%
+  \csname u8:#1\string #2\endcsname}%
+\def\UTFviiiThreeOctetsName#1#2#3{%
+  \csname u8:#1\string #2\string #3\endcsname}%
+\def\UTFviiiFourOctetsName#1#2#3#4{%
+  \csname u8:#1\string #2\string #3\string #4\endcsname}%
+
+% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
+% provide a definition macro to replace a Unicode character;
+% this gets used by the @U command
+%
 \begingroup
   \catcode`\"=12
   \catcode`\<=12
@@ -9200,459 +10379,839 @@ directory should work if nowhere else does.}
   \catcode`\;=12
   \catcode`\!=12
   \catcode`\~=13
-
-  \gdef\DeclareUnicodeCharacter#1#2{%
+  \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
     \countUTFz = "#1\relax
-    %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
     \begingroup
       \parseXMLCharref
-      \def\UTFviiiTwoOctets##1##2{%
-        \csname u8:##1\string ##2\endcsname}%
-      \def\UTFviiiThreeOctets##1##2##3{%
-        \csname u8:##1\string ##2\string ##3\endcsname}%
-      \def\UTFviiiFourOctets##1##2##3##4{%
-        \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
-      \expandafter\expandafter\expandafter\expandafter
-       \expandafter\expandafter\expandafter
-       \gdef\UTFviiiTmp{#2}%
+    
+      % Give \u8:... its definition.  The sequence of seven \expandafter's
+      % expands after the \gdef three times, e.g.
+      %
+      % 1.  \UTFviiTwoOctetsName B1 B2
+      % 2.  \csname u8:B1 \string B2 \endcsname
+      % 3.  \u8: B1 B2  (a single control sequence token)
+      %
+      \expandafter\expandafter
+      \expandafter\expandafter
+      \expandafter\expandafter
+      \expandafter\gdef       \UTFviiiTmp{#2}%
+      % 
+      \expandafter\ifx\csname uni:#1\endcsname \relax \else
+       \message{Internal error, already defined: #1}%
+      \fi
+      %
+      % define an additional control sequence for this code point.
+      \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
     \endgroup}
-
+  %
+  % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
+  % to the corresponding UTF-8 sequence.
   \gdef\parseXMLCharref{%
     \ifnum\countUTFz < "A0\relax
       \errhelp = \EMsimple
       \errmessage{Cannot define Unicode char value < 00A0}%
     \else\ifnum\countUTFz < "800\relax
       \parseUTFviiiA,%
-      \parseUTFviiiB C\UTFviiiTwoOctets.,%
+      \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
     \else\ifnum\countUTFz < "10000\relax
       \parseUTFviiiA;%
       \parseUTFviiiA,%
-      \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
+      \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
     \else
       \parseUTFviiiA;%
       \parseUTFviiiA,%
       \parseUTFviiiA!%
-      \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
+      \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
     \fi\fi\fi
   }
 
+  % Extract a byte from the end of the UTF-8 representation of \countUTFx.
+  % It must be a non-initial byte in the sequence.
+  % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
+  % of the bytes.
   \gdef\parseUTFviiiA#1{%
     \countUTFx = \countUTFz
     \divide\countUTFz by 64
-    \countUTFy = \countUTFz
+    \countUTFy = \countUTFz  % Save to be the future value of \countUTFz.
     \multiply\countUTFz by 64
+    
+    % \countUTFz is now \countUTFx with the last 5 bits cleared.  Subtract
+    % in order to get the last five bits.
     \advance\countUTFx by -\countUTFz
+
+    % Convert this to the byte in the UTF-8 sequence.
     \advance\countUTFx by 128
     \uccode `#1\countUTFx
     \countUTFz = \countUTFy}
 
+  % Used to put a UTF-8 byte sequence into \UTFviiiTmp
+  % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
+  %    sequence.
+  % #2 is one of the \UTFviii*OctetsName macros.
+  % #3 is always a full stop (.)
+  % #4 is a template for the other bytes in the sequence.  The values for these
+  %    bytes is substituted in here with \uppercase using the \uccode's.
   \gdef\parseUTFviiiB#1#2#3#4{%
     \advance\countUTFz by "#10\relax
     \uccode `#3\countUTFz
     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
 \endgroup
 
+% For native Unicode handling (XeTeX and LuaTeX),
+% provide a definition macro that sets a catcode to `other' non-globally
+%
+\def\DeclareUnicodeCharacterNativeOther#1#2{%
+  \catcode"#1=\other
+}
+
+% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
+% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
+% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
+% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
+% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
+% 
+% Many of our renditions are less than wonderful, and all the missing
+% characters are available somewhere.  Loading the necessary fonts
+% awaits user request.  We can't truly support Unicode without
+% reimplementing everything that's been done in LaTeX for many years,
+% plus probably using luatex or xetex, and who knows what else.
+% We won't be doing that here in this simple file.  But we can try to at
+% least make most of the characters not bomb out.
+%
+\def\unicodechardefs{%
+  \DeclareUnicodeCharacter{00A0}{\tie}%
+  \DeclareUnicodeCharacter{00A1}{\exclamdown}%
+  \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
+  \DeclareUnicodeCharacter{00A3}{\pounds{}}%
+  \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
+  \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
+  \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
+  \DeclareUnicodeCharacter{00A7}{\S}%
+  \DeclareUnicodeCharacter{00A8}{\"{ }}%
+  \DeclareUnicodeCharacter{00A9}{\copyright{}}%
+  \DeclareUnicodeCharacter{00AA}{\ordf}%
+  \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
+  \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
+  \DeclareUnicodeCharacter{00AD}{\-}%
+  \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
+  \DeclareUnicodeCharacter{00AF}{\={ }}%
+  %
+  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
+  \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
+  \DeclareUnicodeCharacter{00B2}{$^2$}%
+  \DeclareUnicodeCharacter{00B3}{$^3$}%
+  \DeclareUnicodeCharacter{00B4}{\'{ }}%
+  \DeclareUnicodeCharacter{00B5}{$\mu$}%
+  \DeclareUnicodeCharacter{00B6}{\P}%
+  \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
+  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
+  \DeclareUnicodeCharacter{00B9}{$^1$}%
+  \DeclareUnicodeCharacter{00BA}{\ordm}%
+  \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
+  \DeclareUnicodeCharacter{00BC}{$1\over4$}%
+  \DeclareUnicodeCharacter{00BD}{$1\over2$}%
+  \DeclareUnicodeCharacter{00BE}{$3\over4$}%
+  \DeclareUnicodeCharacter{00BF}{\questiondown}%
+  %
+  \DeclareUnicodeCharacter{00C0}{\`A}%
+  \DeclareUnicodeCharacter{00C1}{\'A}%
+  \DeclareUnicodeCharacter{00C2}{\^A}%
+  \DeclareUnicodeCharacter{00C3}{\~A}%
+  \DeclareUnicodeCharacter{00C4}{\"A}%
+  \DeclareUnicodeCharacter{00C5}{\AA}%
+  \DeclareUnicodeCharacter{00C6}{\AE}%
+  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
+  \DeclareUnicodeCharacter{00C8}{\`E}%
+  \DeclareUnicodeCharacter{00C9}{\'E}%
+  \DeclareUnicodeCharacter{00CA}{\^E}%
+  \DeclareUnicodeCharacter{00CB}{\"E}%
+  \DeclareUnicodeCharacter{00CC}{\`I}%
+  \DeclareUnicodeCharacter{00CD}{\'I}%
+  \DeclareUnicodeCharacter{00CE}{\^I}%
+  \DeclareUnicodeCharacter{00CF}{\"I}%
+  %
+  \DeclareUnicodeCharacter{00D0}{\DH}%
+  \DeclareUnicodeCharacter{00D1}{\~N}%
+  \DeclareUnicodeCharacter{00D2}{\`O}%
+  \DeclareUnicodeCharacter{00D3}{\'O}%
+  \DeclareUnicodeCharacter{00D4}{\^O}%
+  \DeclareUnicodeCharacter{00D5}{\~O}%
+  \DeclareUnicodeCharacter{00D6}{\"O}%
+  \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
+  \DeclareUnicodeCharacter{00D8}{\O}%
+  \DeclareUnicodeCharacter{00D9}{\`U}%
+  \DeclareUnicodeCharacter{00DA}{\'U}%
+  \DeclareUnicodeCharacter{00DB}{\^U}%
+  \DeclareUnicodeCharacter{00DC}{\"U}%
+  \DeclareUnicodeCharacter{00DD}{\'Y}%
+  \DeclareUnicodeCharacter{00DE}{\TH}%
+  \DeclareUnicodeCharacter{00DF}{\ss}%
+  %
+  \DeclareUnicodeCharacter{00E0}{\`a}%
+  \DeclareUnicodeCharacter{00E1}{\'a}%
+  \DeclareUnicodeCharacter{00E2}{\^a}%
+  \DeclareUnicodeCharacter{00E3}{\~a}%
+  \DeclareUnicodeCharacter{00E4}{\"a}%
+  \DeclareUnicodeCharacter{00E5}{\aa}%
+  \DeclareUnicodeCharacter{00E6}{\ae}%
+  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
+  \DeclareUnicodeCharacter{00E8}{\`e}%
+  \DeclareUnicodeCharacter{00E9}{\'e}%
+  \DeclareUnicodeCharacter{00EA}{\^e}%
+  \DeclareUnicodeCharacter{00EB}{\"e}%
+  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
+  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
+  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
+  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
+  %
+  \DeclareUnicodeCharacter{00F0}{\dh}%
+  \DeclareUnicodeCharacter{00F1}{\~n}%
+  \DeclareUnicodeCharacter{00F2}{\`o}%
+  \DeclareUnicodeCharacter{00F3}{\'o}%
+  \DeclareUnicodeCharacter{00F4}{\^o}%
+  \DeclareUnicodeCharacter{00F5}{\~o}%
+  \DeclareUnicodeCharacter{00F6}{\"o}%
+  \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
+  \DeclareUnicodeCharacter{00F8}{\o}%
+  \DeclareUnicodeCharacter{00F9}{\`u}%
+  \DeclareUnicodeCharacter{00FA}{\'u}%
+  \DeclareUnicodeCharacter{00FB}{\^u}%
+  \DeclareUnicodeCharacter{00FC}{\"u}%
+  \DeclareUnicodeCharacter{00FD}{\'y}%
+  \DeclareUnicodeCharacter{00FE}{\th}%
+  \DeclareUnicodeCharacter{00FF}{\"y}%
+  %
+  \DeclareUnicodeCharacter{0100}{\=A}%
+  \DeclareUnicodeCharacter{0101}{\=a}%
+  \DeclareUnicodeCharacter{0102}{\u{A}}%
+  \DeclareUnicodeCharacter{0103}{\u{a}}%
+  \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
+  \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
+  \DeclareUnicodeCharacter{0106}{\'C}%
+  \DeclareUnicodeCharacter{0107}{\'c}%
+  \DeclareUnicodeCharacter{0108}{\^C}%
+  \DeclareUnicodeCharacter{0109}{\^c}%
+  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
+  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
+  \DeclareUnicodeCharacter{010C}{\v{C}}%
+  \DeclareUnicodeCharacter{010D}{\v{c}}%
+  \DeclareUnicodeCharacter{010E}{\v{D}}%
+  \DeclareUnicodeCharacter{010F}{d'}%
+  %
+  \DeclareUnicodeCharacter{0110}{\DH}%
+  \DeclareUnicodeCharacter{0111}{\dh}%
+  \DeclareUnicodeCharacter{0112}{\=E}%
+  \DeclareUnicodeCharacter{0113}{\=e}%
+  \DeclareUnicodeCharacter{0114}{\u{E}}%
+  \DeclareUnicodeCharacter{0115}{\u{e}}%
+  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
+  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
+  \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
+  \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
+  \DeclareUnicodeCharacter{011A}{\v{E}}%
+  \DeclareUnicodeCharacter{011B}{\v{e}}%
+  \DeclareUnicodeCharacter{011C}{\^G}%
+  \DeclareUnicodeCharacter{011D}{\^g}%
+  \DeclareUnicodeCharacter{011E}{\u{G}}%
+  \DeclareUnicodeCharacter{011F}{\u{g}}%
+  %
+  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
+  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
+  \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
+  \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
+  \DeclareUnicodeCharacter{0124}{\^H}%
+  \DeclareUnicodeCharacter{0125}{\^h}%
+  \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
+  \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
+  \DeclareUnicodeCharacter{0128}{\~I}%
+  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
+  \DeclareUnicodeCharacter{012A}{\=I}%
+  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
+  \DeclareUnicodeCharacter{012C}{\u{I}}%
+  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
+  \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
+  \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
+  %
+  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
+  \DeclareUnicodeCharacter{0131}{\dotless{i}}%
+  \DeclareUnicodeCharacter{0132}{IJ}%
+  \DeclareUnicodeCharacter{0133}{ij}%
+  \DeclareUnicodeCharacter{0134}{\^J}%
+  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
+  \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
+  \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
+  \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
+  \DeclareUnicodeCharacter{0139}{\'L}%
+  \DeclareUnicodeCharacter{013A}{\'l}%
+  \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
+  \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
+  \DeclareUnicodeCharacter{013D}{L'}% should kern
+  \DeclareUnicodeCharacter{013E}{l'}% should kern
+  \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
+  %
+  \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
+  \DeclareUnicodeCharacter{0141}{\L}%
+  \DeclareUnicodeCharacter{0142}{\l}%
+  \DeclareUnicodeCharacter{0143}{\'N}%
+  \DeclareUnicodeCharacter{0144}{\'n}%
+  \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
+  \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
+  \DeclareUnicodeCharacter{0147}{\v{N}}%
+  \DeclareUnicodeCharacter{0148}{\v{n}}%
+  \DeclareUnicodeCharacter{0149}{'n}%
+  \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
+  \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
+  \DeclareUnicodeCharacter{014C}{\=O}%
+  \DeclareUnicodeCharacter{014D}{\=o}%
+  \DeclareUnicodeCharacter{014E}{\u{O}}%
+  \DeclareUnicodeCharacter{014F}{\u{o}}%
+  %
+  \DeclareUnicodeCharacter{0150}{\H{O}}%
+  \DeclareUnicodeCharacter{0151}{\H{o}}%
+  \DeclareUnicodeCharacter{0152}{\OE}%
+  \DeclareUnicodeCharacter{0153}{\oe}%
+  \DeclareUnicodeCharacter{0154}{\'R}%
+  \DeclareUnicodeCharacter{0155}{\'r}%
+  \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
+  \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
+  \DeclareUnicodeCharacter{0158}{\v{R}}%
+  \DeclareUnicodeCharacter{0159}{\v{r}}%
+  \DeclareUnicodeCharacter{015A}{\'S}%
+  \DeclareUnicodeCharacter{015B}{\'s}%
+  \DeclareUnicodeCharacter{015C}{\^S}%
+  \DeclareUnicodeCharacter{015D}{\^s}%
+  \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
+  \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
+  %
+  \DeclareUnicodeCharacter{0160}{\v{S}}%
+  \DeclareUnicodeCharacter{0161}{\v{s}}%
+  \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
+  \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
+  \DeclareUnicodeCharacter{0164}{\v{T}}%
+  \DeclareUnicodeCharacter{0165}{\v{t}}%
+  \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
+  \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
+  \DeclareUnicodeCharacter{0168}{\~U}%
+  \DeclareUnicodeCharacter{0169}{\~u}%
+  \DeclareUnicodeCharacter{016A}{\=U}%
+  \DeclareUnicodeCharacter{016B}{\=u}%
+  \DeclareUnicodeCharacter{016C}{\u{U}}%
+  \DeclareUnicodeCharacter{016D}{\u{u}}%
+  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
+  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
+  %
+  \DeclareUnicodeCharacter{0170}{\H{U}}%
+  \DeclareUnicodeCharacter{0171}{\H{u}}%
+  \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
+  \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
+  \DeclareUnicodeCharacter{0174}{\^W}%
+  \DeclareUnicodeCharacter{0175}{\^w}%
+  \DeclareUnicodeCharacter{0176}{\^Y}%
+  \DeclareUnicodeCharacter{0177}{\^y}%
+  \DeclareUnicodeCharacter{0178}{\"Y}%
+  \DeclareUnicodeCharacter{0179}{\'Z}%
+  \DeclareUnicodeCharacter{017A}{\'z}%
+  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
+  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
+  \DeclareUnicodeCharacter{017D}{\v{Z}}%
+  \DeclareUnicodeCharacter{017E}{\v{z}}%
+  \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
+  %
+  \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
+  \DeclareUnicodeCharacter{01C5}{D\v{z}}%
+  \DeclareUnicodeCharacter{01C6}{d\v{z}}%
+  \DeclareUnicodeCharacter{01C7}{LJ}%
+  \DeclareUnicodeCharacter{01C8}{Lj}%
+  \DeclareUnicodeCharacter{01C9}{lj}%
+  \DeclareUnicodeCharacter{01CA}{NJ}%
+  \DeclareUnicodeCharacter{01CB}{Nj}%
+  \DeclareUnicodeCharacter{01CC}{nj}%
+  \DeclareUnicodeCharacter{01CD}{\v{A}}%
+  \DeclareUnicodeCharacter{01CE}{\v{a}}%
+  \DeclareUnicodeCharacter{01CF}{\v{I}}%
+  %
+  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
+  \DeclareUnicodeCharacter{01D1}{\v{O}}%
+  \DeclareUnicodeCharacter{01D2}{\v{o}}%
+  \DeclareUnicodeCharacter{01D3}{\v{U}}%
+  \DeclareUnicodeCharacter{01D4}{\v{u}}%
+  %
+  \DeclareUnicodeCharacter{01E2}{\={\AE}}%
+  \DeclareUnicodeCharacter{01E3}{\={\ae}}%
+  \DeclareUnicodeCharacter{01E6}{\v{G}}%
+  \DeclareUnicodeCharacter{01E7}{\v{g}}%
+  \DeclareUnicodeCharacter{01E8}{\v{K}}%
+  \DeclareUnicodeCharacter{01E9}{\v{k}}%
+  %
+  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
+  \DeclareUnicodeCharacter{01F1}{DZ}%
+  \DeclareUnicodeCharacter{01F2}{Dz}%
+  \DeclareUnicodeCharacter{01F3}{dz}%
+  \DeclareUnicodeCharacter{01F4}{\'G}%
+  \DeclareUnicodeCharacter{01F5}{\'g}%
+  \DeclareUnicodeCharacter{01F8}{\`N}%
+  \DeclareUnicodeCharacter{01F9}{\`n}%
+  \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
+  \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
+  \DeclareUnicodeCharacter{01FE}{\'{\O}}%
+  \DeclareUnicodeCharacter{01FF}{\'{\o}}%
+  %
+  \DeclareUnicodeCharacter{021E}{\v{H}}%
+  \DeclareUnicodeCharacter{021F}{\v{h}}%
+  %
+  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
+  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
+  \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
+  \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
+  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
+  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
+  %
+  \DeclareUnicodeCharacter{0232}{\=Y}%
+  \DeclareUnicodeCharacter{0233}{\=y}%
+  \DeclareUnicodeCharacter{0237}{\dotless{j}}%
+  %
+  \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
+  %
+  % Greek letters upper case
+  \DeclareUnicodeCharacter{0391}{{\it A}}%
+  \DeclareUnicodeCharacter{0392}{{\it B}}%
+  \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
+  \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
+  \DeclareUnicodeCharacter{0395}{{\it E}}%
+  \DeclareUnicodeCharacter{0396}{{\it Z}}%
+  \DeclareUnicodeCharacter{0397}{{\it H}}%
+  \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
+  \DeclareUnicodeCharacter{0399}{{\it I}}%
+  \DeclareUnicodeCharacter{039A}{{\it K}}%
+  \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
+  \DeclareUnicodeCharacter{039C}{{\it M}}%
+  \DeclareUnicodeCharacter{039D}{{\it N}}%
+  \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
+  \DeclareUnicodeCharacter{039F}{{\it O}}%
+  \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
+  \DeclareUnicodeCharacter{03A1}{{\it P}}%
+  %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
+  \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
+  \DeclareUnicodeCharacter{03A4}{{\it T}}%
+  \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
+  \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
+  \DeclareUnicodeCharacter{03A7}{{\it X}}%
+  \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
+  \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
+  %
+  % Vowels with accents
+  \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
+  \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
+  \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
+  \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
+  \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
+  \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
+  %
+  % Standalone accent
+  \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
+  %
+  % Greek letters lower case
+  \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
+  \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
+  \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
+  \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
+  \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
+  \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
+  \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
+  \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
+  \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
+  \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
+  \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
+  \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
+  \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
+  \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
+  \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
+  \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
+  \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
+  \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
+  \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
+  \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
+  \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
+  \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
+  \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
+  \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
+  \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
+  %
+  % More Greek vowels with accents
+  \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
+  \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
+  \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
+  \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
+  \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
+  %
+  % Variant Greek letters
+  \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
+  \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
+  \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
+  %
+  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
+  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
+  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
+  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
+  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
+  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
+  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
+  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
+  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
+  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
+  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
+  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
+  %
+  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
+  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
+  %
+  \DeclareUnicodeCharacter{1E20}{\=G}%
+  \DeclareUnicodeCharacter{1E21}{\=g}%
+  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
+  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
+  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
+  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
+  \DeclareUnicodeCharacter{1E26}{\"H}%
+  \DeclareUnicodeCharacter{1E27}{\"h}%
+  %
+  \DeclareUnicodeCharacter{1E30}{\'K}%
+  \DeclareUnicodeCharacter{1E31}{\'k}%
+  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
+  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
+  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
+  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
+  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
+  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
+  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
+  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
+  \DeclareUnicodeCharacter{1E3E}{\'M}%
+  \DeclareUnicodeCharacter{1E3F}{\'m}%
+  %
+  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
+  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
+  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
+  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
+  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
+  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
+  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
+  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
+  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
+  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
+  %
+  \DeclareUnicodeCharacter{1E54}{\'P}%
+  \DeclareUnicodeCharacter{1E55}{\'p}%
+  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
+  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
+  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
+  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
+  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
+  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
+  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
+  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
+  %
+  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
+  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
+  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
+  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
+  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
+  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
+  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
+  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
+  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
+  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
+  %
+  \DeclareUnicodeCharacter{1E7C}{\~V}%
+  \DeclareUnicodeCharacter{1E7D}{\~v}%
+  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
+  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
+  %
+  \DeclareUnicodeCharacter{1E80}{\`W}%
+  \DeclareUnicodeCharacter{1E81}{\`w}%
+  \DeclareUnicodeCharacter{1E82}{\'W}%
+  \DeclareUnicodeCharacter{1E83}{\'w}%
+  \DeclareUnicodeCharacter{1E84}{\"W}%
+  \DeclareUnicodeCharacter{1E85}{\"w}%
+  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
+  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
+  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
+  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
+  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
+  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
+  \DeclareUnicodeCharacter{1E8C}{\"X}%
+  \DeclareUnicodeCharacter{1E8D}{\"x}%
+  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
+  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
+  %
+  \DeclareUnicodeCharacter{1E90}{\^Z}%
+  \DeclareUnicodeCharacter{1E91}{\^z}%
+  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
+  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
+  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
+  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
+  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
+  \DeclareUnicodeCharacter{1E97}{\"t}%
+  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
+  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
+  %
+  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
+  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
+  %
+  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
+  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
+  \DeclareUnicodeCharacter{1EBC}{\~E}%
+  \DeclareUnicodeCharacter{1EBD}{\~e}%
+  %
+  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
+  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
+  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
+  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
+  %
+  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
+  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
+  %
+  \DeclareUnicodeCharacter{1EF2}{\`Y}%
+  \DeclareUnicodeCharacter{1EF3}{\`y}%
+  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
+  %
+  \DeclareUnicodeCharacter{1EF8}{\~Y}%
+  \DeclareUnicodeCharacter{1EF9}{\~y}%
+  %
+  % Punctuation
+  \DeclareUnicodeCharacter{2013}{--}%
+  \DeclareUnicodeCharacter{2014}{---}%
+  \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
+  \DeclareUnicodeCharacter{2019}{\quoteright{}}%
+  \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
+  \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
+  \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
+  \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
+  \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
+  \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
+  \DeclareUnicodeCharacter{2022}{\bullet{}}%
+  \DeclareUnicodeCharacter{202F}{\thinspace}%
+  \DeclareUnicodeCharacter{2026}{\dots{}}%
+  \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
+  \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
+  %
+  \DeclareUnicodeCharacter{20AC}{\euro{}}%
+  %
+  \DeclareUnicodeCharacter{2192}{\expansion{}}%
+  \DeclareUnicodeCharacter{21D2}{\result{}}%
+  %
+  % Mathematical symbols
+  \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
+  \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
+  \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
+  \DeclareUnicodeCharacter{2212}{\minus{}}%
+  \DeclareUnicodeCharacter{2217}{\ast}%
+  \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
+  \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
+  \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
+  \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
+  \DeclareUnicodeCharacter{2261}{\equiv{}}%
+  \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
+  \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
+  \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
+  \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
+  %
+  \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
+  \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
+  \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
+  \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
+  \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
+  \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
+  \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
+  \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
+  \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
+  \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
+  \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
+  \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
+  \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
+  \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
+  \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
+  \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
+  \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
+  \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
+  \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
+  \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
+  \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
+  \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
+  \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
+  \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
+  \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
+  \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
+  \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
+  \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
+  \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
+  \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
+  \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
+  \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
+  \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
+  \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
+  \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
+  \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
+  \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
+  \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
+  \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
+  \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
+  \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
+  \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
+  \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
+  \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
+  \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
+  \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
+  \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
+  \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
+  \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
+  \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
+  \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
+  \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
+  \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
+  \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
+  \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
+  \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
+  \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
+  \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
+  \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
+  \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
+  \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
+  \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
+  \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
+  \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
+  \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
+  \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
+  \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
+  \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
+  \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
+  \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
+  \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
+  \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
+  \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
+  \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
+  \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
+  \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
+  \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
+  \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
+  \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
+  \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
+  \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
+  \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
+  \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
+  \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
+  \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
+  \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
+  \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
+  \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
+  \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
+  \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
+  \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
+  %
+  \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
+  \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
+  \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
+  \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
+  \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
+  \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
+  \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
+  \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
+  \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
+  \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
+  \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
+  \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
+  \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
+  \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
+  \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
+  \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
+  \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
+  \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
+  \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
+  \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
+  \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
+  \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
+  \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
+  \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
+  \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
+  \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
+  \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
+  \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
+  \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
+  %
+  \global\mathchardef\checkmark="1370% actually the square root sign
+  \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
+}% end of \unicodechardefs
+
+% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
+% It makes the setting that replace UTF-8 byte sequence.
 \def\utfeightchardefs{%
-  \DeclareUnicodeCharacter{00A0}{\tie}
-  \DeclareUnicodeCharacter{00A1}{\exclamdown}
-  \DeclareUnicodeCharacter{00A3}{\pounds}
-  \DeclareUnicodeCharacter{00A8}{\"{ }}
-  \DeclareUnicodeCharacter{00A9}{\copyright}
-  \DeclareUnicodeCharacter{00AA}{\ordf}
-  \DeclareUnicodeCharacter{00AB}{\guillemetleft}
-  \DeclareUnicodeCharacter{00AD}{\-}
-  \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
-  \DeclareUnicodeCharacter{00AF}{\={ }}
-
-  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
-  \DeclareUnicodeCharacter{00B4}{\'{ }}
-  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
-  \DeclareUnicodeCharacter{00BA}{\ordm}
-  \DeclareUnicodeCharacter{00BB}{\guillemetright}
-  \DeclareUnicodeCharacter{00BF}{\questiondown}
-
-  \DeclareUnicodeCharacter{00C0}{\`A}
-  \DeclareUnicodeCharacter{00C1}{\'A}
-  \DeclareUnicodeCharacter{00C2}{\^A}
-  \DeclareUnicodeCharacter{00C3}{\~A}
-  \DeclareUnicodeCharacter{00C4}{\"A}
-  \DeclareUnicodeCharacter{00C5}{\AA}
-  \DeclareUnicodeCharacter{00C6}{\AE}
-  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
-  \DeclareUnicodeCharacter{00C8}{\`E}
-  \DeclareUnicodeCharacter{00C9}{\'E}
-  \DeclareUnicodeCharacter{00CA}{\^E}
-  \DeclareUnicodeCharacter{00CB}{\"E}
-  \DeclareUnicodeCharacter{00CC}{\`I}
-  \DeclareUnicodeCharacter{00CD}{\'I}
-  \DeclareUnicodeCharacter{00CE}{\^I}
-  \DeclareUnicodeCharacter{00CF}{\"I}
-
-  \DeclareUnicodeCharacter{00D0}{\DH}
-  \DeclareUnicodeCharacter{00D1}{\~N}
-  \DeclareUnicodeCharacter{00D2}{\`O}
-  \DeclareUnicodeCharacter{00D3}{\'O}
-  \DeclareUnicodeCharacter{00D4}{\^O}
-  \DeclareUnicodeCharacter{00D5}{\~O}
-  \DeclareUnicodeCharacter{00D6}{\"O}
-  \DeclareUnicodeCharacter{00D8}{\O}
-  \DeclareUnicodeCharacter{00D9}{\`U}
-  \DeclareUnicodeCharacter{00DA}{\'U}
-  \DeclareUnicodeCharacter{00DB}{\^U}
-  \DeclareUnicodeCharacter{00DC}{\"U}
-  \DeclareUnicodeCharacter{00DD}{\'Y}
-  \DeclareUnicodeCharacter{00DE}{\TH}
-  \DeclareUnicodeCharacter{00DF}{\ss}
-
-  \DeclareUnicodeCharacter{00E0}{\`a}
-  \DeclareUnicodeCharacter{00E1}{\'a}
-  \DeclareUnicodeCharacter{00E2}{\^a}
-  \DeclareUnicodeCharacter{00E3}{\~a}
-  \DeclareUnicodeCharacter{00E4}{\"a}
-  \DeclareUnicodeCharacter{00E5}{\aa}
-  \DeclareUnicodeCharacter{00E6}{\ae}
-  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
-  \DeclareUnicodeCharacter{00E8}{\`e}
-  \DeclareUnicodeCharacter{00E9}{\'e}
-  \DeclareUnicodeCharacter{00EA}{\^e}
-  \DeclareUnicodeCharacter{00EB}{\"e}
-  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
-  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
-  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
-  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
-
-  \DeclareUnicodeCharacter{00F0}{\dh}
-  \DeclareUnicodeCharacter{00F1}{\~n}
-  \DeclareUnicodeCharacter{00F2}{\`o}
-  \DeclareUnicodeCharacter{00F3}{\'o}
-  \DeclareUnicodeCharacter{00F4}{\^o}
-  \DeclareUnicodeCharacter{00F5}{\~o}
-  \DeclareUnicodeCharacter{00F6}{\"o}
-  \DeclareUnicodeCharacter{00F8}{\o}
-  \DeclareUnicodeCharacter{00F9}{\`u}
-  \DeclareUnicodeCharacter{00FA}{\'u}
-  \DeclareUnicodeCharacter{00FB}{\^u}
-  \DeclareUnicodeCharacter{00FC}{\"u}
-  \DeclareUnicodeCharacter{00FD}{\'y}
-  \DeclareUnicodeCharacter{00FE}{\th}
-  \DeclareUnicodeCharacter{00FF}{\"y}
-
-  \DeclareUnicodeCharacter{0100}{\=A}
-  \DeclareUnicodeCharacter{0101}{\=a}
-  \DeclareUnicodeCharacter{0102}{\u{A}}
-  \DeclareUnicodeCharacter{0103}{\u{a}}
-  \DeclareUnicodeCharacter{0104}{\ogonek{A}}
-  \DeclareUnicodeCharacter{0105}{\ogonek{a}}
-  \DeclareUnicodeCharacter{0106}{\'C}
-  \DeclareUnicodeCharacter{0107}{\'c}
-  \DeclareUnicodeCharacter{0108}{\^C}
-  \DeclareUnicodeCharacter{0109}{\^c}
-  \DeclareUnicodeCharacter{0118}{\ogonek{E}}
-  \DeclareUnicodeCharacter{0119}{\ogonek{e}}
-  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
-  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
-  \DeclareUnicodeCharacter{010C}{\v{C}}
-  \DeclareUnicodeCharacter{010D}{\v{c}}
-  \DeclareUnicodeCharacter{010E}{\v{D}}
-
-  \DeclareUnicodeCharacter{0112}{\=E}
-  \DeclareUnicodeCharacter{0113}{\=e}
-  \DeclareUnicodeCharacter{0114}{\u{E}}
-  \DeclareUnicodeCharacter{0115}{\u{e}}
-  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
-  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
-  \DeclareUnicodeCharacter{011A}{\v{E}}
-  \DeclareUnicodeCharacter{011B}{\v{e}}
-  \DeclareUnicodeCharacter{011C}{\^G}
-  \DeclareUnicodeCharacter{011D}{\^g}
-  \DeclareUnicodeCharacter{011E}{\u{G}}
-  \DeclareUnicodeCharacter{011F}{\u{g}}
-
-  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
-  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
-  \DeclareUnicodeCharacter{0124}{\^H}
-  \DeclareUnicodeCharacter{0125}{\^h}
-  \DeclareUnicodeCharacter{0128}{\~I}
-  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
-  \DeclareUnicodeCharacter{012A}{\=I}
-  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
-  \DeclareUnicodeCharacter{012C}{\u{I}}
-  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
-
-  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
-  \DeclareUnicodeCharacter{0131}{\dotless{i}}
-  \DeclareUnicodeCharacter{0132}{IJ}
-  \DeclareUnicodeCharacter{0133}{ij}
-  \DeclareUnicodeCharacter{0134}{\^J}
-  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
-  \DeclareUnicodeCharacter{0139}{\'L}
-  \DeclareUnicodeCharacter{013A}{\'l}
-
-  \DeclareUnicodeCharacter{0141}{\L}
-  \DeclareUnicodeCharacter{0142}{\l}
-  \DeclareUnicodeCharacter{0143}{\'N}
-  \DeclareUnicodeCharacter{0144}{\'n}
-  \DeclareUnicodeCharacter{0147}{\v{N}}
-  \DeclareUnicodeCharacter{0148}{\v{n}}
-  \DeclareUnicodeCharacter{014C}{\=O}
-  \DeclareUnicodeCharacter{014D}{\=o}
-  \DeclareUnicodeCharacter{014E}{\u{O}}
-  \DeclareUnicodeCharacter{014F}{\u{o}}
-
-  \DeclareUnicodeCharacter{0150}{\H{O}}
-  \DeclareUnicodeCharacter{0151}{\H{o}}
-  \DeclareUnicodeCharacter{0152}{\OE}
-  \DeclareUnicodeCharacter{0153}{\oe}
-  \DeclareUnicodeCharacter{0154}{\'R}
-  \DeclareUnicodeCharacter{0155}{\'r}
-  \DeclareUnicodeCharacter{0158}{\v{R}}
-  \DeclareUnicodeCharacter{0159}{\v{r}}
-  \DeclareUnicodeCharacter{015A}{\'S}
-  \DeclareUnicodeCharacter{015B}{\'s}
-  \DeclareUnicodeCharacter{015C}{\^S}
-  \DeclareUnicodeCharacter{015D}{\^s}
-  \DeclareUnicodeCharacter{015E}{\cedilla{S}}
-  \DeclareUnicodeCharacter{015F}{\cedilla{s}}
-
-  \DeclareUnicodeCharacter{0160}{\v{S}}
-  \DeclareUnicodeCharacter{0161}{\v{s}}
-  \DeclareUnicodeCharacter{0162}{\cedilla{t}}
-  \DeclareUnicodeCharacter{0163}{\cedilla{T}}
-  \DeclareUnicodeCharacter{0164}{\v{T}}
-
-  \DeclareUnicodeCharacter{0168}{\~U}
-  \DeclareUnicodeCharacter{0169}{\~u}
-  \DeclareUnicodeCharacter{016A}{\=U}
-  \DeclareUnicodeCharacter{016B}{\=u}
-  \DeclareUnicodeCharacter{016C}{\u{U}}
-  \DeclareUnicodeCharacter{016D}{\u{u}}
-  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
-  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
-
-  \DeclareUnicodeCharacter{0170}{\H{U}}
-  \DeclareUnicodeCharacter{0171}{\H{u}}
-  \DeclareUnicodeCharacter{0174}{\^W}
-  \DeclareUnicodeCharacter{0175}{\^w}
-  \DeclareUnicodeCharacter{0176}{\^Y}
-  \DeclareUnicodeCharacter{0177}{\^y}
-  \DeclareUnicodeCharacter{0178}{\"Y}
-  \DeclareUnicodeCharacter{0179}{\'Z}
-  \DeclareUnicodeCharacter{017A}{\'z}
-  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
-  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
-  \DeclareUnicodeCharacter{017D}{\v{Z}}
-  \DeclareUnicodeCharacter{017E}{\v{z}}
-
-  \DeclareUnicodeCharacter{01C4}{D\v{Z}}
-  \DeclareUnicodeCharacter{01C5}{D\v{z}}
-  \DeclareUnicodeCharacter{01C6}{d\v{z}}
-  \DeclareUnicodeCharacter{01C7}{LJ}
-  \DeclareUnicodeCharacter{01C8}{Lj}
-  \DeclareUnicodeCharacter{01C9}{lj}
-  \DeclareUnicodeCharacter{01CA}{NJ}
-  \DeclareUnicodeCharacter{01CB}{Nj}
-  \DeclareUnicodeCharacter{01CC}{nj}
-  \DeclareUnicodeCharacter{01CD}{\v{A}}
-  \DeclareUnicodeCharacter{01CE}{\v{a}}
-  \DeclareUnicodeCharacter{01CF}{\v{I}}
-
-  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
-  \DeclareUnicodeCharacter{01D1}{\v{O}}
-  \DeclareUnicodeCharacter{01D2}{\v{o}}
-  \DeclareUnicodeCharacter{01D3}{\v{U}}
-  \DeclareUnicodeCharacter{01D4}{\v{u}}
-
-  \DeclareUnicodeCharacter{01E2}{\={\AE}}
-  \DeclareUnicodeCharacter{01E3}{\={\ae}}
-  \DeclareUnicodeCharacter{01E6}{\v{G}}
-  \DeclareUnicodeCharacter{01E7}{\v{g}}
-  \DeclareUnicodeCharacter{01E8}{\v{K}}
-  \DeclareUnicodeCharacter{01E9}{\v{k}}
-
-  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
-  \DeclareUnicodeCharacter{01F1}{DZ}
-  \DeclareUnicodeCharacter{01F2}{Dz}
-  \DeclareUnicodeCharacter{01F3}{dz}
-  \DeclareUnicodeCharacter{01F4}{\'G}
-  \DeclareUnicodeCharacter{01F5}{\'g}
-  \DeclareUnicodeCharacter{01F8}{\`N}
-  \DeclareUnicodeCharacter{01F9}{\`n}
-  \DeclareUnicodeCharacter{01FC}{\'{\AE}}
-  \DeclareUnicodeCharacter{01FD}{\'{\ae}}
-  \DeclareUnicodeCharacter{01FE}{\'{\O}}
-  \DeclareUnicodeCharacter{01FF}{\'{\o}}
-
-  \DeclareUnicodeCharacter{021E}{\v{H}}
-  \DeclareUnicodeCharacter{021F}{\v{h}}
-
-  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
-  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
-  \DeclareUnicodeCharacter{0228}{\cedilla{E}}
-  \DeclareUnicodeCharacter{0229}{\cedilla{e}}
-  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
-  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
-
-  \DeclareUnicodeCharacter{0232}{\=Y}
-  \DeclareUnicodeCharacter{0233}{\=y}
-  \DeclareUnicodeCharacter{0237}{\dotless{j}}
-
-  \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
-
-  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
-  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
-  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
-  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
-  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
-  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
-  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
-  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
-  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
-  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
-  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
-  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
-
-  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
-  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
-
-  \DeclareUnicodeCharacter{1E20}{\=G}
-  \DeclareUnicodeCharacter{1E21}{\=g}
-  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
-  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
-  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
-  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
-  \DeclareUnicodeCharacter{1E26}{\"H}
-  \DeclareUnicodeCharacter{1E27}{\"h}
-
-  \DeclareUnicodeCharacter{1E30}{\'K}
-  \DeclareUnicodeCharacter{1E31}{\'k}
-  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
-  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
-  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
-  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
-  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
-  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
-  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
-  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
-  \DeclareUnicodeCharacter{1E3E}{\'M}
-  \DeclareUnicodeCharacter{1E3F}{\'m}
-
-  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
-  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
-  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
-  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
-  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
-  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
-  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
-  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
-  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
-  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
-
-  \DeclareUnicodeCharacter{1E54}{\'P}
-  \DeclareUnicodeCharacter{1E55}{\'p}
-  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
-  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
-  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
-  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
-  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
-  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
-  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
-  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
-
-  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
-  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
-  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
-  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
-  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
-  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
-  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
-  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
-  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
-  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
-
-  \DeclareUnicodeCharacter{1E7C}{\~V}
-  \DeclareUnicodeCharacter{1E7D}{\~v}
-  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
-  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
-
-  \DeclareUnicodeCharacter{1E80}{\`W}
-  \DeclareUnicodeCharacter{1E81}{\`w}
-  \DeclareUnicodeCharacter{1E82}{\'W}
-  \DeclareUnicodeCharacter{1E83}{\'w}
-  \DeclareUnicodeCharacter{1E84}{\"W}
-  \DeclareUnicodeCharacter{1E85}{\"w}
-  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
-  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
-  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
-  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
-  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
-  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
-  \DeclareUnicodeCharacter{1E8C}{\"X}
-  \DeclareUnicodeCharacter{1E8D}{\"x}
-  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
-  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
-
-  \DeclareUnicodeCharacter{1E90}{\^Z}
-  \DeclareUnicodeCharacter{1E91}{\^z}
-  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
-  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
-  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
-  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
-  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
-  \DeclareUnicodeCharacter{1E97}{\"t}
-  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
-  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
-
-  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
-  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
-
-  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
-  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
-  \DeclareUnicodeCharacter{1EBC}{\~E}
-  \DeclareUnicodeCharacter{1EBD}{\~e}
-
-  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
-  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
-  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
-  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
-
-  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
-  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
-
-  \DeclareUnicodeCharacter{1EF2}{\`Y}
-  \DeclareUnicodeCharacter{1EF3}{\`y}
-  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
-
-  \DeclareUnicodeCharacter{1EF8}{\~Y}
-  \DeclareUnicodeCharacter{1EF9}{\~y}
-
-  \DeclareUnicodeCharacter{2013}{--}
-  \DeclareUnicodeCharacter{2014}{---}
-  \DeclareUnicodeCharacter{2018}{\quoteleft}
-  \DeclareUnicodeCharacter{2019}{\quoteright}
-  \DeclareUnicodeCharacter{201A}{\quotesinglbase}
-  \DeclareUnicodeCharacter{201C}{\quotedblleft}
-  \DeclareUnicodeCharacter{201D}{\quotedblright}
-  \DeclareUnicodeCharacter{201E}{\quotedblbase}
-  \DeclareUnicodeCharacter{2022}{\bullet}
-  \DeclareUnicodeCharacter{2026}{\dots}
-  \DeclareUnicodeCharacter{2039}{\guilsinglleft}
-  \DeclareUnicodeCharacter{203A}{\guilsinglright}
-  \DeclareUnicodeCharacter{20AC}{\euro}
-
-  \DeclareUnicodeCharacter{2192}{\expansion}
-  \DeclareUnicodeCharacter{21D2}{\result}
-
-  \DeclareUnicodeCharacter{2212}{\minus}
-  \DeclareUnicodeCharacter{2217}{\point}
-  \DeclareUnicodeCharacter{2261}{\equiv}
-}% end of \utfeightchardefs
+  \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
+  \unicodechardefs
+}
+
+% Whether the active definitions of non-ASCII characters expand to
+% non-active tokens with the same character code.  This is used to
+% write characters literally, instead of using active definitions for
+% printing the correct glyphs.
+\newif\ifpassthroughchars
+\passthroughcharsfalse
+
+% For native Unicode handling (XeTeX and LuaTeX),
+% provide a definition macro to replace/pass-through a Unicode character
+%
+\def\DeclareUnicodeCharacterNative#1#2{%
+  \catcode"#1=\active
+  \def\dodeclareunicodecharacternative##1##2##3{%
+    \begingroup
+      \uccode`\~="##2\relax
+      \uppercase{\gdef~}{%
+        \ifpassthroughchars
+          ##1%
+        \else
+          ##3%
+        \fi
+      }
+    \endgroup
+  }
+  \begingroup
+    \uccode`\.="#1\relax
+    \uppercase{\def\UTFNativeTmp{.}}%
+    \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
+  \endgroup
+}
+
+% Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
+% It activates the setting that replaces Unicode characters.
+\def\nativeunicodechardefs{%
+  \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
+  \unicodechardefs
+}
+
+% For native Unicode handling (XeTeX and LuaTeX),
+% make the character token expand
+% to the sequences given in \unicodechardefs for printing.
+\def\DeclareUnicodeCharacterNativeAtU#1#2{%
+  \def\UTFAtUTmp{#2}
+  \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
+}
 
+% @U command definitions for native Unicode handling (XeTeX and LuaTeX).
+\def\nativeunicodechardefsatu{%
+  \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
+  \unicodechardefs
+}
 
 % US-ASCII character definitions.
 \def\asciichardefs{% nothing need be done
    \relax
 }
 
+% define all Unicode characters we know about, for the sake of @U.
+\iftxinativeunicodecapable
+  \nativeunicodechardefsatu
+\else
+  \utfeightchardefs
+\fi
+
+
 % Make non-ASCII characters printable again for compatibility with
 % existing Texinfo documents that may use them, even without declaring a
 % document encoding.
@@ -9708,12 +11267,12 @@ directory should work if nowhere else does.}
   \advance\vsize by \topskip
   \outervsize = \vsize
   \advance\outervsize by 2\topandbottommargin
-  \pageheight = \vsize
+  \txipageheight = \vsize
   %
   \hsize = #2\relax
   \outerhsize = \hsize
   \advance\outerhsize by 0.5in
-  \pagewidth = \hsize
+  \txipagewidth = \hsize
   %
   \normaloffset = #4\relax
   \bindingoffset = #5\relax
@@ -9725,6 +11284,14 @@ directory should work if nowhere else does.}
     % whatever layout pdftex was dumped with.
     \pdfhorigin = 1 true in
     \pdfvorigin = 1 true in
+  \else
+    \ifx\XeTeXrevision\thisisundefined
+      \special{papersize=#8,#7}%
+    \else
+      \pdfpageheight #7\relax
+      \pdfpagewidth #8\relax
+      % XeTeX does not have \pdfhorigin and \pdfvorigin.
+    \fi
   \fi
   %
   \setleading{\textleading}
@@ -9757,7 +11324,6 @@ directory should work if nowhere else does.}
   %
   \lispnarrowing = 0.3in
   \tolerance = 700
-  \hfuzz = 1pt
   \contentsrightmargin = 0pt
   \defbodyindent = .5cm
 }}
@@ -9775,7 +11341,6 @@ directory should work if nowhere else does.}
   %
   \lispnarrowing = 0.25in
   \tolerance = 700
-  \hfuzz = 1pt
   \contentsrightmargin = 0pt
   \defbodyindent = .4cm
 }}
@@ -9801,7 +11366,6 @@ directory should work if nowhere else does.}
                     {297mm}{210mm}%
   %
   \tolerance = 700
-  \hfuzz = 1pt
   \contentsrightmargin = 0pt
   \defbodyindent = 5mm
 }}
@@ -9820,7 +11384,6 @@ directory should work if nowhere else does.}
   %
   \lispnarrowing = 0.2in
   \tolerance = 800
-  \hfuzz = 1.2pt
   \contentsrightmargin = 0pt
   \defbodyindent = 2mm
   \tableindent = 12mm
@@ -9876,6 +11439,9 @@ directory should work if nowhere else does.}
 %
 \letterpaper
 
+% Default value of \hfuzz, for suppressing warnings about overfull hboxes.
+\hfuzz = 1pt
+
 
 \message{and turning on texinfo input format.}
 
@@ -9912,44 +11478,47 @@ directory should work if nowhere else does.}
 % this is not a problem.
 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
 
-% Turn off all special characters except @
-% (and those which the user can use as if they were ordinary).
+% Set catcodes for Texinfo file
+
+% Active characters for printing the wanted glyph.
 % Most of these we simply print from the \tt font, but for some, we can
 % use math or other variants that look better in normal text.
-
+%
 \catcode`\"=\active
 \def\activedoublequote{{\tt\char34}}
 \let"=\activedoublequote
-\catcode`\~=\active
-\def~{{\tt\char126}}
-\chardef\hat=`\^
-\catcode`\^=\active
-\def^{{\tt \hat}}
+\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
+\chardef\hatchar=`\^
+\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
 
 \catcode`\_=\active
 \def_{\ifusingtt\normalunderscore\_}
-\let\realunder=_
-% Subroutine for the previous macro.
 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
+\let\realunder=_
+
+\catcode`\|=\active \def|{{\tt\char124}}
 
-\catcode`\|=\active
-\def|{{\tt\char124}}
 \chardef \less=`\<
-\catcode`\<=\active
-\def<{{\tt \less}}
+\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
 \chardef \gtr=`\>
-\catcode`\>=\active
-\def>{{\tt \gtr}}
-\catcode`\+=\active
-\def+{{\tt \char 43}}
-\catcode`\$=\active
-\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
+\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
+\catcode`\+=\active \def+{{\tt \char 43}}
+\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
+\catcode`\-=\active \let-=\normaldash
 
-% If a .fmt file is being used, characters that might appear in a file
-% name cannot be active until we have parsed the command line.
-% So turn them off again, and have \everyjob (or @setfilename) turn them on.
-% \otherifyactive is called near the end of this file.
-\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
+
+% used for headline/footline in the output routine, in case the page
+% breaks in the middle of an @tex block.
+\def\texinfochars{%
+  \let< = \activeless
+  \let> = \activegtr
+  \let~ = \activetilde 
+  \let^ = \activehat
+  \markupsetuplqdefault \markupsetuprqdefault 
+  \let\b = \strong
+  \let\i = \smartitalic
+  % in principle, all other definitions in \tex have to be undone too.
+}
 
 % Used sometimes to turn off (effectively) the active characters even after
 % parsing them.
@@ -9969,23 +11538,22 @@ directory should work if nowhere else does.}
 % \doublebackslash is two of them (for the pdf outlines).
 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
 
-% In texinfo, backslash is an active character; it prints the backslash
+% In Texinfo, backslash is an active character; it prints the backslash
 % in fixed width font.
 \catcode`\\=\active  % @ for escape char from now on.
 
-% The story here is that in math mode, the \char of \backslashcurfont
-% ends up printing the roman \ from the math symbol font (because \char
-% in math mode uses the \mathcode, and plain.tex sets
-% \mathcode`\\="026E).  It seems better for @backslashchar{} to always
-% print a typewriter backslash, hence we use an explicit \mathchar,
+% Print a typewriter backslash.  For math mode, we can't simply use
+% \backslashcurfont: the story here is that in math mode, the \char
+% of \backslashcurfont ends up printing the roman \ from the math symbol
+% font (because \char in math mode uses the \mathcode, and plain.tex
+% sets \mathcode`\\="026E).  Hence we use an explicit \mathchar,
 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
 % ignored family value; char position "5C).  We can't use " for the
 % usual hex value because it has already been made active.
-@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
-@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
 
-% On startup, @fixbackslash assigns:
-%  @let \ = @normalbackslash
+@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
+@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
+
 % \rawbackslash defines an active \ to do \backslashcurfont.
 % \otherbackslash defines an active \ to be a literal `\' character with
 % catcode other.  We switch back and forth between these.
@@ -9995,45 +11563,91 @@ directory should work if nowhere else does.}
 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
 % the literal character `\'.
 %
-@def@normalturnoffactive{%
-  @let"=@normaldoublequote
-  @let$=@normaldollar %$ font-lock fix
-  @let+=@normalplus
-  @let<=@normalless
-  @let>=@normalgreater
-  @let\=@normalbackslash
-  @let^=@normalcaret
-  @let_=@normalunderscore
-  @let|=@normalverticalbar
-  @let~=@normaltilde
-  @markupsetuplqdefault
-  @markupsetuprqdefault
-  @unsepspaces
-}
-
-% Make _ and + \other characters, temporarily.
-% This is canceled by @fixbackslash.
-@otherifyactive
+{@catcode`- = @active
+ @gdef@normalturnoffactive{%
+   @passthroughcharstrue
+   @let-=@normaldash
+   @let"=@normaldoublequote
+   @let$=@normaldollar %$ font-lock fix
+   @let+=@normalplus
+   @let<=@normalless
+   @let>=@normalgreater
+   @let^=@normalcaret
+   @let_=@normalunderscore
+   @let|=@normalverticalbar
+   @let~=@normaltilde
+   @let\=@ttbackslash
+   @markupsetuplqdefault
+   @markupsetuprqdefault
+   @unsepspaces
+ }
+}
+
+% If a .fmt file is being used, characters that might appear in a file
+% name cannot be active until we have parsed the command line.
+% So turn them off again, and have @fixbackslash turn them back on.
+@catcode`+=@other @catcode`@_=@other
 
+% \enablebackslashhack - allow file to begin `\input texinfo'
+%
 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
 % That is what \eatinput is for; after that, the `\' should revert to printing
 % a backslash.
-%
-@gdef@eatinput input texinfo{@fixbackslash}
-@global@let\ = @eatinput
+% If the file did not have a `\input texinfo', then it is turned off after
+% the first line; otherwise the first `\' in the file would cause an error.
+% This is used on the very last line of this file, texinfo.tex.
+% We also use @c to call @fixbackslash, in case ends of lines are hidden.
+{
+@catcode`@^=7
+@catcode`@^^M=13@gdef@enablebackslashhack{%
+  @global@let\ = @eatinput%
+  @catcode`@^^M=13%
+  @def@c{@fixbackslash@c}%
+  % Definition for the newline at the end of this file.
+  @def ^^M{@let^^M@secondlinenl}%
+  % Definition for a newline in the main Texinfo file.
+  @gdef @secondlinenl{@fixbackslash}%
+  % In case the first line has a whole-line command on it
+  @let@originalparsearg@parsearg
+  @def@parsearg{@fixbackslash@originalparsearg}
+}}
+
+{@catcode`@^=7 @catcode`@^^M=13%
+@gdef@eatinput input texinfo#1^^M{@fixbackslash}}
+
+% Emergency active definition of newline, in case an active newline token
+% appears by mistake.
+{@catcode`@^=7 @catcode13=13%
+@gdef@enableemergencynewline{%
+  @gdef^^M{%
+    @par%
+    %<warning: active newline>@par%
+}}}
+
 
-% On the other hand, perhaps the file did not have a `\input texinfo'. Then
-% the first `\' in the file would cause an error. This macro tries to fix
-% that, assuming it is called before the first `\' could plausibly occur.
-% Also turn back on active characters that might appear in the input
-% file name, in case not using a pre-dumped format.
-%
 @gdef@fixbackslash{%
-  @ifx\@eatinput @let\ = @normalbackslash @fi
+  @ifx\@eatinput @let\ = @ttbackslash @fi
+  @catcode13=5 % regular end of line
+  @enableemergencynewline
+  @let@c=@texinfoc
+  @let@parsearg@originalparsearg
+  % Also turn back on active characters that might appear in the input
+  % file name, in case not using a pre-dumped format.
   @catcode`+=@active
   @catcode`@_=@active
+  %
+  % If texinfo.cnf is present on the system, read it.
+  % Useful for site-wide @afourpaper, etc.  This macro, @fixbackslash, gets
+  % called at the beginning of every Texinfo file.  Not opening texinfo.cnf
+  % directly in this file, texinfo.tex, makes it possible to make a format
+  % file for Texinfo.
+  %
+  @openin 1 texinfo.cnf
+  @ifeof 1 @else @input texinfo.cnf @fi
+  @closein 1
 }
 
+
 % Say @foo, not \foo, in error messages.
 @escapechar = `@@
 
@@ -10062,7 +11676,7 @@ directory should work if nowhere else does.}
 
 @c Local variables:
 @c eval: (add-hook 'write-file-hooks 'time-stamp)
-@c page-delimiter: "^\\\\message"
+@c page-delimiter: "^\\\\message\\|emacs-page"
 @c time-stamp-start: "def\\\\texinfoversion{"
 @c time-stamp-format: "%:y-%02m-%02d.%02H"
 @c time-stamp-end: "}"
@@ -10070,6 +11684,4 @@ directory should work if nowhere else does.}
 
 @c vim:sw=2:
 
-@ignore
-   arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
-@end ignore
+@enablebackslashhack
index 97eb7cc..e73a1a2 100644 (file)
@@ -1,3 +1,3 @@
-@set EDITION 4.0.18
-@set VERSION 4.0.18
-@set UPDATED January 2013
+@set EDITION 4.0.19
+@set VERSION 4.0.19
+@set UPDATED September 2018
diff --git a/vfat.c b/vfat.c
index 0406a74..36cfa82 100644 (file)
--- a/vfat.c
+++ b/vfat.c
@@ -476,7 +476,12 @@ static dirCacheEntry_t *vfat_lookup_loop_common(doscp_t *cp,
        if (direntry->dir.attr & 0x8){
                /* Read entry as a label */
                wchar_t *ptr = newfile;
-               ptr += dos_to_wchar(cp, direntry->dir.name, ptr, 8);
+               if (direntry->dir.name[0] == '\x05') {
+                       ptr += dos_to_wchar(cp, "\xE5", ptr, 1);
+                       ptr += dos_to_wchar(cp, direntry->dir.name+1, ptr, 7);
+               } else {
+                       ptr += dos_to_wchar(cp, direntry->dir.name, ptr, 8);
+               }
                ptr += dos_to_wchar(cp, direntry->dir.ext, ptr, 3);
                *ptr = '\0';
        } else