From b1e873c5b2f6376bb39ff0fda1464cbbacbae5f7 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Mon, 12 Dec 2016 16:05:30 -0700 Subject: [PATCH] New upstream version 2.20 --- Makefile.in | 3 +- NEWS | 6 +- config.guess | 407 ++++++++++++++----------- config.h.in | 2 + config.sub | 162 ++++++---- configure | 336 +++++++++++---------- configure.in | 10 +- cpm.5 | 24 +- cpm.5.in | 22 +- cpmchattr.1 | 5 +- cpmchattr.1.in | 3 + cpmchattr.c | 12 +- cpmchmod.1 | 5 +- cpmchmod.1.in | 3 + cpmchmod.c | 8 +- cpmcp.1 | 5 +- cpmcp.1.in | 3 + cpmcp.c | 16 +- cpmfs.c | 143 ++++++--- cpmfs.h | 5 +- cpmls.1 | 9 +- cpmls.1.in | 7 +- cpmls.c | 9 +- cpmrm.1 | 5 +- cpmrm.1.in | 3 + cpmrm.c | 8 +- device.h | 2 +- device_libdsk.c | 64 +++- device_posix.c | 6 +- device_win32.c | 7 +- diskdefs | 776 +++++++++++++++++++++++++++++++++++++++++++++++- fsck.cpm.1 | 5 +- fsck.cpm.1.in | 3 + fsck.cpm.c | 12 +- fsed.cpm.1 | 5 +- fsed.cpm.1.in | 3 + fsed.cpm.c | 37 ++- install-sh | 29 +- mkfs.cpm.1 | 5 +- mkfs.cpm.1.in | 3 + mkfs.cpm.c | 102 +++++-- 41 files changed, 1719 insertions(+), 561 deletions(-) diff --git a/Makefile.in b/Makefile.in index 679f13d..878de76 100644 --- a/Makefile.in +++ b/Makefile.in @@ -82,6 +82,7 @@ fsck.test: fsck.cpm install: all [ -d $(MANDIR)/man1 ] || $(INSTALL) -m 755 -d $(MANDIR)/man1 [ -d $(MANDIR)/man5 ] || $(INSTALL) -m 755 -d $(MANDIR)/man5 + [ -d $(BINDIR) ] || $(INSTALL) -m 755 -d $(BINDIR) $(INSTALL) -s -m 755 cpmls $(BINDIR)/cpmls $(INSTALL) -s -m 755 cpmcp $(BINDIR)/cpmcp $(INSTALL) -s -m 755 cpmrm $(BINDIR)/cpmrm @@ -89,7 +90,7 @@ install: all $(INSTALL) -s -m 755 cpmchattr $(BINDIR)/cpmchattr $(INSTALL) -s -m 755 mkfs.cpm $(BINDIR)/mkfs.cpm $(INSTALL) -s -m 755 fsck.cpm $(BINDIR)/fsck.cpm - [ "$(FSED_CPM)" != '' ] && $(INSTALL) -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm + [ "$(FSED_CPM)" == '' ] || $(INSTALL) -s -m 755 fsed.cpm $(BINDIR)/fsed.cpm $(INSTALL_DATA) diskdefs @datarootdir@/diskdefs $(INSTALL_DATA) cpmls.1 $(MANDIR)/man1/cpmls.1 $(INSTALL_DATA) cpmcp.1 $(MANDIR)/man1/cpmcp.1 diff --git a/NEWS b/NEWS index a98a886..ba446f1 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,3 @@ -Changes since 2.16: +Changes since 2.19: -o Improved filesystem documentation -o Many new diskdefs -o device_win32.c fixed by Bill Buckels +o Fixed bug in cpmfs leading to wrongly allocated blocks diff --git a/config.guess b/config.guess index 2852378..b79252d 100755 --- a/config.guess +++ b/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -# Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2010-08-21' +timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +15,22 @@ timestamp='2010-08-21' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# 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. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. +Copyright 1992-2013 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." @@ -92,7 +84,7 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' HUP INT TERM +trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -106,7 +98,7 @@ trap 'exit 1' HUP INT TERM set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || @@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -181,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -202,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -224,7 +241,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -270,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -296,12 +316,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -395,23 +415,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -481,8 +501,8 @@ EOF echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -495,7 +515,7 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -595,52 +615,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #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); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -731,22 +751,22 @@ EOF exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -770,14 +790,14 @@ EOF exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -789,30 +809,35 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; @@ -849,15 +874,22 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -867,52 +899,56 @@ EOF EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac + esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -931,54 +967,63 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -987,11 +1032,11 @@ EOF echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1023,7 +1068,7 @@ EOF fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1051,13 +1096,13 @@ EOF exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1092,8 +1137,8 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1136,10 +1181,10 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1165,11 +1210,11 @@ EOF exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1182,6 +1227,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1208,19 +1256,21 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1234,7 +1284,10 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1279,13 +1332,13 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1303,11 +1356,11 @@ EOF i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c < printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif diff --git a/config.h.in b/config.h.in index 0e05715..89d2d7b 100644 --- a/config.h.in +++ b/config.h.in @@ -7,6 +7,8 @@ #define HAVE_SYS_TYPES_H 0 #define HAVE_SYS_STAT_H 0 #define HAVE_MODE_T 0 +#define NEED_NCURSES 0 +#define HAVE_NCURSES_NCURSES_H 0 #if HAVE_SYS_STAT_H #include diff --git a/config.sub b/config.sub index 320e303..59bb593 100755 --- a/config.sub +++ b/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -# Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2010-09-11' +timestamp='2012-04-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,9 +21,7 @@ timestamp='2010-09-11' # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -76,8 +74,8 @@ version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +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." @@ -132,6 +130,10 @@ case $maybe_os in os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -158,8 +160,8 @@ case $os in os= basic_machine=$1 ;; - -bluegene*) - os=-cnk + -bluegene*) + os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= @@ -175,10 +177,10 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -223,6 +225,12 @@ case $os in -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -247,17 +255,22 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ @@ -286,22 +299,23 @@ case $basic_machine in | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ + | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | rx \ + | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ - | v850 | v850e \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; @@ -314,8 +328,7 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -325,6 +338,21 @@ case $basic_machine in basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -339,11 +367,13 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ @@ -352,8 +382,10 @@ case $basic_machine in | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ @@ -382,24 +414,26 @@ case $basic_machine in | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ + | tile*-* \ | tron-* \ | ubicom32-* \ - | v850-* | v850e-* | vax-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) @@ -424,7 +458,7 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -507,7 +541,7 @@ case $basic_machine in basic_machine=c90-cray os=-unicos ;; - cegcc) + cegcc) basic_machine=arm-unknown os=-cegcc ;; @@ -539,7 +573,7 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -697,7 +731,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -755,7 +788,7 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze) basic_machine=microblaze-xilinx ;; mingw32) @@ -794,10 +827,18 @@ case $basic_machine in ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i386-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -862,10 +903,10 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - neo-tandem) + neo-tandem) basic_machine=neo-tandem ;; - nse-tandem) + nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) @@ -950,9 +991,10 @@ case $basic_machine in ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -1046,6 +1088,9 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -1102,13 +1147,8 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1178,6 +1218,9 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1275,11 +1318,11 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux + -auroraux) + os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` @@ -1315,7 +1358,7 @@ case $os in | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ @@ -1364,7 +1407,7 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1413,7 +1456,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1458,8 +1501,8 @@ case $os in -dicos*) os=-dicos ;; - -nacl*) - ;; + -nacl*) + ;; -none) ;; *) @@ -1482,10 +1525,10 @@ else # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1497,8 +1540,8 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff ;; tic54x-*) os=-coff @@ -1527,14 +1570,11 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1561,7 +1601,7 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) diff --git a/configure b/configure index d4a7592..72495a1 100755 --- a/configure +++ b/configure @@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +132,31 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -212,21 +236,25 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -328,6 +356,14 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -449,6 +485,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -483,16 +523,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -504,28 +544,8 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1141,8 +1161,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1386,9 +1404,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1501,7 +1519,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1805,7 +1823,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2254,8 +2272,8 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -VERSION=2.17 -UPDATED='November 16, 2013' +VERSION=2.20 +UPDATED='October 25, 2014' DEVICE="posix" @@ -2292,7 +2310,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2332,7 +2350,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2385,7 +2403,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2426,7 +2444,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2484,7 +2502,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2528,7 +2546,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2974,8 +2992,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3097,7 +3114,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -3293,7 +3310,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$GCC" = yes then - CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common" + CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wno-unused-parameter -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common" LDFLAGS="${LDFLAGS} ${EXTRA_GLDFLAGS}-g" else CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}" @@ -3448,57 +3465,8 @@ else FSED_CPM= fi -fi - -if test "$LIBDSK" != ""; then - DEVICE="libdsk" - CPPFLAGS="$CPPFLAGS -I$LIBDSK/include" - CFLAGS="$CFLAGS -I$LIBDSK/include $CFLAGS_LIBDSK" - LDFLAGS="$LDFLAGS -L$LIBDSK/lib" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dsk_open in -ldsk" >&5 -$as_echo_n "checking for dsk_open in -ldsk... " >&6; } -if ${ac_cv_lib_dsk_dsk_open+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldsk $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dsk_open (); -int -main () -{ -return dsk_open (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dsk_dsk_open=yes -else - ac_cv_lib_dsk_dsk_open=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dsk_dsk_open" >&5 -$as_echo "$ac_cv_lib_dsk_dsk_open" >&6; } -if test "x$ac_cv_lib_dsk_dsk_open" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBDSK 1 -_ACEOF - - LIBS="-ldsk $LIBS" - -fi + if test x"$FSED_CPM" != x""; then + $as_echo "#define NEED_NCURSES 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 @@ -3517,7 +3485,7 @@ do for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3583,7 +3551,7 @@ do for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -3760,7 +3728,72 @@ fi done -for ac_header in libdsk.h +for ac_header in ncurses/ncurses.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_ncurses_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NCURSES_NCURSES_H 1 +_ACEOF + have_ncurses_ncurses_h=yes +fi + +done + + fi +fi + +if test "$LIBDSK" != ""; then + DEVICE="libdsk" + CPPFLAGS="$CPPFLAGS -I$LIBDSK/include" + CFLAGS="$CFLAGS -I$LIBDSK/include $CFLAGS_LIBDSK" + LDFLAGS="$LDFLAGS -L$LIBDSK/lib" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dsk_open in -ldsk" >&5 +$as_echo_n "checking for dsk_open in -ldsk... " >&6; } +if ${ac_cv_lib_dsk_dsk_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldsk $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dsk_open (); +int +main () +{ +return dsk_open (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dsk_dsk_open=yes +else + ac_cv_lib_dsk_dsk_open=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dsk_dsk_open" >&5 +$as_echo "$ac_cv_lib_dsk_dsk_open" >&6; } +if test "x$ac_cv_lib_dsk_dsk_open" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBDSK 1 +_ACEOF + + LIBS="-ldsk $LIBS" + +fi + + for ac_header in libdsk.h do : ac_fn_c_check_header_mongrel "$LINENO" "libdsk.h" "ac_cv_header_libdsk_h" "$ac_includes_default" if test "x$ac_cv_header_libdsk_h" = xyes; then : @@ -3948,11 +3981,11 @@ else int main () { -/* FIXME: Include the comments suggested by Paul. */ + #ifndef __cplusplus - /* Ultrix mips cc rejects this. */ + /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; - const charset cs; + const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; @@ -3969,8 +4002,9 @@ main () ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; @@ -3986,10 +4020,10 @@ main () iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this saying + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; @@ -4294,6 +4328,8 @@ _ACEOF esac rm -rf conftest* fi + + fi @@ -4849,16 +4885,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -4918,28 +4954,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4961,7 +4985,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5023,10 +5047,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5115,7 +5139,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff --git a/configure.in b/configure.in index 0632ff7..be9a55c 100644 --- a/configure.in +++ b/configure.in @@ -1,8 +1,8 @@ AC_INIT(cpmfs.c) AC_CONFIG_HEADER(config.h) AC_CANONICAL_HOST -VERSION=2.17 -UPDATED='November 16, 2013' +VERSION=2.20 +UPDATED='October 25, 2014' DEVICE="posix" @@ -23,7 +23,7 @@ AC_PROG_CPP if test "$GCC" = yes then - CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common" + CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wno-unused-parameter -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common" LDFLAGS="${LDFLAGS} ${EXTRA_GLDFLAGS}-g" else CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}" @@ -65,6 +65,10 @@ 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=) + if test x"$FSED_CPM" != x""; then + AC_DEFINE(NEED_NCURSES) + AC_CHECK_HEADERS(ncurses/ncurses.h,have_ncurses_ncurses_h=yes) + fi fi dnl If using libdsk, check it's available. diff --git a/cpm.5 b/cpm.5 index 684f5da..9f11ff9 100644 --- a/cpm.5 +++ b/cpm.5 @@ -1,7 +1,7 @@ .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en \(en -.TH CPM 5 "November 16, 2013" "CP/M tools" "File formats" +.TH CPM 5 "October 25, 2014" "CP/M tools" "File formats" .SH NAME \"{{{roff}}}\"{{{ cpm \- CP/M disk and file system format .\"}}} @@ -24,7 +24,8 @@ Logical sector skew .br Number of reserved system tracks (optional) .br -Offset to start of volume (optional) +Offset to start of volume (optional and not covered by operating system, +but disk driver specific) .sp .RE A block is the smallest allocatable storage unit. CP/M supports block @@ -34,10 +35,10 @@ 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: +A CP/M disk contains four areas: .RS .sp -Volume offset (optional) +Volume offset (optional and not covered by operating system, but disk driver specific) .br System tracks (optional) .br @@ -54,15 +55,15 @@ drive for the first time, CP/M builds this bitmap in core from the directory. .LP A hard disk can have the additional notion of a \fIvolume offset\fP to locate the start of the drive image (which may or may not have system -tracks associated with it). The base unit for volume offset is byte +tracks associated with it). The base unit for volume offset is byte count from the beginning of the physical disk, but specifiers of \fIK\fP, \fIM\fP, \fIT\fP or \fIS\fP may be appended to denote kilobytes, megabytes, tracks or sectors. If provided, a specifier must immediately follow the numeric value with no whitespace. For convenience upper and lower case are both accepted and only the first letter is significant, thus 2KB, 8MB, 1000trk and 16sec are valid -values. Offset must appear subsequent to track, sector and sector -length values. +values. The \fBoffset\fP must appear subsequent to track, sector and sector +length values for the sector and track units to work. .\"}}} .SS "Directory entries" \"{{{ The directory is a sequence of directory entries (also called extents), @@ -199,6 +200,7 @@ time stamp. 1 byte minute in BCD format .sp .RE +All time stamps are stored in local time. .\"}}} .SS "DateStamper time stamps" \"{{{ The DateStamper software added functions to the BDOS to manage @@ -214,11 +216,13 @@ following structure of 16 bytes: .br 5 bytes modify datefield .br -1 byte checksum +1 byte magic number/checksum .sp .RE -The checksum is only used on every 8th entry (last entry in 128-byte -record) and is the sum of the first 127 bytes of the record. +The magic number is used for the first 7 entries of each 128-byte record +and contains the characters \fB!\fP, \fB!\fP, \fB!\fP, \fBT\fP, \fBI\fP, +\fBM\fP and \fBE\fP. The checksum is used on every 8th entry (last entry +in 128-byte record) and is the sum of the first 127 bytes of the record. Each datefield has this structure: .RS .sp diff --git a/cpm.5.in b/cpm.5.in index ce7779d..5295621 100644 --- a/cpm.5.in +++ b/cpm.5.in @@ -24,7 +24,8 @@ Logical sector skew .br Number of reserved system tracks (optional) .br -Offset to start of volume (optional) +Offset to start of volume (optional and not covered by operating system, +but disk driver specific) .sp .RE A block is the smallest allocatable storage unit. CP/M supports block @@ -34,10 +35,10 @@ 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: +A CP/M disk contains four areas: .RS .sp -Volume offset (optional) +Volume offset (optional and not covered by operating system, but disk driver specific) .br System tracks (optional) .br @@ -54,15 +55,15 @@ drive for the first time, CP/M builds this bitmap in core from the directory. .LP A hard disk can have the additional notion of a \fIvolume offset\fP to locate the start of the drive image (which may or may not have system -tracks associated with it). The base unit for volume offset is byte +tracks associated with it). The base unit for volume offset is byte count from the beginning of the physical disk, but specifiers of \fIK\fP, \fIM\fP, \fIT\fP or \fIS\fP may be appended to denote kilobytes, megabytes, tracks or sectors. If provided, a specifier must immediately follow the numeric value with no whitespace. For convenience upper and lower case are both accepted and only the first letter is significant, thus 2KB, 8MB, 1000trk and 16sec are valid -values. Offset must appear subsequent to track, sector and sector -length values. +values. The \fBoffset\fP must appear subsequent to track, sector and sector +length values for the sector and track units to work. .\"}}} .SS "Directory entries" \"{{{ The directory is a sequence of directory entries (also called extents), @@ -199,6 +200,7 @@ time stamp. 1 byte minute in BCD format .sp .RE +All time stamps are stored in local time. .\"}}} .SS "DateStamper time stamps" \"{{{ The DateStamper software added functions to the BDOS to manage @@ -214,11 +216,13 @@ following structure of 16 bytes: .br 5 bytes modify datefield .br -1 byte checksum +1 byte magic number/checksum .sp .RE -The checksum is only used on every 8th entry (last entry in 128-byte -record) and is the sum of the first 127 bytes of the record. +The magic number is used for the first 7 entries of each 128-byte record +and contains the characters \fB!\fP, \fB!\fP, \fB!\fP, \fBT\fP, \fBI\fP, +\fBM\fP and \fBE\fP. The checksum is used on every 8th entry (last entry +in 128-byte record) and is the sum of the first 127 bytes of the record. Each datefield has this structure: .RS .sp diff --git a/cpmchattr.1 b/cpmchattr.1 index 1b9e6d4..f130d5c 100644 --- a/cpmchattr.1 +++ b/cpmchattr.1 @@ -1,4 +1,4 @@ -.TH CPMCHATTR 1 "November 16, 2013" "CP/M tools" "User commands" +.TH CPMCHATTR 1 "October 25, 2014" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmchattr \- change file attributes on CP/M files .\"}}} @@ -19,6 +19,9 @@ cpmchattr \- change file attributes on CP/M files .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .IP "\fIattrib\fP" Set the file attributes as given. .\"}}} diff --git a/cpmchattr.1.in b/cpmchattr.1.in index fcd12f8..b1690b0 100644 --- a/cpmchattr.1.in +++ b/cpmchattr.1.in @@ -19,6 +19,9 @@ cpmchattr \- change file attributes on CP/M files .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .IP "\fIattrib\fP" Set the file attributes as given. .\"}}} diff --git a/cpmchattr.c b/cpmchattr.c index dc55c33..be39130 100644 --- a/cpmchattr.c +++ b/cpmchattr.c @@ -57,10 +57,14 @@ int main(int argc, char *argv[]) /*{{{*/ /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev, image, O_RDWR, devopts))) { - fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); + exit(1); + } + if (cpmReadSuper(&drive,&root,format)==-1) + { + fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } - cpmReadSuper(&drive,&root,format); /*}}}*/ cpmglob(optind,argc,argv,&root,&gargc,&gargv); for (i=0; i #include #include -#include #include #include #include @@ -64,7 +63,7 @@ static int cpmToUnix(const struct cpmInode *root, const char *src, const char *d int res; char buf[4096]; - while ((res=cpmRead(&file,buf,sizeof(buf)))!=0) + while ((res=cpmRead(&file,buf,sizeof(buf)))>0) { int j; @@ -93,6 +92,7 @@ static int cpmToUnix(const struct cpmInode *root, const char *src, const char *d } } endwhile: + if (res==-1 && !ohno) { fprintf(stderr,"%s: can not read %s (%s)\n",cmd,src,boo); exitcode=1; ohno=1; } if (fclose(ufp)==EOF && !ohno) { fprintf(stderr,"%s: can not close %s: %s\n",cmd,dest,strerror(errno)); exitcode=1; ohno=1; } if (preserve && !ohno && (ino.atime || ino.mtime)) { @@ -178,10 +178,14 @@ int main(int argc, char *argv[]) /* 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); + fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); + exit(1); + } + if (cpmReadSuper(&super,&root,format)==-1) + { + fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } - cpmReadSuper(&super,&root,format); /*}}}*/ if (readcpm) /* copy from CP/M to UNIX */ /*{{{*/ { @@ -255,7 +259,7 @@ int main(int argc, char *argv[]) cpmOpen(&ino,&file,O_WRONLY); do { - int j; + unsigned int j; for (j=0; j<(sizeof(buf)/2) && (c=getc(ufp))!=EOF; ++j) { @@ -263,7 +267,7 @@ int main(int argc, char *argv[]) buf[j]=c; } if (text && c==EOF) buf[j++]='\032'; - if (cpmWrite(&file,buf,j)!=j) + if (cpmWrite(&file,buf,j)!=(ssize_t)j) { fprintf(stderr,"%s: can not write %s: %s\n",cmd,dest,boo); ohno=1; diff --git a/cpmfs.c b/cpmfs.c index 760c9ab..22b5dea 100644 --- a/cpmfs.c +++ b/cpmfs.c @@ -325,9 +325,14 @@ static int readBlock(const struct cpmSuperBlock *d, int blockno, char *buffer, i { int sect, track, counter; + assert(d); assert(blockno>=0); - assert(blocknosize); - assert(buffer!=(char*)0); + assert(buffer); + if (blockno>=d->size) + { + boo="Attempting to access block beyond end of disk"; + return -1; + } if (end<0) end=d->blksiz/d->secLength-1; sect=(blockno*(d->blksiz/d->secLength)+ d->sectrk*d->boottrk)%d->sectrk; track=(blockno*(d->blksiz/d->secLength)+ d->sectrk*d->boottrk)/d->sectrk; @@ -335,6 +340,8 @@ static int readBlock(const struct cpmSuperBlock *d, int blockno, char *buffer, i { const char *err; + assert(d->skewtab[sect]>=0); + assert(d->skewtab[sect]sectrk); if (counter>=start && (err=Device_readSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter)))) { boo=err; @@ -581,6 +588,8 @@ static int recmatch(const char *a, const char *pattern) { int first=1; + assert(a); + assert(pattern); while (*pattern) { switch (*pattern) @@ -609,6 +618,8 @@ int match(const char *a, const char *pattern) int user; char pat[255]; + assert(a); + assert(pattern); 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; } @@ -665,6 +676,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) FILE *fp; int insideDef=0,found=0; + d->libdskGeometry[0] = '\0'; d->type=0; if ((fp=fopen("diskdefs","r"))==(FILE*)0 && (fp=fopen(DISKDEFS,"r"))==(FILE*)0) { @@ -675,6 +687,13 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) { int argc; char *argv[2]; + char *s; + + /* Allow inline comments preceded by ; or # */ + s = strchr(line, '#'); + if (s) strcpy(s, "\n"); + s = strchr(line, ';'); + if (s) strcpy(s, "\n"); 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; @@ -702,8 +721,6 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) for (pass=0; pass<2; ++pass) { - char *s; - sectors=0; for (s=argv[1]; *s; ) { @@ -733,8 +750,8 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) errno=0; multiplier=1; - val = strtoul(argv[1],&endptr,10); - if ((errno==ERANGE && val==ULONG_MAX)||(errno!=0 && val==0)) + val = strtol(argv[1],&endptr,10); + if ((errno==ERANGE && val==LONG_MAX)||(errno!=0 && val<=0)) { fprintf(stderr,"%s: invalid offset value \"%s\" - %s\n",cmd,argv[1],strerror(errno)); exit(1); @@ -749,31 +766,31 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) /* Have a unit specifier */ switch (toupper(*endptr)) { - case 'K': - multiplier=1024; - break; - case 'M': - multiplier=1024*1024; - break; - case 'T': - if (d->sectrk<0||d->tracks<0||d->secLength<0) - { - fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength\n",cmd); + case 'K': + multiplier=1024; + break; + case 'M': + multiplier=1024*1024; + break; + case 'T': + if (d->sectrk<0||d->tracks<0||d->secLength<0) + { + fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength\n",cmd); + exit(1); + } + multiplier=d->sectrk*d->secLength; + break; + case 'S': + if (d->sectrk<0||d->tracks<0||d->secLength<0) + { + fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength\n",cmd); + exit(1); + } + multiplier=d->secLength; + break; + default: + fprintf(stderr,"%s: unknown unit specifier \"%c\"\n",cmd,*endptr); exit(1); - } - multiplier=d->sectrk*d->secLength; - break; - case 'S': - if (d->sectrk<0||d->tracks<0||d->secLength<0) - { - fprintf(stderr,"%s: offset must be specified after sectrk, tracks and secLength\n",cmd); - exit(1); - } - multiplier=d->secLength; - break; - default: - fprintf(stderr,"%s: unknown unit specifier \"%c\"\n",cmd,*endptr); - exit(1); } } if (val*multiplier>INT_MAX) @@ -797,8 +814,13 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) exit(1); } } + else if (strcmp(argv[0], "libdsk:format")==0) + { + strncpy(d->libdskGeometry, argv[1], sizeof(d->libdskGeometry) - 1); + d->libdskGeometry[sizeof(d->libdskGeometry) - 1] = 0; + } } - else if (argc>0 && argv[0][0]!='#') + else if (argc>0 && argv[0][0]!='#' && argv[0][0]!=';') { fprintf(stderr,"%s: invalid keyword `%s'\n",cmd,argv[0]); exit(1); @@ -809,10 +831,11 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) insideDef=1; d->skew=1; d->extents=0; - d->type|=CPMFS_DR3; + d->type=CPMFS_DR22; d->skewtab=(int*)0; d->offset=0; d->boottrk=d->secLength=d->sectrk=d->tracks=-1; + d->libdskGeometry[0] = 0; if (strcmp(argv[1],format)==0) found=1; } } @@ -851,7 +874,7 @@ 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,0); + Device_setGeometry(&d->dev,512,9,40,0,"pcw180"); if ((err=Device_readSector(&d->dev, 0, 0, (char *)boot_sector))) { fprintf(stderr,"%s: Failed to read Amstrad superblock (%s)\n",cmd,err); @@ -896,6 +919,8 @@ static int amsReadSuper(struct cpmSuperBlock *d, const char *format) d->offset = 0; d->size = (d->secLength*d->sectrk*(d->tracks-d->boottrk))/d->blksiz; d->extents = ((d->size>=256 ? 8 : 16)*d->blksiz)/16384; + d->libdskGeometry[0] = 0; /* LibDsk can recognise an Amstrad superblock + * and autodect */ return 0; } @@ -953,23 +978,27 @@ int cpmReadSuper(struct cpmSuperBlock *d, struct cpmInode *root, const char *for assert(s_ifdir); while (s_ifreg && !S_ISREG(s_ifreg)) s_ifreg<<=1; assert(s_ifreg); - if (strcmp(format, "amstrad")==0) amsReadSuper(d,format); + if (strcmp(format,"amstrad")==0) amsReadSuper(d,format); else diskdefReadSuper(d,format); - Device_setGeometry(&d->dev,d->secLength,d->sectrk,d->tracks,d->offset); + boo = Device_setGeometry(&d->dev,d->secLength,d->sectrk,d->tracks,d->offset,d->libdskGeometry); + if (boo) return -1; + if (d->skewtab==(int*)0) /* generate skew table */ /*{{{*/ { int i,j,k; 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); + boo=strerror(errno); + return -1; } memset(d->skewtab,0,d->sectrk*sizeof(int)); for (i=j=0; isectrk; ++i,j=(j+d->skew)%d->sectrk) { while (1) { + assert(isectrk); + assert(jsectrk); for (k=0; kskewtab[k]!=j; ++k); if (ksectrk; else break; @@ -983,15 +1012,16 @@ int cpmReadSuper(struct cpmSuperBlock *d, struct cpmInode *root, const char *for 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"; + boo=strerror(errno); return -1; } } /*}}}*/ /* allocate directory buffer */ /*{{{*/ - if ((d->dir=malloc(d->maxdir*32))==(struct PhysDirectoryEntry*)0) + assert(sizeof(struct PhysDirectoryEntry)==32); + if ((d->dir=malloc(((d->maxdir*32+d->blksiz-1)/d->blksiz)*d->blksiz))==(struct PhysDirectoryEntry*)0) { - boo="out of memory"; + boo=strerror(errno); return -1; } /*}}}*/ @@ -1423,7 +1453,6 @@ int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent) /* variables */ /*{{{*/ struct PhysDirectoryEntry *cur=(struct PhysDirectoryEntry*)0; char buf[2+8+1+3+1]; /* 00foobarxy.zzy\0 */ - int i; char *bufp; int hasext; /*}}}*/ @@ -1436,6 +1465,8 @@ int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent) /*}}}*/ while (1) { + int i; + if (dir->pos==0) /* first entry is . */ /*{{{*/ { ent->ino=dir->ino->sb->maxdir; @@ -1482,7 +1513,7 @@ int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent) } /*}}}*/ } - else if (dir->pos>=RESERVED_ENTRIES && dir->posino->sb->maxdir+RESERVED_ENTRIES) + else if (dir->pos>=RESERVED_ENTRIES && dir->pos<(int)dir->ino->sb->maxdir+RESERVED_ENTRIES) { int first=dir->pos-RESERVED_ENTRIES; @@ -1564,7 +1595,7 @@ int cpmRead(struct cpmFile *file, char *buf, int count) 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->ino->ino==(ino_t)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); @@ -1575,7 +1606,7 @@ int cpmRead(struct cpmFile *file, char *buf, int count) return count; } /*}}}*/ - else if (file->ino->ino==file->ino->sb->maxdir+2) /* [label] */ /*{{{*/ + else if (file->ino->ino==(ino_t)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); @@ -1616,7 +1647,11 @@ int cpmRead(struct cpmFile *file, char *buf, int count) { 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); + if (readBlock(file->ino->sb,block,buffer,start,end)==-1) + { + if (got==0) got=-1; + break; + } } } nextblockpos=(file->pos/blocksize)*blocksize+blocksize; @@ -1693,8 +1728,22 @@ int cpmWrite(struct cpmFile *file, const char *buf, int count) { 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); + if (file->pos%file->ino->sb->secLength) + { + if (readBlock(file->ino->sb,block,buffer,start,start)==-1) + { + if (got==0) got=-1; + break; + } + } + if (end!=start && (file->pos+count-1)ino->sb,block,buffer+end*file->ino->sb->secLength,end,end)==-1) + { + if (got==0) got=-1; + break; + } + } } /*}}}*/ nextblockpos=(file->pos/blocksize)*blocksize+blocksize; diff --git a/cpmfs.h b/cpmfs.h index 2f519a1..06126c8 100644 --- a/cpmfs.h +++ b/cpmfs.h @@ -104,7 +104,7 @@ struct cpmStat #define CPMFS_CPM3_DATES (0x1<<1) /* has CP/M+ style time stamps */ #define CPMFS_CPM3_OTHER (0x1<<2) /* has passwords and disc label */ #define CPMFS_DS_DATES (0x1<<3) /* has datestamper timestamps */ -#define CPMFS_EXACT_SIZE (0x1<<4) /* has exact file size */ +#define CPMFS_EXACT_SIZE (0x1<<4) /* has reverse exact file size */ #define CPMFS_DR22 0 #define CPMFS_P2DOS (CPMFS_CPM3_DATES|CPMFS_HI_USER) @@ -141,7 +141,7 @@ struct cpmSuperBlock int skew; int boottrk; off_t offset; - unsigned int type; + int type; int size; int extents; /* logical extents per physical extent */ struct PhysDirectoryEntry *dir; @@ -157,6 +157,7 @@ struct cpmSuperBlock int dirtyDirectory; struct dsDate *ds; int dirtyDs; + char libdskGeometry[256]; }; struct cpmStatFS diff --git a/cpmls.1 b/cpmls.1 index e74e098..9132640 100644 --- a/cpmls.1 +++ b/cpmls.1 @@ -1,13 +1,15 @@ -.TH CPMLS 1 "November 16, 2013" "CP/M tools" "User commands" +.TH CPMLS 1 "October 25, 2014" "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 ] +.RB [ \-T +.IR libdsk-type ] +.RB [ \-d | \-D | \-F | \-A | \-l [ \-c ][ \-i ]] .I image .RI [ file-pattern "...]" .ad b @@ -18,6 +20,9 @@ cpmls \- list sorted contents of directory .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .IP \fB\-d\fP Old CP/M 2.2 dir output. .IP \fB\-D\fP diff --git a/cpmls.1.in b/cpmls.1.in index a75019c..347761c 100644 --- a/cpmls.1.in +++ b/cpmls.1.in @@ -5,9 +5,11 @@ cpmls \- list sorted contents of directory .SH SYNOPSIS \"{{{ .ad l .B cpmls -.RB [ \-d | \-D | \-F | \-A | \-l [ \-c ][ \-i ]] .RB [ \-f .IR format ] +.RB [ \-T +.IR libdsk-type ] +.RB [ \-d | \-D | \-F | \-A | \-l [ \-c ][ \-i ]] .I image .RI [ file-pattern "...]" .ad b @@ -18,6 +20,9 @@ cpmls \- list sorted contents of directory .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .IP \fB\-d\fP Old CP/M 2.2 dir output. .IP \fB\-D\fP diff --git a/cpmls.c b/cpmls.c index fa100e9..3721d2e 100644 --- a/cpmls.c +++ b/cpmls.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "getopt_.h" #include "cpmfs.h" @@ -379,10 +380,14 @@ int main(int argc, char *argv[]) /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev,image,O_RDONLY,devopts))) { - fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); + exit(1); + } + if (cpmReadSuper(&drive,&root,format)==-1) + { + fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } - cpmReadSuper(&drive,&root,format); /*}}}*/ if (optinddev, filename, deviceOpts, NULL); + char *format; + char driverName[80]; + const char *boo; + dsk_err_t e; + + /* Assume driver name & format name both fit in 80 characters, rather than + * malloccing the exact size */ + if (deviceOpts == NULL) + { + e = dsk_open(&this->dev, filename, NULL, NULL); + format = NULL; + } + else + { + strncpy(driverName, deviceOpts, 79); + driverName[79] = 0; + format = strchr(driverName, ','); + if (format) + { + *format = 0; + ++format; + } + e = dsk_open(&this->dev, filename, driverName, NULL); + } this->opened = 0; if (e) return dsk_strerror(e); this->opened = 1; - dsk_getgeom(this->dev, &this->geom); + if (format) + { + boo = lookupFormat(&this->geom, format); + if (boo) return boo; + } + else + { + 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, off_t offset) +const char *Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry) { + char *boo; + this->secLength=secLength; this->sectrk=sectrk; this->tracks=tracks; /* Must be an even multiple of sector size */ assert(offset%secLength==0); this->offset=offset; + /* If a geometry is named in diskdefs, use it */ + if (libdskGeometry && libdskGeometry[0]) + { + return lookupFormat(&this->geom, libdskGeometry); + } 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; + if (this->geom.dg_cylinders * this->geom.dg_heads == tracks) return NULL; /* 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) @@ -50,6 +105,7 @@ void Device_setGeometry(struct Device *this, int secLength, int sectrk, int trac this->geom.dg_cylinders = tracks/2; this->geom.dg_heads = 2; } + return NULL; } /*}}}*/ /* Device_close -- Close an image file */ /*{{{*/ diff --git a/device_posix.c b/device_posix.c index 0393eed..5a28dcd 100644 --- a/device_posix.c +++ b/device_posix.c @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -22,12 +23,13 @@ const char *Device_open(struct Device *this, const char *filename, int mode, con } /*}}}*/ /* Device_setGeometry -- Set disk geometry */ /*{{{*/ -void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset) +const char *Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry) { this->secLength=secLength; this->sectrk=sectrk; this->tracks=tracks; this->offset=offset; + return NULL; } /*}}}*/ /* Device_close -- Close an image file */ /*{{{*/ @@ -42,10 +44,12 @@ const char *Device_readSector(const struct Device *this, int track, int sector, { int res; + assert(this); assert(sector>=0); assert(sectorsectrk); assert(track>=0); assert(tracktracks); + assert(buf); if (lseek(this->fd,(off_t)(((sector+track*this->sectrk)*this->secLength)+this->offset),SEEK_SET)==-1) { return strerror(errno); diff --git a/device_win32.c b/device_win32.c index 339eb34..1829443 100644 --- a/device_win32.c +++ b/device_win32.c @@ -2,8 +2,8 @@ #include "config.h" #include -#include #include +#include #include #include "cpmdir.h" @@ -385,7 +385,7 @@ const char *Device_open(struct Device *sb, const char *filename, int mode, const } /*}}}*/ /* Device_setGeometry -- Set disk geometry */ /*{{{*/ -void Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset) +const char * Device_setGeometry(struct Device *this, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry) { int n; @@ -401,7 +401,7 @@ void Device_setGeometry(struct Device *this, int secLength, int sectrk, int trac { DRIVEPARAMS drvp; memset(&drvp, 0, sizeof(drvp)); - if (GetDriveParams( this->hdisk, this->fd, &drvp )) return; + if (GetDriveParams( this->hdisk, this->fd, &drvp )) return "GetDriveParams failed"; drvp.bytespersector = secLength; drvp.sectorspertrack = sectrk; @@ -448,6 +448,7 @@ void Device_setGeometry(struct Device *this, int secLength, int sectrk, int trac */ SetDriveParams( this->hdisk, this->fd, &drvp ); } + return NULL; } /*}}}*/ /* Device_close -- Close an image file */ /*{{{*/ diff --git a/diskdefs b/diskdefs index c57e616..630317a 100644 --- a/diskdefs +++ b/diskdefs @@ -29,6 +29,7 @@ diskdef pcw skew 1 boottrk 1 os 3 + libdsk:format pcw180 end diskdef pc1.2m @@ -53,6 +54,7 @@ diskdef cpm86-144feat skew 1 boottrk 2 os 3 + libdsk:format ibm1440 end # CP/M 86 on 720KB floppies @@ -76,6 +78,7 @@ diskdef cf2dd skew 1 boottrk 1 os 3 + libdsk:format pcw720 end #amstrad: values are read from super block (special name hardcoded) @@ -127,6 +130,7 @@ diskdef myz80 skew 1 boottrk 0 os 3 + libdsk:format pcw720 end # Despite being Amstrad formats, CPC System and CPC Data don't have an Amstrad @@ -141,6 +145,7 @@ diskdef cpcsys skew 1 boottrk 2 os 3 + libdsk:format cpcsys end diskdef cpcdata seclen 512 @@ -151,6 +156,7 @@ diskdef cpcdata skew 1 boottrk 0 os 3 + libdsk:format cpcdata end # after being read in with no sector skew. @@ -223,6 +229,7 @@ diskdef ibmpc-514ss skew 1 boottrk 1 os 2.2 + libdsk:format ibm160 end # IBM CP/M-86 @@ -236,6 +243,7 @@ diskdef ibmpc-514ds skew 0 boottrk 2 os 2.2 + libdsk:format ibm320 end diskdef p112 @@ -294,9 +302,10 @@ diskdef attwp boottrk 1 logicalextents 1 skewtab 0,2,4,6,8,10,12,14,1,3,5,7,9,11,13,15,16,18,20,22,24,26,28,30,17,19,21,23,25,27,29,31 - os 2 + os 2.2 end +# setfdprm /dev/fd0 zerobased SS DD ssize=512 cyl=40 sect=10 head=1 # Kaypro II diskdef kpii seclen 512 @@ -309,6 +318,7 @@ diskdef kpii os 2.2 end +# setfdprm /dev/fd0 zerobased DS DD ssize=512 cyl=40 sect=10 head=2 # Kayro IV diskdef kpiv seclen 512 @@ -381,6 +391,62 @@ diskdef 17153 os 3 end +#DDR +diskdef scp624 + seclen 256 + tracks 160 + sectrk 16 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef scp640 + seclen 256 + tracks 160 + sectrk 16 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 0 + os 2.2 +end + +diskdef scp780 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef scp800 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 0 + os 2.2 +end + +diskdef z9001 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 192 + skew 0 + boottrk 0 + os 2.2 +end + # Visual Technology Visual 1050 computer diskdef v1050 seclen 512 @@ -509,7 +575,7 @@ diskdef nsfd maxdir 64 skew 5 boottrk 2 - os 2.2 + os 2.2 end @@ -527,7 +593,7 @@ diskdef nshd4 maxdir 256 skew 0 boottrk 0 - os 2.2 + os 2.2 end @@ -545,7 +611,7 @@ diskdef nshd8 maxdir 256 skew 0 boottrk 0 - os 2.2 + os 2.2 end # Northstar Micro-Disk System MDS-A-D 175 @@ -582,7 +648,7 @@ diskdef osborne1 blocksize 1024 maxdir 64 boottrk 3 - os 2 + os 2.2 end # Osborne Nuevo/Vixen/4 @@ -594,7 +660,7 @@ diskdef osborne4 maxdir 128 skew 2 boottrk 2 - os 2 + os 2.2 end # Lobo Max-80 8" CP/M 2 @@ -621,7 +687,7 @@ diskdef lobo3 os 3 end -# PRO CP/M RZ50 DZ format, experimental +# PRO CP/M RZ50 DZ format (Perhaps only 79 tracks should be used?) diskdef dec_pro seclen 512 tracks 80 @@ -632,3 +698,699 @@ diskdef dec_pro boottrk 2 os 2.2 end + +# TDOS with DateStamper +diskdef tdos-ds + seclen 1024 + tracks 77 + sectrk 16 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 1 + os zsys +end + +# The following entires are tested and working +# Most of the images are either from Don Maslin's archive or from +# Dave Dunfield's site, but not all - they are noted as well as +# their size. + +# PMC Micromate +# Dave Dunfield's Imagedisk information from DSK conversion from IMD: +# IMageDisk Utility 1.18 / Mar 07 2012 +# IMD 1.14: 10/03/2007 11:13:27 +# PMC-101 MicroMate +# CP/M Plus +# System Master +# Assuming 1:1 for Binary output +# 0/0 250 kbps DD 5x1024 +# 80 tracks(40/40), 400 sectors (12 Compressed) +# Entry derived from above - image size = 409,600, from Dave Dunfield +diskdef pmc101 + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 3 +end + +# BEGIN td143ssdd8 Turbo Dos 1.43 - SSDD 8" - 512 x 16 +# Test OK - image size = 630,784, from Don Maslin's archive +diskdef td143ssdd8 + seclen 512 + tracks 77 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 0 + os 2.2 +# DENSITY MFM ,LOW +end + +# BEGIN headsdd8 Heath H89, Magnolia CP/M - SSDD 8" - 512 x 16 +# Test OK - image size = 630,784, from Don Maslin's archive +diskdef heassdd8 + seclen 512 + tracks 77 + sectrk 16 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +# DENSITY MFM ,LOW +end + +# Morrow Designs Micro-Decision DOUBLE +# 64k CP/M Vers. 2.2 Rev.2.3 SIDED +# Copyright '76, '77, '78, '79, '80 +# Digital Research +# Copyright 1982,1983 Morrow Designs, Inc. +# Assuming 1:1 for Binary output +# 0/0 250 kbps DD 5x1024 +# 80 tracks(40/40), 400 sectors (128 Compressed) +# Entry derived from above data +# Test OK - image siae = 409600, from Dave Dunfield +diskdef mordsdd + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 3 + boottrk 2 + OS 2.2 +end + + +# BEGIN morsddd Morrow MD2 - SSDD 48 tpi 5.25" - 1024 x 5 +# Test OK - image size = 204,800, from Don Maslin's archive +# Also tested with image from Dave Dunfield +diskdef morsddd + seclen 1024 + tracks 40 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 3 + boottrk 2 + os 2.2 +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 94 DRM 127 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN osb1sssd Osborne 1 - SSSD 48 tpi 5.25" - 256 x 10 +# Test OK - image size = 102,400, from Don Maslin's archive +diskdef osb1sssd + seclen 256 + tracks 40 + sectrk 10 + blocksize 2048 + maxdir 64 + skew 2 + boottrk 3 + os 2.2 +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 45 DRM 63 AL0 080H AL1 0 OFS 3 +end + +# BEGIN ampdsdd Ampro - DSDD 48 tpi 5.25" - 512 x 10 +# Test OK - image size = 409,600, from Don Maslin's archive +diskdef ampdsdd + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 + libdsk:format ampro400d +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN ampdsdd80 Ampro - DSDD 96 tpi 5.25" - 512 x 10 +# Test OK - image size = 819,200, from Don Maslin's archive +diskdef ampdsdd80 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 + libdsk:format ampro800 +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN altdsdd Altos - DSDD 5" - 512 x 9 +# Test OK - both CP/M and MP/M - image size = 737,280, from Dave Dunfield +diskdef altdsdd + seclen 512 + tracks 160 + sectrk 9 + blocksize 4096 + maxdir 177 + skew 0 + boottrk 2 + os 3 +# DENSITY MFM ,HIGH +# BSH 5 BLM 31 EXM 3 DSM 176 DRM 176 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN trsomsssd TRS-80 Model 1, Omikron CP/M - SSSD 48 tpi 5.25" - 128 x 18 +# Test OK - image size = 80,640, from TRS-80 Yahoo Group posting +diskdef trsomsssd + seclen 128 + tracks 35 + sectrk 18 + blocksize 1024 + maxdir 64 + skew 4 + boottrk 3 + os 2.2 +# DENSITY FM ,LOW +# BSH 3 BLM 7 EXM 0 DSM 71 DRM 63 AL0 0C0H AL1 0 OFS 3 +end + +# Memotech type 03, ie: 3.5" or 5.25", D/S, D/D, S/T +# 40 tracks, 2 sides, 16 sectors/track, 256 bytes/sector +# Bytes on the media = 2*40*16*256 = 327680 +# CP/M sees 26 128 byte records per track (similar to 8" disks). +# Tracks = 327680/(26*128) = 98 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = ((98-2)*26*128)/2048 = 156, which agrees with DPB + +diskdef memotech-type03 + seclen 128 + tracks 98 + sectrk 26 + blocksize 2048 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 07, ie: 3.5" or 5.25", D/S, D/D, D/T +# 80 tracks, 2 sides, 16 sectors/track, 256 bytes/sector +# Bytes on the media = 2*80*16*256 = 655360 +# CP/M sees 26 128 byte records per track (similar to 8" disks). +# Tracks = 655360/(26*128) = 196 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = ((196-2)*26*128)/2048 = 315, which agrees with DPB + +diskdef memotech-type07 + seclen 128 + tracks 196 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 43, ie: 1MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 1048576/(26*128) = 315.07 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (1048576-2*26*128)/4096 = 254, which agrees with DPB +# Blocks = ((315-2)*26*128)/4096 = 254, so we don't need the 0.07 track +diskdef memotech-type43 + seclen 128 + tracks 315 + sectrk 26 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 47, ie: 2MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 2097152/(26*128) = 630.15 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (2097152-2*26*128)/4096 = 510, which agrees with DPB +# Blocks = ((630-2)*26*128)/4096 = 510, so we don't need the 0.15 track +diskdef memotech-type47 + seclen 128 + tracks 630 + sectrk 26 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 4B, ie: 4MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 4194304/(26*128) = 1260.3 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (4194304-2*26*128)/4096 = 1022, which agrees with DPB +# Blocks = ((1260-2)*26*128)/4096 = 1022, so we don't need the 0.3 track +diskdef memotech-type4B + seclen 128 + tracks 1260 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 4F, ie: 8MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 8388608/(26*128) = 2520.61 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (8388608-2*26*128)/4096 = 2046, which agrees with DPB +# Blocks = ((2520-2)*26*128)/4096 = 2045, so we need the extra 0.61 track +diskdef memotech-type4F + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 18, ie: 8MB SD Card +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for SD Cards includes blocks on the last incomplete track +# Tracks = 8388608/(26*128) = 2520.61 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (8388608-2*26*128)/4096 = 2046, which agrees with DPB +# Blocks = ((2520-2)*26*128)/4096 = 2045, so we need the extra 0.61 track +diskdef memotech-type18 + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 19, ie: 8MB SD Card +diskdef memotech-type19 + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 8M +end + +# Memotech type 1A, ie: 8MB SD Card +diskdef memotech-type1A + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 16M +end + +# Memotech type 1B, ie: 8MB SD Card +diskdef memotech-type1B + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 24M +end + +# Memotech type 1C, ie: 8MB SD Card +diskdef memotech-type1C + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 32M +end + +# Memotech type 1D, ie: 8MB SD Card +diskdef memotech-type1D + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 40M +end + +# Memotech type 1E, ie: 8MB SD Card +diskdef memotech-type1E + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 48M +end + +# Memotech type 1F, ie: 8MB SD Card +diskdef memotech-type1F + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 56M +end + +# Memotech type 50, ie: 256KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 262144/(26*128) = 78.76 +# Data is in 1024 byte blocks, on track 2 onwards +# Blocks = (262144-2*26*128)/1024 = 249, which agrees with DPB +# Blocks = ((78-2)*26*128)/1024 = 247, so we need the extra 0.76 track +diskdef memotech-type50 + seclen 128 + tracks 79 + sectrk 26 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, ie: 512KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 524288/(26*128) = 157.53 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (524288-2*26*128)/2048 = 252, which agrees with DPB +# Blocks = ((157-2)*26*128)/2048 = 251, so we need the extra 0.53 track +diskdef memotech-type51 + seclen 128 + tracks 158 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, as used in Italy, ie: 480KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 491520/(26*128) = 147.69 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (491520-2*26*128)/2048 = 236, which agrees with DPB +# Blocks = ((147-2)*26*128)/2048 = 235, so we need the extra 0.69 track +diskdef memotech-type51-italy + seclen 128 + tracks 148 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, after S2R64.COM, ie: 448KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 458752/(26*128) = 137.84 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (458752-2*26*128)/2048 = 220, which agrees with DPB, after S2R64.COM +# Blocks = ((137-2)*26*128)/2048 = 219, so we need the extra 0.84 track +diskdef memotech-type51-s2r64 + seclen 128 + tracks 138 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, after S2R.COM, ie: 144KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 147456/(26*128) = 44.3 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (147456-2*26*128)/2048 = 68, which agrees with DPB, after S2R.COM +# Blocks = ((44-2)*26*128)/2048 = 68, so we don't need the extra 0.3 track +diskdef memotech-type51-s2r + seclen 128 + tracks 44 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 52, ie: 320KB RAM Disc +# Added for REMEMOTECH +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 327680/(26*128) = 98.46 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (327680-2*26*128)/2048 = 156 +# Blocks = ((98-2)*26*128)/2048 = 156, so we don't need the extra 0.46 track +# This type very deliberately and conveniently exactly matches type 03 +diskdef memotech-type52 + seclen 128 + tracks 98 + sectrk 26 + blocksize 2048 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +# Research Machines 380Z/480Z 5.25" "Single Density" or "MDS" format. +# All tracks are formatted FM 16x128. +diskdef rm-sd + seclen 128 + tracks 40 + sectrk 16 + blocksize 1024 + maxdir 64 + skew 3 + boottrk 3 + os 2.2 +end + +# Research Machines 380Z/480Z 5.25" "Double Density" or "MD" format. +# Track 0 is formatted FM 16x128; 1+ are MFM 9x512. +# If you're working with an image file, make sure that track 0 is +# padded to be the same size as the other tracks. +diskdef rm-dd + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 5 + boottrk 3 + os 2.2 +end + +# Research Machines 380Z/480Z 5.25" "Quad Density" or "MQ" format. +# Track 0 is formatted FM 16x128; 1+ are MFM 9x512. +diskdef rm-qd + seclen 512 + tracks 80 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 5 + boottrk 3 + os 2.2 +end + +# Ampro Little Board Z80 running CP/M 2.21 +# BEGIN AMP1 Ampro - SSDD 48 tpi 5.25" +# DENSITY MFM, LOW +# CYLINDERS 40 SIDES 1 SECTORS 10,512 SKEW 2 +# SIDE1 0 1,2,3,4,5,6,7,8,9,10 +# BSH 4 BLM 15 EXM 1 DSM 94 DRM 63 AL0 080H AL1 0 OFS 2 +# END + +diskdef amp1 + seclen 512 #= Sectors xx,512 + tracks 40 #= (Cylinders * Sides) = 40*1 = 40 + sectrk 10 #= Sectors 10,xxx + blocksize 2048 #= (128*(BLM+1)) = 2048 + maxdir 64 #(DRM+1) = 64 + skew 0 #= SKEW = 0 + boottrk 2 #= OFS = 2 + os 2.2 +end + +#BEGIN AMP2 Ampro - DSDD 48 tpi 5.25" +#DENSITY MFM, LOW +#CYLINDERS 40 SIDES 2 +#SECTORS 10,512 +#SKEW 2 +#SIDE1 0 17,18,19,20,21,22,23,24,25,26 +#SIDE2 1 17,18,19,20,21,22,23,24,25,26 +#ORDER SIDES +#BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 DS DD ssize=512 cyl=40 sect=10 head=2 +diskdef amp2 + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP3 Ampro - SSDD 96 tpi 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 1 SECTORS 5,1024 SKEW 2 +#SIDE1 0 1,2,3,4,5 +#BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 SS DD ssize=1024 cyl=80 sect=5 head=1 +diskdef amp3 + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP4 Ampro - DSDD 96 tpi 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 2 SECTORS 5,1024 SKEW 2 +#SIDE1 0 17,18,19,20,21 +#SIDE2 1 17,18,19,20,21 +#ORDER SIDES +#BSH 4 BLM 15 EXM 0 DSM 394 DRM 255 AL0 0F0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 DS DD ssize=1024 cyl=80 sect=5 head=2 +diskdef amp4 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP5 Ampro - SSDD 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 1 SECTORS 5,1024 SKEW 2 +#SIDE1 0 1,2,3,4,5 +#BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 SS DD ssize=1024 cyl=80 sect=5 head=1 +diskdef amp5 + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP6 Ampro - DSDD 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 2 SECTORS 5,1024 SKEW 2 +#SIDE1 0 17,18,19,20,21 +#SIDE2 1 17,18,19,20,21 +#ORDER SIDES +#BSH 4 BLM 15 EXM 0 DSM 394 DRM 255 AL0 0F0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 DS DD ssize=1024 cyl=80 sect=5 head=2 +diskdef amp6 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef ampro800 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end diff --git a/fsck.cpm.1 b/fsck.cpm.1 index de0eada..a167ef0 100644 --- a/fsck.cpm.1 +++ b/fsck.cpm.1 @@ -1,4 +1,4 @@ -.TH FSCK.CPM 1 "November 16, 2013" "CP/M tools" "User commands" +.TH FSCK.CPM 1 "October 25, 2014" "CP/M tools" "User commands" .SH NAME ..\"{{{roff}}}\"{{{ fsck.cpm \- check a CP/M file system .\"}}} @@ -25,6 +25,9 @@ invalid time stamp mode). The second pass checks extent connectivity .SH OPTIONS .\"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .IP "\fB\-n\fP" Open the file system read-only and do not repair any errors. .\"}}} diff --git a/fsck.cpm.1.in b/fsck.cpm.1.in index 929074d..b27697e 100644 --- a/fsck.cpm.1.in +++ b/fsck.cpm.1.in @@ -25,6 +25,9 @@ invalid time stamp mode). The second pass checks extent connectivity .SH OPTIONS .\"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .IP "\fB\-n\fP" Open the file system read-only and do not repair any errors. .\"}}} diff --git a/fsck.cpm.c b/fsck.cpm.c index c145803..585015b 100644 --- a/fsck.cpm.c +++ b/fsck.cpm.c @@ -249,7 +249,7 @@ static int fsck(struct cpmInode *root, const char *image) if (block>0) { ++usedBlocks; - if (blockmax) + if (block=max) { printf("Error: Bad block number (extent=%d, name=\"%s\", block=%d)\n",extent,prfile(sb,extent),block); if (ask("Remove file")) @@ -600,15 +600,19 @@ int main(int argc, char *argv[]) { if ((err=Device_open(&sb.dev, image,O_RDONLY, devopts))) { - fprintf(stderr,"%s: can not open %s: %s\n",cmd,image,err); + fprintf(stderr,"%s: cannot 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); + fprintf(stderr,"%s: cannot open %s for writing, no repair possible\n",cmd,image); } } - cpmReadSuper(&sb,&root,format); + if (cpmReadSuper(&sb,&root,format)==-1) + { + fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); + exit(1); + } ret=fsck(&root,image); if (ret&MODIFIED) { diff --git a/fsed.cpm.1 b/fsed.cpm.1 index b08ad47..a6d5873 100644 --- a/fsed.cpm.1 +++ b/fsed.cpm.1 @@ -1,4 +1,4 @@ -.TH FSED.CPM 1 "November 16, 2013" "CP/M tools" "User commands" +.TH FSED.CPM 1 "October 25, 2014" "CP/M tools" "User commands" .SH NAME ..\"{{{roff}}}\"{{{ fsed.cpm \- edit a CP/M file system .\"}}} @@ -19,6 +19,9 @@ self-explanatory. .SH OPTIONS .\"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .\"}}} .SH "RETURN VALUE" .\"{{{ Upon successful completion, exit code 0 is returned. diff --git a/fsed.cpm.1.in b/fsed.cpm.1.in index 596dfcf..1520be2 100644 --- a/fsed.cpm.1.in +++ b/fsed.cpm.1.in @@ -19,6 +19,9 @@ self-explanatory. .SH OPTIONS .\"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. +.IP "\fB\-T\fP \fIlibdsk-type\fP" +libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images +(requires building cpmtools with support for libdsk). .\"}}} .SH "RETURN VALUE" .\"{{{ Upon successful completion, exit code 0 is returned. diff --git a/fsed.cpm.c b/fsed.cpm.c index 0c3f03f..f120b77 100644 --- a/fsed.cpm.c +++ b/fsed.cpm.c @@ -3,13 +3,23 @@ #include #include +#if NEED_NCURSES +#if HAVE_NCURSES_NCURSES_H +#include +#else +#include +#endif +#else #include +#endif #include #include #include #include +#include #include "cpmfs.h" +#include "getopt_.h" #ifdef USE_DMALLOC #include @@ -25,7 +35,7 @@ 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}; + unsigned 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); @@ -87,7 +97,8 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ { const char *msg; char bmap[18*80]; - int secmap,pos,sys,directory; + int secmap,sys,directory; + int pos; clear(); msg="Data map"; @@ -114,7 +125,7 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ { for (i=0; i<16; ++i) { - unsigned int sector; + int sector; sector=mapbuf[entry*32+16+i]&0xff; if (sb->size>=256) sector|=(((mapbuf[entry*32+16+ ++i]&0xff)<<8)); @@ -129,7 +140,7 @@ static void map(struct cpmSuperBlock *sb) /*{{{*/ } } - for (pos=0; possecLength)&~0x7f; - int i; + unsigned int i; for (i=0; i<128; ++i) { @@ -168,7 +179,7 @@ int main(int argc, char *argv[]) /*{{{*/ struct cpmInode root; const char *format; int c,usage=0; - unsigned long pos; + off_t pos; chtype ch; int reload; char *buf; @@ -196,10 +207,14 @@ int main(int argc, char *argv[]) /*{{{*/ /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev,image,O_RDONLY,devopts))) { - fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err); + fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); + exit(1); + } + if (cpmReadSuper(&drive,&root,format)==-1) + { + fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } - cpmReadSuper(&drive,&root,format); /*}}}*/ /* alloc sector buffers */ /*{{{*/ if ((buf=malloc(drive.secLength))==(char*)0 || (mapbuf=malloc(drive.secLength))==(char*)0) @@ -270,7 +285,7 @@ int main(int argc, char *argv[]) /*{{{*/ { case 'F': /* next 16 byte */ /*{{{*/ { - if (pos+16<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + if (pos+16<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+16)/drive.secLength) reload=1; pos+=16; @@ -621,7 +636,7 @@ int main(int argc, char *argv[]) /*{{{*/ { case 'F': /* next entry */ /*{{{*/ { - if (pos+32<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + if (pos+32<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+32)/drive.secLength) reload=1; pos+=32; @@ -657,7 +672,7 @@ int main(int argc, char *argv[]) /*{{{*/ { case 'n': /* next record */ /*{{{*/ { - if (pos+128<(drive.sectrk*drive.tracks*(unsigned long)drive.secLength)) + if (pos+128<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+128)/drive.secLength) reload=1; pos+=128; diff --git a/install-sh b/install-sh index 3f83ce9..377bb86 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2010-02-06.18; # UTC +scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,7 +35,7 @@ scriptversion=2010-02-06.18; # UTC # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it +# '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 @@ -156,6 +156,10 @@ while test $# -ne 0; do -s) stripcmd=$stripprog;; -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac shift;; -T) no_target_directory=true;; @@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then fi shift # arg dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac done fi @@ -194,7 +202,7 @@ if test $# -eq 0; then echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call `install-sh -d' without argument. + # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi @@ -232,9 +240,9 @@ fi for src do - # Protect names starting with `-'. + # Protect names problematic for 'test' and other utilities. case $src in - -*) src=./$src;; + -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then @@ -256,12 +264,7 @@ do echo "$0: no destination specified." >&2 exit 1 fi - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. @@ -351,7 +354,7 @@ do if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. + # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in @@ -389,7 +392,7 @@ do case $dstdir in /*) prefix='/';; - -*) prefix='./';; + [-=\(\)!]*) prefix='./';; *) prefix='';; esac @@ -407,7 +410,7 @@ do for d do - test -z "$d" && continue + test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then diff --git a/mkfs.cpm.1 b/mkfs.cpm.1 index f0d1bfd..b31fb7c 100644 --- a/mkfs.cpm.1 +++ b/mkfs.cpm.1 @@ -1,4 +1,4 @@ -.TH MKFS.CPM 1 "November 16, 2013" "CP/M tools" "User commands" +.TH MKFS.CPM 1 "October 25, 2014" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ mkfs.cpm \- make a CP/M file system .\"}}} @@ -11,6 +11,7 @@ mkfs.cpm \- make a CP/M file system .IR boot ] .RB [ \-L .IR label ] +.RB [ \-t ] .I image .ad b .\"}}} @@ -27,6 +28,8 @@ 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. +.IP "\fB\-t\fP" +Create time stamps. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. diff --git a/mkfs.cpm.1.in b/mkfs.cpm.1.in index 7161d84..56d9e4d 100644 --- a/mkfs.cpm.1.in +++ b/mkfs.cpm.1.in @@ -11,6 +11,7 @@ mkfs.cpm \- make a CP/M file system .IR boot ] .RB [ \-L .IR label ] +.RB [ \-t ] .I image .ad b .\"}}} @@ -27,6 +28,8 @@ 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. +.IP "\fB\-t\fP" +Create time stamps. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. diff --git a/mkfs.cpm.c b/mkfs.cpm.c index 0e0ac55..2c37bdf 100644 --- a/mkfs.cpm.c +++ b/mkfs.cpm.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "getopt_.h" #include "cpmfs.h" @@ -21,15 +22,15 @@ /*}}}*/ /* mkfs -- make file system */ /*{{{*/ -static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *label, char *bootTracks) +static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *format, const char *label, char *bootTracks, int timeStamps) { /* variables */ /*{{{*/ - int i; + unsigned int i; char buf[128]; char firstbuf[128]; int fd; - int bytes; - int trkbytes; + unsigned int bytes; + unsigned int trkbytes; /*}}}*/ /* open image file */ /*{{{*/ @@ -42,7 +43,7 @@ static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *label /* 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) + for (i=0; iboottrk; i+=drive->secLength) if (write(fd, bootTracks+i, drive->secLength)!=(ssize_t)drive->secLength) { boo=strerror(errno); close(fd); @@ -53,7 +54,7 @@ static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *label 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; + if (timeStamps && (drive->type==CPMFS_P2DOS || drive->type==CPMFS_DR3)) buf[3*32]=0x21; memcpy(firstbuf,buf,128); if (drive->type==CPMFS_DR3) { @@ -64,23 +65,29 @@ static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *label 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 */ + firstbuf[12]=timeStamps ? 0x11 : 0x01; /* 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) + if (timeStamps) { - days+=365; - if (i%4==0 && (i%100!=0 || i%400==0)) ++days; + int year; + + /* Stamp label. */ + 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 (year=1978,days=0; year<1900+t->tm_year; ++year) + { + days+=365; + if (year%4==0 && (year%100!=0 || year%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; } - 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) + for (i=0; itype==CPMFS_P2DOS || drive->type==CPMFS_DR3)) /*{{{*/ + { + int offset,j; + struct cpmInode ino, root; + static const char sig[] = "!!!TIME"; + unsigned int records; + struct dsDate *ds; + struct cpmSuperBlock super; + const char *err; + + if ((err=Device_open(&super.dev,name,O_RDWR,NULL))) + { + fprintf(stderr,"%s: can not open %s (%s)\n",cmd,name,err); + exit(1); + } + cpmReadSuper(&super,&root,format); + + records=root.sb->maxdir/8; + if (!(ds=malloc(records*128))) + { + cpmUmount(&super); + return -1; + } + memset(ds,0,records*128); + offset=15; + for (i=0; ids=ds; + root.sb->dirtyDs=1; + cpmUmount(&super); + } + /*}}}*/ + return 0; } /*}}}*/ @@ -108,12 +164,13 @@ int main(int argc, char *argv[]) /*{{{*/ struct cpmSuperBlock drive; struct cpmInode root; const char *label="unlabeled"; + int timeStamps=0; size_t bootTrackSize,used; char *bootTracks; const char *boot[4]={(const char*)0,(const char*)0,(const char*)0,(const char*)0}; if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT; - while ((c=getopt(argc,argv,"b:f:L:h?"))!=EOF) switch(c) + while ((c=getopt(argc,argv,"b:f:L:th?"))!=EOF) switch(c) { case 'b': { @@ -126,6 +183,7 @@ int main(int argc, char *argv[]) /*{{{*/ } case 'f': format=optarg; break; case 'L': label=optarg; break; + case 't': timeStamps=1; break; case 'h': case '?': usage=1; break; } @@ -135,7 +193,7 @@ int main(int argc, char *argv[]) /*{{{*/ if (usage) { - fprintf(stderr,"Usage: %s [-f format] [-b boot] [-L label] image\n",cmd); + fprintf(stderr,"Usage: %s [-f format] [-b boot] [-L label] [-t] image\n",cmd); exit(1); } drive.dev.opened=0; @@ -166,7 +224,7 @@ int main(int argc, char *argv[]) /*{{{*/ used+=size; close(fd); } - if (mkfs(&drive,image,label,bootTracks)==-1) + if (mkfs(&drive,image,format,label,bootTracks,timeStamps)==-1) { fprintf(stderr,"%s: can not make new file system: %s\n",cmd,boo); exit(1); -- 2.30.2