From 32087c67d53a8f8058b359388f23e2dbc9436d54 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Mon, 19 May 2008 22:56:21 -0600 Subject: [PATCH] Imported Upstream version 2.1 --- .depend | 14 + COPYING | 340 ++++ INSTALL | 217 +++ Makefile.bcc | 95 + Makefile.in | 110 ++ Makefile.msc | 95 + NEWS | 5 + README | 43 + README.win32 | 27 + badfs/Makefile | 7 + badfs/blocknumber | Bin 0 -> 13312 bytes badfs/doubleext | Bin 0 -> 13312 bytes badfs/extension | Bin 0 -> 13312 bytes badfs/extno | Bin 0 -> 16512 bytes badfs/hugecom | Bin 0 -> 76544 bytes badfs/label | Bin 0 -> 9984 bytes badfs/lcr | Bin 0 -> 16512 bytes badfs/multipleblocks | Bin 0 -> 13312 bytes badfs/name | Bin 0 -> 13312 bytes badfs/recordcount | Bin 0 -> 13312 bytes badfs/status | Bin 0 -> 13312 bytes badfs/timestamps | Bin 0 -> 23168 bytes config.guess | 1298 +++++++++++++ config.h.in | 54 + config.sub | 1375 ++++++++++++++ configure | 4267 ++++++++++++++++++++++++++++++++++++++++++ configure.in | 120 ++ cpm.5.in | 240 +++ cpmchattr.1.in | 81 + cpmchattr.c | 106 ++ cpmchmod.1.in | 57 + cpmchmod.c | 78 + cpmcp.1.in | 85 + cpmcp.c | 307 +++ cpmdir.h | 21 + cpmfs.c | 1488 +++++++++++++++ cpmfs.h | 173 ++ cpmls.1.in | 67 + cpmls.c | 368 ++++ cpmrm.1.in | 53 + cpmrm.c | 65 + device.h | 35 + device_libdsk.c | 79 + device_posix.c | 81 + device_win32.c | 656 +++++++ diskdefs | 167 ++ fsck.cpm.1.in | 74 + fsck.cpm.c | 624 ++++++ fsed.cpm.1.in | 56 + fsed.cpm.c | 730 ++++++++ getopt.c | 1053 +++++++++++ getopt.h | 133 ++ getopt1.c | 189 ++ install-sh | 251 +++ makefile.nt | 89 + mkfs.cpm.1.in | 64 + mkfs.cpm.c | 173 ++ 57 files changed, 15710 insertions(+) create mode 100644 .depend create mode 100644 COPYING create mode 100644 INSTALL create mode 100644 Makefile.bcc create mode 100644 Makefile.in create mode 100644 Makefile.msc create mode 100644 NEWS create mode 100644 README create mode 100644 README.win32 create mode 100644 badfs/Makefile create mode 100644 badfs/blocknumber create mode 100644 badfs/doubleext create mode 100644 badfs/extension create mode 100644 badfs/extno create mode 100644 badfs/hugecom create mode 100644 badfs/label create mode 100644 badfs/lcr create mode 100644 badfs/multipleblocks create mode 100644 badfs/name create mode 100644 badfs/recordcount create mode 100644 badfs/status create mode 100644 badfs/timestamps create mode 100755 config.guess create mode 100644 config.h.in create mode 100755 config.sub create mode 100755 configure create mode 100644 configure.in create mode 100644 cpm.5.in create mode 100644 cpmchattr.1.in create mode 100644 cpmchattr.c create mode 100644 cpmchmod.1.in create mode 100644 cpmchmod.c create mode 100644 cpmcp.1.in create mode 100644 cpmcp.c create mode 100644 cpmdir.h create mode 100644 cpmfs.c create mode 100644 cpmfs.h create mode 100644 cpmls.1.in create mode 100644 cpmls.c create mode 100644 cpmrm.1.in create mode 100644 cpmrm.c create mode 100644 device.h create mode 100644 device_libdsk.c create mode 100644 device_posix.c create mode 100644 device_win32.c create mode 100644 diskdefs create mode 100644 fsck.cpm.1.in create mode 100644 fsck.cpm.c create mode 100644 fsed.cpm.1.in create mode 100644 fsed.cpm.c create mode 100644 getopt.c create mode 100644 getopt.h create mode 100644 getopt1.c create mode 100755 install-sh create mode 100644 makefile.nt create mode 100644 mkfs.cpm.1.in create mode 100644 mkfs.cpm.c diff --git a/.depend b/.depend new file mode 100644 index 0000000..c70d842 --- /dev/null +++ b/.depend @@ -0,0 +1,14 @@ +cpmchattr.o: cpmchattr.c config.h getopt.h cpmfs.h device.h +cpmchmod.o: cpmchmod.c config.h getopt.h cpmfs.h device.h +cpmcp.o: cpmcp.c config.h getopt.h cpmfs.h device.h +cpmfs.o: cpmfs.c config.h cpmdir.h cpmfs.h device.h +cpmls.o: cpmls.c config.h getopt.h cpmfs.h device.h +cpmrm.o: cpmrm.c config.h getopt.h cpmfs.h device.h +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 cpmdir.h cpmfs.h device.h +fsed.cpm.o: fsed.cpm.c config.h +getopt.o: getopt.c +getopt1.o: getopt1.c getopt.h +mkfs.cpm.o: mkfs.cpm.c config.h cpmfs.h device.h diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..a3f6b12 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..16dd9e0 --- /dev/null +++ b/INSTALL @@ -0,0 +1,217 @@ +Options for "./configure" include: + + --with-defformat= + Set the standard format the cpmtools will use. + Default is ibm-3740 + --with-device= + Set the method cpmtools will use to access discs. One of: + posix: Use the original cpmtools driver for raw files or + Unix floppy drives. + win32: Use the original cpmtools driver for raw files or + Windows floppy drives. + LibDsk: 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/ + --with-dmalloc + Use the dmalloc library + --disable-floppy + Disable the direct floppy access in LibDsk, so that it only + contains drivers for raw files, .DSK files and MYZ80 files. + + All the cpmtools that use LibDsk have an extra option: -T . This + sets the drive type used by LibDsk, and is one of: + + "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 + + 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. + + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.bcc b/Makefile.bcc new file mode 100644 index 0000000..9458c7e --- /dev/null +++ b/Makefile.bcc @@ -0,0 +1,95 @@ +# +# Makefile for cpmtools, using MS Visual C++ 6.x command-line tools +# +CC= bcc32 +DISKDEFS= c:/cpm/etc/diskdefs +CPPFLAGS= -DDISKDEFS=\"$(DISKDEFS)\" -DFORMAT=\"ibm-3740\" -DWINDOWS32 -DHAVE_MODE_T +# +# Note: The "-a1" (pack structures on 1-byte boundaries) is important. +# +CFLAGS= -a1 $(CPPFLAGS) # /Zi +LDFLAGS= +#LDFLAGS= -g -L/usr/dmalloc/lib +LIBCURSES= -lcurses +LIBS= getopt.obj # /link /debug +#LIBS= -ldmalloc +MAKEDEPEND= mkdep -d +#MAKEDEPEND= gcc -MM +#MAKEDEPEND= makedepend -f- +BINDIR= /usr/cpm/bin +MANDIR= /usr/cpm/man/en +OSDEPEND= device_win32.obj +#OSDEPEND= device_posix.obj # Can be used if you don't want direct + # floppy support + +ALL= cpmls.exe cpmrm.exe cpmcp.exe mkfs.cpm.exe fsck.cpm.exe \ + cpmchmod.exe cpmchattr.exe # fsed.cpm.exe + +all: $(ALL) + +cpmls.exe: cpmls.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) cpmls.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmrm.exe: cpmrm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) cpmrm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmchmod.exe: cpmchmod.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) cpmchmod.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmchattr.exe: cpmchattr.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) cpmchattr.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmcp.exe: cpmcp.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) cpmcp.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +mkfs.cpm.exe: mkfs.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) mkfs.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +fsck.cpm.exe: fsck.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) fsck.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +fsed.cpm.exe: fsed.cpm.obj getopt.obj + $(CC) $(LDFLAGS) fsed.cpm.obj $(LIBCURSES) $(LIBS) + +fsck.test: fsck.cpm.exe + -.\\fsck.cpm.exe -n badfs/status + -.\\fsck.cpm.exe -n badfs/extno + -.\\fsck.cpm.exe -n badfs/lcr + -.\\fsck.cpm.exe -n badfs/name + -.\\fsck.cpm.exe -n badfs/extension + -.\\fsck.cpm.exe -n badfs/blocknumber + -.\\fsck.cpm.exe -n badfs/recordcount + -.\\fsck.cpm.exe -n badfs/hugecom + -.\\fsck.cpm.exe -n badfs/timestamps + -.\\fsck.cpm.exe -n badfs/multipleblocks + -.\\fsck.cpm.exe -n badfs/doubleext + -.\\fsck.cpm.exe -f pcw -n badfs/label + +install: all + install -c -s -m 755 cpmls $(BINDIR)/cpmls + install -c -s -m 755 cpmcp $(BINDIR)/cpmcp + install -c -s -m 755 cpmrm $(BINDIR)/cpmrm + install -c -s -m 755 mkfs.cpm $(BINDIR)/mkfs.cpm + install -c -s -m 755 fsck.cpm $(BINDIR)/fsck.cpm + install -c -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm + install -c -m 644 diskdefs $(DISKDEFS) + install -c -m 644 cpmls.1 $(MANDIR)/man1/cpmls.1 + install -c -m 644 cpmcp.1 $(MANDIR)/man1/cpmcp.1 + install -c -m 644 cpmrm.1 $(MANDIR)/man1/cpmrm.1 + install -c -m 644 mkfs.cpm.1 $(MANDIR)/man1/mkfs.cpm.1 + install -c -m 644 fsck.cpm.1 $(MANDIR)/man1/fsck.cpm.1 + install -c -m 644 fsed.cpm.1 $(MANDIR)/man1/fsed.cpm.1 + +clean: + rm -f *.obj + +clobber: clean + rm -f $(ALL) *.out + +tar: clobber + (b=`pwd`; b=`basename $$b`; cd ..; tar zcvf $$b.tar.gz $$b) + +depend: + $(MAKEDEPEND) $(CPPFLAGS) *.c >.depend + +!include .depend diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..6894e20 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,110 @@ +srcdir= @srcdir@ +VPATH= @srcdir@ +libdir= @libdir@ +BINDIR= @bindir@ +MANDIR= @mandir@ +includedir= @includedir@ +exec_prefix= @exec_prefix@ +prefix= @prefix@ +INSTALL= @INSTALL@ +INSTALL_DATA= @INSTALL_DATA@ +CC= @CC@ +CFLAGS= @CFLAGS@ +LDFLAGS= @LDFLAGS@ +DEFFORMAT= @DEFFORMAT@ +DEVICE= @DEVICE@ +FSED_CPM= @FSED_CPM@ +EXEEXT = @EXEEXT@ +OBJEXT = .@OBJEXT@ +LIBS= @LIBS@ @LDLIBS@ +LDDEPS= @LDDEPS@ +CPPFLAGS= -DDISKDEFS=\"@datadir@/diskdefs\" -DFORMAT=\"$(DEFFORMAT)\" +# +# [JCE] I'm only a novice and I haven't worked out how to autoconf this one +# + +#MAKEDEPEND= mkdep -d +MAKEDEPEND= gcc -MM +#MAKEDEPEND= makedepend -f- + +DEVICEOBJ= device_$(DEVICE)$(OBJEXT) + +ALL= cpmls$(EXEEXT) cpmrm$(EXEEXT) cpmcp$(EXEEXT) \ + cpmchmod$(EXEEXT) cpmchattr$(EXEEXT) mkfs.cpm$(EXEEXT) \ + fsck.cpm$(EXEEXT) $(FSED_CPM) + +all: $(ALL) + +LibDsk/libdsk.a: + cd LibDsk && make + +cpmls$(EXEEXT): cpmls$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) + $(CC) $(LDFLAGS) -o $@ cpmls$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) + +cpmrm$(EXEEXT): cpmrm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) + $(CC) $(LDFLAGS) -o $@ cpmrm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) + +cpmcp$(EXEEXT): cpmcp$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) + $(CC) $(LDFLAGS) -o $@ cpmcp$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) + +cpmchmod$(EXEEXT): cpmchmod$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) + $(CC) $(LDFLAGS) -o $@ cpmchmod$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) + +cpmchattr$(EXEEXT): cpmchattr$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) + $(CC) $(LDFLAGS) -o $@ cpmchattr$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) + +mkfs.cpm$(EXEEXT): mkfs.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) + $(CC) $(LDFLAGS) -o $@ mkfs.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) + +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) + +fsck.test: fsck.cpm + -./fsck.cpm -f ibm-3740 -n badfs/status + -./fsck.cpm -f ibm-3740 -n badfs/extno + -./fsck.cpm -f ibm-3740 -n badfs/lcr + -./fsck.cpm -f ibm-3740 -n badfs/name + -./fsck.cpm -f ibm-3740 -n badfs/extension + -./fsck.cpm -f ibm-3740 -n badfs/blocknumber + -./fsck.cpm -f ibm-3740 -n badfs/recordcount + -./fsck.cpm -f ibm-3740 -n badfs/hugecom + -./fsck.cpm -f ibm-3740 -n badfs/timestamps + -./fsck.cpm -f ibm-3740 -n badfs/multipleblocks + -./fsck.cpm -f ibm-3740 -n badfs/doubleext + -./fsck.cpm -f pcw -n badfs/label + +install: all + $(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 + $(INSTALL) -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm + $(INSTALL_DATA) diskdefs @datadir@/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) cpmchmod.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 + +clean: + rm -f *$(OBJEXT) *.1 *.5 + +distclean: clean + rm -f $(ALL) config.log config.cache config.h config.status Makefile *.out + +tar: distclean + (b=`pwd`; b=`basename $$b`; cd ..; tar zcvf $$b.tar.gz $$b) + +depend: + $(MAKEDEPEND) $(CPPFLAGS) *.c >.depend + +include .depend diff --git a/Makefile.msc b/Makefile.msc new file mode 100644 index 0000000..8bb6b0e --- /dev/null +++ b/Makefile.msc @@ -0,0 +1,95 @@ +# +# Makefile for cpmtools, using MS Visual C++ 6.x command-line tools +# +CC= cl +DISKDEFS= c:/cpm/etc/diskdefs +CPPFLAGS= /DDISKDEFS=\"$(DISKDEFS)\" /DFORMAT=\"ibm-3740\" /DWINDOWS32 +# +# Note: The "/Zp1" (pack structures on 1-byte boundaries) is important. +# +CFLAGS= /Zp1 /WX /W3 /nologo $(CPPFLAGS) # /Zi +LDFLAGS= /nologo +#LDFLAGS= -g -L/usr/dmalloc/lib +LIBCURSES= -lcurses +LIBS= getopt.obj # /link /debug +#LIBS= -ldmalloc +MAKEDEPEND= mkdep -d +#MAKEDEPEND= gcc -MM +#MAKEDEPEND= makedepend -f- +BINDIR= /usr/cpm/bin +MANDIR= /usr/cpm/man/en +OSDEPEND= device_win32.obj +#OSDEPEND= device_posix.obj # Can be used if you don't want direct + # floppy support + +ALL= cpmls.exe cpmrm.exe cpmcp.exe mkfs.cpm.exe fsck.cpm.exe \ + cpmchmod.exe cpmchattr.exe # fsed.cpm.exe + +all: $(ALL) + +cpmls.exe: cpmls.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmls.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmrm.exe: cpmrm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmrm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmchmod.exe: cpmchmod.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmchmod.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmchattr.exe: cpmchattr.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmchattr.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmcp.exe: cpmcp.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmcp.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +mkfs.cpm.exe: mkfs.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ mkfs.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +fsck.cpm.exe: fsck.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ fsck.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +fsed.cpm.exe: fsed.cpm.obj getopt.obj + $(CC) $(LDFLAGS) -o $@ fsed.cpm.obj $(LIBCURSES) $(LIBS) + +fsck.test: fsck.cpm.exe + -.\\fsck.cpm.exe -n badfs/status + -.\\fsck.cpm.exe -n badfs/extno + -.\\fsck.cpm.exe -n badfs/lcr + -.\\fsck.cpm.exe -n badfs/name + -.\\fsck.cpm.exe -n badfs/extension + -.\\fsck.cpm.exe -n badfs/blocknumber + -.\\fsck.cpm.exe -n badfs/recordcount + -.\\fsck.cpm.exe -n badfs/hugecom + -.\\fsck.cpm.exe -n badfs/timestamps + -.\\fsck.cpm.exe -n badfs/multipleblocks + -.\\fsck.cpm.exe -n badfs/doubleext + -.\\fsck.cpm.exe -f pcw -n badfs/label + +install: all + install -c -s -m 755 cpmls $(BINDIR)/cpmls + install -c -s -m 755 cpmcp $(BINDIR)/cpmcp + install -c -s -m 755 cpmrm $(BINDIR)/cpmrm + install -c -s -m 755 mkfs.cpm $(BINDIR)/mkfs.cpm + install -c -s -m 755 fsck.cpm $(BINDIR)/fsck.cpm + install -c -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm + install -c -m 644 diskdefs $(DISKDEFS) + install -c -m 644 cpmls.1 $(MANDIR)/man1/cpmls.1 + install -c -m 644 cpmcp.1 $(MANDIR)/man1/cpmcp.1 + install -c -m 644 cpmrm.1 $(MANDIR)/man1/cpmrm.1 + install -c -m 644 mkfs.cpm.1 $(MANDIR)/man1/mkfs.cpm.1 + install -c -m 644 fsck.cpm.1 $(MANDIR)/man1/fsck.cpm.1 + install -c -m 644 fsed.cpm.1 $(MANDIR)/man1/fsed.cpm.1 + +clean: + rm -f *.obj + +clobber: clean + rm -f $(ALL) *.out + +tar: clobber + (b=`pwd`; b=`basename $$b`; cd ..; tar zcvf $$b.tar.gz $$b) + +depend: + $(MAKEDEPEND) $(CPPFLAGS) *.c >.depend + +include .depend diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..af2b661 --- /dev/null +++ b/NEWS @@ -0,0 +1,5 @@ +Changes since 2.0: + +o Epson QX10 format added to diskdefs +o Extent computation fixed for blocksizes <= 1k and disk sizes >= 256 k +o Support for current libdsk diff --git a/README b/README new file mode 100644 index 0000000..021e771 --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +This package allows to access CP/M file systems similar to the well-known +mtools package, which accesses MSDOS file systems. I use it for file +exchange with a Z80-PC simulator, but it works on floppy devices as well. +Currently it contains: + +o cpmls - list sorted directory with output similar to ls, DIR, P2DOS + DIR and CP/M3 DIR[FULL] +o cpmcp - copy files from and to CP/M file systems +o cpmrm - erase files from CP/M file systems +o cpmchmod - change file permissions +o cpmchattr - change file attributes +o mkfs.cpm - make a CP/M file system +o fsck.cpm - check and repair a CP/M file system (only simple errors + can be repaired so far). Some images of broken file systems are provided + for testing. +o fsed.cpm - view CP/M file system +o manual pages for everything including the CP/M file system format + +All CP/M file system features are supported. Password protection +is ignored, because passwords are easy to decrypt, but a pseudo file +[passwd] contains them, if you are curious what your old password has +been. The disk label is read as special file [label]. User numbers +are specified as user:file. + +Cpmtools should compile and work out of the box on each POSIX compliant +system. It can be additionally compiled for Win32 systems. The source +is available as a GNU zipped tape archive from: + + http://www.moria.de/~michael/cpmtools/ + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2 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. + +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/README.win32 b/README.win32 new file mode 100644 index 0000000..2a094da --- /dev/null +++ b/README.win32 @@ -0,0 +1,27 @@ +Compiling on Win32 systems: + + It's best to do this using mingw32 and standard configure commands. The +makefiles for Microsoft C and Borland C are pretty outdated and don't +understand LibDsk. + +For Microsoft C++ (eg: Visual C++ 6.0): + +* Run the VCVARS32 command to set up the command-line compiler. +* Build the CPMTOOLS programs with NMAKE /F MAKEFILE.MSC + +For Borland C++ 5.x: + +* Use Makefile.bcc + + I have not found a working Curses library for Win32, so fsed.cpm has not +been touched. + + 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/badfs/Makefile b/badfs/Makefile new file mode 100644 index 0000000..75c4ee0 --- /dev/null +++ b/badfs/Makefile @@ -0,0 +1,7 @@ +# +# Dummy makefile +# +all: +clean: +distclean: + diff --git a/badfs/blocknumber b/badfs/blocknumber new file mode 100644 index 0000000000000000000000000000000000000000..9259cacb19e82bf3525eab4d46979e21fb442db0 GIT binary patch literal 13312 zcmeHLU2o&Y72TqJ;!o()g`ea=W+koHYrAa#fA|Uix4&Q0 zTK^x{qH0af+gj(eGJZjRq3OXq>52;bU@}#Zd(^8mN#EQhS9Ejtr?-?F_ehzoyfT%; z1GUzKVU)W}(ht)lb<1SBc3zj{Yn44Z>e;0?wo=7$lFsVn*3>$~lxsdZG$t;q%?yj5 zt!3$RTNHL>st0mQote4G$eADX?$YGl8IN;sQ-7$+aWez(V6(S}fCX03-PRE{F6Di2yP-sxhV5=|U__H9l%*{8_BwhL1L}tI)I6m#jYoN``$Ph%sKV>I zr2F|Kn7;zAjbGo-?@+^)T07FuS<&P=7MN+z^xo$~n!K}KV-Cd=u_TN;H2yY&{#lGH zboHRAsf>r7rPH})xwJJ968a|63E1F=gVAZ9MuXGyKAjFO&iZsdycmfq49{MkpN6i0 zQT|Z@1m9H3>tfA5U|hng2LQ3Z9D4of{SjU3!ssVd!^6X1QNB;L=7sCLkhZunuiDP% z8@l9{@1)1duIRp}t0XmZswmCDg^Et(&~FaI4IjS+tZ$L@j{dHyM%8N?o*jDqSOm?C zFV&LQUKqF%^LEamMyl>m#(yrbB$Z{_IgSP@$!kO;xsm;BZfZQ{O$n3@Hl(TjU}<6s`8q>j(W2%^*anW=w)O5nd5Nk6T?3EBCL$LJf8vNzB+>ZDHBE z{8HCU^N_2yz@b}G%t8I&ItR}`eHva|ygs5MDV(>qa5(tJ#P$q(JWA5(xAgAn?KsJn z@W7K$V=+PoXU_M=z8ADD58RHYHyib4lFj6?qFB&uTRN*Wkpcg<{KYKK6cN|fr1rmsqu+6iH^L3N?rq7mM$JaNv5^|K^ zy;_>8;W@)~mJKFX<oE8L1qyU{$*ACyv`{!EwjSNa=$MgOM%ps7Mu*A|On#Vu8yqr$Q| zn-!{h1T0}QCd4b%ni{n1lFbF36*07G%>_*290xSu&2aY?4Y^zF4N{kqjV>`;wt%hW z*u{;LyJl8k^TTss1NUT{;U?Ks9B~DAOp0D1d!FMMZPC<1!wkA-!Y8A26w2CL+lH34 zouS*V>7jv_;x>;Wp!mMQB!g%D3a#YiYjNK`4eq}}UwJtU=XU1n^NMqErorKQO zOyDXdp*E$oGodCf1{?JTx38%eXNkm3Q3%v|jpnyHX22mL@!qBK@D_FoXHg=F17hG= z0e!*!0@3-AQnYE|T&h}wV|b9Qi#5tcUoEsQg2pg%j~!RfRa1DGkFfoExy#g+NS~)G zZjT-*H`pO^6Zg9d>s{kJ&qIv?*&Zg7pukU_A70XOYbw+epYMk+LBXcJ^xj_}GLnR? zwoLxtMrw(8pg-t6>^jzxydo{$64c}am5+0ma)Rm&kNa{42L*?1 z5qZR*r{a>g&5B`=&uoEKShXC*w7ImVf-OT@@d7=m0^NmM-ri=FV5{t-@R!l6v*bH$ z+K~6@UsJ>l1Sh;mVDO1x7?(!>6}8bkC0U4*Q*SfmtX0L{n0VE#UPQSYGv23g>_}HT z35Y>)*rRX;XYV1uvNCmhLWbH2I`KZqJ7`brkV;Gf6&}Mf4@CQR+I_=C5fULn&igFk z1-_>t0&JW(Y|K9A#BEyOqy#rk_MEsC2=YcA%Agt5qAT{sQS zM;>hLl)(^`Byh0yA}yE|(u8VgLcVIemJo9_y_rm?jW7u^$t6DKT>pi>{<2@czKj-+ m(B{F+4X?$e$GqW?>E(r`H>g}_{<-V${>=_a`V*EENB9|{O`z@o literal 0 HcmV?d00001 diff --git a/badfs/doubleext b/badfs/doubleext new file mode 100644 index 0000000000000000000000000000000000000000..8ee7d65b78a042a9d87beaff6f9fe8c5262b419b GIT binary patch literal 13312 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 I?@|>0{{_)qYybcN literal 0 HcmV?d00001 diff --git a/badfs/label b/badfs/label new file mode 100644 index 0000000000000000000000000000000000000000..982928d18d0a1ea8e1c6d2f3d08654bb1e834786 GIT binary patch literal 9984 zcmeIuu?>ST07b!UL6L@J6C%;kFf^lhj|iF!@R|tSms~zuzA=md0RjXF5FkK+009C7 z2oNAZ;LZZ`wtUuYzP3MpJD%_9JoWFddO_^H9|2>|KLW;_e*}y<{|Fd!{t+h1$ttv`Tzg` literal 0 HcmV?d00001 diff --git a/badfs/lcr b/badfs/lcr new file mode 100644 index 0000000000000000000000000000000000000000..da20f4b5b08a1e603b7b47ba99ea680925fd5c91 GIT binary patch literal 16512 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 literal 0 HcmV?d00001 diff --git a/badfs/multipleblocks b/badfs/multipleblocks new file mode 100644 index 0000000000000000000000000000000000000000..52c1d922b9344fff5c4a9a2a7618687fec4e3d93 GIT binary patch literal 13312 zcmeHLU2o&Y6*ZdVg+HNB7k-ihiIucoukE%8{GlL9_QP0hQJ{4nM&!sEnB*v&p=IU& z=703uJEJdW7byB*0|AWyS&HO*oO{l>XZYK1?O%&Pi$IG&i$IG&i$IG&i$IG&i$IG& zi$IG&i$IG&i$IG&i$IG&i$IG&i$IG&i@+ZVfrG1?cf^0Mi4G19=ucmL{SE%V{afEZ z3HJ}a`g(g0|N0|g@e+GcwI=6nt#eu$KPNxebY~uPMTNaHnJUQL>t&jxZ*P(dy1Mzx zJIal_r_5GfnabgXT5G~E%AF_a$4Qd9MKW1AuS@c^%I+O??7|ycsp2R}r*(2|YMo)q z6<@u?o_FVTS#74+{B$K-pV^|YOH})&ZZwn$tSSi?QvJMA=H>!>mdr2qsXet zgBFZ;x|pRz`pPEi}z+T|WPg_h)25Zkd~} zrAfN-wTaAryLN&|eHg+Ma@X4F`T;W918)QC1xH$FPFHhI=+}G*tAzkXi z=m%88!^2=vzDu>{jqALSwzxL0+RkQcy5yFhr2EP)>9(V*BsDXtD9yozih6SC*O%de zPd@_IcSw4NKdGuw^@;{3&%NKL^I;P-HNI2}-g{x-O3d3ChZ?E6LmB@$$Cgxo-4vze*!nl~k^UU)NYOaUCY-0Q&+6*8nO3~Z5$@KUter|Ws{YtSFj3__G@ z#w3Uz!V(emxYY%*a{nqU)L>_k#Ei|w7M88cFLcc`54ma!9J(dN9Mlc2^WyoZOM|ns zH-~g6h4a=H4i`U|*q&jJheKXj zY5d`RGE(r@ZFY_h0L&2>Rv}w|+EN0#z%2!&era?CBZcGqt}#H+eR3zHTz#)OwrJ2b_9ycoWYTOTU}qhr!3FQyA|H-P2WWRCR<`VE9l1 zmewEi@ZaF<&8Z{;9udRMZBuhNzP!4YkfZ$W-O^MI&l&EsY%sYh7p_aw#?#I4`on~B zt6iFmL71HfBtpf7nkvx@>kM<@+_Dc4yf!qoons2DeIc9WqGdR*a4Rx zr05lL<~fSd7ELWQ%%FQFd@@Xjp{$*iZD>*3DZ1^7?izS09`h&yitigt(tp&i(Mo#X ziTie`fBP-^%Bw;6ZD+nN?>HA{>OT(SeWppEQ8;CuM)C?um11xHJ(Nkh;U`Y5>l47- z+|4qy z?{pJ}9O~d%7PWpb7U+ay_CCvz&-cZ=0aN6*Mqn$TIESh8UZJo-4EF+*-<#4ULR#=P zco-b5f`1e_FdH)lu%=8oR8Ke?jZO#$>*MqmnZQ*_LTyTEXF^Tf3^wWw9$!%>&Ju~6 zq7bO_3e9hM#DGIY;=K#y;VtYG&Z0yT2gJa$0{Vjc1)}pSrD)T_xm2|R$M7Os7i*M@ zzMN}a1dUda1Chm7P*15!Yp1T?YvOSE) zL4i-+ADq)-Ybw+cpYMh*LBXcJwC*nu8A-xcTPFX1Bkhs#1up0V>^jzxy^u>7iP+YKZ0=ZgihFPL!$X=S!7p%F*C@+t2_XRx~*i$Y{N zoQy_v@pke732OY2%KMp1IYD&>M_u^^7X^oH5qZR*qvDpg&5B`=&uoEK*tJ~6w7IaR zf-OT@@diDp0^NmM-rixAV5{t-@R#B1ljLU{+K~6@UlYU)1Sc#cFt{fe#;wu+L~S%r zNfzSd)L9QX-Kb)3Oe}S)7g6rojQ1%VJJQ8Y0%A}c&M2J0*?Y(@txUc7L5A81I`KKl zJ7`brkV;Gf6&}GdUx4y^Q|=osijW8qaz1AXFYrAL5n%1a;b8VTC*Gt5PD*g&WY38= z0^wX4jymhJJ?NPH`NjTrf;AVjCt)lySQk!%^N|NzJ7q8gB?%m?y+{jYg*2fWnvky= zZzRNAOs>Xb+C-QHndBTFb1wfz-+kGy-<(H_M`-h4=9<^y(jz`_$n>&c=?y9unt$#- PynlT{lKzA(#S#7s^45iN literal 0 HcmV?d00001 diff --git a/badfs/name b/badfs/name new file mode 100644 index 0000000000000000000000000000000000000000..67265aca96e0332f1628a01416886f8bebf0f52d GIT binary patch literal 13312 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 literal 0 HcmV?d00001 diff --git a/badfs/status b/badfs/status new file mode 100644 index 0000000000000000000000000000000000000000..33da248169b72872435ff70f6de33737b51a34a8 GIT binary patch literal 13312 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 literal 0 HcmV?d00001 diff --git a/badfs/timestamps b/badfs/timestamps new file mode 100644 index 0000000000000000000000000000000000000000..a434cc96935e8cf128804f30e5de6109b464c441 GIT binary patch literal 23168 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 literal 0 HcmV?d00001 diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..6012b39 --- /dev/null +++ b/config.guess @@ -0,0 +1,1298 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-07-12' + +# 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 +# (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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# 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. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +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." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + 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 + 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 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # 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. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + 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 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + 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 + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + 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/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + 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/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /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} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # 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} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + 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); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????: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 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | 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` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 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 ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + eval $set_cc_for_build + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + 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 i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev67 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-pc-linux-gnu\n", argv[1]); +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-pc-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V: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} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + 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} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + 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 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /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 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *: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 + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +eval $set_cc_for_build +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +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` + +/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` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..1739459 --- /dev/null +++ b/config.h.in @@ -0,0 +1,54 @@ + +#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_DMALLOC_H 0 +#define HAVE_SYS_TYPES_H 0 +#define HAVE_SYS_STAT_H 0 +#define HAVE_MODE_T 0 + +#if HAVE_SYS_STAT_H +#include +#endif + +#if HAVE_SYS_TYPES_H +#include +#endif + +#if HAVE_DMALLOC_H +#include +#endif + +#if HAVE_LIMITS_H +#include +#endif + +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_WINDOWS_H +#include +#endif + +#if HAVE_WINIOCTL_H +#include +#endif + +#if HAVE_LIBDSK_H +#include +#endif + +#if HAVE_FCNTL_H +#include +#endif + +#ifndef _POSIX_PATH_MAX +#define _POSIX_PATH_MAX _MAX_PATH +#endif + +#include + diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..578b302 --- /dev/null +++ b/config.sub @@ -0,0 +1,1375 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-06-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 +# (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. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# 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. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +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." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + 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* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### 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) + os= + basic_machine=$1 + ;; + -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 + ;; + -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/'` + ;; + -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*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ + | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ + | pj | pjl | h8500 | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # 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 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \ + | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ + | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) + ;; + # 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 + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + 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 + ;; + 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 + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + 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 | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + 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 + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + 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 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-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 + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-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 + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + 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 + ;; + 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* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + 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 + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) 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/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# 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 + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$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. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # 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* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # 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 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# 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*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..1d687ac --- /dev/null +++ b/configure @@ -0,0 +1,4267 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="cpmfs.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +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 || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:866: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:877: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:885: creating cache $cache_file" >&5 +echo "$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 `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) + { echo "$as_me:901: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:905: error: \`$ac_var' was not set in the previous run" >&5 +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 + { echo "$as_me:911: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:913: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:915: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:934: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:936: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +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 + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:956: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:959: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_config_headers="$ac_config_headers config.h" + +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" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:987: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:997: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:1001: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:1010: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:1014: error: $ac_config_sub $ac_cv_build_alias failed." >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1019: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +echo "$as_me:1026: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:1035: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1040: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +VERSION=2.1 +UPDATED='April 21, 2002' + +DEVICE="posix" + +if test "$prefix" = NONE +then + case $host in + *-linux-*) + PIPE="-pipe " + ;; + esac + case $host in + *-netbsd*) + PIPE="-pipe " + ;; + esac +fi + +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 +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 +echo "$as_me:1074: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1089: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1097: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1100: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +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 +echo "$as_me:1109: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1124: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1132: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1135: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +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 +echo "$as_me:1148: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1163: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1171: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1174: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1183: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1198: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1206: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1209: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +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 +echo "$as_me:1222: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1242: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # 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 + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1264: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1267: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + 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 +echo "$as_me:1278: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1293: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1301: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1304: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1317: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1332: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1340: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1343: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1355: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1360:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1363: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:1366: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1368: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:1371: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1373: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:1376: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1380 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# 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. +echo "$as_me:1396: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1399: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1402: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1425: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1431: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1436: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1442: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1445: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1452: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1460: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1467: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1469: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1472: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1474: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1477: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1493: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1499: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1505: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1511 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1523: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1526: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1538: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1545: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1549: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1555 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1570: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1573: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1576: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1579: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1591: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1597: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1603 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1615: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1618: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1621: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1624: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1634: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1661: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1664: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1667: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1670: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1682 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1695: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1698: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1701: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1704: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1714 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1726: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1729: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1732: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1735: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +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 + +# 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 +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:1774: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:1823: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +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 +echo "$as_me:1839: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-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. + # 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 >conftest.$ac_ext <<_ACEOF +#line 1860 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:1865: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1871: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1894 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:1898: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1904: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:1941: result: $CPP" >&5 +echo "${ECHO_T}$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. + # 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 >conftest.$ac_ext <<_ACEOF +#line 1951 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:1956: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1962: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1985 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:1989: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1995: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:2023: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +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 + +if test "$GCC" = yes +then + CFLAGS="${CFLAGS} ${PIPE}-Wmissing-prototypes -Wstrict-prototypes -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-declarations -Wnested-externs -pedantic -fno-common" + LDFLAGS='-g' +fi + +# Check whether --with-defformat or --without-defformat was given. +if test "${with_defformat+set}" = set; then + withval="$with_defformat" + DEFFORMAT="$withval" +else + DEFFORMAT="ibm-3740" +fi; + +# Check whether --with-libdsk or --without-libdsk was given. +if test "${with_libdsk+set}" = set; then + withval="$with_libdsk" + LIBDSK="$withval" +else + LIBDSK="" +fi; + +# Check whether --with-dmalloc or --without-dmalloc was given. +if test "${with_dmalloc+set}" = set; then + withval="$with_dmalloc" + DMALLOC="$withval" +else + DMALLOC="" +fi; + +case $host_os in + *cygwin* ) CYGWIN=yes;; + * ) CYGWIN=no;; +esac + +case $host_os in + *mingw32* ) MINGW32=yes;; + * ) MINGW32=no;; +esac + +DEVICE="posix" + +if test "$CYGWIN" = "yes" +then + DEVICE="win32" +fi +if test "$MINGW32" = "yes" +then + DEVICE="win32" +fi + +echo "$as_me:2085: checking for printw in -lcurses" >&5 +echo $ECHO_N "checking for printw in -lcurses... $ECHO_C" >&6 +if test "${ac_cv_lib_curses_printw+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2093 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char printw (); +int +main () +{ +printw (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2112: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2115: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2118: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2121: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_curses_printw=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_curses_printw=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2132: result: $ac_cv_lib_curses_printw" >&5 +echo "${ECHO_T}$ac_cv_lib_curses_printw" >&6 +if test $ac_cv_lib_curses_printw = yes; then + FSED_CPM=fsed.cpm LIBS="-lcurses $LIBS" +else + FSED_CPM= +fi + +if test x"$FSED_CPM" = x""; then + echo "$as_me:2141: checking for printw in -lncurses" >&5 +echo $ECHO_N "checking for printw in -lncurses... $ECHO_C" >&6 +if test "${ac_cv_lib_ncurses_printw+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2149 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char printw (); +int +main () +{ +printw (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2168: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2171: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2174: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2177: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ncurses_printw=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ncurses_printw=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2188: result: $ac_cv_lib_ncurses_printw" >&5 +echo "${ECHO_T}$ac_cv_lib_ncurses_printw" >&6 +if test $ac_cv_lib_ncurses_printw = yes; then + FSED_CPM=fsed.cpm LIBS="-lncurses $LIBS" +else + FSED_CPM= +fi + +fi + +if test "$LIBDSK" != ""; then + DEVICE="libdsk" + CPPFLAGS="$CPPFLAGS -I$LIBDSK/include" + CFLAGS="$CFLAGS -I$LIBDSK/include" + LDFLAGS="$LDFLAGS -L$LIBDSK/lib" + +echo "$as_me:2204: checking for dsk_open in -ldsk" >&5 +echo $ECHO_N "checking for dsk_open in -ldsk... $ECHO_C" >&6 +if test "${ac_cv_lib_dsk_dsk_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldsk $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2212 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dsk_open (); +int +main () +{ +dsk_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2231: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2234: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2237: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2240: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dsk_dsk_open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dsk_dsk_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2251: result: $ac_cv_lib_dsk_dsk_open" >&5 +echo "${ECHO_T}$ac_cv_lib_dsk_dsk_open" >&6 +if test $ac_cv_lib_dsk_dsk_open = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2271 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2275: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2281: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2300: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2325 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2329: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2335: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2354: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for malloc in -ldmalloc... $ECHO_C" >&6 +if test "${ac_cv_lib_dmalloc_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2381 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char malloc (); +int +main () +{ +malloc (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2400: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2403: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2406: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2409: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dmalloc_malloc=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dmalloc_malloc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2420: result: $ac_cv_lib_dmalloc_malloc" >&5 +echo "${ECHO_T}$ac_cv_lib_dmalloc_malloc" >&6 +if test $ac_cv_lib_dmalloc_malloc = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2440 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2444: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2450: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2469: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2487 "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:2495: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2501: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 2523 "configure" +#include "confdefs.h" +#include + +_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* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 2541 "configure" +#include "confdefs.h" +#include + +_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* + +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 >conftest.$ac_ext <<_ACEOF +#line 2562 "configure" +#include "confdefs.h" +#include +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:2588: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2591: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:2593: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2596: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:2609: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_header in fcntl.h sys/types.h sys/stat.h limits.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:2622: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2628 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2632: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2638: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2657: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 2675 "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* 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; +} +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; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:2724: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2727: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2730: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2733: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:2750: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:2753: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +echo "$as_me:2758: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2764 "configure" +#include "confdefs.h" + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* 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. + 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 */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2822: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2825: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2828: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2831: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2841: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\EOF +#define const +EOF + +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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:2857: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2863 "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2869: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2872: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2875: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2878: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2888: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 +if test "${ac_cv_type_mode_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2904 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((mode_t *) 0) + return 0; +if (sizeof (mode_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2919: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2922: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2925: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2928: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_mode_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_mode_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2938: result: $ac_cv_type_mode_t" >&5 +echo "${ECHO_T}$ac_cv_type_mode_t" >&6 +if test $ac_cv_type_mode_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2956 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2971: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2974: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2977: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2980: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2990: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3008 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3023: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3026: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3029: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3032: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_pid_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3042: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3060 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3075: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3078: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3081: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3084: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3094: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 +if test "${ac_cv_struct_tm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3112 "configure" +#include "confdefs.h" +#include +#include + +int +main () +{ +struct tm *tp; tp->tm_sec; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3126: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3129: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3132: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3135: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_struct_tm=time.h +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_struct_tm=sys/time.h +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:3145: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6 +if test $ac_cv_struct_tm = sys/time.h; then + +cat >>confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +if test x"$FSED_CPM" != x""; then + FSED_CPM="$FSED_CPM$EXEEXT" +fi + +echo "$as_me:3159: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +else + cat >conftest.$ac_ext <<_ACEOF +#line 3168 "configure" +#include "confdefs.h" + +int +main () +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:3204: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3207: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:3209: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3212: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_memcmp_working=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_memcmp_working=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:3224: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext" + +for ac_func in strftime +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:3231: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3237 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3268: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3271: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3274: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3277: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3287: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_strftime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 3304 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strftime (); +int +main () +{ +strftime (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3323: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3326: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3329: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3332: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_strftime=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_intl_strftime=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:3343: result: $ac_cv_lib_intl_strftime" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6 +if test $ac_cv_lib_intl_strftime = yes; then + cat >>confdefs.h <<\EOF +#define HAVE_STRFTIME 1 +EOF + +LIBS="-lintl $LIBS" +fi + +fi +done + +for ac_func in mktime strerror +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:3359: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3365 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3396: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3399: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3402: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3405: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3415: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:3507: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:3680: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:3699: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "cpm.5" ) CONFIG_FILES="$CONFIG_FILES cpm.5" ;; + "cpmchattr.1" ) CONFIG_FILES="$CONFIG_FILES cpmchattr.1" ;; + "cpmchmod.1" ) CONFIG_FILES="$CONFIG_FILES cpmchmod.1" ;; + "cpmcp.1" ) CONFIG_FILES="$CONFIG_FILES cpmcp.1" ;; + "cpmls.1" ) CONFIG_FILES="$CONFIG_FILES cpmls.1" ;; + "cpmrm.1" ) CONFIG_FILES="$CONFIG_FILES cpmrm.1" ;; + "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" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:3745: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# 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 +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CPP@,$CPP,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LDLIBS@,$LDLIBS,;t t +s,@LDDEPS@,$LDDEPS,;t t +s,@DEVICE@,$DEVICE,;t t +s,@DATADIR@,$DATADIR,;t t +s,@DISKDEFS@,$DISKDEFS,;t t +s,@DEFFORMAT@,$DEFFORMAT,;t t +s,@FSED_CPM@,$FSED_CPM,;t t +s,@UPDATED@,$UPDATED,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:3968: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3986: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3999: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:4060: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:4071: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:4084: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:4201: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..b9d19d6 --- /dev/null +++ b/configure.in @@ -0,0 +1,120 @@ +AC_INIT(cpmfs.c) +AC_CONFIG_HEADER(config.h) +AC_CANONICAL_HOST +VERSION=2.1 +UPDATED='April 21, 2002' + +DEVICE="posix" + +if test "$prefix" = NONE +then + case $host in + *-linux-*) + PIPE="-pipe " + ;; + esac + case $host in + *-netbsd*) + PIPE="-pipe " + ;; + esac +fi + +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_CPP + +if test "$GCC" = yes +then + CFLAGS="${CFLAGS} ${PIPE}-Wmissing-prototypes -Wstrict-prototypes -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-declarations -Wnested-externs -pedantic -fno-common" + LDFLAGS='-g' +fi + +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], + [DMALLOC="$withval"], [DMALLOC=""]) + +AC_CYGWIN +AC_MINGW32 +dnl Choose between posix and win32 drivers... +DEVICE="posix" + +if test "$CYGWIN" = "yes" +then + DEVICE="win32" +fi +if test "$MINGW32" = "yes" +then + DEVICE="win32" +fi + + +dnl Check for curses. If not found, don't build fsed.cpm +dnl Try both curses and ncurses +AC_CHECK_LIB(curses, printw, FSED_CPM=fsed.cpm LIBS="-lcurses $LIBS", FSED_CPM=) +if test x"$FSED_CPM" = x""; then + AC_CHECK_LIB(ncurses, printw, FSED_CPM=fsed.cpm LIBS="-lncurses $LIBS", FSED_CPM=) +fi + +dnl If using libdsk, check it's available. +if test "$LIBDSK" != ""; then + DEVICE="libdsk" + CPPFLAGS="$CPPFLAGS -I$LIBDSK/include" + CFLAGS="$CFLAGS -I$LIBDSK/include" + LDFLAGS="$LDFLAGS -L$LIBDSK/lib" + AC_CHECK_LIB(dsk, dsk_open) + 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 winioctl.h, ,[echo "Windows headers not found - aborting"; exit 1] ) +fi + +dnl Check for dmalloc +if test x"$DMALLOC" != x""; then + CPPFLAGS = "-I$DMALLOC/include $CPPFLAGS" + CFLAGS = "-I$DMALLOC/include $CFLAGS" + LDFLAGS = "-L$DMALLOC/lib $LDFLAGS" + AC_CHECK_LIB(dmalloc, malloc) + AC_CHECK_HEADERS(dmalloc.h) +fi + + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h sys/types.h sys/stat.h limits.h unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_STRUCT_TM +AC_EXEEXT +AC_OBJEXT + +dnl add EXE extension to fsed.cpm +if test x"$FSED_CPM" != x""; then + FSED_CPM="$FSED_CPM$EXEEXT" +fi + +dnl Checks for library functions. +AC_FUNC_MEMCMP +AC_FUNC_STRFTIME +AC_CHECK_FUNCS(mktime strerror) + +AC_SUBST(LDLIBS) +AC_SUBST(LDDEPS) +AC_SUBST(DEVICE) +eval DATADIR=$datadir +AC_SUBST(DATADIR) +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 ) diff --git a/cpm.5.in b/cpm.5.in new file mode 100644 index 0000000..89371f6 --- /dev/null +++ b/cpm.5.in @@ -0,0 +1,240 @@ +.\" 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 "@UPDATED@" "CP/M tools" "File formats" +.SH NAME \"{{{roff}}}\"{{{ +cpm \- CP/M disk and file system format +.\"}}} +.SH DESCRIPTION \"{{{ +.SS "Characteristic sizes" \"{{{ +Each CP/M disk format is described by the following specific sizes: +.RS +.sp +Sector size in bytes +.br +Number of tracks +.br +Number of sectors +.br +Block size +.br +Number of directory entries +.br +Logical sector skew +.br +Number of reserved system tracks +.sp +.RE +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. +.\"}}} +.SS "Device areas" \"{{{ +A CP/M disk contains three areas: +.RS +.sp +System tracks (optional) +.br +Directory +.br +Data +.sp +.RE +The system tracks store the boot loader and CP/M itself. In order to save +disk space, there are non-bootable formats which omit those system tracks. +The term \fIdisk capacity\fP always excludes the space for system tracks. +Note that there is no bitmap or list for free blocks. When accessing a +drive for the first time, CP/M builds this bitmap in core from the directory. +.\"}}} +.SS "Directory entries" \"{{{ +The directory is a sequence of directory entries (also called extents), +which contain 32 bytes of the following structure: +.RS +.sp +.ta 3n 6n 9n 12n 15n 18n 21n 24n 27n 30n 33n 36n 39n 42n 45n +St F0 F1 F2 F3 F4 F5 F6 F7 E0 E1 E2 Xl Bc Xh Rc +.br +Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al +.sp +.RE +.\"{{{ St = status +\fBSt\fP is the status; possible values are: +.RS +.sp +0\*(en15: used for file, status is the user number +.br +16\*(en31: used for file, status is the user number (P2DOS) +or used for password extent (CP/M 3 or higher) +.br +32: disc label +.br +33: time stamp (P2DOS) +.br +0xE5: unused +.sp +.RE +.\"}}} +.LP +.\"{{{ F0-E2 = file name and extension +\fBF0\*(enE2\fP are the file name and its extension. They may consist of +any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. +The file name must not be empty, the extension may be empty. Both are +padded with blanks. The highest bit of each character of the file name +and extension is used as attribute. The attributes have the following +meaning: +.RS +.sp +F0: requires set wheel byte (Backgrounder II) +.br +F1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) +.br +F2: date stamp (ZSDOS), background-only commands (Backgrounder II) +.br +F7: wheel protect (ZSDOS) +.br +E0: read-only +.br +E1: system file +.br +E2: archived +.sp +.RE +Public files (visible under each user number) are not supported by CP/M +2.2, but there is a patch and some free CP/M clones support them without +any patches. +.LP +The wheel byte is (by default) the memory location at 0x4b. If it is +zero, only non-privileged commands may be executed. +.\"}}} +.LP +.\"{{{ Xl, Xh = extent number +\fBXl\fP and \fBXh\fP store the extent number. A file may use more than +one directory entry, if it contains more blocks than an extent can hold. +In this case, more extents are allocated and each of them is numbered +sequentially with an extent number. If a physical extent stores more than +16k, it is considered to contain multiple logical extents, each pointing +to 16k data, and the extent number of the last used logical extent +is stored. Note: Some formats decided to always store only one logical +extent in a physical extent, thus wasting extent space. CP/M 2.2 allows +512 extents per file, CP/M 3 and higher allow up to 2048. Bit 5\*(en7 of +Xl are 0, bit 0\*(en4 store the lower bits of the extent number. Bit 6 +and 7 of Xh are 0, bit 0\*(en5 store the higher bits of the extent number. +.\"}}} +.LP +.\"{{{ Rc, Bc = record count, byte count +\fBRc\fP and \fBBc\fP determine the length of the data used by this extent. The +physical extent is divided into logical extents, each of them being 16k +in size (a physical extent must hold at least one logical extent, e.g. a +blocksize of 1024 byte with two-byte block pointers is not allowed). +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. +.\"}}} +.LP +.\"{{{ Al = allocated blocks +\fBAl\fP stores block pointers. If the disk capacity is less than 256 blocks, +Al is interpreted as 16 byte-values, otherwise as 8 double-byte-values. +A block pointer of 0 marks a hole in the file. If a hole +covers the range of a full extent, the extent will not be allocated. In particular, +the first extent of a file does not neccessarily have extent number 0. +A file may not share blocks with other files, as its blocks would be freed +if the other files is erased without a following disk system reset. CP/M returns +EOF when it reaches a hole, whereas UNIX returns zero-value bytes, which makes +holes invisible. +.\"}}} +.\"}}} +.SS "Time stamps" \"{{{ +P2DOS and CP/M Plus support time stamps, which are stored in each fourth +directory entry. This entry contains the time stamps for +the extents using the previous three directory entries. Note that you +really have time stamps for each extent, no matter if it is the first +extent of a file or not. The structure of time stamp entries is: +.RS +.sp +1 byte status 0x21 +.br +8 bytes time stamp for third-last directory entry +.br +2 bytes unused +.br +8 bytes time stamp for second-last directory entry +.br +2 bytes unused +.br +8 bytes time stamp for last directory entry +.sp +.RE +A time stamp consists of two dates: Creation and modification date (the +latter being recorded when the file is closed). CP/M Plus further +allows optionally to record the access instead of creation date as first +time stamp. +.RS +.sp +2 bytes (little-endian) days starting with 1 at 01-01-1978 +.br +1 byte hour in BCD format +.br +1 byte minute in BCD format +.sp +.RE +.\"}}} +.SS "Disc labels" \"{{{ +CP/M Plus support disc labels, which are stored in an arbitrary directory +entry. +The structure of disc labels is: +.RS +.sp +1 byte status 0x20 +.br +\fBF0\*(enE2\fP are the disc label +.br +1 byte mode: bit 7 activates password protection, bit 6 causes time stamps on +access, but 5 causes time stamps on modifications, bit 4 causes time stamps on +creation and bit 0 is set when a label exists. Bit 4 and 6 are exclusively set. +.br +1 byte password decode byte: To decode the password, xor this byte with the password +bytes in reverse order. To encode a password, add its characters to get the +decode byte. +.br +2 reserved bytes +.br +8 password bytes +.br +4 bytes label creation time stamp +.br +4 bytes label modification time stamp +.sp +.RE +.\"}}} +.SS "Passwords" \"{{{ +CP/M Plus supports passwords, which are stored in an arbitrary directory +entry. +The structure of these entries is: +.RS +.sp +1 byte status (user number plus 16) +.br +\fBF0\*(enE2\fP are the file name and its extension. +.br +1 byte password mode: bit 7 means password required for reading, bit 6 for writing +and bit 5 for deleting. +.br +1 byte password decode byte: To decode the password, xor this byte with the password +bytes in reverse order. To encode a password, add its characters to get the +decode byte. +.br +2 reserved bytes +.br +8 password bytes +.sp +.RE +.\"}}} +.\"}}} +.SH "SEE ALSO" \"{{{ +.IR mkfs.cpm (1), +.IR fsck.cpm (1), +.IR fsed.cpm (1), +.IR cpmls (1) +.\"}}} diff --git a/cpmchattr.1.in b/cpmchattr.1.in new file mode 100644 index 0000000..8455d06 --- /dev/null +++ b/cpmchattr.1.in @@ -0,0 +1,81 @@ +.TH CPMCHATTR 1 "@UPDATED@" "CP/M tools" "User commands" +.SH NAME \"{{{roff}}}\"{{{ +cpmchattr \- change file attributes on CP/M files +.\"}}} +.SH SYNOPSIS \"{{{ +.ad l +.B cpmchattr +.RB [ \-f +.IR format ] +.I image +.I attrib +.I file-pattern +\&... +.ad b +.\"}}} +.SH DESCRIPTION \"{{{ +\fBCpmchattr\fP changes the file attributes for files on CP/M disks. +.\"}}} +.SH OPTIONS \"{{{ +.IP "\fB\-f\fP \fIformat\fP" +Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fIattrib\fP" +Set the file attributes as given. +.\"}}} +.SH "FILE ATTRIBUTES" \"{{{ +The file attribute string can contain the characters +1,2,3,4,s,a,N and M. +The meanings of these are: +.TP +.B 1-4 +The CP/M "user attributes" F1-F4. CP/M does not assign any +meaning to these attributes, though MP/M does. +.TP +.B s +The file is a system file. This attribute can also be set by +.I cpmchmod(1). +.TP +.B a +The file has been backed up. +.TP +.B N +Reset all attributes to zero. So the string "N1r" resets all attributes and +then sets F1 and Read-Only. +.TP +.B M +Attributes after an M are unset rather than set. The string "12M34" sets +atttributes F1 and F2, and unsets F3 and F4. +.\"}}} +.SH "RETURN VALUE" \"{{{ +Upon successful completion, exit code 0 is returned. +.\"}}} +.SH ERRORS \"{{{ +Any errors are indicated by exit code 1. +.\"}}} +.SH FILES \"{{{ +@DATADIR@/diskdefs CP/M disk format definitions +.\"}}} +.SH AUTHORS \"{{{ +This program is copyright 1997, 1998, 1999, 2000, 2001 Michael Haardt + and copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" \"{{{ +.IR cpmls (1), +.IR cpmchmod (1), +.IR cpm (5) +.\"}}} diff --git a/cpmchattr.c b/cpmchattr.c new file mode 100644 index 0000000..9fbf074 --- /dev/null +++ b/cpmchattr.c @@ -0,0 +1,106 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include +#include +#include +#include +#include "config.h" + +#include "getopt.h" +#include "cpmfs.h" +/*}}}*/ + +const char cmd[]="cpmchattr"; + +int main(int argc, char *argv[]) /*{{{*/ +{ + /* variables */ /*{{{*/ + const char *err; + const char *image; + const char *format=FORMAT; + const char *devopts=NULL; + int c,i,usage=0,exitcode=0; + struct cpmSuperBlock drive; + struct cpmInode root; + int gargc; + char **gargv; + const char *attrs; + /*}}}*/ + + /* parse options */ /*{{{*/ + while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c) + { + case 'T': devopts=optarg; break; + case 'f': format=optarg; break; + case 'h': + case '?': usage=1; break; + } + + if (optind>=(argc-2)) usage=1; + else + { + image=argv[optind]; + attrs = argv[optind+1]; + } + + if (usage) + { + fprintf(stderr,"Usage: %s [-f format] [-T dsktype] image [NMrsa1234] pattern ...\n",cmd); + exit(1); + } + /*}}}*/ + /* open image */ /*{{{*/ + if ((err=Device_open(&drive.dev, image, O_RDWR, devopts))) + { + fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + exit(1); + } + cpmReadSuper(&drive,&root,format); + /*}}}*/ + cpmglob(optind,argc,argv,&root,&gargc,&gargv); + for (i=0; i and copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" \"{{{ +.IR cpmls (1), +.IR chmod (1), +.IR cpm (5) +.\"}}} diff --git a/cpmchmod.c b/cpmchmod.c new file mode 100644 index 0000000..2e64574 --- /dev/null +++ b/cpmchmod.c @@ -0,0 +1,78 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include +#include +#include +#include +#include +#include "config.h" + +#include "getopt.h" +#include "cpmfs.h" +/*}}}*/ + +const char cmd[]="cpmchmod"; + +int main(int argc, char *argv[]) /*{{{*/ +{ + /* variables */ /*{{{*/ + const char *err; + const char *image; + const char *format=FORMAT; + const char *devopts=NULL; + int c,i,usage=0,exitcode=0; + struct cpmSuperBlock drive; + struct cpmInode root; + int gargc; + char **gargv; + unsigned int mode; + /*}}}*/ + + /* parse options */ /*{{{*/ + while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c) + { + case 'T': devopts=optarg; break; + case 'f': format=optarg; break; + case 'h': + case '?': usage=1; break; + } + + if (optind>=(argc-2)) usage=1; + else + { + image=argv[optind]; + if (!sscanf(argv[optind+1], "%o", &mode)) usage=1; + } + + if (usage) + { + fprintf(stderr,"Usage: %s [-f format] image mode pattern ...\n",cmd); + exit(1); + } + /*}}}*/ + /* open image */ /*{{{*/ + if ((err=Device_open(&drive.dev, image, O_RDWR, devopts))) + { + fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + exit(1); + } + cpmReadSuper(&drive,&root,format); + /*}}}*/ + cpmglob(optind,argc,argv,&root,&gargc,&gargv); + for (i=0; i. The Windows port is copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" \"{{{ +.IR cpmls (1), +.IR cpm (5) +.\"}}} diff --git a/cpmcp.c b/cpmcp.c new file mode 100644 index 0000000..61dc65b --- /dev/null +++ b/cpmcp.c @@ -0,0 +1,307 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#undef _POSIX_SOURCE +#define _POSIX_SOURCE 1 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 2 + +#ifdef DMALLOC +#include "dmalloc.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include "config.h" + +#include "getopt.h" +#include "cpmfs.h" +/*}}}*/ + +const char cmd[]="cpmcp"; +static int text=0; + +/** + * Return the user number. + * @param s CP/M filename in 0[0]:aaaaaaaa.bbb format. + * @returns The user number or -1 for no match. + */ +static int userNumber(const char *s) /*{{{*/ +{ + if (isdigit(*s) && *(s+1)==':') return (*s-'0'); + if (isdigit(*s) && isdigit(*(s+1)) && *(s+2)==':') return (10*(*s-'0')+(*(s+1))); + return -1; +} +/*}}}*/ + +/** + * Copy one file from CP/M to UNIX. + * @param root The inode for the root directory. + * @param src The CP/M filename in 00aaaaaaaabbb format. + * @param dest The UNIX filename. + * @returns 0 for success, 1 for error. + */ +static int cpmToUnix(const struct cpmInode *root, const char *src, const char *dest) /*{{{*/ +{ + struct cpmInode ino; + int exitcode=0; + + if (cpmNamei(root,src,&ino)==-1) { fprintf(stderr,"%s: can not open %s: %s\n",cmd,src,boo); exitcode=1; } + else + { + struct cpmFile file; + FILE *ufp; + + cpmOpen(&ino,&file,O_RDONLY); + if ((ufp=fopen(dest,text ? "w" : "wb"))==(FILE*)0) { fprintf(stderr,"%s: can not create %s: %s\n",cmd,dest,strerror(errno)); exitcode=1; } + else + { + int crpending=0; + int ohno=0; + int res; + char buf[4096]; + + while ((res=cpmRead(&file,buf,sizeof(buf)))!=0) + { + int j; + + for (j=0; j=argc) usage(); + image=argv[optind]; + + if (userNumber(argv[optind+1])>=0) /* cpm -> unix? */ /*{{{*/ + { + int i; + struct stat statbuf; + + for (i=optind+1; i<(argc-1); ++i) if (userNumber(argv[i])==-1) usage(); + todir=((argc-optind-1)>2); + if (stat(argv[argc-1],&statbuf)==-1) { if (todir) usage(); } + else if (S_ISDIR(statbuf.st_mode)) todir=1; else if (todir) usage(); + readcpm=1; + } + /*}}}*/ + else if (userNumber(argv[argc-1])>=0) /* unix -> cpm */ /*{{{*/ + { + int i; + + todir=0; + for (i=optind+1; i<(argc-1); ++i) if (userNumber(argv[i])>=0) usage(); + if ((argc-optind-1)>2 && *(strchr(argv[argc-1],':')+1)!='\0') usage(); + if (*(strchr(argv[argc-1],':')+1)=='\0') todir=1; + readcpm=0; + } + /*}}}*/ + else usage(); + /*}}}*/ + /* open image file */ /*{{{*/ + if ((err=Device_open(&super.dev,image,readcpm ? O_RDONLY : O_RDWR, devopts))) + { + fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + exit(1); + } + cpmReadSuper(&super,&root,format); + /*}}}*/ + if (readcpm) /* copy from CP/M to UNIX */ /*{{{*/ + { + int i,count,total=0; + char src[2+8+1+3+1]; + struct cpmFile dir; + struct cpmDirent dirent; + + /* expand pattern and check if we try to copy multiple files to a file */ /*{{{*/ + for (i=optind+1,total=0; i<(argc-1); ++i) + { + cpmOpendir(&root,&dir); + count=0; + while (cpmReaddir(&dir,&dirent)) if (match(dirent.name,argv[i])) ++count; + if (count==0) ++total; else total+=count; + cpmClose(&dir); + } + if (total>1 && !todir) usage(); + /*}}}*/ + + for (i=optind+1; i<(argc-1); ++i) + { + char dest[_POSIX_PATH_MAX]; + + count=0; + cpmOpendir(&root,&dir); + while (cpmReaddir(&dir,&dirent)) + { + if (match(dirent.name,argv[i])) + { + if (todir) + { + strcpy(dest,argv[argc-1]); + strcat(dest,"/"); + strcat(dest,dirent.name+2); + } + else strcpy(dest,argv[argc-1]); + if (cpmToUnix(&root,dirent.name,dest)) exitcode=1; + ++count; + } + } + cpmClose(&dir); + if (count==0) /* try the pattern itself and find it does not work :) */ /*{{{*/ + { + if (todir) + { + strcpy(dest,argv[argc-1]); + strcat(dest,"/"); + strcat(dest,src+2); + } + else strcpy(dest,argv[argc-1]); + if (cpmToUnix(&root,src,dest)) exitcode=1; + } + /*}}}*/ + } + } + /*}}}*/ + else /* copy from UNIX to CP/M */ /*{{{*/ + { + int i; + + for (i=optind+1; i<(argc-1); ++i) + { + /* variables */ /*{{{*/ + char *dest=(char*)0; + FILE *ufp; + /*}}}*/ + + if ((ufp=fopen(argv[i],"r"))==(FILE*)0) /* cry a little */ /*{{{*/ + { + fprintf(stderr,"%s: can not open %s: %s\n",cmd,argv[i],strerror(errno)); + exitcode=1; + } + /*}}}*/ + else + { + struct cpmInode ino; + char cpmname[2+8+3+1]; /* 00foobarxy.zzy\0 */ + + if (todir) + { + if ((dest=strrchr(argv[i],'/'))!=(char*)0) ++dest; else dest=argv[i]; + sprintf(cpmname,"%02d%s",userNumber(argv[argc-1]),dest); + } + else + { + sprintf(cpmname,"%02d%s",userNumber(argv[argc-1]),strchr(argv[argc-1],':')+1); + } + if (cpmCreat(&root,cpmname,&ino,0666)==-1) /* just cry */ /*{{{*/ + { + fprintf(stderr,"%s: can not create %s: %s\n",cmd,cpmname,boo); + exitcode=1; + } + /*}}}*/ + else + { + struct cpmFile file; + int ohno=0; + char buf[4096+1]; + + cpmOpen(&ino,&file,O_WRONLY); + do + { + int j; + + for (j=0; j<(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)!=j) + { + fprintf(stderr,"%s: can not write %s: %s\n",cmd,dest,boo); + ohno=1; + exitcode=1; + break; + } + } while (c!=EOF); + if (cpmClose(&file)==EOF && !ohno) /* I just can't hold back the tears */ /*{{{*/ + { + fprintf(stderr,"%s: can not close %s: %s\n",cmd,dest,boo); + exitcode=1; + } + /*}}}*/ + } + fclose(ufp); + } + } + } + /*}}}*/ + cpmUmount(&super); + exit(exitcode); +} diff --git a/cpmdir.h b/cpmdir.h new file mode 100644 index 0000000..685e3db --- /dev/null +++ b/cpmdir.h @@ -0,0 +1,21 @@ +#ifndef CPMDIR_H +#define CPMDIR_H + +struct PhysDirectoryEntry +{ + char status; + char name[8]; + char ext[3]; + char extnol; + char lrc; + char extnoh; + char blkcnt; + char pointers[16]; +}; + +#define ISFILECHAR(notFirst,c) (((notFirst) || (c)!=' ') && (c)>=' ' && !((c)&~0x7f) && (c)!='<' && (c)!='>' && (c)!='.' && (c)!=',' && (c)!=';' && (c)!=':' && (c)!='=' && (c)!='?' && (c)!='*' && (c)!= '[' && (c)!=']') +#define EXTENT(low,high) (((low)&0x1f)|(((high)&0x3f)<<5)) +#define EXTENTL(extent) ((extent)&0x1f) +#define EXTENTH(extent) (((extent>>5))&0x3f) + +#endif diff --git a/cpmfs.c b/cpmfs.c new file mode 100644 index 0000000..cabe8ee --- /dev/null +++ b/cpmfs.c @@ -0,0 +1,1488 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#undef _POSIX_SOURCE +#define _POSIX_SOURCE 1 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 2 + +#ifdef DMALLOC +#include "dmalloc.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include "config.h" +#include "cpmdir.h" +#include "cpmfs.h" +/*}}}*/ +/* #defines */ /*{{{*/ +#undef CPMFS_DEBUG + +/* Number of _used_ bits per int */ + +#define INTBITS ((int)(sizeof(int)*8)) + +/* There are four reserved entries: ., .., [passwd] and [label] */ + +#define RESERVED_ENTRIES 4 + +/* CP/M does not support any kind of inodes, so they are simulated. +Inode 0-(maxdir-1) are used by files which lowest extent is stored in +the respective directory entry. Inode maxdir is the root directory +and inode maxdir+1 is the passwd file, if any. */ + +#define RESERVED_INODES 3 + +#define PASSWD_RECLEN 24 +/*}}}*/ + +extern char **environ; +const char *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) +{ + while (count--) + { + *dest = ((*dest) & 0x80) | ((*src) & 0x7F); + ++dest; + ++src; + } +} +/*}}}*/ + +/* 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) +{ + int i,j; + + assert(fullname!=(const char*)0); + assert(name!=(char*)0); + assert(ext!=(char*)0); + assert(user!=(int*)0); + memset(name,' ',8); + memset(ext,' ',3); + if (!isdigit(fullname[0]) || !isdigit(fullname[1])) + { + boo="illegal CP/M filename"; + return -1; + } + *user=10*(fullname[0]-'0')+(fullname[1]-'0'); + fullname+=2; + if ((fullname[0]=='\0') || (type==CPMFS_DR22 && *user>=16) || (type==CPMFS_P2DOS && *user>=32)) + { + boo="illegal CP/M filename"; + return -1; + } + for (i=0; i<8 && fullname[i] && fullname[i]!='.'; ++i) if (!ISFILECHAR(i,fullname[i])) + { + boo="illegal CP/M filename"; + return -1; + } + else name[i]=toupper(fullname[i]); + if (fullname[i]=='.') + { + ++i; + for (j=0; j<3 && fullname[i]; ++i,++j) if (!ISFILECHAR(1,fullname[i])) + { + boo="illegal CP/M filename"; + return -1; + } + else ext[j]=toupper(fullname[i]); + if (i==1 && j==0) + { + boo="illegal CP/M filename"; + return -1; + } + } + return 0; +} +/*}}}*/ +/* 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) +{ + int i; + + assert(name1!=(const char*)0); + assert(ext1!=(const char*)0); + assert(name2!=(const char*)0); + assert(ext2!=(const char*)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; + return 1; +} +/*}}}*/ + +/* allocation vector bitmap functions */ +/* alvInit -- init allocation vector */ /*{{{*/ +static void alvInit(const struct cpmSuperBlock *d) +{ + int i,j,offset,block; + + assert(d!=(const struct cpmSuperBlock*)0); + /* clean bitmap */ /*{{{*/ + 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; + /*}}}*/ + for (i=0; imaxdir; ++i) /* mark file blocks as used */ /*{{{*/ + { + if (d->dir[i].status>=0 && d->dir[i].status<=(d->type==CPMFS_P2DOS ? 31 : 15)) + { +#ifdef CPMFS_DEBUG + fprintf(stderr,"alvInit: allocate extent %d\n",i); +#endif + 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 (block) + { +#ifdef CPMFS_DEBUG + fprintf(stderr,"alvInit: allocate block %d\n",block); +#endif + offset=block/INTBITS; + d->alv[offset]|=(1<alvSize; ++i) + { + for (j=0,bits=drive->alv[i]; j=drive->size) + { + boo="device full"; + return -1; + } + drive->alv[i] |= (1<>= 1; + } + } + boo="device full"; + return -1; +} +/*}}}*/ + +/* logical block I/O */ +/* readBlock -- read a (partial) block */ /*{{{*/ +static int readBlock(const struct cpmSuperBlock *d, int blockno, char *buffer, int start, int end) +{ + int sect, track, counter; + + assert(blockno>=0); + assert(blocknosize); + assert(buffer!=(char*)0); + 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; + for (counter=0; counter<=end; ++counter) + { + const char *err; + + if (counter>=start && (err=Device_readSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter)))) + { + boo=err; + return -1; + } + ++sect; + if (sect>=d->sectrk) + { + sect = 0; + ++track; + } + } + return 0; +} +/*}}}*/ +/* writeBlock -- write a (partial) block */ /*{{{*/ +static int writeBlock(const struct cpmSuperBlock *d, int blockno, const char *buffer, int start, int end) +{ + int sect, track, counter; + + assert(blockno>=0); + assert(blocknosize); + assert(buffer!=(const char*)0); + 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; + for (counter = 0; counter<=end; ++counter) + { + const char *err; + + if (counter>=start && (err=Device_writeSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter)))) + { + boo=err; + return -1; + } + ++sect; + if (sect>=d->sectrk) + { + sect=0; + ++track; + } + } + return 0; +} +/*}}}*/ + +/* directory management */ +/* readPhysDirectory -- read directory from drive */ /*{{{*/ +static int readPhysDirectory(const struct cpmSuperBlock *drive) +{ + int i,blocks,entry; + + blocks=(drive->maxdir*32+drive->blksiz-1)/drive->blksiz; + entry=0; + for (i=0; idir+entry),0,-1)==-1) return -1; + entry+=(drive->blksiz/32); + } + return 0; +} +/*}}}*/ +/* writePhysDirectory -- write directory to drive */ /*{{{*/ +static int writePhysDirectory(const struct cpmSuperBlock *drive) +{ + int i,blocks,entry; + + blocks=(drive->maxdir*32+drive->blksiz-1)/drive->blksiz; + entry=0; + for (i=0; idir+entry),0,-1)==-1) return -1; + entry+=(drive->blksiz/32); + } + return 0; +} +/*}}}*/ +/* 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) +{ + boo="file already exists"; + for (; startmaxdir; ++start) + { + if + ( + ((unsigned char)sb->dir[start].status)<=(sb->type==CPMFS_P2DOS ? 31 : 15) + && (extno==-1 || (EXTENT(sb->dir[start].extnol,sb->dir[start].extnoh)/sb->extents)==(extno/sb->extents)) + && isMatching(user,name,ext,sb->dir[start].status,sb->dir[start].name,sb->dir[start].ext) + ) return start; + } + boo="file not found"; + return -1; +} +/*}}}*/ +/* findFreeExtent -- find first free extent */ /*{{{*/ +static int findFreeExtent(const struct cpmSuperBlock *drive) +{ + int i; + + for (i=0; imaxdir; ++i) if (drive->dir[i].status==(char)0xe5) return (i); + boo="directory full"; + return -1; +} +/*}}}*/ +/* updateTimeStamps -- convert time stamps to CP/M format */ /*{{{*/ +static void updateTimeStamps(const struct cpmInode *ino, int extent) +{ + struct PhysDirectoryEntry *date; + struct tm *t; + int i; + int ca_min,ca_hour,ca_days,u_min,u_hour,u_days; + + if (!S_ISREG(ino->mode)) return; +#ifdef CPMFS_DEBUG + fprintf(stderr,"CPMFS: updating time stamps for inode %d (%d)\n",extent,extent&3); +#endif + /* compute ctime/atime */ /*{{{*/ + t=localtime(ino->sb->cnotatime ? &ino->ctime : &ino->atime); + ca_min=((t->tm_min/10)<<4)|(t->tm_min%10); + ca_hour=((t->tm_hour/10)<<4)|(t->tm_hour%10); + for (i=1978,ca_days=0; i < 1900 + t->tm_year; ++i) + { + ca_days+=365; + if (i%4==0 && (i%100!=0 || i%400==0)) ++ca_days; + } + ca_days += t->tm_yday + 1; + /*}}}*/ + /* compute mtime */ /*{{{*/ + t=localtime(&ino->mtime); + u_min=((t->tm_min/10)<<4)|(t->tm_min%10); + u_hour=((t->tm_hour/10)<<4)|(t->tm_hour%10); + for (i=1978,u_days=0; i < 1900 + t->tm_year; ++i) + { + u_days+=365; + if (i%4==0 && (i%100!=0 || i%400==0)) ++u_days; + } + u_days += t->tm_yday + 1; + /*}}}*/ + if ((ino->sb->type==CPMFS_P2DOS || ino->sb->type==CPMFS_DR3) && (date=ino->sb->dir+(extent|3))->status==0x21) + { + switch (extent&3) + { + case 0: /* first entry */ /*{{{*/ + { + date->name[0]=ca_days&0xff; date->name[1]=ca_days>>8; + date->name[2]=ca_hour; + date->name[3]=ca_min; + date->name[4]=u_days&0xff; date->name[5]=u_days>>8; + date->name[6]=u_hour; + date->name[7]=u_min; + break; + } + /*}}}*/ + case 1: /* second entry */ /*{{{*/ + { + date->ext[2]=ca_days&0xff; date->extnol=ca_days>>8; + date->lrc=ca_hour; + date->extnoh=ca_min; + date->blkcnt=u_days&0xff; date->pointers[0]=u_days>>8; + date->pointers[1]=u_hour; + date->pointers[2]=u_min; + break; + } + /*}}}*/ + case 2: /* third entry */ /*{{{*/ + { + date->pointers[5]=ca_days&0xff; date->pointers[6]=ca_days>>8; + date->pointers[7]=ca_hour; + date->pointers[8]=ca_min; + date->pointers[9]=u_days&0xff; date->pointers[10]=u_days>>8; + date->pointers[11]=u_hour; + date->pointers[12]=u_min; + break; + } + /*}}}*/ + } + } +} +/*}}}*/ + +/* diskdefReadSuper -- read super block from diskdefs file */ /*{{{*/ +static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) +{ + char line[256]; + FILE *fp; + int insideDef=0,found=0; + + if ((fp=fopen(DISKDEFS,"r"))==(FILE*)0 && (fp=fopen("diskdefs","r"))==(FILE*)0) + { + fprintf(stderr,"%s: Neither " DISKDEFS " nor diskdefs could be opened.\n",cmd); + exit(1); + } + while (fgets(line,sizeof(line),fp)!=(char*)0) + { + int argc; + char *argv[2]; + + for (argc=0; argc<1 && (argv[argc]=strtok(argc ? (char*)0 : line," \t\n")); ++argc); + if ((argv[argc]=strtok((char*)0,"\n"))!=(char*)0) ++argc; + if (insideDef) + { + 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; + if (d->extents==0) d->extents=1; + if (found) break; + } + else if (argc==2) + { + 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],"maxdir")==0) d->maxdir=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],"boottrk")==0) d->boottrk=strtol(argv[1],(char**)0,0); + else if (strcmp(argv[0],"logicalextents")==0) d->extents=strtol(argv[1],(char**)0,0); + else if (strcmp(argv[0],"os")==0) + { + if (strcmp(argv[1],"2.2")==0) d->type=CPMFS_DR22; + else if (strcmp(argv[1],"3")==0) d->type=CPMFS_DR3; + else if (strcmp(argv[1],"p2dos")==0) d->type=CPMFS_P2DOS; + } + } + } + else if (argc==2 && strcmp(argv[0],"diskdef")==0) + { + insideDef=1; + d->skew=1; + d->extents=0; + d->type=CPMFS_DR3; + if (strcmp(argv[1],format)==0) found=1; + } + } + fclose(fp); + if (!found) + { + fprintf(stderr,"%s: unknown format %s\n",cmd,format); + exit(1); + } + return 0; +} +/*}}}*/ +/* amsReadSuper -- read super block from amstrad disk */ /*{{{*/ +static int amsReadSuper(struct cpmSuperBlock *d, const char *format) +{ + unsigned char boot_sector[512], *boot_spec; + const char *err; + + Device_setGeometry(&d->dev,512,9,40); + if ((err=Device_readSector(&d->dev, 0, 0, (char *)boot_sector))) + { + fprintf(stderr,"%s: Failed to read Amstrad superblock (%s)\n",cmd,err); + exit(1); + } + boot_spec=(boot_sector[0] == 0 || boot_sector[0] == 3)?boot_sector:(unsigned char*)0; + /* Check for JCE's extension to allow Amstrad and MSDOS superblocks + * in the same sector (for the PCW16) + */ + if + ( + (boot_sector[0] == 0xE9 || boot_sector[0] == 0xEB) + && !memcmp(boot_sector + 0x2B, "CP/M", 4) + && !memcmp(boot_sector + 0x33, "DSK", 3) + && !memcmp(boot_sector + 0x7C, "CP/M", 4) + ) boot_spec = boot_sector + 128; + if (boot_spec==(unsigned char*)0) + { + fprintf(stderr,"%s: Amstrad superblock not present\n",cmd); + exit(1); + } + /* boot_spec[0] = format number: 0 for SS SD, 3 for DS DD + [1] = single/double sided and density flags + [2] = cylinders per side + [3] = sectors per cylinder + [4] = Physical sector shift, 2 => 512 + [5] = Reserved track count + [6] = Block shift + [7] = No. of directory blocks + */ + d->type = CPMFS_DR3; /* Amstrads are CP/M 3 systems */ + d->secLength = 128 << boot_spec[4]; + d->tracks = boot_spec[2]; + if (boot_spec[1] & 3) d->tracks *= 2; + d->sectrk = boot_spec[3]; + d->blksiz = 128 << boot_spec[6]; + d->maxdir = (d->blksiz / 32) * boot_spec[7]; + d->skew = 1; /* Amstrads skew at the controller level */ + d->boottrk = boot_spec[5]; + d->size = (d->secLength*d->sectrk*(d->tracks-d->boottrk))/d->blksiz; + d->extents = ((d->size>=256 ? 8 : 16)*d->blksiz)/16384; + + return 0; +} +/*}}}*/ + +/* match -- match filename against a pattern */ /*{{{*/ +static int recmatch(const char *a, const char *pattern) +{ + int first=1; + + while (*pattern) + { + switch (*pattern) + { + case '*': + { + if (*a=='.' && first) return 1; + ++pattern; + while (*a) if (recmatch(a,pattern)) return 1; else ++a; + break; + } + case '?': + { + if (*a) { ++a; ++pattern; } else return 0; + break; + } + default: if (*a==*pattern) { ++a; ++pattern; } else return 0; + } + first=0; + } + return (*pattern=='\0' && *a=='\0'); +} + +int match(const char *a, const char *pattern) +{ + int user; + char pat[255]; + + assert(strlen(pattern)<255); + if (isdigit(*pattern) && *(pattern+1)==':') { user=(*pattern-'0'); pattern+=2; } + else if (isdigit(*pattern) && isdigit(*(pattern+1)) && *(pattern+2)==':') { user=(10*(*pattern-'0')+(*(pattern+1)-'0')); pattern+=3; } + else user=-1; + if (user==-1) sprintf(pat,"??%s",pattern); + else sprintf(pat,"%02d%s",user,pattern); + return recmatch(a,pat); +} + +/*}}}*/ +/* cpmglob -- expand CP/M style wildcards */ /*{{{*/ +void cpmglob(int optin, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv) +{ + struct cpmFile dir; + int entries,dirsize=0; + struct cpmDirent *dirent=(struct cpmDirent*)0; + int gargcap=0,i,j; + + *gargv=(char**)0; + *gargc=0; + cpmOpendir(root,&dir); + entries=0; + dirent=realloc(dirent,sizeof(struct cpmDirent)*(dirsize=32)); + while (cpmReaddir(&dir,dirent+entries)) + { + ++entries; + if (entries==dirsize) dirent=realloc(dirent,sizeof(struct cpmDirent)*(dirsize*=2)); + } + for (i=optin; idev,d->secLength,d->sectrk,d->tracks); + /* generate skew table */ /*{{{*/ + if (( d->skewtab = malloc(d->sectrk*sizeof(int))) == (int*)0) + { + fprintf(stderr,"%s: can not allocate memory for skew sector table\n",cmd); + exit(1); + } + if (strcmp(format,"apple-do")==0) + { + static int skew[]={0,6,12,3,9,15,14,5,11,2,8,7,13,4,10,1}; + memcpy(d->skewtab,skew,d->sectrk*sizeof(int)); + } + else if (strcmp(format,"apple-po")==0) + { + static int skew[]={0,9,3,12,6,15,1,10,4,13,7,8,2,11,5,14}; + memcpy(d->skewtab,skew,d->sectrk*sizeof(int)); + } + else + { + int i,j,k; + + for (i=j=0; isectrk; ++i,j=(j+d->skew)%d->sectrk) + { + while (1) + { + for (k=0; kskewtab[k]!=j; ++k); + if (ksectrk; + else break; + } + d->skewtab[i]=j; + } + } + /*}}}*/ + /* initialise allocation vector bitmap */ /*{{{*/ + { + d->alvSize=((d->secLength*d->sectrk*(d->tracks-d->boottrk))/d->blksiz+INTBITS-1)/INTBITS; + if ((d->alv=malloc(d->alvSize*sizeof(int)))==(int*)0) + { + boo="out of memory"; + return -1; + } + } + /*}}}*/ + /* allocate directory buffer */ /*{{{*/ + if ((d->dir=malloc(d->maxdir*32))==(struct PhysDirectoryEntry*)0) + { + boo="out of memory"; + return -1; + } + /*}}}*/ + if (d->dev.opened==0) memset(d->dir,0xe5,d->maxdir*32); + else if (readPhysDirectory(d)==-1) return -1; + alvInit(d); + if (d->type==CPMFS_DR3) /* read additional superblock information */ /*{{{*/ + { + int i; + + /* passwords */ /*{{{*/ + { + int passwords=0; + + for (i=0; imaxdir; ++i) if (d->dir[i].status>=16 && d->dir[i].status<=31) ++passwords; +#ifdef CPMFS_DEBUG + fprintf(stderr,"getformat: found %d passwords\n",passwords); +#endif + if ((d->passwdLength=passwords*PASSWD_RECLEN)) + { + if ((d->passwd=malloc(d->passwdLength))==(char*)0) + { + boo="out of memory"; + return -1; + } + for (i=0,passwords=0; imaxdir; ++i) if (d->dir[i].status>=16 && d->dir[i].status<=31) + { + int j,pb; + char *p=d->passwd+(passwords++*PASSWD_RECLEN); + + p[0]='0'+(d->dir[i].status-16)/10; + p[1]='0'+(d->dir[i].status-16)%10; + for (j=0; j<8; ++j) p[2+j]=d->dir[i].name[j]&0x7f; + p[10]=(d->dir[i].ext[0]&0x7f)==' ' ? ' ' : '.'; + for (j=0; j<3; ++j) p[11+j]=d->dir[i].ext[j]&0x7f; + p[14]=' '; + pb=(unsigned char)d->dir[i].lrc; + for (j=0; j<8; ++j) p[15+j]=((unsigned char)d->dir[i].pointers[7-j])^pb; +#ifdef CPMFS_DEBUG + p[23]='\0'; + fprintf(stderr,"getformat: %s\n",p); +#endif + p[23]='\n'; + } + } + } + /*}}}*/ + /* disc label */ /*{{{*/ + for (i=0; imaxdir; ++i) if (d->dir[i].status==(char)0x20) + { + int j; + + d->cnotatime=d->dir[i].extnol&0x10; + if (d->dir[i].extnol&0x1) + { + d->labelLength=12; + if ((d->label=malloc(d->labelLength))==(char*)0) + { + boo="out of memory"; + return -1; + } + for (j=0; j<8; ++j) d->label[j]=d->dir[i].name[j]&0x7f; + for (j=0; j<3; ++j) d->label[8+j]=d->dir[i].ext[j]&0x7f; + d->label[11]='\n'; + } + else + { + d->labelLength=0; + } + break; + } + if (i==d->maxdir) + { + d->cnotatime=1; + d->labelLength=0; + } + /*}}}*/ + } + /*}}}*/ + else + { + d->passwdLength=0; + d->cnotatime=1; + d->labelLength=0; + } + d->root=root; + root->ino=d->maxdir; + root->sb=d; + root->mode=(s_ifdir|0777); + root->size=0; + root->atime=root->mtime=root->ctime=0; + return 0; +} +/*}}}*/ +/* cpmNamei -- map name to inode */ /*{{{*/ +int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i) +{ + /* variables */ /*{{{*/ + int user; + char name[8],extension[3]; + struct PhysDirectoryEntry *date; + char **old_environ; + static char gmt0[]="TZ=GMT0"; + static char *gmt_env[]={ gmt0, (char*)0 }; + int highestExtno,highestExt=-1,lowestExtno,lowestExt=-1; + int protectMode=0; + /*}}}*/ + + if (!S_ISDIR(dir->mode)) + { + boo="No such file"; + return -1; + } + if (strcmp(filename,".")==0 || strcmp(filename,"..")==0) /* root directory */ /*{{{*/ + { + *i=*dir; + return 0; + } + /*}}}*/ + else if (strcmp(filename,"[passwd]")==0 && dir->sb->passwdLength) /* access passwords */ /*{{{*/ + { + i->attr=0; + i->ino=dir->sb->maxdir+1; + i->mode=s_ifreg|0444; + i->sb=dir->sb; + i->atime=i->mtime=i->ctime=0; + i->size=i->sb->passwdLength; + return 0; + } + /*}}}*/ + else if (strcmp(filename,"[label]")==0 && dir->sb->labelLength) /* access label */ /*{{{*/ + { + i->attr=0; + i->ino=dir->sb->maxdir+2; + i->mode=s_ifreg|0444; + i->sb=dir->sb; + i->atime=i->mtime=i->ctime=0; + i->size=i->sb->labelLength; + return 0; + } + /*}}}*/ + if (splitFilename(filename,dir->sb->type,name,extension,&user)==-1) return -1; + /* find highest and lowest extent */ /*{{{*/ + { + int extent; + + i->size=0; + extent=-1; + highestExtno=-1; + lowestExtno=2049; + while ((extent=findFileExtent(dir->sb,user,name,extension,extent+1,-1))!=-1) + { + int extno=EXTENT(dir->sb->dir[extent].extnol,dir->sb->dir[extent].extnoh); + + if (extno>highestExtno) + { + highestExtno=extno; + highestExt=extent; + } + if (extnosize=highestExtno*16384; + if (dir->sb->size<256) for (block=15; block>=0; --block) + { + if (dir->sb->dir[highestExt].pointers[block]) break; + } + else for (block=7; block>=0; --block) + { + 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; + 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); +#endif + } + /*}}}*/ + i->ino=lowestExt; + i->mode=s_ifreg; + i->sb=dir->sb; + old_environ=environ; + environ=gmt_env; /* for mktime() */ + if + ( + (dir->sb->type==CPMFS_P2DOS || dir->sb->type==CPMFS_DR3) + && (date=dir->sb->dir+(lowestExt|3))->status==0x21 + ) + /* set time stamps */ /*{{{*/ + { + /* variables */ /*{{{*/ + int u_days=0,u_hour=0,u_min=0; + int ca_days=0,ca_hour=0,ca_min=0; + struct tm tms; + /*}}}*/ + + switch (lowestExt&3) + { + case 0: /* first entry of the four */ /*{{{*/ + { + ca_days=((unsigned char)date->name[0])+(((unsigned char)date->name[1])<<8); + ca_hour=(unsigned char)date->name[2]; + ca_min=(unsigned char)date->name[3]; + u_days=((unsigned char)date->name[4])+(((unsigned char)date->name[5])<<8); + u_hour=(unsigned char)date->name[6]; + u_min=(unsigned char)date->name[7]; + protectMode=(unsigned char)date->name[8]; + break; + } + /*}}}*/ + case 1: /* second entry */ /*{{{*/ + { + ca_days=((unsigned char)date->ext[2])+(((unsigned char)date->extnol)<<8); + ca_hour=(unsigned char)date->lrc; + ca_min=(unsigned char)date->extnoh; + u_days=((unsigned char)date->blkcnt)+(((unsigned char)date->pointers[0])<<8); + u_hour=(unsigned char)date->pointers[1]; + u_min=(unsigned char)date->pointers[2]; + protectMode=(unsigned char)date->pointers[3]; + break; + } + /*}}}*/ + case 2: /* third one */ /*{{{*/ + { + ca_days=((unsigned char)date->pointers[5])+(((unsigned char)date->pointers[6])<<8); + ca_hour=(unsigned char)date->pointers[7]; + ca_min=(unsigned char)date->pointers[8]; + u_days=((unsigned char)date->pointers[9])+(((unsigned char)date->pointers[10])<<8); + u_hour=(unsigned char)date->pointers[11]; + u_min=(unsigned char)date->pointers[12]; + protectMode=(unsigned char)date->pointers[13]; + break; + } + /*}}}*/ + } + /* compute CP/M to UNIX time format */ /*{{{*/ + tms.tm_sec=0; + tms.tm_min=((ca_min>>4)&0xf)*10+(ca_min&0xf); + tms.tm_hour=((ca_hour>>4)&0xf)*10+(ca_hour&0xf); + tms.tm_mday=1; + tms.tm_mon=0; + tms.tm_year=78; + tms.tm_isdst=-1; + if (i->sb->cnotatime) + { + i->ctime=mktime(&tms)+(ca_days-1)*24*3600; + i->atime=0; + } + else + { + i->ctime=0; + i->atime=mktime(&tms)+(ca_days-1)*24*3600; + } + tms.tm_min=((u_min>>4)&0xf)*10+(u_min&0xf); + tms.tm_hour=((u_hour>>4)&0xf)*10+(u_hour&0xf); + i->mtime=mktime(&tms)+(u_days-1)*24*3600; + /*}}}*/ + } + /*}}}*/ + else i->atime=i->mtime=i->ctime=0; + environ=old_environ; + + /* Determine the inode attributes */ + i->attr = 0; + if (dir->sb->dir[lowestExt].name[0]&0x80) i->attr |= CPM_ATTR_F1; + if (dir->sb->dir[lowestExt].name[1]&0x80) i->attr |= CPM_ATTR_F2; + if (dir->sb->dir[lowestExt].name[2]&0x80) i->attr |= CPM_ATTR_F3; + if (dir->sb->dir[lowestExt].name[3]&0x80) i->attr |= CPM_ATTR_F4; + if (dir->sb->dir[lowestExt].ext [0]&0x80) i->attr |= CPM_ATTR_RO; + if (dir->sb->dir[lowestExt].ext [1]&0x80) i->attr |= CPM_ATTR_SYS; + if (dir->sb->dir[lowestExt].ext [2]&0x80) i->attr |= CPM_ATTR_ARCV; + if (protectMode&0x20) i->attr |= CPM_ATTR_PWDEL; + if (protectMode&0x40) i->attr |= CPM_ATTR_PWWRITE; + if (protectMode&0x80) i->attr |= CPM_ATTR_PWREAD; + + if (dir->sb->dir[lowestExt].ext[1]&0x80) i->mode|=01000; + i->mode|=0444; + if (!(dir->sb->dir[lowestExt].ext[0]&0x80)) i->mode|=0222; + if (extension[0]=='C' && extension[1]=='O' && extension[2]=='M') i->mode|=0111; + return 0; +} +/*}}}*/ +/* cpmStatFS -- statfs */ /*{{{*/ +void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf) +{ + int i; + struct cpmSuperBlock *d; + + d=ino->sb; + buf->f_bsize=d->blksiz; + buf->f_blocks=(d->tracks*d->sectrk*d->secLength)/d->blksiz; + buf->f_bfree=0; + buf->f_bused=-(d->maxdir*32+d->blksiz-1)/d->blksiz; + for (i=0; ialvSize; ++i) + { + int temp,j; + + temp = *(d->alv+i); + for (j=0; jsize) + { + if (1&temp) + { +#ifdef CPMFS_DEBUG + fprintf(stderr,"cpmStatFS: block %d allocated\n",(i*INTBITS+j)); +#endif + ++buf->f_bused; + } + else ++buf->f_bfree; + } + temp >>= 1; + } + } + buf->f_bavail=buf->f_bfree; + buf->f_files=d->maxdir; + buf->f_ffree=0; + for (i=0; imaxdir; ++i) + { + if (d->dir[i].status==(char)0xe5) ++buf->f_ffree; + } + buf->f_namelen=11; +} +/*}}}*/ +/* cpmUnlink -- unlink */ /*{{{*/ +int cpmUnlink(const struct cpmInode *dir, const char *fname) +{ + int user; + char name[8],extension[3]; + int extent; + struct cpmSuperBlock *drive; + + if (!S_ISDIR(dir->mode)) + { + boo="No such file"; + return -1; + } + drive=dir->sb; + if (splitFilename(fname,dir->sb->type,name,extension,&user)==-1) return -1; + if ((extent=findFileExtent(drive,user,name,extension,0,-1))==-1) return -1; + drive->dir[extent].status=(char)0xe5; + do + { + drive->dir[extent].status=(char)0xe5; + } while ((extent=findFileExtent(drive,user,name,extension,extent+1,-1))>=0); + if (writePhysDirectory(drive)==-1) return -1; + alvInit(drive); + return 0; +} +/*}}}*/ +/* cpmRename -- rename */ /*{{{*/ +int cpmRename(const struct cpmInode *dir, const char *old, const char *new) +{ + struct cpmSuperBlock *drive; + int extent; + int olduser; + char oldname[8], oldext[3]; + int newuser; + char newname[8], newext[3]; + + if (!S_ISDIR(dir->mode)) + { + boo="No such file"; + return -1; + } + drive=dir->sb; + if (splitFilename(old,dir->sb->type, oldname, oldext,&olduser)==-1) return -1; + if (splitFilename(new,dir->sb->type, newname, newext,&newuser)==-1) return -1; + if ((extent=findFileExtent(drive,olduser,oldname,oldext,0,-1))==-1) return -1; + if (findFileExtent(drive,newuser,newname, newext,0,-1)!=-1) + { + boo="file already exists"; + return -1; + } + do + { + drive->dir[extent].status=newuser; + memcpy7(drive->dir[extent].name, newname, 8); + memcpy7(drive->dir[extent].ext, newext, 3); + } while ((extent=findFileExtent(drive,olduser,oldname,oldext,extent+1,-1))!=-1); + if (writePhysDirectory(drive)==-1) return -1; + return 0; +} +/*}}}*/ +/* cpmOpendir -- opendir */ /*{{{*/ +int cpmOpendir(struct cpmInode *dir, struct cpmFile *dirp) +{ + if (!S_ISDIR(dir->mode)) + { + boo="No such file"; + return -1; + } + dirp->ino=dir; + dirp->pos=0; + dirp->mode=O_RDONLY; + return 0; +} +/*}}}*/ +/* cpmReaddir -- readdir */ /*{{{*/ +int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent) +{ + /* variables */ /*{{{*/ + struct PhysDirectoryEntry *cur=(struct PhysDirectoryEntry*)0; + char buf[13]; + int i; + char *bufp; + int hasext; + /*}}}*/ + + if (!(S_ISDIR(dir->ino->mode))) /* error: not a directory */ /*{{{*/ + { + boo="not a directory"; + return -1; + } + /*}}}*/ + while (1) + { + if (dir->pos==0) /* first entry is . */ /*{{{*/ + { + ent->ino=dir->ino->sb->maxdir; + ent->reclen=1; + strcpy(ent->name,"."); + ent->off=dir->pos; + ++dir->pos; + return 1; + } + /*}}}*/ + else if (dir->pos==1) /* next entry is .. */ /*{{{*/ + { + ent->ino=dir->ino->sb->maxdir; + ent->reclen=2; + strcpy(ent->name,".."); + ent->off=dir->pos; + ++dir->pos; + return 1; + } + /*}}}*/ + else if (dir->pos==2) + { + if (dir->ino->sb->passwdLength) /* next entry is [passwd] */ /*{{{*/ + { + ent->ino=dir->ino->sb->maxdir+1; + ent->reclen=8; + strcpy(ent->name,"[passwd]"); + ent->off=dir->pos; + ++dir->pos; + return 1; + } + /*}}}*/ + } + else if (dir->pos==3) + { + if (dir->ino->sb->labelLength) /* next entry is [label] */ /*{{{*/ + { + ent->ino=dir->ino->sb->maxdir+2; + ent->reclen=7; + strcpy(ent->name,"[label]"); + ent->off=dir->pos; + ++dir->pos; + return 1; + } + /*}}}*/ + } + else if (dir->pos>=RESERVED_ENTRIES && dir->posino->sb->maxdir+RESERVED_ENTRIES) + { + int first=dir->pos-RESERVED_ENTRIES; + + if ((cur=dir->ino->sb->dir+(dir->pos-RESERVED_ENTRIES))->status>=0 && cur->status<=(dir->ino->sb->type==CPMFS_P2DOS ? 31 : 15)) + { + /* determine first extent for the current file */ /*{{{*/ + for (i=0; iino->sb->maxdir; ++i) if (i!=(dir->pos-RESERVED_ENTRIES)) + { + if (isMatching(cur->status,cur->name,cur->ext,dir->ino->sb->dir[i].status,dir->ino->sb->dir[i].name,dir->ino->sb->dir[i].ext) && EXTENT(cur->extnol,cur->extnoh)>EXTENT(dir->ino->sb->dir[i].extnol,dir->ino->sb->dir[i].extnoh)) first=i; + } + /*}}}*/ + if (first==(dir->pos-RESERVED_ENTRIES)) + { + ent->ino=dir->pos-RESERVED_INODES; + /* 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 (hasext=0,i=0; i<3 && (cur->ext[i]&0x7f)!=' '; ++i) + { + if (!hasext) { *bufp++='.'; hasext=1; } + *bufp++=tolower(cur->ext[i]&0x7f); + } + *bufp='\0'; + /*}}}*/ + ent->reclen=strlen(buf); + strcpy(ent->name,buf); + ent->off=dir->pos; + ++dir->pos; + return 1; + } + } + } + else return 0; + ++dir->pos; + } +} +/*}}}*/ +/* cpmStat -- stat */ /*{{{*/ +void cpmStat(const struct cpmInode *ino, struct cpmStat *buf) +{ + buf->ino=ino->ino; + buf->mode=ino->mode; + buf->size=ino->size; + buf->atime=ino->atime; + buf->mtime=ino->mtime; + buf->ctime=ino->ctime; +} +/*}}}*/ +/* cpmOpen -- open */ /*{{{*/ +int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode) +{ + if (S_ISREG(ino->mode)) + { + if ((mode&O_WRONLY) && (ino->mode&0222)==0) + { + boo="permission denied"; + return -1; + } + file->pos=0; + file->ino=ino; + file->mode=mode; + return 0; + } + else + { + boo="not a regular file"; + return -1; + } +} +/*}}}*/ +/* cpmRead -- read */ /*{{{*/ +int cpmRead(struct cpmFile *file, char *buf, int count) +{ + int findext=1,findblock=1,extent=-1,block=-1,extentno=-1,got=0,nextblockpos=-1,nextextpos=-1; + int blocksize=file->ino->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==file->ino->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); + file->pos+=count; +#ifdef CPMFS_DEBUG + fprintf(stderr,"cpmRead passwd: read %d bytes, now at position %ld\n",count,(long)file->pos); +#endif + return count; + } + /*}}}*/ + else if (file->ino->ino==file->ino->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); + file->pos+=count; +#ifdef CPMFS_DEBUG + fprintf(stderr,"cpmRead label: read %d bytes, now at position %ld\n",count,(long)file->pos); +#endif + return count; + } + /*}}}*/ + else while (count>0 && file->posino->size) + { + char buffer[16384]; + + 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); + nextextpos=(file->pos/extcap)*extcap+extcap; + findext=0; + findblock=1; + } + if (findblock) + { + if (extent!=-1) + { + int start,end,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 (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; + readBlock(file->ino->sb,block,buffer,start,end); + } + } + nextblockpos=(file->pos/blocksize)*blocksize+blocksize; + findblock=0; + } + if (file->pospos%blocksize]; + ++file->pos; + ++got; + --count; + } + else if (file->pos==nextextpos) findext=1; else findblock=1; + } +#ifdef CPMFS_DEBUG + fprintf(stderr,"cpmRead: read %d bytes, now at position %ld\n",got,(long)file->pos); +#endif + return got; +} +/*}}}*/ +/* cpmWrite -- write */ /*{{{*/ +int cpmWrite(struct cpmFile *file, const char *buf, int 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 block=-1,start=-1,end=-1,ptr=-1; + char buffer[16384]; + + while (count>0) + { + 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); + nextextpos=(file->pos/extcap)*extcap+extcap; + findext=0; + findblock=1; + updateTimeStamps(file->ino,extent); + } + if (findblock) + { + if (start!=-1) + { + int last; + + last=writeBlock(file->ino->sb,block,buffer,start,end); + if (file->ino->sb->size<256) for (last=15; last>=ptr; --last) + { + if (file->ino->sb->dir[extent].pointers[last]) break; + } + else for (last=14; last>=ptr; last-=2) + { + if (file->ino->sb->dir[extent].pointers[last] || file->ino->sb->dir[extent].pointers[last+1]) break; + } + if (last==ptr) /* we wrote the last used block of this extent */ + { + file->ino->sb->dir[extent].extnol=EXTENTL((file->pos-1)/16384); + file->ino->sb->dir[extent].extnoh=EXTENTH((file->pos-1)/16384); + file->ino->sb->dir[extent].blkcnt=((file->pos-1)%16384)/128+1; + file->ino->sb->dir[extent].lrc=file->pos%128; + } + } + if (extent==-1) + { + if ((extent=findFreeExtent(file->ino->sb))==-1) return (got==0 ? -1 : got); + file->ino->sb->dir[extent]=file->ino->sb->dir[file->ino->ino]; + memset(file->ino->sb->dir[extent].pointers,0,16); + file->ino->sb->dir[extent].extnol=EXTENTL(extentno); + file->ino->sb->dir[extent].extnoh=EXTENTH(extentno); + file->ino->sb->dir[extent].blkcnt=0; + file->ino->sb->dir[extent].lrc=0; + } + 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 (block==0) + { + 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; + start=0; + end=(blocksize-1)/file->ino->sb->secLength; + 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 (file->pos%file->ino->sb->secLength) readBlock(file->ino->sb,block,buffer,start,start); + if (end!=start && (file->pos+count-1)ino->sb,block,buffer+end*file->ino->sb->secLength,end,end); + } + nextblockpos=(file->pos/blocksize)*blocksize+blocksize; + findblock=0; + } + buffer[file->pos%blocksize]=*buf++; + ++file->pos; + if (file->ino->sizepos) file->ino->size=file->pos; + ++got; + if (file->pos==nextblockpos) { if (file->pos==nextextpos) findext=1; else findblock=1; } + --count; + } + if (start!=-1) + { + int last; + + last=writeBlock(file->ino->sb,block,buffer,start,end); + if (file->ino->sb->size<256) for (last=15; last>=ptr; --last) + { + if (file->ino->sb->dir[extent].pointers[last]) break; + } + else for (last=14; last>=ptr; last-=2) + { + if (file->ino->sb->dir[extent].pointers[last] || file->ino->sb->dir[extent].pointers[last+1]) break; + } + if (last==ptr) /* we wrote the last used block of this extent */ + { + file->ino->sb->dir[extent].extnol=EXTENTL((file->pos-1)/16384); + file->ino->sb->dir[extent].extnoh=EXTENTH((file->pos-1)/16384); + file->ino->sb->dir[extent].blkcnt=((file->pos-1)%16384)/128+1; + file->ino->sb->dir[extent].lrc=file->pos%128; + writePhysDirectory(file->ino->sb); + } + } + return got; +} +/*}}}*/ +/* cpmClose -- close */ /*{{{*/ +int cpmClose(struct cpmFile *file) +{ + if (file->mode&O_WRONLY) return (writePhysDirectory(file->ino->sb)); + return 0; +} +/*}}}*/ +/* cpmCreat -- creat */ /*{{{*/ +int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode) +{ + int user; + char name[8],extension[3]; + int extent; + struct cpmSuperBlock *drive; + struct PhysDirectoryEntry *ent; + + if (!S_ISDIR(dir->mode)) + { + boo="No such file or directory"; + return -1; + } + if (splitFilename(fname,dir->sb->type,name,extension,&user)==-1) return -1; +#ifdef CPMFS_DEBUG + fprintf(stderr,"cpmCreat: %s -> %d:%-.8s.%-.3s\n",fname,user,name,extension); +#endif + if (findFileExtent(dir->sb,user,name,extension,0,-1)!=-1) return -1; + drive=dir->sb; + if ((extent=findFreeExtent(dir->sb))==-1) return -1; + ent=dir->sb->dir+extent; + memset(ent,0,32); + ent->status=user; + memcpy(ent->name,name,8); + memcpy(ent->ext,extension,3); + ino->ino=extent; + ino->mode=s_ifreg|mode; + ino->size=0; + time(&ino->atime); + time(&ino->mtime); + time(&ino->ctime); + ino->sb=dir->sb; + updateTimeStamps(ino,extent); + writePhysDirectory(dir->sb); + return 0; +} +/*}}}*/ +/* cpmAttrGet -- get CP/M attributes */ /*{{{*/ +int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib) +{ + *attrib = ino->attr; + return 0; +} +/*}}}*/ +/* cpmAttrSet -- set CP/M attributes */ /*{{{*/ +int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib) +{ + struct cpmSuperBlock *drive; + int extent; + int user; + char name[8], extension[3]; + + memset(name, 0, sizeof(name)); + memset(extension, 0, sizeof(extension)); + drive = ino->sb; + extent = ino->ino; + + /* Strip off existing attribute bits */ + memcpy7(name, drive->dir[extent].name, 8); + memcpy7(extension, drive->dir[extent].ext, 3); + user = drive->dir[extent].status; + + /* And set new ones */ + if (attrib & CPM_ATTR_F1) name[0] |= 0x80; + if (attrib & CPM_ATTR_F2) name[1] |= 0x80; + if (attrib & CPM_ATTR_F3) name[2] |= 0x80; + if (attrib & CPM_ATTR_F4) name[3] |= 0x80; + if (attrib & CPM_ATTR_RO) extension[0] |= 0x80; + if (attrib & CPM_ATTR_SYS) extension[1] |= 0x80; + if (attrib & CPM_ATTR_ARCV) extension[2] |= 0x80; + + do + { + memcpy(drive->dir[extent].name, name, 8); + memcpy(drive->dir[extent].ext, extension, 3); + } while ((extent=findFileExtent(drive, user,name,extension,extent+1,-1))!=-1); + if (writePhysDirectory(drive)==-1) return -1; + + /* Update the stored (inode) copies of the file attributes and mode */ + ino->attr=attrib; + if (attrib&CPM_ATTR_RO) ino->mode&=~(S_IWUSR|S_IWGRP|S_IWOTH); + else ino->mode|=(S_IWUSR|S_IWGRP|S_IWOTH); + + return 0; +} +/*}}}*/ +/* cpmChmod -- set CP/M r/o & sys */ /*{{{*/ +int cpmChmod(struct cpmInode *ino, mode_t mode) +{ + /* Convert the chmod() into a chattr() call that affects RO */ + int newatt = ino->attr & ~CPM_ATTR_RO; + + if ((mode & (S_IWUSR|S_IWGRP|S_IWOTH))) newatt |= CPM_ATTR_RO; + return cpmAttrSet(ino, newatt); +} +/*}}}*/ +/* cpmSync -- write directory back */ /*{{{*/ +int cpmSync(struct cpmSuperBlock *sb) +{ + return (writePhysDirectory(sb)); +} +/*}}}*/ +/* cpmUmount -- free super block */ /*{{{*/ +void cpmUmount(struct cpmSuperBlock *sb) +{ + free(sb->alv); + free(sb->skewtab); + free(sb->dir); + if (sb->passwdLength) free(sb->passwd); +} +/*}}}*/ diff --git a/cpmfs.h b/cpmfs.h new file mode 100644 index 0000000..2393bc9 --- /dev/null +++ b/cpmfs.h @@ -0,0 +1,173 @@ +#ifndef CPMFS_H +#define CPMFS_H + +#include +#include + +#ifdef _WIN32 + #include + #include + /* To make it compile on NT: extracts from Linux 2.0 * + * and */ + #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 /* For open(), lseek() etc. */ + #ifndef HAVE_MODE_T + typedef int mode_t; + #endif +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +#include "device.h" + +/* CP/M file attributes */ +#define CPM_ATTR_F1 1 +#define CPM_ATTR_F2 2 +#define CPM_ATTR_F3 4 +#define CPM_ATTR_F4 8 +/* F5-F8 are banned in CP/M 2 & 3, F7 is used by ZSDOS */ +#define CPM_ATTR_RO 256 /* Read-only */ +#define CPM_ATTR_SYS 512 /* System */ +#define CPM_ATTR_ARCV 1024 /* Archive */ +#define CPM_ATTR_PWDEL 2048 /* Password required to delete */ +#define CPM_ATTR_PWWRITE 4096 /* Password required to write */ +#define CPM_ATTR_PWREAD 8192 /* Password required to read */ + +typedef int cpm_attr_t; + +struct cpmInode +{ + ino_t ino; + mode_t mode; + off_t size; + cpm_attr_t attr; + time_t atime; + time_t mtime; + time_t ctime; + struct cpmSuperBlock *sb; +}; + +struct cpmFile +{ + mode_t mode; + off_t pos; + struct cpmInode *ino; +}; + +struct cpmDirent +{ + ino_t ino; + off_t off; + size_t reclen; + char name[2+8+1+3+1]; /* 00foobarxy.zzy\0 */ +}; + +struct cpmStat +{ + ino_t ino; + mode_t mode; + off_t size; + time_t atime; + time_t mtime; + time_t ctime; +}; + +#define CPMFS_DR22 0 +#define CPMFS_P2DOS 1 +#define CPMFS_DR3 2 + +struct cpmSuperBlock +{ + struct Device dev; + + int secLength; + int tracks; + int sectrk; + int blksiz; + int maxdir; + int skew; + int boottrk; + int type; + int size; + int extents; /* logical extents per physical extent */ + struct PhysDirectoryEntry *dir; + int alvSize; + int *alv; + int *skewtab; + int cnotatime; + char *label; + size_t labelLength; + char *passwd; + size_t passwdLength; + struct cpmInode *root; +}; + +struct cpmStatFS +{ + long f_bsize; + long f_blocks; + long f_bfree; + long f_bused; + long f_bavail; + long f_files; + long f_ffree; + long f_namelen; +}; + +extern const char cmd[]; +extern const char *boo; + +int match(const char *a, const char *pattern); +void cpmglob(int opti, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv); + +int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format); +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); +int cpmRename(const struct cpmInode *dir, const char *old, const char *newname); +int cpmOpendir(struct cpmInode *dir, struct cpmFile *dirp); +int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent); +void cpmStat(const struct cpmInode *ino, struct cpmStat *buf); +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); +int cpmClose(struct cpmFile *file); +int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode); +int cpmSync(struct cpmSuperBlock *sb); +void cpmUmount(struct cpmSuperBlock *sb); + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/cpmls.1.in b/cpmls.1.in new file mode 100644 index 0000000..5ba6fe8 --- /dev/null +++ b/cpmls.1.in @@ -0,0 +1,67 @@ +.TH CPMLS 1 "@UPDATED@" "CP/M tools" "User commands" +.SH NAME \"{{{roff}}}\"{{{ +cpmls \- list sorted contents of directory +.\"}}} +.SH SYNOPSIS \"{{{ +.ad l +.B cpmls +.RB [ \-d | \-D | \-F | \-A | \-l [ \-c ][ \-i ]] +.RB [ \-f +.IR format ] +.I image +.RI [ file-pattern "...]" +.ad b +.\"}}} +.SH DESCRIPTION \"{{{ +\fBCpmls\fP lists the sorted contents of the directory. +.\"}}} +.SH OPTIONS \"{{{ +.IP "\fB\-f\fP \fIformat\fP" +Use the given CP/M disk \fIformat\fP instead of the default format. +.IP \fB\-d\fP +Old CP/M 2.2 dir output. +.IP \fB\-D\fP +P2DOS 2.3 ddir-like output. +.IP \fB\-F\fp +CP/M 3.x dir output. +.IP \fB\-A\fp +E2fs lsattr-like output. +.IP \fB\-l\fP +Long UNIX-style directory listing including size, time stamp and user number. +.IP \fB\-c\fP +Output the creation time, not the modification time. +.IP \fB\-i\fP +Print index number of each file. +.\"}}} +.SH "RETURN VALUE" \"{{{ +Upon successful completion, exit code 0 is returned. +.\"}}} +.SH ERRORS \"{{{ +Any errors are indicated by exit code 1. +.\"}}} +.SH FILES \"{{{ +@DATADIR@/diskdefs CP/M disk format definitions +.\"}}} +.SH AUTHORS \"{{{ +This program is copyright 1997, 1998, 1999, 2000, 2001 Michael Haardt +. The Windows port is copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" \"{{{ +.IR cpmcp (1), +.IR cpm (5) +.\"}}} diff --git a/cpmls.c b/cpmls.c new file mode 100644 index 0000000..e2d1786 --- /dev/null +++ b/cpmls.c @@ -0,0 +1,368 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include +#include +#include +#include +#include +#include "config.h" +#include "getopt.h" +#include "cpmfs.h" +/*}}}*/ + +/* variables */ /*{{{*/ +static const char * const month[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; +/*}}}*/ + +/* namecmp -- compare two entries */ /*{{{*/ +static int namecmp(const void *a, const void *b) +{ + if (**((const char * const *)a)=='[') return -1; + return strcmp(*((const char * const *)a),*((const char * const *)b)); +} +/*}}}*/ +/* olddir -- old style output */ /*{{{*/ +static void olddir(char **dirent, int entries) +{ + int i,j,k,l,user,announce; + + announce=0; + for (user=0; user<32; ++user) + { + for (i=l=0; itm_mday,month[tmp->tm_mon],tmp->tm_year+1900,tmp->tm_hour,tmp->tm_min); + tmp=gmtime(&statbuf.ctime); + printf(" %02d-%s-%04d %02d:%02d",tmp->tm_mday,month[tmp->tm_mon],tmp->tm_year+1900,tmp->tm_hour,tmp->tm_min); + } + putchar('\n'); + ++l; + } + } + if (announce==2) announce=1; + } + printf("%5.1d Files occupying %6.1ldK",l,(buf.f_bused*buf.f_bsize)/1024); + printf(", %7.1ldK Free.\n",(buf.f_bfree*buf.f_bsize)/1024); + } + else printf("No files found\n"); +} +/*}}}*/ +/* old3dir -- old CP/M Plus style long output */ /*{{{*/ +static void old3dir(char **dirent, int entries, struct cpmInode *ino) +{ + struct cpmStatFS buf; + struct cpmStat statbuf; + struct cpmInode file; + + if (entries) + { + int i,j,k,l,announce,user, attrib; + int totalBytes=0,totalRecs=0; + + qsort(dirent,entries,sizeof(char*),namecmp); + cpmStatFS(ino,&buf); + announce=1; + for (l=0,user=0; user<32; ++user) + { + for (i=0; itm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min); + tmp=gmtime(&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); + putchar('\n'); + ++l; + } + } + if (announce==2) announce=1; + } + printf("\nTotal Bytes = %6.1dk ",(totalBytes+1023)/1024); + printf("Total Records = %7.1d ",totalRecs); + printf("Files Found = %4.1d\n",l); + printf("Total 1k Blocks = %6.1ld ",(buf.f_bused*buf.f_bsize)/1024); + printf("Used/Max Dir Entries For Drive A: %4.1ld/%4.1ld\n",buf.f_files-buf.f_ffree,buf.f_files); + } + else printf("No files found\n"); +} +/*}}}*/ +/* ls -- UNIX style output */ /*{{{*/ +static void ls(char **dirent, int entries, struct cpmInode *ino, int l, int c, int iflag) +{ + int i,user,announce,any; + time_t now; + struct cpmStat statbuf; + struct cpmInode file; + + time(&now); + qsort(dirent,entries,sizeof(char*),namecmp); + announce=0; + any=0; + for (user=0; user<32; ++user) + { + announce=0; + for (i=0; itm_mon],tmp->tm_mday); + if ((c ? statbuf.ctime : statbuf.mtime)<(now-182*24*3600)) printf("%04d ",tmp->tm_year+1900); + else printf("%02d:%02d ",tmp->tm_hour,tmp->tm_min); + } + printf("%s\n",dirent[i]+2); + } + } + } +} +/*}}}*/ +/* lsattr -- output something like e2fs lsattr */ /*{{{*/ +static void lsattr(char **dirent, int entries, struct cpmInode *ino) +{ + int i,user,announce,any; + struct cpmStat statbuf; + struct cpmInode file; + cpm_attr_t attrib; + + qsort(dirent,entries,sizeof(char*),namecmp); + announce=0; + any=0; + for (user=0; user<32; ++user) + { + announce=0; + for (i=0; i. The Windows port is copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" \"{{{ +.IR cpmls (1), +.IR cpm (5) +.\"}}} diff --git a/cpmrm.c b/cpmrm.c new file mode 100644 index 0000000..b88bdca --- /dev/null +++ b/cpmrm.c @@ -0,0 +1,65 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include +#include +#include +#include +#include +#include "config.h" +#include "getopt.h" +#include "cpmfs.h" +/*}}}*/ + +const char cmd[]="cpmrm"; + +int main(int argc, char *argv[]) /*{{{*/ +{ + /* variables */ /*{{{*/ + const char *err; + const char *image; + const char *format=FORMAT; + const char *devopts=NULL; + int c,i,usage=0,exitcode=0; + struct cpmSuperBlock drive; + struct cpmInode root; + int gargc; + char **gargv; + /*}}}*/ + + /* parse options */ /*{{{*/ + while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c) + { + case 'T': devopts=optarg; break; + case 'f': format=optarg; break; + case 'h': + case '?': usage=1; break; + } + + if (optind>=(argc-1)) usage=1; + else image=argv[optind]; + + if (usage) + { + fprintf(stderr,"Usage: %s [-f format] [-T dsktype] image pattern ...\n",cmd); + exit(1); + } + /*}}}*/ + /* open image */ /*{{{*/ + if ((err=Device_open(&drive.dev, image, O_RDWR, devopts))) + { + fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + exit(1); + } + cpmReadSuper(&drive,&root,format); + /*}}}*/ + cpmglob(optind,argc,argv,&root,&gargc,&gargv); + for (i=0; i +#include +#include +#include +#include "config.h" +#include "device.h" +/*}}}*/ + +/* Device_open -- Open an image file */ /*{{{*/ +const char *Device_open(struct Device *this, const char *filename, int mode, const char *deviceOpts) +{ + dsk_err_t e = dsk_open(&this->dev, filename, deviceOpts, NULL); + this->opened = 0; + if (e) return dsk_strerror(e); + this->opened = 1; + dsk_getgeom(this->dev, &this->geom); + return NULL; +} +/*}}}*/ +/* Device_setGeometry -- Set disk geometry */ /*{{{*/ +void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks) +{ + this->secLength=secLength; + this->sectrk=sectrk; + this->tracks=tracks; + + this->geom.dg_secsize = secLength; + this->geom.dg_sectors = sectrk; + /* Did the autoprobe guess right about the number of sectors & cylinders? */ + if (this->geom.dg_cylinders * this->geom.dg_heads == tracks) return; + /* Otherwise we guess: <= 43 tracks: single-sided. Else double. This + * fails for 80-track single-sided if there are any such beasts */ + if (tracks <= 43) + { + this->geom.dg_cylinders = tracks; + this->geom.dg_heads = 1; + } + else + { + this->geom.dg_cylinders = tracks/2; + this->geom.dg_heads = 2; + } +} +/*}}}*/ +/* Device_close -- Close an image file */ /*{{{*/ +const char *Device_close(struct Device *this) +{ + dsk_err_t e; + this->opened=0; + e = dsk_close(&this->dev); + return (e?dsk_strerror(e):(const char*)0); +} +/*}}}*/ +/* Device_readSector -- read a physical sector */ /*{{{*/ +const char *Device_readSector(const struct Device *this, int track, int sector, char *buf) +{ + dsk_err_t e; + e = dsk_lread(this->dev, &this->geom, buf, (track * this->sectrk) + sector); + return (e?dsk_strerror(e):(const char*)0); +} +/*}}}*/ +/* Device_writeSector -- write physical sector */ /*{{{*/ +const char *Device_writeSector(const struct Device *this, int track, int sector, const char *buf) +{ + dsk_err_t e; + e = dsk_lwrite(this->dev, &this->geom, buf, (track * this->sectrk) + sector); + return (e?dsk_strerror(e):(const char*)0); +} +/*}}}*/ diff --git a/device_posix.c b/device_posix.c new file mode 100644 index 0000000..82071a4 --- /dev/null +++ b/device_posix.c @@ -0,0 +1,81 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#undef _POSIX_SOURCE +#define _POSIX_SOURCE 1 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 2 + +#ifdef DMALLOC +#include "dmalloc.h" +#endif + +#include +#include +#include "config.h" +#include +#include + +#include "device.h" +/*}}}*/ + +/* Device_open -- Open an image file */ /*{{{*/ +const char *Device_open(struct Device *this, const char *filename, int mode, const char *deviceOpts) +{ + this->fd=open(filename,mode); + this->opened=(this->fd==-1?0:1); + return ((this->fd==-1)?strerror(errno):(const char*)0); +} +/*}}}*/ +/* Device_setGeometry -- Set disk geometry */ /*{{{*/ +void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks) +{ + this->secLength=secLength; + this->sectrk=sectrk; + this->tracks=tracks; +} +/*}}}*/ +/* Device_close -- Close an image file */ /*{{{*/ +const char *Device_close(struct Device *this) +{ + this->opened=0; + return ((close(this->fd)==-1)?strerror(errno):(const char*)0); +} +/*}}}*/ +/* Device_readSector -- read a physical sector */ /*{{{*/ +const char *Device_readSector(const struct Device *this, int track, int sector, char *buf) +{ + int res; + + assert(sector>=0); + assert(sectorsectrk); + assert(track>=0); + assert(tracktracks); + if (lseek(this->fd,(off_t)(sector+track*this->sectrk)*this->secLength,SEEK_SET)==-1) + { + return strerror(errno); + } + if ((res=read(this->fd, buf, this->secLength)) != this->secLength) + { + if (res==-1) + { + return strerror(errno); + } + else memset(buf+res,0,this->secLength-res); /* hit end of disk image */ + } + return (const char*)0; +} +/*}}}*/ +/* Device_writeSector -- write physical sector */ /*{{{*/ +const char *Device_writeSector(const struct Device *this, int track, int sector, const char *buf) +{ + assert(sector>=0); + assert(sectorsectrk); + assert(track>=0); + assert(tracktracks); + if (lseek(this->fd,(off_t)(sector+track*this->sectrk)*this->secLength, SEEK_SET)==-1) + { + return strerror(errno); + } + if (write(this->fd, buf, this->secLength) == this->secLength) return (const char*)0; + return strerror(errno); +} +/*}}}*/ diff --git a/device_win32.c b/device_win32.c new file mode 100644 index 0000000..ca32902 --- /dev/null +++ b/device_win32.c @@ -0,0 +1,656 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#undef _POSIX_SOURCE +#define _POSIX_SOURCE 1 +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 2 + +#include +#include +#include +#include "config.h" +#include "cpmdir.h" +#include "cpmfs.h" +/*}}}*/ +/* 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, + ®, sizeof( 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, + ®, sizeof( 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, + ®, sizeof( 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, + ®, sizeof( 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, + ®, sizeof( 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, + ®, sizeof( 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 */ /*{{{*/ +void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks) +{ + int n; + + this->secLength=secLength; + this->sectrk=sectrk; + this->tracks=tracks; + if (this->drvtype == CPMDRV_WIN95) + { + DRIVEPARAMS drvp; + memset(&drvp, 0, sizeof(drvp)); + if (GetDriveParams( this->hdisk, this->fd, &drvp )) return; + + 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 ); + } +} +/*}}}*/ +/* 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(sectorsectrk); + assert(track>=0); + assert(tracktracks); + + offset = ((sector+track*drive->sectrk)*drive->secLength); + + if (drive->drvtype == CPMDRV_WINNT) + { + LPVOID iobuffer; + DWORD bytesread; + + if (SetFilePointer(drive->hdisk, 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; + } + + 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, + ®, sizeof( 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, + ®, sizeof( reg ), ®, sizeof( reg ), &cb, 0 ); + +#endif + if ( !bResult || (reg.reg_Flags & 1) ) + { + if (GetLastError()) return strwin32error(); + return "Unknown read error."; + } + return 0; + } + + if (lseek(drive->fd,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(sectorsectrk); + assert(track>=0); + assert(tracktracks); + + offset = ((sector+track*drive->sectrk)*drive->secLength); + + if (drive->drvtype == CPMDRV_WINNT) + { + LPVOID iobuffer; + DWORD byteswritten; + + if (SetFilePointer(drive->hdisk, 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; + } + + 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, + ®, sizeof( 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, + ®, sizeof( reg ), ®, sizeof( reg ), &cb, 0 ); +#endif + + if ( !bResult || (reg.reg_Flags & 1) ) + { + if (GetLastError()) return strwin32error(); + return "Unknown write error."; + } + return NULL; + } + + if (lseek(drive->fd,offset, SEEK_SET)==-1) + { + return strerror(errno); + } + if (write(drive->fd, buf, drive->secLength) == drive->secLength) return NULL; + return strerror(errno); +} +/*}}}*/ diff --git a/diskdefs b/diskdefs new file mode 100644 index 0000000..f6678ca --- /dev/null +++ b/diskdefs @@ -0,0 +1,167 @@ +diskdef ibm-3740 + seclen 128 + tracks 77 + sectrk 26 + blocksize 1024 + maxdir 64 + skew 6 + boottrk 2 + os p2dos +end + +diskdef 4mb-hd + seclen 128 + tracks 1024 + sectrk 32 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 0 + os p2dos +end + +diskdef pcw + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 1 + os 3 +end + +diskdef pc1.2m + seclen 512 + tracks 80 + # this format uses 15 sectors per track, but 30 per cylinder + sectrk 30 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 0 + os 3 +end + +diskdef cf2dd + seclen 512 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 1 + os 3 +end + +#amstrad: values are read from super block (special name hardcoded) + +# Royal alphatronic +# setfdprm /dev/fd1 dd ssize=256 cyl=40 sect=16 head=2 +diskdef alpha + seclen 256 + tracks 40 + sectrk 32 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Apple II CP/M skew o Apple II DOS 3.3 skew +diskdef apple-do + seclen 256 + tracks 35 + sectrk 16 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 3 + os 2.2 +end + +# Apple II CP/M skew o Apple II PRODOS skew +diskdef apple-po + seclen 256 + tracks 35 + sectrk 16 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 3 + os 2.2 +end + +# MYZ80 hard drive (only works with libdsk, because it has a 256-byte header) +diskdef myz80 + seclen 1024 + tracks 64 + sectrk 128 + blocksize 4096 + maxdir 1024 + skew 1 + boottrk 0 + os 3 +end + +# Despite being Amstrad formats, CPC System and CPC Data don't have an Amstrad +# superblock. You'll need to use libdsk to access them because the Linux +# and Windows kernel drivers won't touch them. +diskdef cpcsys + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 2 + os 3 +end +diskdef cpcdata + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 0 + os 3 +end + +# after being read in with no sector skew. +diskdef nigdos + seclen 512 + # NigDos double sided disk format, 42 tracks * 2 sides + tracks 84 + sectrk 10 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 0 + # this format wastes half of the directory entry + logicalextents 1 + os 3 +end + +diskdef epsqx10 + seclen 512 + tracks 40 + sectrk 20 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef ibm-8ss + seclen 512 + tracks 40 + sectrk 8 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 1 + os 2.2 +end diff --git a/fsck.cpm.1.in b/fsck.cpm.1.in new file mode 100644 index 0000000..b1a0c0c --- /dev/null +++ b/fsck.cpm.1.in @@ -0,0 +1,74 @@ +.TH FSCK.CPM 1 "@UPDATED@" "CP/M tools" "User commands" +.SH NAME ..\"{{{roff}}}\"{{{ +fsck.cpm \- check a CP/M file system +.\"}}} +.SH SYNOPSIS .\"{{{ +.ad l +.B fsck.cpm +.RB [ \-f +.IR format ] +.RB [ \-n ] +.I image +.ad b +.\"}}} +.SH DESCRIPTION .\"{{{ +\fBfsck.cpm\fP is used to check and repair a CP/M file system. After +reading the directory, it makes two passes. The first pass checks extent +fields for range and format violations (bad status, extent number, last +record byte count, file name, extension, block number, record count, +size of \&.COM files, time stamp format, invalid password characters, +invalid time stamp mode). The second pass checks extent connectivity +(multiple allocated blocks and duplicate directory entries). +.P +\fBfsck.cpm\fP can not yet repair all errors. +.\"}}} +.SH OPTIONS .\"{{{ +.IP "\fB\-f\fP \fIformat\fP" +Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-n\fP" +Open the file system read-only and do not repair any errors. +.\"}}} +.SH "RETURN VALUE" .\"{{{ +Upon successful completion, exit code 0 is returned. +.\"}}} +.SH ERRORS .\"{{{ +Any errors are indicated by exit code 1. +.\"}}} +.SH FILES .\"{{{ +@DATADIR@/diskdefs CP/M disk format definitions +.\"}}} +.SH DIAGNOSTICS .\"{{{ +.IP "\fIimage\fP: \fIused\fP/\fItotal\fP files (\fIn\fP.\fIn\fP% non-contiguos), \fIused\fP/\fItotal\fP blocks" +No inconsistencies could be found. The number of used files actually +is the number of used extents. Since a file may use more than +one extent, this may be greather than the actual number of files, but a +correct measure would not reflect how many files could still be created +at most. A file is considered fragmented, if sequential data blocks +pointed to by the same extent do not have sequential block numbers. +The number of used blocks includes the blocks used for system tracks +and the directory. +.\"}}} +.SH AUTHORS .\"{{{ +This program is copyright 1997, 1998, 1999, 2000, 2001 Michael Haardt +. The Windows port is copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" .\"{{{ +.IR fsck (8), +.IR mkfs.cpm (1), +.IR cpm (5) +.\"}}} diff --git a/fsck.cpm.c b/fsck.cpm.c new file mode 100644 index 0000000..572823b --- /dev/null +++ b/fsck.cpm.c @@ -0,0 +1,624 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include +#include +#include +#include +#include +#include "config.h" + +extern char *optarg; +extern int optind,opterr,optopt; +int getopt(int argc, char * const *argv, const char *optstring); + +#include "cpmdir.h" +#include "cpmfs.h" +/*}}}*/ +/* #defines */ /*{{{*/ +/* your favourite password *:-) */ + +#define T0 'G' +#define T1 'E' +#define T2 'H' +#define T3 'E' +#define T4 'I' +#define T5 'M' +#define T6 ' ' +#define T7 ' ' + +#define PB ((char)(T0+T1+T2+T3+T4+T5+T6+T7)) +#define P0 ((char)(T7^PB)) +#define P1 ((char)(T6^PB)) +#define P2 ((char)(T5^PB)) +#define P3 ((char)(T4^PB)) +#define P4 ((char)(T3^PB)) +#define P5 ((char)(T2^PB)) +#define P6 ((char)(T1^PB)) +#define P7 ((char)(T0^PB)) +/*}}}*/ + +/* types */ /*{{{*/ +enum Result { OK=0, MODIFIED=1, BROKEN=2 }; +/*}}}*/ +/* variables */ /*{{{*/ +static int norepair=0; +/*}}}*/ + +/* bcdCheck -- check format and range of BCD digit */ /*{{{*/ +static int bcdCheck(int n, int max, const char *msg, const char *unit, int extent1, int extent2) +{ + if (((n>>4)&0xf)>10 || (n&0xf)>10 || (((n>>4)&0xf)*10+(n&0xf))>=max) + { + printf("Error: Bad %s %s (extent=%d/%d, %s=%02x)\n",msg,unit,extent1,extent2,unit,n&0xff); + return -1; + } + else return 0; +} +/*}}}*/ +/* pwdCheck -- check password */ /*{{{*/ +static int pwdCheck(int extent, const char *pwd, char decode) +{ + char c; + int i; + + for (i=0; i<8; ++i) if ((c=((char)(pwd[7-i]^decode)))<' ' || c&0x80) + { + printf("Error: non-printable character in password (extent=%d, password=",extent); + for (i=0; i<8; ++i) + { + c=pwd[7-i]^decode; + if (c<' ' || c&0x80) + { + putchar('\\'); putchar('0'+((c>>6)&0x01)); + putchar('0'+((c>>3)&0x03)); + putchar('0'+(c&0x03)); + } + else putchar(c); + } + printf(")\n"); + return -1; + } + return 0; +} +/*}}}*/ +/* ask -- ask user and return answer */ /*{{{*/ +static int ask(const char *msg) +{ + while (1) + { + char buf[80]; + + if (norepair) return 0; + printf("%s [Y]? ",msg); fflush(stdout); + if (fgets(buf,sizeof(buf),stdin)==(char*)0) exit(1); + switch (toupper(buf[0])) + { + case '\n': + case 'Y': return 1; + case 'N': return 0; + } + } +} +/*}}}*/ +/* prfile -- print file name */ /*{{{*/ +static char *prfile(struct cpmSuperBlock *sb, int extent) +{ + struct PhysDirectoryEntry *dir; + static char name[80]; + char *s=name; + int i; + char c; + + dir=sb->dir+extent; + for (i=0; i<8; ++i) + { + c=dir->name[i]; + if ((c&0x7f)<' ') + { + *s++='\\'; *s++=('0'+((c>>6)&0x01)); + *s++=('0'+((c>>3)&0x03)); + *s++=('0'+(c&0x03)); + } + else *s++=(c&0x7f); + } + *s++='.'; + for (i=0; i<3; ++i) + { + c=dir->ext[i]; + if ((c&0x7f)<' ') + { + *s++='\\'; *s++=('0'+((c>>6)&0x01)); + *s++=('0'+((c>>3)&0x03)); + *s++=('0'+(c&0x03)); + } + else *s++=(c&0x7f); + } + *s='\0'; + return name; +} +/*}}}*/ +/* fsck -- file system check */ /*{{{*/ +static int fsck(struct cpmInode *root, const char *image) +{ + /* variables */ /*{{{*/ + enum Result ret=OK; + int extent,extent2; + struct PhysDirectoryEntry *dir,*dir2; + struct cpmSuperBlock *sb=root->sb; + /*}}}*/ + + /* Phase 1: check extent fields */ /*{{{*/ + printf("Phase 1: check extent fields\n"); + for (extent=0; extentmaxdir; ++extent) + { + char *status; + int usedBlocks=0; + + dir=sb->dir+extent; + status=&dir->status; + if (*status>=0 && *status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* directory entry */ /*{{{*/ + { + /* check name and extension */ /*{{{*/ + { + int i; + char *c; + + for (i=0; i<8; ++i) + { + c=&(dir->name[i]); + if (!ISFILECHAR(i,*c&0x7f) || islower(*c&0x7f)) + { + printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); + if (ask("Remove file")) + { + *status=(char)0xE5; + ret|=MODIFIED; + break; + } + else ret|=BROKEN; + } + } + if (*status==(char)0xe5) continue; + for (i=0; i<3; ++i) + { + c=&(dir->ext[i]); + if (!ISFILECHAR(1,*c&0x7f) || islower(*c&0x7f)) + { + printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); + if (ask("Remove file")) + { + *status=(char)0xE5; + ret|=MODIFIED; + break; + } + else ret|=BROKEN; + } + } + if (*status==(char)0xe5) continue; + } + /*}}}*/ + /* check extent number */ /*{{{*/ + if ((dir->extnol&0xff)>0x1f) + { + printf("Error: Bad lower bits of extent number (extent=%d, name=\"%s\", low bits=%d)\n",extent,prfile(sb,extent),dir->extnol&0xff); + if (ask("Remove file")) + { + *status=(char)0xE5; + ret|=MODIFIED; + } + else ret|=BROKEN; + } + if (*status==(char)0xe5) continue; + if ((dir->extnoh&0xff)>0x3f) + { + printf("Error: Bad higher bits of extent number (extent=%d, name=\"%s\", high bits=%d)\n",extent,prfile(sb,extent),dir->extnoh&0xff); + if (ask("Remove file")) + { + *status=(char)0xE5; + ret|=MODIFIED; + } + else ret|=BROKEN; + } + if (*status==(char)0xe5) continue; + /*}}}*/ + /* check last record byte count */ /*{{{*/ + if ((dir->lrc&0xff)>128) + { + printf("Error: Bad last record byte count (extent=%d, name=\"%s\", lrc=%d)\n",extent,prfile(sb,extent),dir->lrc&0xff); + if (ask("Clear last record byte count")) + { + dir->lrc=(char)0; + ret|=MODIFIED; + } + else ret|=BROKEN; + } + if (*status==(char)0xe5) continue; + /*}}}*/ + /* check block number range */ /*{{{*/ + { + int block,min,max,i; + + min=(sb->maxdir*32+sb->blksiz-1)/sb->blksiz; + 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 (block>0) + { + ++usedBlocks; + if (blockmax) + { + printf("Error: Bad block number (extent=%d, name=\"%s\", block=%d)\n",extent,prfile(sb,extent),block); + if (ask("Remove file")) + { + *status=(char)0xE5; + ret|=MODIFIED; + break; + } + else ret|=BROKEN; + } + } + } + if (*status==(char)0xe5) continue; + } + /*}}}*/ + /* check number of used blocks ? */ /*{{{*/ + /*}}}*/ + /* check record count */ /*{{{*/ + { + int i,min,max,recordsInBlocks,used=0; + + min=(dir->extnol%sb->extents)*16/sb->extents; + max=((dir->extnol%sb->extents)+1)*16/sb->extents; + assert(minpointers[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) + { + printf("Error: Bad record count (extent=%d, name=\"%s\", record count=%d)\n",extent,prfile(sb,extent),dir->blkcnt&0xff); + if (ask("Remove file")) + { + *status=(char)0xE5; + ret|=MODIFIED; + } + else ret|=BROKEN; + } + if (*status==(char)0xe5) continue; + } + /*}}}*/ + /* check for too large .com files */ /*{{{*/ + if (((EXTENT(dir->extnol,dir->extnoh)==3 && dir->blkcnt>=126) || EXTENT(dir->extnol,dir->extnoh)>=4) && (dir->ext[0]&0x7f)=='C' && (dir->ext[1]&0x7f)=='O' && (dir->ext[2]&0x7f)=='M') + { + printf("Warning: Oversized .COM file (extent=%d, name=\"%s\")\n",extent,prfile(sb,extent)); + } + /*}}}*/ + } + /*}}}*/ + else if ((sb->type==CPMFS_P2DOS || sb->type==CPMFS_DR3) && *status==33) /* check time stamps ? */ /*{{{*/ + { + unsigned long created,modified; + char s; + + if ((s=sb->dir[extent2=(extent&~3)].status)>=0 && s<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* time stamps for first of the three extents */ /*{{{*/ + { + bcdCheck(dir->name[2],24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent2); + bcdCheck(dir->name[3],60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent2); + bcdCheck(dir->name[6],24,"modification date","hour",extent,extent2); + bcdCheck(dir->name[7],60,"modification date","minute",extent,extent2); + created=(dir->name[4]+(dir->name[1]<<8))*(0x60*0x60)+dir->name[2]*0x60+dir->name[3]; + modified=(dir->name[0]+(dir->name[5]<<8))*(0x60*0x60)+dir->name[6]*0x60+dir->name[7]; + if (sb->cnotatime && modifieddir[extent2=(extent&~3)+1].status)>=0 && s<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* time stamps for second */ /*{{{*/ + { + bcdCheck(dir->lrc,24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent2); + bcdCheck(dir->extnoh,60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent2); + bcdCheck(dir->pointers[1],24,"modification date","hour",extent,extent2); + bcdCheck(dir->pointers[2],60,"modification date","minute",extent,extent2); + created=(dir->ext[2]+(dir->extnol<<8))*(0x60*0x60)+dir->lrc*0x60+dir->extnoh; + modified=(dir->blkcnt+(dir->pointers[0]<<8))*(0x60*0x60)+dir->pointers[1]*0x60+dir->pointers[2]; + if (sb->cnotatime && modifieddir[extent2=(extent&~3)+2].status)>=0 && s<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* time stamps for third */ /*{{{*/ + { + bcdCheck(dir->pointers[7],24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent2); + bcdCheck(dir->pointers[8],60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent2); + bcdCheck(dir->pointers[11],24,"modification date","hour",extent,extent2); + bcdCheck(dir->pointers[12],60,"modification date","minute",extent,extent2); + created=(dir->pointers[5]+(dir->pointers[6]<<8))*(0x60*0x60)+dir->pointers[7]*0x60+dir->pointers[8]; + modified=(dir->pointers[9]+(dir->pointers[10]<<8))*(0x60*0x60)+dir->pointers[11]*0x60+dir->pointers[12]; + if (sb->cnotatime && modifiedtype==CPMFS_DR3 && *status==32) /* disc label */ /*{{{*/ + { + unsigned long created,modified; + + bcdCheck(dir->pointers[10],24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent); + bcdCheck(dir->pointers[11],60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent); + bcdCheck(dir->pointers[14],24,"modification date","hour",extent,extent); + bcdCheck(dir->pointers[15],60,"modification date","minute",extent,extent); + created=(dir->pointers[8]+(dir->pointers[9]<<8))*(0x60*0x60)+dir->pointers[10]*0x60+dir->pointers[11]; + modified=(dir->pointers[12]+(dir->pointers[13]<<8))*(0x60*0x60)+dir->pointers[14]*0x60+dir->pointers[15]; + if (sb->cnotatime && modifiedextnol&0x40 && dir->extnol&0x10) + { + printf("Error: Bit 4 and 6 can only be exclusively be set (extent=%d, label byte=0x%02x)\n",extent,(unsigned char)dir->extnol); + if (ask("Time stamp on creation")) + { + dir->extnol&=~0x40; + ret|=MODIFIED; + } + else if (ask("Time stamp on access")) + { + dir->extnol&=~0x10; + ret|=MODIFIED; + } + else ret|=BROKEN; + } + if (dir->extnol&0x80 && pwdCheck(extent,dir->pointers,dir->lrc)) + { + char msg[80]; + + sprintf(msg,"Set password to %c%c%c%c%c%c%c%c",T0,T1,T2,T3,T4,T5,T6,T7); + if (ask(msg)) + { + dir->pointers[0]=P0; + dir->pointers[1]=P1; + dir->pointers[2]=P2; + dir->pointers[3]=P3; + dir->pointers[4]=P4; + dir->pointers[5]=P5; + dir->pointers[6]=P6; + dir->pointers[7]=P7; + dir->lrc=PB; + ret|=MODIFIED; + } + else ret|=BROKEN; + } + } + /*}}}*/ + else if (sb->type==CPMFS_DR3 && *status>=16 && *status<=31) /* password */ /*{{{*/ + { + /* check name and extension */ /*{{{*/ + { + int i; + char *c; + + for (i=0; i<8; ++i) + { + c=&(dir->name[i]); + if (!ISFILECHAR(i,*c&0x7f) || islower(*c&0x7f)) + { + printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); + if (ask("Clear password entry")) + { + *status=(char)0xE5; + ret|=MODIFIED; + break; + } + else ret|=BROKEN; + } + } + if (*status==(char)0xe5) continue; + for (i=0; i<3; ++i) + { + c=&(dir->ext[i]); + if (!ISFILECHAR(1,*c&0x7f) || islower(*c&0x7f)) + { + printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); + if (ask("Clear password entry")) + { + *status=(char)0xE5; + ret|=MODIFIED; + break; + } + else ret|=BROKEN; + } + } + if (*status==(char)0xe5) continue; + } + /*}}}*/ + /* check password */ /*{{{*/ + if (dir->extnol&(0x80|0x40|0x20) && pwdCheck(extent,dir->pointers,dir->lrc)) + { + char msg[80]; + + sprintf(msg,"Set password to %c%c%c%c%c%c%c%c",T0,T1,T2,T3,T4,T5,T6,T7); + if (ask(msg)) + { + dir->pointers[0]=P0; + dir->pointers[1]=P1; + dir->pointers[2]=P2; + dir->pointers[3]=P3; + dir->pointers[4]=P4; + dir->pointers[5]=P5; + dir->pointers[6]=P6; + dir->pointers[7]=P7; + dir->lrc=PB; + ret|=MODIFIED; + } + else ret|=BROKEN; + } + /*}}}*/ + } + /*}}}*/ + else if (*status!=(char)0xe5) /* bad status */ /*{{{*/ + { + printf("Error: Bad status (extent=%d, name=\"%s\", status=0x%02x)\n",extent,prfile(sb,extent),*status&0xff); + if (ask("Clear entry")) + { + *status=(char)0xE5; + ret|=MODIFIED; + } + else ret|=BROKEN; + continue; + } + /*}}}*/ + } + /*}}}*/ + /* Phase 2: check extent connectivity */ /*{{{*/ + printf("Phase 2: check extent connectivity\n"); + /* check multiple allocated blocks */ /*{{{*/ + for (extent=0; extentmaxdir; ++extent) if ((dir=sb->dir+extent)->status>=0 && dir->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) + { + int i,j,block,block2; + + for (i=0; i<16; ++i) + { + block=dir->pointers[i]&0xff; + if (sb->size>=256) block+=(dir->pointers[++i]&0xff)<<8; + for (extent2=0; extent2maxdir; ++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 (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)); + printf(",\"%s\" block=%d)\n",prfile(sb,extent2),block); + ret|=BROKEN; + } + } + } + } + } + /*}}}*/ + /* check multiple extents */ /*{{{*/ + for (extent=0; extentmaxdir; ++extent) if ((dir=sb->dir+extent)->status>=0 && dir->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) + { + for (extent2=0; extent2maxdir; ++extent2) if ((dir2=sb->dir+extent2)->status>=0 && dir2->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) + { + if (extent!=extent2 && EXTENT(dir->extnol,dir->extnoh)==EXTENT(dir2->extnol,dir2->extnoh) && dir->status==dir2->status) + { + int i; + + for (i=0; i<8 && (dir->name[i]&0x7f)==(dir2->name[i]&0x7f); ++i); + if (i==8) + { + for (i=0; i<3 && (dir->ext[i]&0x7f)==(dir2->ext[i]&0x7f); ++i); + if (i==3) + { + printf("Error: Duplicate extent (extent=%d,%d)\n",extent,extent2); + ret|=BROKEN; + } + } + } + } + } + /*}}}*/ + /*}}}*/ + if (ret==0) /* print statistics */ /*{{{*/ + { + struct cpmStatFS statfsbuf; + int fragmented=0,borders=0; + + cpmStatFS(root,&statfsbuf); + for (extent=0; extentmaxdir; ++extent) if ((dir=sb->dir+extent)->status>=0 && dir->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) + { + int i,block,previous=-1; + + for (i=0; i<16; ++i) + { + block=dir->pointers[i]&0xff; + if (sb->size>=256) block+=(dir->pointers[++i]&0xff)<<8; + if (previous!=-1) + { + if (block!=0 && block!=(previous+1)) ++fragmented; + ++borders; + } + previous=block; + } + } + fragmented=(borders ? (1000*fragmented)/borders : 0); + printf("%s: %ld/%ld files (%d.%d%% non-contigous), %ld/%ld blocks\n",image,statfsbuf.f_files-statfsbuf.f_ffree,statfsbuf.f_files,fragmented/10,fragmented%10,statfsbuf.f_blocks-statfsbuf.f_bfree,statfsbuf.f_blocks); + } + /*}}}*/ + return ret; +} +/*}}}*/ + +const char cmd[]="fsck.cpm"; + +/* main */ /*{{{*/ +int main(int argc, char *argv[]) +{ + const char *err; + const char *image; + const char *format=FORMAT; + const char *devopts=NULL; + int c,usage=0; + struct cpmSuperBlock sb; + struct cpmInode root; + enum Result ret; + + while ((c=getopt(argc,argv,"T:f:nh?"))!=EOF) switch(c) + { + case 'f': format=optarg; break; + case 'T': devopts=optarg; break; + case 'n': norepair=1; break; + case 'h': + case '?': usage=1; break; + } + + if (optind!=(argc-1)) usage=1; + else image=argv[optind]; + + if (usage) + { + fprintf(stderr,"Usage: %s [-f format] [-n] image\n",cmd); + exit(1); + } + if ((err=Device_open(&sb.dev, image, (norepair ? O_RDONLY : O_RDWR), devopts))) + { + if ((err=Device_open(&sb.dev, image,O_RDONLY, devopts))) + { + fprintf(stderr,"%s: can not open %s: %s\n",cmd,image,err); + exit(1); + } + else + { + fprintf(stderr,"%s: can not open %s for writing, no repair possible\n",cmd,image); + } + } + cpmReadSuper(&sb,&root,format); + ret=fsck(&root,image); + if (ret&MODIFIED) + { + if (cpmSync(&sb)==-1) + { + fprintf(stderr,"%s: write error on %s: %s\n",cmd,image,strerror(errno)); + ret|=BROKEN; + } + fprintf(stderr,"%s: FILE SYSTEM ON %s MODIFIED",cmd,image); + if (ret&BROKEN) fprintf(stderr,", PLEASE CHECK AGAIN"); + fprintf(stderr,"\n"); + } + cpmUmount(&sb); + if (ret&BROKEN) return 2; + else return 0; +} +/*}}}*/ diff --git a/fsed.cpm.1.in b/fsed.cpm.1.in new file mode 100644 index 0000000..230b84e --- /dev/null +++ b/fsed.cpm.1.in @@ -0,0 +1,56 @@ +.TH FSED.CPM 1 "@UPDATED@" "CP/M tools" "User commands" +.SH NAME ..\"{{{roff}}}\"{{{ +fsed.cpm \- edit a CP/M file system +.\"}}} +.SH SYNOPSIS .\"{{{ +.ad l +.B fsed.cpm +.RB [ \-f +.IR format ] +.I image +.ad b +.\"}}} +.SH DESCRIPTION .\"{{{ +\fBfsed.cpm\fP edits a CP/M file system on an image file or device. +It knows about the system, directory and data area, using sector skew on +the last two. Directory entries are decoded. The interactive usage is +self-explanatory. +.\"}}} +.SH OPTIONS .\"{{{ +.IP "\fB\-f\fP \fIformat\fP" +Use the given CP/M disk \fIformat\fP instead of the default format. +.\"}}} +.SH "RETURN VALUE" .\"{{{ +Upon successful completion, exit code 0 is returned. +.\"}}} +.SH ERRORS .\"{{{ +Any errors are indicated by exit code 1. +.\"}}} +.SH FILES .\"{{{ +@DATADIR@/diskdefs CP/M disk format definitions +.\"}}} +.SH AUTHORS \"{{{ +This program is copyright 1997, 1998, 1999, 2000, 2001 Michael Haardt +. The Windows port is copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" .\"{{{ +.IR fsck.cpm (1), +.IR mkfs.cpm (1), +.IR cpmls (1), +.IR cpm (5) +.\"}}} diff --git a/fsed.cpm.c b/fsed.cpm.c new file mode 100644 index 0000000..dfd9467 --- /dev/null +++ b/fsed.cpm.c @@ -0,0 +1,730 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "cpmfs.h" +/*}}}*/ + +extern char **environ; + +static char *mapbuf; + +static struct tm *cpmtime(char lday, char hday, char hour, char min) /*{{{*/ +{ + static struct tm tm; + unsigned long days=(lday&0xff)|((hday&0xff)<<8); + int d; + int md[12]={31,0,31,30,31,30,31,31,30,31,30,31}; + + tm.tm_sec=0; + tm.tm_min=((min>>4)&0xf)*10+(min&0xf); + tm.tm_hour=((hour>>4)&0xf)*10+(hour&0xf); + tm.tm_mon=0; + tm.tm_year=1978; + tm.tm_isdst=-1; + if (days) --days; + while (days>=(d=(((tm.tm_year%400)==0 || ((tm.tm_year%4)==0 && (tm.tm_year%100))) ? 366 : 365))) + { + days-=d; + ++tm.tm_year; + } + md[1]=((tm.tm_year%400)==0 || ((tm.tm_year%4)==0 && (tm.tm_year%100))) ? 29 : 28; + while (days>=md[tm.tm_mon]) + { + days-=md[tm.tm_mon]; + ++tm.tm_mon; + } + tm.tm_mday=days+1; + tm.tm_year-=1900; + return &tm; +} +/*}}}*/ +static void info(struct cpmSuperBlock *sb, const char *format, const char *image) /*{{{*/ +{ + const char *msg; + + 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: "); + 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; + } + + 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); + + 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); + + msg="Any key to continue"; + move(23,(COLS-strlen(msg))/2); printw(msg); + getch(); +} +/*}}}*/ +static void map(struct cpmSuperBlock *sb) /*{{{*/ +{ + const char *msg; + char bmap[18*80]; + int secmap,pos,system,directory; + + clear(); + msg="Data map"; + move(0,(COLS-strlen(msg))/2); printw(msg); + + secmap=(sb->tracks*sb->sectrk+80*18-1)/(80*18); + memset(bmap,' ',sizeof(bmap)); + system=sb->boottrk*sb->sectrk; + memset(bmap,'S',system/secmap); + directory=(sb->maxdir*32+sb->secLength-1)/sb->secLength; + memset(bmap+system/secmap,'D',directory/secmap); + memset(bmap+(system+directory)/secmap,'.',sb->sectrk*sb->tracks/secmap); + + for (pos=0; pos<(sb->maxdir*32+sb->secLength-1)/sb->secLength; ++pos) + { + int entry; + + Device_readSector(&sb->dev,sb->boottrk+pos/(sb->sectrk*sb->secLength),pos/sb->secLength,mapbuf); + for (entry=0; entrysecLength/32 && (pos*sb->secLength/32)+entrymaxdir; ++entry) + { + int i; + + if (mapbuf[entry*32]>=0 && mapbuf[entry*32]<=(sb->type==CPMFS_P2DOS ? 31 : 15)) + { + for (i=0; i<16; ++i) + { + unsigned int sector; + + sector=mapbuf[entry*32+16+i]&0xff; + 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 */ + sector=sector*(sb->blksiz/sb->secLength)+sb->sectrk*sb->boottrk; + memset(bmap+sector/secmap,'#',sb->blksiz/(sb->secLength*secmap)); + } + } + } + } + } + + for (pos=0; possecLength)&~0x7f; + int i; + + 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); + } + move(4+((pos&0x7f)>>4),((pos&0x7f)&0x0f)*3+!!((pos&0x7f)&0x8)+1); +} +/*}}}*/ + +const char cmd[]="fsed.cpm"; + +int main(int argc, char *argv[]) /*{{{*/ +{ + /* variables */ /*{{{*/ + const char *devopts=(const char*)0; + char *image; + const char *err; + struct cpmSuperBlock drive; + struct cpmInode root; + const char *format=FORMAT; + int c,usage=0; + unsigned long pos; + chtype ch; + int reload; + char *buf; + /*}}}*/ + + /* parse options */ /*{{{*/ + while ((c=getopt(argc,argv,"f:h?"))!=EOF) switch(c) + { + case 'f': format=optarg; break; + case 'T': devopts=optarg; break; + case 'h': + case '?': usage=1; break; + } + + if (optind!=(argc-1)) usage=1; + else image=argv[optind]; + + if (usage) + { + fprintf(stderr,"Usage: fsed.cpm [-f format] image\n"); + exit(1); + } + /*}}}*/ + /* open image */ /*{{{*/ + if ((err=Device_open(&drive.dev,image,O_RDONLY,devopts))) + { + fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + exit(1); + } + cpmReadSuper(&drive,&root,format); + /*}}}*/ + /* alloc sector buffers */ /*{{{*/ + if ((buf=malloc(drive.secLength))==(char*)0 || (mapbuf=malloc(drive.secLength))==(char*)0) + { + fprintf(stderr,"fsed.cpm: can not allocate sector buffer (%s).\n",strerror(errno)); + exit(1); + } + /*}}}*/ + /* init curses */ /*{{{*/ + initscr(); + noecho(); + raw(); + nonl(); + idlok(stdscr,TRUE); + idcok(stdscr,TRUE); + keypad(stdscr,TRUE); + clear(); + /*}}}*/ + + pos=0; + reload=1; + do + { + /* display position and load data */ /*{{{*/ + clear(); + move(2,0); printw("Byte %8d (0x%08x) ",pos,pos); + if (pos<(drive.boottrk*drive.sectrk*drive.secLength)) + { + printw("Physical sector %3d ",((pos/drive.secLength)%drive.sectrk)+1); + } + else + { + printw("Sector %3d ",((pos/drive.secLength)%drive.sectrk)+1); + printw("(physical %3d) ",drive.skewtab[(pos/drive.secLength)%drive.sectrk]+1); + } + printw("Offset %5d ",pos%drive.secLength); + printw("Track %5d",pos/(drive.secLength*drive.sectrk)); + move(LINES-3,0); printw("N)ext track P)revious track"); + move(LINES-2,0); printw("n)ext record n)revious record f)orward byte b)ackward byte"); + move(LINES-1,0); printw("i)nfo q)uit"); + if (reload) + { + const char *err; + + if (pos<(drive.boottrk*drive.sectrk*drive.secLength)) + { + err=Device_readSector(&drive.dev,pos/(drive.secLength*drive.sectrk),(pos/drive.secLength)%drive.sectrk,buf); + } + else + { + err=Device_readSector(&drive.dev,pos/(drive.secLength*drive.sectrk),drive.skewtab[(pos/drive.secLength)%drive.sectrk],buf); + } + if (err) + { + move(4,0); printw("Data can not be read: %s",err); + } + else reload=0; + } + /*}}}*/ + + if /* position before end of system area */ /*{{{*/ + (pos<(drive.boottrk*drive.sectrk*drive.secLength)) + { + 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"); + if (!reload) data(&drive,buf,pos); + switch (ch=getch()) + { + case 'F': /* next 16 byte */ /*{{{*/ + { + if (pos+16<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + { + if (pos/drive.secLength!=(pos+16)/drive.secLength) reload=1; + pos+=16; + } + break; + } + /*}}}*/ + case 'B': /* previous 16 byte */ /*{{{*/ + { + if (pos>=16) + { + if (pos/drive.secLength!=(pos-16)/drive.secLength) reload=1; + pos-=16; + } + break; + } + /*}}}*/ + } + } + /*}}}*/ + else if /* position before end of directory area */ /*{{{*/ + (pos<(drive.boottrk*drive.sectrk*drive.secLength+drive.maxdir*32)) + { + const char *msg; + unsigned long entrystart=(pos&~0x1f)%drive.secLength; + 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"); + + move(13,0); printw("Entry %3d: ",entry); + if /* free or used directory entry */ /*{{{*/ + ((buf[entrystart]>=0 && buf[entrystart]<=(drive.type==CPMFS_P2DOS ? 31 : 15)) || buf[entrystart]==(char)0xe5) + { + int i; + + if (buf[entrystart]==(char)0xe5) + { + if (offset==0) attron(A_REVERSE); + printw("Free"); + attroff(A_REVERSE); + } + else printw("Directory entry"); + move(15,0); + if (buf[entrystart]!=(char)0xe5) + { + printw("User: "); + if (offset==0) attron(A_REVERSE); + printw("%2d",buf[entrystart]); + attroff(A_REVERSE); + printw(" "); + } + printw("Name: "); + for (i=0; i<8; ++i) + { + if (offset==1+i) attron(A_REVERSE); + printw("%c",buf[entrystart+1+i]&0x7f); + attroff(A_REVERSE); + } + printw(" Extension: "); + for (i=0; i<3; ++i) + { + if (offset==9+i) attron(A_REVERSE); + printw("%c",buf[entrystart+9+i]&0x7f); + attroff(A_REVERSE); + } + 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:"); + for (i=0; i<16; ++i) + { + unsigned int block=buf[entrystart+16+i]&0xff; + 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); + } + else + { + printw(" "); + if (offset==16+i) attron(A_REVERSE); + printw("%3d",block); + attroff(A_REVERSE); + } + } + } + /*}}}*/ + else if /* disc label */ /*{{{*/ + (buf[entrystart]==0x20 && drive.type==CPMFS_DR3) + { + int i; + const struct tm *tm; + char s[30]; + + if (offset==0) attron(A_REVERSE); + printw("Disc label"); + attroff(A_REVERSE); + move(15,0); + printw("Label: "); + for (i=0; i<11; ++i) + { + if (i+1==offset) attron(A_REVERSE); + printw("%c",buf[entrystart+1+i]&0x7f); + attroff(A_REVERSE); + } + 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: "); + for (i=0; i<8; ++i) + { + char c; + + if (offset==16+(7-i)) attron(A_REVERSE); + c=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; + printw("%c",isprint(c) ? c : ' '); + attroff(A_REVERSE); + } + printw(" XOR value: "); + if (offset==13) attron(A_REVERSE); + printw("0x%02x",buf[entrystart+13]&0xff); + attroff(A_REVERSE); + move(19,0); + printw("Created: "); + tm=cpmtime(buf[entrystart+24],buf[entrystart+25],buf[entrystart+26],buf[entrystart+27]); + if (offset==24 || offset==25) attron(A_REVERSE); + 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: "); + tm=cpmtime(buf[entrystart+28],buf[entrystart+29],buf[entrystart+30],buf[entrystart+31]); + if (offset==28 || offset==29) attron(A_REVERSE); + 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); + } + /*}}}*/ + else if /* time stamp */ /*{{{*/ + (buf[entrystart]==0x21 && (drive.type==CPMFS_P2DOS || drive.type==CPMFS_DR3)) + { + 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 "); + tm=cpmtime(buf[entrystart+1],buf[entrystart+2],buf[entrystart+3],buf[entrystart+4]); + if (offset==1 || offset==2) attron(A_REVERSE); + 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 "); + tm=cpmtime(buf[entrystart+5],buf[entrystart+6],buf[entrystart+7],buf[entrystart+8]); + if (offset==5 || offset==6) attron(A_REVERSE); + 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 "); + tm=cpmtime(buf[entrystart+11],buf[entrystart+12],buf[entrystart+13],buf[entrystart+14]); + if (offset==11 || offset==12) attron(A_REVERSE); + 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 "); + tm=cpmtime(buf[entrystart+15],buf[entrystart+16],buf[entrystart+17],buf[entrystart+18]); + if (offset==15 || offset==16) attron(A_REVERSE); + 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 "); + tm=cpmtime(buf[entrystart+21],buf[entrystart+22],buf[entrystart+23],buf[entrystart+24]); + if (offset==21 || offset==22) attron(A_REVERSE); + 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 "); + tm=cpmtime(buf[entrystart+25],buf[entrystart+26],buf[entrystart+27],buf[entrystart+28]); + if (offset==25 || offset==26) attron(A_REVERSE); + 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); + } + /*}}}*/ + else if /* password */ /*{{{*/ + (buf[entrystart]>=16 && buf[entrystart]<=31 && drive.type==CPMFS_DR3) + { + int i; + + if (offset==0) attron(A_REVERSE); + printw("Password"); + attroff(A_REVERSE); + + move(15,0); + printw("Name: "); + for (i=0; i<8; ++i) + { + if (offset==1+i) attron(A_REVERSE); + printw("%c",buf[entrystart+1+i]&0x7f); + attroff(A_REVERSE); + } + printw(" Extension: "); + for (i=0; i<3; ++i) + { + if (offset==9+i) attron(A_REVERSE); + printw("%c",buf[entrystart+9+i]&0x7f); + attroff(A_REVERSE); + } + + 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); + + move(17,0); + printw("Password: "); + for (i=0; i<8; ++i) + { + char c; + + if (offset==16+(7-i)) attron(A_REVERSE); + c=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; + printw("%c",isprint(c) ? c : ' '); + attroff(A_REVERSE); + } + printw(" XOR value: "); + if (offset==13) attron(A_REVERSE); + printw("0x%02x",buf[entrystart+13]&0xff); + attroff(A_REVERSE); + } + /*}}}*/ + else /* bad status */ /*{{{*/ + { + printw("Bad status "); + if (offset==0) attron(A_REVERSE); + printw("0x%02x",buf[entrystart]); + attroff(A_REVERSE); + } + /*}}}*/ + if (!reload) data(&drive,buf,pos); + switch (ch=getch()) + { + case 'F': /* next entry */ /*{{{*/ + { + if (pos+32<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + { + if (pos/drive.secLength!=(pos+32)/drive.secLength) reload=1; + pos+=32; + } + break; + } + /*}}}*/ + case 'B': /* previous entry */ /*{{{*/ + { + if (pos>=32) + { + if (pos/drive.secLength!=(pos-32)/drive.secLength) reload=1; + pos-=32; + } + break; + } + /*}}}*/ + } + } + /*}}}*/ + else /* data area */ /*{{{*/ + { + const char *msg; + + msg="Data area"; move(0,(COLS-strlen(msg))/2); printw(msg); + if (!reload) data(&drive,buf,pos); + ch=getch(); + } + /*}}}*/ + + /* process common commands */ /*{{{*/ + switch (ch) + { + case 'n': /* next record */ /*{{{*/ + { + if (pos+128<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + { + if (pos/drive.secLength!=(pos+128)/drive.secLength) reload=1; + pos+=128; + } + break; + } + /*}}}*/ + case 'p': /* previous record */ /*{{{*/ + { + if (pos>=128) + { + if (pos/drive.secLength!=(pos-128)/drive.secLength) reload=1; + pos-=128; + } + break; + } + /*}}}*/ + case 'N': /* next track */ /*{{{*/ + { + if ((pos+drive.sectrk*drive.secLength)<(drive.sectrk*drive.tracks*drive.secLength)) + { + pos+=drive.sectrk*drive.secLength; + reload=1; + } + break; + } + /*}}}*/ + case 'P': /* previous track */ /*{{{*/ + { + if (pos>drive.sectrk*drive.secLength) + { + pos-=drive.sectrk*drive.secLength; + reload=1; + } + break; + } + /*}}}*/ + case 'b': /* byte back */ /*{{{*/ + { + if (pos) + { + if (pos/drive.secLength!=(pos-1)/drive.secLength) reload=1; + --pos; + } + break; + } + /*}}}*/ + case 'f': /* byte forward */ /*{{{*/ + { + if (pos+1. + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include +#include +#endif /* GNU C library. */ + +#ifdef VMS +#include +#if HAVE_STRING_H - 0 +#include +#endif +#endif + +#if defined (WINDOWS32) && !defined (__CYGWIN32__) +/* It's not Unix, really. See? Capital letters. */ +#include +#define getpid() GetCurrentProcessId() +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +#ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include +#define my_index strchr +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +extern pid_t __libc_pid; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +text_set_element (__libc_subinit, store_args_and_env); + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined (__STDC__) && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len); + memset (&new_str[nonoption_flags_max_len], '\0', + top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined (__STDC__) && __STDC__ +static const char *_getopt_initialize (int, char *const *, const char *); +#endif +static const char * +_getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + { + memcpy (__getopt_nonoption_flags, orig_str, len); + memset (&__getopt_nonoption_flags[len], '\0', + nonoption_flags_max_len - len); + } + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0 || !__getopt_initialized) + { + if (optind == 0) + optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring); + __getopt_initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) +#else +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/getopt.h b/getopt.h new file mode 100644 index 0000000..f994e58 --- /dev/null +++ b/getopt.h @@ -0,0 +1,133 @@ +/* Declarations for getopt. + Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@gnu.org. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +/* extern int getopt (); */ +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/getopt1.c b/getopt1.c new file mode 100644 index 0000000..a91c423 --- /dev/null +++ b/getopt1.c @@ -0,0 +1,189 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@gnu.org. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "getopt.h" + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/makefile.nt b/makefile.nt new file mode 100644 index 0000000..816c592 --- /dev/null +++ b/makefile.nt @@ -0,0 +1,89 @@ +# +# Makefile for cpmtools, using MS Visual C++ 6.x command-line tools +# +CC= cl +DISKDEFS= c:/cpm/etc/diskdefs +CPPFLAGS= /DDISKDEFS=\"$(DISKDEFS)\" /DFORMAT=\"ibm-3740\" +# +# Note: The "/Zp1" (pack structures on 1-byte boundaries) is important. +# +CFLAGS= /Zp1 /WX /W3 $(CPPFLAGS) +LDFLAGS= +#LDFLAGS= -g -L/usr/dmalloc/lib +LIBCURSES= -lcurses +LIBS= getopt.obj +#LIBS= -ldmalloc +MAKEDEPEND= mkdep -d +#MAKEDEPEND= gcc -MM +#MAKEDEPEND= makedepend -f- +BINDIR= /usr/cpm/bin +MANDIR= /usr/cpm/man/en +OSDEPEND= os_win32.obj +#OSDEPEND= os_unix.obj # Can be used if you don't want direct + # floppy support + +ALL= cpmls.exe cpmrm.exe cpmcp.exe mkfs.cpm.exe fsck.cpm.exe \ + # fsed.cpm.exe + +all: $(ALL) + +cpmls.exe: cpmls.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmls.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmrm.exe: cpmrm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmrm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +cpmcp.exe: cpmcp.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ cpmcp.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +mkfs.cpm.exe: mkfs.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ mkfs.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +fsck.cpm.exe: fsck.cpm.obj cpmfs.obj $(OSDEPEND) getopt.obj + $(CC) $(LDFLAGS) -o $@ fsck.cpm.obj cpmfs.obj $(OSDEPEND) $(LIBS) + +fsed.cpm.exe: fsed.cpm.obj getopt.obj + $(CC) $(LDFLAGS) -o $@ fsed.cpm.obj $(LIBCURSES) $(LIBS) + +fsck.test: fsck.cpm.exe + -.\\fsck.cpm.exe -n badfs/status + -.\\fsck.cpm.exe -n badfs/extno + -.\\fsck.cpm.exe -n badfs/lcr + -.\\fsck.cpm.exe -n badfs/name + -.\\fsck.cpm.exe -n badfs/extension + -.\\fsck.cpm.exe -n badfs/blocknumber + -.\\fsck.cpm.exe -n badfs/recordcount + -.\\fsck.cpm.exe -n badfs/hugecom + -.\\fsck.cpm.exe -n badfs/timestamps + -.\\fsck.cpm.exe -n badfs/multipleblocks + -.\\fsck.cpm.exe -n badfs/doubleext + -.\\fsck.cpm.exe -f pcw -n badfs/label + +install: all + install -c -s -m 755 cpmls $(BINDIR)/cpmls + install -c -s -m 755 cpmcp $(BINDIR)/cpmcp + install -c -s -m 755 cpmrm $(BINDIR)/cpmrm + install -c -s -m 755 mkfs.cpm $(BINDIR)/mkfs.cpm + install -c -s -m 755 fsck.cpm $(BINDIR)/fsck.cpm + install -c -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm + install -c -m 644 diskdefs $(DISKDEFS) + install -c -m 644 cpmls.1 $(MANDIR)/man1/cpmls.1 + install -c -m 644 cpmcp.1 $(MANDIR)/man1/cpmcp.1 + install -c -m 644 cpmrm.1 $(MANDIR)/man1/cpmrm.1 + install -c -m 644 mkfs.cpm.1 $(MANDIR)/man1/mkfs.cpm.1 + install -c -m 644 fsck.cpm.1 $(MANDIR)/man1/fsck.cpm.1 + install -c -m 644 fsed.cpm.1 $(MANDIR)/man1/fsed.cpm.1 + +clean: + rm -f *.obj + +clobber: clean + rm -f $(ALL) *.out + +tar: clobber + (b=`pwd`; b=`basename $$b`; cd ..; tar zcvf $$b.tar.gz $$b) + +depend: + $(MAKEDEPEND) $(CPPFLAGS) *.c >.depend + +include .depend diff --git a/mkfs.cpm.1.in b/mkfs.cpm.1.in new file mode 100644 index 0000000..7b9dce6 --- /dev/null +++ b/mkfs.cpm.1.in @@ -0,0 +1,64 @@ +.TH MKFS.CPM 1 "@UPDATED@" "CP/M tools" "User commands" +.SH NAME \"{{{roff}}}\"{{{ +mkfs.cpm \- make a CP/M file system +.\"}}} +.SH SYNOPSIS \"{{{ +.ad l +.B mkfs.cpm +.RB [ \-f +.IR format ] +.RB [ \-b +.IR boot ] +.RB [ \-L +.IR label ] +.I image +.ad b +.\"}}} +.SH DESCRIPTION \"{{{ +\fBmkfs.cpm\fP makes a CP/M file system on an image file or device. +.\"}}} +.SH OPTIONS \"{{{ +.IP "\fB\-f\fP \fIformat\fP" +Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-b\fP \fIbootblock\fP" +Write the contents of the file \fIbootblock\fP to the system tracks +instead of filling them with 0xe5. This option can be used up to four +times. The file contents (typically boot block, CCP, BDOS and BIOS) +are written to sequential sectors, padding with 0xe5 if needed. +.IP "\fB\-L\fP \fIlabel\fP" +Label the file system. This is only supported by CP/M Plus. +.\"}}} +.SH "RETURN VALUE" \"{{{ +Upon successful completion, exit code 0 is returned. +.\"}}} +.SH ERRORS \"{{{ +Any errors are indicated by exit code 1. +.\"}}} +.SH FILES \"{{{ +@DATADIR@/diskdefs CP/M disk format definitions +.\"}}} +.SH AUTHORS \"{{{ +This program is copyright 1997, 1998, 1999, 2000, 2001 Michael Haardt +. The Windows port is copyright 2000, 2001 John Elliott +. +.PP +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +.PP +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. +.PP +You should have received a copy of the GNU General Public License along +with this program. If not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.\"}}} +.SH "SEE ALSO" \"{{{ +.IR fsck.cpm (1), +.IR cpmls (1), +.IR mkfs (1), +.IR cpm (5) +.\"}}} diff --git a/mkfs.cpm.c b/mkfs.cpm.c new file mode 100644 index 0000000..e15c36d --- /dev/null +++ b/mkfs.cpm.c @@ -0,0 +1,173 @@ +/* #includes */ /*{{{C}}}*//*{{{*/ +#include +#include +#include +#include +#include +#include "config.h" + +extern char *optarg; +extern int optind,opterr,optopt; +int getopt(int argc, char * const *argv, const char *optstring); + +#include "cpmfs.h" +/*}}}*/ +/* #defines */ /*{{{*/ +#ifndef O_BINARY +#define O_BINARY 0 +#endif +/*}}}*/ + +/* mkfs -- make file system */ /*{{{*/ +static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *label, char *bootTracks) +{ + /* variables */ /*{{{*/ + int i; + char buf[128]; + char firstbuf[128]; + int fd; + int bytes; + int trkbytes; + /*}}}*/ + + /* open image file */ /*{{{*/ + if ((fd = open(name, O_BINARY|O_CREAT|O_WRONLY, 0666)) < 0) + { + boo=strerror(errno); + return -1; + } + /*}}}*/ + /* write system tracks */ /*{{{*/ + /* this initialises only whole tracks, so it skew is not an issue */ + trkbytes=drive->secLength*drive->sectrk; + for (i=0; iboottrk; i+=drive->secLength) if (write(fd, bootTracks+i, drive->secLength)!=drive->secLength) + { + boo=strerror(errno); + close(fd); + return -1; + } + /*}}}*/ + /* write directory */ /*{{{*/ + memset(buf,0xe5,128); + bytes=drive->maxdir*32; + if (bytes%trkbytes) bytes=((bytes+trkbytes)/trkbytes)*trkbytes; + if (drive->type==CPMFS_P2DOS || drive->type==CPMFS_DR3) buf[3*32]=0x21; + memcpy(firstbuf,buf,128); + if (drive->type==CPMFS_DR3) + { + time_t now; + struct tm *t; + int min,hour,days; + + firstbuf[0]=0x20; + for (i=0; i<11 && *label; ++i,++label) firstbuf[1+i]=toupper(*label&0x7f); + while (i<11) firstbuf[1+i++]=' '; + firstbuf[12]=0x11; /* label set and first time stamp is creation date */ + memset(&firstbuf[13],0,1+2+8); + time(&now); + t=localtime(&now); + min=((t->tm_min/10)<<4)|(t->tm_min%10); + hour=((t->tm_hour/10)<<4)|(t->tm_hour%10); + for (i=1978,days=0; i < 1900 + t->tm_year; ++i) + { + days+=365; + if (i%4==0 && (i%100!=0 || i%400==0)) ++days; + } + days += t->tm_yday + 1; + firstbuf[24]=firstbuf[28]=days&0xff; firstbuf[25]=firstbuf[29]=days>>8; + firstbuf[26]=firstbuf[30]=hour; + firstbuf[27]=firstbuf[31]=min; + } + for (i=0; i < bytes; i += 128) if (write(fd, i==0 ? firstbuf : buf, 128)!=128) + { + boo=strerror(errno); + close(fd); + return -1; + } + /*}}}*/ + /* close image file */ /*{{{*/ + if (close(fd)==-1) + { + boo=strerror(errno); + return -1; + } + /*}}}*/ + return 0; +} +/*}}}*/ + +const char cmd[]="mkfs.cpm"; + +int main(int argc, char *argv[]) /*{{{*/ +{ + char *image; + const char *format=FORMAT; + int c,usage=0; + struct cpmSuperBlock drive; + struct cpmInode root; + const char *label="unlabeled"; + size_t bootTrackSize,used; + char *bootTracks; + const char *boot[4]={(const char*)0,(const char*)0,(const char*)0,(const char*)0}; + + while ((c=getopt(argc,argv,"b:f:L:h?"))!=EOF) switch(c) + { + case 'b': + { + if (boot[0]==(const char*)0) boot[0]=optarg; + else if (boot[1]==(const char*)0) boot[1]=optarg; + else if (boot[2]==(const char*)0) boot[2]=optarg; + else if (boot[3]==(const char*)0) boot[3]=optarg; + else usage=1; + break; + } + case 'f': format=optarg; break; + case 'L': label=optarg; break; + case 'h': + case '?': usage=1; break; + } + + if (optind!=(argc-1)) usage=1; + else image=argv[optind]; + + if (usage) + { + fprintf(stderr,"Usage: %s [-f format] [-b boot] [-L label] image\n",cmd); + exit(1); + } + drive.dev.opened=0; + cpmReadSuper(&drive,&root,format); + bootTrackSize=drive.boottrk*drive.secLength*drive.sectrk; + if ((bootTracks=malloc(bootTrackSize))==(void*)0) + { + fprintf(stderr,"%s: can not allocate boot track buffer: %s\n",cmd,strerror(errno)); + exit(1); + } + memset(bootTracks,0xe5,bootTrackSize); + used=0; + for (c=0; c<4 && boot[c]; ++c) + { + int fd; + size_t size; + + if ((fd=open(boot[c],O_BINARY|O_RDONLY))==-1) + { + fprintf(stderr,"%s: can not open %s: %s\n",cmd,boot[c],strerror(errno)); + exit(1); + } + size=read(fd,bootTracks+used,bootTrackSize-used); +#if 0 + fprintf(stderr,"%d %04x %s\n",c,used+0x800,boot[c]); +#endif + if (size%drive.secLength) size=(size|(drive.secLength-1))+1; + used+=size; + close(fd); + } + if (mkfs(&drive,image,label,bootTracks)==-1) + { + fprintf(stderr,"%s: can not make new file system: %s\n",cmd,boo); + exit(1); + } + else exit(0); +} +/*}}}*/ -- 2.30.2