New upstream version 2.23 upstream upstream/2.23
authorBdale Garbee <bdale@gag.com>
Tue, 3 Jan 2023 16:20:18 +0000 (09:20 -0700)
committerBdale Garbee <bdale@gag.com>
Tue, 3 Jan 2023 16:20:18 +0000 (09:20 -0700)
52 files changed:
.depend
INSTALL
Makefile.in
NEWS
README.win32-libdsk [deleted file]
README.win32.cygwin.txt [deleted file]
config.guess
config.h.in
config.sub
configure
configure.in
cpm.5
cpm.5.in
cpm.ps [deleted file]
cpmchattr.1
cpmchattr.1.in
cpmchattr.c
cpmchmod.1
cpmchmod.1.in
cpmchmod.c
cpmcp.1
cpmcp.1.in
cpmcp.c
cpmfs.c
cpmfs.h
cpmls.1
cpmls.1.in
cpmls.c
cpmrm.1
cpmrm.1.in
cpmrm.c
device.h
device_libdsk.c
device_posix.c
device_win32.c [deleted file]
diskdefs
diskdefs.5 [new file with mode: 0644]
diskdefs.5.in [new file with mode: 0644]
fsck.cpm.1
fsck.cpm.1.in
fsck.cpm.c
fsed.cpm.1
fsed.cpm.1.in
fsed.cpm.c
getopt.c
install-sh
makefile.nt [deleted file]
mkfs.cpm.1
mkfs.cpm.1.in
mkfs.cpm.c
term.h [new file with mode: 0644]
term_curses.c [new file with mode: 0644]

diff --git a/.depend b/.depend
index a6039372d2d5596b00c074dcd80300ecb61a9724..58712b99a82371681d45e41ff1bb06947f2a2951 100644 (file)
--- a/.depend
+++ b/.depend
@@ -8,7 +8,8 @@ device_libdsk.o: device_libdsk.c config.h device.h
 device_posix.o: device_posix.c config.h device.h
 device_win32.o: device_win32.c config.h cpmdir.h cpmfs.h device.h
 fsck.cpm.o: fsck.cpm.c config.h getopt_.h cpmdir.h cpmfs.h device.h
-fsed.cpm.o: fsed.cpm.c config.h cpmfs.h device.h
-getopt.o: getopt.c config.h getopt_.h getopt_int.h
+fsed.cpm.o: fsed.cpm.c config.h cpmfs.h device.h getopt_.h term.h
 getopt1.o: getopt1.c config.h getopt_.h getopt_int.h
+getopt.o: getopt.c config.h getopt_.h getopt_int.h
 mkfs.cpm.o: mkfs.cpm.c config.h getopt_.h cpmfs.h device.h
+term_curses.o: term_curses.c config.h term.h
diff --git a/INSTALL b/INSTALL
index 6c565395b0e0b2582cb8f6e52a91b771b6fdcb8e..2e7e9dfb3c5bdbd020adfb80ba241d137d2742cb 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -7,7 +7,7 @@ Options for "./configure" include:
                   Use LibDsk to access raw files, .DSK files, MYZ80 
                         files and Unix/Windows floppy drives.  This library
                         is available at:
-                        http://www.seasip.demon.co.uk/Unix/LibDsk/
+                        https://www.seasip.info/Unix/LibDsk/
   --with-dmalloc
                  Use the dmalloc library
   --disable-floppy
@@ -15,16 +15,18 @@ Options for "./configure" include:
                   contains drivers for raw files, .DSK files and MYZ80 files.
 
   All the cpmtools that use LibDsk have an extra option: -T <type>. This 
-  sets the drive type used by LibDsk, and is one of:
+  sets the drive type used by LibDsk; available values include:
 
     "floppy" - The computer's floppy drive (only supported on Linux and Win32)
     "raw"    - Raw file (or the floppy drive on other Unix systems)
     "dsk"    - .DSK file
     "myz80"  - MYZ80 hard drive file
 
+    See the libdsk documentation for a full list.
+
     It will normally only be necessary to include "-T" when you are 
   accessing a MYZ80 file, because LibDsk can detect the other file types 
-  automatically. "-T" options are ignored if LibDsk is not being used.
+  automatically. "-T" options are not accepted if LibDsk is not being used.
 
 
 Basic Installation
index 878de768b31bcd82a97965fb3451c2cbca956053..02bb52410e0773c99167c67d6c85766450ec035b 100644 (file)
@@ -62,8 +62,8 @@ mkfs.cpm$(EXEEXT):    mkfs.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJ
 fsck.cpm$(EXEEXT):     fsck.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS)
                $(CC) $(LDFLAGS) -o $@ fsck.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS)
 
-fsed.cpm$(EXEEXT):     fsed.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS)
-               $(CC) $(LDFLAGS) -o $@ fsed.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS)
+fsed.cpm$(EXEEXT):     fsed.cpm$(OBJEXT) cpmfs$(OBJEXT) term_curses$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS)
+               $(CC) $(LDFLAGS) -o $@ fsed.cpm$(OBJEXT) cpmfs$(OBJEXT) term_curses$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS)
 
 fsck.test:     fsck.cpm
                -./fsck.cpm -f ibm-3740 -n badfs/status
@@ -80,27 +80,28 @@ fsck.test:  fsck.cpm
                -./fsck.cpm -f pcw -n badfs/label
 
 install:       all
-               [ -d $(MANDIR)/man1 ] || $(INSTALL) -m 755 -d $(MANDIR)/man1
-               [ -d $(MANDIR)/man5 ] || $(INSTALL) -m 755 -d $(MANDIR)/man5
-               [ -d $(BINDIR) ] || $(INSTALL) -m 755 -d $(BINDIR)
-               $(INSTALL) -s -m 755 cpmls $(BINDIR)/cpmls
-               $(INSTALL) -s -m 755 cpmcp $(BINDIR)/cpmcp
-               $(INSTALL) -s -m 755 cpmrm $(BINDIR)/cpmrm
-               $(INSTALL) -s -m 755 cpmchmod $(BINDIR)/cpmchmod
-               $(INSTALL) -s -m 755 cpmchattr $(BINDIR)/cpmchattr
-               $(INSTALL) -s -m 755 mkfs.cpm $(BINDIR)/mkfs.cpm
-               $(INSTALL) -s -m 755 fsck.cpm $(BINDIR)/fsck.cpm
-               [ "$(FSED_CPM)" == '' ] || $(INSTALL) -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm
-               $(INSTALL_DATA) diskdefs @datarootdir@/diskdefs
-               $(INSTALL_DATA) cpmls.1 $(MANDIR)/man1/cpmls.1
-               $(INSTALL_DATA) cpmcp.1 $(MANDIR)/man1/cpmcp.1
-               $(INSTALL_DATA) cpmrm.1 $(MANDIR)/man1/cpmrm.1
-               $(INSTALL_DATA) cpmchmod.1 $(MANDIR)/man1/cpmchmod.1
-               $(INSTALL_DATA) cpmchattr.1 $(MANDIR)/man1/cpmchattr.1
-               $(INSTALL_DATA) mkfs.cpm.1 $(MANDIR)/man1/mkfs.cpm.1
-               $(INSTALL_DATA) fsck.cpm.1 $(MANDIR)/man1/fsck.cpm.1
-               $(INSTALL_DATA) fsed.cpm.1 $(MANDIR)/man1/fsed.cpm.1
-               $(INSTALL_DATA) cpm.5 $(MANDIR)/man5/cpm.5
+               [ -d $(DESTDIR)$(MANDIR)/man1 ] || $(INSTALL) -m 755 -d $(DESTDIR)$(MANDIR)/man1
+               [ -d $(DESTDIR)$(MANDIR)/man5 ] || $(INSTALL) -m 755 -d $(DESTDIR)$(MANDIR)/man5
+               [ -d $(DESTDIR)$(BINDIR) ] || $(INSTALL) -m 755 -d $(DESTDIR)$(BINDIR)
+               $(INSTALL) -s -m 755 cpmls $(DESTDIR)$(BINDIR)/cpmls
+               $(INSTALL) -s -m 755 cpmcp $(DESTDIR)$(BINDIR)/cpmcp
+               $(INSTALL) -s -m 755 cpmrm $(DESTDIR)$(BINDIR)/cpmrm
+               $(INSTALL) -s -m 755 cpmchmod $(DESTDIR)$(BINDIR)/cpmchmod
+               $(INSTALL) -s -m 755 cpmchattr $(DESTDIR)$(BINDIR)/cpmchattr
+               $(INSTALL) -s -m 755 mkfs.cpm $(DESTDIR)$(BINDIR)/mkfs.cpm
+               $(INSTALL) -s -m 755 fsck.cpm $(DESTDIR)$(BINDIR)/fsck.cpm
+               [ "$(FSED_CPM)" = '' ] || $(INSTALL) -s -m 755 fsed.cpm $(DESTDIR)$(BINDIR)/fsed.cpm
+               $(INSTALL_DATA) diskdefs $(DESTDIR)@datarootdir@/diskdefs
+               $(INSTALL_DATA) cpmls.1 $(DESTDIR)$(MANDIR)/man1/cpmls.1
+               $(INSTALL_DATA) cpmcp.1 $(DESTDIR)$(MANDIR)/man1/cpmcp.1
+               $(INSTALL_DATA) cpmrm.1 $(DESTDIR)$(MANDIR)/man1/cpmrm.1
+               $(INSTALL_DATA) cpmchmod.1 $(DESTDIR)$(MANDIR)/man1/cpmchmod.1
+               $(INSTALL_DATA) cpmchattr.1 $(DESTDIR)$(MANDIR)/man1/cpmchattr.1
+               $(INSTALL_DATA) mkfs.cpm.1 $(DESTDIR)$(MANDIR)/man1/mkfs.cpm.1
+               $(INSTALL_DATA) fsck.cpm.1 $(DESTDIR)$(MANDIR)/man1/fsck.cpm.1
+               $(INSTALL_DATA) fsed.cpm.1 $(DESTDIR)$(MANDIR)/man1/fsed.cpm.1
+               $(INSTALL_DATA) cpm.5 $(DESTDIR)$(MANDIR)/man5/cpm.5
+               $(INSTALL_DATA) diskdefs.5 $(DESTDIR)$(MANDIR)/man5/diskdefs.5
 
 clean:
                rm -f *$(OBJEXT)
diff --git a/NEWS b/NEWS
index ba446f1f9ed012a6ea8575564e9b3fa752c9fdab..8891a300aaa96201661c7f4dad199ad7292ddc95 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
-Changes since 2.19:
+Changes since 2.22:
 
-o  Fixed bug in cpmfs leading to wrongly allocated blocks
+o  Use 16 bit block pointers for file systems > 256 blocks, not >= 256
+o  Translate CP/M file name character '/' to ',' for the host and back
+o  dirblks in Kaypro format fixed
+o  Misc fixes for directory listing
+o  Added bootsec diskdefs option
+o  Check Device_close return value
+o  Check for too small block number when reading file data
+o  Replaced obsolete macros in configure.in
+o  Cygwin/Windows support did not build any more and likely not for quite
+   some time, so it was removed.
diff --git a/README.win32-libdsk b/README.win32-libdsk
deleted file mode 100644 (file)
index ff9eb45..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-  Under Windows 95/98, if a program name has more than one dot, you have to
-add the ".exe" extension to the command. So you should use "fsck.cpm.exe" 
-rather than just "fsck.cpm".
-
-  If you have appropriate rights, the CPMTOOLS should be able to access
-the floppy drive by using "A:" or "B:" as the name of the disc image. 
-"mkfs.cpm" and "fsed.cpm" don't have this capability.
-
-John Elliott, 18 June 2000  
diff --git a/README.win32.cygwin.txt b/README.win32.cygwin.txt
deleted file mode 100644 (file)
index 868e1e8..0000000
+++ /dev/null
@@ -1,518 +0,0 @@
-README.win32.cygwin.txt
------------------------
-
-Building cpmtools-2.9 in Windows XP using:
-
-- cpmtools http://www.moria.de/~michael/cpmtools/
-- cygwin and the ncurses library - http://www.cygwin.com/
-
-"The experts will always complain about shorter documents that do do not
-provide enough details to confuse the rest of us, and longer documents that
-do not omit enough details to confuse the rest of us. No documentation is
-needed for people of that calibre."
-
-- Bill Buckels, November 2008
-
-This document is provided 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. In particular, Bill Buckels has no warranty obligations
-or liability resulting from its use in any way whatsoever. If you don't agree
-then don't read it.
-
-Introduction
-------------
-
-This document is intended as a general guideline. An annotated summary is
-provided directly below especially for expert users followed by annotated
-details.
-
-Please review the other documentation and source code that comes with
-cpmtools for more information about cpmtools. Please review the cygwin
-documentation for more information about cygwin.
-
-At time of this writing, I have used the latest versions of the packages
-listed above to build the latest version of cpmtools in its entirety. I have
-documented the steps I followed below. 
-
-Although there are probably other environments and compilers that can build
-cpmtools for Windows I have not been successful in using the other several I
-tried. Using a complete cygwin installation I had no problems and I had
-cpmtools built in moments after I had cygwin installed and the cpmtools
-source in place as documented below.
-
-Intended Audience
------------------
-
-This document takes two tracks for installing cpmtools binary executables
-after they have been built in cygwin:
-
-1. End users who will run cpmtools from within the cygwin shell. This
-includes unix users who do not want to use the native Windows command line.
-
-2. End users who will run cpmtools from the native Windows command line. The
-average Windows user does not have cygwin, and probably won't want to install
-cygwin or learn a unix-like shell to use cpmtools.
-
-The consideration here is where cpmtools looks for its CP/M disk format
-definitions file (diskdefs) when not in a unix-like environment like cygwin
-and this consideration will affect the way you build cpmtools since this path
-is hardcoded into the binary executables.
-
-My hope is that this document will help address the needs of both types of
-Windows end users and those who wish to provide cpmtools to them.
-
-Summary 
--------
-
-- Install cygwin with ncurses.
-- Download cpmtools-2.9.tar.tar to your cygwin home directory.
-- Start cygwin from the shortcut on the Windows desktop.
-
-- Enter the following commands:
-
-tar -xvf cpmtools.tar.tar
-cd cpmtools-2.9
-./configure --with-diskdefs=/usr/local/share/diskdefs
-make
-mkdir /usr/local/share
-mkdir /usr/local/share/man
-mkdir /usr/local/share/man/man1
-mkdir /usr/local/share/man/man5
-make install
-
-Assumptions
------------
-
-The above builds cpmtools under cygwin for end users who will use cpmtools in
-the cygwin shell and who will use the default installation.
-
-I am assuming in this summary that all has gone well and that anyone who
-deviates from what I have done or who has customized their cygwin
-installation will be able to troubleshoot their own problems,
-
-I therefore make the following related assumptions in this summary:
-
-- That compiler related programs and libraries required to build cpmtools
-under cygwin (including ncurses) are installed.
-
-- That you wish to download into and work under your home directory. You may
-also consider whether a better place to download is in /usr/local/src and
-whether you should install in the binaries in /opt/cpmtools/ and things of
-that nature.
-Default Format
---------------
-
-You can change the default format to accomodate the special needs of your
-users so they don't need to type their favorite format. The following line
-can be entered to configure for an apple-do default format:
-
-./configure --with-defformat="apple-do" --with-diskdefs=/usr/local/share/diskdefs
-
-Native Windows Installation
----------------------------
-
-If you wish to distribute your binaries to Windows end users who will not
-have the cygwin shell and who will use the Windows command line, you have 2
-options:
-
-1. Require your users to always work in the same directory as diskdefs.
-
-- or -
-
-2. Hardcode the default diskdefs path into your binary executables and
-require your users to always use the expected directory for diskdefs.
-
-The following line shows how to configure for an apple-do default format and
-to set the default diskdefs path in a mannner that is acceptable to Windows
-to a relative path from the root of the current drive:
-
-./configure --with-defformat="apple-do" --with-diskdefs=/cpmtools/diskdefs
-
-Cross-Cygwin Binary Installation
---------------------------------
-
-You can still use the binaries built as above and installed using "make
-install" in cygwin if you add the following line to /etc/fstab (assuming your
-cygdrive is the Windows C:drive):
-
-c:\cygwin\usr\local\share /cpmtools
-
-Making a Zip Installation for Native Windows Users
---------------------------------------------------
-
-If your target is the Windows user who does not have cygwin you can do the
-following in cygwin in your build directory to create a zip file that will
-contain the cpmtools binary executables:
-
-- mkdir cpmtools
-- cp *.exe cpmtools/.
-- cp diskdefs cpmtools/.
-- cp /bin/cygwin1.dll cpmtools/.
-- cp /bin/cygncurses-8.dll cpmtools/.
-- zip -R cpmtools/*.*
-
-Making Documentation for Native Windows Users
----------------------------------------------
-
-If you wish to provide the cpmtools manual pages in html format you can use
-man2html to generate your html in ugly format and redirect to a file and edit
-by hand. Here's an example:
-
-man2html -r cpm.5 > cpm.html
-
-If you wish to avoid html and provide the cpmtools manual pages in text
-format you can use troff to generate your text in ugly format and redirect to
-a file and edit by hand. Here's an example:
-
-troff -a cpm.5 > cpm.txt
-
-This concludes the summary. 
-
-Details, Alternatives, and Other Fluff
---------------------------------------
-
-1.cygwin
---------
-
-Cygwin gave me a complete and free environment to both configure and build
-cpmtools in its entirety.
-
-I installed cygwin from http://www.cygwin.com/ in its entirety which included
-the ncurses library and when prompted to select a download site I chose 
-ftp://mirrors.kernel.org/sourceware/cygwin/
-
-The site you pick will depend on your own preference and how much of cygwin
-you decide to install will be up to you. I have a good Internet connection
-and a large hard disk so installing ALL of cygwin was no problem for me.
-Those who don't may wish to attempt an incremental installation which I
-personally found to be annoying and tedious.
-
-It is not necessary to install ALL cygwin options. Another alternative is to
-take the minimalistic approach and just install the compiler related
-programs and libraries required to build cpmtools (including ncurses). If you
-have missed something you will still be able to select additional components
-via Cygwin Setup.
-
-By default cygwin installs into c:\cygwin and puts a shortcut on the Windows
-desktop. By default the cygwin shell starts in your cygwin home directory
-under c:\cygwin\home\. I used the cygwin default paths for my installation of
-cygwin.
-
-2. cpmtoools
-------------
-
-I then downloaded Download cpmtools-2.9 from 
-http://www.moria.de/~michael/cpmtools/
-and used WinRAR to extract cpmtools-2.9 to  
-C:\cygwin\home\bbuckels\cpmtools-2.9\
-
-I have noted in the summary that tar can be used. Use whatever you are
-comfortable with to handle things from unix of a tarball nature.
-
-3. Building 
------------
-
-3.1. I started cygwin by clicking on the cygwin shortcut on my desktop which
-placed me into my cygwin home directory in the cygwin shell.
-
-3.2  Now in the cygwin shell, I changed to the cpmtools directory by typing
-the following and pressing the [Enter] key:
-
-cd cpmtools-2.9
-
-
-3.3 Running the configure script
---------------------------------
-
-Before making cpmtools, the configure script must be run to create the
-cpmtools makefile and the config.h header file required by cpmtools.
-
-I ran the configure script with two options; to set the default format for
-cpmtools to Apple II DOS 3.3 disk images and to tell cpmtools where to find
-the diskdefs format definitions file (which is required to run cpmtools. See
-far below.)
-
-3.3.2 Building for use in the cygwin shell
-------------------------------------------
-
-If I was building for use in the cygwin shell and I was using the default
-paths used by "make install" noted far below, to be certain that my diskdefs
-file would be found and to set my default format to "apple-do" I would type
-the following and press the [Enter] key:
-
-./configure --with-defformat="apple-do" --with-diskdefs=/usr/local/share/diskdefs
-
-3.3.1  Building for the Native Windows command line
----------------------------------------------------
-
-To set the default format to "apple-do" and to provide a relative path for
-native Windows to my diskefs file which I would later copy to C:\cpmtools\ ,
-I typed the following and pressed the [Enter] key:
-
-./configure --with-defformat="apple-do" --with-diskdefs=/cpmtools/diskdefs
-
-Note: Windows paths are typed into the Windows native command line with
-backslashes in the MS- DOS tradition. Historically the forward slash used by
-unix as a path separator was used as a switch character in MS-DOS utilities
-and this has carried forward with the commands that come with Windows. But in
-a program, local Windows paths can be used with forward slashes instead and
-they still work. Backslashes will cause problems for configure so use forward
-slashes.
-
-3.4. The configure script created my cpmtools makefile and config.h with the
-options I chose. I then ran make by typing the following and pressing the
-[Enter] Key.
-
-make
-
-This concludes the first part of the details section of this document and I
-have covered the basic steps that I followed to build cpmtools. What you do
-will likely be a close variation.
-
-4. Installing
--------------
-
-4.1 Some of this is also noted in the summary. Also keep in mind that if
-cpmtools is used outside of cygwin access to the documentation which is in
-the form of unix-style man pages will not be available unless reformatted to
-a media type that Windows users are familiar with.
-
-4.1.1 Installing for the cygwin shell
------------------------------------
-
-You can review the summary and the cpmtools INSTALL document for more
-information on unix-like installations. Installation of cpmtools for use in
-the cygwin shell follows those conventions.
-
-If installing cpmtools to be used in cygwin using the cpmtools defaults and
-assuming the directories below don't already exist, you will need to manually
-create the following directories using the mkdir command as follows:
-
-mkdir /usr/local/share
-mkdir /usr/local/share/man
-mkdir /usr/local/share/man/man1
-mkdir /usr/local/share/man/man5
-
-This is because the manual pages (man pages) will not be installed if you
-don't. If you install the man pages, then when you need help on cpmtools in
-cygwin, you can just enter "man cpmls" or "man cpmchmod", etc. 
-
-After you make the directories above enter the following command:
-
-make install
-
-Assuming all has gone well, cpmtools is now part of your cygwin installation
-and can be used wherever you work in cygwin. 
-
-4.1.2 Installing for Use Outside Cygwin
----------------------------------------
-
-Please also read the summary.
-
-The requirements of my installation were to create a directory structure for
-a binary executable version of cpmtools targetted at Apple II disk image
-users that would run at the native Windows cmd prompt. I offer the following
-for general reference. The cygwin paths are based on my installation of
-cygwin and are presented using conventional windows pathname notation.
-
-4.1.2.1 Dll's
--------------
-
-Two dll's from the c:\cygwin\bin\ directory were required:
-
-cygwin1.dll
-cygncurses-8.dll
-
-Regardless of installation, for this cygwin and this ncurses version access
-to these dll's will be required by this version of the cpmtools excecutables.
-
-4.2 Manually Placing Files for Use Outside Cygwin
--------------------------------------------------
-
-I did my installation by hand. 
-
-My executables were created in c:\cygwin\home\bbuckels\cpmtools-2.9\ (my
-cygwin home directory) which is also where the diskdefs file was.
-
-I used Windows Explorer to manually do the following:
-
-4.2.1 create c:\cpmtools\ directory.
-4.2.2 copy all 8 exes into c:\cpmtools\
-4.2.3 copy both dll's listed above into c:\cpmtools\
-4.2.4 copy diskdefs into c:\cpmtools\
-
-This gave me my directory structure and files for testing and distribution.
-
-I also placed an Apple II CP/M disk image called EXMPLCPM.dsk in c:\cpmtools\
-as a test target.
-
-
-5. Additional Notes 
--------------------
-
-5.1 diskdefs - CP/M disk format definitions
---------------------------------------------
-
-The diskdefs file is a plain ascii text file that serves as a database of
-disk and disk image format definitions. It can be reviewed for available CP/M
-formats and their names. For Apple II CP/M 80 users the disk image formats
-apple-do and apple-po are available.
-
-The possible locations where cpmtools first looks for the diskdefs file:
-
-- Can vary depending on the preferences of the person who builds the cpmtools
-binaries (executables) from the source code.
-
-- The location is also installation dependent and the diskdefs file may also
-have been renamed (but we hope not).
-
-If it's not found the current (work) directory is then searched for a file
-called diskdefs.
-
-On a unix-like system, a ${prefix}/share/ style path like /usr/local/share/
-is a possible place that cpmtools could be made to first look for diskdefs.
-
-In a Win32 system sometimes unix-like shells like cygwin are used to run
-cpmtools instead of Windows cmd. For those installations unix-like
-conventions probably should apply.
-
-For cpmtools installations targetted at the average Windows user who does not
-have a unix-like shell and uses the Windows cmd prompt to run cpmtools there
-is no standard shared place that cpmtools can be made to first look for
-diskdefs. Pathed File names like \cpm\diskdefs or even c:\cpmtools\diskdefs
-are possible.
-
-5.2 Difficulties in using the Windows File System
----------------------------------------------------
-
-This is not a troubleshooting guide. Unless you wish to find-out for yourself
-as I did just how many problems you can face with all of this, or you are
-really an expert, please do yourself a favour and try to stay within what I
-am suggesting as standard or alternative ways of building cpmtools.
-
-Missing libaries and compiler tools can be solved by trial and error and
-reading the cygwin and cpmtools documentation.
-
-There are however some things about path names and file names that you need
-to be aware of, some of which I have mentioned throughout this document and
-some which I deliberately did not mention yet, like avoiding absolute paths
-and drive letters.
-
-If you use a drive letter like C: when hardcoding a path to diskdefs you are
-making several assumptions:
-
-First off, you are assuming that your build of cpmtools will only be run from
-within Windows cmd shell on the local drive C:, (not from a bash-like shell
-like cygwin which doesn't support drive letters the same way Windows cmd and
-Windows itself does), and that diskdefs will not be on another drive, and
-that drive C: exists in the first place, and that diskdefs is not on a
-Windows network either unless drive C:,X:,Y:,Z:,etc is a mapped network
-drive. It is questionable whether cpmtools build process for diskdefs pathing
-supports UNC pathing anyway. I couldn't get \\ to work since the first slash
-disappears in the configure script and the second slash becomes an escape
-sequence for the next letter. 
-
-Relative pathing will work and if you want to use conventions like
-/cpmtools-2.9/diskedefs this will work. Environments like ${USERPROFILE}
-aren't a good idea even if I could have got them to work since they are not
-portable for several reasons and I will say no more on this except I
-recommend that any path that you decide to use for diskdefs will only be
-almost portable between shells if off the root directory and contains forward
-slashes and no drive letters or colons.
-
-I hope what I have said proved less confusing to read than to write if you
-have bothered to read it. If you are not confused yet read further.
-
-- Since cpmtools has special meanings for A: and B: as command line targets
-it probably isn't a good idea to use these drives especially.
-
-- Some programmers and users have no difficulty in shifts between unix-like
-and Windows pathing. Some will be familiar with how colons are used on
-systems like Mac OSX. I think the only point to be made here is to consider
-your target audience and all the things you can anticipate going wrong with
-interoperability of all of this, (cpmtools being a set of command line
-tools), and build cpmtools accordingly for the needs of you or your users,
-then test what you have built with all this in mind.
-
-5.3 Testing your build of cpmtools
-----------------------------------
-
-To test what you have built I suggest you start with cpmls and cpmcp and an
-apple disk image or equivalent.
-
-John Elliot said "If you have appropriate rights, the CPMTOOLS should be able
-to access the floppy drive by using "A:" or "B:" as the name of the disc
-image.". I say don't bother mucking with your physical disk drive unless you
-have a physical CP/M disk of a format supported by cpmtools safely in the
-drive.
-
-Get an apple CP/M disk image and use it for testing is what I suggest. The
-following examples assume you have an Apple II DOS 3.3 order disk image
-called EXMPLCPM.dsk for testing.
-
-To list the files:
-
-cpmls -f apple-do EXMPLCPM.dsk
-
-The following example shows how to copy a file from an Apple II DOS 3.3 order
-cpm disk image to the current directory:
-
-cpmcp -f apple-do EXMPLCPM.dsk bhead.c 0:bhead.c
-
-The following example shows how to copy a file to an Apple II DOS 3.3 order
-cpm disk image from the current directory:
-
-cpmcp -f apple-do EXMPLCPM.dsk 0:bhead.c bhead.c
-
-To test the other utilities in cpmtools like cpmrm, cpmchattr, cpmchmod,
-fsck.cpm and fsed.cpm, review the appropriate manpages for usage.
-
-Those are simple tests as well using an apple-do format disk image. For
-mkfs.cpm I will leave it to those more capable than I to decide what to do
-there. Compared to them I am merely dangerous.
-
-Acknowledgements and Stuff
---------------------------
-
-Michael Haardt - for cpmtools in the first place and for his tireless and
-ongoing efforts in supporting cpmtools in the second.
-
-John Elliot - for bringing cpmtools to Windows.
-
-My focus is on Windows XP (and other Windows) users and making this available
-to them. At this point in time my focus is also on Apple II Z80 Softcard
-users. Thankfully Michael Haardt has considered Apple II disk images in
-cpmtools. My focus is also on the Aztec C Z80 MS-DOS cross-compiler which
-creates Apple II CP/M programs in Windows XP.
-
-Between Michael and John, with cpmtools I can now easily get these onto an
-Apple disk image and transfer the disk image over to my real Apple II which
-has a Z80 softcard clone using my Microdrive with a CF card and make a real
-CP/M disk from the image with DISKMAKER.8 or DSK2FILE then run my Aztec C
-CP/M programs using the real thing. I can also use the emulator that came
-with Apple II Oasis to run the disk image.
-
-Apparently nothing is missing from cpmtools for Windows XP that is available
-on cpmtools for unix-like systems and I am thankful for that. Hopefully you
-will be too.
-
-I would also like to acknowledge the following individuals from the
-comp.os.cpm and apple2.sys usenet newsgroups who gave their experience,
-thoughts and encouragement during my adventure with all of this and in no
-particular order:
-
-David Schmidt - for cygwin feedback.
-Udo Munk - for cygwin feedback. 
-Peter Dassow - for cygwin feedback.
-Stevo Tarkin - for msys feedback.
-Volker Pohlers - for msys and pdcurses feedback.
-Rolf Harmann - for linux feedback.
-Richard Brady - who may or may not know watfor:) 
-
-If I missed anyone, I thank them too. I am somewhat new to some of this and
-needed all the help I received. cygwin is now my friend.
-
-Bill Buckels
-bbuckels@mts.net
-November 2008
\ No newline at end of file
index b79252d6b1034cbcce18ed21d4ed21a405f987e9..1972fda8eb05d040c1390495644252fc92fa2d10 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2013 Free Software Foundation, Inc.
+#   Copyright 1992-2021 Free Software Foundation, Inc.
 
-timestamp='2013-06-10'
+timestamp='2021-01-25'
 
 # 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
@@ -15,7 +15,7 @@ timestamp='2013-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, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://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
@@ -24,22 +24,22 @@ timestamp='2013-06-10'
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # 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;hb=HEAD
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 #
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>.
 
 
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=$(echo "$0" | sed -e 's,.*/,,')
 
 usage="\
 Usage: $0 [OPTION]
 
 Output the configuration name of the system \`$me' is run on.
 
-Operation modes:
+Options:
   -h, --help         print this help, then exit
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2021 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."
@@ -84,8 +84,6 @@ if test $# != 0; then
   exit 1
 fi
 
-trap 'exit 1' 1 2 15
-
 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
 # compiler to aid in system detection is discouraged as it requires
 # temporary files to be created and, as you can see below, it is a
@@ -96,66 +94,89 @@ trap 'exit 1' 1 2 15
 
 # Portable tmp directory creation inspired by the Autoconf team.
 
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-       for c in cc gcc c89 c99 ; do
-         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
-            CC_FOR_BUILD="$c"; break ;
-         fi ;
-       done ;
-       if test x"$CC_FOR_BUILD" = x ; then
-         CC_FOR_BUILD=no_compiler_found ;
-       fi
-       ;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
+tmp=
+# shellcheck disable=SC2172
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
+
+set_cc_for_build() {
+    # prevent multiple calls if $tmp is already set
+    test "$tmp" && return 0
+    : "${TMPDIR=/tmp}"
+    # shellcheck disable=SC2039
+    { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||
+       { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
+       { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+       { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
+    dummy=$tmp/dummy
+    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
+       ,,)    echo "int x;" > "$dummy.c"
+              for driver in cc gcc c89 c99 ; do
+                  if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
+                      CC_FOR_BUILD="$driver"
+                      break
+                  fi
+              done
+              if test x"$CC_FOR_BUILD" = x ; then
+                  CC_FOR_BUILD=no_compiler_found
+              fi
+              ;;
+       ,,*)   CC_FOR_BUILD=$CC ;;
+       ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+    esac
+}
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+if test -f /.attbin/uname ; then
        PATH=$PATH:/.attbin ; export PATH
 fi
 
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-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
+UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
+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
+case "$UNAME_SYSTEM" in
 Linux|GNU|GNU/*)
-       # If the system lacks a compiler, then just pick glibc.
-       # We could probably try harder.
-       LIBC=gnu
+       LIBC=unknown
 
-       eval $set_cc_for_build
-       cat <<-EOF > $dummy.c
+       set_cc_for_build
+       cat <<-EOF > "$dummy.c"
        #include <features.h>
        #if defined(__UCLIBC__)
        LIBC=uclibc
        #elif defined(__dietlibc__)
        LIBC=dietlibc
-       #else
+       #elif defined(__GLIBC__)
        LIBC=gnu
+       #else
+       #include <stdarg.h>
+       /* First heuristic to detect musl libc.  */
+       #ifdef __DEFINED_va_list
+       LIBC=musl
+       #endif
        #endif
        EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+       eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"
+
+       # Second heuristic to detect musl libc.
+       if [ "$LIBC" = unknown ] &&
+          command -v ldd >/dev/null &&
+          ldd --version 2>&1 | grep -q ^musl; then
+               LIBC=musl
+       fi
+
+       # If the system lacks a compiler, then just pick glibc.
+       # We could probably try harder.
+       if [ "$LIBC" = unknown ]; then
+               LIBC=gnu
+       fi
        ;;
 esac
 
 # Note: order is significant - the case branches are not exclusive.
 
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
     *:NetBSD:*:*)
        # NetBSD (nbsd) targets should (where applicable) match one or
        # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -167,22 +188,32 @@ 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)`
-       case "${UNAME_MACHINE_ARCH}" in
+       UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
+           /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+           /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+           echo unknown))
+       case "$UNAME_MACHINE_ARCH" in
+           aarch64eb) machine=aarch64_be-unknown ;;
            armeb) machine=armeb-unknown ;;
            arm*) machine=arm-unknown ;;
            sh3el) machine=shl-unknown ;;
            sh3eb) machine=sh-unknown ;;
            sh5el) machine=sh5le-unknown ;;
-           *) machine=${UNAME_MACHINE_ARCH}-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.
-       case "${UNAME_MACHINE_ARCH}" in
+       # 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
+               set_cc_for_build
                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
                        | grep -q __ELF__
                then
@@ -197,117 +228,137 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                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
        # Debian GNU/NetBSD machines have a different userland, and
        # thus, need a distinct triplet. However, they do not need
        # kernel version information, so it can be replaced with a
        # suitable tag, in the style of linux-gnu.
-       case "${UNAME_VERSION}" in
+       case "$UNAME_VERSION" in
            Debian*)
                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}
+       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}
+       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 ;;
+    *:MidnightBSD:*:*)
+       echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
        exit ;;
     *:ekkoBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
        exit ;;
     *:SolidBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
+       exit ;;
+    *:OS108:*:*)
+       echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
        exit ;;
     macppc:MirBSD:*:*)
-       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
        exit ;;
     *:MirBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
+       exit ;;
+    *:Sortix:*:*)
+       echo "$UNAME_MACHINE"-unknown-sortix
+       exit ;;
+    *:Twizzler:*:*)
+       echo "$UNAME_MACHINE"-unknown-twizzler
+       exit ;;
+    *:Redox:*:*)
+       echo "$UNAME_MACHINE"-unknown-redox
+       exit ;;
+    mips:OSF1:*.*)
+       echo mips-dec-osf1
        exit ;;
     alpha:OSF1:*:*)
        case $UNAME_RELEASE in
        *4.0)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               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
        # OSF/1 and Tru64 systems produced since 1995.  I hope that
        # covers most systems running today.  This code pipes the CPU
        # types through head -n 1, so we only detect the type of CPU 0.
-       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       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'`
+       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
-       # of the specific Alpha model?
-       echo alpha-pc-interix
-       exit ;;
-    21064:Windows_NT:50:3)
-       echo alpha-dec-winnt3.5
-       exit ;;
     Amiga*:UNIX_System_V:4.0:*)
        echo m68k-unknown-sysv4
        exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-amigaos
+       echo "$UNAME_MACHINE"-unknown-amigaos
        exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-morphos
+       echo "$UNAME_MACHINE"-unknown-morphos
        exit ;;
     *:OS/390:*:*)
        echo i370-ibm-openedition
@@ -319,7 +370,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        echo powerpc-ibm-os400
        exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-       echo arm-acorn-riscix${UNAME_RELEASE}
+       echo arm-acorn-riscix"$UNAME_RELEASE"
        exit ;;
     arm*:riscos:*:*|arm*:RISCOS:*:*)
        echo arm-unknown-riscos
@@ -329,7 +380,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        exit ;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
        # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+       if test "$( (/bin/universe) 2>/dev/null)" = att ; then
                echo pyramid-pyramid-sysv3
        else
                echo pyramid-pyramid-bsd
@@ -342,69 +393,69 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        echo sparc-icl-nx6
        exit ;;
     DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-       case `/usr/bin/uname -p` in
+       case $(/usr/bin/uname -p) in
            sparc) echo sparc-icl-nx7; exit ;;
        esac ;;
     s390x:SunOS:*:*)
-       echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
        exit ;;
     sun4H:SunOS:5.*:*)
-       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
        exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
        exit ;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-       echo i386-pc-auroraux${UNAME_RELEASE}
+       echo i386-pc-auroraux"$UNAME_RELEASE"
        exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-       eval $set_cc_for_build
-       SUN_ARCH="i386"
+       set_cc_for_build
+       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 test "$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/[^.]*//'`
+       echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
        exit ;;
     sun4*:SunOS:6*:*)
        # According to config.sub, this is the proper way to canonicalize
        # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
        # it's likely to be more like Solaris than SunOS4.
-       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
        exit ;;
     sun4*:SunOS:*:*)
-       case "`/usr/bin/arch -k`" in
+       case "$(/usr/bin/arch -k)" in
            Series*|S4*)
-               UNAME_RELEASE=`uname -v`
+               UNAME_RELEASE=$(uname -v)
                ;;
        esac
        # Japanese Language versions have a version number like `4.1.3-JL'.
-       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
        exit ;;
     sun3*:SunOS:*:*)
-       echo m68k-sun-sunos${UNAME_RELEASE}
+       echo m68k-sun-sunos"$UNAME_RELEASE"
        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
-       case "`/bin/arch`" in
+       UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)
+       test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
+       case "$(/bin/arch)" in
            sun3)
-               echo m68k-sun-sunos${UNAME_RELEASE}
+               echo m68k-sun-sunos"$UNAME_RELEASE"
                ;;
            sun4)
-               echo sparc-sun-sunos${UNAME_RELEASE}
+               echo sparc-sun-sunos"$UNAME_RELEASE"
                ;;
        esac
        exit ;;
     aushp:SunOS:*:*)
-       echo sparc-auspex-sunos${UNAME_RELEASE}
+       echo sparc-auspex-sunos"$UNAME_RELEASE"
        exit ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
@@ -415,44 +466,44 @@ 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}
+       echo m68k-atari-mint"$UNAME_RELEASE"
        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}
+       echo m68k-milan-mint"$UNAME_RELEASE"
        exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-       echo m68k-hades-mint${UNAME_RELEASE}
+       echo m68k-hades-mint"$UNAME_RELEASE"
        exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-       echo m68k-unknown-mint${UNAME_RELEASE}
+       echo m68k-unknown-mint"$UNAME_RELEASE"
        exit ;;
     m68k:machten:*:*)
-       echo m68k-apple-machten${UNAME_RELEASE}
+       echo m68k-apple-machten"$UNAME_RELEASE"
        exit ;;
     powerpc:machten:*:*)
-       echo powerpc-apple-machten${UNAME_RELEASE}
+       echo powerpc-apple-machten"$UNAME_RELEASE"
        exit ;;
     RISC*:Mach:*:*)
        echo mips-dec-mach_bsd4.3
        exit ;;
     RISC*:ULTRIX:*:*)
-       echo mips-dec-ultrix${UNAME_RELEASE}
+       echo mips-dec-ultrix"$UNAME_RELEASE"
        exit ;;
     VAX*:ULTRIX*:*:*)
-       echo vax-dec-ultrix${UNAME_RELEASE}
+       echo vax-dec-ultrix"$UNAME_RELEASE"
        exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
-       echo clipper-intergraph-clix${UNAME_RELEASE}
+       echo clipper-intergraph-clix"$UNAME_RELEASE"
        exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
+       set_cc_for_build
+       sed 's/^        //' << EOF > "$dummy.c"
 #ifdef __cplusplus
 #include <stdio.h>  /* for printf() prototype */
        int main (int argc, char *argv[]) {
@@ -461,23 +512,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 #endif
        #if defined (host_mips) && defined (MIPSEB)
        #if defined (SYSTYPE_SYSV)
-         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+         printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
        #endif
        #if defined (SYSTYPE_SVR4)
-         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+         printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
        #endif
        #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+         printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
        #endif
        #endif
          exit (-1);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c &&
-         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-         SYSTEM_NAME=`$dummy $dummyarg` &&
+       $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+         dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
+         SYSTEM_NAME=$("$dummy" "$dummyarg") &&
            { echo "$SYSTEM_NAME"; exit; }
-       echo mips-mips-riscos${UNAME_RELEASE}
+       echo mips-mips-riscos"$UNAME_RELEASE"
        exit ;;
     Motorola:PowerMAX_OS:*:*)
        echo powerpc-motorola-powermax
@@ -502,18 +553,18 @@ EOF
        exit ;;
     AViiON:dgux:*:*)
        # DG/UX returns AViiON for all architectures
-       UNAME_PROCESSOR=`/usr/bin/uname -p`
-       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       UNAME_PROCESSOR=$(/usr/bin/uname -p)
+       if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
        then
-           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+              test "$TARGET_BINARY_INTERFACE"x = x
            then
-               echo m88k-dg-dgux${UNAME_RELEASE}
+               echo m88k-dg-dgux"$UNAME_RELEASE"
            else
-               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+               echo m88k-dg-dguxbcs"$UNAME_RELEASE"
            fi
        else
-           echo i586-dg-dgux${UNAME_RELEASE}
+           echo i586-dg-dgux"$UNAME_RELEASE"
        fi
        exit ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
@@ -530,26 +581,26 @@ EOF
        echo m68k-tektronix-bsd
        exit ;;
     *:IRIX*:*:*)
-       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
        exit ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
        echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+       exit ;;               # Note that: echo "'$(uname -s)'" gives 'AIX '
     i*86:AIX:*:*)
        echo i386-ibm-aix
        exit ;;
     ia64:AIX:*:*)
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
+       if test -x /usr/bin/oslevel ; then
+               IBM_REV=$(/usr/bin/oslevel)
        else
-               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+               IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
        fi
-       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
        exit ;;
     *:AIX:2:3)
        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-               eval $set_cc_for_build
-               sed 's/^                //' << EOF >$dummy.c
+               set_cc_for_build
+               sed 's/^                //' << EOF > "$dummy.c"
                #include <sys/systemcfg.h>
 
                main()
@@ -560,7 +611,7 @@ EOF
                        exit(0);
                        }
 EOF
-               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")
                then
                        echo "$SYSTEM_NAME"
                else
@@ -573,27 +624,28 @@ EOF
        fi
        exit ;;
     *: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_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 test -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}
+               IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
        fi
-       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
        exit ;;
     *:AIX:*:*)
        echo rs6000-ibm-aix
        exit ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
        echo romp-ibm-bsd4.4
        exit ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
        exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
        echo rs6000-bull-bosx
@@ -608,28 +660,28 @@ EOF
        echo m68k-hp-bsd4.4
        exit ;;
     9000/[34678]??:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       case "${UNAME_MACHINE}" in
-           9000/31? )            HP_ARCH=m68000 ;;
-           9000/[34]?? )         HP_ARCH=m68k ;;
+       HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
+       case "$UNAME_MACHINE" in
+           9000/31?)            HP_ARCH=m68000 ;;
+           9000/[34]??)         HP_ARCH=m68k ;;
            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
+               if test -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
+                       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
+               if test "$HP_ARCH" = ""; then
+                   set_cc_for_build
+                   sed 's/^            //' << EOF > "$dummy.c"
 
                #define _HPUX_SOURCE
                #include <stdlib.h>
@@ -662,13 +714,13 @@ EOF
                    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 test "$HP_ARCH" = hppa2.0w
        then
-           eval $set_cc_for_build
+           set_cc_for_build
 
            # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
            # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
@@ -679,23 +731,23 @@ 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}
+       echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
        exit ;;
     ia64:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       echo ia64-hp-hpux${HPUX_REV}
+       HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
+       echo ia64-hp-hpux"$HPUX_REV"
        exit ;;
     3050*:HI-UX:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
+       set_cc_for_build
+       sed 's/^        //' << EOF > "$dummy.c"
        #include <unistd.h>
        int
        main ()
@@ -720,11 +772,11 @@ EOF
          exit (0);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+       $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
                { echo "$SYSTEM_NAME"; exit; }
        echo unknown-hitachi-hiuxwe2
        exit ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
        echo hppa1.1-hp-bsd
        exit ;;
     9000/8??:4.3bsd:*:*)
@@ -733,17 +785,17 @@ EOF
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
        echo hppa1.0-hp-mpeix
        exit ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
        echo hppa1.1-hp-osf
        exit ;;
     hp8??:OSF1:*:*)
        echo hppa1.0-hp-osf
        exit ;;
     i*86:OSF1:*:*)
-       if [ -x /usr/sbin/sysversion ] ; then
-           echo ${UNAME_MACHINE}-unknown-osf1mk
+       if test -x /usr/sbin/sysversion ; then
+           echo "$UNAME_MACHINE"-unknown-osf1mk
        else
-           echo ${UNAME_MACHINE}-unknown-osf1
+           echo "$UNAME_MACHINE"-unknown-osf1
        fi
        exit ;;
     parisc*:Lites*:*:*)
@@ -768,130 +820,123 @@ EOF
        echo c4-convex-bsd
        exit ;;
     CRAY*Y-MP:*:*:*)
-       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     CRAY*[A-Z]90:*:*:*)
-       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
        | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
              -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
              -e 's/\.[^.]*$/.X/'
        exit ;;
     CRAY*TS:*:*:*)
-       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     CRAY*T3E:*:*:*)
-       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     CRAY*SV1:*:*:*)
-       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
        exit ;;
     *:UNICOS/mp:*:*)
-       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       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/ /_/'`
+       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/ /_/'`
+       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}
+       echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
        exit ;;
     sparc*:BSD/OS:*:*)
-       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       echo sparc-unknown-bsdi"$UNAME_RELEASE"
        exit ;;
     *:BSD/OS:*:*)
-       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
+       exit ;;
+    arm:FreeBSD:*:*)
+       UNAME_PROCESSOR=$(uname -p)
+       set_cc_for_build
+       if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_PCS_VFP
+       then
+           echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
+       else
+           echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
+       fi
        exit ;;
     *:FreeBSD:*:*)
-       UNAME_PROCESSOR=`/usr/bin/uname -p`
-       case ${UNAME_PROCESSOR} in
+       UNAME_PROCESSOR=$(/usr/bin/uname -p)
+       case "$UNAME_PROCESSOR" in
            amd64)
-               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-           *)
-               echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+               UNAME_PROCESSOR=x86_64 ;;
+           i386)
+               UNAME_PROCESSOR=i586 ;;
        esac
+       echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
        exit ;;
     i*:CYGWIN*:*)
-       echo ${UNAME_MACHINE}-pc-cygwin
+       echo "$UNAME_MACHINE"-pc-cygwin
        exit ;;
     *:MINGW64*:*)
-       echo ${UNAME_MACHINE}-pc-mingw64
+       echo "$UNAME_MACHINE"-pc-mingw64
        exit ;;
     *:MINGW*:*)
-       echo ${UNAME_MACHINE}-pc-mingw32
+       echo "$UNAME_MACHINE"-pc-mingw32
        exit ;;
-    i*:MSYS*:*)
-       echo ${UNAME_MACHINE}-pc-msys
-       exit ;;
-    i*:windows32*:*)
-       # uname -m includes "-pc" on this system.
-       echo ${UNAME_MACHINE}-mingw32
+    *:MSYS*:*)
+       echo "$UNAME_MACHINE"-pc-msys
        exit ;;
     i*:PW*:*)
-       echo ${UNAME_MACHINE}-pc-pw32
+       echo "$UNAME_MACHINE"-pc-pw32
        exit ;;
     *:Interix*:*)
-       case ${UNAME_MACHINE} in
+       case "$UNAME_MACHINE" in
            x86)
-               echo i586-pc-interix${UNAME_RELEASE}
+               echo i586-pc-interix"$UNAME_RELEASE"
                exit ;;
            authenticamd | genuineintel | EM64T)
-               echo x86_64-unknown-interix${UNAME_RELEASE}
+               echo x86_64-unknown-interix"$UNAME_RELEASE"
                exit ;;
            IA64)
-               echo ia64-unknown-interix${UNAME_RELEASE}
+               echo ia64-unknown-interix"$UNAME_RELEASE"
                exit ;;
        esac ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-       echo i${UNAME_MACHINE}-pc-mks
-       exit ;;
-    8664:Windows_NT:*)
-       echo x86_64-pc-mks
-       exit ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-       # How do we know it's Interix rather than the generic POSIX subsystem?
-       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-       # UNAME_MACHINE based on the output of uname instead of i386?
-       echo i586-pc-interix
-       exit ;;
     i*:UWIN*:*)
-       echo ${UNAME_MACHINE}-pc-uwin
+       echo "$UNAME_MACHINE"-pc-uwin
        exit ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-       echo x86_64-unknown-cygwin
-       exit ;;
-    p*:CYGWIN*:*)
-       echo powerpcle-unknown-cygwin
+       echo x86_64-pc-cygwin
        exit ;;
     prep*:SunOS:5.*:*)
-       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
        exit ;;
     *:GNU:*:*)
        # the GNU system
-       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`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/[-(].*//'`-${LIBC}
+       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
+    *:Minix:*:*)
+       echo "$UNAME_MACHINE"-unknown-minix
        exit ;;
     aarch64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     aarch64_be:Linux:*:*)
        UNAME_MACHINE=aarch64_be
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     alpha:Linux:*:*)
-       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+       case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
          EV5)   UNAME_MACHINE=alphaev5 ;;
          EV56)  UNAME_MACHINE=alphaev56 ;;
          PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -901,129 +946,182 @@ EOF
          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}
+       if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     arc:Linux:*:* | arceb:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     arm*:Linux:*:*)
-       eval $set_cc_for_build
+       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-${LIBC}
+           echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        else
            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
+               echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
            else
-               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+               echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
            fi
        fi
        exit ;;
     avr32*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     cris:Linux:*:*)
-       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+       echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
        exit ;;
     crisv32:Linux:*:*)
-       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+       echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
+       exit ;;
+    e2k:Linux:*:*)
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     frv:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     hexagon:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     i*86:Linux:*:*)
-       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+       echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
        exit ;;
     ia64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+       exit ;;
+    k1om:Linux:*:*)
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+       exit ;;
+    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     m32r*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     m68*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
+       set_cc_for_build
+       IS_GLIBC=0
+       test x"${LIBC}" = xgnu && IS_GLIBC=1
+       sed 's/^        //' << EOF > "$dummy.c"
        #undef CPU
-       #undef ${UNAME_MACHINE}
-       #undef ${UNAME_MACHINE}el
+       #undef mips
+       #undef mipsel
+       #undef mips64
+       #undef mips64el
+       #if ${IS_GLIBC} && defined(_ABI64)
+       LIBCABI=gnuabi64
+       #else
+       #if ${IS_GLIBC} && defined(_ABIN32)
+       LIBCABI=gnuabin32
+       #else
+       LIBCABI=${LIBC}
+       #endif
+       #endif
+
+       #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+       CPU=mipsisa64r6
+       #else
+       #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+       CPU=mipsisa32r6
+       #else
+       #if defined(__mips64)
+       CPU=mips64
+       #else
+       CPU=mips
+       #endif
+       #endif
+       #endif
+
        #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=${UNAME_MACHINE}el
+       MIPS_ENDIAN=el
        #else
        #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=${UNAME_MACHINE}
+       MIPS_ENDIAN=
        #else
-       CPU=
+       MIPS_ENDIAN=
        #endif
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+       eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
+       test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
        ;;
-    or1k:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+    mips64el:Linux:*:*)
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
-    or32:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+    openrisc*:Linux:*:*)
+       echo or1k-unknown-linux-"$LIBC"
+       exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     padre:Linux:*:*)
-       echo sparc-unknown-linux-${LIBC}
+       echo sparc-unknown-linux-"$LIBC"
        exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-${LIBC}
+       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-${LIBC} ;;
-         PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
-         *)    echo hppa-unknown-linux-${LIBC} ;;
+       case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
+         PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
+         PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
+         *)    echo hppa-unknown-linux-"$LIBC" ;;
        esac
        exit ;;
     ppc64:Linux:*:*)
-       echo powerpc64-unknown-linux-${LIBC}
+       echo powerpc64-unknown-linux-"$LIBC"
        exit ;;
     ppc:Linux:*:*)
-       echo powerpc-unknown-linux-${LIBC}
+       echo powerpc-unknown-linux-"$LIBC"
        exit ;;
     ppc64le:Linux:*:*)
-       echo powerpc64le-unknown-linux-${LIBC}
+       echo powerpc64le-unknown-linux-"$LIBC"
        exit ;;
     ppcle:Linux:*:*)
-       echo powerpcle-unknown-linux-${LIBC}
+       echo powerpcle-unknown-linux-"$LIBC"
+       exit ;;
+    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-       echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+       echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
        exit ;;
     sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     sh*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     tile*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     vax:Linux:*:*)
-       echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+       echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
        exit ;;
     x86_64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       set_cc_for_build
+       LIBCABI=$LIBC
+       if test "$CC_FOR_BUILD" != no_compiler_found; then
+           if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_X32 >/dev/null
+           then
+               LIBCABI="$LIBC"x32
+           fi
+       fi
+       echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
        exit ;;
     xtensa*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+       echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
        exit ;;
     i*86:DYNIX/ptx:4*:*)
        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1037,51 +1135,51 @@ EOF
        # 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.
-       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
        exit ;;
     i*86:OS/2:*:*)
        # If we were able to find `uname', then EMX Unix compatibility
        # is probably installed.
-       echo ${UNAME_MACHINE}-pc-os2-emx
+       echo "$UNAME_MACHINE"-pc-os2-emx
        exit ;;
     i*86:XTS-300:*:STOP)
-       echo ${UNAME_MACHINE}-unknown-stop
+       echo "$UNAME_MACHINE"-unknown-stop
        exit ;;
     i*86:atheos:*:*)
-       echo ${UNAME_MACHINE}-unknown-atheos
+       echo "$UNAME_MACHINE"-unknown-atheos
        exit ;;
     i*86:syllable:*:*)
-       echo ${UNAME_MACHINE}-pc-syllable
+       echo "$UNAME_MACHINE"-pc-syllable
        exit ;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
-       echo i386-unknown-lynxos${UNAME_RELEASE}
+       echo i386-unknown-lynxos"$UNAME_RELEASE"
        exit ;;
     i*86:*DOS:*:*)
-       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       echo "$UNAME_MACHINE"-pc-msdosdjgpp
        exit ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+    i*86:*:4.*:*)
+       UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')
        if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+               echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
        else
-               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+               echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
        fi
        exit ;;
     i*86:*:5:[678]*)
        # UnixWare 7.x, OpenUNIX and OpenServer 6.
-       case `/bin/uname -X | grep "^Machine"` in
+       case $(/bin/uname -X | grep "^Machine") in
            *486*)           UNAME_MACHINE=i486 ;;
            *Pentium)        UNAME_MACHINE=i586 ;;
            *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
        esac
-       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
        exit ;;
     i*86:*:3.2:*)
        if test -f /usr/options/cb.name; then
-               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+               UNAME_REL=$(sed -n 's/.*Version //p' </usr/options/cb.name)
+               echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
        elif /bin/uname -X 2>/dev/null >/dev/null ; then
-               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))
                (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
                (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
                        && UNAME_MACHINE=i586
@@ -1089,9 +1187,9 @@ EOF
                        && UNAME_MACHINE=i686
                (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
                        && UNAME_MACHINE=i686
-               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+               echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
        else
-               echo ${UNAME_MACHINE}-pc-sysv32
+               echo "$UNAME_MACHINE"-pc-sysv32
        fi
        exit ;;
     pc:*:*:*)
@@ -1099,7 +1197,7 @@ EOF
        # 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 ;;
@@ -1111,9 +1209,9 @@ EOF
        exit ;;
     i860:*:4.*:*) # i860-SVR4
        if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+         echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
        else # Add other i860-SVR4 vendors below as they are discovered.
-         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+         echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
        fi
        exit ;;
     mini*:CTIX:SYS*5:*)
@@ -1131,41 +1229,41 @@ EOF
     3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
        OS_REL=''
        test -r /etc/.relid \
-       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+         && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+         && { 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; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
        OS_REL='.3'
        test -r /etc/.relid \
-           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+           && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-           && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+           && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-           && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+           && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
        /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
-           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+           && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       echo m68k-unknown-lynxos"$UNAME_RELEASE"
        exit ;;
     mc68030:UNIX_System_V:4.*:*)
        echo m68k-atari-sysv4
        exit ;;
     TSUNAMI:LynxOS:2.*:*)
-       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       echo sparc-unknown-lynxos"$UNAME_RELEASE"
        exit ;;
     rs6000:LynxOS:2.*:*)
-       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       echo rs6000-unknown-lynxos"$UNAME_RELEASE"
        exit ;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
-       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       echo powerpc-unknown-lynxos"$UNAME_RELEASE"
        exit ;;
     SM[BE]S:UNIX_SV:*:*)
-       echo mips-dde-sysv${UNAME_RELEASE}
+       echo mips-dde-sysv"$UNAME_RELEASE"
        exit ;;
     RM*:ReliantUNIX-*:*:*)
        echo mips-sni-sysv4
@@ -1175,8 +1273,8 @@ EOF
        exit ;;
     *:SINIX-*:*:*)
        if uname -p 2>/dev/null >/dev/null ; then
-               UNAME_MACHINE=`(uname -p) 2>/dev/null`
-               echo ${UNAME_MACHINE}-sni-sysv4
+               UNAME_MACHINE=$( (uname -p) 2>/dev/null)
+               echo "$UNAME_MACHINE"-sni-sysv4
        else
                echo ns32k-sni-sysv
        fi
@@ -1196,23 +1294,23 @@ EOF
        exit ;;
     i*86:VOS:*:*)
        # From Paul.Green@stratus.com.
-       echo ${UNAME_MACHINE}-stratus-vos
+       echo "$UNAME_MACHINE"-stratus-vos
        exit ;;
     *:VOS:*:*)
        # From Paul.Green@stratus.com.
        echo hppa1.1-stratus-vos
        exit ;;
     mc68*:A/UX:*:*)
-       echo m68k-apple-aux${UNAME_RELEASE}
+       echo m68k-apple-aux"$UNAME_RELEASE"
        exit ;;
     news*:NEWS-OS:6*:*)
        echo mips-sony-newsos6
        exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-       if [ -d /usr/nec ]; then
-               echo mips-nec-sysv${UNAME_RELEASE}
+       if test -d /usr/nec; then
+               echo mips-nec-sysv"$UNAME_RELEASE"
        else
-               echo mips-unknown-sysv${UNAME_RELEASE}
+               echo mips-unknown-sysv"$UNAME_RELEASE"
        fi
        exit ;;
     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
@@ -1231,67 +1329,97 @@ EOF
        echo x86_64-unknown-haiku
        exit ;;
     SX-4:SUPER-UX:*:*)
-       echo sx4-nec-superux${UNAME_RELEASE}
+       echo sx4-nec-superux"$UNAME_RELEASE"
        exit ;;
     SX-5:SUPER-UX:*:*)
-       echo sx5-nec-superux${UNAME_RELEASE}
+       echo sx5-nec-superux"$UNAME_RELEASE"
        exit ;;
     SX-6:SUPER-UX:*:*)
-       echo sx6-nec-superux${UNAME_RELEASE}
+       echo sx6-nec-superux"$UNAME_RELEASE"
        exit ;;
     SX-7:SUPER-UX:*:*)
-       echo sx7-nec-superux${UNAME_RELEASE}
+       echo sx7-nec-superux"$UNAME_RELEASE"
        exit ;;
     SX-8:SUPER-UX:*:*)
-       echo sx8-nec-superux${UNAME_RELEASE}
+       echo sx8-nec-superux"$UNAME_RELEASE"
        exit ;;
     SX-8R:SUPER-UX:*:*)
-       echo sx8r-nec-superux${UNAME_RELEASE}
+       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}
+       echo powerpc-apple-rhapsody"$UNAME_RELEASE"
        exit ;;
     *:Rhapsody:*:*)
-       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
+       exit ;;
+    arm64:Darwin:*:*)
+       echo aarch64-apple-darwin"$UNAME_RELEASE"
        exit ;;
     *:Darwin:*:*)
-       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-       eval $set_cc_for_build
-       if test "$UNAME_PROCESSOR" = unknown ; then
-           UNAME_PROCESSOR=powerpc
+       UNAME_PROCESSOR=$(uname -p)
+       case $UNAME_PROCESSOR in
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       if command -v xcode-select > /dev/null 2> /dev/null && \
+               ! xcode-select --print-path > /dev/null 2> /dev/null ; then
+           # Avoid executing cc if there is no toolchain installed as
+           # cc will be a stub that puts up a graphical alert
+           # prompting the user to install developer tools.
+           CC_FOR_BUILD=no_compiler_found
+       else
+           set_cc_for_build
        fi
-       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+       if test "$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
+                  (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
+           # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+           if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+                  (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+                  grep IS_PPC >/dev/null
+           then
+               UNAME_PROCESSOR=powerpc
+           fi
+       elif test "$UNAME_PROCESSOR" = i386 ; then
+           # uname -m returns i386 or x86_64
+           UNAME_PROCESSOR=$UNAME_MACHINE
        fi
-       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
        exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-       UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
+       UNAME_PROCESSOR=$(uname -p)
+       if test "$UNAME_PROCESSOR" = x86; then
                UNAME_PROCESSOR=i386
                UNAME_MACHINE=pc
        fi
-       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
        exit ;;
     *:QNX:*:4*)
        echo i386-pc-qnx
        exit ;;
-    NEO-?:NONSTOP_KERNEL:*:*)
-       echo neo-tandem-nsk${UNAME_RELEASE}
+    NEO-*:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk"$UNAME_RELEASE"
        exit ;;
     NSE-*:NONSTOP_KERNEL:*:*)
-       echo nse-tandem-nsk${UNAME_RELEASE}
+       echo nse-tandem-nsk"$UNAME_RELEASE"
+       exit ;;
+    NSR-*:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk"$UNAME_RELEASE"
        exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
-       echo nsr-tandem-nsk${UNAME_RELEASE}
+    NSV-*:NONSTOP_KERNEL:*:*)
+       echo nsv-tandem-nsk"$UNAME_RELEASE"
+       exit ;;
+    NSX-*:NONSTOP_KERNEL:*:*)
+       echo nsx-tandem-nsk"$UNAME_RELEASE"
        exit ;;
     *:NonStop-UX:*:*)
        echo mips-compaq-nonstopux
@@ -1300,18 +1428,19 @@ EOF
        echo bs2000-siemens-sysv
        exit ;;
     DS/*:UNIX_System_V:*:*)
-       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
        exit ;;
     *:Plan9:*:*)
        # "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
+       # shellcheck disable=SC2154
+       if test "$cputype" = 386; then
            UNAME_MACHINE=i386
        else
            UNAME_MACHINE="$cputype"
        fi
-       echo ${UNAME_MACHINE}-unknown-plan9
+       echo "$UNAME_MACHINE"-unknown-plan9
        exit ;;
     *:TOPS-10:*:*)
        echo pdp10-unknown-tops10
@@ -1332,14 +1461,14 @@ 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/[-(].*//'`
+       echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
        exit ;;
     *:*VMS:*:*)
-       UNAME_MACHINE=`(uname -p) 2>/dev/null`
-       case "${UNAME_MACHINE}" in
+       UNAME_MACHINE=$( (uname -p) 2>/dev/null)
+       case "$UNAME_MACHINE" in
            A*) echo alpha-dec-vms ; exit ;;
            I*) echo ia64-dec-vms ; exit ;;
            V*) echo vax-dec-vms ; exit ;;
@@ -1348,24 +1477,39 @@ 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
+       echo "$UNAME_MACHINE"-pc-rdos
        exit ;;
-    i*86:AROS:*:*)
-       echo ${UNAME_MACHINE}-pc-aros
+    *:AROS:*:*)
+       echo "$UNAME_MACHINE"-unknown-aros
        exit ;;
     x86_64:VMkernel:*:*)
-       echo ${UNAME_MACHINE}-unknown-esx
+       echo "$UNAME_MACHINE"-unknown-esx
+       exit ;;
+    amd64:Isilon\ OneFS:*:*)
+       echo x86_64-unknown-onefs
+       exit ;;
+    *:Unleashed:*:*)
+       echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
        exit ;;
 esac
 
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
 #ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
 #endif
 main ()
 {
@@ -1378,20 +1522,12 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-       "4"
+  "4"
 #else
-       ""
-#endif
-       ); exit (0);
+  ""
 #endif
+  ); exit (0);
 #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)
@@ -1399,7 +1535,7 @@ main ()
 #define __ARCHITECTURE__ "m68k"
 #endif
   int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  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
@@ -1433,39 +1569,54 @@ main ()
 #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);
+  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
+#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
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname un;
+  uname (&un);
+  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+  printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+  struct utsname *un;
+  uname (&un);
+  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+  printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
 #endif
 
 #if defined (alliant) && defined (i860)
@@ -1476,82 +1627,73 @@ main ()
 }
 EOF
 
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+$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; }
 
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+echo "$0: unable to guess system type" >&2
 
-# Convex versions that predate uname can use getsysinfo(1)
+case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+    mips:Linux | mips64:Linux)
+       # If we got here on MIPS GNU/Linux, output extra information.
+       cat >&2 <<EOF
 
-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
-       exit ;;
-    c34*)
-       echo c34-convex-bsd
-       exit ;;
-    c38*)
-       echo c38-convex-bsd
-       exit ;;
-    c4*)
-       echo c4-convex-bsd
-       exit ;;
-    esac
-fi
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
+the system type. Please install a C compiler and try again.
+EOF
+       ;;
+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 *all*
+copies of 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
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+EOF
+
+year=$(echo $timestamp | sed 's,-.*,,')
+# shellcheck disable=SC2003
+if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then
+   cat >&2 <<EOF
 
-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
 
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+uname -m = $( (uname -m) 2>/dev/null || echo unknown)
+uname -r = $( (uname -r) 2>/dev/null || echo unknown)
+uname -s = $( (uname -s) 2>/dev/null || echo unknown)
+uname -v = $( (uname -v) 2>/dev/null || echo unknown)
 
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)
+/bin/uname -X     = $( (/bin/uname -X) 2>/dev/null)
 
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+hostinfo               = $( (hostinfo) 2>/dev/null)
+/bin/universe          = $( (/bin/universe) 2>/dev/null)
+/usr/bin/arch -k       = $( (/usr/bin/arch -k) 2>/dev/null)
+/bin/arch              = $( (/bin/arch) 2>/dev/null)
+/usr/bin/oslevel       = $( (/usr/bin/oslevel) 2>/dev/null)
+/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)
 
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM  = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
 EOF
+fi
 
 exit 1
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
index 89d2d7b2929056e41706b19808664af0bdfaf04d..248577cd7466bf93791ffc3f4bffaa61e4709460 100644 (file)
@@ -1,56 +1,71 @@
-#define HAVE_FCNTL_H 0
-#define HAVE_LIMITS_H 0
-#define HAVE_UNISTD_H 0
-#define HAVE_WINDOWS_H 0
-#define HAVE_WINIOCTL_H 0
-#define HAVE_LIBDSK_H 0
-#define HAVE_SYS_TYPES_H 0
-#define HAVE_SYS_STAT_H 0
-#define HAVE_MODE_T 0
-#define NEED_NCURSES 0
-#define HAVE_NCURSES_NCURSES_H 0
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#undef HAVE_FCNTL_H
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
 #endif
 
-#if HAVE_LIMITS_H
+#undef HAVE_LIMITS_H
+#ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
 
-#if HAVE_UNISTD_H
+#undef HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#if HAVE_WINDOWS_H
+#undef HAVE_WINDOWS_H
+#ifdef HAVE_WINDOWS_H
 #include <windows.h>
 #endif
 
-#if HAVE_WINIOCTL_H
+#undef HAVE_WINIOCTL_H
+#ifdef HAVE_WINIOCTL_H
 #include <winioctl.h>
 #endif
 
-#if HAVE_LIBDSK_H
+#undef HAVE_LIBDSK_H
+#ifdef HAVE_LIBDSK_H
 #include <libdsk.h>
 #endif
 
-#if HAVE_FCNTL_H
-#include <fcntl.h>
+#undef HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
 #endif
 
-#ifndef _POSIX_PATH_MAX
-#define _POSIX_PATH_MAX _MAX_PATH
+#undef HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
 #endif
 
-#include <time.h>
+#undef HAVE_SYS_UTIME_H
+#ifdef HAVE_SYS_UTIME_H
+#include <sys/utime.h>
+#endif
+
+#undef HAVE_UTIME_H
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
+#undef NEED_NCURSES
+#undef HAVE_NCURSES_NCURSES_H
 
 /* Define either for large file support, if your OS needs them. */
 #undef _FILE_OFFSET_BITS
 #undef _LARGE_FILES
 
-/* Define if using dmalloc */
-#undef USE_DMALLOC
+#ifndef _POSIX_PATH_MAX
+#define _POSIX_PATH_MAX _MAX_PATH
+#endif
+
+/* There is not standard header for this, yet it is needed for
+ * timezone changes.
+ */
+#ifndef environ
+extern char **environ;
+#endif
+
+/* If types are missing, the script defines.awk contained
+ * in configure.status should create definitions here.
+ */
index 59bb593f109c8d795df4cbb96b015222eed91c07..63c1f1c8b5e2d881e106d8951a11c6c94ae6352b 100755 (executable)
@@ -1,36 +1,31 @@
 #! /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, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   Copyright 1992-2021 Free Software Foundation, Inc.
 
-timestamp='2012-04-18'
+timestamp='2021-01-08'
 
-# 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, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://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 GNU 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.
@@ -38,7 +33,7 @@ timestamp='2012-04-18'
 # 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;hb=HEAD
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -55,15 +50,14 @@ timestamp='2012-04-18'
 #      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
-me=`echo "$0" | sed -e 's,.*/,,'`
+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.
 
-Operation modes:
+Options:
   -h, --help         print this help, then exit
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
@@ -73,9 +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, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2021 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."
@@ -97,12 +89,12 @@ while test $# -gt 0 ; do
     - )        # Use stdin as input.
        break ;;
     -* )
-       echo "$me: invalid option $1$help"
+       echo "$me: invalid option $1$help" >&2
        exit 1 ;;
 
     *local*)
        # First pass through any local machine types.
-       echo $1
+       echo "$1"
        exit ;;
 
     * )
@@ -118,1196 +110,1169 @@ case $# in
     exit 1;;
 esac
 
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# 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-android* | linux-dietlibc | linux-newlib* | \
-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
-  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 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
+# Split fields of configuration type
+# shellcheck disable=SC2162
+IFS="-" read field1 field2 field3 field4 <<EOF
+$1
+EOF
 
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-       -sun*os*)
-               # Prevent following clause from handling this invalid input.
-               ;;
-       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-       -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 | -microblaze)
-               os=
-               basic_machine=$1
-               ;;
-       -bluegene*)
-               os=-cnk
-               ;;
-       -sim | -cisco | -oki | -wec | -winbond)
-               os=
-               basic_machine=$1
-               ;;
-       -scout)
-               ;;
-       -wrs)
-               os=-vxworks
-               basic_machine=$1
-               ;;
-       -chorusos*)
-               os=-chorusos
-               basic_machine=$1
-               ;;
-       -chorusrdb)
-               os=-chorusrdb
-               basic_machine=$1
-               ;;
-       -hiux*)
-               os=-hiuxwe2
-               ;;
-       -sco6)
-               os=-sco5v6
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco5)
-               os=-sco3.2v5
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco4)
-               os=-sco3.2v4
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2.[4-9]*)
-               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2v[4-9]*)
-               # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco5v6*)
-               # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco*)
-               os=-sco3.2v2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -udk*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -isc)
-               os=-isc2.2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -clix*)
-               basic_machine=clipper-intergraph
-               ;;
-       -isc*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -lynx*178)
-               os=-lynxos178
-               ;;
-       -lynx*5)
-               os=-lynxos5
-               ;;
-       -lynx*)
-               os=-lynxos
+# Separate into logical components for further validation
+case $1 in
+       *-*-*-*-*)
+               echo Invalid configuration \`"$1"\': more than four components >&2
+               exit 1
                ;;
-       -ptx*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+       *-*-*-*)
+               basic_machine=$field1-$field2
+               basic_os=$field3-$field4
                ;;
-       -windowsnt*)
-               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+       *-*-*)
+               # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
+               # parts
+               maybe_os=$field2-$field3
+               case $maybe_os in
+                       nto-qnx* | linux-* | uclinux-uclibc* \
+                       | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
+                       | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
+                       | storm-chaos* | os2-emx* | rtmk-nova*)
+                               basic_machine=$field1
+                               basic_os=$maybe_os
+                               ;;
+                       android-linux)
+                               basic_machine=$field1-unknown
+                               basic_os=linux-android
+                               ;;
+                       *)
+                               basic_machine=$field1-$field2
+                               basic_os=$field3
+                               ;;
+               esac
                ;;
-       -psos*)
-               os=-psos
+       *-*)
+               # A lone config we happen to match not fitting any pattern
+               case $field1-$field2 in
+                       decstation-3100)
+                               basic_machine=mips-dec
+                               basic_os=
+                               ;;
+                       *-*)
+                               # Second component is usually, but not always the OS
+                               case $field2 in
+                                       # Prevent following clause from handling this valid os
+                                       sun*os*)
+                                               basic_machine=$field1
+                                               basic_os=$field2
+                                               ;;
+                                       # Manufacturers
+                                       dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
+                                       | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
+                                       | unicom* | ibm* | next | hp | isi* | apollo | altos* \
+                                       | 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 \
+                                       | microblaze* | sim | cisco \
+                                       | oki | wec | wrs | winbond)
+                                               basic_machine=$field1-$field2
+                                               basic_os=
+                                               ;;
+                                       *)
+                                               basic_machine=$field1
+                                               basic_os=$field2
+                                               ;;
+                               esac
+                       ;;
+               esac
                ;;
-       -mint | -mint[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
+       *)
+               # Convert single-component short-hands not valid as part of
+               # multi-component configurations.
+               case $field1 in
+                       386bsd)
+                               basic_machine=i386-pc
+                               basic_os=bsd
+                               ;;
+                       a29khif)
+                               basic_machine=a29k-amd
+                               basic_os=udi
+                               ;;
+                       adobe68k)
+                               basic_machine=m68010-adobe
+                               basic_os=scout
+                               ;;
+                       alliant)
+                               basic_machine=fx80-alliant
+                               basic_os=
+                               ;;
+                       altos | altos3068)
+                               basic_machine=m68k-altos
+                               basic_os=
+                               ;;
+                       am29k)
+                               basic_machine=a29k-none
+                               basic_os=bsd
+                               ;;
+                       amdahl)
+                               basic_machine=580-amdahl
+                               basic_os=sysv
+                               ;;
+                       amiga)
+                               basic_machine=m68k-unknown
+                               basic_os=
+                               ;;
+                       amigaos | amigados)
+                               basic_machine=m68k-unknown
+                               basic_os=amigaos
+                               ;;
+                       amigaunix | amix)
+                               basic_machine=m68k-unknown
+                               basic_os=sysv4
+                               ;;
+                       apollo68)
+                               basic_machine=m68k-apollo
+                               basic_os=sysv
+                               ;;
+                       apollo68bsd)
+                               basic_machine=m68k-apollo
+                               basic_os=bsd
+                               ;;
+                       aros)
+                               basic_machine=i386-pc
+                               basic_os=aros
+                               ;;
+                       aux)
+                               basic_machine=m68k-apple
+                               basic_os=aux
+                               ;;
+                       balance)
+                               basic_machine=ns32k-sequent
+                               basic_os=dynix
+                               ;;
+                       blackfin)
+                               basic_machine=bfin-unknown
+                               basic_os=linux
+                               ;;
+                       cegcc)
+                               basic_machine=arm-unknown
+                               basic_os=cegcc
+                               ;;
+                       convex-c1)
+                               basic_machine=c1-convex
+                               basic_os=bsd
+                               ;;
+                       convex-c2)
+                               basic_machine=c2-convex
+                               basic_os=bsd
+                               ;;
+                       convex-c32)
+                               basic_machine=c32-convex
+                               basic_os=bsd
+                               ;;
+                       convex-c34)
+                               basic_machine=c34-convex
+                               basic_os=bsd
+                               ;;
+                       convex-c38)
+                               basic_machine=c38-convex
+                               basic_os=bsd
+                               ;;
+                       cray)
+                               basic_machine=j90-cray
+                               basic_os=unicos
+                               ;;
+                       crds | unos)
+                               basic_machine=m68k-crds
+                               basic_os=
+                               ;;
+                       da30)
+                               basic_machine=m68k-da30
+                               basic_os=
+                               ;;
+                       decstation | pmax | pmin | dec3100 | decstatn)
+                               basic_machine=mips-dec
+                               basic_os=
+                               ;;
+                       delta88)
+                               basic_machine=m88k-motorola
+                               basic_os=sysv3
+                               ;;
+                       dicos)
+                               basic_machine=i686-pc
+                               basic_os=dicos
+                               ;;
+                       djgpp)
+                               basic_machine=i586-pc
+                               basic_os=msdosdjgpp
+                               ;;
+                       ebmon29k)
+                               basic_machine=a29k-amd
+                               basic_os=ebmon
+                               ;;
+                       es1800 | OSE68k | ose68k | ose | OSE)
+                               basic_machine=m68k-ericsson
+                               basic_os=ose
+                               ;;
+                       gmicro)
+                               basic_machine=tron-gmicro
+                               basic_os=sysv
+                               ;;
+                       go32)
+                               basic_machine=i386-pc
+                               basic_os=go32
+                               ;;
+                       h8300hms)
+                               basic_machine=h8300-hitachi
+                               basic_os=hms
+                               ;;
+                       h8300xray)
+                               basic_machine=h8300-hitachi
+                               basic_os=xray
+                               ;;
+                       h8500hms)
+                               basic_machine=h8500-hitachi
+                               basic_os=hms
+                               ;;
+                       harris)
+                               basic_machine=m88k-harris
+                               basic_os=sysv3
+                               ;;
+                       hp300 | hp300hpux)
+                               basic_machine=m68k-hp
+                               basic_os=hpux
+                               ;;
+                       hp300bsd)
+                               basic_machine=m68k-hp
+                               basic_os=bsd
+                               ;;
+                       hppaosf)
+                               basic_machine=hppa1.1-hp
+                               basic_os=osf
+                               ;;
+                       hppro)
+                               basic_machine=hppa1.1-hp
+                               basic_os=proelf
+                               ;;
+                       i386mach)
+                               basic_machine=i386-mach
+                               basic_os=mach
+                               ;;
+                       isi68 | isi)
+                               basic_machine=m68k-isi
+                               basic_os=sysv
+                               ;;
+                       m68knommu)
+                               basic_machine=m68k-unknown
+                               basic_os=linux
+                               ;;
+                       magnum | m3230)
+                               basic_machine=mips-mips
+                               basic_os=sysv
+                               ;;
+                       merlin)
+                               basic_machine=ns32k-utek
+                               basic_os=sysv
+                               ;;
+                       mingw64)
+                               basic_machine=x86_64-pc
+                               basic_os=mingw64
+                               ;;
+                       mingw32)
+                               basic_machine=i686-pc
+                               basic_os=mingw32
+                               ;;
+                       mingw32ce)
+                               basic_machine=arm-unknown
+                               basic_os=mingw32ce
+                               ;;
+                       monitor)
+                               basic_machine=m68k-rom68k
+                               basic_os=coff
+                               ;;
+                       morphos)
+                               basic_machine=powerpc-unknown
+                               basic_os=morphos
+                               ;;
+                       moxiebox)
+                               basic_machine=moxie-unknown
+                               basic_os=moxiebox
+                               ;;
+                       msdos)
+                               basic_machine=i386-pc
+                               basic_os=msdos
+                               ;;
+                       msys)
+                               basic_machine=i686-pc
+                               basic_os=msys
+                               ;;
+                       mvs)
+                               basic_machine=i370-ibm
+                               basic_os=mvs
+                               ;;
+                       nacl)
+                               basic_machine=le32-unknown
+                               basic_os=nacl
+                               ;;
+                       ncr3000)
+                               basic_machine=i486-ncr
+                               basic_os=sysv4
+                               ;;
+                       netbsd386)
+                               basic_machine=i386-pc
+                               basic_os=netbsd
+                               ;;
+                       netwinder)
+                               basic_machine=armv4l-rebel
+                               basic_os=linux
+                               ;;
+                       news | news700 | news800 | news900)
+                               basic_machine=m68k-sony
+                               basic_os=newsos
+                               ;;
+                       news1000)
+                               basic_machine=m68030-sony
+                               basic_os=newsos
+                               ;;
+                       necv70)
+                               basic_machine=v70-nec
+                               basic_os=sysv
+                               ;;
+                       nh3000)
+                               basic_machine=m68k-harris
+                               basic_os=cxux
+                               ;;
+                       nh[45]000)
+                               basic_machine=m88k-harris
+                               basic_os=cxux
+                               ;;
+                       nindy960)
+                               basic_machine=i960-intel
+                               basic_os=nindy
+                               ;;
+                       mon960)
+                               basic_machine=i960-intel
+                               basic_os=mon960
+                               ;;
+                       nonstopux)
+                               basic_machine=mips-compaq
+                               basic_os=nonstopux
+                               ;;
+                       os400)
+                               basic_machine=powerpc-ibm
+                               basic_os=os400
+                               ;;
+                       OSE68000 | ose68000)
+                               basic_machine=m68000-ericsson
+                               basic_os=ose
+                               ;;
+                       os68k)
+                               basic_machine=m68k-none
+                               basic_os=os68k
+                               ;;
+                       paragon)
+                               basic_machine=i860-intel
+                               basic_os=osf
+                               ;;
+                       parisc)
+                               basic_machine=hppa-unknown
+                               basic_os=linux
+                               ;;
+                       psp)
+                               basic_machine=mipsallegrexel-sony
+                               basic_os=psp
+                               ;;
+                       pw32)
+                               basic_machine=i586-unknown
+                               basic_os=pw32
+                               ;;
+                       rdos | rdos64)
+                               basic_machine=x86_64-pc
+                               basic_os=rdos
+                               ;;
+                       rdos32)
+                               basic_machine=i386-pc
+                               basic_os=rdos
+                               ;;
+                       rom68k)
+                               basic_machine=m68k-rom68k
+                               basic_os=coff
+                               ;;
+                       sa29200)
+                               basic_machine=a29k-amd
+                               basic_os=udi
+                               ;;
+                       sei)
+                               basic_machine=mips-sei
+                               basic_os=seiux
+                               ;;
+                       sequent)
+                               basic_machine=i386-sequent
+                               basic_os=
+                               ;;
+                       sps7)
+                               basic_machine=m68k-bull
+                               basic_os=sysv2
+                               ;;
+                       st2000)
+                               basic_machine=m68k-tandem
+                               basic_os=
+                               ;;
+                       stratus)
+                               basic_machine=i860-stratus
+                               basic_os=sysv4
+                               ;;
+                       sun2)
+                               basic_machine=m68000-sun
+                               basic_os=
+                               ;;
+                       sun2os3)
+                               basic_machine=m68000-sun
+                               basic_os=sunos3
+                               ;;
+                       sun2os4)
+                               basic_machine=m68000-sun
+                               basic_os=sunos4
+                               ;;
+                       sun3)
+                               basic_machine=m68k-sun
+                               basic_os=
+                               ;;
+                       sun3os3)
+                               basic_machine=m68k-sun
+                               basic_os=sunos3
+                               ;;
+                       sun3os4)
+                               basic_machine=m68k-sun
+                               basic_os=sunos4
+                               ;;
+                       sun4)
+                               basic_machine=sparc-sun
+                               basic_os=
+                               ;;
+                       sun4os3)
+                               basic_machine=sparc-sun
+                               basic_os=sunos3
+                               ;;
+                       sun4os4)
+                               basic_machine=sparc-sun
+                               basic_os=sunos4
+                               ;;
+                       sun4sol2)
+                               basic_machine=sparc-sun
+                               basic_os=solaris2
+                               ;;
+                       sun386 | sun386i | roadrunner)
+                               basic_machine=i386-sun
+                               basic_os=
+                               ;;
+                       sv1)
+                               basic_machine=sv1-cray
+                               basic_os=unicos
+                               ;;
+                       symmetry)
+                               basic_machine=i386-sequent
+                               basic_os=dynix
+                               ;;
+                       t3e)
+                               basic_machine=alphaev5-cray
+                               basic_os=unicos
+                               ;;
+                       t90)
+                               basic_machine=t90-cray
+                               basic_os=unicos
+                               ;;
+                       toad1)
+                               basic_machine=pdp10-xkl
+                               basic_os=tops20
+                               ;;
+                       tpf)
+                               basic_machine=s390x-ibm
+                               basic_os=tpf
+                               ;;
+                       udi29k)
+                               basic_machine=a29k-amd
+                               basic_os=udi
+                               ;;
+                       ultra3)
+                               basic_machine=a29k-nyu
+                               basic_os=sym1
+                               ;;
+                       v810 | necv810)
+                               basic_machine=v810-nec
+                               basic_os=none
+                               ;;
+                       vaxv)
+                               basic_machine=vax-dec
+                               basic_os=sysv
+                               ;;
+                       vms)
+                               basic_machine=vax-dec
+                               basic_os=vms
+                               ;;
+                       vsta)
+                               basic_machine=i386-pc
+                               basic_os=vsta
+                               ;;
+                       vxworks960)
+                               basic_machine=i960-wrs
+                               basic_os=vxworks
+                               ;;
+                       vxworks68)
+                               basic_machine=m68k-wrs
+                               basic_os=vxworks
+                               ;;
+                       vxworks29k)
+                               basic_machine=a29k-wrs
+                               basic_os=vxworks
+                               ;;
+                       xbox)
+                               basic_machine=i686-pc
+                               basic_os=mingw32
+                               ;;
+                       ymp)
+                               basic_machine=ymp-cray
+                               basic_os=unicos
+                               ;;
+                       *)
+                               basic_machine=$1
+                               basic_os=
+                               ;;
+               esac
                ;;
 esac
 
-# Decode aliases for certain CPU-COMPANY combinations.
+# Decode 1-component or ad-hoc basic machines
 case $basic_machine in
-       # Recognize the basic CPU types without company name.
-       # 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 \
-        | be32 | be64 \
-       | bfin \
-       | c4x | clipper \
-       | d10v | d30v | dlx | dsp16xx \
-       | epiphany \
-       | fido | fr30 | frv \
-       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-       | hexagon \
-       | i370 | i860 | i960 | ia64 \
-       | ip2k | iq2000 \
-       | le32 | le64 \
-       | lm32 \
-       | m32c | m32r | m32rle | m68000 | m68k | m88k \
-       | maxq | mb | microblaze | mcore | mep | metag \
-       | mips | mipsbe | mipseb | mipsel | mipsle \
-       | mips16 \
-       | mips64 | mips64el \
-       | mips64octeon | mips64octeonel \
-       | mips64orion | mips64orionel \
-       | mips64r5900 | mips64r5900el \
-       | mips64vr | mips64vrel \
-       | mips64vr4100 | mips64vr4100el \
-       | mips64vr4300 | mips64vr4300el \
-       | mips64vr5000 | mips64vr5000el \
-       | mips64vr5900 | mips64vr5900el \
-       | mipsisa32 | mipsisa32el \
-       | mipsisa32r2 | mipsisa32r2el \
-       | mipsisa64 | mipsisa64el \
-       | mipsisa64r2 | mipsisa64r2el \
-       | mipsisa64sb1 | mipsisa64sb1el \
-       | mipsisa64sr71k | mipsisa64sr71kel \
-       | mipstx39 | mipstx39el \
-       | mn10200 | mn10300 \
-       | moxie \
-       | mt \
-       | msp430 \
-       | nds32 | nds32le | nds32be \
-       | nios | nios2 \
-       | ns16k | ns32k \
-       | open8 \
-       | or32 \
-       | pdp10 | pdp11 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle \
-       | pyramid \
-       | 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 \
-       | sh64 | sh64le \
-       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
-       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-       | spu \
-       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
-       | ubicom32 \
-       | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
-       | we32k \
-       | x86 | xc16x | xstormy16 | xtensa \
-       | z8k | z80)
-               basic_machine=$basic_machine-unknown
-               ;;
-       c54x)
-               basic_machine=tic54x-unknown
-               ;;
-       c55x)
-               basic_machine=tic55x-unknown
-               ;;
-       c6x)
-               basic_machine=tic6x-unknown
-               ;;
-       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
-               basic_machine=$basic_machine-unknown
-               os=-none
-               ;;
-       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-               ;;
-       ms1)
-               basic_machine=mt-unknown
+       # Here we handle the default manufacturer of certain CPU types.  It is in
+       # some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               cpu=hppa1.1
+               vendor=winbond
                ;;
-
-       strongarm | thumb | xscale)
-               basic_machine=arm-unknown
+       op50n)
+               cpu=hppa1.1
+               vendor=oki
                ;;
-       xgate)
-               basic_machine=$basic_machine-unknown
-               os=-none
+       op60c)
+               cpu=hppa1.1
+               vendor=oki
                ;;
-       xscaleeb)
-               basic_machine=armeb-unknown
+       ibm*)
+               cpu=i370
+               vendor=ibm
                ;;
-
-       xscaleel)
-               basic_machine=armel-unknown
+       orion105)
+               cpu=clipper
+               vendor=highlevel
                ;;
-
-       # We use `pc' rather than `unknown'
-       # because (1) that's what they normally are, and
-       # (2) the word "unknown" tends to confuse beginning users.
-       i*86 | x86_64)
-         basic_machine=$basic_machine-pc
-         ;;
-       # Object if more than one company name word.
-       *-*-*)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
+       mac | mpw | mac-mpw)
+               cpu=m68k
+               vendor=apple
                ;;
-       # 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-* \
-       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-       | avr-* | avr32-* \
-       | be32-* | be64-* \
-       | bfin-* | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c4x-* \
-       | clipper-* | craynv-* | cydra-* \
-       | d10v-* | d30v-* | dlx-* \
-       | 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-* \
-       | le32-* | le64-* \
-       | lm32-* \
-       | m32c-* | m32r-* | m32rle-* \
-       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
-       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-       | mips16-* \
-       | mips64-* | mips64el-* \
-       | mips64octeon-* | mips64octeonel-* \
-       | mips64orion-* | mips64orionel-* \
-       | mips64r5900-* | mips64r5900el-* \
-       | mips64vr-* | mips64vrel-* \
-       | mips64vr4100-* | mips64vr4100el-* \
-       | mips64vr4300-* | mips64vr4300el-* \
-       | mips64vr5000-* | mips64vr5000el-* \
-       | mips64vr5900-* | mips64vr5900el-* \
-       | mipsisa32-* | mipsisa32el-* \
-       | mipsisa32r2-* | mipsisa32r2el-* \
-       | mipsisa64-* | mipsisa64el-* \
-       | mipsisa64r2-* | mipsisa64r2el-* \
-       | mipsisa64sb1-* | mipsisa64sb1el-* \
-       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
-       | mipstx39-* | mipstx39el-* \
-       | mmix-* \
-       | mt-* \
-       | msp430-* \
-       | nds32-* | nds32le-* | nds32be-* \
-       | nios-* | nios2-* \
-       | none-* | np1-* | ns16k-* | ns32k-* \
-       | open8-* \
-       | orion-* \
-       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
-       | pyramid-* \
-       | 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-* | sv1-* | sx?-* \
-       | tahoe-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-       | tile*-* \
-       | tron-* \
-       | ubicom32-* \
-       | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
-       | vax-* \
-       | we32k-* \
-       | x86-* | x86_64-* | xc16x-* | xps100-* \
-       | xstormy16-* | xtensa*-* \
-       | ymp-* \
-       | z8k-* | z80-*)
-               ;;
-       # Recognize the basic CPU types without company name, with glob match.
-       xtensa*)
-               basic_machine=$basic_machine-unknown
+       pmac | pmac-mpw)
+               cpu=powerpc
+               vendor=apple
                ;;
+
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
-       386bsd)
-               basic_machine=i386-unknown
-               os=-bsd
-               ;;
        3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-               basic_machine=m68000-att
+               cpu=m68000
+               vendor=att
                ;;
        3b*)
-               basic_machine=we32k-att
-               ;;
-       a29khif)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       abacus)
-               basic_machine=abacus-unknown
-               ;;
-       adobe68k)
-               basic_machine=m68010-adobe
-               os=-scout
-               ;;
-       alliant | fx80)
-               basic_machine=fx80-alliant
-               ;;
-       altos | altos3068)
-               basic_machine=m68k-altos
-               ;;
-       am29k)
-               basic_machine=a29k-none
-               os=-bsd
-               ;;
-       amd64)
-               basic_machine=x86_64-pc
-               ;;
-       amd64-*)
-               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       amdahl)
-               basic_machine=580-amdahl
-               os=-sysv
-               ;;
-       amiga | amiga-*)
-               basic_machine=m68k-unknown
-               ;;
-       amigaos | amigados)
-               basic_machine=m68k-unknown
-               os=-amigaos
-               ;;
-       amigaunix | amix)
-               basic_machine=m68k-unknown
-               os=-sysv4
-               ;;
-       apollo68)
-               basic_machine=m68k-apollo
-               os=-sysv
-               ;;
-       apollo68bsd)
-               basic_machine=m68k-apollo
-               os=-bsd
-               ;;
-       aros)
-               basic_machine=i386-pc
-               os=-aros
-               ;;
-       aux)
-               basic_machine=m68k-apple
-               os=-aux
-               ;;
-       balance)
-               basic_machine=ns32k-sequent
-               os=-dynix
-               ;;
-       blackfin)
-               basic_machine=bfin-unknown
-               os=-linux
-               ;;
-       blackfin-*)
-               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
-               os=-linux
+               cpu=we32k
+               vendor=att
                ;;
        bluegene*)
-               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)
-               basic_machine=arm-unknown
-               os=-cegcc
-               ;;
-       convex-c1)
-               basic_machine=c1-convex
-               os=-bsd
-               ;;
-       convex-c2)
-               basic_machine=c2-convex
-               os=-bsd
-               ;;
-       convex-c32)
-               basic_machine=c32-convex
-               os=-bsd
-               ;;
-       convex-c34)
-               basic_machine=c34-convex
-               os=-bsd
-               ;;
-       convex-c38)
-               basic_machine=c38-convex
-               os=-bsd
-               ;;
-       cray | j90)
-               basic_machine=j90-cray
-               os=-unicos
-               ;;
-       craynv)
-               basic_machine=craynv-cray
-               os=-unicosmp
-               ;;
-       cr16 | cr16-*)
-               basic_machine=cr16-unknown
-               os=-elf
-               ;;
-       crds | unos)
-               basic_machine=m68k-crds
-               ;;
-       crisv32 | crisv32-* | etraxfs*)
-               basic_machine=crisv32-axis
-               ;;
-       cris | cris-* | etrax*)
-               basic_machine=cris-axis
-               ;;
-       crx)
-               basic_machine=crx-unknown
-               os=-elf
-               ;;
-       da30 | da30-*)
-               basic_machine=m68k-da30
-               ;;
-       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-               basic_machine=mips-dec
+               cpu=powerpc
+               vendor=ibm
+               basic_os=cnk
                ;;
        decsystem10* | dec10*)
-               basic_machine=pdp10-dec
-               os=-tops10
+               cpu=pdp10
+               vendor=dec
+               basic_os=tops10
                ;;
        decsystem20* | dec20*)
-               basic_machine=pdp10-dec
-               os=-tops20
+               cpu=pdp10
+               vendor=dec
+               basic_os=tops20
                ;;
        delta | 3300 | motorola-3300 | motorola-delta \
              | 3300-motorola | delta-motorola)
-               basic_machine=m68k-motorola
-               ;;
-       delta88)
-               basic_machine=m88k-motorola
-               os=-sysv3
-               ;;
-       dicos)
-               basic_machine=i686-pc
-               os=-dicos
+               cpu=m68k
+               vendor=motorola
                ;;
-       djgpp)
-               basic_machine=i586-pc
-               os=-msdosdjgpp
-               ;;
-       dpx20 | dpx20-*)
-               basic_machine=rs6000-bull
-               os=-bosx
-               ;;
-       dpx2* | dpx2*-bull)
-               basic_machine=m68k-bull
-               os=-sysv3
-               ;;
-       ebmon29k)
-               basic_machine=a29k-amd
-               os=-ebmon
-               ;;
-       elxsi)
-               basic_machine=elxsi-elxsi
-               os=-bsd
+       dpx2*)
+               cpu=m68k
+               vendor=bull
+               basic_os=sysv3
                ;;
        encore | umax | mmax)
-               basic_machine=ns32k-encore
+               cpu=ns32k
+               vendor=encore
                ;;
-       es1800 | OSE68k | ose68k | ose | OSE)
-               basic_machine=m68k-ericsson
-               os=-ose
+       elxsi)
+               cpu=elxsi
+               vendor=elxsi
+               basic_os=${basic_os:-bsd}
                ;;
        fx2800)
-               basic_machine=i860-alliant
+               cpu=i860
+               vendor=alliant
                ;;
        genix)
-               basic_machine=ns32k-ns
-               ;;
-       gmicro)
-               basic_machine=tron-gmicro
-               os=-sysv
-               ;;
-       go32)
-               basic_machine=i386-pc
-               os=-go32
+               cpu=ns32k
+               vendor=ns
                ;;
        h3050r* | hiux*)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       h8300hms)
-               basic_machine=h8300-hitachi
-               os=-hms
-               ;;
-       h8300xray)
-               basic_machine=h8300-hitachi
-               os=-xray
-               ;;
-       h8500hms)
-               basic_machine=h8500-hitachi
-               os=-hms
-               ;;
-       harris)
-               basic_machine=m88k-harris
-               os=-sysv3
-               ;;
-       hp300-*)
-               basic_machine=m68k-hp
-               ;;
-       hp300bsd)
-               basic_machine=m68k-hp
-               os=-bsd
-               ;;
-       hp300hpux)
-               basic_machine=m68k-hp
-               os=-hpux
+               cpu=hppa1.1
+               vendor=hitachi
+               basic_os=hiuxwe2
                ;;
        hp3k9[0-9][0-9] | hp9[0-9][0-9])
-               basic_machine=hppa1.0-hp
+               cpu=hppa1.0
+               vendor=hp
                ;;
        hp9k2[0-9][0-9] | hp9k31[0-9])
-               basic_machine=m68000-hp
+               cpu=m68000
+               vendor=hp
                ;;
        hp9k3[2-9][0-9])
-               basic_machine=m68k-hp
+               cpu=m68k
+               vendor=hp
                ;;
        hp9k6[0-9][0-9] | hp6[0-9][0-9])
-               basic_machine=hppa1.0-hp
+               cpu=hppa1.0
+               vendor=hp
                ;;
        hp9k7[0-79][0-9] | hp7[0-79][0-9])
-               basic_machine=hppa1.1-hp
+               cpu=hppa1.1
+               vendor=hp
                ;;
        hp9k78[0-9] | hp78[0-9])
                # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
+               cpu=hppa1.1
+               vendor=hp
                ;;
        hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
                # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
+               cpu=hppa1.1
+               vendor=hp
                ;;
        hp9k8[0-9][13679] | hp8[0-9][13679])
-               basic_machine=hppa1.1-hp
+               cpu=hppa1.1
+               vendor=hp
                ;;
        hp9k8[0-9][0-9] | hp8[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hppa-next)
-               os=-nextstep3
-               ;;
-       hppaosf)
-               basic_machine=hppa1.1-hp
-               os=-osf
-               ;;
-       hppro)
-               basic_machine=hppa1.1-hp
-               os=-proelf
-               ;;
-       i370-ibm* | ibm*)
-               basic_machine=i370-ibm
+               cpu=hppa1.0
+               vendor=hp
                ;;
        i*86v32)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv32
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
+               vendor=pc
+               basic_os=sysv32
                ;;
        i*86v4*)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv4
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
+               vendor=pc
+               basic_os=sysv4
                ;;
        i*86v)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
+               vendor=pc
+               basic_os=sysv
                ;;
        i*86sol2)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-solaris2
-               ;;
-       i386mach)
-               basic_machine=i386-mach
-               os=-mach
+               cpu=$(echo "$1" | sed -e 's/86.*/86/')
+               vendor=pc
+               basic_os=solaris2
                ;;
-       i386-vsta | vsta)
-               basic_machine=i386-unknown
-               os=-vsta
+       j90 | j90-cray)
+               cpu=j90
+               vendor=cray
+               basic_os=${basic_os:-unicos}
                ;;
        iris | iris4d)
-               basic_machine=mips-sgi
-               case $os in
-                   -irix*)
+               cpu=mips
+               vendor=sgi
+               case $basic_os in
+                   irix*)
                        ;;
                    *)
-                       os=-irix4
+                       basic_os=irix4
                        ;;
                esac
                ;;
-       isi68 | isi)
-               basic_machine=m68k-isi
-               os=-sysv
-               ;;
-       m68knommu)
-               basic_machine=m68k-unknown
-               os=-linux
-               ;;
-       m68knommu-*)
-               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
-               os=-linux
-               ;;
-       m88k-omron*)
-               basic_machine=m88k-omron
-               ;;
-       magnum | m3230)
-               basic_machine=mips-mips
-               os=-sysv
-               ;;
-       merlin)
-               basic_machine=ns32k-utek
-               os=-sysv
-               ;;
-       microblaze)
-               basic_machine=microblaze-xilinx
-               ;;
-       mingw32)
-               basic_machine=i386-pc
-               os=-mingw32
-               ;;
-       mingw32ce)
-               basic_machine=arm-unknown
-               os=-mingw32ce
-               ;;
        miniframe)
-               basic_machine=m68000-convergent
-               ;;
-       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
-               ;;
-       mips3*-*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               cpu=m68000
+               vendor=convergent
                ;;
-       mips3*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-               ;;
-       monitor)
-               basic_machine=m68k-rom68k
-               os=-coff
-               ;;
-       morphos)
-               basic_machine=powerpc-unknown
-               os=-morphos
-               ;;
-       msdos)
-               basic_machine=i386-pc
-               os=-msdos
-               ;;
-       ms1-*)
-               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
-               ;;
-       msys)
-               basic_machine=i386-pc
-               os=-msys
-               ;;
-       mvs)
-               basic_machine=i370-ibm
-               os=-mvs
-               ;;
-       nacl)
-               basic_machine=le32-unknown
-               os=-nacl
-               ;;
-       ncr3000)
-               basic_machine=i486-ncr
-               os=-sysv4
-               ;;
-       netbsd386)
-               basic_machine=i386-unknown
-               os=-netbsd
-               ;;
-       netwinder)
-               basic_machine=armv4l-rebel
-               os=-linux
-               ;;
-       news | news700 | news800 | news900)
-               basic_machine=m68k-sony
-               os=-newsos
-               ;;
-       news1000)
-               basic_machine=m68030-sony
-               os=-newsos
+       *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               cpu=m68k
+               vendor=atari
+               basic_os=mint
                ;;
        news-3600 | risc-news)
-               basic_machine=mips-sony
-               os=-newsos
-               ;;
-       necv70)
-               basic_machine=v70-nec
-               os=-sysv
-               ;;
-       next | m*-next )
-               basic_machine=m68k-next
-               case $os in
-                   -nextstep* )
+               cpu=mips
+               vendor=sony
+               basic_os=newsos
+               ;;
+       next | m*-next)
+               cpu=m68k
+               vendor=next
+               case $basic_os in
+                   openstep*)
+                       ;;
+                   nextstep*)
                        ;;
-                   -ns2*)
-                     os=-nextstep2
+                   ns2*)
+                     basic_os=nextstep2
                        ;;
                    *)
-                     os=-nextstep3
+                     basic_os=nextstep3
                        ;;
                esac
                ;;
-       nh3000)
-               basic_machine=m68k-harris
-               os=-cxux
-               ;;
-       nh[45]000)
-               basic_machine=m88k-harris
-               os=-cxux
-               ;;
-       nindy960)
-               basic_machine=i960-intel
-               os=-nindy
-               ;;
-       mon960)
-               basic_machine=i960-intel
-               os=-mon960
-               ;;
-       nonstopux)
-               basic_machine=mips-compaq
-               os=-nonstopux
-               ;;
        np1)
-               basic_machine=np1-gould
-               ;;
-       neo-tandem)
-               basic_machine=neo-tandem
-               ;;
-       nse-tandem)
-               basic_machine=nse-tandem
-               ;;
-       nsr-tandem)
-               basic_machine=nsr-tandem
+               cpu=np1
+               vendor=gould
                ;;
        op50n-* | op60c-*)
-               basic_machine=hppa1.1-oki
-               os=-proelf
-               ;;
-       openrisc | openrisc-*)
-               basic_machine=or32-unknown
-               ;;
-       os400)
-               basic_machine=powerpc-ibm
-               os=-os400
-               ;;
-       OSE68000 | ose68000)
-               basic_machine=m68000-ericsson
-               os=-ose
-               ;;
-       os68k)
-               basic_machine=m68k-none
-               os=-os68k
+               cpu=hppa1.1
+               vendor=oki
+               basic_os=proelf
                ;;
        pa-hitachi)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       paragon)
-               basic_machine=i860-intel
-               os=-osf
-               ;;
-       parisc)
-               basic_machine=hppa-unknown
-               os=-linux
-               ;;
-       parisc-*)
-               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
-               os=-linux
+               cpu=hppa1.1
+               vendor=hitachi
+               basic_os=hiuxwe2
                ;;
        pbd)
-               basic_machine=sparc-tti
+               cpu=sparc
+               vendor=tti
                ;;
        pbb)
-               basic_machine=m68k-tti
-               ;;
-       pc532 | pc532-*)
-               basic_machine=ns32k-pc532
-               ;;
-       pc98)
-               basic_machine=i386-pc
-               ;;
-       pc98-*)
-               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentium | p5 | k5 | k6 | nexgen | viac3)
-               basic_machine=i586-pc
-               ;;
-       pentiumpro | p6 | 6x86 | athlon | athlon_*)
-               basic_machine=i686-pc
+               cpu=m68k
+               vendor=tti
                ;;
-       pentiumii | pentium2 | pentiumiii | pentium3)
-               basic_machine=i686-pc
-               ;;
-       pentium4)
-               basic_machine=i786-pc
-               ;;
-       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumpro-* | p6-* | 6x86-* | athlon-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentium4-*)
-               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+       pc532)
+               cpu=ns32k
+               vendor=pc532
                ;;
        pn)
-               basic_machine=pn-gould
-               ;;
-       power)  basic_machine=power-ibm
+               cpu=pn
+               vendor=gould
                ;;
-       ppc | ppcbe)    basic_machine=powerpc-unknown
-               ;;
-       ppc-* | ppcbe-*)
-               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
-               basic_machine=powerpcle-unknown
-               ;;
-       ppcle-* | powerpclittle-*)
-               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64)  basic_machine=powerpc64-unknown
-               ;;
-       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-               basic_machine=powerpc64le-unknown
-               ;;
-       ppc64le-* | powerpc64little-*)
-               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+       power)
+               cpu=power
+               vendor=ibm
                ;;
        ps2)
-               basic_machine=i386-ibm
-               ;;
-       pw32)
-               basic_machine=i586-unknown
-               os=-pw32
-               ;;
-       rdos)
-               basic_machine=i386-pc
-               os=-rdos
-               ;;
-       rom68k)
-               basic_machine=m68k-rom68k
-               os=-coff
+               cpu=i386
+               vendor=ibm
                ;;
        rm[46]00)
-               basic_machine=mips-siemens
+               cpu=mips
+               vendor=siemens
                ;;
        rtpc | rtpc-*)
-               basic_machine=romp-ibm
-               ;;
-       s390 | s390-*)
-               basic_machine=s390-ibm
-               ;;
-       s390x | s390x-*)
-               basic_machine=s390x-ibm
-               ;;
-       sa29200)
-               basic_machine=a29k-amd
-               os=-udi
+               cpu=romp
+               vendor=ibm
                ;;
-       sb1)
-               basic_machine=mipsisa64sb1-unknown
+       sde)
+               cpu=mipsisa32
+               vendor=sde
+               basic_os=${basic_os:-elf}
                ;;
-       sb1el)
-               basic_machine=mipsisa64sb1el-unknown
+       simso-wrs)
+               cpu=sparclite
+               vendor=wrs
+               basic_os=vxworks
                ;;
-       sde)
-               basic_machine=mipsisa32-sde
-               os=-elf
+       tower | tower-32)
+               cpu=m68k
+               vendor=ncr
                ;;
-       sei)
-               basic_machine=mips-sei
-               os=-seiux
+       vpp*|vx|vx-*)
+               cpu=f301
+               vendor=fujitsu
                ;;
-       sequent)
-               basic_machine=i386-sequent
+       w65)
+               cpu=w65
+               vendor=wdc
                ;;
-       sh)
-               basic_machine=sh-hitachi
-               os=-hms
+       w89k-*)
+               cpu=hppa1.1
+               vendor=winbond
+               basic_os=proelf
                ;;
-       sh5el)
-               basic_machine=sh5le-unknown
+       none)
+               cpu=none
+               vendor=none
                ;;
-       sh64)
-               basic_machine=sh64-unknown
+       leon|leon[3-9])
+               cpu=sparc
+               vendor=$basic_machine
                ;;
-       sparclite-wrs | simso-wrs)
-               basic_machine=sparclite-wrs
-               os=-vxworks
+       leon-*|leon[3-9]-*)
+               cpu=sparc
+               vendor=$(echo "$basic_machine" | sed 's/-.*//')
                ;;
-       sps7)
-               basic_machine=m68k-bull
-               os=-sysv2
+
+       *-*)
+               # shellcheck disable=SC2162
+               IFS="-" read cpu vendor <<EOF
+$basic_machine
+EOF
                ;;
-       spur)
-               basic_machine=spur-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.
+       i*86 | x86_64)
+               cpu=$basic_machine
+               vendor=pc
                ;;
-       st2000)
-               basic_machine=m68k-tandem
+       # These rules are duplicated from below for sake of the special case above;
+       # i.e. things that normalized to x86 arches should also default to "pc"
+       pc98)
+               cpu=i386
+               vendor=pc
                ;;
-       stratus)
-               basic_machine=i860-stratus
-               os=-sysv4
+       x64 | amd64)
+               cpu=x86_64
+               vendor=pc
                ;;
-       strongarm-* | thumb-*)
-               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+       # Recognize the basic CPU types without company name.
+       *)
+               cpu=$basic_machine
+               vendor=unknown
                ;;
-       sun2)
-               basic_machine=m68000-sun
+esac
+
+unset -v basic_machine
+
+# Decode basic machines in the full and proper CPU-Company form.
+case $cpu-$vendor in
+       # Here we handle the default manufacturer of certain CPU types in canonical form. It is in
+       # some cases the only manufacturer, in others, it is the most popular.
+       craynv-unknown)
+               vendor=cray
+               basic_os=${basic_os:-unicosmp}
                ;;
-       sun2os3)
-               basic_machine=m68000-sun
-               os=-sunos3
+       c90-unknown | c90-cray)
+               vendor=cray
+               basic_os=${Basic_os:-unicos}
                ;;
-       sun2os4)
-               basic_machine=m68000-sun
-               os=-sunos4
+       fx80-unknown)
+               vendor=alliant
                ;;
-       sun3os3)
-               basic_machine=m68k-sun
-               os=-sunos3
+       romp-unknown)
+               vendor=ibm
                ;;
-       sun3os4)
-               basic_machine=m68k-sun
-               os=-sunos4
+       mmix-unknown)
+               vendor=knuth
                ;;
-       sun4os3)
-               basic_machine=sparc-sun
-               os=-sunos3
+       microblaze-unknown | microblazeel-unknown)
+               vendor=xilinx
                ;;
-       sun4os4)
-               basic_machine=sparc-sun
-               os=-sunos4
+       rs6000-unknown)
+               vendor=ibm
                ;;
-       sun4sol2)
-               basic_machine=sparc-sun
-               os=-solaris2
+       vax-unknown)
+               vendor=dec
                ;;
-       sun3 | sun3-*)
-               basic_machine=m68k-sun
+       pdp11-unknown)
+               vendor=dec
                ;;
-       sun4)
-               basic_machine=sparc-sun
+       we32k-unknown)
+               vendor=att
                ;;
-       sun386 | sun386i | roadrunner)
-               basic_machine=i386-sun
+       cydra-unknown)
+               vendor=cydrome
                ;;
-       sv1)
-               basic_machine=sv1-cray
-               os=-unicos
+       i370-ibm*)
+               vendor=ibm
                ;;
-       symmetry)
-               basic_machine=i386-sequent
-               os=-dynix
+       orion-unknown)
+               vendor=highlevel
                ;;
-       t3e)
-               basic_machine=alphaev5-cray
-               os=-unicos
+       xps-unknown | xps100-unknown)
+               cpu=xps100
+               vendor=honeywell
                ;;
-       t90)
-               basic_machine=t90-cray
-               os=-unicos
+
+       # Here we normalize CPU types with a missing or matching vendor
+       dpx20-unknown | dpx20-bull)
+               cpu=rs6000
+               vendor=bull
+               basic_os=${basic_os:-bosx}
                ;;
-       tile*)
-               basic_machine=$basic_machine-unknown
-               os=-linux-gnu
+
+       # Here we normalize CPU types irrespective of the vendor
+       amd64-*)
+               cpu=x86_64
                ;;
-       tx39)
-               basic_machine=mipstx39-unknown
+       blackfin-*)
+               cpu=bfin
+               basic_os=linux
                ;;
-       tx39el)
-               basic_machine=mipstx39el-unknown
+       c54x-*)
+               cpu=tic54x
                ;;
-       toad1)
-               basic_machine=pdp10-xkl
-               os=-tops20
+       c55x-*)
+               cpu=tic55x
                ;;
-       tower | tower-32)
-               basic_machine=m68k-ncr
+       c6x-*)
+               cpu=tic6x
                ;;
-       tpf)
-               basic_machine=s390x-ibm
-               os=-tpf
+       e500v[12]-*)
+               cpu=powerpc
+               basic_os=${basic_os}"spe"
                ;;
-       udi29k)
-               basic_machine=a29k-amd
-               os=-udi
+       mips3*-*)
+               cpu=mips64
                ;;
-       ultra3)
-               basic_machine=a29k-nyu
-               os=-sym1
+       ms1-*)
+               cpu=mt
                ;;
-       v810 | necv810)
-               basic_machine=v810-nec
-               os=-none
+       m68knommu-*)
+               cpu=m68k
+               basic_os=linux
                ;;
-       vaxv)
-               basic_machine=vax-dec
-               os=-sysv
+       m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+               cpu=s12z
                ;;
-       vms)
-               basic_machine=vax-dec
-               os=-vms
+       openrisc-*)
+               cpu=or32
                ;;
-       vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
+       parisc-*)
+               cpu=hppa
+               basic_os=linux
                ;;
-       vxworks960)
-               basic_machine=i960-wrs
-               os=-vxworks
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               cpu=i586
                ;;
-       vxworks68)
-               basic_machine=m68k-wrs
-               os=-vxworks
+       pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
+               cpu=i686
                ;;
-       vxworks29k)
-               basic_machine=a29k-wrs
-               os=-vxworks
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               cpu=i686
                ;;
-       w65*)
-               basic_machine=w65-wdc
-               os=-none
+       pentium4-*)
+               cpu=i786
                ;;
-       w89k-*)
-               basic_machine=hppa1.1-winbond
-               os=-proelf
+       pc98-*)
+               cpu=i386
                ;;
-       xbox)
-               basic_machine=i686-pc
-               os=-mingw32
+       ppc-* | ppcbe-*)
+               cpu=powerpc
                ;;
-       xps | xps100)
-               basic_machine=xps100-honeywell
+       ppcle-* | powerpclittle-*)
+               cpu=powerpcle
                ;;
-       xscale-* | xscalee[bl]-*)
-               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+       ppc64-*)
+               cpu=powerpc64
                ;;
-       ymp)
-               basic_machine=ymp-cray
-               os=-unicos
+       ppc64le-* | powerpc64little-*)
+               cpu=powerpc64le
                ;;
-       z8k-*-coff)
-               basic_machine=z8k-unknown
-               os=-sim
+       sb1-*)
+               cpu=mipsisa64sb1
                ;;
-       z80-*-coff)
-               basic_machine=z80-unknown
-               os=-sim
+       sb1el-*)
+               cpu=mipsisa64sb1el
                ;;
-       none)
-               basic_machine=none-none
-               os=-none
+       sh5e[lb]-*)
+               cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/')
                ;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-       w89k)
-               basic_machine=hppa1.1-winbond
+       spur-*)
+               cpu=spur
                ;;
-       op50n)
-               basic_machine=hppa1.1-oki
+       strongarm-* | thumb-*)
+               cpu=arm
                ;;
-       op60c)
-               basic_machine=hppa1.1-oki
+       tx39-*)
+               cpu=mipstx39
                ;;
-       romp)
-               basic_machine=romp-ibm
+       tx39el-*)
+               cpu=mipstx39el
                ;;
-       mmix)
-               basic_machine=mmix-knuth
+       x64-*)
+               cpu=x86_64
                ;;
-       rs6000)
-               basic_machine=rs6000-ibm
+       xscale-* | xscalee[bl]-*)
+               cpu=$(echo "$cpu" | sed 's/^xscale/arm/')
                ;;
-       vax)
-               basic_machine=vax-dec
+       arm64-*)
+               cpu=aarch64
                ;;
-       pdp10)
-               # there are many clones, so DEC is not a safe bet
-               basic_machine=pdp10-unknown
+
+       # Recognize the canonical CPU Types that limit and/or modify the
+       # company names they are paired with.
+       cr16-*)
+               basic_os=${basic_os:-elf}
                ;;
-       pdp11)
-               basic_machine=pdp11-dec
+       crisv32-* | etraxfs*-*)
+               cpu=crisv32
+               vendor=axis
                ;;
-       we32k)
-               basic_machine=we32k-att
+       cris-* | etrax*-*)
+               cpu=cris
+               vendor=axis
                ;;
-       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
-               basic_machine=sh-unknown
+       crx-*)
+               basic_os=${basic_os:-elf}
                ;;
-       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
-               basic_machine=sparc-sun
+       neo-tandem)
+               cpu=neo
+               vendor=tandem
                ;;
-       cydra)
-               basic_machine=cydra-cydrome
+       nse-tandem)
+               cpu=nse
+               vendor=tandem
                ;;
-       orion)
-               basic_machine=orion-highlevel
+       nsr-tandem)
+               cpu=nsr
+               vendor=tandem
                ;;
-       orion105)
-               basic_machine=clipper-highlevel
+       nsv-tandem)
+               cpu=nsv
+               vendor=tandem
                ;;
-       mac | mpw | mac-mpw)
-               basic_machine=m68k-apple
+       nsx-tandem)
+               cpu=nsx
+               vendor=tandem
                ;;
-       pmac | pmac-mpw)
-               basic_machine=powerpc-apple
+       mipsallegrexel-sony)
+               cpu=mipsallegrexel
+               vendor=sony
                ;;
-       *-unknown)
-               # Make sure to match an already-canonicalized machine name.
+       tile*-*)
+               basic_os=${basic_os:-linux-gnu}
                ;;
+
        *)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
+               # Recognize the canonical CPU types that are allowed with any
+               # company name.
+               case $cpu in
+                       1750a | 580 \
+                       | a29k \
+                       | aarch64 | aarch64_be \
+                       | abacus \
+                       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
+                       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
+                       | alphapca5[67] | alpha64pca5[67] \
+                       | am33_2.0 \
+                       | amdgcn \
+                       | arc | arceb \
+                       | arm | arm[lb]e | arme[lb] | armv* \
+                       | avr | avr32 \
+                       | asmjs \
+                       | ba \
+                       | be32 | be64 \
+                       | bfin | bpf | bs2000 \
+                       | c[123]* | c30 | [cjt]90 | c4x \
+                       | c8051 | clipper | craynv | csky | cydra \
+                       | d10v | d30v | dlx | dsp16xx \
+                       | e2k | elxsi | epiphany \
+                       | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
+                       | h8300 | h8500 \
+                       | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+                       | hexagon \
+                       | i370 | i*86 | i860 | i960 | ia16 | ia64 \
+                       | ip2k | iq2000 \
+                       | k1om \
+                       | le32 | le64 \
+                       | lm32 \
+                       | loongarch32 | loongarch64 | loongarchx32 \
+                       | m32c | m32r | m32rle \
+                       | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
+                       | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
+                       | m88110 | m88k | maxq | mb | mcore | mep | metag \
+                       | microblaze | microblazeel \
+                       | mips | mipsbe | mipseb | mipsel | mipsle \
+                       | mips16 \
+                       | mips64 | mips64eb | mips64el \
+                       | mips64octeon | mips64octeonel \
+                       | mips64orion | mips64orionel \
+                       | mips64r5900 | mips64r5900el \
+                       | mips64vr | mips64vrel \
+                       | mips64vr4100 | mips64vr4100el \
+                       | mips64vr4300 | mips64vr4300el \
+                       | mips64vr5000 | mips64vr5000el \
+                       | mips64vr5900 | mips64vr5900el \
+                       | mipsisa32 | mipsisa32el \
+                       | mipsisa32r2 | mipsisa32r2el \
+                       | mipsisa32r6 | mipsisa32r6el \
+                       | mipsisa64 | mipsisa64el \
+                       | mipsisa64r2 | mipsisa64r2el \
+                       | mipsisa64r6 | mipsisa64r6el \
+                       | mipsisa64sb1 | mipsisa64sb1el \
+                       | mipsisa64sr71k | mipsisa64sr71kel \
+                       | mipsr5900 | mipsr5900el \
+                       | mipstx39 | mipstx39el \
+                       | mmix \
+                       | mn10200 | mn10300 \
+                       | moxie \
+                       | mt \
+                       | msp430 \
+                       | nds32 | nds32le | nds32be \
+                       | nfp \
+                       | nios | nios2 | nios2eb | nios2el \
+                       | none | np1 | ns16k | ns32k | nvptx \
+                       | open8 \
+                       | or1k* \
+                       | or32 \
+                       | orion \
+                       | picochip \
+                       | pdp10 | pdp11 | pj | pjl | pn | power \
+                       | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
+                       | pru \
+                       | pyramid \
+                       | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
+                       | rl78 | romp | rs6000 | rx \
+                       | s390 | s390x \
+                       | score \
+                       | sh | shl \
+                       | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
+                       | sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
+                       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
+                       | sparclite \
+                       | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
+                       | spu \
+                       | tahoe \
+                       | thumbv7* \
+                       | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
+                       | tron \
+                       | ubicom32 \
+                       | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+                       | vax \
+                       | visium \
+                       | w65 \
+                       | wasm32 | wasm64 \
+                       | we32k \
+                       | x86 | x86_64 | xc16x | xgate | xps100 \
+                       | xstormy16 | xtensa* \
+                       | ymp \
+                       | z8k | z80)
+                               ;;
+
+                       *)
+                               echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
+                               exit 1
+                               ;;
+               esac
                ;;
 esac
 
 # Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-       *-digital*)
-               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+case $vendor in
+       digital*)
+               vendor=dec
                ;;
-       *-commodore*)
-               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+       commodore*)
+               vendor=cbm
                ;;
        *)
                ;;
@@ -1315,203 +1280,213 @@ esac
 
 # Decode manufacturer-specific aliases for certain operating systems.
 
-if [ x"$os" != x"" ]
+if test x$basic_os != x
 then
-case $os in
-       # 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
+
+# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+       gnu/linux*)
+               kernel=linux
+               os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|')
+               ;;
+       os2-emx)
+               kernel=os2
+               os=$(echo $basic_os | sed -e 's|os2-emx|emx|')
+               ;;
+       nto-qnx*)
+               kernel=nto
+               os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|')
+               ;;
+       *-*)
+               # shellcheck disable=SC2162
+               IFS="-" read kernel os <<EOF
+$basic_os
+EOF
+               ;;
+       # Default OS when just kernel was specified
+       nto*)
+               kernel=nto
+               os=$(echo $basic_os | sed -e 's|nto|qnx|')
+               ;;
+       linux*)
+               kernel=linux
+               os=$(echo $basic_os | sed -e 's|linux|gnu|')
                ;;
-       -solaris1 | -solaris1.*)
-               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+       *)
+               kernel=
+               os=$basic_os
                ;;
-       -solaris)
-               os=-solaris2
+esac
+
+# Now, normalize the OS (knowing we just have one component, it's not a kernel,
+# etc.)
+case $os in
+       # 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
                ;;
-       -svr4*)
-               os=-sysv4
+       bluegene*)
+               os=cnk
                ;;
-       -unixware*)
-               os=-sysv4.2uw
+       solaris1 | solaris1.*)
+               os=$(echo $os | sed -e 's|solaris1|sunos4|')
                ;;
-       -gnu/linux*)
-               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+       solaris)
+               os=solaris2
                ;;
-       # First accept the basic system types.
-       # The portable systems comes first.
-       # Each alternative MUST END IN A *, to match a version number.
-       # -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* | -auroraux* | -solaris* \
-             | -sym* | -kopensolaris* \
-             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* | -aros* \
-             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-             | -openbsd* | -solidbsd* \
-             | -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* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -linux-android* \
-             | -linux-newlib* | -linux-uclibc* \
-             | -uxpv* | -beos* | -mpeix* | -udk* \
-             | -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* | -es*)
-       # Remember, each alternative MUST END IN *, to match a version number.
-               ;;
-       -qnx*)
-               case $basic_machine in
-                   x86-* | i*86-*)
-                       ;;
-                   *)
-                       os=-nto$os
-                       ;;
-               esac
+       unixware*)
+               os=sysv4.2uw
                ;;
-       -nto-qnx*)
+       # es1800 is here to avoid being matched by es* (a different OS)
+       es1800*)
+               os=ose
                ;;
-       -nto*)
-               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+       # Some version numbers need modification
+       chorusos*)
+               os=chorusos
                ;;
-       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
-             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+       isc)
+               os=isc2.2
                ;;
-       -mac*)
-               os=`echo $os | sed -e 's|mac|macos|'`
+       sco6)
+               os=sco5v6
                ;;
-       -linux-dietlibc)
-               os=-linux-dietlibc
+       sco5)
+               os=sco3.2v5
                ;;
-       -linux*)
-               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+       sco4)
+               os=sco3.2v4
                ;;
-       -sunos5*)
-               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+       sco3.2.[4-9]*)
+               os=$(echo $os | sed -e 's/sco3.2./sco3.2v/')
                ;;
-       -sunos6*)
-               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+       sco*v* | scout)
+               # Don't match below
                ;;
-       -opened*)
-               os=-openedition
+       sco*)
+               os=sco3.2v2
                ;;
-       -os400*)
-               os=-os400
+       psos*)
+               os=psos
                ;;
-       -wince*)
-               os=-wince
+       qnx*)
+               os=qnx
                ;;
-       -osfrose*)
-               os=-osfrose
+       hiux*)
+               os=hiuxwe2
                ;;
-       -osf*)
-               os=-osf
+       lynx*178)
+               os=lynxos178
                ;;
-       -utek*)
-               os=-bsd
+       lynx*5)
+               os=lynxos5
                ;;
-       -dynix*)
-               os=-bsd
+       lynxos*)
+               # don't get caught up in next wildcard
                ;;
-       -acis*)
-               os=-aos
+       lynx*)
+               os=lynxos
                ;;
-       -atheos*)
-               os=-atheos
+       mac[0-9]*)
+               os=$(echo "$os" | sed -e 's|mac|macos|')
                ;;
-       -syllable*)
-               os=-syllable
+       opened*)
+               os=openedition
                ;;
-       -386bsd)
-               os=-bsd
+       os400*)
+               os=os400
                ;;
-       -ctix* | -uts*)
-               os=-sysv
+       sunos5*)
+               os=$(echo "$os" | sed -e 's|sunos5|solaris2|')
                ;;
-       -nova*)
-               os=-rtmk-nova
+       sunos6*)
+               os=$(echo "$os" | sed -e 's|sunos6|solaris3|')
                ;;
-       -ns2 )
-               os=-nextstep2
+       wince*)
+               os=wince
                ;;
-       -nsk*)
-               os=-nsk
+       utek*)
+               os=bsd
                ;;
-       # Preserve the version number of sinix5.
-       -sinix5.*)
-               os=`echo $os | sed -e 's|sinix|sysv|'`
+       dynix*)
+               os=bsd
                ;;
-       -sinix*)
-               os=-sysv4
+       acis*)
+               os=aos
                ;;
-       -tpf*)
-               os=-tpf
+       atheos*)
+               os=atheos
                ;;
-       -triton*)
-               os=-sysv3
+       syllable*)
+               os=syllable
                ;;
-       -oss*)
-               os=-sysv3
+       386bsd)
+               os=bsd
                ;;
-       -svr4)
-               os=-sysv4
+       ctix* | uts*)
+               os=sysv
                ;;
-       -svr3)
-               os=-sysv3
+       nova*)
+               os=rtmk-nova
                ;;
-       -sysvr4)
-               os=-sysv4
+       ns2)
+               os=nextstep2
                ;;
-       # This must come after -sysvr4.
-       -sysv*)
+       # Preserve the version number of sinix5.
+       sinix5.*)
+               os=$(echo $os | sed -e 's|sinix|sysv|')
+               ;;
+       sinix*)
+               os=sysv4
                ;;
-       -ose*)
-               os=-ose
+       tpf*)
+               os=tpf
                ;;
-       -es1800*)
-               os=-ose
+       triton*)
+               os=sysv3
                ;;
-       -xenix)
-               os=-xenix
+       oss*)
+               os=sysv3
                ;;
-       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-               os=-mint
+       svr4*)
+               os=sysv4
                ;;
-       -aros*)
-               os=-aros
+       svr3)
+               os=sysv3
                ;;
-       -kaos*)
-               os=-kaos
+       sysvr4)
+               os=sysv4
                ;;
-       -zvmoe)
-               os=-zvmoe
+       ose*)
+               os=ose
                ;;
-       -dicos*)
-               os=-dicos
+       *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+               os=mint
                ;;
-       -nacl*)
+       dicos*)
+               os=dicos
                ;;
-       -none)
+       pikeos*)
+               # Until real need of OS specific support for
+               # particular features comes up, bare metal
+               # configurations are quite functional.
+               case $cpu in
+                   arm*)
+                       os=eabi
+                       ;;
+                   *)
+                       os=elf
+                       ;;
+               esac
                ;;
        *)
-               # Get rid of the `-' at the beginning of $os.
-               os=`echo $os | sed 's/[^-]*-//'`
-               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-               exit 1
+               # No normalization, but not necessarily accepted, that comes below.
                ;;
 esac
+
 else
 
 # Here we handle the default operating systems that come with various machines.
@@ -1524,255 +1499,361 @@ else
 # will signal an error saying that MANUFACTURER isn't an operating
 # system, and we'll never get to this point.
 
-case $basic_machine in
+kernel=
+case $cpu-$vendor in
        score-*)
-               os=-elf
+               os=elf
                ;;
        spu-*)
-               os=-elf
+               os=elf
                ;;
        *-acorn)
-               os=-riscix1.2
+               os=riscix1.2
                ;;
        arm*-rebel)
-               os=-linux
+               kernel=linux
+               os=gnu
                ;;
        arm*-semi)
-               os=-aout
+               os=aout
                ;;
        c4x-* | tic4x-*)
-               os=-coff
+               os=coff
+               ;;
+       c8051-*)
+               os=elf
+               ;;
+       clipper-intergraph)
+               os=clix
+               ;;
+       hexagon-*)
+               os=elf
                ;;
        tic54x-*)
-               os=-coff
+               os=coff
                ;;
        tic55x-*)
-               os=-coff
+               os=coff
                ;;
        tic6x-*)
-               os=-coff
+               os=coff
                ;;
        # This must come before the *-dec entry.
        pdp10-*)
-               os=-tops20
+               os=tops20
                ;;
        pdp11-*)
-               os=-none
+               os=none
                ;;
        *-dec | vax-*)
-               os=-ultrix4.2
+               os=ultrix4.2
                ;;
        m68*-apollo)
-               os=-domain
+               os=domain
                ;;
        i386-sun)
-               os=-sunos4.0.2
+               os=sunos4.0.2
                ;;
        m68000-sun)
-               os=-sunos3
+               os=sunos3
                ;;
        m68*-cisco)
-               os=-aout
+               os=aout
                ;;
        mep-*)
-               os=-elf
+               os=elf
                ;;
        mips*-cisco)
-               os=-elf
+               os=elf
                ;;
        mips*-*)
-               os=-elf
+               os=elf
                ;;
        or32-*)
-               os=-coff
+               os=coff
                ;;
        *-tti)  # must be before sparc entry or we get the wrong os.
-               os=-sysv3
+               os=sysv3
                ;;
        sparc-* | *-sun)
-               os=-sunos4.1.1
+               os=sunos4.1.1
                ;;
-       *-be)
-               os=-beos
+       pru-*)
+               os=elf
                ;;
-       *-haiku)
-               os=-haiku
+       *-be)
+               os=beos
                ;;
        *-ibm)
-               os=-aix
+               os=aix
                ;;
        *-knuth)
-               os=-mmixware
+               os=mmixware
                ;;
        *-wec)
-               os=-proelf
+               os=proelf
                ;;
        *-winbond)
-               os=-proelf
+               os=proelf
                ;;
        *-oki)
-               os=-proelf
+               os=proelf
                ;;
        *-hp)
-               os=-hpux
+               os=hpux
                ;;
        *-hitachi)
-               os=-hiux
+               os=hiux
                ;;
        i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-               os=-sysv
+               os=sysv
                ;;
        *-cbm)
-               os=-amigaos
+               os=amigaos
                ;;
        *-dg)
-               os=-dgux
+               os=dgux
                ;;
        *-dolphin)
-               os=-sysv3
+               os=sysv3
                ;;
        m68k-ccur)
-               os=-rtu
+               os=rtu
                ;;
        m88k-omron*)
-               os=-luna
+               os=luna
                ;;
-       *-next )
-               os=-nextstep
+       *-next)
+               os=nextstep
                ;;
        *-sequent)
-               os=-ptx
+               os=ptx
                ;;
        *-crds)
-               os=-unos
+               os=unos
                ;;
        *-ns)
-               os=-genix
+               os=genix
                ;;
        i370-*)
-               os=-mvs
-               ;;
-       *-next)
-               os=-nextstep3
+               os=mvs
                ;;
        *-gould)
-               os=-sysv
+               os=sysv
                ;;
        *-highlevel)
-               os=-bsd
+               os=bsd
                ;;
        *-encore)
-               os=-bsd
+               os=bsd
                ;;
        *-sgi)
-               os=-irix
+               os=irix
                ;;
        *-siemens)
-               os=-sysv4
+               os=sysv4
                ;;
        *-masscomp)
-               os=-rtu
+               os=rtu
                ;;
        f30[01]-fujitsu | f700-fujitsu)
-               os=-uxpv
+               os=uxpv
                ;;
        *-rom68k)
-               os=-coff
+               os=coff
                ;;
        *-*bug)
-               os=-coff
+               os=coff
                ;;
        *-apple)
-               os=-macos
+               os=macos
                ;;
        *-atari*)
-               os=-mint
+               os=mint
+               ;;
+       *-wrs)
+               os=vxworks
                ;;
        *)
-               os=-none
+               os=none
                ;;
 esac
+
 fi
 
+# Now, validate our (potentially fixed-up) OS.
+case $os in
+       # Sometimes we do "kernel-libc", so those need to count as OSes.
+       musl* | newlib* | uclibc*)
+               ;;
+       # Likewise for "kernel-abi"
+       eabi* | gnueabi*)
+               ;;
+       # VxWorks passes extra cpu info in the 4th filed.
+       simlinux | simwindows | spe)
+               ;;
+       # Now accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST end in a * to match a version number.
+       gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+            | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
+            | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
+            | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
+            | hiux* | abug | nacl* | netware* | windows* \
+            | os9* | macos* | osx* | ios* \
+            | mpw* | magic* | mmixware* | mon960* | lnews* \
+            | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
+            | aos* | aros* | cloudabi* | sortix* | twizzler* \
+            | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
+            | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
+            | mirbsd* | netbsd* | dicos* | openedition* | ose* \
+            | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
+            | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
+            | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+            | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
+            | udi* | lites* | ieee* | go32* | aux* | hcos* \
+            | chorusrdb* | cegcc* | glidix* \
+            | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
+            | midipix* | mingw32* | mingw64* | mint* \
+            | uxpv* | beos* | mpeix* | udk* | moxiebox* \
+            | interix* | uwin* | mks* | rhapsody* | darwin* \
+            | openstep* | oskit* | conix* | pw32* | nonstopux* \
+            | storm-chaos* | tops10* | tenex* | tops20* | its* \
+            | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
+            | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
+            | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
+            | skyos* | haiku* | rdos* | toppers* | drops* | es* \
+            | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+            | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+            | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
+               ;;
+       # This one is extra strict with allowed versions
+       sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               ;;
+       none)
+               ;;
+       *)
+               echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+       linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
+               ;;
+       uclinux-uclibc* )
+               ;;
+       -dietlibc* | -newlib* | -musl* | -uclibc* )
+               # These are just libc implementations, not actual OSes, and thus
+               # require a kernel.
+               echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+               exit 1
+               ;;
+       kfreebsd*-gnu* | kopensolaris*-gnu*)
+               ;;
+       vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+               ;;
+       nto-qnx*)
+               ;;
+       os2-emx)
+               ;;
+       *-eabi* | *-gnueabi*)
+               ;;
+       -*)
+               # Blank kernel with real OS is always fine.
+               ;;
+       *-*)
+               echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+               exit 1
+               ;;
+esac
+
 # Here we handle the case where we know the os, and the CPU type, but not the
 # manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-       *-unknown)
-               case $os in
-                       -riscix*)
+case $vendor in
+       unknown)
+               case $cpu-$os in
+                       *-riscix*)
                                vendor=acorn
                                ;;
-                       -sunos*)
+                       *-sunos*)
                                vendor=sun
                                ;;
-                       -cnk*|-aix*)
+                       *-cnk* | *-aix*)
                                vendor=ibm
                                ;;
-                       -beos*)
+                       *-beos*)
                                vendor=be
                                ;;
-                       -hpux*)
+                       *-hpux*)
                                vendor=hp
                                ;;
-                       -mpeix*)
+                       *-mpeix*)
                                vendor=hp
                                ;;
-                       -hiux*)
+                       *-hiux*)
                                vendor=hitachi
                                ;;
-                       -unos*)
+                       *-unos*)
                                vendor=crds
                                ;;
-                       -dgux*)
+                       *-dgux*)
                                vendor=dg
                                ;;
-                       -luna*)
+                       *-luna*)
                                vendor=omron
                                ;;
-                       -genix*)
+                       *-genix*)
                                vendor=ns
                                ;;
-                       -mvs* | -opened*)
+                       *-clix*)
+                               vendor=intergraph
+                               ;;
+                       *-mvs* | *-opened*)
+                               vendor=ibm
+                               ;;
+                       *-os400*)
                                vendor=ibm
                                ;;
-                       -os400*)
+                       s390-* | s390x-*)
                                vendor=ibm
                                ;;
-                       -ptx*)
+                       *-ptx*)
                                vendor=sequent
                                ;;
-                       -tpf*)
+                       *-tpf*)
                                vendor=ibm
                                ;;
-                       -vxsim* | -vxworks* | -windiss*)
+                       *-vxsim* | *-vxworks* | *-windiss*)
                                vendor=wrs
                                ;;
-                       -aux*)
+                       *-aux*)
                                vendor=apple
                                ;;
-                       -hms*)
+                       *-hms*)
                                vendor=hitachi
                                ;;
-                       -mpw* | -macos*)
+                       *-mpw* | *-macos*)
                                vendor=apple
                                ;;
-                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                       *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
                                vendor=atari
                                ;;
-                       -vos*)
+                       *-vos*)
                                vendor=stratus
                                ;;
                esac
-               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
                ;;
 esac
 
-echo $basic_machine$os
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
 exit
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
index 72495a14a6a84a824acab5d5900f6ac094078a83..d2ba794b2ede48b4610a1a5d4b189bf15e2896b7 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69.
+# Generated by GNU Autoconf 2.71.
 #
 #
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
+# Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+as_nop=:
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
-else
+else $as_nop
   case `(set -o) 2>/dev/null` in #(
   *posix*) :
     set -o posix ;; #(
@@ -31,46 +34,46 @@ esac
 fi
 
 
+
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
 as_nl='
 '
 export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-       expr "X$arg" : "X\\(.*\\)$as_nl";
-       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
+IFS=" ""       $as_nl"
+
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh).  This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2)            ; then :; else exec 2>/dev/null; fi
 
 # The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
+if ${PATH_SEPARATOR+false} :; then
   PATH_SEPARATOR=:
   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
@@ -79,13 +82,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
 fi
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""       $as_nl"
-
 # Find who we are.  Look in the path if we contain no directory separator.
 as_myself=
 case $0 in #((
@@ -94,8 +90,12 @@ case $0 in #((
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    test -r "$as_dir$0" && as_myself=$as_dir$0 && break
   done
 IFS=$as_save_IFS
 
@@ -107,30 +107,10 @@ if test "x$as_myself" = x; then
   as_myself=$0
 fi
 if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
   exit 1
 fi
 
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-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.
@@ -152,20 +132,22 @@ 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
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+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 :
+  as_bourne_compatible="as_nop=:
+if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '\${1+\"\$@\"}'='\"\$@\"'
   setopt NO_GLOB_SUBST
-else
+else \$as_nop
   case \`(set -o) 2>/dev/null\` in #(
   *posix*) :
     set -o posix ;; #(
@@ -185,42 +167,52 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; }
 as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
 as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
 as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+if ( set x; as_fn_ret_success y && test x = \"\$1\" )
+then :
 
-else
+else \$as_nop
   exitcode=1; echo positional parameters were not saved.
 fi
 test x\$exitcode = x0 || exit 1
+blah=\$(echo \$(echo blah))
+test x\"\$blah\" = xblah || 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'\" &&
-  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1"
-  if (eval "$as_required") 2>/dev/null; then :
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
+  if (eval "$as_required") 2>/dev/null
+then :
   as_have_required=yes
-else
+else $as_nop
   as_have_required=no
 fi
-  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
+then :
 
-else
+else $as_nop
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 as_found=false
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
   as_found=:
   case $as_dir in #(
         /*)
           for as_base in sh bash ksh sh5; do
             # Try only shells that exist, to save several forks.
-            as_shell=$as_dir/$as_base
+            as_shell=$as_dir$as_base
             if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-                   { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+                   as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
   CONFIG_SHELL=$as_shell as_have_required=yes
-                  if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+                  if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
+then :
   break 2
 fi
 fi
@@ -228,14 +220,21 @@ fi
        esac
   as_found=false
 done
-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
-             { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
-  CONFIG_SHELL=$SHELL as_have_required=yes
-fi; }
 IFS=$as_save_IFS
+if $as_found
+then :
+
+else $as_nop
+  if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+             as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi
+fi
 
 
-      if test "x$CONFIG_SHELL" != x; then :
+      if test "x$CONFIG_SHELL" != x
+then :
   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
@@ -253,18 +252,19 @@ 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
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
 exit 255
 fi
 
-    if test x$as_have_required = xno; then :
-  $as_echo "$0: This script requires a shell more modern than all"
-  $as_echo "$0: the shells that I found on your system."
-  if test x${ZSH_VERSION+set} = xset ; then
-    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
-    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+    if test x$as_have_required = xno
+then :
+  printf "%s\n" "$0: This script requires a shell more modern than all"
+  printf "%s\n" "$0: the shells that I found on your system."
+  if test ${ZSH_VERSION+y} ; then
+    printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."
   else
-    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+    printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system,
 $0: including any error possibly output before this
 $0: message. Then install a modern shell, or manually run
 $0: the script under such a shell if you do have one."
@@ -291,6 +291,7 @@ as_fn_unset ()
 }
 as_unset=as_fn_unset
 
+
 # as_fn_set_status STATUS
 # -----------------------
 # Set $? to STATUS, without forking.
@@ -308,6 +309,14 @@ as_fn_exit ()
   as_fn_set_status $1
   exit $1
 } # as_fn_exit
+# as_fn_nop
+# ---------
+# Do nothing but, unlike ":", preserve the value of $?.
+as_fn_nop ()
+{
+  return $?
+}
+as_nop=as_fn_nop
 
 # as_fn_mkdir_p
 # -------------
@@ -322,7 +331,7 @@ as_fn_mkdir_p ()
     as_dirs=
     while :; do
       case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
       *) as_qdir=$as_dir;;
       esac
       as_dirs="'$as_qdir' $as_dirs"
@@ -331,7 +340,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$as_dir" : 'X\(//\)[^/]' \| \
         X"$as_dir" : 'X\(//\)$' \| \
         X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
+printf "%s\n" X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -370,12 +379,13 @@ as_fn_executable_p ()
 # advantage of any shell optimizations that allow amortized linear growth over
 # repeated appends, instead of the typical quadratic growth present in naive
 # implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
   eval 'as_fn_append ()
   {
     eval $1+=\$2
   }'
-else
+else $as_nop
   as_fn_append ()
   {
     eval $1=\$$1\$2
@@ -387,18 +397,27 @@ fi # as_fn_append
 # Perform arithmetic evaluation on the ARGs, and store the result in the
 # global $as_val. Take advantage of shells that can avoid forks. The arguments
 # must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
   eval 'as_fn_arith ()
   {
     as_val=$(( $* ))
   }'
-else
+else $as_nop
   as_fn_arith ()
   {
     as_val=`expr "$@" || test $? -eq 1`
   }
 fi # as_fn_arith
 
+# as_fn_nop
+# ---------
+# Do nothing but, unlike ":", preserve the value of $?.
+as_fn_nop ()
+{
+  return $?
+}
+as_nop=as_fn_nop
 
 # as_fn_error STATUS ERROR [LINENO LOG_FD]
 # ----------------------------------------
@@ -410,9 +429,9 @@ as_fn_error ()
   as_status=$1; test $as_status -eq 0 && as_status=1
   if test "$4"; then
     as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $2" >&2
+  printf "%s\n" "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -439,7 +458,7 @@ as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
         X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
+printf "%s\n" X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
            s//\1/
            q
@@ -483,7 +502,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
       s/-\n.*//
     ' >$as_me.lineno &&
   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; }
+    { printf "%s\n" "$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
@@ -497,6 +516,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   exit
 }
 
+
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
 ECHO_C= ECHO_N= ECHO_T=
 case `echo -n x` in #(((((
 -n*)
@@ -510,6 +533,13 @@ case `echo -n x` in #(((((
   ECHO_N='-n';;
 esac
 
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n.  New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
+
+
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
@@ -575,50 +605,46 @@ MFLAGS=
 MAKEFLAGS=
 
 # Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
+PACKAGE_NAME=''
+PACKAGE_TARNAME=''
+PACKAGE_VERSION=''
+PACKAGE_STRING=''
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
 
 ac_unique_file="cpmfs.c"
 # Factoring default headers for most tests.
 ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
+#include <stddef.h>
+#ifdef HAVE_STDIO_H
+# include <stdio.h>
 #endif
-#ifdef STDC_HEADERS
+#ifdef HAVE_STDLIB_H
 # include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
 #endif
 #ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-#  include <memory.h>
-# endif
 # include <string.h>
 #endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
 #ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
 #endif
 #ifdef HAVE_STDINT_H
 # include <stdint.h>
 #endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif"
 
+ac_header_c_list=
 ac_subst_vars='LTLIBOBJS
 UPDATED
 FSED_CPM
@@ -629,8 +655,6 @@ DEVICE
 LDDEPS
 LDLIBS
 LIBOBJS
-EGREP
-GREP
 CPP
 INSTALL_DATA
 INSTALL_SCRIPT
@@ -669,6 +693,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -694,7 +719,6 @@ enable_option_checking
 with_diskdefs
 with_defformat
 with_libdsk
-with_dmalloc
 enable_largefile
 '
       ac_precious_vars='build_alias
@@ -744,6 +768,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}'
@@ -773,8 +798,6 @@ do
   *)    ac_optarg=yes ;;
   esac
 
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
   case $ac_dashdash$ac_option in
   --)
     ac_dashdash=yes ;;
@@ -815,9 +838,9 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: \`$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "enable_$ac_useropt"
@@ -841,9 +864,9 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: \`$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "enable_$ac_useropt"
@@ -996,6 +1019,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=* \
@@ -1045,9 +1077,9 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: \`$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "with_$ac_useropt"
@@ -1061,9 +1093,9 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: \`$ac_useropt'"
     ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
       *"
 "with_$ac_useropt"
@@ -1107,9 +1139,9 @@ Try \`$0 --help' for more information"
 
   *)
     # FIXME: should be removed in autoconf 3.0.
-    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+      printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
     : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
@@ -1125,7 +1157,7 @@ if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
     fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
-    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+    *)     printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
 
@@ -1133,7 +1165,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.
@@ -1189,7 +1221,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$as_myself" : 'X\(//\)[^/]' \| \
         X"$as_myself" : 'X\(//\)$' \| \
         X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
+printf "%s\n" X"$as_myself" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -1286,6 +1318,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]
@@ -1325,7 +1358,6 @@ Optional Packages:
   --with-diskdefs         Specify diskdefs location
   --with-defformat        Specify default format (ibm-3740)
   --with-libdsk           Specify path to libdsk library
-  --with-dmalloc          Specify path to dmalloc library
 
 Some influential environment variables:
   CC          C compiler command
@@ -1356,9 +1388,9 @@ if test "$ac_init_help" = "recursive"; then
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1386,7 +1418,8 @@ esac
 ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
     cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
+    # Check for configure.gnu first; this name is used for a wrapper for
+    # Metaconfig's "Configure" on case-insensitive file systems.
     if test -f "$ac_srcdir/configure.gnu"; then
       echo &&
       $SHELL "$ac_srcdir/configure.gnu" --help=recursive
@@ -1394,7 +1427,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
       echo &&
       $SHELL "$ac_srcdir/configure" --help=recursive
     else
-      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+      printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi || ac_status=$?
     cd "$ac_pwd" || { ac_status=$?; break; }
   done
@@ -1404,9 +1437,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 configure
-generated by GNU Autoconf 2.69
+generated by GNU Autoconf 2.71
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2021 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1423,14 +1456,14 @@ fi
 ac_fn_c_try_compile ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext
+  rm -f conftest.$ac_objext conftest.beam
   if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
@@ -1438,14 +1471,15 @@ $as_echo "$ac_try_echo"; } >&5
     cat conftest.er1 >&5
     mv -f conftest.er1 conftest.err
   fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then :
+       } && test -s conftest.$ac_objext
+then :
   ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
+else $as_nop
+  printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_retval=1
@@ -1467,7 +1501,7 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
@@ -1475,14 +1509,15 @@ $as_echo "$ac_try_echo"; } >&5
     cat conftest.er1 >&5
     mv -f conftest.er1 conftest.err
   fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } > conftest.i && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
-       }; then :
+       }
+then :
   ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
+else $as_nop
+  printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
@@ -1498,14 +1533,14 @@ fi
 ac_fn_c_try_link ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
+  rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext
   if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
@@ -1513,17 +1548,18 @@ $as_echo "$ac_try_echo"; } >&5
     cat conftest.er1 >&5
     mv -f conftest.er1 conftest.err
   fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
         test "$cross_compiling" = yes ||
         test -x conftest$ac_exeext
-       }; then :
+       }
+then :
   ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
+else $as_nop
+  printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_retval=1
@@ -1538,135 +1574,6 @@ fi
 
 } # ac_fn_c_try_link
 
-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_c_check_header_mongrel ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_header_compiler=yes
-else
-  ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <$2>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  ac_header_preproc=yes
-else
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
-  yes:no: )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-    ;;
-esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_mongrel
-
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=$ac_status
-fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_run
-
 # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
 # -------------------------------------------------------
 # Tests whether HEADER exists and can be compiled using the include files in
@@ -1674,26 +1581,28 @@ fi
 ac_fn_c_check_header_compile ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $4
 #include <$2>
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   eval "$3=yes"
-else
+else $as_nop
   eval "$3=no"
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+              { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_header_compile
@@ -1705,17 +1614,18 @@ $as_echo "$ac_res" >&6; }
 ac_fn_c_check_type ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   eval "$3=no"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $4
 int
-main ()
+main (void)
 {
 if (sizeof ($2))
         return 0;
@@ -1723,12 +1633,13 @@ if (sizeof ($2))
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $4
 int
-main ()
+main (void)
 {
 if (sizeof (($2)))
            return 0;
@@ -1736,33 +1647,78 @@ if (sizeof (($2)))
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
 
-else
+else $as_nop
   eval "$3=yes"
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+              { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_type
 
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
+# executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  ac_retval=0
+else $as_nop
+  printf "%s\n" "$as_me: program exited with status $ac_status" >&5
+       printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
 # ac_fn_c_check_func LINENO FUNC VAR
 # ----------------------------------
 # Tests whether FUNC exists, setting the cache variable VAR accordingly
 ac_fn_c_check_func ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 /* Define $2 to an innocuous variant, in case <limits.h> declares $2.
@@ -1770,16 +1726,9 @@ else
 #define $2 innocuous_$2
 
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $2 (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+   which can conflict with char $2 (); below.  */
 
+#include <limits.h>
 #undef $2
 
 /* Override any GCC internal prototype to avoid an error.
@@ -1797,35 +1746,56 @@ choke me
 #endif
 
 int
-main ()
+main (void)
 {
 return $2 ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"
+then :
   eval "$3=yes"
-else
+else $as_nop
   eval "$3=no"
 fi
-rm -f core conftest.err conftest.$ac_objext \
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
 fi
 eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+              { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_func
+ac_configure_args_raw=
+for ac_arg
+do
+  case $ac_arg in
+  *\'*)
+    ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+  esac
+  as_fn_append ac_configure_args_raw " '$ac_arg'"
+done
+
+case $ac_configure_args_raw in
+  *$as_nl*)
+    ac_safe_unquote= ;;
+  *)
+    ac_unsafe_z='|&;<>()$`\\"*?[ ''    ' # This string ends in space, tab.
+    ac_unsafe_a="$ac_unsafe_z#~"
+    ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g"
+    ac_configure_args_raw=`      printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;;
+esac
+
 cat >config.log <<_ACEOF
 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.69.  Invocation command line was
+generated by GNU Autoconf 2.71.  Invocation command line was
 
-  $ $0 $@
+  $ $0$ac_configure_args_raw
 
 _ACEOF
 exec 5>>config.log
@@ -1858,8 +1828,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    $as_echo "PATH: $as_dir"
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    printf "%s\n" "PATH: $as_dir"
   done
 IFS=$as_save_IFS
 
@@ -1894,7 +1868,7 @@ do
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
     *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
     1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
@@ -1929,11 +1903,13 @@ done
 # WARNING: Use '\'' to represent an apostrophe within the trap.
 # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
 trap 'exit_status=$?
+  # Sanitize IFS.
+  IFS=" ""     $as_nl"
   # Save into config.log some information that might help in debugging.
   {
     echo
 
-    $as_echo "## ---------------- ##
+    printf "%s\n" "## ---------------- ##
 ## Cache variables. ##
 ## ---------------- ##"
     echo
@@ -1944,8 +1920,8 @@ trap 'exit_status=$?
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
@@ -1969,7 +1945,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
 )
     echo
 
-    $as_echo "## ----------------- ##
+    printf "%s\n" "## ----------------- ##
 ## Output variables. ##
 ## ----------------- ##"
     echo
@@ -1977,14 +1953,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
     do
       eval ac_val=\$$ac_var
       case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
       esac
-      $as_echo "$ac_var='\''$ac_val'\''"
+      printf "%s\n" "$ac_var='\''$ac_val'\''"
     done | sort
     echo
 
     if test -n "$ac_subst_files"; then
-      $as_echo "## ------------------- ##
+      printf "%s\n" "## ------------------- ##
 ## File substitutions. ##
 ## ------------------- ##"
       echo
@@ -1992,15 +1968,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       do
        eval ac_val=\$$ac_var
        case $ac_val in
-       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
        esac
-       $as_echo "$ac_var='\''$ac_val'\''"
+       printf "%s\n" "$ac_var='\''$ac_val'\''"
       done | sort
       echo
     fi
 
     if test -s confdefs.h; then
-      $as_echo "## ----------- ##
+      printf "%s\n" "## ----------- ##
 ## confdefs.h. ##
 ## ----------- ##"
       echo
@@ -2008,8 +1984,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       echo
     fi
     test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
+      printf "%s\n" "$as_me: caught signal $ac_signal"
+    printf "%s\n" "$as_me: exit $exit_status"
   } >&5
   rm -f core *.core core.conftest.* &&
     rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
@@ -2023,63 +1999,48 @@ ac_signal=0
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
 rm -f -r conftest* confdefs.h
 
-$as_echo "/* confdefs.h */" > confdefs.h
+printf "%s\n" "/* confdefs.h */" > confdefs.h
 
 # Predefined preprocessor variables.
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
+printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
+printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
+printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
+printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
+printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
-_ACEOF
+printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h
 
 
 # Let the site file select an alternate cache file if it wants to.
 # Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for config.site.
-  case $CONFIG_SITE in #((
-    -*)  ac_site_file1=./$CONFIG_SITE;;
-    */*) ac_site_file1=$CONFIG_SITE;;
-    *)   ac_site_file1=./$CONFIG_SITE;;
-  esac
+  ac_site_files="$CONFIG_SITE"
 elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
+  ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
 else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
+  ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
 fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+
+for ac_site_file in $ac_site_files
 do
-  test "x$ac_site_file" = xNONE && continue
-  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+  case $ac_site_file in #(
+  */*) :
+     ;; #(
+  *) :
+    ac_site_file=./$ac_site_file ;;
+esac
+  if test -f "$ac_site_file" && test -r "$ac_site_file"; then
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
     . "$ac_site_file" \
-      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+      || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
 See \`config.log' for more details" "$LINENO" 5; }
   fi
@@ -2089,138 +2050,529 @@ if test -r "$cache_file"; then
   # Some versions of bash will fail to source /dev/null (special files
   # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
   if test /dev/null != "$cache_file" && test -f "$cache_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+printf "%s\n" "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . "$cache_file";;
       *)                      . "./$cache_file";;
     esac
   fi
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+printf "%s\n" "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-       # differences in whitespace do not lead to failure.
-       ac_old_val_w=`echo x $ac_old_val`
-       ac_new_val_w=`echo x $ac_new_val`
-       if test "$ac_old_val_w" != "$ac_new_val_w"; then
-         { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-         ac_cache_corrupted=:
-       else
-         { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-         eval $ac_var=\$ac_old_val
-       fi
-       { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-       { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
-fi
-## -------------------- ##
-## Main body of script. ##
-## -------------------- ##
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-ac_config_headers="$ac_config_headers config.h"
+# Test code for whether the C compiler supports C89 (global declarations)
+ac_c_conftest_c89_globals='
+/* Does the compiler advertise C89 conformance?
+   Do not test the value of __STDC__, because some compilers set it to 0
+   while being otherwise adequately conformant. */
+#if !defined __STDC__
+# error "Compiler does not advertise C89 conformance"
+#endif
 
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
+#include <stddef.h>
+#include <stdarg.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7 src/conf.sh.  */
+struct buf { int x; };
+struct buf * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not \xHH hex character constants.
+   These do not provoke an error unfortunately, instead are silently treated
+   as an "x".  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously \x00 != x always comes out true, for an
+   array size at least.  It is necessary to write \x00 == 0 to get something
+   that is true only with -std.  */
+int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) '\''x'\''
+int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
+               int, int);'
+
+# Test code for whether the C compiler supports C89 (body of main).
+ac_c_conftest_c89_main='
+ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
+'
+
+# Test code for whether the C compiler supports C99 (global declarations)
+ac_c_conftest_c99_globals='
+// Does the compiler advertise C99 conformance?
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
+# error "Compiler does not advertise C99 conformance"
+#endif
+
+#include <stdbool.h>
+extern int puts (const char *);
+extern int printf (const char *, ...);
+extern int dprintf (int, const char *, ...);
+extern void *malloc (size_t);
+
+// Check varargs macros.  These examples are taken from C99 6.10.3.5.
+// dprintf is used instead of fprintf to avoid needing to declare
+// FILE and stderr.
+#define debug(...) dprintf (2, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+  int x = 1234;
+  int y = 5678;
+  debug ("Flag");
+  debug ("X = %d\n", x);
+  showlist (The first, second, and third items.);
+  report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+  #error "your preprocessor is broken"
+#endif
+#if BIG_OK
+#else
+  #error "your preprocessor is broken"
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+  int datasize;
+  double data[];
+};
+
+struct named_init {
+  int number;
+  const wchar_t *name;
+  double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+  // See if C++-style comments work.
+  // Iterate through items via the restricted pointer.
+  // Also check for declarations in for loops.
+  for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)
+    continue;
+  return 0;
+}
+
+// Check varargs and va_copy.
+static bool
+test_varargs (const char *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  va_list args_copy;
+  va_copy (args_copy, args);
+
+  const char *str = "";
+  int number = 0;
+  float fnumber = 0;
+
+  while (*format)
+    {
+      switch (*format++)
+       {
+       case '\''s'\'': // string
+         str = va_arg (args_copy, const char *);
+         break;
+       case '\''d'\'': // int
+         number = va_arg (args_copy, int);
+         break;
+       case '\''f'\'': // float
+         fnumber = va_arg (args_copy, double);
+         break;
+       default:
+         break;
+       }
+    }
+  va_end (args_copy);
+  va_end (args);
+
+  return *str && number && fnumber;
+}
+'
+
+# Test code for whether the C compiler supports C99 (body of main).
+ac_c_conftest_c99_main='
+  // Check bool.
+  _Bool success = false;
+  success |= (argc != 0);
+
+  // Check restrict.
+  if (test_restrict ("String literal") == 0)
+    success = true;
+  char *restrict newvar = "Another string";
+
+  // Check varargs.
+  success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);
+  test_varargs_macros ();
+
+  // Check flexible array members.
+  struct incomplete_array *ia =
+    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+  ia->datasize = 10;
+  for (int i = 0; i < ia->datasize; ++i)
+    ia->data[i] = i * 1.234;
+
+  // Check named initializers.
+  struct named_init ni = {
+    .number = 34,
+    .name = L"Test wide string",
+    .average = 543.34343,
+  };
+
+  ni.number = 58;
+
+  int dynamic_array[ni.number];
+  dynamic_array[0] = argv[0][0];
+  dynamic_array[ni.number - 1] = 543;
+
+  // work around unused variable warnings
+  ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
+        || dynamic_array[ni.number - 1] != 543);
+'
+
+# Test code for whether the C compiler supports C11 (global declarations)
+ac_c_conftest_c11_globals='
+// Does the compiler advertise C11 conformance?
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "Compiler does not advertise C11 conformance"
+#endif
+
+// Check _Alignas.
+char _Alignas (double) aligned_as_double;
+char _Alignas (0) no_special_alignment;
+extern char aligned_as_int;
+char _Alignas (0) _Alignas (int) aligned_as_int;
+
+// Check _Alignof.
+enum
+{
+  int_alignment = _Alignof (int),
+  int_array_alignment = _Alignof (int[100]),
+  char_alignment = _Alignof (char)
+};
+_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
+
+// Check _Noreturn.
+int _Noreturn does_not_return (void) { for (;;) continue; }
+
+// Check _Static_assert.
+struct test_static_assert
+{
+  int x;
+  _Static_assert (sizeof (int) <= sizeof (long int),
+                  "_Static_assert does not work in struct");
+  long int y;
+};
+
+// Check UTF-8 literals.
+#define u8 syntax error!
+char const utf8_literal[] = u8"happens to be ASCII" "another string";
+
+// Check duplicate typedefs.
+typedef long *long_ptr;
+typedef long int *long_ptr;
+typedef long_ptr long_ptr;
+
+// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
+struct anonymous
+{
+  union {
+    struct { int i; int j; };
+    struct { int k; long int l; } w;
+  };
+  int m;
+} v1;
+'
+
+# Test code for whether the C compiler supports C11 (body of main).
+ac_c_conftest_c11_main='
+  _Static_assert ((offsetof (struct anonymous, i)
+                  == offsetof (struct anonymous, w.k)),
+                 "Anonymous union alignment botch");
+  v1.i = 2;
+  v1.w.k = 5;
+  ok |= v1.i != 5;
+'
+
+# Test code for whether the C compiler supports C11 (complete).
+ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+${ac_c_conftest_c11_globals}
+
+int
+main (int argc, char **argv)
+{
+  int ok = 0;
+  ${ac_c_conftest_c89_main}
+  ${ac_c_conftest_c99_main}
+  ${ac_c_conftest_c11_main}
+  return ok;
+}
+"
+
+# Test code for whether the C compiler supports C99 (complete).
+ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+
+int
+main (int argc, char **argv)
+{
+  int ok = 0;
+  ${ac_c_conftest_c89_main}
+  ${ac_c_conftest_c99_main}
+  return ok;
+}
+"
+
+# Test code for whether the C compiler supports C89 (complete).
+ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}
+
+int
+main (int argc, char **argv)
+{
+  int ok = 0;
+  ${ac_c_conftest_c89_main}
+  return ok;
+}
+"
+
+as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
+as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"
+as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"
+as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"
+as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"
+as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
+as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
+as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
+as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
+
+# Auxiliary files required by this configure script.
+ac_aux_files="install-sh config.guess config.sub"
+
+# Locations in which to look for auxiliary files.
+ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.."
+
+# Search for a directory containing all of the required auxiliary files,
+# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates.
+# If we don't find one directory that contains all the files we need,
+# we report the set of missing files from the *first* directory in
+# $ac_aux_dir_candidates and give up.
+ac_missing_aux_files=""
+ac_first_candidate=:
+printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in $ac_aux_dir_candidates
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+  as_found=:
+
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}:  trying $as_dir" >&5
+  ac_aux_dir_found=yes
+  ac_install_sh=
+  for ac_aux in $ac_aux_files
+  do
+    # As a special case, if "install-sh" is required, that requirement
+    # can be satisfied by any of "install-sh", "install.sh", or "shtool",
+    # and $ac_install_sh is set appropriately for whichever one is found.
+    if test x"$ac_aux" = x"install-sh"
+    then
+      if test -f "${as_dir}install-sh"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}install-sh found" >&5
+        ac_install_sh="${as_dir}install-sh -c"
+      elif test -f "${as_dir}install.sh"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}install.sh found" >&5
+        ac_install_sh="${as_dir}install.sh -c"
+      elif test -f "${as_dir}shtool"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}shtool found" >&5
+        ac_install_sh="${as_dir}shtool install -c"
+      else
+        ac_aux_dir_found=no
+        if $ac_first_candidate; then
+          ac_missing_aux_files="${ac_missing_aux_files} install-sh"
+        else
+          break
+        fi
+      fi
+    else
+      if test -f "${as_dir}${ac_aux}"; then
+        printf "%s\n" "$as_me:${as_lineno-$LINENO}:   ${as_dir}${ac_aux} found" >&5
+      else
+        ac_aux_dir_found=no
+        if $ac_first_candidate; then
+          ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}"
+        else
+          break
+        fi
+      fi
+    fi
+  done
+  if test "$ac_aux_dir_found" = yes; then
+    ac_aux_dir="$as_dir"
     break
   fi
+  ac_first_candidate=false
+
+  as_found=false
 done
-if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+IFS=$as_save_IFS
+if $as_found
+then :
+
+else $as_nop
+  as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5
 fi
 
+
 # These three variables are undocumented and unsupported,
 # and are intended to be withdrawn in a future Autoconf release.
 # They can cause serious problems if a builder's source tree is in a directory
 # whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+if test -f "${ac_aux_dir}config.guess"; then
+  ac_config_guess="$SHELL ${ac_aux_dir}config.guess"
+fi
+if test -f "${ac_aux_dir}config.sub"; then
+  ac_config_sub="$SHELL ${ac_aux_dir}config.sub"
+fi
+if test -f "$ac_aux_dir/configure"; then
+  ac_configure="$SHELL ${ac_aux_dir}configure"
+fi
 
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+         ac_cache_corrupted=:
+       else
+         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+         eval $ac_var=\$ac_old_val
+       fi
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+printf "%s\n" "$as_me:   former value:  \`$ac_old_val'" >&2;}
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+printf "%s\n" "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file'
+           and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
 
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+
+
+  # Make sure we can run config.sub.
+$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+printf %s "checking build system type... " >&6; }
+if test ${ac_cv_build+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+  ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"`
 test "x$ac_build_alias" = x &&
   as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+printf "%s\n" "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
 *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
@@ -2239,21 +2591,22 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+printf %s "checking host system type... " >&6; }
+if test ${ac_cv_host+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+  ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+printf "%s\n" "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
 *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
@@ -2272,22 +2625,36 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-VERSION=2.20
-UPDATED='October 25, 2014'
+VERSION=2.23
+UPDATED='November 2, 2022'
 
 DEVICE="posix"
+TERM="curses"
 
 if test "$prefix" = NONE
 then
   case $host in
     *-linux-*)
     ;;
+    *-cygwin-*)
+      CYGWIN=yes
+    ;;
     *-pc-mingw32)
       CFLAGS_LIBDSK=-DNOTWINDLL
+      MINGW32=yes
     ;;
   esac
 fi
 
+
+
+
+
+
+
+
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2296,11 +2663,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
@@ -2308,11 +2676,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$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
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2323,11 +2695,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2336,11 +2708,12 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
@@ -2348,11 +2721,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$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
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2363,11 +2740,11 @@ fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
   if test "x$ac_ct_CC" = x; then
@@ -2375,8 +2752,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -2389,11 +2766,12 @@ if test -z "$CC"; then
           if test -n "$ac_tool_prefix"; then
     # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
@@ -2401,11 +2779,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$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
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2416,11 +2798,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2429,11 +2811,12 @@ fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
@@ -2442,15 +2825,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  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
+  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
      fi
     ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2466,18 +2853,18 @@ if test $ac_prog_rejected = yes; then
     # However, it has the same basename, so the bogon will be chosen
     # first if we set CC to just the basename; use the full file name.
     shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+    ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"
   fi
 fi
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2488,11 +2875,12 @@ if test -z "$CC"; then
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
@@ -2500,11 +2888,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$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
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2515,11 +2907,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2532,11 +2924,12 @@ if test -z "$CC"; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
@@ -2544,11 +2937,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$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
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2559,11 +2956,11 @@ fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
 fi
 
 
@@ -2575,8 +2972,8 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -2584,25 +2981,129 @@ esac
 fi
 
 fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
+set dummy ${ac_tool_prefix}clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}clang"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "clang", so it can be a program name with args.
+set dummy clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="clang"
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
+else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
 
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+
+
+test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
 See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
+for ac_option in --version -v -V -qversion -version; do
   { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
   if test -s conftest.err; then
@@ -2612,7 +3113,7 @@ $as_echo "$ac_try_echo"; } >&5
     cat conftest.er1 >&5
   fi
   rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
 
@@ -2620,7 +3121,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
@@ -2632,9 +3133,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+printf %s "checking whether the C compiler works... " >&6; }
+ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
 # The possible output files:
 ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
@@ -2655,11 +3156,12 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+then :
   # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
@@ -2676,7 +3178,7 @@ do
        # certainly right.
        break;;
     *.* )
-       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
        then :; else
           ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
        fi
@@ -2692,44 +3194,46 @@ do
 done
 test "$ac_cv_exeext" = no && ac_cv_exeext=
 
-else
+else $as_nop
   ac_file=''
 fi
-if test -z "$ac_file"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
 See \`config.log' for more details" "$LINENO" 5; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
+else $as_nop
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+printf %s "checking for C compiler default output file name... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+printf "%s\n" "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+printf %s "checking for suffix of executables... " >&6; }
 if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+then :
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -2743,15 +3247,15 @@ for ac_file in conftest.exe conftest conftest.*; do
     * ) break;;
   esac
 done
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+else $as_nop
+  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+printf "%s\n" "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
@@ -2760,7 +3264,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdio.h>
 int
-main ()
+main (void)
 {
 FILE *f = fopen ("conftest.out", "w");
  return ferror (f) || fclose (f) != 0;
@@ -2772,8 +3276,8 @@ _ACEOF
 ac_clean_files="$ac_clean_files conftest.out"
 # Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+printf %s "checking whether we are cross compiling... " >&6; }
 if test "$cross_compiling" != yes; then
   { { ac_try="$ac_link"
 case "(($ac_try" in
@@ -2781,10 +3285,10 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
   if { ac_try='./conftest$ac_cv_exeext'
   { { case "(($ac_try" in
@@ -2792,39 +3296,40 @@ $as_echo "$ac_try_echo"; } >&5
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }; then
     cross_compiling=no
   else
     if test "$cross_compiling" = maybe; then
        cross_compiling=yes
     else
-       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
+       { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
 See \`config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+printf "%s\n" "$cross_compiling" >&6; }
 
 rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+printf %s "checking for suffix of object files... " >&6; }
+if test ${ac_cv_objext+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
@@ -2838,11 +3343,12 @@ case "(($ac_try" in
   *) ac_try_echo=$ac_try;;
 esac
 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
+printf "%s\n" "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+then :
   for ac_file in conftest.o conftest.obj conftest.*; do
   test -f "$ac_file" || continue;
   case $ac_file in
@@ -2851,31 +3357,32 @@ $as_echo "$ac_try_echo"; } >&5
        break;;
   esac
 done
-else
-  $as_echo "$as_me: failed program was:" >&5
+else $as_nop
+  printf "%s\n" "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
 See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+printf "%s\n" "$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5
+printf %s "checking whether the compiler supports GNU C... " >&6; }
+if test ${ac_cv_c_compiler_gnu+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 #ifndef __GNUC__
        choke me
@@ -2885,29 +3392,33 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_compiler_gnu=yes
-else
+else $as_nop
   ac_compiler_gnu=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 if test $ac_compiler_gnu = yes; then
   GCC=yes
 else
   GCC=
 fi
-ac_test_CFLAGS=${CFLAGS+set}
+ac_test_CFLAGS=${CFLAGS+y}
 ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+printf %s "checking whether $CC accepts -g... " >&6; }
+if test ${ac_cv_prog_cc_g+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
    ac_cv_prog_cc_g=no
@@ -2916,57 +3427,60 @@ else
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_prog_cc_g=yes
-else
+else $as_nop
   CFLAGS=""
       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
 
-else
+else $as_nop
   ac_c_werror_flag=$ac_save_c_werror_flag
         CFLAGS="-g"
         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_prog_cc_g=yes
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
    ac_c_werror_flag=$ac_save_c_werror_flag
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
+if test $ac_test_CFLAGS; then
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
@@ -2981,94 +3495,144 @@ else
     CFLAGS=
   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
+ac_prog_cc_stdc=no
+if test x$ac_prog_cc_stdc = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
+printf %s "checking for $CC option to enable C11 features... " >&6; }
+if test ${ac_cv_prog_cc_c11+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_cv_prog_cc_c11=no
 ac_save_CC=$CC
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.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);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+$ac_c_conftest_c11_program
+_ACEOF
+for ac_arg in '' -std=gnu11
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_prog_cc_c11=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+  test "x$ac_cv_prog_cc_c11" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+fi
 
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+if test "x$ac_cv_prog_cc_c11" = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+  if test "x$ac_cv_prog_cc_c11" = x
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
+printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }
+     CC="$CC $ac_cv_prog_cc_c11"
+fi
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
+  ac_prog_cc_stdc=c11
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
+printf %s "checking for $CC option to enable C99 features... " >&6; }
+if test ${ac_cv_prog_cc_c99+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_c_conftest_c99_program
+_ACEOF
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_prog_cc_c99=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+  test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+fi
 
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
+if test "x$ac_cv_prog_cc_c99" = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+  if test "x$ac_cv_prog_cc_c99" = x
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }
+     CC="$CC $ac_cv_prog_cc_c99"
+fi
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+  ac_prog_cc_stdc=c99
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
+printf %s "checking for $CC option to enable C89 features... " >&6; }
+if test ${ac_cv_prog_cc_c89+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_c_conftest_c89_program
 _ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
+  if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_prog_cc_c89=$ac_arg
 fi
-rm -f core conftest.err conftest.$ac_objext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
   test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
 rm -f conftest.$ac_ext
 CC=$ac_save_CC
-
 fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
 
+if test "x$ac_cv_prog_cc_c89" = xno
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else $as_nop
+  if test "x$ac_cv_prog_cc_c89" = x
+then :
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else $as_nop
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }
+     CC="$CC $ac_cv_prog_cc_c89"
+fi
+  ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+  ac_prog_cc_stdc=c89
+fi
 fi
 
 ac_ext=c
@@ -3077,7 +3641,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-# Find a good install program.  We prefer a C program (faster),
+
+  # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
 # SysV /etc/install, /usr/sbin/install
@@ -3091,20 +3656,25 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 # OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
 # Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+printf %s "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if ${ac_cv_path_install+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+if test ${ac_cv_path_install+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in #((
-  ./ | .// | /[cC]/* | \
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    # Account for fact that we put trailing slashes in our PATH walk.
+case $as_dir in #((
+  ./ | /[cC]/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
   ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
   /usr/ucb/* ) ;;
@@ -3114,13 +3684,13 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-       if as_fn_executable_p "$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
+           grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
            # AIX install.  It has an incompatible calling convention.
            :
          elif test $ac_prog = install &&
-           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
            # program-specific install script used by HP pwplus--don't use.
            :
          else
@@ -3128,12 +3698,12 @@ case $as_dir/ in #((
            echo one > conftest.one
            echo two > conftest.two
            mkdir conftest.dir
-           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+           if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" &&
              test -s conftest.one && test -s conftest.two &&
              test -s conftest.dir/conftest.one &&
              test -s conftest.dir/conftest.two
            then
-             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+             ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c"
              break 3
            fi
          fi
@@ -3149,7 +3719,7 @@ IFS=$as_save_IFS
 rm -rf conftest.one conftest.two conftest.dir
 
 fi
-  if test "${ac_cv_path_install+set}" = set; then
+  if test ${ac_cv_path_install+y}; then
     INSTALL=$ac_cv_path_install
   else
     # As a last resort, use the slow shell script.  Don't cache a
@@ -3159,8 +3729,8 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+printf "%s\n" "$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
@@ -3175,40 +3745,36 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+printf %s "checking how to run the C preprocessor... " >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+  if test ${ac_cv_prog_CPP+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+      # Double quotes because $CC needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
     do
       ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
   # Use a header file that comes with gcc, so configuring glibc
   # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+#include <limits.h>
                     Syntax error
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if ac_fn_c_try_cpp "$LINENO"
+then :
 
-else
+else $as_nop
   # Broken: fails on valid input.
 continue
 fi
@@ -3220,10 +3786,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if ac_fn_c_try_cpp "$LINENO"
+then :
   # Broken: success on invalid input.
 continue
-else
+else $as_nop
   # Passes both tests.
 ac_preproc_ok=:
 break
@@ -3233,7 +3800,8 @@ rm -f conftest.err conftest.i conftest.$ac_ext
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+if $ac_preproc_ok
+then :
   break
 fi
 
@@ -3245,29 +3813,24 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+printf "%s\n" "$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
   # Use a header file that comes with gcc, so configuring glibc
   # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+#include <limits.h>
                     Syntax error
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if ac_fn_c_try_cpp "$LINENO"
+then :
 
-else
+else $as_nop
   # Broken: fails on valid input.
 continue
 fi
@@ -3279,10 +3842,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if ac_fn_c_try_cpp "$LINENO"
+then :
   # Broken: success on invalid input.
 continue
-else
+else $as_nop
   # Passes both tests.
 ac_preproc_ok=:
 break
@@ -3292,11 +3856,12 @@ rm -f conftest.err conftest.i conftest.$ac_ext
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+if $ac_preproc_ok
+then :
 
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+else $as_nop
+  { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details" "$LINENO" 5; }
 fi
@@ -3310,436 +3875,171 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 if test "$GCC" = yes
 then
-  CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wno-unused-parameter -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common"
+  CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wshadow -Wno-unused-parameter -Wunused -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common"
   LDFLAGS="${LDFLAGS} ${EXTRA_GLDFLAGS}-g"
 else
   CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
   LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
 fi
 
-
-case $host_os in
-  *cygwin* ) CYGWIN=yes;;
-        * ) CYGWIN=no;;
-esac
-
-
-case $host_os in
-  *mingw32* ) MINGW32=yes;;
-         * ) MINGW32=no;;
-esac
-
-DEVICE="posix"
-
 DISKDEFS='${datarootdir}/diskdefs'
 
-if test "$CYGWIN" = "yes"
-then
-  DEVICE="win32"
-#  DISKDEFS='%USERPROFILE%/diskdefs'
-fi
-if test "$MINGW32" = "yes"
-then
-  DEVICE="win32"
-#  DISKDEFS='%USERPROFILE%\\diskdefs'
-fi
-
 
 # Check whether --with-diskdefs was given.
-if test "${with_diskdefs+set}" = set; then :
+if test ${with_diskdefs+y}
+then :
   withval=$with_diskdefs; DISKDEFS="$withval"
-else
+else $as_nop
   DISKDEFS="$DISKDEFS"
 fi
 
 
 # Check whether --with-defformat was given.
-if test "${with_defformat+set}" = set; then :
+if test ${with_defformat+y}
+then :
   withval=$with_defformat; DEFFORMAT="$withval"
-else
+else $as_nop
   DEFFORMAT="ibm-3740"
 fi
 
 
 # Check whether --with-libdsk was given.
-if test "${with_libdsk+set}" = set; then :
+if test ${with_libdsk+y}
+then :
   withval=$with_libdsk; LIBDSK="$withval"
-else
+else $as_nop
   LIBDSK=""
 fi
 
 
-# Check whether --with-dmalloc was given.
-if test "${with_dmalloc+set}" = set; then :
-  withval=$with_dmalloc; CPPFLAGS="$CPPFLAGS -I$with_dmalloc/include"
-                 LDFLAGS="$LDFLAGS -L$with_dmalloc/lib"
-                 LIBS="$LIBS -ldmalloc"
-                 $as_echo "#define USE_DMALLOC 1" >>confdefs.h
-
-fi
-
-
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for printw in -lcurses" >&5
-$as_echo_n "checking for printw in -lcurses... " >&6; }
-if ${ac_cv_lib_curses_printw+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for printw in -lcurses" >&5
+printf %s "checking for printw in -lcurses... " >&6; }
+if test ${ac_cv_lib_curses_printw+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcurses  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char printw ();
-int
-main ()
-{
-return printw ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_curses_printw=yes
-else
-  ac_cv_lib_curses_printw=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_printw" >&5
-$as_echo "$ac_cv_lib_curses_printw" >&6; }
-if test "x$ac_cv_lib_curses_printw" = xyes; then :
-  FSED_CPM=fsed.cpm LIBS="-lcurses $LIBS"
-else
-  FSED_CPM=
-fi
-
-if test x"$FSED_CPM" = x""; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for printw in -lncurses" >&5
-$as_echo_n "checking for printw in -lncurses... " >&6; }
-if ${ac_cv_lib_ncurses_printw+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lncurses  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char printw ();
-int
-main ()
-{
-return printw ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ncurses_printw=yes
-else
-  ac_cv_lib_ncurses_printw=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_printw" >&5
-$as_echo "$ac_cv_lib_ncurses_printw" >&6; }
-if test "x$ac_cv_lib_ncurses_printw" = xyes; then :
-  FSED_CPM=fsed.cpm LIBS="-lncurses $LIBS"
-else
-  FSED_CPM=
-fi
-
-  if test x"$FSED_CPM" != x""; then
-    $as_echo "#define NEED_NCURSES 1" >>confdefs.h
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    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"
-      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
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    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"
-      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
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_EGREP_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+char printw ();
 int
-main ()
+main (void)
 {
-
+return printw ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
+if ac_fn_c_try_link "$LINENO"
+then :
+  ac_cv_lib_curses_printw=yes
+else $as_nop
+  ac_cv_lib_curses_printw=no
 fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-rm -f conftest*
-
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_printw" >&5
+printf "%s\n" "$ac_cv_lib_curses_printw" >&6; }
+if test "x$ac_cv_lib_curses_printw" = xyes
+then :
+  FSED_CPM=fsed.cpm LIBS="-lcurses $LIBS"
+else $as_nop
+  FSED_CPM=
 fi
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test x"$FSED_CPM" = x""; then
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for printw in -lncurses" >&5
+printf %s "checking for printw in -lncurses... " >&6; }
+if test ${ac_cv_lib_ncurses_printw+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncurses  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-                  (('a' <= (c) && (c) <= 'i') \
-                    || ('j' <= (c) && (c) <= 'r') \
-                    || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
 
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+char printw ();
 int
-main ()
+main (void)
 {
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-       || toupper (i) != TOUPPER (i))
-      return 2;
+return printw ();
+  ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+if ac_fn_c_try_link "$LINENO"
+then :
+  ac_cv_lib_ncurses_printw=yes
+else $as_nop
+  ac_cv_lib_ncurses_printw=no
 fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_printw" >&5
+printf "%s\n" "$ac_cv_lib_ncurses_printw" >&6; }
+if test "x$ac_cv_lib_ncurses_printw" = xyes
+then :
+  FSED_CPM=fsed.cpm LIBS="-lncurses $LIBS"
+else $as_nop
+  FSED_CPM=
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
 
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+  if test x"$FSED_CPM" != x""; then
+    printf "%s\n" "#define NEED_NCURSES 1" >>confdefs.h
+
+    ac_header= ac_cache=
+for ac_item in $ac_header_c_list
+do
+  if test $ac_cache; then
+    ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
+    if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
+      printf "%s\n" "#define $ac_item 1" >> confdefs.h
+    fi
+    ac_header= ac_cache=
+  elif test $ac_header; then
+    ac_cache=$ac_item
+  else
+    ac_header=$ac_item
+  fi
+done
 
-fi
 
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                 inttypes.h stdint.h unistd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
-fi
 
-done
 
 
-for ac_header in ncurses/ncurses.h
+
+
+if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
+then :
+
+printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+       for ac_header in ncurses/ncurses.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default"
-if test "x$ac_cv_header_ncurses_ncurses_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_NCURSES_NCURSES_H 1
-_ACEOF
+  ac_fn_c_check_header_compile "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default"
+if test "x$ac_cv_header_ncurses_ncurses_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_NCURSES_NCURSES_H 1" >>confdefs.h
  have_ncurses_ncurses_h=yes
 fi
 
 done
-
   fi
 fi
 
@@ -3748,11 +4048,12 @@ if test "$LIBDSK" != ""; then
   CPPFLAGS="$CPPFLAGS -I$LIBDSK/include"
   CFLAGS="$CFLAGS -I$LIBDSK/include $CFLAGS_LIBDSK"
   LDFLAGS="$LDFLAGS -L$LIBDSK/lib"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dsk_open in -ldsk" >&5
-$as_echo_n "checking for dsk_open in -ldsk... " >&6; }
-if ${ac_cv_lib_dsk_dsk_open+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dsk_open in -ldsk" >&5
+printf %s "checking for dsk_open in -ldsk... " >&6; }
+if test ${ac_cv_lib_dsk_dsk_open+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldsk  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3761,225 +4062,104 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
    builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
 char dsk_open ();
 int
-main ()
+main (void)
 {
 return dsk_open ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"
+then :
   ac_cv_lib_dsk_dsk_open=yes
-else
+else $as_nop
   ac_cv_lib_dsk_dsk_open=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dsk_dsk_open" >&5
-$as_echo "$ac_cv_lib_dsk_dsk_open" >&6; }
-if test "x$ac_cv_lib_dsk_dsk_open" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDSK 1
-_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dsk_dsk_open" >&5
+printf "%s\n" "$ac_cv_lib_dsk_dsk_open" >&6; }
+if test "x$ac_cv_lib_dsk_dsk_open" = xyes
+then :
+  printf "%s\n" "#define HAVE_LIBDSK 1" >>confdefs.h
 
   LIBS="-ldsk $LIBS"
 
 fi
 
-  for ac_header in libdsk.h
+         for ac_header in libdsk.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "libdsk.h" "ac_cv_header_libdsk_h" "$ac_includes_default"
-if test "x$ac_cv_header_libdsk_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDSK_H 1
-_ACEOF
+  ac_fn_c_check_header_compile "$LINENO" "libdsk.h" "ac_cv_header_libdsk_h" "$ac_includes_default"
+if test "x$ac_cv_header_libdsk_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_LIBDSK_H 1" >>confdefs.h
 
-else
+else $as_nop
   echo "No libdsk.h - aborting"; exit 1
 fi
 
 done
-
-fi
-
-if test x"$DEVICE" = x"win32"; then
-  for ac_header in windows.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default"
-if test "x$ac_cv_header_windows_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_WINDOWS_H 1
-_ACEOF
-
-else
-  echo "Device win32, but <windows.h> not found - aborting"; exit 1
-fi
-
-done
-
-  for ac_header in winioctl.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "winioctl.h" "ac_cv_header_winioctl_h" "#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-
-"
-if test "x$ac_cv_header_winioctl_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_WINIOCTL_H 1
-_ACEOF
-
-else
-  echo "Device win32, but <winioctl.h> not found - aborting"; exit 1
-fi
-
-done
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_header_stdc=yes
-else
-  ac_cv_header_stdc=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then :
 
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
+ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default"
+if test "x$ac_cv_header_fcntl_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h
 
 fi
+ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_types_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h
 
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then :
-
-else
-  ac_cv_header_stdc=no
 fi
-rm -f conftest*
+ac_fn_c_check_header_compile "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_stat_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_SYS_STAT_H 1" >>confdefs.h
 
 fi
+ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default"
+if test "x$ac_cv_header_limits_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-                  (('a' <= (c) && (c) <= 'i') \
-                    || ('j' <= (c) && (c) <= 'r') \
-                    || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-       || toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
-  ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
+ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h
 
 fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+ac_fn_c_check_header_compile "$LINENO" "sys/utime.h" "ac_cv_header_sys_utime_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_utime_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_SYS_UTIME_H 1" >>confdefs.h
 
 fi
-
-for ac_header in fcntl.h sys/types.h sys/stat.h limits.h unistd.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+ac_fn_c_check_header_compile "$LINENO" "utime.h" "ac_cv_header_utime_h" "$ac_includes_default"
+if test "x$ac_cv_header_utime_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_UTIME_H 1" >>confdefs.h
 
 fi
 
-done
-
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if ${ac_cv_c_const+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+printf %s "checking for an ANSI C-conforming const... " >&6; }
+if test ${ac_cv_c_const+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
-main ()
+main (void)
 {
 
 #ifndef __cplusplus
@@ -3992,7 +4172,7 @@ main ()
   /* NEC SVR4.0.2 mips cc rejects this.  */
   struct point {int x, y;};
   static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
+  /* IBM XL C 1.02.0.0 rejects this.
      It does not let you subtract one const X* pointer from another in
      an arm of an if-expression whose if-part is not a constant
      expression */
@@ -4020,7 +4200,7 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+  { /* IBM 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]; } bx;
     struct s *b = &bx; b->j = 5;
@@ -4036,77 +4216,112 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_c_const=yes
-else
+else $as_nop
   ac_cv_c_const=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+printf "%s\n" "$ac_cv_c_const" >&6; }
 if test $ac_cv_c_const = no; then
 
-$as_echo "#define const /**/" >>confdefs.h
+printf "%s\n" "#define const /**/" >>confdefs.h
 
 fi
 
 ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
-if test "x$ac_cv_type_mode_t" = xyes; then :
+if test "x$ac_cv_type_mode_t" = xyes
+then :
 
-else
+else $as_nop
 
-cat >>confdefs.h <<_ACEOF
-#define mode_t int
-_ACEOF
+printf "%s\n" "#define mode_t int" >>confdefs.h
 
 fi
 
 ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = xyes; then :
+if test "x$ac_cv_type_off_t" = xyes
+then :
 
-else
+else $as_nop
 
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
+printf "%s\n" "#define off_t long int" >>confdefs.h
 
 fi
 
-ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
-if test "x$ac_cv_type_pid_t" = xyes; then :
 
-else
+  ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default
+"
+if test "x$ac_cv_type_pid_t" = xyes
+then :
+
+else $as_nop
+                                          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+          #if defined _WIN64 && !defined __CYGWIN__
+          LLP64
+          #endif
+
+int
+main (void)
+{
+
+  ;
+  return 0;
+}
 
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_pid_type='int'
+else $as_nop
+  ac_pid_type='__int64'
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+
+printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h
+
 
 fi
 
+
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = xyes; then :
+if test "x$ac_cv_type_size_t" = xyes
+then :
 
-else
+else $as_nop
 
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
+printf "%s\n" "#define size_t unsigned int" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
-$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if ${ac_cv_struct_tm+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
+if test "x$ac_cv_type_ssize_t" = xyes
+then :
+
+else $as_nop
+
+printf "%s\n" "#define ssize_t int" >>confdefs.h
+
+fi
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
+printf %s "checking whether struct tm is in sys/time.h or time.h... " >&6; }
+if test ${ac_cv_struct_tm+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <time.h>
 
 int
-main ()
+main (void)
 {
 struct tm tm;
                                     int *p = &tm.tm_sec;
@@ -4115,35 +4330,38 @@ struct tm tm;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_struct_tm=time.h
-else
+else $as_nop
   ac_cv_struct_tm=sys/time.h
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
-$as_echo "$ac_cv_struct_tm" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+printf "%s\n" "$ac_cv_struct_tm" >&6; }
 if test $ac_cv_struct_tm = sys/time.h; then
 
-$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
+printf "%s\n" "#define TM_IN_SYS_TIME 1" >>confdefs.h
 
 fi
 
 
 
 # Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then :
+if test ${enable_largefile+y}
+then :
   enableval=$enable_largefile;
 fi
 
 if test "$enable_largefile" != no; then
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+printf %s "checking for special C compiler options needed for large files... " >&6; }
+if test ${ac_cv_sys_largefile_CC+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   ac_cv_sys_largefile_CC=no
      if test "$GCC" != yes; then
        ac_save_CC=$CC
@@ -4157,44 +4375,47 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-        if ac_fn_c_try_compile "$LINENO"; then :
+        if ac_fn_c_try_compile "$LINENO"
+then :
   break
 fi
-rm -f core conftest.err conftest.$ac_objext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
         CC="$CC -n32"
-        if ac_fn_c_try_compile "$LINENO"; then :
+        if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_sys_largefile_CC=' -n32'; break
 fi
-rm -f core conftest.err conftest.$ac_objext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
         break
        done
        CC=$ac_save_CC
        rm -f conftest.$ac_ext
     fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; }
   if test "$ac_cv_sys_largefile_CC" != no; then
     CC=$CC$ac_cv_sys_largefile_CC
   fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if ${ac_cv_sys_file_offset_bits+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test ${ac_cv_sys_file_offset_bits+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   while :; do
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -4203,22 +4424,23 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_sys_file_offset_bits=no; break
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #define _FILE_OFFSET_BITS 64
@@ -4227,43 +4449,43 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_sys_file_offset_bits=64; break
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
   ac_cv_sys_file_offset_bits=unknown
   break
 done
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; }
 case $ac_cv_sys_file_offset_bits in #(
   no | unknown) ;;
   *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
+printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h
 ;;
 esac
 rm -rf conftest*
   if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if ${ac_cv_sys_large_files+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+printf %s "checking for _LARGE_FILES value needed for large files... " >&6; }
+if test ${ac_cv_sys_large_files+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   while :; do
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -4272,22 +4494,23 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_sys_large_files=no; break
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #define _LARGE_FILES 1
@@ -4296,40 +4519,37 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
 int
-main ()
+main (void)
 {
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"
+then :
   ac_cv_sys_large_files=1; break
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
   ac_cv_sys_large_files=unknown
   break
 done
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+printf "%s\n" "$ac_cv_sys_large_files" >&6; }
 case $ac_cv_sys_large_files in #(
   no | unknown) ;;
   *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
+printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h
 ;;
 esac
 rm -rf conftest*
   fi
-
-
 fi
 
 
@@ -4337,19 +4557,21 @@ if test x"$FSED_CPM" != x""; then
   FSED_CPM="$FSED_CPM$EXEEXT"
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
-$as_echo_n "checking for working memcmp... " >&6; }
-if ${ac_cv_func_memcmp_working+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
+printf %s "checking for working memcmp... " >&6; }
+if test ${ac_cv_func_memcmp_working+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if test "$cross_compiling" = yes
+then :
   ac_cv_func_memcmp_working=no
-else
+else $as_nop
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
-main ()
+main (void)
 {
 
   /* Some versions of memcmp are not 8-bit clean.  */
@@ -4380,9 +4602,10 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
+if ac_fn_c_try_run "$LINENO"
+then :
   ac_cv_func_memcmp_working=yes
-else
+else $as_nop
   ac_cv_func_memcmp_working=no
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -4390,8 +4613,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
 fi
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
-$as_echo "$ac_cv_func_memcmp_working" >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
+printf "%s\n" "$ac_cv_func_memcmp_working" >&6; }
 test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
   *" memcmp.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
@@ -4399,21 +4622,22 @@ test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
 esac
 
 
-for ac_func in strftime
+
+  for ac_func in strftime
 do :
   ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
-if test "x$ac_cv_func_strftime" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STRFTIME 1
-_ACEOF
+if test "x$ac_cv_func_strftime" = xyes
+then :
+  printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h
 
-else
+else $as_nop
   # strftime is in -lintl on SCO UNIX.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
-$as_echo_n "checking for strftime in -lintl... " >&6; }
-if ${ac_cv_lib_intl_strftime+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
+printf %s "checking for strftime in -lintl... " >&6; }
+if test ${ac_cv_lib_intl_strftime+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lintl  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4422,49 +4646,49 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
    builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
 char strftime ();
 int
-main ()
+main (void)
 {
 return strftime ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"
+then :
   ac_cv_lib_intl_strftime=yes
-else
+else $as_nop
   ac_cv_lib_intl_strftime=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
-$as_echo "$ac_cv_lib_intl_strftime" >&6; }
-if test "x$ac_cv_lib_intl_strftime" = xyes; then :
-  $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
+printf "%s\n" "$ac_cv_lib_intl_strftime" >&6; }
+if test "x$ac_cv_lib_intl_strftime" = xyes
+then :
+  printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h
 
 LIBS="-lintl $LIBS"
 fi
 
 fi
+
 done
+ac_fn_c_check_func "$LINENO" "mktime" "ac_cv_func_mktime"
+if test "x$ac_cv_func_mktime" = xyes
+then :
+  printf "%s\n" "#define HAVE_MKTIME 1" >>confdefs.h
 
-for ac_func in mktime strerror
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+fi
+ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror"
+if test "x$ac_cv_func_strerror" = xyes
+then :
+  printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h
 
 fi
-done
 
 
 
@@ -4476,7 +4700,7 @@ eval DATADIR=$datadir
 
 
 
-ac_config_files="$ac_config_files Makefile cpm.5 cpmchattr.1 cpmchmod.1 cpmcp.1 cpmls.1 cpmrm.1 fsck.cpm.1 fsed.cpm.1 mkfs.cpm.1"
+ac_config_files="$ac_config_files Makefile cpm.5 cpmchattr.1 cpmchmod.1 cpmcp.1 cpmls.1 cpmrm.1 fsck.cpm.1 fsed.cpm.1 mkfs.cpm.1 diskdefs.5"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -4505,8 +4729,8 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
@@ -4536,15 +4760,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      /^ac_cv_env_/b end
      t clear
      :clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/
      t end
      s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
     if test "x$cache_file" != "x/dev/null"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+printf "%s\n" "$as_me: updating cache $cache_file" >&6;}
       if test ! -f "$cache_file" || test -h "$cache_file"; then
        cat confcache >"$cache_file"
       else
@@ -4558,8 +4782,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;}
       fi
     fi
   else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
@@ -4576,7 +4800,7 @@ U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
   as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
@@ -4592,8 +4816,8 @@ LTLIBOBJS=$ac_ltlibobjs
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;}
 as_write_fail=0
 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
@@ -4616,14 +4840,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+as_nop=:
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
-else
+else $as_nop
   case `(set -o) 2>/dev/null` in #(
   *posix*) :
     set -o posix ;; #(
@@ -4633,46 +4859,46 @@ esac
 fi
 
 
+
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
 as_nl='
 '
 export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-       expr "X$arg" : "X\\(.*\\)$as_nl";
-       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
+IFS=" ""       $as_nl"
+
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh).  This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2)            ; then :; else exec 2>/dev/null; fi
 
 # The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
+if ${PATH_SEPARATOR+false} :; then
   PATH_SEPARATOR=:
   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
@@ -4681,13 +4907,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
 fi
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""       $as_nl"
-
 # Find who we are.  Look in the path if we contain no directory separator.
 as_myself=
 case $0 in #((
@@ -4696,8 +4915,12 @@ case $0 in #((
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  case $as_dir in #(((
+    '') as_dir=./ ;;
+    */) ;;
+    *) as_dir=$as_dir/ ;;
+  esac
+    test -r "$as_dir$0" && as_myself=$as_dir$0 && break
   done
 IFS=$as_save_IFS
 
@@ -4709,30 +4932,10 @@ if test "x$as_myself" = x; then
   as_myself=$0
 fi
 if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
   exit 1
 fi
 
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
 # as_fn_error STATUS ERROR [LINENO LOG_FD]
@@ -4745,13 +4948,14 @@ as_fn_error ()
   as_status=$1; test $as_status -eq 0 && as_status=1
   if test "$4"; then
     as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+    printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $2" >&2
+  printf "%s\n" "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
 
+
 # as_fn_set_status STATUS
 # -----------------------
 # Set $? to STATUS, without forking.
@@ -4778,18 +4982,20 @@ as_fn_unset ()
   { eval $1=; unset $1;}
 }
 as_unset=as_fn_unset
+
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
 # advantage of any shell optimizations that allow amortized linear growth over
 # repeated appends, instead of the typical quadratic growth present in naive
 # implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
   eval 'as_fn_append ()
   {
     eval $1+=\$2
   }'
-else
+else $as_nop
   as_fn_append ()
   {
     eval $1=\$$1\$2
@@ -4801,12 +5007,13 @@ fi # as_fn_append
 # Perform arithmetic evaluation on the ARGs, and store the result in the
 # global $as_val. Take advantage of shells that can avoid forks. The arguments
 # must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
   eval 'as_fn_arith ()
   {
     as_val=$(( $* ))
   }'
-else
+else $as_nop
   as_fn_arith ()
   {
     as_val=`expr "$@" || test $? -eq 1`
@@ -4837,7 +5044,7 @@ as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
         X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
+printf "%s\n" X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
            s//\1/
            q
@@ -4859,6 +5066,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
 as_cr_digits='0123456789'
 as_cr_alnum=$as_cr_Letters$as_cr_digits
 
+
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
 ECHO_C= ECHO_N= ECHO_T=
 case `echo -n x` in #(((((
 -n*)
@@ -4872,6 +5083,12 @@ case `echo -n x` in #(((((
   ECHO_N='-n';;
 esac
 
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n.  New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
+
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
@@ -4913,7 +5130,7 @@ as_fn_mkdir_p ()
     as_dirs=
     while :; do
       case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
       *) as_qdir=$as_dir;;
       esac
       as_dirs="'$as_qdir' $as_dirs"
@@ -4922,7 +5139,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$as_dir" : 'X\(//\)[^/]' \| \
         X"$as_dir" : 'X\(//\)$' \| \
         X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
+printf "%s\n" X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -4985,7 +5202,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.69.  Invocation command line was
+generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -5043,14 +5260,16 @@ $config_headers
 Report bugs to the package provider."
 
 _ACEOF
+ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`
+ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"`
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.69,
+configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2021 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -5088,15 +5307,15 @@ do
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    $as_echo "$ac_cs_version"; exit ;;
+    printf "%s\n" "$ac_cs_version"; exit ;;
   --config | --confi | --conf | --con | --co | --c )
-    $as_echo "$ac_cs_config"; exit ;;
+    printf "%s\n" "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
     case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     '') as_fn_error $? "missing file argument" ;;
     esac
     as_fn_append CONFIG_FILES " '$ac_optarg'"
@@ -5104,7 +5323,7 @@ do
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
@@ -5113,7 +5332,7 @@ do
     as_fn_error $? "ambiguous option: \`$1'
 Try \`$0 --help' for more information.";;
   --help | --hel | -h )
-    $as_echo "$ac_cs_usage"; exit ;;
+    printf "%s\n" "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
     ac_cs_silent=: ;;
@@ -5141,7 +5360,7 @@ 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
   shift
-  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
   export CONFIG_SHELL
   exec "\$@"
@@ -5155,7 +5374,7 @@ exec 5>>config.log
   sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
 ## Running $as_me. ##
 _ASBOX
-  $as_echo "$ac_log"
+  printf "%s\n" "$ac_log"
 } >&5
 
 _ACEOF
@@ -5179,6 +5398,7 @@ do
     "fsck.cpm.1") CONFIG_FILES="$CONFIG_FILES fsck.cpm.1" ;;
     "fsed.cpm.1") CONFIG_FILES="$CONFIG_FILES fsed.cpm.1" ;;
     "mkfs.cpm.1") CONFIG_FILES="$CONFIG_FILES mkfs.cpm.1" ;;
+    "diskdefs.5") CONFIG_FILES="$CONFIG_FILES diskdefs.5" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -5190,8 +5410,8 @@ done
 # We use the long form for the default assignment because of an extremely
 # bizarre bug on SunOS 4.1.3.
 if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
+  test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
@@ -5527,7 +5747,7 @@ do
           esac ||
           as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
-      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
     done
 
@@ -5535,17 +5755,17 @@ do
     # use $as_me), people would be surprised to read:
     #    /* config.h.  Generated by config.status.  */
     configure_input='Generated from '`
-         $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+         printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
        `' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+printf "%s\n" "$as_me: creating $ac_file" >&6;}
     fi
     # Neutralize special characters interpreted by sed in replacement strings.
     case $configure_input in #(
     *\&* | *\|* | *\\* )
-       ac_sed_conf_input=`$as_echo "$configure_input" |
+       ac_sed_conf_input=`printf "%s\n" "$configure_input" |
        sed 's/[\\\\&|]/\\\\&/g'`;; #(
     *) ac_sed_conf_input=$configure_input;;
     esac
@@ -5562,7 +5782,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$ac_file" : 'X\(//\)[^/]' \| \
         X"$ac_file" : 'X\(//\)$' \| \
         X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
+printf "%s\n" X"$ac_file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -5586,9 +5806,9 @@ $as_echo X"$ac_file" |
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -5645,8 +5865,8 @@ ac_sed_dataroot='
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   ac_datarootdir_hack='
@@ -5689,9 +5909,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' \
       "$ac_tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
   rm -f "$ac_tmp/stdin"
@@ -5707,20 +5927,20 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   #
   if test x"$ac_file" != x-; then
     {
-      $as_echo "/* $configure_input  */" \
+      printf "%s\n" "/* $configure_input  */" >&1 \
       && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
     } >"$ac_tmp/config.h" \
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
+      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+printf "%s\n" "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$ac_tmp/config.h" "$ac_file" \
        || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
-    $as_echo "/* $configure_input  */" \
+    printf "%s\n" "/* $configure_input  */" >&1 \
       && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
       || as_fn_error $? "could not create -" "$LINENO" 5
   fi
@@ -5761,7 +5981,8 @@ if test "$no_create" != yes; then
   $ac_cs_success || as_fn_exit 1
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
+
index be9a55c8c3bf5a9d748f2e599e2ce725d34d238c..444aab92997b8914ff02fa17f41d587d754b9b4e 100644 (file)
@@ -1,18 +1,23 @@
 AC_INIT(cpmfs.c)
-AC_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
 AC_CANONICAL_HOST
-VERSION=2.20
-UPDATED='October 25, 2014'
+VERSION=2.23
+UPDATED='November 2, 2022'
 
 DEVICE="posix"
+TERM="curses"
 
 if test "$prefix" = NONE
 then
   case $host in
     *-linux-*)
     ;;
+    *-cygwin-*)
+      CYGWIN=yes
+    ;;
     *-pc-mingw32)
       CFLAGS_LIBDSK=-DNOTWINDLL
+      MINGW32=yes
     ;;
   esac
 fi
@@ -23,42 +28,21 @@ AC_PROG_CPP
 
 if test "$GCC" = yes
 then
-  CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wno-unused-parameter -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common"
+  CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wshadow -Wno-unused-parameter -Wunused -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common"
   LDFLAGS="${LDFLAGS} ${EXTRA_GLDFLAGS}-g"
 else
   CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
   LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
 fi
 
-AC_CYGWIN
-AC_MINGW32
-dnl Choose between posix and win32 drivers...
-DEVICE="posix"
-
 DISKDEFS='${datarootdir}/diskdefs'
 
-if test "$CYGWIN" = "yes"
-then
-  DEVICE="win32"
-#  DISKDEFS='%USERPROFILE%/diskdefs'
-fi
-if test "$MINGW32" = "yes"
-then
-  DEVICE="win32"
-#  DISKDEFS='%USERPROFILE%\\diskdefs'
-fi
-
 AC_ARG_WITH(diskdefs,[  --with-diskdefs         Specify diskdefs location], 
                [DISKDEFS="$withval"], [DISKDEFS="$DISKDEFS"])
 AC_ARG_WITH(defformat,[  --with-defformat        Specify default format (ibm-3740)], 
                [DEFFORMAT="$withval"], [DEFFORMAT="ibm-3740"])
 AC_ARG_WITH(libdsk,   [  --with-libdsk           Specify path to libdsk library], 
                [LIBDSK="$withval"], [LIBDSK=""])
-AC_ARG_WITH(dmalloc,  [  --with-dmalloc          Specify path to dmalloc library], 
-               [CPPFLAGS="$CPPFLAGS -I$with_dmalloc/include"
-                 LDFLAGS="$LDFLAGS -L$with_dmalloc/lib"
-                 LIBS="$LIBS -ldmalloc"
-                 AC_DEFINE(USE_DMALLOC)])
 
 dnl Check for curses. If not found, don't build fsed.cpm
 dnl Try both curses and ncurses
@@ -81,19 +65,8 @@ if test "$LIBDSK" != ""; then
   AC_CHECK_HEADERS(libdsk.h, ,[echo "No libdsk.h - aborting"; exit 1])
 fi
 
-dnl If using win32, check it's available. 
-if test x"$DEVICE" = x"win32"; then
-  AC_CHECK_HEADERS(windows.h, ,[echo "Device win32, but <windows.h> not found - aborting"; exit 1] )
-  AC_CHECK_HEADERS(winioctl.h, ,[echo "Device win32, but <winioctl.h> not found - aborting"; exit 1],
-[#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-])
-fi
-
 dnl Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h sys/types.h sys/stat.h limits.h unistd.h)
+AC_CHECK_HEADERS(fcntl.h sys/types.h sys/stat.h limits.h unistd.h sys/utime.h utime.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -101,6 +74,7 @@ AC_TYPE_MODE_T
 AC_TYPE_OFF_T
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
 AC_STRUCT_TM
 AC_EXEEXT
 AC_OBJEXT
@@ -125,4 +99,5 @@ AC_SUBST(DISKDEFS)
 AC_SUBST(DEFFORMAT)
 AC_SUBST(FSED_CPM)
 AC_SUBST(UPDATED)
-AC_OUTPUT(Makefile cpm.5 cpmchattr.1 cpmchmod.1 cpmcp.1 cpmls.1 cpmrm.1 fsck.cpm.1 fsed.cpm.1 mkfs.cpm.1 )
+AC_CONFIG_FILES(Makefile cpm.5 cpmchattr.1 cpmchmod.1 cpmcp.1 cpmls.1 cpmrm.1 fsck.cpm.1 fsed.cpm.1 mkfs.cpm.1 diskdefs.5)
+AC_OUTPUT
diff --git a/cpm.5 b/cpm.5
index 9f11ff98f6c9fbb4ced75d853b1bb0973167c3ee..4b14493dc6d2dff7d422a9021a4bcc4734250e5a 100644 (file)
--- a/cpm.5
+++ b/cpm.5
@@ -1,7 +1,7 @@
 .\" Believe it or not, reportedly there are nroffs which do not know \(en
 .if n .ds en -
 .if t .ds en \(en
-.TH CPM 5 "October 25, 2014" "CP/M tools" "File formats"
+.TH CPM 5 "October 10, 2022" "CP/M tools" "File formats"
 .SH NAME \"{{{roff}}}\"{{{
 cpm \- CP/M disk and file system format
 .\"}}}
@@ -32,7 +32,9 @@ A block is the smallest allocatable storage unit.  CP/M supports block
 sizes of 1024, 2048, 4096, 8192 and 16384 bytes.  Unfortunately, this
 format specification is not stored on the disk and there are lots of
 formats.  Accessing a block is performed by accessing its sectors, which
-are stored with the given software skew.
+are stored with the given software skew.  \fBcpmtools\fP always counts
+sectors starting with 0, as it deals with logical sectors.  CP/M uses physical
+sectors in the skew table, which often start with 1.
 .\"}}}
 .SS "Device areas" \"{{{
 A CP/M disk contains four areas:
@@ -64,6 +66,16 @@ convenience upper and lower case are both accepted and only the first
 letter is significant, thus 2KB, 8MB, 1000trk and 16sec are valid
 values.  The \fBoffset\fP must appear subsequent to track, sector and sector
 length values for the sector and track units to work.
+.LP
+Note that it is possible to reserve space between the directory and
+the beginning of data.  Although typically data follows the directory,
+some systems used this to store extra data instead of using more
+system tracks (see the fields \fBALV0\fP and \fBALV1\fP in the
+DPB).
+.LP
+There are disk formats that map multiple logical tracks onto a physical
+track, which allows a little bit more capacity in case the system image
+size does not match the physical track capacity well.
 .\"}}}
 .SS "Directory entries" \"{{{
 The directory is a sequence of directory entries (also called extents),
@@ -80,9 +92,10 @@ Al   Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al
 \fBSt\fP is the status; possible values are:
 .RS
 .sp
-0\*(en15: used for file, status is the user number
+0\*(en15: used for file, status is the user number.  CP/M 2.2 only documents
+0\*(en15 and CCP and PIP only offer those, but the BDOS allows to use 0\*(en31.
 .br
-16\*(en31: used for file, status is the user number (P2DOS)
+16\*(en31: used for file, status is the user number (P2DOS, CP/M 2.2)
 or used for password extent (CP/M 3 or higher)
 .br
 32: disc label
@@ -149,11 +162,13 @@ Rc stores the number of 128 byte records of the last used logical extent.
 Bc stores the number of bytes in the last used record.  The value 0 means
 128 for backward compatibility with CP/M 2.2, which did not support Bc.
 ISX records the number of unused instead of used bytes in Bc.
+This only applies to files with allocated blocks.  For an empty file, no
+block is allocated and Bc 0 has no meaning.
 .\"}}}
 .LP
 .\"{{{ Al     = allocated blocks
 \fBAl\fP stores block pointers.  If the disk capacity minus boot
-tracks but including the directory area is less than 256 blocks, Al
+tracks but including the directory area is less than or equal to 256 blocks, Al
 is interpreted as 16 byte-values, otherwise as 8 double-byte-values.
 Since the directory area is not subtracted, the directory area starts
 with block 0 and files can never allocate block 0, which is why this
index 5295621902befeb03b4fc7533f777baf954495d2..5c642e6b9dd998ae1778177bddb78382307908e0 100644 (file)
--- a/cpm.5.in
+++ b/cpm.5.in
@@ -32,7 +32,9 @@ A block is the smallest allocatable storage unit.  CP/M supports block
 sizes of 1024, 2048, 4096, 8192 and 16384 bytes.  Unfortunately, this
 format specification is not stored on the disk and there are lots of
 formats.  Accessing a block is performed by accessing its sectors, which
-are stored with the given software skew.
+are stored with the given software skew.  \fBcpmtools\fP always counts
+sectors starting with 0, as it deals with logical sectors.  CP/M uses physical
+sectors in the skew table, which often start with 1.
 .\"}}}
 .SS "Device areas" \"{{{
 A CP/M disk contains four areas:
@@ -64,6 +66,16 @@ convenience upper and lower case are both accepted and only the first
 letter is significant, thus 2KB, 8MB, 1000trk and 16sec are valid
 values.  The \fBoffset\fP must appear subsequent to track, sector and sector
 length values for the sector and track units to work.
+.LP
+Note that it is possible to reserve space between the directory and
+the beginning of data.  Although typically data follows the directory,
+some systems used this to store extra data instead of using more
+system tracks (see the fields \fBALV0\fP and \fBALV1\fP in the
+DPB).
+.LP
+There are disk formats that map multiple logical tracks onto a physical
+track, which allows a little bit more capacity in case the system image
+size does not match the physical track capacity well.
 .\"}}}
 .SS "Directory entries" \"{{{
 The directory is a sequence of directory entries (also called extents),
@@ -80,9 +92,10 @@ Al   Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al      Al
 \fBSt\fP is the status; possible values are:
 .RS
 .sp
-0\*(en15: used for file, status is the user number
+0\*(en15: used for file, status is the user number.  CP/M 2.2 only documents
+0\*(en15 and CCP and PIP only offer those, but the BDOS allows to use 0\*(en31.
 .br
-16\*(en31: used for file, status is the user number (P2DOS)
+16\*(en31: used for file, status is the user number (P2DOS, CP/M 2.2)
 or used for password extent (CP/M 3 or higher)
 .br
 32: disc label
@@ -149,11 +162,13 @@ Rc stores the number of 128 byte records of the last used logical extent.
 Bc stores the number of bytes in the last used record.  The value 0 means
 128 for backward compatibility with CP/M 2.2, which did not support Bc.
 ISX records the number of unused instead of used bytes in Bc.
+This only applies to files with allocated blocks.  For an empty file, no
+block is allocated and Bc 0 has no meaning.
 .\"}}}
 .LP
 .\"{{{ Al     = allocated blocks
 \fBAl\fP stores block pointers.  If the disk capacity minus boot
-tracks but including the directory area is less than 256 blocks, Al
+tracks but including the directory area is less than or equal to 256 blocks, Al
 is interpreted as 16 byte-values, otherwise as 8 double-byte-values.
 Since the directory area is not subtracted, the directory area starts
 with block 0 and files can never allocate block 0, which is why this
diff --git a/cpm.ps b/cpm.ps
deleted file mode 100644 (file)
index 6c63133..0000000
--- a/cpm.ps
+++ /dev/null
@@ -1,478 +0,0 @@
-%!PS-Adobe-3.0
-%%Creator: groff version 1.19
-%%CreationDate: Sun Feb  3 19:48:55 2013
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Bold
-%%+ font Times-Italic
-%%DocumentSuppliedResources: procset grops 1.19 0
-%%Pages: 4
-%%PageOrder: Ascend
-%%DocumentMedia: Default 595 842 0 () ()
-%%Orientation: Portrait
-%%EndComments
-%%BeginDefaults
-%%PageMedia: Default
-%%EndDefaults
-%%BeginProlog
-%%BeginResource: procset grops 1.19 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/MANUAL{
-statusdict begin/manualfeed true store end
-}bind def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/Fr{
-setrgbcolor fill
-}bind def
-/setcmykcolor where{
-pop
-/Fk{
-setcmykcolor fill
-}bind def
-}if
-/Fg{
-setgray fill
-}bind def
-/FL/fill load def
-/LW/setlinewidth load def
-/Cr/setrgbcolor load def
-/setcmykcolor where{
-pop
-/Ck/setcmykcolor load def
-}if
-/Cg/setgray load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-/setpagedevice{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%BeginFeature: *PageSize Default
-<< /PageSize [ 595 842 ] /ImagingBBox null >> setpagedevice
-%%EndFeature
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Bold
-%%IncludeResource: font Times-Italic
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
-def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron
-/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
-/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
-/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
-/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
-/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
-/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
-/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
-/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
-/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
-/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
-/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
-/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
-/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
-/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
-/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
-/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
-/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
-/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
-/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
-/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
-/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE
-/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 174.415(CPM\(5\) File)72 48 R 174.415
-(formats CPM\(5\))2.5 F/F1 10.95/Times-Bold@0 SF -.219(NA)72 84 S(ME)
-.219 E F0(cpm \255 CP/M disk and \214le system format)108 96 Q F1
-(DESCRIPTION)72 112.8 Q/F2 10/Times-Bold@0 SF(Characteristic sizes)87
-124.8 Q F0(Each CP/M disk format is described by the follo)108 136.8 Q
-(wing speci\214c sizes:)-.25 E(Sector size in bytes)144 160.8 Q
-(Number of tracks)144 172.8 Q(Number of sectors)144 184.8 Q(Block size)
-144 196.8 Q(Number of directory entries)144 208.8 Q(Logical sector sk)
-144 220.8 Q -.25(ew)-.1 G(Number of reserv)144 232.8 Q
-(ed system tracks \(optional\))-.15 E(Of)144 244.8 Q(fset to start of v)
--.25 E(olume \(optional\))-.2 E 2.848(Ab)108 268.8 S .348
-(lock is the smallest allocatable storage unit.)-2.848 F .347
-(CP/M supports block sizes of 1024, 2048, 4096, 8192 and)5.348 F .207
-(16384 bytes.)108 280.8 R(Unfortunately)5.207 E 2.707(,t)-.65 G .208(hi\
-s format speci\214cation is not stored on the disk and there are lots o\
-f formats.)-2.707 F(Accessing a block is performed by accessing its sec\
-tors, which are stored with the gi)108 292.8 Q -.15(ve)-.25 G 2.5(ns).15
-G(oftw)-2.5 E(are sk)-.1 E -.25(ew)-.1 G(.)-.4 E F2(De)87 309.6 Q
-(vice ar)-.15 E(eas)-.18 E F0 2.5(AC)108 321.6 S
-(P/M disk contains three areas:)-2.5 E -1.29(Vo)144 345.6 S(lume of)1.29
-E(fset \(optional\))-.25 E(System tracks \(optional\))144 357.6 Q
-(Directory)144 369.6 Q(Data)144 381.6 Q .058
-(The system tracks store the boot loader and CP/M itself.)108 405.6 R
-.058(In order to sa)5.058 F .358 -.15(ve d)-.2 H .057
-(isk space, there are non-bootable).15 F 1.55
-(formats which omit those system tracks.)108 417.6 R 1.55(The term)6.55
-F/F3 10/Times-Italic@0 SF 1.55(disk capacity)4.05 F F0(al)4.05 E -.1(wa)
--.1 G 1.55(ys e).1 F 1.55(xcludes the space for system)-.15 F 2.748
-(tracks. Note)108 429.6 R .248
-(that there is no bitmap or list for free blocks.)2.748 F .248
-(When accessing a dri)5.248 F .548 -.15(ve f)-.25 H .248
-(or the \214rst time, CP/M).15 F -.2(bu)108 441.6 S
-(ilds this bitmap in core from the directory).2 E(.)-.65 E 3.15(Ah)108
-458.4 S .65(ard disk can ha)-3.15 F .95 -.15(ve t)-.2 H .65
-(he additional notion of a).15 F F3 .65(volume of)3.15 F(fset)-.18 E F0
-.65(to locate the start of the dri)3.15 F .95 -.15(ve i)-.25 H .65
-(mage \(which).15 F .531(may or may not ha)108 470.4 R .831 -.15(ve s)
--.2 H .531(ystem tracks associated with it\). The base unit for v).15 F
-.53(olume of)-.2 F .53(fset is byte count from)-.25 F 1.224(the be)108
-482.4 R 1.224(ginning of the ph)-.15 F 1.224(ysical disk, b)-.05 F 1.225
-(ut speci\214ers of)-.2 F F3(K)3.725 E F0(,)A F3(M)3.725 E F0(,)A F3(T)
-3.725 E F0(or)3.725 E F3(S)3.725 E F0 1.225
-(may be appended to denote kilobytes,)3.725 F(me)108 494.4 Q -.05(ga)
--.15 G .806(bytes, tracks or sectors.).05 F .806(If pro)5.806 F .805
-(vided, a speci\214er must immediately follo)-.15 F 3.305(wt)-.25 G .805
-(he numeric v)-3.305 F .805(alue with no)-.25 F 2.881(whitespace. F)108
-506.4 R .381(or con)-.15 F -.15(ve)-.4 G .381(nience upper and lo).15 F
-.381(wer case are both accepted and only the \214rst letter is signi\
-\214cant,)-.25 F .02(thus 2KB, 8MB, 1000trk and 16sec are v)108 518.4 R
-.019(alid v)-.25 F .019(alues. Of)-.25 F .019
-(fset must appear subsequent to track, sector and sec-)-.25 F
-(tor length v)108 530.4 Q(alues.)-.25 E F2(Dir)87 547.2 Q
-(ectory entries)-.18 E F0 .408
-(The directory is a sequence of directory entries \(also called e)108
-559.2 R .409(xtents\), which contain 32 bytes of the follo)-.15 F(w-)
--.25 E(ing structure:)108 571.2 Q 4.16(St F0)144 595.2 R 1.94
-(F1 F2 F3 F4 F5 F6 F7 E0)4.44 F 1.39(E1 E2 Xl)3.89 F 1.39(Bc Xh)5 F(Rc)
-2.78 E 2.5(Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al)144 607.2 R
-F2(St)108 631.2 Q F0(is the status; possible v)2.5 E(alues are:)-.25 E
-(0\21115: used for \214le, status is the user number)144 655.2 Q .795(1\
-6\21131: used for \214le, status is the user number \(P2DOS\) or used f\
-or passw)144 667.2 R .794(ord e)-.1 F .794(xtent \(CP/M 3 or)-.15 F
-(higher\))144 679.2 Q(32: disc label)144 691.2 Q
-(33: time stamp \(P2DOS\))144 703.2 Q(0xE5: unused)144 715.2 Q
-(CP/M tools)72 768 Q(February 18, 2012)151.35 E(1)192.2 E 0 Cg EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 174.415(CPM\(5\) File)72 48 R 174.415
-(formats CPM\(5\))2.5 F/F1 10/Times-Bold@0 SF(F0\211E2)108 84 Q F0 .412
-(are the \214le name and its e)2.912 F 2.913(xtension. The)-.15 F 2.913
-(ym)-.15 G .413(ay consist of an)-2.913 F 2.913(yp)-.15 G .413
-(rintable 7 bit ASCII character b)-2.913 F(ut:)-.2 E F1(<)2.913 E 3.362
-(>.,;:=?*[])108 96 S F0 5.862(.T)-3.362 G .862
-(he \214le name must not be empty)-5.862 F 3.361(,t)-.65 G .861(he e)
--3.361 F .861(xtension may be empty)-.15 F 5.861(.B)-.65 G .861
-(oth are padded with)-5.861 F 2.831(blanks. The)108 108 R .331
-(highest bit of each character of the \214le name and e)2.831 F .331
-(xtension is used as attrib)-.15 F 2.832(ute. The)-.2 F(attrib)2.832 E
-(utes)-.2 E(ha)108 120 Q .3 -.15(ve t)-.2 H(he follo).15 E
-(wing meaning:)-.25 E(F0: requires set wheel byte \(Backgrounder II\))
-144 144 Q(F1: public \214le \(P2DOS, ZSDOS\), for)144 156 Q
-(ground-only command \(Backgrounder II\))-.18 E
-(F2: date stamp \(ZSDOS\), background-only commands \(Backgrounder II\))
-144 168 Q(F7: wheel protect \(ZSDOS\))144 180 Q(E0: read-only)144 192 Q
-(E1: system \214le)144 204 Q(E2: archi)144 216 Q -.15(ve)-.25 G(d).15 E
-.338(Public \214les \(visible under each user number\) are not supporte\
-d by CP/M 2.2, b)108 240 R .338(ut there is a patch and some)-.2 F
-(free CP/M clones support them without an)108 252 Q 2.5(yp)-.15 G
-(atches.)-2.5 E .827(The wheel byte is \(by def)108 268.8 R .828
-(ault\) the memory location at 0x4b)-.1 F 5.828(.I)-.4 G 3.328(fi)-5.828
-G 3.328(ti)-3.328 G 3.328(sz)-3.328 G .828(ero, only non-pri)-3.328 F
-(vile)-.25 E .828(ged commands)-.15 F(may be e)108 280.8 Q -.15(xe)-.15
-G(cuted.).15 E F1(Xl)108 297.6 Q F0(and)2.546 E F1(Xh)2.546 E F0 .046
-(store the e)2.546 F .046(xtent number)-.15 F 5.046(.A)-.55 G .045
-(\214le may use more than one directory entry)-2.5 F 2.545(,i)-.65 G
-2.545(fi)-2.545 G 2.545(tc)-2.545 G .045(ontains more blocks)-2.545 F
-.21(than an e)108 309.6 R .21(xtent can hold.)-.15 F .21
-(In this case, more e)5.21 F .21
-(xtents are allocated and each of them is numbered sequentially)-.15 F
-.457(with an e)108 321.6 R .457(xtent number)-.15 F 5.457(.I)-.55 G
-2.957(fap)-5.457 G -.05(hy)-2.957 G .457(sical e).05 F .456
-(xtent stores more than 16k, it is considered to contain multiple logi-)
--.15 F .234(cal e)108 333.6 R .234
-(xtents, each pointing to 16k data, and the e)-.15 F .234
-(xtent number of the last used logical e)-.15 F .235(xtent is stored.)
--.15 F(Note:)5.235 E 1.55(Some formats decided to al)108 345.6 R -.1(wa)
--.1 G 1.549(ys store only one logical e).1 F 1.549(xtent in a ph)-.15 F
-1.549(ysical e)-.05 F 1.549(xtent, thus w)-.15 F 1.549(asting e)-.1 F
-(xtent)-.15 E 2.81(space. CP/M)108 357.6 R .31(2.2 allo)2.81 F .31
-(ws 512 e)-.25 F .31(xtents per \214le, CP/M 3 and higher allo)-.15 F
-2.811(wu)-.25 G 2.811(pt)-2.811 G 2.811(o2)-2.811 G 2.811(048. Bit)
--2.811 F .311(5\2117 of Xl are 0, bit)2.811 F .577(0\2114 store the lo)
-108 369.6 R .577(wer bits of the e)-.25 F .576(xtent number)-.15 F 5.576
-(.B)-.55 G .576
-(it 6 and 7 of Xh are 0, bit 0\2115 store the higher bits of the)-5.576
-F -.15(ex)108 381.6 S(tent number).15 E(.)-.55 E F1(Rc)108 398.4 Q F0
-(and)2.946 E F1(Bc)2.946 E F0 .446
-(determine the length of the data used by this e)2.946 F 2.946
-(xtent. The)-.15 F(ph)2.947 E .447(ysical e)-.05 F .447(xtent is di)-.15
-F .447(vided into logical)-.25 F -.15(ex)108 410.4 S .156
-(tents, each of them being 16k in size \(a ph).15 F .156(ysical e)-.05 F
-.156(xtent must hold at least one logical e)-.15 F .156
-(xtent, e.g. a block-)-.15 F .053(size of 1024 byte with tw)108 422.4 R
-.054(o-byte block pointers is not allo)-.1 F 2.554(wed\). Rc)-.25 F .054
-(stores the number of 128 byte records of)2.554 F .457
-(the last used logical e)108 434.4 R 2.957(xtent. Bc)-.15 F .456
-(stores the number of bytes in the last used record.)2.957 F .456(The v)
-5.456 F .456(alue 0 means 128)-.25 F .654(for backw)108 446.4 R .654
-(ard compatibility with CP/M 2.2, which did not support Bc.)-.1 F .655
-(ISX records the number of unused)5.655 F(instead of used bytes in Bc.)
-108 458.4 Q F1(Al)108 475.2 Q F0 .9(stores block pointers.)3.4 F .899(I\
-f the disk capacity is less than 256 blocks, Al is interpreted as 16 by\
-te-v)5.9 F(alues,)-.25 E .243(otherwise as 8 double-byte-v)108 487.2 R
-2.743(alues. A)-.25 F .243
-(block pointer of 0 marks a hole in the \214le.)2.743 F .243
-(If a hole co)5.243 F -.15(ve)-.15 G .243(rs the range).15 F .341
-(of a full e)108 499.2 R .341(xtent, the e)-.15 F .341
-(xtent will not be allocated.)-.15 F .34(In particular)5.341 F 2.84(,t)
--.4 G .34(he \214rst e)-2.84 F .34
-(xtent of a \214le does not neccessarily)-.15 F(ha)108 511.2 Q .479 -.15
-(ve ex)-.2 H .179(tent number 0.).15 F 2.679<418c>5.179 G .18
-(le may not share blocks with other \214les, as its blocks w)-2.679 F
-.18(ould be freed if the other)-.1 F .822
-(\214les is erased without a follo)108 523.2 R .822
-(wing disk system reset.)-.25 F .822
-(CP/M returns EOF when it reaches a hole, whereas)5.822 F
-(UNIX returns zero-v)108 535.2 Q(alue bytes, which mak)-.25 E
-(es holes in)-.1 E(visible.)-.4 E F1(Nati)87 552 Q .2 -.1(ve t)-.1 H
-(ime stamps).1 E F0 1.053(P2DOS and CP/M Plus support time stamps, whic\
-h are stored in each fourth directory entry)108 564 R 6.054(.T)-.65 G
-1.054(his entry)-6.054 F 1.3(contains the time stamps for the e)108 576
-R 1.299(xtents using the pre)-.15 F 1.299
-(vious three directory entries.)-.25 F 1.299(Note that you really)6.299
-F(ha)108 588 Q 1.294 -.15(ve t)-.2 H .994(ime stamps for each e).15 F
-.994(xtent, no matter if it is the \214rst e)-.15 F .994
-(xtent of a \214le or not.)-.15 F .995(The structure of time)5.994 F
-(stamp entries is:)108 600 Q 2.5(1b)144 624 S(yte status 0x21)-2.5 E 2.5
-(8b)144 636 S(ytes time stamp for third-last directory entry)-2.5 E 2.5
-(2b)144 648 S(ytes unused)-2.5 E 2.5(8b)144 660 S
-(ytes time stamp for second-last directory entry)-2.5 E 2.5(2b)144 672 S
-(ytes unused)-2.5 E 2.5(8b)144 684 S
-(ytes time stamp for last directory entry)-2.5 E 2.872(At)108 708 S .372
-(ime stamp consists of tw)-2.872 F 2.872(od)-.1 G .372(ates: Creation a\
-nd modi\214cation date \(the latter being recorded when the \214le)
--2.872 F .935(is closed\).)108 720 R .936(CP/M Plus further allo)5.935 F
-.936(ws optionally to record the access instead of creation date as \
-\214rst time)-.25 F(CP/M tools)72 768 Q(February 18, 2012)151.35 E(2)
-192.2 E 0 Cg EP
-%%Page: 3 3
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 174.415(CPM\(5\) File)72 48 R 174.415
-(formats CPM\(5\))2.5 F(stamp.)108 84 Q 2.5(2b)144 108 S
-(ytes \(little-endian\) days starting with 1 at 01-01-1978)-2.5 E 2.5
-(1b)144 120 S(yte hour in BCD format)-2.5 E 2.5(1b)144 132 S
-(yte minute in BCD format)-2.5 E/F1 10/Times-Bold@0 SF
-(DateStamper time stamps)87 160.8 Q F0 .552(The DateStamper softw)108
-172.8 R .552(are added functions to the BDOS to manage time stamps by a\
-llocating a read only)-.1 F .441(\214le with the name "!!!TIME&.D)108
-184.8 R -1.11(AT)-.4 G 2.941("i)1.11 G 2.941(nt)-2.941 G .441(he v)
--2.941 F .441(ery \214rst directory entry)-.15 F 2.941(,c)-.65 G -.15
-(ove)-2.941 G .441(ring the v).15 F .442(ery \214rst data blocks.)-.15 F
-(It)5.442 E(contains one entry per directory entry with the follo)108
-196.8 Q(wing structure of 16 bytes:)-.25 E 2.5(5b)144 220.8 S
-(ytes create date\214eld)-2.5 E 2.5(5b)144 232.8 S
-(ytes access date\214eld)-2.5 E 2.5(5b)144 244.8 S
-(ytes modify date\214eld)-2.5 E 2.5(1b)144 256.8 S(yte checksum)-2.5 E
-.237(The checksum is only used on e)108 280.8 R -.15(ve)-.25 G .236(ry \
-8th entry \(last entry in 128-byte record\) and is the sum of the \214r\
-st 127).15 F(bytes of the record.)108 292.8 Q
-(Each date\214eld has this structure:)5 E 2.5(1b)144 316.8 S
-(yte BCD coded year \(no century)-2.5 E 2.5(,s)-.65 G 2.5(oi)-2.5 G 2.5
-(ti)-2.5 G 2.5(ss)-2.5 G(ane assuming an)-2.5 E 2.5(yy)-.15 G
-(ear < 70 means 21st century\))-2.5 E 2.5(1b)144 328.8 S
-(yte BCD coded month)-2.5 E 2.5(1b)144 340.8 S(yte BCD coded day)-2.5 E
-2.608(1b)144 352.8 S .108(yte BCD coded hour or)-2.608 F 2.608(,i)-.4 G
-2.608(ft)-2.608 G .108(he high bit is set, the high byte of a counter f\
-or systems without real)-2.608 F(time clock)144 364.8 Q 2.5(1b)144 376.8
-S(yte BCD coded minute, or the lo)-2.5 E 2.5(wb)-.25 G
-(yte of the counter)-2.5 E F1(Disc labels)87 405.6 Q F0 .258(CP/M Plus \
-support disc labels, which are stored in an arbitrary directory entry)
-108 417.6 R 5.257(.T)-.65 G .257(he structure of disc labels)-5.257 F
-(is:)108 429.6 Q 2.5(1b)144 453.6 S(yte status 0x20)-2.5 E F1(F0\211E2)
-144 465.6 Q F0(are the disc label)2.5 E 2.886(1b)144 477.6 S .386
-(yte mode: bit 7 acti)-2.886 F -.25(va)-.25 G .386(tes passw).25 F .387
-(ord protection, bit 6 causes time stamps on access, b)-.1 F .387
-(ut 5 causes)-.2 F .874(time stamps on modi\214cations, bit 4 causes ti\
-me stamps on creation and bit 0 is set when a label)144 489.6 R -.15(ex)
-144 501.6 S 2.5(ists. Bit).15 F 2.5(4a)2.5 G(nd 6 are e)-2.5 E(xclusi)
--.15 E -.15(ve)-.25 G(ly set.).15 E 3.45(1b)144 513.6 S .95(yte passw)
--3.45 F .95(ord decode byte: T)-.1 F 3.45(od)-.8 G .951(ecode the passw)
--3.45 F .951(ord, xor this byte with the passw)-.1 F .951(ord bytes in)
--.1 F(re)144 525.6 Q -.15(ve)-.25 G(rse order).15 E 5(.T)-.55 G 2.5(oe)
--5.8 G(ncode a passw)-2.5 E
-(ord, add its characters to get the decode byte.)-.1 E 2.5(2r)144 537.6
-S(eserv)-2.5 E(ed bytes)-.15 E 2.5(8p)144 549.6 S(assw)-2.5 E(ord bytes)
--.1 E 2.5(4b)144 561.6 S(ytes label creation time stamp)-2.5 E 2.5(4b)
-144 573.6 S(ytes label modi\214cation time stamp)-2.5 E F1 -.1(Pa)87
-602.4 S(ssw).1 E(ords)-.1 E F0 1.484(CP/M Plus supports passw)108 614.4
-R 1.484(ords, which are stored in an arbitrary directory entry)-.1 F
-6.484(.T)-.65 G 1.484(he structure of these)-6.484 F(entries is:)108
-626.4 Q 2.5(1b)144 650.4 S(yte status \(user number plus 16\))-2.5 E F1
-(F0\211E2)144 662.4 Q F0(are the \214le name and its e)2.5 E(xtension.)
--.15 E 3.171(1b)144 674.4 S .671(yte passw)-3.171 F .671
-(ord mode: bit 7 means passw)-.1 F .672
-(ord required for reading, bit 6 for writing and bit 5 for)-.1 F
-(deleting.)144 686.4 Q 3.451(1b)144 698.4 S .951(yte passw)-3.451 F .951
-(ord decode byte: T)-.1 F 3.451(od)-.8 G .951(ecode the passw)-3.451 F
-.95(ord, xor this byte with the passw)-.1 F .95(ord bytes in)-.1 F(re)
-144 710.4 Q -.15(ve)-.25 G(rse order).15 E 5(.T)-.55 G 2.5(oe)-5.8 G
-(ncode a passw)-2.5 E(ord, add its characters to get the decode byte.)
--.1 E 2.5(2r)144 722.4 S(eserv)-2.5 E(ed bytes)-.15 E(CP/M tools)72 768
-Q(February 18, 2012)151.35 E(3)192.2 E 0 Cg EP
-%%Page: 4 4
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 174.415(CPM\(5\) File)72 48 R 174.415
-(formats CPM\(5\))2.5 F 2.5(8p)144 84 S(assw)-2.5 E(ord bytes)-.1 E/F1
-10.95/Times-Bold@0 SF(SEE ALSO)72 112.8 Q/F2 10/Times-Italic@0 SF
-(mkfs.cpm)108 124.8 Q F0(\(1\),).32 E F2(fsc)2.5 E(k.cpm)-.2 E F0
-(\(1\),).32 E F2(fsed.cpm)2.5 E F0(\(1\),).32 E F2(cpmls)2.5 E F0(\(1\))
-.27 E(CP/M tools)72 768 Q(February 18, 2012)151.35 E(4)192.2 E 0 Cg EP
-%%Trailer
-end
-%%EOF
index f130d5c2da8753b049841d15433bef096fb14589..909b7285f135e74ea5a436c2ade2f9846a994646 100644 (file)
@@ -1,4 +1,4 @@
-.TH CPMCHATTR 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH CPMCHATTR 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME \"{{{roff}}}\"{{{
 cpmchattr \- change file attributes on CP/M files
 .\"}}}
@@ -7,6 +7,7 @@ cpmchattr \- change file attributes on CP/M files
 .B cpmchattr
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .I attrib
 .I file-pattern
@@ -22,6 +23,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .IP "\fIattrib\fP"
 Set the file attributes as given.
 .\"}}}
@@ -67,7 +70,7 @@ CPMTOOLSFMT   Default format
 ${prefix}/share/diskdefs       CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de> and copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index b1690b0db2bc7dd15545ca5a47949678a4661f03..6af5cb0d90ebbec0a9c2090b88aa4a4336b0e64f 100644 (file)
@@ -7,6 +7,7 @@ cpmchattr \- change file attributes on CP/M files
 .B cpmchattr
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .I attrib
 .I file-pattern
@@ -22,6 +23,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .IP "\fIattrib\fP"
 Set the file attributes as given.
 .\"}}}
@@ -67,7 +70,7 @@ CPMTOOLSFMT   Default format
 @DATADIR@/diskdefs     CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de> and copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index be39130b86b056d0c993b22b1072b0fe9afef0cb..4ab7aaff93dce431dd20a41d0941bc4c1942df9b 100644 (file)
@@ -8,10 +8,6 @@
 
 #include "getopt_.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 const char cmd[]="cpmchattr";
@@ -23,6 +19,7 @@ int main(int argc, char *argv[]) /*{{{*/
   const char *image;
   const char *format;
   const char *devopts=NULL;
+  int uppercase=0;
   int c,i,usage=0,exitcode=0;
   struct cpmSuperBlock drive;
   struct cpmInode root;
@@ -33,10 +30,11 @@ int main(int argc, char *argv[]) /*{{{*/
 
   /* parse options */ /*{{{*/
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c)
   {
     case 'T': devopts=optarg; break;
     case 'f': format=optarg; break;
+    case 'u': uppercase=1; break;
     case 'h':
     case '?': usage=1; break;
   }
@@ -50,7 +48,7 @@ int main(int argc, char *argv[]) /*{{{*/
 
   if (usage)
   {
-    fprintf(stderr,"Usage: %s [-f format] [-T dsktype] image [NMrsa1234] pattern ...\n",cmd);
+    fprintf(stderr,"Usage: %s [-f format] [-T dsktype] [-u] image [NMrsa1234] pattern ...\n",cmd);
     exit(1);
   }
   /*}}}*/
@@ -60,7 +58,7 @@ int main(int argc, char *argv[]) /*{{{*/
     fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
     exit(1);
   }
-  if (cpmReadSuper(&drive,&root,format)==-1)
+  if (cpmReadSuper(&drive,&root,format,uppercase)==-1)
   {
     fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
index 1b8329f0c0d329f9e72b42b37c8b1c53748975ba..5481e4514ff2e6526a3c9276b0342901ba0a5877 100644 (file)
@@ -1,4 +1,4 @@
-.TH CPMCHMOD 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH CPMCHMOD 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME \"{{{roff}}}\"{{{
 cpmchmod \- change file mode on CP/M files
 .\"}}}
@@ -7,6 +7,7 @@ cpmchmod \- change file mode on CP/M files
 .B cpmchmod
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .I mode
 .I file-pattern
@@ -22,6 +23,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .IP "\fImode\fP"
 Octal file mode, as used in \fIchmod\fP(1).
 .\"}}}
@@ -38,7 +41,7 @@ CPMTOOLSFMT     Default format
 ${prefix}/share/diskdefs       CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de> and copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index 780e38317ac03c21656eed32bc9f15ae7384e53d..0af679c09e45a6612b0a869311aa894b958d3da6 100644 (file)
@@ -7,6 +7,7 @@ cpmchmod \- change file mode on CP/M files
 .B cpmchmod
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .I mode
 .I file-pattern
@@ -22,6 +23,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .IP "\fImode\fP"
 Octal file mode, as used in \fIchmod\fP(1).
 .\"}}}
@@ -38,7 +41,7 @@ CPMTOOLSFMT     Default format
 @DATADIR@/diskdefs     CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de> and copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index ad146965cfad8c1d128363512a0603a3cfcb12b1..a917ae754400bdb0c32b06c9605ec3eb3420c462 100644 (file)
@@ -9,10 +9,6 @@
 
 #include "getopt_.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 const char cmd[]="cpmchmod";
@@ -24,6 +20,7 @@ int main(int argc, char *argv[]) /*{{{*/
   const char *image;
   const char *format;
   const char *devopts=NULL;
+  int uppercase=0;
   int c,i,usage=0,exitcode=0;
   struct cpmSuperBlock drive;
   struct cpmInode root;
@@ -34,10 +31,11 @@ int main(int argc, char *argv[]) /*{{{*/
 
   /* parse options */ /*{{{*/
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c)
   {
     case 'T': devopts=optarg; break;
     case 'f': format=optarg; break;
+    case 'u': uppercase=1; break;
     case 'h':
     case '?': usage=1; break;
   }
@@ -51,7 +49,7 @@ int main(int argc, char *argv[]) /*{{{*/
 
   if (usage)
   {
-    fprintf(stderr,"Usage: %s [-f format] image mode pattern ...\n",cmd);
+    fprintf(stderr,"Usage: %s [-f format] [-u] image mode pattern ...\n",cmd);
     exit(1);
   }
   /*}}}*/
@@ -61,7 +59,7 @@ int main(int argc, char *argv[]) /*{{{*/
     fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
     exit(1);
   }
-  if (cpmReadSuper(&drive,&root,format)==-1)
+  if (cpmReadSuper(&drive,&root,format,uppercase)==-1)
   {
     fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
diff --git a/cpmcp.1 b/cpmcp.1
index 6eae3feaed5c8337dc96be709b3267f64a3b7fed..87d0eb74b0273ebe9b52235601b2b3e6986519d8 100644 (file)
--- a/cpmcp.1
+++ b/cpmcp.1
@@ -1,4 +1,4 @@
-.TH CPMCP 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH CPMCP 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME \"{{{roff}}}\"{{{
 cpmcp \- copy files from and to CP/M disks
 .\"}}}
@@ -10,6 +10,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIuser\fP\fB:\fP\fIfile\fP \fIfile\fP
 .br
 .B cpmcp
@@ -18,6 +19,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIuser\fP\fB:\fP\fIfile\fP ... \fIdirectory\fP
 .br
 .B cpmcp
@@ -26,6 +28,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIfile\fP \fIuser\fP\fB:\fP\fIfile\fP
 .br
 .B cpmcp
@@ -34,6 +37,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIfile\fP ... \fIuser\fP\fB:\fP
 .ad b
 .\"}}}
@@ -48,6 +52,11 @@ You can use \fB*\fP and \fB?\fP in CP/M file names, which have the same
 meaning in
 .IR sh (1)
 file name patterns.
+.PP
+On CP/M, the slash is a legal file name character.  When copying such files
+to the host, it is translated to a comma.  Filenames with a comma have that
+translated back to a slash on CP/M.  That is no restriction, because a comma
+is not a legal CP/M filename character.
 .\"}}}
 .SH OPTIONS \"{{{
 .IP "\fB\-f\fP \fIformat\fP"
@@ -60,6 +69,8 @@ Preserve time stamps when copying files from CP/M to UNIX (not
 implemented for copying the other way so far).
 .IP \fB\-t\fP
 Convert text files between CP/M and UNIX conventions.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -74,7 +85,7 @@ CPMTOOLSFMT     Default format
 ${prefix}/share/diskdefs       CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index 33bff1b9afc9b6a62068879d11eee8bfd4111fd8..9751d6186b50f634d5cd9e16d95ddab854e29020 100644 (file)
@@ -10,6 +10,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIuser\fP\fB:\fP\fIfile\fP \fIfile\fP
 .br
 .B cpmcp
@@ -18,6 +19,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIuser\fP\fB:\fP\fIfile\fP ... \fIdirectory\fP
 .br
 .B cpmcp
@@ -26,6 +28,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIfile\fP \fIuser\fP\fB:\fP\fIfile\fP
 .br
 .B cpmcp
@@ -34,6 +37,7 @@ cpmcp \- copy files from and to CP/M disks
 .RB [ \-p ]
 .RB [ \-t ]
 .I image
+.RB [ \-u ]
 \fIfile\fP ... \fIuser\fP\fB:\fP
 .ad b
 .\"}}}
@@ -48,6 +52,11 @@ You can use \fB*\fP and \fB?\fP in CP/M file names, which have the same
 meaning in
 .IR sh (1)
 file name patterns.
+.PP
+On CP/M, the slash is a legal file name character.  When copying such files
+to the host, it is translated to a comma.  Filenames with a comma have that
+translated back to a slash on CP/M.  That is no restriction, because a comma
+is not a legal CP/M filename character.
 .\"}}}
 .SH OPTIONS \"{{{
 .IP "\fB\-f\fP \fIformat\fP"
@@ -60,6 +69,8 @@ Preserve time stamps when copying files from CP/M to UNIX (not
 implemented for copying the other way so far).
 .IP \fB\-t\fP
 Convert text files between CP/M and UNIX conventions.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -74,7 +85,7 @@ CPMTOOLSFMT     Default format
 @DATADIR@/diskdefs     CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
diff --git a/cpmcp.c b/cpmcp.c
index 561c451f51a439d4134e4a42b37d42a027965c9a..bf7c7262d6bd66c9a77a452eabba37e2a0207418 100644 (file)
--- a/cpmcp.c
+++ b/cpmcp.c
@@ -9,14 +9,10 @@
 #include <string.h>
 #include <limits.h>
 #include <stdlib.h>
-#include <utime.h>
+#include <time.h>
 
 #include "getopt_.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 const char cmd[]="cpmcp";
@@ -60,7 +56,7 @@ static int cpmToUnix(const struct cpmInode *root, const char *src, const char *d
     {
       int crpending=0;
       int ohno=0;
-      int res;
+      ssize_t res;
       char buf[4096];
 
       while ((res=cpmRead(&file,buf,sizeof(buf)))>0)
@@ -126,6 +122,7 @@ int main(int argc, char *argv[])
   const char *image;
   const char *format;
   const char *devopts=NULL;
+  int uppercase=0;
   int c,readcpm=-1,todir=-1;
   struct cpmInode root;
   struct cpmSuperBlock super;
@@ -136,14 +133,15 @@ int main(int argc, char *argv[])
 
   /* parse options */ /*{{{*/
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"T:f:h?pt"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"T:f:ptuh?"))!=EOF) switch(c)
   {
     case 'T': devopts=optarg; break;
     case 'f': format=optarg; break;
-    case 'h':
-    case '?': usage(); break;
     case 'p': preserve=1; break;
     case 't': text=1; break;
+    case 'u': uppercase=1; break;
+    case 'h':
+    case '?': usage(); break;
   }
   /*}}}*/
   /* parse arguments */ /*{{{*/
@@ -181,7 +179,7 @@ int main(int argc, char *argv[])
     fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
     exit(1);
   }
-  if (cpmReadSuper(&super,&root,format)==-1)
+  if (cpmReadSuper(&super,&root,format,uppercase)==-1)
   {
     fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
@@ -201,9 +199,13 @@ int main(int argc, char *argv[])
 
       if (todir)
       {
+        char *translate;
+
         strcpy(dest,last);
         strcat(dest,"/");
+        translate=dest+strlen(dest);
         strcat(dest,gargv[i]+2);
+        while ((translate=strchr(translate,'/'))) *translate=',';
       }
       else strcpy(dest,last);
       if (cpmToUnix(&root,gargv[i],dest)) exitcode=1;
@@ -231,6 +233,7 @@ int main(int argc, char *argv[])
       {
         struct cpmInode ino;
         char cpmname[2+8+1+3+1]; /* 00foobarxy.zzy\0 */
+        char *translate;
         struct stat st;
 
         stat(argv[i],&st);
@@ -244,6 +247,10 @@ int main(int argc, char *argv[])
         {
           snprintf(cpmname,sizeof(cpmname),"%02d%s",userNumber(argv[argc-1]),strchr(argv[argc-1],':')+1);
         }
+
+        translate=cpmname;
+        while ((translate=strchr(translate,','))) *translate='/';
+
         if (cpmCreat(&root,cpmname,&ino,0666)==-1) /* just cry */ /*{{{*/
         {
           fprintf(stderr,"%s: can not create %s: %s\n",cmd,cpmname,boo);
@@ -259,15 +266,15 @@ int main(int argc, char *argv[])
           cpmOpen(&ino,&file,O_WRONLY);
           do
           {
-            unsigned int j;
+            ssize_t j;
 
-            for (j=0; j<(sizeof(buf)/2) && (c=getc(ufp))!=EOF; ++j)
+            for (j=0; j<((ssize_t)sizeof(buf)/2) && (c=getc(ufp))!=EOF; ++j)
             {
               if (text && c=='\n') buf[j++]='\r';
               buf[j]=c;
             }
             if (text && c==EOF) buf[j++]='\032';
-            if (cpmWrite(&file,buf,j)!=(ssize_t)j)
+            if (cpmWrite(&file,buf,j)!=j)
             {
               fprintf(stderr,"%s: can not write %s: %s\n",cmd,dest,boo);
               ohno=1;
@@ -289,11 +296,19 @@ int main(int argc, char *argv[])
             cpmUtime(&ino,&times);
           }
         }
-        fclose(ufp);
+        if (fclose(ufp)==EOF)
+        {
+          fprintf(stderr,"%s: can not close %s: %s\n",cmd,dest,strerror(errno));
+          exitcode=1;
+        }
       }
     }
   }
   /*}}}*/
-  cpmUmount(&super);
+  if (cpmUmount(&super)==-1)
+  {
+    fprintf(stderr,"%s: can not umount device: %s\n",cmd,boo);
+    exitcode=1;
+  }
   exit(exitcode);
 }
diff --git a/cpmfs.c b/cpmfs.c
index 22b5dea35e12db90fbb970e6e6da68fbcd0f17b8..8193116e0ce7f5efcce72c829fc018decfc7dc22 100644 (file)
--- a/cpmfs.c
+++ b/cpmfs.c
 
 #include "cpmdir.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 /* #defines */ /*{{{*/
 #undef CPMFS_DEBUG
@@ -46,13 +42,12 @@ maxdir+2 the optional disk label. */
 #define PASSWD_RECLEN 24
 /*}}}*/
 
-extern char **environ;
-const char *boo;
+char const *boo;
 static mode_t s_ifdir=1;
 static mode_t s_ifreg=1;
 
 /* memcpy7            -- Copy string, leaving 8th bit alone      */ /*{{{*/
-static void memcpy7(char *dest, const char *src, int count)
+static void memcpy7(char *dest, char const *src, int count)
 {
   while (count--)
   {
@@ -65,11 +60,11 @@ static void memcpy7(char *dest, const char *src, int count)
 
 /* file name conversions */ 
 /* splitFilename      -- split file name into name and extension */ /*{{{*/
-static int splitFilename(const char *fullname, int type, char *name, char *ext, int *user) 
+static int splitFilename(char const *fullname, int type, char *name, char *ext, int *user) 
 {
   int i,j;
 
-  assert(fullname!=(const char*)0);
+  assert(fullname!=(char const *)0);
   assert(name!=(char*)0);
   assert(ext!=(char*)0);
   assert(user!=(int*)0);
@@ -112,14 +107,14 @@ static int splitFilename(const char *fullname, int type, char *name, char *ext,
 }
 /*}}}*/
 /* isMatching         -- do two file names match?                */ /*{{{*/
-static int isMatching(int user1, const char *name1, const char *ext1, int user2, const char *name2, const char *ext2)
+static int isMatching(int user1, char const *name1, char const *ext1, int user2, char const *name2, char const *ext2)
 {
   int i;
 
-  assert(name1!=(const char*)0);
-  assert(ext1!=(const char*)0);
-  assert(name2!=(const char*)0);
-  assert(ext2!=(const char*)0);
+  assert(name1!=(char const *)0);
+  assert(ext1!=(char const *)0);
+  assert(name2!=(char const *)0);
+  assert(ext2!=(char const *)0);
   if (user1!=user2) return 0;
   for (i=0; i<8; ++i) if ((name1[i]&0x7f)!=(name2[i]&0x7f)) return 0;
   for (i=0; i<3; ++i) if ((ext1[i]&0x7f)!=(ext2[i]&0x7f)) return 0;
@@ -148,6 +143,7 @@ static time_t cpm2unix_time(int days, int hour, int min)
   tms=*localtime(&lt);
   old_environ=environ;
   environ=gmt_env;
+  tms.tm_isdst=0;
   lt=mktime(&tms);
   lt-=t;
   tms.tm_sec=0;
@@ -263,7 +259,17 @@ static void alvInit(const struct cpmSuperBlock *d)
   memset(d->alv,0,d->alvSize*sizeof(int));
   /*}}}*/
   /* mark directory blocks as used */ /*{{{*/
-  *d->alv=(1<<((d->maxdir*32+d->blksiz-1)/d->blksiz))-1;
+  /* A directory may cover more blocks than an int may hold bits,
+   * so a loop is needed.
+   */
+  for (block=0; block<d->dirblks; ++block)
+  {
+    offset = block/INTBITS;
+    d->alv[offset] |= (1<<(block%INTBITS));
+#ifdef CPMFS_DEBUG
+    fprintf(stderr,"alvInit: allocate directory block %d\n",block);
+#endif
+  } 
   /*}}}*/
   for (i=0; i<d->maxdir; ++i) /* mark file blocks as used */ /*{{{*/
   {
@@ -275,7 +281,7 @@ static void alvInit(const struct cpmSuperBlock *d)
       for (j=0; j<16; ++j)
       {
         block=(unsigned char)d->dir[i].pointers[j];
-        if (d->size>=256) block+=(((unsigned char)d->dir[i].pointers[++j])<<8);
+        if (d->size>256) block+=(((unsigned char)d->dir[i].pointers[++j])<<8);
         if (block && block<d->size)
         {
 #ifdef CPMFS_DEBUG
@@ -308,6 +314,9 @@ static int allocBlock(const struct cpmSuperBlock *drive)
           boo="device full";
           return -1;
         }
+#ifdef CPMFS_DEBUG
+        fprintf(stderr,"allocBlock: allocate data block %d\n",block);
+#endif
         drive->alv[i] |= (1<<j);
         return block;
       }
@@ -319,6 +328,15 @@ static int allocBlock(const struct cpmSuperBlock *drive)
 }
 /*}}}*/
 
+/* bootOffset        -- find the logical sector number of the CP/M directory */ /*{{{*/
+static int bootOffset(const struct cpmSuperBlock *d)
+{
+       assert(d);
+       if (d->bootsec >= 0) return d->bootsec;
+       return d->boottrk * d->sectrk;
+}
+/*}}}*/
+
 /* logical block I/O */
 /* readBlock          -- read a (partial) block                  */ /*{{{*/
 static int readBlock(const struct cpmSuperBlock *d, int blockno, char *buffer, int start, int end)
@@ -328,24 +346,34 @@ static int readBlock(const struct cpmSuperBlock *d, int blockno, char *buffer, i
   assert(d);
   assert(blockno>=0);
   assert(buffer);
+
+#ifdef CPMFS_DEBUG
+  fprintf(stderr,"readBlock: read block %d %d-%d\n",blockno,start,end);
+#endif
   if (blockno>=d->size)
   {
     boo="Attempting to access block beyond end of disk";
     return -1;
   }
   if (end<0) end=d->blksiz/d->secLength-1;
-  sect=(blockno*(d->blksiz/d->secLength)+ d->sectrk*d->boottrk)%d->sectrk;
-  track=(blockno*(d->blksiz/d->secLength)+ d->sectrk*d->boottrk)/d->sectrk;
+  sect =(blockno*(d->blksiz/d->secLength)+ bootOffset(d))%d->sectrk;
+  track=(blockno*(d->blksiz/d->secLength)+ bootOffset(d))/d->sectrk;
   for (counter=0; counter<=end; ++counter)
   {
-    const char *err;
+    char const *err;
 
     assert(d->skewtab[sect]>=0);
     assert(d->skewtab[sect]<d->sectrk);
-    if (counter>=start && (err=Device_readSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter))))
+    if (counter>=start)
     {
-      boo=err;
-      return -1;
+#ifdef CPMFS_DEBUG
+      fprintf(stderr,"readBlock: read sector %d/%d\n",d->skewtab[sect],track);
+#endif
+      if ((err=Device_readSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter))))
+      {
+        boo=err;
+        return -1;
+      }
     }
     ++sect;
     if (sect>=d->sectrk) 
@@ -358,19 +386,23 @@ static int readBlock(const struct cpmSuperBlock *d, int blockno, char *buffer, i
 }
 /*}}}*/
 /* writeBlock         -- write a (partial) block                 */ /*{{{*/
-static int writeBlock(const struct cpmSuperBlock *d, int blockno, const char *buffer, int start, int end)
+static int writeBlock(const struct cpmSuperBlock *d, int blockno, char const *buffer, int start, int end)
 {
   int sect, track, counter;
 
   assert(blockno>=0);
   assert(blockno<d->size);
-  assert(buffer!=(const char*)0);
+  assert(buffer!=(char const *)0);
+
+#ifdef CPMFS_DEBUG
+  fprintf(stderr,"writeBlock: write block %d %d-%d\n",blockno,start,end);
+#endif
   if (end < 0) end=d->blksiz/d->secLength-1;
-  sect = (blockno*(d->blksiz/d->secLength))%d->sectrk;
-  track = (blockno*(d->blksiz/d->secLength))/d->sectrk+d->boottrk;
+  sect  = (blockno*(d->blksiz/d->secLength) + bootOffset(d)) % d->sectrk;
+  track = (blockno*(d->blksiz/d->secLength) + bootOffset(d)) / d->sectrk;
   for (counter = 0; counter<=end; ++counter)
   {
-    const char *err;
+    char const *err;
 
     if (counter>=start && (err=Device_writeSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter))))
     {
@@ -390,7 +422,7 @@ static int writeBlock(const struct cpmSuperBlock *d, int blockno, const char *bu
 
 /* directory management */
 /* findFileExtent     -- find first/next extent for a file       */ /*{{{*/
-static int findFileExtent(const struct cpmSuperBlock *sb, int user, const char *name, const char *ext, int start, int extno)
+static int findFileExtent(const struct cpmSuperBlock *sb, int user, char const *name, char const *ext, int start, int extno)
 {
   boo="file already exists";
   for (; start<sb->maxdir; ++start)
@@ -420,7 +452,6 @@ static int findFreeExtent(const struct cpmSuperBlock *drive)
 static void updateTimeStamps(const struct cpmInode *ino, int extent)
 {
   struct PhysDirectoryEntry *date;
-  int i;
   int ca_min,ca_hour,ca_days,u_min,u_hour,u_days;
 
   if (!S_ISREG(ino->mode)) return;
@@ -474,8 +505,6 @@ static void updateTimeStamps(const struct cpmInode *ino, int extent)
 /* updateDsStamps     -- set time in datestamper file            */ /*{{{*/
 static void updateDsStamps(const struct cpmInode *ino, int extent)
 {
-  int yr;
-  struct tm *cpm_time;
   struct dsDate *stamp;
   
   if (!S_ISREG(ino->mode)) return;
@@ -584,7 +613,7 @@ static void readDsStamps(struct cpmInode *i, int lowestExt)
 /*}}}*/
 
 /* match              -- match filename against a pattern        */ /*{{{*/
-static int recmatch(const char *a, const char *pattern)
+static int recmatch(char const *a, char const *pattern)
 {
   int first=1;
 
@@ -613,10 +642,10 @@ static int recmatch(const char *a, const char *pattern)
   return (*pattern=='\0' && *a=='\0');
 }
 
-int match(const char *a, const char *pattern) 
+int match(char const *a, char const *pattern) 
 {
   int user;
-  char pat[255];
+  char pat[257];
 
   assert(a);
   assert(pattern);
@@ -667,12 +696,24 @@ void cpmglob(int optin, int argc, char * const argv[], struct cpmInode *root, in
   free(dirent);
 }
 /*}}}*/
+/* cpmglobfree        -- free expanded wildcards                 */ /*{{{*/
+void cpmglobfree(char **dirent, int entries)
+{
+  int d;
+
+  assert(dirent);
+  assert(entries>=0);
+  for (d=0; d<entries; ++d) free(dirent[d]);
+  free(dirent);
+}
+/*}}}*/
 
 /* superblock management */
 /* diskdefReadSuper   -- read super block from diskdefs file     */ /*{{{*/
-static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
+static int diskdefReadSuper(struct cpmSuperBlock *d, char const *format)
 {
   char line[256];
+  int ln;
   FILE *fp;
   int insideDef=0,found=0;
 
@@ -683,6 +724,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
     fprintf(stderr,"%s: Neither `diskdefs' nor `" DISKDEFS "' could be opened.\n",cmd);
     exit(1);
   }
+  ln=1;
   while (fgets(line,sizeof(line),fp)!=(char*)0)
   {
     int argc;
@@ -702,8 +744,8 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
       if (argc==1 && strcmp(argv[0],"end")==0)
       {
         insideDef=0;
-        d->size=(d->secLength*d->sectrk*(d->tracks-d->boottrk))/d->blksiz;
-        if (d->extents==0) d->extents=((d->size>=256 ? 8 : 16)*d->blksiz)/16384;
+        d->size=(d->sectrk*d->tracks-bootOffset(d)) * d->secLength / d->blksiz;
+        if (d->extents==0) d->extents=((d->size>256 ? 8 : 16)*d->blksiz)/16384;
         if (d->extents==0) d->extents=1;
         if (found) break;
       }
@@ -712,8 +754,17 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
         if (strcmp(argv[0],"seclen")==0) d->secLength=strtol(argv[1],(char**)0,0);
         else if (strcmp(argv[0],"tracks")==0) d->tracks=strtol(argv[1],(char**)0,0);
         else if (strcmp(argv[0],"sectrk")==0) d->sectrk=strtol(argv[1],(char**)0,0);
-        else if (strcmp(argv[0],"blocksize")==0) d->blksiz=strtol(argv[1],(char**)0,0);
+        else if (strcmp(argv[0],"blocksize")==0)
+        {
+          d->blksiz=strtol(argv[1],(char**)0,0);
+          if (d->blksiz <= 0)
+          {
+            fprintf(stderr,"%s: invalid blocksize `%s' in line %d\n",cmd,argv[1],ln);
+            exit(1);
+          }
+        }
         else if (strcmp(argv[0],"maxdir")==0) d->maxdir=strtol(argv[1],(char**)0,0);
+        else if (strcmp(argv[0],"dirblks")==0) d->dirblks=strtol(argv[1],(char**)0,0);
         else if (strcmp(argv[0],"skew")==0) d->skew=strtol(argv[1],(char**)0,0);
         else if (strcmp(argv[0],"skewtab")==0)
         {
@@ -731,7 +782,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
               if (pass==1) d->skewtab[sectors]=phys;
               if (end==s)
               {
-                fprintf(stderr,"%s: invalid skewtab `%s' at `%s'\n",cmd,argv[1],s);
+                fprintf(stderr,"%s: invalid skewtab `%s' at `%s' in line %d\n",cmd,argv[1],s,ln);
                 exit(1);
               }
               s=end;
@@ -742,6 +793,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
           }
         }
         else if (strcmp(argv[0],"boottrk")==0) d->boottrk=strtol(argv[1],(char**)0,0);
+        else if (strcmp(argv[0],"bootsec")==0) d->bootsec=strtol(argv[1],(char**)0,0);
         else if (strcmp(argv[0],"offset")==0)  
         {
           off_t val;
@@ -753,12 +805,12 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
           val = strtol(argv[1],&endptr,10);
           if ((errno==ERANGE && val==LONG_MAX)||(errno!=0 && val<=0))
           {
-            fprintf(stderr,"%s: invalid offset value \"%s\" - %s\n",cmd,argv[1],strerror(errno));
+            fprintf(stderr,"%s: invalid offset value `%s' (%s) in line %d\n",cmd,argv[1],strerror(errno),ln);
             exit(1);
           }
           if (endptr==argv[1])
           {
-            fprintf(stderr,"%s: offset value \"%s\" is not a number\n",cmd,argv[1]);
+            fprintf(stderr,"%s: offset value `%s' is not a number in line %d\n",cmd,argv[1],ln);
             exit(1);
           }
           if (*endptr!='\0')
@@ -775,7 +827,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
               case 'T':
                 if (d->sectrk<0||d->tracks<0||d->secLength<0)
                 {
-                  fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength\n",cmd);
+                  fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength in line %d\n",cmd,ln);
                   exit(1);
                 }
                 multiplier=d->sectrk*d->secLength;
@@ -783,19 +835,19 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
               case 'S':
                 if (d->sectrk<0||d->tracks<0||d->secLength<0)
                 {
-                  fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength\n",cmd);
+                  fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength in line %d\n",cmd,ln);
                   exit(1);
                 }
                 multiplier=d->secLength;
                 break;
               default:
-                fprintf(stderr,"%s: unknown unit specifier \"%c\"\n",cmd,*endptr);
+                fprintf(stderr,"%s: unknown unit specifier `%c' in line %d\n",cmd,*endptr,ln);
                 exit(1);
             }
           }
           if (val*multiplier>INT_MAX)
           {
-            fprintf(stderr,"%s: effective offset is out of range\n",cmd);
+            fprintf(stderr,"%s: effective offset is out of range in line %d\n",cmd,ln);
             exit(1);
           }
           d->offset=val*multiplier;
@@ -810,7 +862,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
           else if (strcmp(argv[1],"zsys" )==0) d->type|=CPMFS_ZSYS;
           else 
           {
-            fprintf(stderr, "%s: invalid OS type `%s'\n", cmd, argv[1]);
+            fprintf(stderr, "%s: invalid OS type `%s' in line %d\n",cmd,argv[1],ln);
             exit(1);
           }
         }
@@ -822,7 +874,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
       }
       else if (argc>0 && argv[0][0]!='#' && argv[0][0]!=';')
       {
-        fprintf(stderr,"%s: invalid keyword `%s'\n",cmd,argv[0]);
+        fprintf(stderr,"%s: invalid keyword `%s' in line %d\n",cmd,argv[0],ln);
         exit(1);
       }
     }
@@ -834,10 +886,12 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
       d->type=CPMFS_DR22;
       d->skewtab=(int*)0;
       d->offset=0;
-      d->boottrk=d->secLength=d->sectrk=d->tracks=-1;
+      d->blksiz=d->boottrk=d->bootsec=d->secLength=d->sectrk=d->tracks=d->maxdir=-1;
+      d->dirblks=0;
       d->libdskGeometry[0] = 0;
       if (strcmp(argv[1],format)==0) found=1;
     }
+    ++ln;
   }
   fclose(fp);
   if (!found)
@@ -845,9 +899,9 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
     fprintf(stderr,"%s: unknown format %s\n",cmd,format);
     exit(1);
   }
-  if (d->boottrk<0)
+  if (d->boottrk<0 && d->bootsec<0)
   {
-    fprintf(stderr, "%s: boottrk parameter invalid or missing from diskdef\n",cmd);
+    fprintf(stderr, "%s: boottrk / bootsec parameter invalid or missing from diskdef\n",cmd);
     exit(1);
   }
   if (d->secLength<0)
@@ -865,14 +919,24 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format)
     fprintf(stderr, "%s: tracks parameter invalid or missing from diskdef\n",cmd);
     exit(1);
   }
+  if (d->blksiz<0)
+  {
+    fprintf(stderr, "%s: blocksize parameter invalid or missing from diskdef\n",cmd);
+    exit(1);
+  }
+  if (d->maxdir<0)
+  {
+    fprintf(stderr, "%s: maxdir parameter invalid or missing from diskdef\n",cmd);
+    exit(1);
+  }
   return 0;
 }
 /*}}}*/
 /* amsReadSuper       -- read super block from amstrad disk      */ /*{{{*/
-static int amsReadSuper(struct cpmSuperBlock *d, const char *format)
+static int amsReadSuper(struct cpmSuperBlock *d, char const *format)
 {
   unsigned char boot_sector[512], *boot_spec;
-  const char *err;
+  char const *err;
 
   Device_setGeometry(&d->dev,512,9,40,0,"pcw180");
   if ((err=Device_readSector(&d->dev, 0, 0, (char *)boot_sector)))
@@ -913,12 +977,13 @@ static int amsReadSuper(struct cpmSuperBlock *d, const char *format)
   d->sectrk    = boot_spec[3];
   d->blksiz    = 128 << boot_spec[6];
   d->maxdir    = (d->blksiz / 32) * boot_spec[7];
+  d->dirblks   = 0;
   d->skew      = 1; /* Amstrads skew at the controller level */
   d->skewtab   = (int*)0;
   d->boottrk   = boot_spec[5];
   d->offset    = 0;
   d->size      = (d->secLength*d->sectrk*(d->tracks-d->boottrk))/d->blksiz;
-  d->extents   = ((d->size>=256 ? 8 : 16)*d->blksiz)/16384;
+  d->extents   = ((d->size>256 ? 8 : 16)*d->blksiz)/16384;
   d->libdskGeometry[0] = 0; /* LibDsk can recognise an Amstrad superblock 
                              * and autodect */
  
@@ -972,14 +1037,32 @@ int cpmCheckDs(struct cpmSuperBlock *sb)
 }
 /*}}}*/
 /* cpmReadSuper       -- get DPB and init in-core data for drive */ /*{{{*/
-int cpmReadSuper(struct cpmSuperBlock *d, struct cpmInode *root, const char *format)
+int cpmReadSuper(struct cpmSuperBlock *d, struct cpmInode *root, char const *format, int uppercase)
 {
   while (s_ifdir && !S_ISDIR(s_ifdir)) s_ifdir<<=1;
   assert(s_ifdir);
   while (s_ifreg && !S_ISREG(s_ifreg)) s_ifreg<<=1;
   assert(s_ifreg);
+
   if (strcmp(format,"amstrad")==0) amsReadSuper(d,format);
   else diskdefReadSuper(d,format);
+
+  d->uppercase=uppercase;
+
+  assert(d->boottrk>=0);
+  assert(d->secLength>0);
+  assert(d->sectrk>0);
+  assert(d->tracks>0);
+  assert(d->blksiz>0);
+  assert(d->maxdir>0);
+  assert(d->dirblks>=0);
+
+  if (d->dirblks==0)
+  {
+    /* optional field, compute based on directory size */
+    d->dirblks=(d->maxdir*32+(d->blksiz-1))/d->blksiz;
+  }
+
   boo = Device_setGeometry(&d->dev,d->secLength,d->sectrk,d->tracks,d->offset,d->libdskGeometry);
   if (boo) return -1;
 
@@ -1009,7 +1092,7 @@ int cpmReadSuper(struct cpmSuperBlock *d, struct cpmInode *root, const char *for
   /*}}}*/
   /* initialise allocation vector bitmap */ /*{{{*/
   {
-    d->alvSize=((d->secLength*d->sectrk*(d->tracks-d->boottrk))/d->blksiz+INTBITS-1)/INTBITS;
+    d->alvSize= ((((d->sectrk * d->tracks)-bootOffset(d)) * d->secLength)/d->blksiz+INTBITS-1)/INTBITS;
     if ((d->alv=malloc(d->alvSize*sizeof(int)))==(int*)0) 
     {
       boo=strerror(errno);
@@ -1192,19 +1275,30 @@ int cpmSync(struct cpmSuperBlock *sb)
 }
 /*}}}*/
 /* cpmUmount          -- free super block                        */ /*{{{*/
-void cpmUmount(struct cpmSuperBlock *sb)
+int cpmUmount(struct cpmSuperBlock *sb)
 {
-  cpmSync(sb);
+  int err_sync;
+  char const *err_close;
+
+  err_sync=cpmSync(sb);
+  err_close=Device_close(&sb->dev);
   if (sb->type&CPMFS_DS_DATES) free(sb->ds);
   free(sb->alv);
   free(sb->skewtab);
   free(sb->dir);
   if (sb->passwdLength) free(sb->passwd);
+  if (err_sync==-1) return err_sync;
+  if (err_close)
+  {
+    boo=err_close;
+    return -1;
+  }
+  return 0;
 }
 /*}}}*/
 
 /* cpmNamei           -- map name to inode                       */ /*{{{*/
-int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i)
+int cpmNamei(const struct cpmInode *dir, char const *filename, struct cpmInode *i)
 {
   /* variables */ /*{{{*/
   int user;
@@ -1213,6 +1307,9 @@ int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *
   int protectMode=0;
   /*}}}*/
 
+#ifdef CPMFS_DEBUG
+  fprintf(stderr,"cpmNamei: map %s\n", filename);
+#endif
   if (!S_ISDIR(dir->mode))
   {
     boo="No such file";
@@ -1278,7 +1375,7 @@ int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *
     int block;
 
     i->size=highestExtno*16384;
-    if (dir->sb->size<256) for (block=15; block>=0; --block)
+    if (dir->sb->size<=256) for (block=15; block>=0; --block)
     {
       if (dir->sb->dir[highestExt].pointers[block]) break;
     }
@@ -1286,14 +1383,17 @@ int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *
     {
       if (dir->sb->dir[highestExt].pointers[2*block] || dir->sb->dir[highestExt].pointers[2*block+1]) break;
     }
-    if (dir->sb->dir[highestExt].blkcnt) i->size+=((dir->sb->dir[highestExt].blkcnt&0xff)-1)*128;
-    if (dir->sb->type & CPMFS_ISX)
-    {
-      i->size += (128 - dir->sb->dir[highestExt].lrc);
-    }
-    else
+    if (dir->sb->dir[highestExt].blkcnt)
     {
-      i->size+=dir->sb->dir[highestExt].lrc ? (dir->sb->dir[highestExt].lrc&0xff) : 128;
+      i->size+=((dir->sb->dir[highestExt].blkcnt&0xff)-1)*128;
+      if (dir->sb->type & CPMFS_ISX)
+      {
+        i->size += (128 - dir->sb->dir[highestExt].lrc);
+      }
+      else
+      {
+        i->size+=dir->sb->dir[highestExt].lrc ? (dir->sb->dir[highestExt].lrc&0xff) : 128;
+      }
     }
 #ifdef CPMFS_DEBUG
     fprintf(stderr,"cpmNamei: size=%ld\n",(long)i->size);
@@ -1341,7 +1441,7 @@ void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf)
   buf->f_bsize=d->blksiz;
   buf->f_blocks=d->size;
   buf->f_bfree=0;
-  buf->f_bused=-(d->maxdir*32+d->blksiz-1)/d->blksiz;
+  buf->f_bused=-(d->dirblks);
   for (i=0; i<d->alvSize; ++i)
   {
     int temp,j;
@@ -1374,7 +1474,7 @@ void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf)
 }
 /*}}}*/
 /* cpmUnlink          -- unlink                                  */ /*{{{*/
-int cpmUnlink(const struct cpmInode *dir, const char *fname)
+int cpmUnlink(const struct cpmInode *dir, char const *fname)
 {
   int user;
   char name[8],extension[3];
@@ -1400,7 +1500,7 @@ int cpmUnlink(const struct cpmInode *dir, const char *fname)
 }
 /*}}}*/
 /* cpmRename          -- rename                                  */ /*{{{*/
-int cpmRename(const struct cpmInode *dir, const char *old, const char *new)
+int cpmRename(const struct cpmInode *dir, char const *old, char const *new)
 {
   struct cpmSuperBlock *drive;
   int extent;
@@ -1531,11 +1631,14 @@ int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent)
           /* convert file name to UNIX style */ /*{{{*/
           buf[0]='0'+cur->status/10;
           buf[1]='0'+cur->status%10;
-          for (bufp=buf+2,i=0; i<8 && (cur->name[i]&0x7f)!=' '; ++i) *bufp++=tolower(cur->name[i]&0x7f);
+          for (bufp=buf+2,i=0; i<8 && (cur->name[i]&0x7f)!=' '; ++i)
+          {
+            *bufp++=dir->ino->sb->uppercase ? cur->name[i]&0x7f : tolower(cur->name[i]&0x7f);
+          }
           for (hasext=0,i=0; i<3 && (cur->ext[i]&0x7f)!=' '; ++i)
           {
             if (!hasext) { *bufp++='.'; hasext=1; }
-            *bufp++=tolower(cur->ext[i]&0x7f);
+            *bufp++=dir->ino->sb->uppercase ? cur->ext[i]&0x7f : tolower(cur->ext[i]&0x7f);
           }
           *bufp='\0';
           /*}}}*/
@@ -1587,18 +1690,19 @@ int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode)
 }
 /*}}}*/
 /* cpmRead            -- read                                    */ /*{{{*/
-int cpmRead(struct cpmFile *file, char *buf, int count)
+ssize_t cpmRead(struct cpmFile *file, char *buf, size_t count)
 {
   int findext=1,findblock=1,extent=-1,block=-1,extentno=-1,got=0,nextblockpos=-1,nextextpos=-1;
-  int blocksize=file->ino->sb->blksiz;
+  struct cpmSuperBlock const *sb=file->ino->sb;
+  int blocksize=sb->blksiz;
   int extcap;
 
-  extcap=(file->ino->sb->size<256 ? 16 : 8)*blocksize;
-  if (extcap>16384) extcap=16384*file->ino->sb->extents;
-  if (file->ino->ino==(ino_t)file->ino->sb->maxdir+1) /* [passwd] */ /*{{{*/
+  extcap=(sb->size<=256 ? 16 : 8)*blocksize;
+  if (extcap>16384) extcap=16384*sb->extents;
+  if (file->ino->ino==(ino_t)sb->maxdir+1) /* [passwd] */ /*{{{*/
   {
-    if ((file->pos+count)>file->ino->size) count=file->ino->size-file->pos;
-    if (count) memcpy(buf,file->ino->sb->passwd+file->pos,count);
+    if ((file->pos+(off_t)count)>file->ino->size) count=file->ino->size-file->pos;
+    if (count) memcpy(buf,sb->passwd+file->pos,count);
     file->pos+=count;
 #ifdef CPMFS_DEBUG
     fprintf(stderr,"cpmRead passwd: read %d bytes, now at position %ld\n",count,(long)file->pos);
@@ -1606,10 +1710,10 @@ int cpmRead(struct cpmFile *file, char *buf, int count)
     return count;
   }
   /*}}}*/
-  else if (file->ino->ino==(ino_t)file->ino->sb->maxdir+2) /* [label] */ /*{{{*/
+  else if (file->ino->ino==(ino_t)sb->maxdir+2) /* [label] */ /*{{{*/
   {
-    if ((file->pos+count)>file->ino->size) count=file->ino->size-file->pos;
-    if (count) memcpy(buf,file->ino->sb->label+file->pos,count);
+    if ((file->pos+(off_t)count)>file->ino->size) count=file->ino->size-file->pos;
+    if (count) memcpy(buf,sb->label+file->pos,count);
     file->pos+=count;
 #ifdef CPMFS_DEBUG
     fprintf(stderr,"cpmRead label: read %d bytes, now at position %ld\n",count,(long)file->pos);
@@ -1624,7 +1728,7 @@ int cpmRead(struct cpmFile *file, char *buf, int count)
     if (findext)
     {
       extentno=file->pos/16384;
-      extent=findFileExtent(file->ino->sb,file->ino->sb->dir[file->ino->ino].status,file->ino->sb->dir[file->ino->ino].name,file->ino->sb->dir[file->ino->ino].ext,0,extentno);
+      extent=findFileExtent(sb,sb->dir[file->ino->ino].status,sb->dir[file->ino->ino].name,sb->dir[file->ino->ino].ext,0,extentno);
       nextextpos=(file->pos/extcap)*extcap+extcap;
       findext=0;
       findblock=1;
@@ -1633,21 +1737,31 @@ int cpmRead(struct cpmFile *file, char *buf, int count)
     {
       if (extent!=-1)
       {
-        int start,end,ptr;
+        int ptr;
 
         ptr=(file->pos%extcap)/blocksize;
-        if (file->ino->sb->size>=256) ptr*=2;
-        block=(unsigned char)file->ino->sb->dir[extent].pointers[ptr];
-        if (file->ino->sb->size>=256) block+=((unsigned char)file->ino->sb->dir[extent].pointers[ptr+1])<<8;
+        if (sb->size>256) ptr*=2;
+        block=(unsigned char)sb->dir[extent].pointers[ptr];
+        if (sb->size>256) block+=((unsigned char)sb->dir[extent].pointers[ptr+1])<<8;
         if (block==0)
         {
           memset(buffer,0,blocksize);
         }
         else
         {
-          start=(file->pos%blocksize)/file->ino->sb->secLength;
-          end=((file->pos%blocksize+count)>blocksize ? blocksize-1 : (file->pos%blocksize+count-1))/file->ino->sb->secLength;
-          if (readBlock(file->ino->sb,block,buffer,start,end)==-1)
+          int start,end;
+
+          start=(file->pos%blocksize)
+               /sb->secLength;
+          end=((file->pos%blocksize+(off_t)count)>blocksize ? blocksize-1 : (int)(file->pos%blocksize+count-1))
+              /sb->secLength;
+          if (block<sb->dirblks)
+          {
+            boo="Attempting to access block before beginning of data";
+            if (got==0) got=-1;
+            break;
+          }
+          if (readBlock(sb,block,buffer,start,end)==-1)
           {
             if (got==0) got=-1;
             break;
@@ -1673,14 +1787,16 @@ int cpmRead(struct cpmFile *file, char *buf, int count)
 }
 /*}}}*/
 /* cpmWrite           -- write                                   */ /*{{{*/
-int cpmWrite(struct cpmFile *file, const char *buf, int count)
+ssize_t cpmWrite(struct cpmFile *file, char const *buf, size_t count)
 {
   int findext=1,findblock=-1,extent=-1,extentno=-1,got=0,nextblockpos=-1,nextextpos=-1;
   int blocksize=file->ino->sb->blksiz;
-  int extcap=(file->ino->sb->size<256 ? 16 : 8)*blocksize;
+  int extcap;
   int block=-1,start=-1,end=-1,ptr=-1,last=-1;
   char buffer[16384];
 
+  extcap=(file->ino->sb->size<=256 ? 16 : 8)*blocksize;
+  if (extcap>16384) extcap=16384*file->ino->sb->extents;
   while (count>0)
   {
     if (findext) /*{{{*/
@@ -1708,15 +1824,20 @@ int cpmWrite(struct cpmFile *file, const char *buf, int count)
     if (findblock) /*{{{*/
     {
       ptr=(file->pos%extcap)/blocksize;
-      if (file->ino->sb->size>=256) ptr*=2;
+      if (file->ino->sb->size>256) ptr*=2;
       block=(unsigned char)file->ino->sb->dir[extent].pointers[ptr];
-      if (file->ino->sb->size>=256) block+=((unsigned char)file->ino->sb->dir[extent].pointers[ptr+1])<<8;
+      if (file->ino->sb->size>256) block+=((unsigned char)file->ino->sb->dir[extent].pointers[ptr+1])<<8;
       if (block==0) /* allocate new block, set start/end to cover it */ /*{{{*/
       {
         if ((block=allocBlock(file->ino->sb))==-1) return (got==0 ? -1 : got);
         file->ino->sb->dir[extent].pointers[ptr]=block&0xff;
-        if (file->ino->sb->size>=256) file->ino->sb->dir[extent].pointers[ptr+1]=(block>>8)&0xff;
+        if (file->ino->sb->size>256) file->ino->sb->dir[extent].pointers[ptr+1]=(block>>8)&0xff;
         start=0;
+        /* By setting end to the end of the block and not the end
+         * of the currently written data, the whole block gets
+         * wiped from the disk, which is slow, but convenient in
+         * case of sparse files.
+         */
         end=(blocksize-1)/file->ino->sb->secLength;
         memset(buffer,0,blocksize);
         time(&file->ino->ctime);
@@ -1727,7 +1848,7 @@ int cpmWrite(struct cpmFile *file, const char *buf, int count)
       else /* read existing block and set start/end to cover modified parts */ /*{{{*/
       {
         start=(file->pos%blocksize)/file->ino->sb->secLength;
-        end=((file->pos%blocksize+count)>blocksize ? blocksize-1 : (file->pos%blocksize+count-1))/file->ino->sb->secLength;
+        end=((int)(file->pos%blocksize+count)>=blocksize ? blocksize-1 : (int)(file->pos%blocksize+count-1))/file->ino->sb->secLength;
         if (file->pos%file->ino->sb->secLength)
         {
           if (readBlock(file->ino->sb,block,buffer,start,start)==-1)
@@ -1736,9 +1857,9 @@ int cpmWrite(struct cpmFile *file, const char *buf, int count)
             break;
           }
         }
-        if (end!=start && (file->pos+count-1)<blocksize)
+        if (end!=start && (int)(file->pos%blocksize+count)<blocksize && (file->pos+count)%file->ino->sb->secLength)
         {
-          if (readBlock(file->ino->sb,block,buffer+end*file->ino->sb->secLength,end,end)==-1)
+          if (readBlock(file->ino->sb,block,buffer,end,end)==-1)
           {
             if (got==0) got=-1;
             break;
@@ -1760,9 +1881,14 @@ int cpmWrite(struct cpmFile *file, const char *buf, int count)
       ++got;
       --count;
     }
+    /* In case the data only fills part of a sector, the rest is
+     * still initialized: A new block was cleared and the boundaries
+     * of an existing block were read.
+     */
+
     (void)writeBlock(file->ino->sb,block,buffer,start,end);
     time(&file->ino->mtime);
-    if (file->ino->sb->size<256) for (last=15; last>=0; --last)
+    if (file->ino->sb->size<=256) for (last=15; last>=0; --last)
     {
       if (file->ino->sb->dir[extent].pointers[last])
       {
@@ -1805,7 +1931,7 @@ int cpmClose(struct cpmFile *file)
 }
 /*}}}*/
 /* cpmCreat           -- creat                                   */ /*{{{*/
-int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode)
+int cpmCreat(struct cpmInode *dir, char const *fname, struct cpmInode *ino, mode_t mode)
 {
   int user;
   char name[8],extension[3];
diff --git a/cpmfs.h b/cpmfs.h
index 06126c865797c85bf99a28884ef301bb25c43ced..3d73559528363a0a84dee976a9b570e9d11e1c3b 100644 (file)
--- a/cpmfs.h
+++ b/cpmfs.h
@@ -1,49 +1,8 @@
 #ifndef CPMFS_H
 #define CPMFS_H
 
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-
-#ifdef _WIN32
-    #include <windows.h>
-    #include <winioctl.h>
-    /* To make it compile on NT: extracts from Linux 2.0 *
-     * <statbuf.h> and <sys/stat.h>                      */
-    #define __S_IFMT        0170000 /* These bits determine file type.  */
-    #define __S_IFDIR       0040000 /* Directory.  */
-    #define __S_IFREG       0100000 /* Regular file.  */
-    #define __S_IWUSR       0000200 /* Writable for user.  */
-    #define __S_IWGRP       0000200 /* Writable for group.  */
-    #define __S_IWOTH       0000200 /* Writable for others.  */
-
-    #define __S_ISTYPE(mode, mask)  (((mode) & __S_IFMT) == (mask))
-    #define __S_ISTYPE(mode, mask)  (((mode) & __S_IFMT) == (mask))
-    /* These bits are defined in Borland C++ 5 but not in MS Visual C++ */
-    #ifndef S_ISDIR
-    # define S_ISDIR(mode)   __S_ISTYPE((mode), __S_IFDIR)
-    #endif
-    #ifndef S_ISREG
-    # define S_ISREG(mode)   __S_ISTYPE((mode), __S_IFREG)
-    #endif
-    #ifndef S_IWUSR
-    #define S_IWUSR __S_IWUSR
-    #endif
-    #ifndef S_IWGRP
-    #define S_IWGRP __S_IWGRP
-    #endif
-    #ifndef S_IWOTH
-    #define S_IWOTH __S_IWOTH
-    #endif
-
-    #include <io.h>            /* For open(), lseek() etc. */
-    #ifndef HAVE_MODE_T
-    typedef int mode_t;
-    #endif
-#endif
-
 #ifdef __cplusplus
-        extern "C" {
+extern "C" {
 #endif
 
 #include "device.h"
@@ -100,13 +59,17 @@ struct cpmStat
   time_t ctime;
 };
 
+/* Note: CPMFS_HI_USER should be split for systems with user numbers
+ * up to 31 and CP/M 3, which uses them, but for password entries and
+ * not for files.
+ */
 #define CPMFS_HI_USER    (0x1<<0) /* has user numbers up to 31    */
 #define CPMFS_CPM3_DATES (0x1<<1) /* has CP/M+ style time stamps  */
 #define CPMFS_CPM3_OTHER (0x1<<2) /* has passwords and disc label */
 #define CPMFS_DS_DATES   (0x1<<3) /* has datestamper timestamps   */
 #define CPMFS_EXACT_SIZE (0x1<<4) /* has reverse exact file size  */
 
-#define CPMFS_DR22  0
+#define CPMFS_DR22  (CPMFS_HI_USER)
 #define CPMFS_P2DOS (CPMFS_CPM3_DATES|CPMFS_HI_USER)
 #define CPMFS_DR3   (CPMFS_CPM3_DATES|CPMFS_CPM3_OTHER|CPMFS_HI_USER)
 #define CPMFS_ISX   (CPMFS_EXACT_SIZE)
@@ -132,22 +95,27 @@ struct dsDate
 struct cpmSuperBlock
 {
   struct Device dev;
+  int uppercase;
 
   int secLength;
   int tracks;
   int sectrk;
   int blksiz;
   int maxdir;
+  int dirblks;
   int skew;
+  int bootsec;
   int boottrk;
   off_t offset;
   int type;
   int size;
   int extents; /* logical extents per physical extent */
+  int *skewtab;
+  char libdskGeometry[256];
+
   struct PhysDirectoryEntry *dir;
   int alvSize;
   int *alv;
-  int *skewtab;
   int cnotatime;
   char *label;
   size_t labelLength;
@@ -157,7 +125,6 @@ struct cpmSuperBlock
   int dirtyDirectory;
   struct dsDate *ds;
   int dirtyDs;
-  char libdskGeometry[256];
 };
 
 struct cpmStatFS
@@ -172,13 +139,14 @@ struct cpmStatFS
   long f_namelen;
 };
 
-extern const char cmd[];
-extern const char *boo;
+extern char const cmd[];
+extern char const *boo;
 
-int match(const char *a, const char *pattern);
+int match(char const *a, char const *pattern);
 void cpmglob(int opti, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv);
+void cpmglobfree(char **dirent, int entries);
 
-int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format);
+int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format, int uppercase);
 int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i);
 void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf);
 int cpmUnlink(const struct cpmInode *dir, const char *fname);
@@ -190,17 +158,17 @@ int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib);
 int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib);
 int cpmChmod(struct cpmInode *ino, mode_t mode);
 int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode);
-int cpmRead(struct cpmFile *file, char *buf, int count);
-int cpmWrite(struct cpmFile *file, const char *buf, int count);
+ssize_t cpmRead(struct cpmFile *file, char *buf, size_t count);
+ssize_t cpmWrite(struct cpmFile *file, const char *buf, size_t count);
 int cpmClose(struct cpmFile *file);
 int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode);
 void cpmUtime(struct cpmInode *ino, struct utimbuf *times);
 int cpmSync(struct cpmSuperBlock *sb);
-void cpmUmount(struct cpmSuperBlock *sb);
+int cpmUmount(struct cpmSuperBlock *sb);
 int cpmCheckDs(struct cpmSuperBlock *sb);
 
 #ifdef __cplusplus
-       }
+}
 #endif
 
 #endif
diff --git a/cpmls.1 b/cpmls.1
index 91326400a6639dfd19042a1c78052df2104c791d..eb840eea3a3b6c6acbee6391bd880fd13c2a6485 100644 (file)
--- a/cpmls.1
+++ b/cpmls.1
@@ -1,4 +1,4 @@
-.TH CPMLS 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH CPMLS 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME \"{{{roff}}}\"{{{
 cpmls \- list sorted contents of directory
 .\"}}}
@@ -10,6 +10,7 @@ cpmls \- list sorted contents of directory
 .RB [ \-T
 .IR libdsk-type ]
 .RB [ \-d | \-D | \-F | \-A | \-l [ \-c ][ \-i ]]
+.RB [ \-u ]
 .I image
 .RI [ file-pattern "...]"
 .ad b
@@ -37,6 +38,8 @@ Long UNIX-style directory listing including size, time stamp and user number.
 Output the creation time, not the modification time.
 .IP \fB\-i\fP
 Print index number of each file.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -51,7 +54,7 @@ CPMTOOLSFMT     Default format
 ${prefix}/share/diskdefs       CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index 347761c6dd299e817b5ad21b346c59236c2b95dc..3e9d189916c372f52521c6a6020bc2b2e4dac7e6 100644 (file)
@@ -10,6 +10,7 @@ cpmls \- list sorted contents of directory
 .RB [ \-T
 .IR libdsk-type ]
 .RB [ \-d | \-D | \-F | \-A | \-l [ \-c ][ \-i ]]
+.RB [ \-u ]
 .I image
 .RI [ file-pattern "...]"
 .ad b
@@ -37,6 +38,8 @@ Long UNIX-style directory listing including size, time stamp and user number.
 Output the creation time, not the modification time.
 .IP \fB\-i\fP
 Print index number of each file.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -51,7 +54,7 @@ CPMTOOLSFMT     Default format
 @DATADIR@/diskdefs     CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
diff --git a/cpmls.c b/cpmls.c
index 3721d2e0bb7c3d50e4169024032b0485e74768a5..6bc6bad89b6f757c2651d41d8a3a108c9b89cdd3 100644 (file)
--- a/cpmls.c
+++ b/cpmls.c
 
 #include "getopt_.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 /* variables */ /*{{{*/
@@ -27,23 +23,42 @@ static int namecmp(const void *a, const void *b)
   return strcmp(*((const char * const *)a),*((const char * const *)b));
 }
 /*}}}*/
+/* onlyuser0 -- do all entries belong to user 0? */ /*{{{*/
+static int onlyuser0(char ** const dirent, int entries)
+{
+  int i;
+
+  for (i=0; i<entries; ++i)
+  {
+    if (dirent[i][0]!='.' && (dirent[i][0]!='0' || dirent[i][1]!='0')) return 0;
+  }
+
+  return 1;
+}
+/*}}}*/
 /* olddir  -- old style output */ /*{{{*/
 static void olddir(char **dirent, int entries)
 {
-  int i,j,k,l,user,announce;
+  int i,j,k,l,user,announce,showuser,files;
 
-  announce=0;
+  showuser=!onlyuser0(dirent,entries);
+  files=0;
   for (user=0; user<32; ++user)
   {
+    announce=1;
     for (i=l=0; i<entries; ++i)
     {
+      /* This selects real regular files implicitly, because only those have
+       * the user in their name.  ".", ".." and the password file do not.
+       */
       if (dirent[i][0]=='0'+user/10 && dirent[i][1]=='0'+user%10)
       {
-        if (announce==1)
+        ++files;
+        if (announce && showuser)
         {
           printf("User %d\n",user);
+          announce=0;
         }
-        announce=2;
         if (l%4) printf(" : ");
         for (j=2; dirent[i][j] && dirent[i][j]!='.'; ++j) putchar(toupper(dirent[i][j]));
         k=j; while (k<11) { putchar(' '); ++k; }
@@ -52,18 +67,19 @@ static void olddir(char **dirent, int entries)
         for (; k<3; ++k) putchar(' ');
         ++l;
       }
-      if (l && (l%4)==0) {
+      if (l && (l%4)==0)
+      {
        l = 0;
        putchar('\n');
       }        
     }
-    if (l%4) {
-       putchar('\n');
+    if (l%4)
+    {
+      putchar('\n');
     }
-
-    if (announce==2) announce=1;
   }
-  if (entries==0) printf("No files\n");
+
+  if (files==0) printf("No file\n");
 }
 /*}}}*/
 /* oldddir -- old style long output */ /*{{{*/
@@ -73,7 +89,7 @@ static void oldddir(char **dirent, int entries, struct cpmInode *ino)
   struct cpmStat statbuf;
   struct cpmInode file;
 
-  if (entries)
+  if (entries>2)
   {
     int i,j,k,l,announce,user;
 
@@ -143,7 +159,7 @@ static void old3dir(char **dirent, int entries, struct cpmInode *ino)
   struct cpmStat statbuf;
   struct cpmInode file;
 
-  if (entries)
+  if (entries>2)
   {
     int i,j,k,l,announce,user, attrib;
     int totalBytes=0,totalRecs=0;
@@ -166,7 +182,8 @@ static void old3dir(char **dirent, int entries, struct cpmInode *ino)
           {
             if (user) putchar('\n');
             printf("Directory For Drive A:  User %2.1d\n\n",user);
-            printf("    Name     Bytes   Recs   Attributes   Prot      Update          Create\n");
+            printf("    Name     Bytes   Recs   Attributes   Prot      Update          %s\n",
+               ino->sb->cnotatime ? "Create" : "Access");
             printf("------------ ------ ------ ------------ ------ --------------  --------------\n\n");
           }
           announce=2;
@@ -181,7 +198,7 @@ static void old3dir(char **dirent, int entries, struct cpmInode *ino)
           totalRecs+=(statbuf.size+127)/128;
           printf(" %5.1ldk",(long) (statbuf.size+buf.f_bsize-1) /
                        buf.f_bsize*(buf.f_bsize/1024));
-          printf(" %6.1ld ",(long)(statbuf.size/128));
+          printf(" %6.1ld ",(long)((statbuf.size+127)/128));
           putchar((attrib & CPM_ATTR_F1)   ? '1' : ' ');
           putchar((attrib & CPM_ATTR_F2)   ? '2' : ' ');
           putchar((attrib & CPM_ATTR_F3)   ? '3' : ' ');          
@@ -199,12 +216,17 @@ static void old3dir(char **dirent, int entries, struct cpmInode *ino)
             tmp=localtime(&statbuf.mtime);
             printf("%02d/%02d/%02d %02d:%02d  ",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min);
           }
-          else if (statbuf.ctime) printf("                ");
-          if (statbuf.ctime)
+          else printf("                ");
+          if (ino->sb->cnotatime && statbuf.ctime)
           {
             tmp=localtime(&statbuf.ctime);
             printf("%02d/%02d/%02d %02d:%02d",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min);
           }
+          else if (!ino->sb->cnotatime && statbuf.atime)
+          {
+            tmp=localtime(&statbuf.atime);
+            printf("%02d/%02d/%02d %02d:%02d",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min);
+          }
           putchar('\n');
           ++l;
         }
@@ -340,20 +362,21 @@ int main(int argc, char *argv[])
   const char *format;
   const char *devopts=NULL;
   int c,usage=0;
-  struct cpmSuperBlock drive;
+  struct cpmSuperBlock super;
   struct cpmInode root;
   int style=0;
   int changetime=0;
+  int uppercase=0;
   int inode=0;
   char **gargv;
   int gargc;
   static char starlit[2]="*";
-  static char * const star[]={starlit};
+  static char * const star[]={ starlit };
   /*}}}*/
 
   /* parse options */ /*{{{*/
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"cT:f:ih?dDFlA"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"cT:f:ih?dDFlAu"))!=EOF) switch(c)
   {
     case 'f': format=optarg; break;
     case 'T': devopts=optarg; break;
@@ -366,6 +389,7 @@ int main(int argc, char *argv[])
     case 'A': style=5; break;
     case 'c': changetime=1; break;
     case 'i': inode=1; break;
+    case 'u': uppercase=1; break;
   }
 
   if (optind==argc) usage=1;
@@ -373,17 +397,21 @@ int main(int argc, char *argv[])
 
   if (usage)
   {
-    fprintf(stderr,"Usage: %s [-f format] [-T libdsk-type] [-d|-D|-F|-A|[-l][-c][-i]] image [file ...]\n",cmd);
+#ifdef HAVE_LIBDSK_H
+    fprintf(stderr,"Usage: %s [-f format] [-T libdsk-type] [-d|-D|-F|-A|[-l][-c][-i]] [-u] image [file ...]\n",cmd);
+#else
+    fprintf(stderr,"Usage: %s [-f format] [-d|-D|-F|-A|[-l][-c][-i]] [-u] image [file ...]\n",cmd);
+#endif
     exit(1);
   }
   /*}}}*/
   /* open image */ /*{{{*/
-  if ((err=Device_open(&drive.dev,image,O_RDONLY,devopts))) 
+  if ((err=Device_open(&super.dev,image,O_RDONLY,devopts))) 
   {
     fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
     exit(1);
   }
-  if (cpmReadSuper(&drive,&root,format)==-1)
+  if (cpmReadSuper(&super,&root,format,uppercase)==-1)
   {
     fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
@@ -396,5 +424,7 @@ int main(int argc, char *argv[])
   else if (style==3) old3dir(gargv,gargc,&root);
   else if (style==5) lsattr(gargv, gargc, &root); 
   else ls(gargv,gargc,&root,style==4,changetime,inode);
+  cpmglobfree(gargv,gargc);
+  cpmUmount(&super);
   exit(0);
 }
diff --git a/cpmrm.1 b/cpmrm.1
index 39f0f73df2e28de9a56f3238c98f69dbbbd75b2f..10e99f30a1744749bc23d3de19b174744b266d1f 100644 (file)
--- a/cpmrm.1
+++ b/cpmrm.1
@@ -1,4 +1,4 @@
-.TH CPMRM 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH CPMRM 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME \"{{{roff}}}\"{{{
 cpmrm \- remove files on CP/M disks
 .\"}}}
@@ -7,6 +7,7 @@ cpmrm \- remove files on CP/M disks
 .B cpmrm
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .I file-pattern
 \&...
@@ -21,6 +22,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -35,7 +38,7 @@ CPMTOOLSFMT     Default format
 ${prefix}/share/diskdefs       CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index c527753a7f818250be06af3541ca05a53b23f79e..2f2bbc7e74456cb63dccc31dadf0c2f394198c96 100644 (file)
@@ -7,6 +7,7 @@ cpmrm \- remove files on CP/M disks
 .B cpmrm
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .I file-pattern
 \&...
@@ -21,6 +22,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -35,7 +38,7 @@ CPMTOOLSFMT     Default format
 @DATADIR@/diskdefs     CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
diff --git a/cpmrm.c b/cpmrm.c
index 65430da6d752548e98648baad4f7d0cbe722af84..f49ed4a68b5d741b7f13fe71b9ad83c1a5b60f62 100644 (file)
--- a/cpmrm.c
+++ b/cpmrm.c
@@ -9,10 +9,6 @@
 
 #include "getopt_.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 const char cmd[]="cpmrm";
@@ -24,6 +20,7 @@ int main(int argc, char *argv[]) /*{{{*/
   const char *image;
   const char *format;
   const char *devopts=NULL;
+  int uppercase=0;
   int c,i,usage=0,exitcode=0;
   struct cpmSuperBlock drive;
   struct cpmInode root;
@@ -33,10 +30,11 @@ int main(int argc, char *argv[]) /*{{{*/
 
   /* parse options */ /*{{{*/
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c)
   {
     case 'T': devopts=optarg; break;
     case 'f': format=optarg; break;
+    case 'u': uppercase=1; break;
     case 'h':
     case '?': usage=1; break;
   }
@@ -46,7 +44,7 @@ int main(int argc, char *argv[]) /*{{{*/
 
   if (usage)
   {
-    fprintf(stderr,"Usage: %s [-f format] [-T dsktype] image pattern ...\n",cmd);
+    fprintf(stderr,"Usage: %s [-f format] [-T dsktype] [-u] image pattern ...\n",cmd);
     exit(1);
   }
   /*}}}*/
@@ -56,7 +54,7 @@ int main(int argc, char *argv[]) /*{{{*/
     fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
     exit(1);
   }
-  if (cpmReadSuper(&drive,&root,format)==-1)
+  if (cpmReadSuper(&drive,&root,format,uppercase)==-1)
   {
     fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
index 319604e4ef0623a9ad0141ba36b9dc5dc369cbd2..377e2580f76ccc0ad1b333234d6772a8b4e67294 100644 (file)
--- a/device.h
+++ b/device.h
@@ -16,11 +16,11 @@ struct Device
   int tracks;
   int sectrk;
   off_t offset;
-#if HAVE_LIBDSK_H
+#ifdef HAVE_LIBDSK_H
   DSK_PDRIVER   dev;
   DSK_GEOMETRY geom; 
 #endif
-#if HAVE_WINDOWS_H
+#ifdef HAVE_WINDOWS_H
   int drvtype;
   HANDLE hdisk;
 #endif
index 51dcc01e34899aff0730097e6bb0e6ee1a0628f0..7baaed4223014f08902ae81739a38ce360feef88 100644 (file)
@@ -7,10 +7,6 @@
 #include <string.h>
 
 #include "device.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 static const char *lookupFormat(DSK_GEOMETRY *geom, const char *name)
index 5a28dcdc5ecb4c0be201c81c0bd14081bcb05072..fd425cafed1fdb649d087c523d46b83101a0ed57 100644 (file)
@@ -8,15 +8,15 @@
 #include <string.h>
 
 #include "device.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 
 /* Device_open           -- Open an image file                      */ /*{{{*/
 const char *Device_open(struct Device *this, const char *filename, int mode, const char *deviceOpts)
 {
+  if (deviceOpts != NULL)
+  {
+    return "POSIX driver accepts no options (build compiled without libdsk)";
+  }
   this->fd=open(filename,mode);
   this->opened=(this->fd==-1?0:1);
   return ((this->fd==-1)?strerror(errno):(const char*)0);
@@ -60,7 +60,11 @@ const char *Device_readSector(const struct Device *this, int track, int sector,
     {
       return strerror(errno);
     }
-    else memset(buf+res,0,this->secLength-res); /* hit end of disk image */
+    else
+{
+printf("len %d\n",this->secLength-res);
+ memset(buf+res,0,this->secLength-res); /* hit end of disk image */
+}
   }
   return (const char*)0;
 }
diff --git a/device_win32.c b/device_win32.c
deleted file mode 100644 (file)
index 1829443..0000000
+++ /dev/null
@@ -1,670 +0,0 @@
-/* #includes */ /*{{{C}}}*//*{{{*/
-#include "config.h"
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "cpmdir.h"
-#include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
-/*}}}*/
-/* types */ /*{{{*/
-#define PHYSICAL_SECTOR_1       1 /* First physical sector */
-
-/* Use the INT13 interface rather than INT25/INT26. This appears to
- * improve performance, but is less well tested. */
-#define USE_INT13
-
-/* Windows 95 disk I/O functions - based on Stan Mitchell's DISKDUMP.C */
-#define VWIN32_DIOC_DOS_IOCTL   1   /* DOS ioctl calls 4400h-4411h */
-#define VWIN32_DIOC_DOS_INT25   2   /* absolute disk read, DOS int 25h */
-#define VWIN32_DIOC_DOS_INT26   3   /* absolute disk write, DOS int 26h */
-#define VWIN32_DIOC_DOS_INT13   4   /* BIOS INT13 functions */
-
-typedef struct _DIOC_REGISTERS {
-    DWORD reg_EBX;
-    DWORD reg_EDX;
-    DWORD reg_ECX;
-    DWORD reg_EAX;
-    DWORD reg_EDI;
-    DWORD reg_ESI;
-    DWORD reg_Flags;
-    }
-    DIOC_REGISTERS, *PDIOC_REGISTERS;
-
-#define   LEVEL0_LOCK   0
-#define   LEVEL1_LOCK   1
-#define   LEVEL2_LOCK   2
-#define   LEVEL3_LOCK   3
-#define   LEVEL1_LOCK_MAX_PERMISSION      0x0001
-
-#define   DRIVE_IS_REMOTE                 0x1000
-#define   DRIVE_IS_SUBST                  0x8000
-
-/*********************************************************
- **** Note: all MS-DOS data structures must be packed ****
- ****       on a one-byte boundary.                   ****
- *********************************************************/
-#pragma pack(1)
-
-typedef struct _DISKIO {
-    DWORD diStartSector;    /* sector number to start at */
-    WORD  diSectors;        /* number of sectors */
-    DWORD diBuffer;         /* address of buffer */
-    }
-    DISKIO, *PDISKIO;
-
-typedef struct MID {
-    WORD  midInfoLevel;       /* information level, must be 0 */
-    DWORD midSerialNum;       /* serial number for the medium */
-    char  midVolLabel[11];    /* volume label for the medium */
-    char  midFileSysType[8];  /* type of file system as 8-byte ASCII */
-    }
-    MID, *PMID;
-
-typedef struct driveparams {    /* Disk geometry */
-    BYTE special;
-    BYTE devicetype;
-    WORD deviceattrs;
-    WORD cylinders;
-    BYTE mediatype;
-    /* BPB starts here */
-    WORD bytespersector;
-    BYTE sectorspercluster;
-    WORD reservedsectors;
-    BYTE numberofFATs;
-    WORD rootdirsize;
-    WORD totalsectors;
-    BYTE mediaid;
-    WORD sectorsperfat;
-    WORD sectorspertrack;
-    WORD heads;
-    DWORD hiddensectors;
-    DWORD bigtotalsectors;
-    BYTE  reserved[6];
-    /* BPB ends here */
-    WORD sectorcount;
-    WORD sectortable[80];
-    } DRIVEPARAMS, *PDRIVEPARAMS;
-/*}}}*/
-
-static char *strwin32error(void) /*{{{*/
-{
-    static char buffer[1024];
-
-    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-                  NULL,
-                  GetLastError(),
-                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
-                  (LPTSTR)buffer,
-                  1023, NULL);
-    return buffer;
-}
-/*}}}*/
-static BOOL LockVolume( HANDLE hDisk ) /*{{{*/
-{
-    DWORD ReturnedByteCount;
-
-    return DeviceIoControl( hDisk, FSCTL_LOCK_VOLUME, NULL, 0, NULL,
-                0, &ReturnedByteCount, NULL );
-}
-/*}}}*/
-static BOOL UnlockVolume( HANDLE hDisk )  /*{{{*/
-{
-    DWORD ReturnedByteCount;
-
-    return DeviceIoControl( hDisk, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL,
-                0, &ReturnedByteCount, NULL );
-}
-/*}}}*/
-static BOOL DismountVolume( HANDLE hDisk ) /*{{{*/
-{
-    DWORD ReturnedByteCount;
-
-    return DeviceIoControl( hDisk, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL,
-                0, &ReturnedByteCount, NULL );
-}
-/*}}}*/
-static int GetDriveParams( HANDLE hVWin32Device, int volume, DRIVEPARAMS* pParam ) /*{{{*/
-  {
-  DIOC_REGISTERS reg;
-  BOOL bResult;
-  DWORD cb;
-
-  reg.reg_EAX = 0x440d; /* IOCTL for block device */
-  reg.reg_EBX = volume; /* one-based drive number */
-  reg.reg_ECX = 0x0860; /* Get Device params */
-  reg.reg_EDX = (DWORD)pParam;
-  reg.reg_Flags = 1; /* preset the carry flag */
-
-  bResult = DeviceIoControl( hVWin32Device, VWIN32_DIOC_DOS_IOCTL,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 ); 
-
-  if ( !bResult || (reg.reg_Flags & 1) ) 
-      return (reg.reg_EAX & 0xffff);
-
-  return 0;
-  }
-/*}}}*/
-static int SetDriveParams( HANDLE hVWin32Device, int volume, DRIVEPARAMS* pParam ) /*{{{*/
-  {
-  DIOC_REGISTERS reg;
-  BOOL bResult;
-  DWORD cb;
-
-  reg.reg_EAX = 0x440d; /* IOCTL for block device */
-  reg.reg_EBX = volume; /* one-based drive number */
-  reg.reg_ECX = 0x0840; /* Set Device params */
-  reg.reg_EDX = (DWORD)pParam;
-  reg.reg_Flags = 1; /* preset the carry flag */
-
-  bResult = DeviceIoControl( hVWin32Device, VWIN32_DIOC_DOS_IOCTL,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 ); 
-
-  if ( !bResult || (reg.reg_Flags & 1) ) 
-      return (reg.reg_EAX & 0xffff);
-
-  return 0;
-  }
-/*}}}*/
-static int GetMediaID( HANDLE hVWin32Device, int volume, MID* pMid ) /*{{{*/
-  {
-  DIOC_REGISTERS reg;
-  BOOL bResult;
-  DWORD cb;
-
-  reg.reg_EAX = 0x440d; /* IOCTL for block device */
-  reg.reg_EBX = volume; /* one-based drive number */
-  reg.reg_ECX = 0x0866; /* Get Media ID */
-  reg.reg_EDX = (DWORD)pMid;
-  reg.reg_Flags = 1; /* preset the carry flag */
-
-  bResult = DeviceIoControl( hVWin32Device, VWIN32_DIOC_DOS_IOCTL,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 );
-
-  if ( !bResult || (reg.reg_Flags & 1) ) 
-      return (reg.reg_EAX & 0xffff);
-
-  return 0;
-  }
-/*}}}*/
-static int VolumeCheck(HANDLE hVWin32Device, int volume, WORD* flags ) /*{{{*/
-{
-  DIOC_REGISTERS reg;
-  BOOL bResult;
-  DWORD cb;
-
-  reg.reg_EAX = 0x4409; /* Is Drive Remote */
-  reg.reg_EBX = volume; /* one-based drive number */
-  reg.reg_Flags = 1; /* preset the carry flag */
-
-  bResult = DeviceIoControl( hVWin32Device, VWIN32_DIOC_DOS_IOCTL,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 ); 
-
-  if ( !bResult || (reg.reg_Flags & 1) ) 
-      return (reg.reg_EAX & 0xffff);
-
-  *flags = (WORD)(reg.reg_EDX & 0xffff);
-  return 0;
-}
-/*}}}*/
-static int LockLogicalVolume(HANDLE hVWin32Device, int volume, int lock_level, int permissions) /*{{{*/
-{
-  DIOC_REGISTERS reg;
-  BOOL bResult;
-  DWORD cb;
-
-  reg.reg_EAX = 0x440d; /* generic IOCTL */
-  reg.reg_ECX = 0x084a; /* lock logical volume */
-  reg.reg_EBX = volume | (lock_level << 8);
-  reg.reg_EDX = permissions;
-  reg.reg_Flags = 1; /* preset the carry flag */
-
-  bResult = DeviceIoControl( hVWin32Device, VWIN32_DIOC_DOS_IOCTL,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 ); 
-
-  if ( !bResult || (reg.reg_Flags & 1) ) 
-      return (reg.reg_EAX & 0xffff);
-
-  return 0;
-}
-/*}}}*/
-static int UnlockLogicalVolume( HANDLE hVWin32Device, int volume ) /*{{{*/
-{
-  DIOC_REGISTERS reg;
-  BOOL bResult;
-  DWORD cb;
-
-  reg.reg_EAX = 0x440d;
-  reg.reg_ECX = 0x086a; /* lock logical volume  */
-  reg.reg_EBX = volume;
-  reg.reg_Flags = 1; /* preset the carry flag */
-
-  bResult = DeviceIoControl( hVWin32Device, VWIN32_DIOC_DOS_IOCTL,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 ); 
-
-  if ( !bResult || (reg.reg_Flags & 1) ) return -1;
-  return 0;
-}
-/*}}}*/
-static int w32mode(int mode) /*{{{*/
-{
-    switch(mode)
-    {
-        case O_RDONLY: return GENERIC_READ;
-        case O_WRONLY: return GENERIC_WRITE;
-    }
-    return GENERIC_READ | GENERIC_WRITE;
-}
-/*}}}*/
-
-/* Device_open           -- Open an image file                      */ /*{{{*/
-const char *Device_open(struct Device *sb, const char *filename, int mode, const char *deviceOpts)
-{
-    /* Windows 95/NT: floppy drives using handles */ 
-    if (strlen(filename) == 2 && filename[1] == ':')    /* Drive name */
-    {
-        char vname[20];
-        DWORD dwVers;
-
-        sb->fd = -1;
-        dwVers = GetVersion();
-
-        if (dwVers & 0x80000000L) /* Win32s (3.1) or Win32c (Win95) */
-        {
-            int lock, driveno, res, permissions;
-            unsigned short drive_flags;
-            MID media;
-
-            vname[0] = toupper(filename[0]);
-            driveno = vname[0] - 'A' + 1;   /* 1=A: 2=B: */
-            sb->drvtype = CPMDRV_WIN95;
-            sb->hdisk   = CreateFile( "\\\\.\\vwin32",
-                                       0,
-                                       0,
-                                       NULL,
-                                       0,
-                                       FILE_FLAG_DELETE_ON_CLOSE,
-                                       NULL );
-            if (!sb->hdisk)
-            {
-                return "Failed to open VWIN32 driver.";
-            }
-            if (VolumeCheck(sb->hdisk, driveno, &drive_flags))
-            {
-                CloseHandle(sb->hdisk);
-                return "Invalid drive";
-            } 
-            res = GetMediaID( sb->hdisk, driveno, &media );
-            if ( res )
-            {
-                const char *lboo = NULL;
-
-                if ( res == ERROR_INVALID_FUNCTION && 
-                            (drive_flags & DRIVE_IS_REMOTE )) 
-                     lboo = "Network drive";
-                else if (res == ERROR_ACCESS_DENIED) lboo = "Access denied";
-                /* nb: It's perfectly legitimate for GetMediaID() to fail; most CP/M */
-                /*     CP/M disks won't have a media ID. */ 
-           
-                if (lboo != NULL)
-                {
-                   CloseHandle(sb->hdisk);
-                   return lboo;
-                }
-            }
-            if (!res && 
-                (!memcmp( media.midFileSysType, "CDROM", 5 ) ||
-                 !memcmp( media.midFileSysType, "CD001", 5 ) ||
-                 !memcmp( media.midFileSysType, "CDAUDIO", 5 )))
-            {
-                CloseHandle(sb->hdisk);
-                return "CD-ROM drive";
-            }
-            if (w32mode(mode) & GENERIC_WRITE)
-            {
-                lock = LEVEL0_LOCK; /* Exclusive access */
-                permissions = 0;
-            }
-            else
-            {
-                lock = LEVEL1_LOCK; /* Allow other processes access */
-                permissions = LEVEL1_LOCK_MAX_PERMISSION;
-            }
-            if (LockLogicalVolume( sb->hdisk, driveno, lock, permissions))
-            {
-                CloseHandle(sb->hdisk);
-                return "Could not acquire a lock on the drive.";
-            }
-            sb->fd = driveno;   /* 1=A: 2=B: etc - we will need this later */
-            
-        }
-        else
-        {
-            sprintf(vname, "\\\\.\\%s", filename);
-            sb->drvtype = CPMDRV_WINNT;
-            sb->hdisk   = CreateFile(vname,         /* Name */
-                                     w32mode(mode), /* Access mode */
-                                     FILE_SHARE_READ|FILE_SHARE_WRITE, /*Sharing*/
-                                     NULL,          /* Security attributes */ 
-                                     OPEN_EXISTING, /* See MSDN */
-                                     0,             /* Flags & attributes */
-                                     NULL);         /* Template file */
-
-            if (sb->hdisk != INVALID_HANDLE_VALUE)
-            {
-                sb->fd = 1;   /* Arbitrary value >0 */
-                if (LockVolume(sb->hdisk) == FALSE)    /* Lock drive */
-                {
-                    char *lboo = strwin32error();
-                    CloseHandle(sb->hdisk);
-                    sb->fd = -1;
-                    return lboo;
-                }
-            }
-            else return strwin32error();
-        }
-        sb->opened = 1;
-        return NULL;
-    }
-
-    /* Not a floppy. Treat it as a normal file */
-
-    mode |= O_BINARY;
-    sb->fd = open(filename, mode);
-    if (sb->fd == -1) return strerror(errno);
-    sb->drvtype = CPMDRV_FILE;
-    sb->opened  = 1;
-    return NULL;
-}
-/*}}}*/
-/* Device_setGeometry    -- Set disk geometry                       */ /*{{{*/
-const char * Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry)
-{
-  int n;
-
-  this->secLength=secLength;
-  this->sectrk=sectrk;
-  this->tracks=tracks;
-  // Bill Buckels - add this->offset
-  this->offset=offset;
-
-
-  // Bill Buckels - not sure what to do here
-  if (this->drvtype == CPMDRV_WIN95)
-  {
-      DRIVEPARAMS drvp;
-      memset(&drvp, 0, sizeof(drvp));
-      if (GetDriveParams( this->hdisk, this->fd, &drvp )) return "GetDriveParams failed";
-
-      drvp.bytespersector  = secLength;
-      drvp.sectorspertrack = sectrk;
-      drvp.totalsectors    = sectrk * tracks;
-
-/* Guess the cylinder/head configuration from the track count. This will
- * get single-sided 80-track discs wrong, but it's that or double-sided
- * 40-track (or add cylinder/head counts to diskdefs) 
- */
-      if (tracks < 44)
-      {
-        drvp.cylinders       = tracks;
-        drvp.heads           = 1;
-      }
-      else
-      {
-        drvp.cylinders       = tracks / 2;
-        drvp.heads           = 2;
-      }
-
-/* Set up "reasonable" values for the other members */
-
-      drvp.sectorspercluster = 1024 / secLength;
-      drvp.reservedsectors   = 1;
-      drvp.numberofFATs      = 2;
-      drvp.sectorcount       = sectrk;
-      drvp.rootdirsize       = 64;
-      drvp.mediaid           = 0xF0;
-      drvp.hiddensectors     = 0;
-      drvp.sectorsperfat     = 3;
-      for (n = 0; n < sectrk; n++)
-      {
-          drvp.sectortable[n*2]   = n + PHYSICAL_SECTOR_1;    /* Physical sector numbers */ 
-          drvp.sectortable[n*2+1] = secLength;
-      }
-      drvp.special = 6;
-/* We have not set:
-
-    drvp.mediatype   
-    drvp.devicetype  
-    drvp.deviceattrs  
-
-    which should have been read correctly by GetDriveParams().
-  */
-      SetDriveParams( this->hdisk, this->fd, &drvp );
-  }
-  return NULL;
-}
-/*}}}*/
-/* Device_close          -- Close an image file                     */ /*{{{*/
-const char *Device_close(struct Device *sb)
-{
-    sb->opened = 0;
-    switch(sb->drvtype)
-    {
-        case CPMDRV_WIN95:
-            UnlockLogicalVolume(sb->hdisk, sb->fd );
-            if (!CloseHandle( sb->hdisk )) return strwin32error();
-            return NULL;
-
-        case CPMDRV_WINNT:
-            DismountVolume(sb->hdisk);
-            UnlockVolume(sb->hdisk);
-            if (!CloseHandle(sb->hdisk)) return strwin32error();
-            return NULL; 
-    }
-    if (close(sb->fd)) return strerror(errno);
-    return NULL; 
-}
-/*}}}*/
-/* Device_readSector     -- read a physical sector                  */ /*{{{*/
-const char *Device_readSector(const struct Device *drive, int track, int sector, char *buf)
-{
-  int res;
-  off_t offset;
-
-  assert(sector>=0);
-  assert(sector<drive->sectrk);
-  assert(track>=0);
-  assert(track<drive->tracks);
-
-  offset = ((sector+track*drive->sectrk)*drive->secLength);
-
-  if (drive->drvtype == CPMDRV_WINNT)
-  {
-        LPVOID iobuffer;
-        DWORD  bytesread;
-    
-        // Bill Buckels - add drive->offset
-        if (SetFilePointer(drive->hdisk, offset+drive->offset, NULL, FILE_BEGIN) == INVALID_FILE_SIZE)
-        {
-            return strwin32error();
-        }
-        iobuffer = VirtualAlloc(NULL, drive->secLength, MEM_COMMIT, PAGE_READWRITE);
-        if (!iobuffer) 
-        {
-            return strwin32error();
-        }
-        res = ReadFile(drive->hdisk, iobuffer, drive->secLength, &bytesread, NULL);
-        if (!res)
-        {
-            char *lboo = strwin32error();
-            VirtualFree(iobuffer, drive->secLength, MEM_RELEASE);
-            return lboo;
-        } 
-
-        memcpy(buf, iobuffer, drive->secLength);
-        VirtualFree(iobuffer, drive->secLength, MEM_RELEASE);
-
-        if (bytesread < (unsigned)drive->secLength)
-        {
-            memset(buf + bytesread, 0, drive->secLength - bytesread);
-        }
-        return NULL;
-  }
-
-  // Bill Buckels - not sure what to do here
-  if (drive->drvtype == CPMDRV_WIN95)
-  {
-        DIOC_REGISTERS reg;
-        BOOL bResult;
-        DWORD cb;
-
-#ifdef USE_INT13
-        int cyl, head;
-
-        if (drive->tracks < 44) { cyl = track;    head = 0; }
-        else                    { cyl = track/2;  head = track & 1; }
-
-        reg.reg_EAX      = 0x0201;  /* Read 1 sector */
-        reg.reg_EBX      = (DWORD)buf;
-        reg.reg_ECX      = (cyl << 8)  | (sector + PHYSICAL_SECTOR_1);
-        reg.reg_EDX      = (head << 8) | (drive->fd - 1);
-        reg.reg_Flags    = 1;       /* preset the carry flag */
-        bResult          = DeviceIoControl( drive->hdisk, VWIN32_DIOC_DOS_INT13,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 );
-#else
-        DISKIO di;
-
-        reg.reg_EAX      = drive->fd - 1;  /* zero-based volume number */
-        reg.reg_EBX      = (DWORD)&di;
-        reg.reg_ECX      = 0xffff;  /* use DISKIO structure */
-        reg.reg_Flags    = 1;       /* preset the carry flag */
-        di.diStartSector = sector+track*drive->sectrk;
-        di.diSectors     = 1;
-        di.diBuffer      = (DWORD)buf;
-        bResult          = DeviceIoControl( drive->hdisk, VWIN32_DIOC_DOS_INT25,
-             &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 );
-
-#endif
-        if ( !bResult || (reg.reg_Flags & 1) )
-        {
-            if (GetLastError()) return strwin32error();
-            return "Unknown read error.";
-        }
-        return 0;
-  }
-
-  // Bill Buckels - add drive->offset
-  if (lseek(drive->fd,offset+drive->offset,SEEK_SET)==-1)
-  {
-    return strerror(errno);
-  }
-  if ((res=read(drive->fd, buf, drive->secLength)) != drive->secLength)
-  {
-    if (res==-1)
-    {
-      return strerror(errno);
-    }
-    else memset(buf+res,0,drive->secLength-res); /* hit end of disk image */
-  }
-  return NULL;
-}
-/*}}}*/
-/* Device_writeSector    -- write physical sector                   */ /*{{{*/
-const char *Device_writeSector(const struct Device *drive, int track, int sector, const char *buf)
-{
-  off_t offset;
-  int res;
-
-  assert(sector>=0);
-  assert(sector<drive->sectrk);
-  assert(track>=0);
-  assert(track<drive->tracks);
-
-  offset = ((sector+track*drive->sectrk)*drive->secLength);
-
-  if (drive->drvtype == CPMDRV_WINNT)
-  {
-        LPVOID iobuffer;
-        DWORD  byteswritten;
-
-        // Bill Buckels - add drive->offset
-        if (SetFilePointer(drive->hdisk, offset+drive->offset, NULL, FILE_BEGIN) == INVALID_FILE_SIZE)
-        {
-            return strwin32error();
-        }
-        iobuffer = VirtualAlloc(NULL, drive->secLength, MEM_COMMIT, PAGE_READWRITE);
-        if (!iobuffer)
-        {
-            return strwin32error();
-        }
-        memcpy(iobuffer, buf, drive->secLength);
-        res = WriteFile(drive->hdisk, iobuffer, drive->secLength, &byteswritten, NULL);
-        if (!res || (byteswritten < (unsigned)drive->secLength))
-        {
-            char *lboo = strwin32error();
-            VirtualFree(iobuffer, drive->secLength, MEM_RELEASE);
-            return lboo;
-        }
-
-        VirtualFree(iobuffer, drive->secLength, MEM_RELEASE);
-        return NULL;
-  }
-
-  // Bill Buckels - not sure what to do here
-  if (drive->drvtype == CPMDRV_WIN95)
-  {
-        DIOC_REGISTERS reg;
-        BOOL bResult;
-        DWORD cb;
-
-#ifdef USE_INT13
-        int cyl, head;
-
-        if (drive->tracks < 44) { cyl = track;    head = 0; }
-        else                    { cyl = track/2;  head = track & 1; }
-
-        reg.reg_EAX      = 0x0301;  /* Write 1 sector */
-        reg.reg_EBX      = (DWORD)buf;
-        reg.reg_ECX      = (cyl << 8)  | (sector + PHYSICAL_SECTOR_1);
-        reg.reg_EDX      = (head << 8) | (drive->fd - 1);
-        reg.reg_Flags    = 1;       /* preset the carry flag */
-        bResult          = DeviceIoControl( drive->hdisk, VWIN32_DIOC_DOS_INT13,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 );
-#else
-        DISKIO di;
-
-        reg.reg_EAX      = drive->fd - 1;  /* zero-based volume number */
-        reg.reg_EBX      = (DWORD)&di;
-        reg.reg_ECX      = 0xffff;  /* use DISKIO structure */
-        reg.reg_Flags    = 1;       /* preset the carry flag */
-        di.diStartSector = sector+track*drive->sectrk;
-        di.diSectors     = 1;
-        di.diBuffer      = (DWORD)buf;
-        bResult          = DeviceIoControl( drive->hdisk, VWIN32_DIOC_DOS_INT26,
-              &reg, sizeof( reg ), &reg, sizeof( reg ), &cb, 0 ); 
-#endif
-
-        if ( !bResult || (reg.reg_Flags & 1) )
-        {
-            if (GetLastError()) return strwin32error();
-            return "Unknown write error.";
-        }
-        return NULL;
-  }
-
-  // Bill Buckels - add drive->offset
-  if (lseek(drive->fd,offset+drive->offset, SEEK_SET)==-1)
-  {
-    return strerror(errno);
-  }
-  if (write(drive->fd, buf, drive->secLength) == drive->secLength) return NULL;
-  return strerror(errno);
-}
-/*}}}*/
index 630317a048f239da7e753fb3212a9bd05ad97367..aedb7330af4eff07bdd9e5b0bd2670cb092c4132 100644 (file)
--- a/diskdefs
+++ b/diskdefs
@@ -20,6 +20,17 @@ diskdef 4mb-hd
   os p2dos
 end
 
+diskdef sdcard
+  seclen 512
+  tracks 256
+  sectrk 64
+  blocksize 8192
+  maxdir 256
+  skew 0
+  boottrk 1
+  os 2.2
+end
+
 diskdef pcw
   seclen 512
   tracks 40
@@ -313,6 +324,7 @@ diskdef kpii
   sectrk 10
   blocksize 1024
   maxdir 64
+  dirblks 4
   skew 0
   boottrk 1
   os 2.2
@@ -326,6 +338,7 @@ diskdef kpiv
   sectrk 10
   blocksize 2048
   maxdir 64
+  dirblks 2
   skew 0
   boottrk 1
   os 2.2
@@ -493,7 +506,8 @@ diskdef dreamdisk80
   os 2.2
 end
 
-diskdef rc759
+# RC75x series
+diskdef rc75x
   seclen 1024
   tracks 154
   sectrk 8
@@ -766,6 +780,54 @@ diskdef heassdd8
 # DENSITY MFM ,LOW 
 end
 
+# ZEN7  Zenith Z-100 - SSDD 48 tpi 5.25" - 512 x 8
+diskdef zen7
+  seclen 512
+  tracks 40
+  sectrk 8
+  blocksize 1024
+  maxdir 128
+  skew 1
+  boottrk 2
+  os 2.2
+end
+
+# ZEN8  Zenith Z-100 - DSDD 48 tpi 5.25" - 512 x 8
+diskdef zen8
+  seclen 512
+  tracks 80
+  sectrk 8
+  blocksize 2048
+  maxdir 256
+  skew 1
+  boottrk 2
+  os 2.2
+end
+
+# ZEN9  Zenith Z-100 - SSSD 8" - 128 x 26
+diskdef zen9
+  seclen 128
+  tracks 77
+  sectrk 26
+  blocksize 1024
+  maxdir 64
+  skew 6
+  boottrk 2
+  os 2.2
+end
+
+# ZENA  Zenith Z-100 - SSDD 8" - 256 x 26
+diskdef zena
+  seclen 256
+  tracks 77
+  sectrk 26
+  blocksize 2048
+  maxdir 128
+  skew 9
+  boottrk 2
+  os 2.2
+end
+
 # Morrow Designs Micro-Decision         DOUBLE
 # 64k CP/M Vers. 2.2 Rev.2.3            SIDED
 # Copyright '76, '77, '78, '79, '80
@@ -819,38 +881,6 @@ diskdef osb1sssd
 # BSH 4 BLM 15 EXM 1 DSM 45 DRM 63 AL0 080H AL1 0 OFS 3
 end
 
-# BEGIN ampdsdd  Ampro - DSDD 48 tpi 5.25" - 512 x 10
-# Test OK - image size = 409,600, from Don Maslin's archive
-diskdef ampdsdd
-  seclen 1024
-  tracks 80
-  sectrk 5
-  blocksize 2048
-  maxdir 128
-  skew 0
-  boottrk 2
-  os 2.2
-  libdsk:format ampro400d
-# DENSITY MFM ,LOW 
-# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2
-end
-
-# BEGIN ampdsdd80  Ampro - DSDD 96 tpi 5.25" - 512 x 10
-# Test OK - image size = 819,200, from Don Maslin's archive
-diskdef ampdsdd80
-  seclen 1024
-  tracks 160
-  sectrk 5
-  blocksize 2048
-  maxdir 128
-  skew 0
-  boottrk 2
-  os 2.2
-  libdsk:format ampro800
-# DENSITY MFM ,LOW 
-# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2
-end
-
 # BEGIN altdsdd  Altos - DSDD 5" - 512 x 9
 # Test OK - both CP/M and MP/M - image size = 737,280, from Dave Dunfield
 diskdef altdsdd
@@ -866,6 +896,8 @@ diskdef altdsdd
 # BSH 5 BLM 31 EXM 3 DSM 176 DRM 176 AL0 0C0H AL1 0 OFS 2
 end
 
+# All TRS formats added by Larry Kraemer
+
 # BEGIN trsomsssd  TRS-80 Model 1, Omikron CP/M - SSSD 48 tpi 5.25" - 128 x 18
 # Test OK - image size = 80,640, from TRS-80 Yahoo Group posting
 diskdef trsomsssd
@@ -881,6 +913,304 @@ diskdef trsomsssd
 # BSH 3 BLM 7 EXM 0 DSM 71 DRM 63 AL0 0C0H AL1 0 OFS 3
 end
 
+diskdef trsg         #= TRS-80 Model 4,4P Montezuma System 170K - SSDD 48 tpi 5.25"
+  seclen 256         #= Sectors xx,256
+  tracks 40          #= (Cylinders * Sides) = 40*1 = 40
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 18          #= Sectors 18,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsh         #= TRS-80 Model 4,4P Montezuma Data 200K - SSDD 48 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 40          #= (Cylinders * Sides) = 40*1 = 40
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsi         #= TRS-80 Model 4,4P Montezuma System 350K - DSDD 48 tpi 5.25"
+  seclen 256         #= Sectors xx,256
+  tracks 80          #= (Cylinders * Sides) = 40*2 = 80
+#  sides outout       #= Order of Cylinders  = alt, outout, outback
+  sectrk 18          #= Sectors 18,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+#end
+
+diskdef trsj         #= TRS-80 Model 4,4P Montezuma Data 400K - DSDD 48 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 80          #= (Cylinders * Sides) = 40*2 = 80
+#  sides outout       #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsk         #= TRS-80 Model 4,4P Montezuma System 350K - SSDD 96 tpi 5.25"
+  seclen 256         #= Sectors xx,256
+  tracks 80          #= (Cylinders * Sides) = 80*1 = 80
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 18          #= Sectors 18,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsl         #= TRS-80 Model 4,4P Montezuma Data 400K - SSDD 96 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 80          #= (Cylinders * Sides) = 80*1 = 80
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsm         #= TRS-80 Model 4,4P Montezuma System 710K - DSDD 96 tpi 5.25"
+  seclen 256         #= Sectors xx,256
+  tracks 160         #= (Cylinders * Sides) = 80*2 = 160
+#  sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 18          #= Sectors 18,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsn         #= TRS-80 Model 4,4P Montezuma Data 800K - DSDD 96 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 160         #= (Cylinders * Sides) = 80*2 = 160
+#  sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 0             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trso         #= TRS-80 Model 4,4P Montezuma Extend System 190K - SSDD 48 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 40          #= (Cylinders * Sides) = 40*1 = 40
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try x
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsp         #= TRS-80 Model 4,4P Montezuma Extend System 390K - DSDD 48 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 80          #= (Cylinders * Sides) = 40*2 = 80
+#  sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsq         #= TRS-80 Model 4,4P Montezuma Extend System 390K - SSDD 96 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 80          #= (Cylinders * Sides) = 80*1 = 80
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsr         #= TRS-80 Model 4,4P Montezuma Extend System 790K - DSDD 96 tpi 5.25"
+  seclen 512         #= Sectors xx,512
+  tracks 160         #= (Cylinders * Sides) = 80*2 = 160
+#  sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 2          #= OFS = 2
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trss         #= TRS-80 Model 4,4P Montezuma Super Data 220K - SSDD 48 tpi 5.25"
+  seclen 1024        #= Sectors xx,1024
+  tracks 40          #= (Cylinders * Sides) = 40*1 = 40
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 6           #= Sectors 6,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trst         #= TRS-80 Model 4,4P Montezuma Super Data 440K - DSDD 48 tpi 5.25"
+  seclen 1024        #= Sectors xx,1024
+  tracks 80          #= (Cylinders * Sides) = 40*2 = 80
+#  sides outout       #= Order of Cylinders  = alt, outout, outback
+  sectrk 6           #= Sectors 6,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsu         #= TRS-80 Model 4,4P Montezuma Super Data 440K - SSDD 96 tpi 5.25"
+  seclen 1024        #= Sectors xx,1024
+  tracks 80          #= (Cylinders * Sides) = 80*1 = 80
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 6           #= Sectors 6,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsv         #= TRS-80 Model 4,4P Montezuma Super Data 880K - DSDD 96 tpi 5.25"
+  seclen 1024        #= Sectors xx,1024
+  tracks 160         #= (Cylinders * Sides) = 80*2 = 160
+#  sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 6           #= Sectors 6,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try x
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+diskdef trsw         #= TRS-80 Model 4,4P Montezuma System 400K - SSDD 96 tpi 3.5"
+  seclen 512         #= Sectors xx,512
+  tracks 80          #= (Cylinders * Sides) = 80*1 = 80
+# sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 10          #= Sectors 10,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+#  datarate DD        #= DENSITY SD, DD, HD, or ED
+#  FM NO              #= Format YES = FM, or NO = MFM
+  skew 2             #= [0..8] try 2
+  boottrk 0          #= OFS = 0
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+#BEGIN TRSE  TRS-80 II/12/16 Aton CP/M - SSHD 8" - 1024 x 8
+diskdef trse
+  seclen 1024
+  tracks 77
+  sectrk 8
+  blocksize 2048
+  maxdir 128
+  datarate DD
+  fm NO
+  skew 3
+  boottrk 0
+  offset 11520
+  os 2.2
+end
+
+# TRSF  TRS-80 II/12/16 Aton CP/M  - DSHD 8" - 1024 x 8
+diskdef trsf
+  seclen 1024
+  tracks 154
+  sides alt
+  sectrk 8
+  blocksize 2048
+  maxdir 192
+  skew 3
+  boottrk 0
+  offset 11520
+  os 2.2
+end
+
+# TRS5  TRS-80, Lifeboat CP/M (1024 bytes/sector) - SSDD 8"
+# The first track is 26 sectors with 128 bytes, the rest are 1024 x 8
+diskdef trs5
+  seclen 1024
+  tracks 75
+  sectrk 8
+  blocksize 2048
+  maxdir 128
+  skew 3
+  boottrk 0
+  os 2.2
+  offset 11520
+end
+
 # Memotech type 03, ie: 3.5" or 5.25", D/S, D/D, S/T
 # 40 tracks, 2 sides, 16 sectors/track, 256 bytes/sector
 # Bytes on the media = 2*40*16*256 = 327680
@@ -1394,3 +1724,237 @@ diskdef ampro800
   boottrk 2
   os 2.2
 end
+
+# Ampro - DSDD 48 tpi 5.25" - 512 x 10
+diskdef ampro400d
+  seclen 512
+  tracks 80
+  sectrk 10
+  blocksize 2048
+  maxdir 128
+  skew 0
+  boottrk 2
+  os 2.2
+  libdsk:format ampro400d
+# DENSITY MFM ,LOW 
+# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2
+end
+
+# BEGIN ampdsdd80  Ampro - DSDD 96 tpi 5.25" - 512 x 10
+# Test OK - image size = 819,200, from Don Maslin's archive
+diskdef ampdsdd80
+  seclen 1024
+  tracks 160
+  sectrk 5
+  blocksize 2048
+  maxdir 128
+  skew 0
+  boottrk 2
+  os 2.2
+  libdsk:format ampro800
+# DENSITY MFM ,LOW 
+# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2
+end
+
+# ALTAIRZ80 SIMH *dsk 8MB Harddisk (Type AZ80 HDSK)
+diskdef 8megAltairSIMH
+  seclen 128
+  tracks 2048
+  sectrk 32
+  blocksize 4096
+  maxdir 1024
+  skew 0
+  boottrk 6
+  os 2.2
+end
+
+# ALTAIRZ80 SIMH *dsk MITS 88-DISK 137 Byte/Sektor
+# speedball (copylib) skewtable
+diskdef simh
+  seclen 128
+  tracks 254
+  sectrk 32
+  blocksize 2048
+  maxdir 256
+  skew 17
+  boottrk 6
+  os 2.2
+end
+
+diskdef all1         #= Allen-Bradley Advisor+ - DSDD 3.5"
+  seclen 512         #= Sectors xx,512
+  tracks 160         #= (Cylinders * Sides) = 80*2 = 160
+  sides alt          #= Order of Cylinders  = alt, outout, outback
+  sectrk 8           #= Sectors 8,xxx
+  blocksize 2048     #= (128*(BLM+1)) =  7=1024, 15=2048, 31=4096, 63=8192
+  maxdir 128         #= (DRM+1) = 128
+  datarate DD        #= DENSITY SD, DD, HD, or ED
+  FM NO              #= Format YES = FM, or NO = MFM
+  skew 0             #= [0..8] try x
+  boottrk 1          #= OFS = 1
+#                    #= 2, 2.2, or 3 (NO comment on next line)
+  os 2.2
+end
+
+# COM8  Compupro (Viasyn) 8/16 - SSDD 8" - 1024 x 8
+# IMD RAW format
+diskdef com8
+  seclen 1024
+  tracks 77
+  sectrk 8
+  blocksize 2048
+  maxdir 128
+  skew 3
+  offset 11520
+  boottrk 0
+  os 2.2
+end
+
+# Spectravideo SVI-728 (MSX) with SVI-707 floppy drive
+diskdef svi707
+  seclen 256
+  tracks 40
+  sectrk 17
+  blocksize 2048
+  maxdir 64
+  skew 0
+  boottrk 3
+  os 2.2
+end
+
+# Intel MDS/22 8" Double Density
+diskdef mds-dd
+  seclen 128
+  tracks 77
+  sectrk 52
+  blocksize 2048
+  maxdir 128
+  skew 0
+  boottrk 2
+  os 2.2
+end
+
+# Intel MDS/22 8" Single Density. Untested.
+diskdef mds-sd
+  seclen 128
+  tracks 77
+  sectrk 26
+  blocksize 1024
+  maxdir 64
+  skew 0
+  boottrk 2
+  os 2.2
+end
+
+# CF card in PCMCIA slot on NC200 with cpmish
+diskdef nc200cf
+  seclen 512
+  tracks 256
+  sectrk 256
+  blocksize 16384
+  maxdir 512
+  boottrk 0
+  os 2.2
+end
+
+# Floppy image on NC200 with cpmish
+diskdef nc200cpm
+  seclen 512
+  tracks 80
+  sectrk 18
+  blocksize 2048
+  maxdir 128
+  boottrk 2
+  os 2.2
+end
+
+# ZCN format drive partitions in nc100em's nc100.card
+# use this for a bootable A: drive
+# (assumes ZCN system is 12k, which it has been for years)
+diskdef zcna_boot
+  seclen 1024
+  tracks 256
+  sectrk 1
+  blocksize 1024
+  maxdir 64
+  skew 0
+  boottrk 13
+  os 2.2
+end
+
+# use this for a non-bootable A: drive
+diskdef zcna_nonboot
+  seclen 1024
+  tracks 256
+  sectrk 1
+  blocksize 1024
+  maxdir 64
+  skew 0
+  boottrk 1
+  os 2.2
+end
+
+# ZCN b/c/d all assumed to be non-bootable
+diskdef zcnb
+  seclen 1024
+  tracks 256
+  sectrk 1
+  blocksize 1024
+  maxdir 64
+  skew 0
+  boottrk 1
+  os 2.2
+  offset 256KB
+end
+
+diskdef zcnc
+  seclen 1024
+  tracks 256
+  sectrk 1
+  blocksize 1024
+  maxdir 64
+  skew 0
+  boottrk 1
+  os 2.2
+  offset 512KB
+end
+
+diskdef zcnd
+  seclen 1024
+  tracks 256
+  sectrk 1
+  blocksize 1024
+  maxdir 64
+  skew 0
+  boottrk 1
+  os 2.2
+  offset 768KB
+end
+
+# Hewlett-Packard HP9000-200 - 70-track SS drive that emulates a
+# 35 track DSDD 48 tpi 5.25"
+diskdef HP25
+  seclen 256
+  tracks 66
+  sectrk 16
+  blocksize 1024
+  maxdir 128
+  skew 0
+  boottrk 3
+  os 2.2
+end
+
+
+
+diskdef yaze512
+# BSH 4 BLM 15 EXM 1 DSM 255 DRM 1023 AL0 0FFH AL1 0FFH OFS 0
+seclen 128
+tracks 4096
+sectrk 8
+blocksize 2048
+maxdir 1024
+skew 1
+offset 128
+boottrk 0
+os 3
+end
diff --git a/diskdefs.5 b/diskdefs.5
new file mode 100644 (file)
index 0000000..43ad10e
--- /dev/null
@@ -0,0 +1,52 @@
+.\" Believe it or not, reportedly there are nroffs which do not know \(en
+.if n .ds en -
+.if t .ds en \(en
+.TH DISKDEFS 5 "October 10, 2022" "CP/M tools" "File formats"
+.SH NAME \"{{{roff}}}\"{{{
+diskdefs \- CP/M disk and file system format definitions
+.\"}}}
+.SH DESCRIPTION \"{{{
+The diskdefs file contains CP/M format descriptions,
+because CP/M in general does not store those in the file system and there are
+no standards of any kind.
+.PP
+A diskdefs file consists of one or more entries of the format:
+.PP
+.nf
+.RS
+\fBdiskdef\fP \fIname\fP
+  \fBseclen\fP \fIsize\fP
+  \fBtracks\fP \fIcount\fP
+  \fBsectrk\fP \fIcount\fP
+  \fBblocksize\fP \fIsize\fP
+  \fBmaxdir\fP \fIcount\fP
+  [\fBdirblks\fP \fIcount\fP]
+  \fBboottrk\fP \fInumber\fP
+  [\fBbootsec\fP \fInumber\fP]
+  [\fBskew\fP \fInumber\fP]
+  [\fBskewtab\fP \fIsector\fP[\fB,\fP\fIsector\fP]...]
+  [\fBos\fP \fB2.2\fP|\fB3\fP|\fBisx\fP|\fBp2dos\fP|\fBzsys\fP]
+  [\fBoffset\fP \fIsize\fP]
+  [\fBlogicalextents\fP \fIcount\fP]
+  [\fBlibdsk:format\fP \fIname\fP]
+\fBend\fP
+.RE
+.fi
+.PP
+\fBskew\fP and \fBskewtab\fP must only be used exclusively.
+.PP
+Comments are marked with a leading hash or semicolon and extend to the
+end of the line.
+.PP
+It is possible to reserve space after the directory beyond \fBmaxdir\fP
+using an inflated DPB ALV0.  If the format makes use of that,
+\fBdirblks\fP must be set.
+.PP
+\fBbootsec\fP contains the total number of sectors used by the boot area.
+This is for CP/M systems that map multiple logical tracks onto a physical
+track. While raw disk images can be configured for doing the same,
+accessing libdsk images needs to be done by physical tracks.
+.\"}}}
+.SH "SEE ALSO" \"{{{
+.IR cpm (5)
+.\"}}}
diff --git a/diskdefs.5.in b/diskdefs.5.in
new file mode 100644 (file)
index 0000000..0649cb3
--- /dev/null
@@ -0,0 +1,52 @@
+.\" Believe it or not, reportedly there are nroffs which do not know \(en
+.if n .ds en -
+.if t .ds en \(en
+.TH DISKDEFS 5 "@UPDATED@" "CP/M tools" "File formats"
+.SH NAME \"{{{roff}}}\"{{{
+diskdefs \- CP/M disk and file system format definitions
+.\"}}}
+.SH DESCRIPTION \"{{{
+The diskdefs file contains CP/M format descriptions,
+because CP/M in general does not store those in the file system and there are
+no standards of any kind.
+.PP
+A diskdefs file consists of one or more entries of the format:
+.PP
+.nf
+.RS
+\fBdiskdef\fP \fIname\fP
+  \fBseclen\fP \fIsize\fP
+  \fBtracks\fP \fIcount\fP
+  \fBsectrk\fP \fIcount\fP
+  \fBblocksize\fP \fIsize\fP
+  \fBmaxdir\fP \fIcount\fP
+  [\fBdirblks\fP \fIcount\fP]
+  \fBboottrk\fP \fInumber\fP
+  [\fBbootsec\fP \fInumber\fP]
+  [\fBskew\fP \fInumber\fP]
+  [\fBskewtab\fP \fIsector\fP[\fB,\fP\fIsector\fP]...]
+  [\fBos\fP \fB2.2\fP|\fB3\fP|\fBisx\fP|\fBp2dos\fP|\fBzsys\fP]
+  [\fBoffset\fP \fIsize\fP]
+  [\fBlogicalextents\fP \fIcount\fP]
+  [\fBlibdsk:format\fP \fIname\fP]
+\fBend\fP
+.RE
+.fi
+.PP
+\fBskew\fP and \fBskewtab\fP must only be used exclusively.
+.PP
+Comments are marked with a leading hash or semicolon and extend to the
+end of the line.
+.PP
+It is possible to reserve space after the directory beyond \fBmaxdir\fP
+using an inflated DPB ALV0.  If the format makes use of that,
+\fBdirblks\fP must be set.
+.PP
+\fBbootsec\fP contains the total number of sectors used by the boot area.
+This is for CP/M systems that map multiple logical tracks onto a physical
+track. While raw disk images can be configured for doing the same,
+accessing libdsk images needs to be done by physical tracks.
+.\"}}}
+.SH "SEE ALSO" \"{{{
+.IR cpm (5)
+.\"}}}
index a167ef0e3c04f736885f944a1c4712febbbf8814..e88269ac05589f257f1c72c62123f66d6119b96d 100644 (file)
@@ -1,4 +1,4 @@
-.TH FSCK.CPM 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH FSCK.CPM 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME ..\"{{{roff}}}\"{{{
 fsck.cpm \- check a CP/M file system
 .\"}}}
@@ -8,6 +8,7 @@ fsck.cpm \- check a CP/M file system
 .RB [ \-f
 .IR format ]
 .RB [ \-n ]
+.RB [ \-u ]
 .I image
 .ad b
 .\"}}}
@@ -30,6 +31,8 @@ libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw ima
 (requires building cpmtools with support for libdsk).
 .IP "\fB\-n\fP"
 Open the file system read-only and do not repair any errors.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" .\"{{{
 Upon successful completion, exit code 0 is returned.
@@ -55,7 +58,7 @@ The number of used blocks includes the blocks used for system tracks
 and the directory.
 .\"}}}
 .SH AUTHORS .\"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index b27697e38a25359967f3fc7d12d6cccda56b50a2..84a3c80388133942a8e0d5bce102553d3f4ec339 100644 (file)
@@ -8,6 +8,7 @@ fsck.cpm \- check a CP/M file system
 .RB [ \-f
 .IR format ]
 .RB [ \-n ]
+.RB [ \-u ]
 .I image
 .ad b
 .\"}}}
@@ -30,6 +31,8 @@ libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw ima
 (requires building cpmtools with support for libdsk).
 .IP "\fB\-n\fP"
 Open the file system read-only and do not repair any errors.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" .\"{{{
 Upon successful completion, exit code 0 is returned.
@@ -55,7 +58,7 @@ The number of used blocks includes the blocks used for system tracks
 and the directory.
 .\"}}}
 .SH AUTHORS .\"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index 585015b0cac3f91db0cc337b4bf42004dbd4d3e4..380df469f757b50874bc382d86a032b6796a1a2f 100644 (file)
 #include "getopt_.h"
 #include "cpmdir.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 /* #defines */ /*{{{*/
 /* your favourite password *:-) */
@@ -240,12 +236,12 @@ static int fsck(struct cpmInode *root, const char *image)
       {
         int block,min,max,i;
 
-        min=(sb->maxdir*32+sb->blksiz-1)/sb->blksiz;
+        min=sb->dirblks;
         max=sb->size;
         for (i=0; i<16; ++i)
         {
           block=dir->pointers[i]&0xff;
-          if (sb->size>=256) block+=(dir->pointers[++i]&0xff)<<8;
+          if (sb->size>256) block+=(dir->pointers[++i]&0xff)<<8;
           if (block>0)
           {
             ++usedBlocks;
@@ -278,8 +274,8 @@ static int fsck(struct cpmInode *root, const char *image)
         {
         /* [JCE] Rewritten because the previous implementation didn't work
          *       properly with Visual C++ */
-          if (dir->pointers[i] || (sb->size>=256 && dir->pointers[i+1])) ++used;
-          if (sb->size >= 256) ++i;
+          if (dir->pointers[i] || (sb->size>256 && dir->pointers[i+1])) ++used;
+          if (sb->size>256) ++i;
         }
         recordsInBlocks=(((unsigned char)dir->blkcnt)*128+sb->blksiz-1)/sb->blksiz;
         if (recordsInBlocks!=used)
@@ -492,13 +488,13 @@ static int fsck(struct cpmInode *root, const char *image)
     for (i=0; i<16; ++i)
     {
       block=dir->pointers[i]&0xff;
-      if (sb->size>=256) block+=(dir->pointers[++i]&0xff)<<8;
+      if (sb->size>256) block+=(dir->pointers[++i]&0xff)<<8;
       for (extent2=0; extent2<sb->maxdir; ++extent2) if ((dir2=sb->dir+extent2)->status>=0 && dir2->status<=(sb->type==CPMFS_P2DOS ? 31 : 15))
       {
         for (j=0; j<16; ++j)
         {
           block2=dir2->pointers[j]&0xff;
-          if (sb->size>=256) block2+=(dir2->pointers[++j]&0xff)<<8;
+          if (sb->size>256) block2+=(dir2->pointers[++j]&0xff)<<8;
           if (block!=0 && block2!=0 && block==block2 && !(extent==extent2 && i==j))
           {
             printf("Error: Multiple allocated block (extent=%d,%d, name=\"%s\"",extent,extent2,prfile(sb,extent));
@@ -547,7 +543,7 @@ static int fsck(struct cpmInode *root, const char *image)
       for (i=0; i<16; ++i)
       {
         block=dir->pointers[i]&0xff;
-        if (sb->size>=256) block+=(dir->pointers[++i]&0xff)<<8;
+        if (sb->size>256) block+=(dir->pointers[++i]&0xff)<<8;
         if (previous!=-1)
         {
           if (block!=0 && block!=(previous+1)) ++fragmented;
@@ -573,17 +569,19 @@ int main(int argc, char *argv[])
   const char *image;
   const char *format;
   const char *devopts=NULL;
+  int uppercase=0;
   int c,usage=0;
   struct cpmSuperBlock sb;
   struct cpmInode root;
   enum Result ret;
 
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"T:f:nh?"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"T:f:nuh?"))!=EOF) switch(c)
   {
     case 'f': format=optarg; break;
     case 'T': devopts=optarg; break;
     case 'n': norepair=1; break;
+    case 'u': uppercase=1; break;
     case 'h':
     case '?': usage=1; break;
   }
@@ -608,7 +606,7 @@ int main(int argc, char *argv[])
       fprintf(stderr,"%s: cannot open %s for writing, no repair possible\n",cmd,image);
     }
   }
-  if (cpmReadSuper(&sb,&root,format)==-1)
+  if (cpmReadSuper(&sb,&root,format,uppercase)==-1)
   {
     fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
index a6d5873816c5f39d9b68dde3268228f2eea31fec..0c70d0c2b9dae1078533e1eb3b8ac26ec88cd4d7 100644 (file)
@@ -1,4 +1,4 @@
-.TH FSED.CPM 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH FSED.CPM 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME ..\"{{{roff}}}\"{{{
 fsed.cpm \- edit a CP/M file system
 .\"}}}
@@ -7,6 +7,7 @@ fsed.cpm \- edit a CP/M file system
 .B fsed.cpm
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .ad b
 .\"}}}
@@ -22,6 +23,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" .\"{{{
 Upon successful completion, exit code 0 is returned.
@@ -36,7 +39,7 @@ CPMTOOLSFMT     Default format
 ${prefix}/share/diskdefs       CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index 1520be25c29735503c9495c7d76f887614602302..b1838c337164ce49a1f2d3d8871f2cfcc802cdcb 100644 (file)
@@ -7,6 +7,7 @@ fsed.cpm \- edit a CP/M file system
 .B fsed.cpm
 .RB [ \-f
 .IR format ]
+.RB [ \-u ]
 .I image
 .ad b
 .\"}}}
@@ -22,6 +23,8 @@ Use the given CP/M disk \fIformat\fP instead of the default format.
 .IP "\fB\-T\fP \fIlibdsk-type\fP"
 libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images 
 (requires building cpmtools with support for libdsk).
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" .\"{{{
 Upon successful completion, exit code 0 is returned.
@@ -36,7 +39,7 @@ CPMTOOLSFMT     Default format
 @DATADIR@/diskdefs     CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index f120b77c4a364749a3cdc119469acd710576a24b..f4d4235e0e8b33eb01c2464370132cfe122fecc8 100644 (file)
@@ -3,15 +3,6 @@
 
 #include <assert.h>
 #include <ctype.h>
-#if NEED_NCURSES
-#if HAVE_NCURSES_NCURSES_H
-#include <ncurses/ncurses.h>
-#else
-#include <ncurses.h>
-#endif
-#else
-#include <curses.h>
-#endif
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 
 #include "cpmfs.h"
 #include "getopt_.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
+#include "term.h"
 /*}}}*/
 
 extern char **environ;
@@ -64,33 +52,34 @@ static void info(struct cpmSuperBlock *sb, const char *format, const char *image
 {
   const char *msg;
 
-  clear();
+  term_clear();
   msg="File system characteristics";
-  move(0,(COLS-strlen(msg))/2); printw(msg);
-  move(2,0); printw("                      Image: %s",image);
-  move(3,0); printw("                     Format: %s",format);
-  move(4,0); printw("                File system: ");
+  term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg);
+  term_xy(0,2); term_printf("                      Image: %s",image);
+  term_xy(0,3); term_printf("                     Format: %s",format);
+  term_xy(0,4); term_printf("                File system: ");
   switch (sb->type)
   {
-    case CPMFS_DR22: printw("CP/M 2.2"); break;
-    case CPMFS_P2DOS: printw("P2DOS 2.3"); break;
-    case CPMFS_DR3: printw("CP/M Plus"); break;
+    case CPMFS_DR22: term_printf("CP/M 2.2"); break;
+    case CPMFS_P2DOS: term_printf("P2DOS 2.3"); break;
+    case CPMFS_DR3: term_printf("CP/M Plus"); break;
   }
 
-  move(6,0); printw("              Sector length: %d",sb->secLength);
-  move(7,0); printw("           Number of tracks: %d",sb->tracks);
-  move(8,0); printw("          Sectors per track: %d",sb->sectrk);
+  term_xy(0,6); term_printf("              Sector length: %d",sb->secLength);
+  term_xy(0,7); term_printf("           Number of tracks: %d",sb->tracks);
+  term_xy(0,8); term_printf("          Sectors per track: %d",sb->sectrk);
 
-  move(10,0);printw("                 Block size: %d",sb->blksiz);
-  move(11,0);printw("Number of directory entries: %d",sb->maxdir);
-  move(12,0);printw("        Logical sector skew: %d",sb->skew);
-  move(13,0);printw("    Number of system tracks: %d",sb->boottrk);
-  move(14,0);printw(" Logical extents per extent: %d",sb->extents);
-  move(15,0);printw("    Allocatable data blocks: %d",sb->size-(sb->maxdir*32+sb->blksiz-1)/sb->blksiz);
+  term_xy(0,10);term_printf("                 Block size: %d",sb->blksiz);
+  term_xy(0,11);term_printf("Number of directory entries: %d",sb->maxdir);
+  term_xy(0,12);term_printf(" Number of directory blocks: %d",sb->dirblks);
+  term_xy(0,13);term_printf("        Logical sector skew: %d",sb->skew);
+  term_xy(0,14);term_printf("    Number of system tracks: %d",sb->boottrk);
+  term_xy(0,15);term_printf(" Logical extents per extent: %d",sb->extents);
+  term_xy(0,16);term_printf("    Allocatable data blocks: %d",sb->size-(sb->maxdir*32+sb->blksiz-1)/sb->blksiz);
 
   msg="Any key to continue";
-  move(23,(COLS-strlen(msg))/2); printw(msg);
-  getch();
+  term_xy((term_cols()-strlen(msg))/2,23); term_printf(msg);
+  term_getch();
 }
 /*}}}*/
 static void map(struct cpmSuperBlock *sb) /*{{{*/
@@ -100,9 +89,9 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/
   int secmap,sys,directory;
   int pos;
 
-  clear();
+  term_clear();
   msg="Data map";
-  move(0,(COLS-strlen(msg))/2); printw(msg);
+  term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg);
 
   secmap=(sb->tracks*sb->sectrk+80*18-1)/(80*18);
   memset(bmap,' ',sizeof(bmap));
@@ -128,7 +117,7 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/
           int sector;
 
           sector=mapbuf[entry*32+16+i]&0xff;
-          if (sb->size>=256) sector|=(((mapbuf[entry*32+16+ ++i]&0xff)<<8));
+          if (sb->size>256) sector|=(((mapbuf[entry*32+16+ ++i]&0xff)<<8));
           if (sector>0 && sector<=sb->size)
           {
             /* not entirely correct without the last extent record count */
@@ -142,13 +131,13 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/
 
   for (pos=0; pos<(int)sizeof(bmap); ++pos)
   {
-    move(2+pos%18,pos/18);
-    addch(bmap[pos]);
+    term_xy(pos/18,2+pos%18);
+    term_putch(bmap[pos]);
   }
-  move(21,0); printw("S=System area   D=Directory area   #=File data   .=Free");
+  term_xy(0,21); term_printf("S=System area   D=Directory area   #=File data   .=Free");
   msg="Any key to continue";
-  move(23,(COLS-strlen(msg))/2); printw(msg);
-  getch();
+  term_xy((term_cols()-strlen(msg))/2,23); term_printf(msg);
+  term_getch();
 }
 /*}}}*/
 static void data(struct cpmSuperBlock *sb, const char *buf, unsigned long int pos) /*{{{*/
@@ -158,12 +147,12 @@ static void data(struct cpmSuperBlock *sb, const char *buf, unsigned long int po
 
   for (i=0; i<128; ++i)
   {
-    move(4+(i>>4),(i&0x0f)*3+!!(i&0x8)); printw("%02x",buf[i+offset]&0xff);
-    if (pos%sb->secLength==i+offset) attron(A_REVERSE);
-    move(4+(i>>4),50+(i&0x0f)); printw("%c",isprint(buf[i+offset]) ? buf[i+offset] : '.');
-    attroff(A_REVERSE);
+    term_xy((i&0x0f)*3+!!(i&0x8),4+(i>>4)); term_printf("%02x",buf[i+offset]&0xff);
+    if (pos%sb->secLength==i+offset) term_reverse(1);
+    term_xy(50+(i&0x0f),4+(i>>4)); term_printf("%c",isprint((unsigned char)buf[i+offset]) ? buf[i+offset] : '.');
+    term_reverse(0);
   }
-  move(4+((pos&0x7f)>>4),((pos&0x7f)&0x0f)*3+!!((pos&0x7f)&0x8)+1);
+  term_xy(((pos&0x7f)&0x0f)*3+!!((pos&0x7f)&0x8)+1,4+((pos&0x7f)>>4));
 }
 /*}}}*/
 
@@ -173,6 +162,7 @@ int main(int argc, char *argv[]) /*{{{*/
 {
   /* variables */ /*{{{*/
   const char *devopts=(const char*)0;
+  int uppercase=0;
   char *image;
   const char *err;
   struct cpmSuperBlock drive;
@@ -180,17 +170,18 @@ int main(int argc, char *argv[]) /*{{{*/
   const char *format;
   int c,usage=0;
   off_t pos;
-  chtype ch;
+  int ch;
   int reload;
   char *buf;
   /*}}}*/
 
   /* parse options */ /*{{{*/
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c)
   {
     case 'f': format=optarg; break;
     case 'T': devopts=optarg; break;
+    case 'u': uppercase=1; break;
     case 'h':
     case '?': usage=1; break;
   }
@@ -210,7 +201,7 @@ int main(int argc, char *argv[]) /*{{{*/
     fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
     exit(1);
   }
-  if (cpmReadSuper(&drive,&root,format)==-1)
+  if (cpmReadSuper(&drive,&root,format,uppercase)==-1)
   {
     fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
     exit(1);
@@ -223,38 +214,29 @@ int main(int argc, char *argv[]) /*{{{*/
     exit(1);
   }
   /*}}}*/
-  /* init curses */ /*{{{*/
-  initscr();
-  noecho();
-  raw();
-  nonl();
-  idlok(stdscr,TRUE);
-  idcok(stdscr,TRUE);
-  keypad(stdscr,TRUE);
-  clear();
-  /*}}}*/
+  term_init();
 
   pos=0;
   reload=1;
   do
   {
     /* display position and load data */ /*{{{*/
-    clear();
-    move(2,0); printw("Byte %8lu (0x%08lx)  ",pos,pos);
+    term_clear();
+    term_xy(0,2); term_printf("Byte %8lu (0x%08lx)  ",pos,pos);
     if (pos<(drive.boottrk*drive.sectrk*drive.secLength))
     {
-      printw("Physical sector %3lu  ",((pos/drive.secLength)%drive.sectrk)+1);
+      term_printf("Physical sector %3lu  ",((pos/drive.secLength)%drive.sectrk)+1);
     }
     else
     {
-      printw("Sector %3lu ",((pos/drive.secLength)%drive.sectrk)+1);
-      printw("(physical %3d)  ",drive.skewtab[(pos/drive.secLength)%drive.sectrk]+1);
+      term_printf("Sector %3lu ",((pos/drive.secLength)%drive.sectrk)+1);
+      term_printf("(physical %3d)  ",drive.skewtab[(pos/drive.secLength)%drive.sectrk]+1);
     }
-    printw("Offset %5lu  ",pos%drive.secLength);
-    printw("Track %5lu",pos/(drive.secLength*drive.sectrk));
-    move(LINES-3,0); printw("N)ext track    P)revious track");
-    move(LINES-2,0); printw("n)ext record   p)revious record     f)orward byte      b)ackward byte");
-    move(LINES-1,0); printw("i)nfo          q)uit");
+    term_printf("Offset %5lu  ",pos%drive.secLength);
+    term_printf("Track %5lu",pos/(drive.secLength*drive.sectrk));
+    term_xy(0,term_lines()-3); term_printf("N)ext track    P)revious track");
+    term_xy(0,term_lines()-2); term_printf("n)ext record   p)revious record     f)orward byte      b)ackward byte");
+    term_xy(0,term_lines()-1); term_printf("i)nfo          q)uit");
     if (reload)
     {
       if (pos<(drive.boottrk*drive.sectrk*drive.secLength))
@@ -267,7 +249,7 @@ int main(int argc, char *argv[]) /*{{{*/
       }
       if (err)
       {
-        move(4,0); printw("Data can not be read: %s",err);
+        term_xy(0,4); term_printf("Data can not be read: %s",err);
       }
       else reload=0;
     }
@@ -278,10 +260,10 @@ int main(int argc, char *argv[]) /*{{{*/
     {
       const char *msg;
 
-      msg="System area"; move(0,(COLS-strlen(msg))/2); printw(msg);
-      move(LINES-3,36); printw("F)orward 16 byte   B)ackward 16 byte");
+      msg="System area"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg);
+      term_xy(36,term_lines()-3); term_printf("F)orward 16 byte   B)ackward 16 byte");
       if (!reload) data(&drive,buf,pos);
-      switch (ch=getch())
+      switch (ch=term_getch())
       {
         case 'F': /* next 16 byte */ /*{{{*/
         {
@@ -314,10 +296,10 @@ int main(int argc, char *argv[]) /*{{{*/
       int entry=(pos-(drive.boottrk*drive.sectrk*drive.secLength))>>5;
       int offset=pos&0x1f;
 
-      msg="Directory area"; move(0,(COLS-strlen(msg))/2); printw(msg);
-      move(LINES-3,36); printw("F)orward entry     B)ackward entry");
+      msg="Directory area"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg);
+      term_xy(36,term_lines()-3); term_printf("F)orward entry     B)ackward entry");
 
-      move(13,0); printw("Entry %3d: ",entry);      
+      term_xy(0,13); term_printf("Entry %3d: ",entry);      
       if /* free or used directory entry */ /*{{{*/
       ((buf[entrystart]>=0 && buf[entrystart]<=(drive.type==CPMFS_P2DOS ? 31 : 15)) || buf[entrystart]==(char)0xe5)
       {
@@ -325,69 +307,69 @@ int main(int argc, char *argv[]) /*{{{*/
 
         if (buf[entrystart]==(char)0xe5)
         {
-          if (offset==0) attron(A_REVERSE);
-          printw("Free");
-          attroff(A_REVERSE);
+          if (offset==0) term_reverse(1);
+          term_printf("Free");
+          term_reverse(0);
         }
-        else printw("Directory entry");
-        move(15,0);
+        else term_printf("Directory entry");
+        term_xy(0,15);
         if (buf[entrystart]!=(char)0xe5)
         {
-          printw("User: ");
-          if (offset==0) attron(A_REVERSE);
-          printw("%2d",buf[entrystart]);
-          attroff(A_REVERSE);
-          printw(" ");
+          term_printf("User: ");
+          if (offset==0) term_reverse(1);
+          term_printf("%2d",buf[entrystart]);
+          term_reverse(0);
+          term_printf(" ");
         }
-        printw("Name: ");
+        term_printf("Name: ");
         for (i=0; i<8; ++i)
         {
-          if (offset==1+i) attron(A_REVERSE);
-          printw("%c",buf[entrystart+1+i]&0x7f);
-          attroff(A_REVERSE);
+          if (offset==1+i) term_reverse(1);
+          term_printf("%c",buf[entrystart+1+i]&0x7f);
+          term_reverse(0);
         }
-        printw(" Extension: ");
+        term_printf(" Extension: ");
         for (i=0; i<3; ++i)
         {
-          if (offset==9+i) attron(A_REVERSE);
-          printw("%c",buf[entrystart+9+i]&0x7f);
-          attroff(A_REVERSE);
+          if (offset==9+i) term_reverse(1);
+          term_printf("%c",buf[entrystart+9+i]&0x7f);
+          term_reverse(0);
         }
-        move(16,0); printw("Extent: %3d",((buf[entrystart+12]&0xff)+((buf[entrystart+14]&0xff)<<5))/drive.extents);
-        printw(" (low: ");
-        if (offset==12) attron(A_REVERSE);
-        printw("%2d",buf[entrystart+12]&0xff);
-        attroff(A_REVERSE);
-        printw(", high: ");
-        if (offset==14) attron(A_REVERSE);
-        printw("%2d",buf[entrystart+14]&0xff);
-        attroff(A_REVERSE);
-        printw(")");
-        move(17,0); printw("Last extent record count: ");
-        if (offset==15) attron(A_REVERSE);
-        printw("%3d",buf[entrystart+15]&0xff);
-        attroff(A_REVERSE);
-        move(18,0); printw("Last record byte count: ");
-        if (offset==13) attron(A_REVERSE);
-        printw("%3d",buf[entrystart+13]&0xff);
-        attroff(A_REVERSE);
-        move(19,0); printw("Data blocks:");
+        term_xy(0,16); term_printf("Extent: %3d",((buf[entrystart+12]&0xff)+((buf[entrystart+14]&0xff)<<5))/drive.extents);
+        term_printf(" (low: ");
+        if (offset==12) term_reverse(1);
+        term_printf("%2d",buf[entrystart+12]&0xff);
+        term_reverse(0);
+        term_printf(", high: ");
+        if (offset==14) term_reverse(1);
+        term_printf("%2d",buf[entrystart+14]&0xff);
+        term_reverse(0);
+        term_printf(")");
+        term_xy(0,17); term_printf("Last extent record count: ");
+        if (offset==15) term_reverse(1);
+        term_printf("%3d",buf[entrystart+15]&0xff);
+        term_reverse(0);
+        term_xy(0,18); term_printf("Last record byte count: ");
+        if (offset==13) term_reverse(1);
+        term_printf("%3d",buf[entrystart+13]&0xff);
+        term_reverse(0);
+        term_xy(0,19); term_printf("Data blocks:");
         for (i=0; i<16; ++i)
         {
           unsigned int block=buf[entrystart+16+i]&0xff;
-          if (drive.size>=256)
+          if (drive.size>256)
           {
-            printw(" ");
-            if (offset==16+i || offset==16+i+1) attron(A_REVERSE);
-            printw("%5d",block|(((buf[entrystart+16+ ++i]&0xff)<<8)));
-            attroff(A_REVERSE);
+            term_printf(" ");
+            if (offset==16+i || offset==16+i+1) term_reverse(1);
+            term_printf("%5d",block|(((buf[entrystart+16+ ++i]&0xff)<<8)));
+            term_reverse(0);
           }
           else
           {
-            printw(" ");
-            if (offset==16+i) attron(A_REVERSE);
-            printw("%3d",block);
-            attroff(A_REVERSE);
+            term_printf(" ");
+            if (offset==16+i) term_reverse(1);
+            term_printf("%3d",block);
+            term_reverse(0);
           }
         }
       }
@@ -399,78 +381,78 @@ int main(int argc, char *argv[]) /*{{{*/
         const struct tm *tm;
         char s[30];
 
-        if (offset==0) attron(A_REVERSE);
-        printw("Disc label");
-        attroff(A_REVERSE);
-        move(15,0);
-        printw("Label: ");
+        if (offset==0) term_reverse(1);
+        term_printf("Disc label");
+        term_reverse(0);
+        term_xy(0,15);
+        term_printf("Label: ");
         for (i=0; i<11; ++i)
         {
-          if (i+1==offset) attron(A_REVERSE);
-          printw("%c",buf[entrystart+1+i]&0x7f);
-          attroff(A_REVERSE);
+          if (i+1==offset) term_reverse(1);
+          term_printf("%c",buf[entrystart+1+i]&0x7f);
+          term_reverse(0);
         }
-        move(16,0);
-        printw("Bit 0,7: ");
-        if (offset==12) attron(A_REVERSE);
-        printw("Label %s",buf[entrystart+12]&1 ? "set" : "not set");
-        printw(", password protection %s",buf[entrystart+12]&0x80 ? "set" : "not set");
-        attroff(A_REVERSE);
-        move(17,0);
-        printw("Bit 4,5,6: ");
-        if (offset==12) attron(A_REVERSE);
-        printw("Time stamp ");
-        if (buf[entrystart+12]&0x10) printw("on create, ");
-        else printw("not on create, ");
-        if (buf[entrystart+12]&0x20) printw("on modification, ");
-        else printw("not on modifiction, ");
-        if (buf[entrystart+12]&0x40) printw("on access");
-        else printw("not on access");
-        attroff(A_REVERSE); 
-        move(18,0);
-        printw("Password: ");
+        term_xy(0,16);
+        term_printf("Bit 0,7: ");
+        if (offset==12) term_reverse(1);
+        term_printf("Label %s",buf[entrystart+12]&1 ? "set" : "not set");
+        term_printf(", password protection %s",buf[entrystart+12]&0x80 ? "set" : "not set");
+        term_reverse(0);
+        term_xy(0,17);
+        term_printf("Bit 4,5,6: ");
+        if (offset==12) term_reverse(1);
+        term_printf("Time stamp ");
+        if (buf[entrystart+12]&0x10) term_printf("on create, ");
+        else term_printf("not on create, ");
+        if (buf[entrystart+12]&0x20) term_printf("on modification, ");
+        else term_printf("not on modifiction, ");
+        if (buf[entrystart+12]&0x40) term_printf("on access");
+        else term_printf("not on access");
+        term_reverse(0); 
+        term_xy(0,18);
+        term_printf("Password: ");
         for (i=0; i<8; ++i)
         {
           char printable;
 
-          if (offset==16+(7-i)) attron(A_REVERSE);
+          if (offset==16+(7-i)) term_reverse(1);
           printable=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f;
-          printw("%c",isprint(printable) ? printable : ' ');
-          attroff(A_REVERSE);
+          term_printf("%c",isprint(printable) ? printable : ' ');
+          term_reverse(0);
         }
-        printw(" XOR value: ");
-        if (offset==13) attron(A_REVERSE);
-        printw("0x%02x",buf[entrystart+13]&0xff);
-        attroff(A_REVERSE);
-        move(19,0);
-        printw("Created: ");
+        term_printf(" XOR value: ");
+        if (offset==13) term_reverse(1);
+        term_printf("0x%02x",buf[entrystart+13]&0xff);
+        term_reverse(0);
+        term_xy(0,19);
+        term_printf("Created: ");
         tm=cpmtime(buf[entrystart+24],buf[entrystart+25],buf[entrystart+26],buf[entrystart+27]);
-        if (offset==24 || offset==25) attron(A_REVERSE);
+        if (offset==24 || offset==25) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==26) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==27) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
-        printw(" Updated: ");
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==26) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==27) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
+        term_printf(" Updated: ");
         tm=cpmtime(buf[entrystart+28],buf[entrystart+29],buf[entrystart+30],buf[entrystart+31]);
-        if (offset==28 || offset==29) attron(A_REVERSE);
+        if (offset==28 || offset==29) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==30) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==31) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==30) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==31) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
       }
       /*}}}*/
       else if /* time stamp */ /*{{{*/
@@ -479,98 +461,98 @@ int main(int argc, char *argv[]) /*{{{*/
         const struct tm *tm;
         char s[30];
 
-        if (offset==0) attron(A_REVERSE);
-        printw("Time stamps");
-        attroff(A_REVERSE);
-        move(15,0);
-        printw("3rd last extent: Created/Accessed ");
+        if (offset==0) term_reverse(1);
+        term_printf("Time stamps");
+        term_reverse(0);
+        term_xy(0,15);
+        term_printf("3rd last extent: Created/Accessed ");
         tm=cpmtime(buf[entrystart+1],buf[entrystart+2],buf[entrystart+3],buf[entrystart+4]);
-        if (offset==1 || offset==2) attron(A_REVERSE);
+        if (offset==1 || offset==2) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==3) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==4) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
-        printw(" Modified ");
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==3) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==4) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
+        term_printf(" Modified ");
         tm=cpmtime(buf[entrystart+5],buf[entrystart+6],buf[entrystart+7],buf[entrystart+8]);
-        if (offset==5 || offset==6) attron(A_REVERSE);
+        if (offset==5 || offset==6) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==7) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==8) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
-
-        move(16,0);
-        printw("2nd last extent: Created/Accessed ");
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==7) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==8) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
+
+        term_xy(0,16);
+        term_printf("2nd last extent: Created/Accessed ");
         tm=cpmtime(buf[entrystart+11],buf[entrystart+12],buf[entrystart+13],buf[entrystart+14]);
-        if (offset==11 || offset==12) attron(A_REVERSE);
+        if (offset==11 || offset==12) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==13) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==14) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
-        printw(" Modified ");
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==13) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==14) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
+        term_printf(" Modified ");
         tm=cpmtime(buf[entrystart+15],buf[entrystart+16],buf[entrystart+17],buf[entrystart+18]);
-        if (offset==15 || offset==16) attron(A_REVERSE);
+        if (offset==15 || offset==16) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==17) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==18) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
-
-        move(17,0);
-        printw("    Last extent: Created/Accessed ");
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==17) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==18) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
+
+        term_xy(0,17);
+        term_printf("    Last extent: Created/Accessed ");
         tm=cpmtime(buf[entrystart+21],buf[entrystart+22],buf[entrystart+23],buf[entrystart+24]);
-        if (offset==21 || offset==22) attron(A_REVERSE);
+        if (offset==21 || offset==22) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==23) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==24) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
-        printw(" Modified ");
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==23) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==24) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
+        term_printf(" Modified ");
         tm=cpmtime(buf[entrystart+25],buf[entrystart+26],buf[entrystart+27],buf[entrystart+28]);
-        if (offset==25 || offset==26) attron(A_REVERSE);
+        if (offset==25 || offset==26) term_reverse(1);
         strftime(s,sizeof(s),"%x",tm);
-        printw("%s",s);
-        attroff(A_REVERSE);
-        printw(" ");
-        if (offset==27) attron(A_REVERSE);
-        printw("%2d",tm->tm_hour);
-        attroff(A_REVERSE);
-        printw(":");
-        if (offset==28) attron(A_REVERSE);
-        printw("%02d",tm->tm_min);
-        attroff(A_REVERSE);
+        term_printf("%s",s);
+        term_reverse(0);
+        term_printf(" ");
+        if (offset==27) term_reverse(1);
+        term_printf("%2d",tm->tm_hour);
+        term_reverse(0);
+        term_printf(":");
+        if (offset==28) term_reverse(1);
+        term_printf("%02d",tm->tm_min);
+        term_reverse(0);
       }
       /*}}}*/
       else if /* password */ /*{{{*/
@@ -578,61 +560,61 @@ int main(int argc, char *argv[]) /*{{{*/
       {
         int i;
 
-        if (offset==0) attron(A_REVERSE);
-        printw("Password");
-        attroff(A_REVERSE);
+        if (offset==0) term_reverse(1);
+        term_printf("Password");
+        term_reverse(0);
 
-        move(15,0);
-        printw("Name: ");
+        term_xy(0,15);
+        term_printf("Name: ");
         for (i=0; i<8; ++i)
         {
-          if (offset==1+i) attron(A_REVERSE);
-          printw("%c",buf[entrystart+1+i]&0x7f);
-          attroff(A_REVERSE);
+          if (offset==1+i) term_reverse(1);
+          term_printf("%c",buf[entrystart+1+i]&0x7f);
+          term_reverse(0);
         }
-        printw(" Extension: ");
+        term_printf(" Extension: ");
         for (i=0; i<3; ++i)
         {
-          if (offset==9+i) attron(A_REVERSE);
-          printw("%c",buf[entrystart+9+i]&0x7f);
-          attroff(A_REVERSE);
+          if (offset==9+i) term_reverse(1);
+          term_printf("%c",buf[entrystart+9+i]&0x7f);
+          term_reverse(0);
         }
 
-        move(16,0);
-        printw("Password required for: ");
-        if (offset==12) attron(A_REVERSE);
-        if (buf[entrystart+12]&0x80) printw("Reading ");
-        if (buf[entrystart+12]&0x40) printw("Writing ");
-        if (buf[entrystart+12]&0x20) printw("Deleting ");
-        attroff(A_REVERSE);
+        term_xy(0,16);
+        term_printf("Password required for: ");
+        if (offset==12) term_reverse(1);
+        if (buf[entrystart+12]&0x80) term_printf("Reading ");
+        if (buf[entrystart+12]&0x40) term_printf("Writing ");
+        if (buf[entrystart+12]&0x20) term_printf("Deleting ");
+        term_reverse(0);
 
-        move(17,0);
-        printw("Password: ");
+        term_xy(0,17);
+        term_printf("Password: ");
         for (i=0; i<8; ++i)
         {
           char printable;
 
-          if (offset==16+(7-i)) attron(A_REVERSE);
+          if (offset==16+(7-i)) term_reverse(1);
           printable=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f;
-          printw("%c",isprint(printable) ? printable : ' ');
-          attroff(A_REVERSE);
+          term_printf("%c",isprint(printable) ? printable : ' ');
+          term_reverse(0);
         }
-        printw(" XOR value: ");
-        if (offset==13) attron(A_REVERSE);
-        printw("0x%02x",buf[entrystart+13]&0xff);
-        attroff(A_REVERSE);
+        term_printf(" XOR value: ");
+        if (offset==13) term_reverse(1);
+        term_printf("0x%02x",buf[entrystart+13]&0xff);
+        term_reverse(0);
       }
       /*}}}*/
       else /* bad status */ /*{{{*/
       {
-        printw("Bad status ");
-        if (offset==0) attron(A_REVERSE);
-        printw("0x%02x",buf[entrystart]);
-        attroff(A_REVERSE);
+        term_printf("Bad status ");
+        if (offset==0) term_reverse(1);
+        term_printf("0x%02x",buf[entrystart]);
+        term_reverse(0);
       }
       /*}}}*/
       if (!reload) data(&drive,buf,pos);
-      switch (ch=getch())
+      switch (ch=term_getch())
       {
         case 'F': /* next entry */ /*{{{*/
         {
@@ -661,9 +643,9 @@ int main(int argc, char *argv[]) /*{{{*/
     {
       const char *msg;
 
-      msg="Data area"; move(0,(COLS-strlen(msg))/2); printw(msg);
+      msg="Data area"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg);
       if (!reload) data(&drive,buf,pos);
-      ch=getch();
+      ch=term_getch();
     }
     /*}}}*/
 
@@ -736,13 +718,7 @@ int main(int argc, char *argv[]) /*{{{*/
     /*}}}*/
   } while (ch!='q');
 
-  /* exit curses */ /*{{{*/
-  move(LINES-1,0);
-  refresh();
-  echo();
-  noraw();
-  endwin();
-  /*}}}*/
+  term_exit();
   exit(0);
 }
 /*}}}*/
index 157ab4c7e83e87e9af7e7a329f6962bcd3140500..a90c9e5eadc027bf998b1981204a6b20562f3d81 100644 (file)
--- a/getopt.c
+++ b/getopt.c
@@ -29,7 +29,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #ifdef __VMS
 # include <unixlib.h>
index 377bb8687ffe16bfc79ea25c8667cabf72aaf2c2..ec298b53740270ce82b326c4c2deaa5dcdec4596 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-11-20.07; # UTC
+scriptversion=2020-11-14.01; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC
 # This script is compatible with the BSD install script, but was written
 # from scratch.
 
+tab='  '
 nl='
 '
-IFS=" ""       $nl"
+IFS=" $tab$nl"
 
-# set DOITPROG to echo to test this script
+# Set DOITPROG to "echo" to test this script.
 
-# Don't use :- since 4.3BSD and earlier shells don't like it.
 doit=${DOITPROG-}
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
+doit_exec=${doit:-exec}
 
 # Put in absolute file names if you don't have them in your path;
 # or use environment vars.
@@ -68,22 +64,16 @@ mvprog=${MVPROG-mv}
 rmprog=${RMPROG-rm}
 stripprog=${STRIPPROG-strip}
 
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
 posix_mkdir=
 
 # Desired mode of installed file.
 mode=0755
 
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
+
+backupsuffix=
 chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
@@ -97,7 +87,7 @@ dir_arg=
 dst_arg=
 
 copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
 
 usage="\
 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -114,18 +104,28 @@ Options:
      --version  display version info and exit.
 
   -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
+  -C            install only if different (preserve data modification time)
   -d            create directories instead of installing files.
   -g GROUP      $chgrpprog installed files to GROUP.
   -m MODE       $chmodprog installed files to MODE.
   -o USER       $chownprog installed files to USER.
+  -p            pass -p to $cpprog.
   -s            $stripprog installed files.
+  -S SUFFIX     attempt to back up existing files, with suffix SUFFIX.
   -t DIRECTORY  install into DIRECTORY.
   -T            report an error if DSTFILE is a directory.
 
 Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
   RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
+
+If -S is not specified, no backups are attempted.
+
+Email bug reports to bug-automake@gnu.org.
+Automake home page: https://www.gnu.org/software/automake/
 "
 
 while test $# -ne 0; do
@@ -137,46 +137,62 @@ while test $# -ne 0; do
     -d) dir_arg=true;;
 
     -g) chgrpcmd="$chgrpprog $2"
-       shift;;
+        shift;;
 
     --help) echo "$usage"; exit $?;;
 
     -m) mode=$2
-       case $mode in
-         *' '* | *'    '* | *'
-'*       | *'*'* | *'?'* | *'['*)
-           echo "$0: invalid mode: $mode" >&2
-           exit 1;;
-       esac
-       shift;;
+        case $mode in
+          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+            echo "$0: invalid mode: $mode" >&2
+            exit 1;;
+        esac
+        shift;;
 
     -o) chowncmd="$chownprog $2"
-       shift;;
+        shift;;
+
+    -p) cpprog="$cpprog -p";;
 
     -s) stripcmd=$stripprog;;
 
-    -t) dst_arg=$2
-       # Protect names problematic for 'test' and other utilities.
-       case $dst_arg in
-         -* | [=\(\)!]) dst_arg=./$dst_arg;;
-       esac
-       shift;;
+    -S) backupsuffix="$2"
+        shift;;
 
-    -T) no_target_directory=true;;
+    -t)
+        is_target_a_directory=always
+        dst_arg=$2
+        # Protect names problematic for 'test' and other utilities.
+        case $dst_arg in
+          -* | [=\(\)!]) dst_arg=./$dst_arg;;
+        esac
+        shift;;
+
+    -T) is_target_a_directory=never;;
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
-    --)        shift
-       break;;
+    --) shift
+        break;;
 
-    -*)        echo "$0: invalid option: $1" >&2
-       exit 1;;
+    -*) echo "$0: invalid option: $1" >&2
+        exit 1;;
 
     *)  break;;
   esac
   shift
 done
 
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+  if test -n "$dst_arg"; then
+    echo "$0: target directory not allowed when installing a directory." >&2
+    exit 1
+  fi
+fi
+
 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
   # When -d is used, all remaining arguments are directories to create.
   # When -t is used, the destination is already specified.
@@ -207,6 +223,15 @@ if test $# -eq 0; then
   exit 0
 fi
 
+if test -z "$dir_arg"; then
+  if test $# -gt 1 || test "$is_target_a_directory" = always; then
+    if test ! -d "$dst_arg"; then
+      echo "$0: $dst_arg: Is not a directory." >&2
+      exit 1
+    fi
+  fi
+fi
+
 if test -z "$dir_arg"; then
   do_exit='(exit $ret); exit $ret'
   trap "ret=129; $do_exit" 1
@@ -223,16 +248,16 @@ if test -z "$dir_arg"; then
 
     *[0-7])
       if test -z "$stripcmd"; then
-       u_plus_rw=
+        u_plus_rw=
       else
-       u_plus_rw='% 200'
+        u_plus_rw='% 200'
       fi
       cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
     *)
       if test -z "$stripcmd"; then
-       u_plus_rw=
+        u_plus_rw=
       else
-       u_plus_rw=,u+rw
+        u_plus_rw=,u+rw
       fi
       cp_umask=$mode$u_plus_rw;;
   esac
@@ -250,6 +275,10 @@ do
     dstdir=$dst
     test -d "$dstdir"
     dstdir_status=$?
+    # Don't chown directories that already exist.
+    if test $dstdir_status = 0; then
+      chowncmd=""
+    fi
   else
 
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@@ -266,178 +295,148 @@ do
     fi
     dst=$dst_arg
 
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
+    # If destination is a directory, append the input filename.
     if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-       echo "$0: $dst_arg: Is a directory" >&2
-       exit 1
+      if test "$is_target_a_directory" = never; then
+        echo "$0: $dst_arg: Is a directory" >&2
+        exit 1
       fi
       dstdir=$dst
-      dst=$dstdir/`basename "$src"`
+      dstbase=`basename "$src"`
+      case $dst in
+       */) dst=$dst$dstbase;;
+       *)  dst=$dst/$dstbase;;
+      esac
       dstdir_status=0
     else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-       (dirname "$dst") 2>/dev/null ||
-       expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-            X"$dst" : 'X\(//\)[^/]' \| \
-            X"$dst" : 'X\(//\)$' \| \
-            X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-       echo X"$dst" |
-           sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-                  s//\1/
-                  q
-                }
-                /^X\(\/\/\)[^/].*/{
-                  s//\1/
-                  q
-                }
-                /^X\(\/\/\)$/{
-                  s//\1/
-                  q
-                }
-                /^X\(\/\).*/{
-                  s//\1/
-                  q
-                }
-                s/.*/./; q'
-      `
-
+      dstdir=`dirname "$dst"`
       test -d "$dstdir"
       dstdir_status=$?
     fi
   fi
 
+  case $dstdir in
+    */) dstdirslash=$dstdir;;
+    *)  dstdirslash=$dstdir/;;
+  esac
+
   obsolete_mkdir_used=false
 
   if test $dstdir_status != 0; then
     case $posix_mkdir in
       '')
-       # Create intermediate dirs using mode 755 as modified by the umask.
-       # This is like FreeBSD 'install' as of 1997-10-28.
-       umask=`umask`
-       case $stripcmd.$umask in
-         # Optimize common cases.
-         *[2367][2367]) mkdir_umask=$umask;;
-         .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-         *[0-7])
-           mkdir_umask=`expr $umask + 22 \
-             - $umask % 100 % 40 + $umask % 20 \
-             - $umask % 10 % 4 + $umask % 2
-           `;;
-         *) mkdir_umask=$umask,go-w;;
-       esac
-
-       # With -d, create the new directory with the user-specified mode.
-       # Otherwise, rely on $mkdir_umask.
-       if test -n "$dir_arg"; then
-         mkdir_mode=-m$mode
+        # With -d, create the new directory with the user-specified mode.
+        # Otherwise, rely on $mkdir_umask.
+        if test -n "$dir_arg"; then
+          mkdir_mode=-m$mode
+        else
+          mkdir_mode=
+        fi
+
+        posix_mkdir=false
+       # The $RANDOM variable is not portable (e.g., dash).  Use it
+       # here however when possible just to lower collision chance.
+       tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+       trap '
+         ret=$?
+         rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+         exit $ret
+       ' 0
+
+       # Because "mkdir -p" follows existing symlinks and we likely work
+       # directly in world-writeable /tmp, make sure that the '$tmpdir'
+       # directory is successfully created first before we actually test
+       # 'mkdir -p'.
+       if (umask $mkdir_umask &&
+           $mkdirprog $mkdir_mode "$tmpdir" &&
+           exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+       then
+         if test -z "$dir_arg" || {
+              # Check for POSIX incompatibilities with -m.
+              # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+              # other-writable bit of parent directory when it shouldn't.
+              # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+              test_tmpdir="$tmpdir/a"
+              ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+              case $ls_ld_tmpdir in
+                d????-?r-*) different_mode=700;;
+                d????-?--*) different_mode=755;;
+                *) false;;
+              esac &&
+              $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+                ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+                test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+              }
+            }
+         then posix_mkdir=:
+         fi
+         rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
        else
-         mkdir_mode=
+         # Remove any dirs left behind by ancient mkdir implementations.
+         rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
        fi
-
-       posix_mkdir=false
-       case $umask in
-         *[123567][0-7][0-7])
-           # POSIX mkdir -p sets u+wx bits regardless of umask, which
-           # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-           ;;
-         *)
-           tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-           trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-           if (umask $mkdir_umask &&
-               exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-           then
-             if test -z "$dir_arg" || {
-                  # Check for POSIX incompatibilities with -m.
-                  # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-                  # other-writable bit of parent directory when it shouldn't.
-                  # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-                  ls_ld_tmpdir=`ls -ld "$tmpdir"`
-                  case $ls_ld_tmpdir in
-                    d????-?r-*) different_mode=700;;
-                    d????-?--*) different_mode=755;;
-                    *) false;;
-                  esac &&
-                  $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-                    ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-                    test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-                  }
-                }
-             then posix_mkdir=:
-             fi
-             rmdir "$tmpdir/d" "$tmpdir"
-           else
-             # Remove any dirs left behind by ancient mkdir implementations.
-             rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-           fi
-           trap '' 0;;
-       esac;;
+       trap '' 0;;
     esac
 
     if
       $posix_mkdir && (
-       umask $mkdir_umask &&
-       $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+        umask $mkdir_umask &&
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
       )
     then :
     else
 
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # mkdir does not conform to POSIX,
       # or it failed possibly due to a race condition.  Create the
       # directory the slow way, step by step, checking for races as we go.
 
       case $dstdir in
-       /*) prefix='/';;
-       [-=\(\)!]*) prefix='./';;
-       *)  prefix='';;
+        /*) prefix='/';;
+        [-=\(\)!]*) prefix='./';;
+        *)  prefix='';;
       esac
 
-      eval "$initialize_posix_glob"
-
       oIFS=$IFS
       IFS=/
-      $posix_glob set -f
+      set -f
       set fnord $dstdir
       shift
-      $posix_glob set +f
+      set +f
       IFS=$oIFS
 
       prefixes=
 
       for d
       do
-       test X"$d" = X && continue
-
-       prefix=$prefix$d
-       if test -d "$prefix"; then
-         prefixes=
-       else
-         if $posix_mkdir; then
-           (umask=$mkdir_umask &&
-            $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-           # Don't fail if two instances are running concurrently.
-           test -d "$prefix" || exit 1
-         else
-           case $prefix in
-             *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-             *) qprefix=$prefix;;
-           esac
-           prefixes="$prefixes '$qprefix'"
-         fi
-       fi
-       prefix=$prefix/
+        test X"$d" = X && continue
+
+        prefix=$prefix$d
+        if test -d "$prefix"; then
+          prefixes=
+        else
+          if $posix_mkdir; then
+            (umask $mkdir_umask &&
+             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+            # Don't fail if two instances are running concurrently.
+            test -d "$prefix" || exit 1
+          else
+            case $prefix in
+              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+              *) qprefix=$prefix;;
+            esac
+            prefixes="$prefixes '$qprefix'"
+          fi
+        fi
+        prefix=$prefix/
       done
 
       if test -n "$prefixes"; then
-       # Don't fail if two instances are running concurrently.
-       (umask $mkdir_umask &&
-        eval "\$doit_exec \$mkdirprog $prefixes") ||
-         test -d "$dstdir" || exit 1
-       obsolete_mkdir_used=true
+        # Don't fail if two instances are running concurrently.
+        (umask $mkdir_umask &&
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
+          test -d "$dstdir" || exit 1
+        obsolete_mkdir_used=true
       fi
     fi
   fi
@@ -450,14 +449,25 @@ do
   else
 
     # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
+    dsttmp=${dstdirslash}_inst.$$_
+    rmtmp=${dstdirslash}_rm.$$_
 
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
 
     # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+    (umask $cp_umask &&
+     { test -z "$stripcmd" || {
+        # Create $dsttmp read-write so that cp doesn't create it read-only,
+        # which would cause strip to fail.
+        if test -z "$doit"; then
+          : >"$dsttmp" # No need to fork-exec 'touch'.
+        else
+          $doit touch "$dsttmp"
+        fi
+       }
+     } &&
+     $doit_exec $cpprog "$src" "$dsttmp") &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
@@ -472,20 +482,24 @@ do
 
     # If -C, don't bother to copy if it wouldn't change the file.
     if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"    2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
+       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
+       set -f &&
        set X $old && old=:$2:$4:$5:$6 &&
        set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
+       set +f &&
        test "$old" = "$new" &&
        $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
     then
       rm -f "$dsttmp"
     else
+      # If $backupsuffix is set, and the file being installed
+      # already exists, attempt a backup.  Don't worry if it fails,
+      # e.g., if mv doesn't support -f.
+      if test -n "$backupsuffix" && test -f "$dst"; then
+        $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
+      fi
+
       # Rename the file to the real destination.
       $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 
@@ -493,24 +507,24 @@ do
       # to itself, or perhaps because mv is so ancient that it does not
       # support -f.
       {
-       # Now remove or move aside any old file at destination location.
-       # We try this two ways since rm can't unlink itself on some
-       # systems and the destination file might be busy for other
-       # reasons.  In this case, the final cleanup might fail but the new
-       # file should still install successfully.
-       {
-         test ! -f "$dst" ||
-         $doit $rmcmd -f "$dst" 2>/dev/null ||
-         { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-           { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-         } ||
-         { echo "$0: cannot unlink or rename $dst" >&2
-           (exit 1); exit 1
-         }
-       } &&
-
-       # Now rename the file to the real destination.
-       $doit $mvcmd "$dsttmp" "$dst"
+        # Now remove or move aside any old file at destination location.
+        # We try this two ways since rm can't unlink itself on some
+        # systems and the destination file might be busy for other
+        # reasons.  In this case, the final cleanup might fail but the new
+        # file should still install successfully.
+        {
+          test ! -f "$dst" ||
+          $doit $rmcmd "$dst" 2>/dev/null ||
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+            { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
+          } ||
+          { echo "$0: cannot unlink or rename $dst" >&2
+            (exit 1); exit 1
+          }
+        } &&
+
+        # Now rename the file to the real destination.
+        $doit $mvcmd "$dsttmp" "$dst"
       }
     fi || exit 1
 
@@ -519,9 +533,9 @@ do
 done
 
 # Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
 # End:
diff --git a/makefile.nt b/makefile.nt
deleted file mode 100644 (file)
index 816c592..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#\r
-# Makefile for cpmtools, using MS Visual C++ 6.x command-line tools \r
-#\r
-CC=            cl\r
-DISKDEFS=      c:/cpm/etc/diskdefs\r
-CPPFLAGS=      /DDISKDEFS=\"$(DISKDEFS)\" /DFORMAT=\"ibm-3740\"\r
-#\r
-# Note: The "/Zp1" (pack structures on 1-byte boundaries) is important.\r
-#\r
-CFLAGS=     /Zp1 /WX /W3 $(CPPFLAGS)\r
-LDFLAGS=\r
-#LDFLAGS=      -g -L/usr/dmalloc/lib\r
-LIBCURSES=     -lcurses\r
-LIBS=       getopt.obj\r
-#LIBS=         -ldmalloc\r
-MAKEDEPEND=    mkdep -d\r
-#MAKEDEPEND=   gcc -MM\r
-#MAKEDEPEND=   makedepend -f-\r
-BINDIR=                /usr/cpm/bin\r
-MANDIR=                /usr/cpm/man/en\r
-OSDEPEND=       os_win32.obj\r
-#OSDEPEND=      os_unix.obj    # Can be used if you don't want direct\r
-                               # floppy support\r
-\r
-ALL=           cpmls.exe cpmrm.exe cpmcp.exe mkfs.cpm.exe fsck.cpm.exe \\r
-               # fsed.cpm.exe\r
-\r
-all:           $(ALL)\r
-\r
-cpmls.exe:     cpmls.obj cpmfs.obj $(OSDEPEND) getopt.obj\r
-               $(CC) $(LDFLAGS) -o $@ cpmls.obj cpmfs.obj $(OSDEPEND) $(LIBS)\r
-\r
-cpmrm.exe:     cpmrm.obj cpmfs.obj $(OSDEPEND) getopt.obj\r
-               $(CC) $(LDFLAGS) -o $@ cpmrm.obj cpmfs.obj $(OSDEPEND) $(LIBS)\r
-\r
-cpmcp.exe:     cpmcp.obj cpmfs.obj $(OSDEPEND) getopt.obj\r
-               $(CC) $(LDFLAGS) -o $@ cpmcp.obj cpmfs.obj $(OSDEPEND) $(LIBS)\r
-\r
-mkfs.cpm.exe:  mkfs.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj\r
-               $(CC) $(LDFLAGS) -o $@ mkfs.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS)\r
-\r
-fsck.cpm.exe:  fsck.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj\r
-               $(CC) $(LDFLAGS) -o $@ fsck.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS)\r
-\r
-fsed.cpm.exe:  fsed.cpm.obj getopt.obj\r
-               $(CC) $(LDFLAGS) -o $@ fsed.cpm.obj $(LIBCURSES) $(LIBS)\r
-\r
-fsck.test:     fsck.cpm.exe\r
-               -.\\fsck.cpm.exe -n badfs/status\r
-               -.\\fsck.cpm.exe -n badfs/extno\r
-               -.\\fsck.cpm.exe -n badfs/lcr\r
-               -.\\fsck.cpm.exe -n badfs/name\r
-               -.\\fsck.cpm.exe -n badfs/extension\r
-               -.\\fsck.cpm.exe -n badfs/blocknumber\r
-               -.\\fsck.cpm.exe -n badfs/recordcount\r
-               -.\\fsck.cpm.exe -n badfs/hugecom\r
-               -.\\fsck.cpm.exe -n badfs/timestamps\r
-               -.\\fsck.cpm.exe -n badfs/multipleblocks\r
-               -.\\fsck.cpm.exe -n badfs/doubleext\r
-               -.\\fsck.cpm.exe -f pcw -n badfs/label\r
-\r
-install:       all\r
-               install -c -s -m 755 cpmls $(BINDIR)/cpmls\r
-               install -c -s -m 755 cpmcp $(BINDIR)/cpmcp\r
-               install -c -s -m 755 cpmrm $(BINDIR)/cpmrm\r
-               install -c -s -m 755 mkfs.cpm $(BINDIR)/mkfs.cpm\r
-               install -c -s -m 755 fsck.cpm $(BINDIR)/fsck.cpm\r
-               install -c -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm\r
-               install -c -m 644 diskdefs $(DISKDEFS)\r
-               install -c -m 644 cpmls.1 $(MANDIR)/man1/cpmls.1\r
-               install -c -m 644 cpmcp.1 $(MANDIR)/man1/cpmcp.1\r
-               install -c -m 644 cpmrm.1 $(MANDIR)/man1/cpmrm.1\r
-               install -c -m 644 mkfs.cpm.1 $(MANDIR)/man1/mkfs.cpm.1\r
-               install -c -m 644 fsck.cpm.1 $(MANDIR)/man1/fsck.cpm.1\r
-               install -c -m 644 fsed.cpm.1 $(MANDIR)/man1/fsed.cpm.1\r
-\r
-clean:\r
-               rm -f *.obj\r
-\r
-clobber:       clean\r
-               rm -f $(ALL) *.out\r
-\r
-tar:           clobber\r
-               (b=`pwd`; b=`basename $$b`; cd ..; tar zcvf $$b.tar.gz $$b)\r
-\r
-depend:\r
-               $(MAKEDEPEND) $(CPPFLAGS) *.c >.depend\r
-\r
-include .depend\r
index b31fb7ceb4419c3371fea4c21a4aae51704cf8db..55f059644bcb72378d565de1f2a69d4901a33478 100644 (file)
@@ -1,4 +1,4 @@
-.TH MKFS.CPM 1 "October 25, 2014" "CP/M tools" "User commands"
+.TH MKFS.CPM 1 "October 10, 2022" "CP/M tools" "User commands"
 .SH NAME \"{{{roff}}}\"{{{
 mkfs.cpm \- make a CP/M file system
 .\"}}}
@@ -12,6 +12,7 @@ mkfs.cpm \- make a CP/M file system
 .RB [ \-L
 .IR label ]
 .RB [ \-t ]
+.RB [ \-u ]
 .I image
 .ad b
 .\"}}}
@@ -30,6 +31,8 @@ are written to sequential sectors, padding with 0xe5 if needed.
 Label the file system.  This is only supported by CP/M Plus.
 .IP "\fB\-t\fP"
 Create time stamps.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -44,7 +47,7 @@ CPMTOOLSFMT     Default format
 ${prefix}/share/diskdefs       CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index 56d9e4dc927350199d73f9daf0947906eadb6470..99e6c8a2296e10868d624a353553e2e8290e840e 100644 (file)
@@ -12,6 +12,7 @@ mkfs.cpm \- make a CP/M file system
 .RB [ \-L
 .IR label ]
 .RB [ \-t ]
+.RB [ \-u ]
 .I image
 .ad b
 .\"}}}
@@ -30,6 +31,8 @@ are written to sequential sectors, padding with 0xe5 if needed.
 Label the file system.  This is only supported by CP/M Plus.
 .IP "\fB\-t\fP"
 Create time stamps.
+.IP "\fB\-u\fP"
+Show all CP/M file names in upper case.
 .\"}}}
 .SH "RETURN VALUE" \"{{{
 Upon successful completion, exit code 0 is returned.
@@ -44,7 +47,7 @@ CPMTOOLSFMT     Default format
 @DATADIR@/diskdefs     CP/M disk format definitions
 .\"}}}
 .SH AUTHORS \"{{{
-This program is copyright 1997\(en2012 Michael Haardt
+This program is copyright 1997\(en2021 Michael Haardt
 <michael@moria.de>.  The Windows port is copyright 2000, 2001, 2011 John Elliott
 <jce@seasip.demon.co.uk>.
 .PP
index 2c37bdfd0123748d240764fbc5775664cefd47ee..556abb359a4d47ec4b50eb9eca21442f4eb3d7f3 100644 (file)
 
 #include "getopt_.h"
 #include "cpmfs.h"
-
-#ifdef USE_DMALLOC
-#include <dmalloc.h>
-#endif
 /*}}}*/
 /* #defines */ /*{{{*/
 #ifndef O_BINARY
@@ -22,7 +18,7 @@
 /*}}}*/
 
 /* mkfs -- make file system */ /*{{{*/
-static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *format, const char *label, char *bootTracks, int timeStamps)
+static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *format, const char *label, char *bootTracks, int timeStamps, int uppercase)
 {
   /* variables */ /*{{{*/
   unsigned int i;
@@ -116,7 +112,7 @@ static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *forma
       fprintf(stderr,"%s: can not open %s (%s)\n",cmd,name,err);
       exit(1);
     }
-    cpmReadSuper(&super,&root,format);
+    cpmReadSuper(&super,&root,format,uppercase);
 
     records=root.sb->maxdir/8;
     if (!(ds=malloc(records*128)))
@@ -160,6 +156,7 @@ int main(int argc, char *argv[]) /*{{{*/
 {
   char *image;
   const char *format;
+  int uppercase=0;
   int c,usage=0;
   struct cpmSuperBlock drive;
   struct cpmInode root;
@@ -170,7 +167,7 @@ int main(int argc, char *argv[]) /*{{{*/
   const char *boot[4]={(const char*)0,(const char*)0,(const char*)0,(const char*)0};
 
   if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
-  while ((c=getopt(argc,argv,"b:f:L:th?"))!=EOF) switch(c)
+  while ((c=getopt(argc,argv,"b:f:L:tuh?"))!=EOF) switch(c)
   {
     case 'b':
     {
@@ -184,6 +181,7 @@ int main(int argc, char *argv[]) /*{{{*/
     case 'f': format=optarg; break;
     case 'L': label=optarg; break;
     case 't': timeStamps=1; break;
+    case 'u': uppercase=1; break;
     case 'h':
     case '?': usage=1; break;
   }
@@ -193,11 +191,11 @@ int main(int argc, char *argv[]) /*{{{*/
 
   if (usage)
   {
-    fprintf(stderr,"Usage: %s [-f format] [-b boot] [-L label] [-t] image\n",cmd);
+    fprintf(stderr,"Usage: %s [-f format] [-b boot] [-L label] [-t] [-u] image\n",cmd);
     exit(1);
   }
   drive.dev.opened=0;
-  cpmReadSuper(&drive,&root,format);
+  cpmReadSuper(&drive,&root,format,uppercase);
   bootTrackSize=drive.boottrk*drive.secLength*drive.sectrk;
   if ((bootTracks=malloc(bootTrackSize))==(void*)0)
   {
@@ -224,7 +222,7 @@ int main(int argc, char *argv[]) /*{{{*/
     used+=size;
     close(fd);
   }
-  if (mkfs(&drive,image,format,label,bootTracks,timeStamps)==-1)
+  if (mkfs(&drive,image,format,label,bootTracks,timeStamps,uppercase)==-1)
   {
     fprintf(stderr,"%s: can not make new file system: %s\n",cmd,boo);
     exit(1);
diff --git a/term.h b/term.h
new file mode 100644 (file)
index 0000000..edb25ee
--- /dev/null
+++ b/term.h
@@ -0,0 +1,23 @@
+#ifndef TERM_H
+#define TERM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void term_init(void);
+extern void term_exit(void);
+extern void term_clear(void);
+extern void term_xy(int x, int y);
+extern void term_printf(char const *fmt, ...);
+extern void term_putch(char ch);
+extern int term_getch(void);
+extern void term_reverse(int on);
+extern int term_lines(void);
+extern int term_cols(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/term_curses.c b/term_curses.c
new file mode 100644 (file)
index 0000000..8d56614
--- /dev/null
@@ -0,0 +1,88 @@
+/* #includes */ /*{{{C}}}*//*{{{*/
+#include "config.h"
+
+#include <assert.h>
+#include <ctype.h>
+#ifdef NEED_NCURSES
+#ifdef HAVE_NCURSES_NCURSES_H
+#include <ncurses/ncurses.h>
+#else
+#include <ncurses.h>
+#endif
+#else
+#include <curses.h>
+#endif
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "term.h"
+/*}}}*/
+
+void term_init(void) /*{{{*/
+{
+  initscr();
+  noecho();
+  raw();
+  nonl();
+  idlok(stdscr,TRUE);
+  idcok(stdscr,TRUE);
+  keypad(stdscr,TRUE);
+  clear();
+}
+/*}}}*/
+void term_exit(void) /*{{{*/
+{
+  move(LINES-1,0);
+  refresh();
+  echo();
+  noraw();
+  endwin();
+}
+/*}}}*/
+void term_clear(void) /*{{{*/
+{
+  clear();
+}
+/*}}}*/
+void term_xy(int x, int y) /*{{{*/
+{
+  move(y,x);
+}
+/*}}}*/
+void term_printf(char const *fmt, ...) /*{{{*/
+{
+  va_list ap;
+
+  va_start(ap, fmt);
+  vw_printw(stdscr, fmt, ap);
+  va_end(ap);
+}
+/*}}}*/
+void term_putch(char ch) /*{{{*/
+{
+  addch(ch);
+}
+/*}}}*/
+int term_getch(void) /*{{{*/
+{
+  return getch();
+}
+/*}}}*/
+void term_reverse(int on) /*{{{*/
+{
+  if (on) attron(A_REVERSE);
+  else attroff(A_REVERSE);
+}
+/*}}}*/
+int term_lines(void) /*{{{*/
+{
+  return LINES;
+}
+/*}}}*/
+int term_cols(void) /*{{{*/
+{
+  return COLS;
+}
+/*}}}*/