cpmtools-2.23/0000755000175000017500000000000014330525676013101 5ustar michaelmichaelcpmtools-2.23/fsck.cpm.10000644000175000017500000000605714330525205014663 0ustar michaelmichael.TH FSCK.CPM 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME ..\"{{{roff}}}\"{{{ fsck.cpm \- check a CP/M file system .\"}}} .SH SYNOPSIS .\"{{{ .ad l .B fsck.cpm .RB [ \-f .IR format ] .RB [ \-n ] .RB [ \-u ] .I image .ad b .\"}}} .SH DESCRIPTION .\"{{{ \fBfsck.cpm\fP is used to check and repair a CP/M file system. After reading the directory, it makes two passes. The first pass checks extent fields for range and format violations (bad status, extent number, last record byte count, file name, extension, block number, record count, size of \&.COM files, time stamp format, invalid password characters, invalid time stamp mode). The second pass checks extent connectivity (multiple allocated blocks and duplicate directory entries). .P \fBfsck.cpm\fP can not yet repair all errors. .\"}}} .SH OPTIONS .\"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-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. .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" .\"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS .\"{{{ Any errors are indicated by exit code 1. .\"}}} .SH FILES .\"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH DIAGNOSTICS .\"{{{ .IP "\fIimage\fP: \fIused\fP/\fItotal\fP files (\fIn\fP.\fIn\fP% non-contiguos), \fIused\fP/\fItotal\fP blocks" No inconsistencies could be found. The number of used files actually is the number of used extents. Since a file may use more than one extent, this may be greather than the actual number of files, but a correct measure would not reflect how many files could still be created at most. A file is considered fragmented, if sequential data blocks pointed to by the same extent do not have sequential block numbers. The number of used blocks includes the blocks used for system tracks and the directory. .\"}}} .SH AUTHORS .\"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" .\"{{{ .IR fsck (8), .IR mkfs.cpm (1), .IR cpm (5) .\"}}} cpmtools-2.23/device.h0000640000175000017500000000201514047006226014471 0ustar michaelmichael#ifndef DEVICE_H #define DEVICE_H #ifdef _WIN32 /* The type of device the file system is on: */ #define CPMDRV_FILE 0 /* Regular file or Unix block device */ #define CPMDRV_WIN95 1 /* Windows 95 floppy drive accessed via VWIN32 */ #define CPMDRV_WINNT 2 /* Windows NT floppy drive accessed via CreateFile */ #endif struct Device { int opened; int secLength; int tracks; int sectrk; off_t offset; #ifdef HAVE_LIBDSK_H DSK_PDRIVER dev; DSK_GEOMETRY geom; #endif #ifdef HAVE_WINDOWS_H int drvtype; HANDLE hdisk; #endif int fd; }; const char *Device_open(struct Device *self, const char *filename, int mode, const char *deviceOpts); const char *Device_setGeometry(struct Device *self, int secLength, int sectrk, int tracks, off_t offset, const char *libdskGeometry); const char *Device_close(struct Device *self); const char *Device_readSector(const struct Device *self, int track, int sector, char *buf); const char *Device_writeSector(const struct Device *self, int track, int sector, const char *buf); #endif cpmtools-2.23/config.h.in0000640000175000017500000000227114047006226015110 0ustar michaelmichael#undef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H #include #endif #undef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H #include #endif #undef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H #include #endif #undef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H #include #endif #undef HAVE_WINIOCTL_H #ifdef HAVE_WINIOCTL_H #include #endif #undef HAVE_LIBDSK_H #ifdef HAVE_LIBDSK_H #include #endif #undef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H #include #endif #undef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H #include #endif #undef HAVE_SYS_UTIME_H #ifdef HAVE_SYS_UTIME_H #include #endif #undef HAVE_UTIME_H #ifdef HAVE_UTIME_H #include #endif #undef NEED_NCURSES #undef HAVE_NCURSES_NCURSES_H /* Define either for large file support, if your OS needs them. */ #undef _FILE_OFFSET_BITS #undef _LARGE_FILES #ifndef _POSIX_PATH_MAX #define _POSIX_PATH_MAX _MAX_PATH #endif /* There is not standard header for this, yet it is needed for * timezone changes. */ #ifndef environ extern char **environ; #endif /* If types are missing, the script defines.awk contained * in configure.status should create definitions here. */ cpmtools-2.23/cpmls.10000644000175000017500000000445014330525205014270 0ustar michaelmichael.TH CPMLS 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmls \- list sorted contents of directory .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmls .RB [ \-f .IR format ] .RB [ \-T .IR libdsk-type ] .RB [ \-d | \-D | \-F | \-A | \-l [ \-c ][ \-i ]] .RB [ \-u ] .I image .RI [ file-pattern "...]" .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBCpmls\fP lists the sorted contents of the directory. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-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 P2DOS 2.3 ddir-like output. .IP \fB\-F\fp CP/M 3.x dir output. .IP \fB\-A\fp E2fs lsattr-like output. .IP \fB\-l\fP Long UNIX-style directory listing including size, time stamp and user number. .IP \fB\-c\fP Output the creation time, not the modification time. .IP \fB\-i\fP Print index number of each file. .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmcp (1), .IR cpm (5) .\"}}} cpmtools-2.23/cpmchattr.10000644000175000017500000000523314330525205015137 0ustar michaelmichael.TH CPMCHATTR 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmchattr \- change file attributes on CP/M files .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmchattr .RB [ \-f .IR format ] .RB [ \-u ] .I image .I attrib .I file-pattern \&... .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBCpmchattr\fP changes the file attributes for files on CP/M disks. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-T\fP \fIlibdsk-type\fP" libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images (requires building cpmtools with support for libdsk). .IP "\fB\-u\fP" Show all CP/M file names in upper case. .IP "\fIattrib\fP" Set the file attributes as given. .\"}}} .SH "FILE ATTRIBUTES" \"{{{ The file attribute string can contain the characters 1,2,3,4,r,s,a,n and m. The meanings of these are: .TP .B 1-4 The CP/M "user attributes" F1-F4. CP/M does not assign any meaning to these attributes, though MP/M does. .TP .B r The file is read-only. This is the same as using .I cpmchmod(1) to revoke write permissions. .TP .B s The file is a system file. This attribute can also be set by .I cpmchmod(1). .TP .B a The file has been backed up. .TP .B n Reset all attributes to zero. So the string "n1r" resets all attributes and then sets F1 and Read-Only. .TP .B m Attributes after an m are unset rather than set. The string "12m34" sets atttributes F1 and F2, and unsets F3 and F4. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt and copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR cpmchmod (1), .IR cpm (5) .\"}}} cpmtools-2.23/cpmcp.1.in0000640000175000017500000000615514047532322014664 0ustar michaelmichael.TH CPMCP 1 "@UPDATED@" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmcp \- copy files from and to CP/M disks .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIuser\fP\fB:\fP\fIfile\fP \fIfile\fP .br .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIuser\fP\fB:\fP\fIfile\fP ... \fIdirectory\fP .br .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIfile\fP \fIuser\fP\fB:\fP\fIfile\fP .br .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIfile\fP ... \fIuser\fP\fB:\fP .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBcpmcp\fP copies one or more files to or from a CP/M disk. When copying multiple files, the last argument must be a drive or directory. The drive letter does not matter because the device is specified by the image, it is only used to specify which direction you want to copy. The user number is specified after the drive letter, if omitted user 0 is used. .PP You can use \fB*\fP and \fB?\fP in CP/M file names, which have the same meaning in .IR sh (1) file name patterns. .PP On CP/M, the slash is a legal file name character. When copying such files to the host, it is translated to a comma. Filenames with a comma have that translated back to a slash on CP/M. That is no restriction, because a comma is not a legal CP/M filename character. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" 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\-p\fP Preserve time stamps when copying files from CP/M to UNIX (not implemented for copying the other way so far). .IP \fB\-t\fP Convert text files between CP/M and UNIX conventions. .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ @DATADIR@/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR cpm (5) .\"}}} cpmtools-2.23/fsck.cpm.c0000640000175000017500000004607414047257475014764 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include #include "getopt_.h" #include "cpmdir.h" #include "cpmfs.h" /*}}}*/ /* #defines */ /*{{{*/ /* your favourite password *:-) */ #define T0 'G' #define T1 'E' #define T2 'H' #define T3 'E' #define T4 'I' #define T5 'M' #define T6 ' ' #define T7 ' ' #define PB ((char)(T0+T1+T2+T3+T4+T5+T6+T7)) #define P0 ((char)(T7^PB)) #define P1 ((char)(T6^PB)) #define P2 ((char)(T5^PB)) #define P3 ((char)(T4^PB)) #define P4 ((char)(T3^PB)) #define P5 ((char)(T2^PB)) #define P6 ((char)(T1^PB)) #define P7 ((char)(T0^PB)) /*}}}*/ /* types */ /*{{{*/ enum Result { OK=0, MODIFIED=1, BROKEN=2 }; /*}}}*/ /* variables */ /*{{{*/ static int norepair=0; /*}}}*/ /* bcdCheck -- check format and range of BCD digit */ /*{{{*/ static int bcdCheck(int n, int max, const char *msg, const char *unit, int extent1, int extent2) { if (((n>>4)&0xf)>10 || (n&0xf)>10 || (((n>>4)&0xf)*10+(n&0xf))>=max) { printf("Error: Bad %s %s (extent=%d/%d, %s=%02x)\n",msg,unit,extent1,extent2,unit,n&0xff); return -1; } else return 0; } /*}}}*/ /* pwdCheck -- check password */ /*{{{*/ static int pwdCheck(int extent, const char *pwd, char decode) { char c; int i; for (i=0; i<8; ++i) if ((c=((char)(pwd[7-i]^decode)))<' ' || c&0x80) { printf("Error: non-printable character in password (extent=%d, password=",extent); for (i=0; i<8; ++i) { c=pwd[7-i]^decode; if (c<' ' || c&0x80) { putchar('\\'); putchar('0'+((c>>6)&0x01)); putchar('0'+((c>>3)&0x03)); putchar('0'+(c&0x03)); } else putchar(c); } printf(")\n"); return -1; } return 0; } /*}}}*/ /* ask -- ask user and return answer */ /*{{{*/ static int ask(const char *msg) { while (1) { char buf[80]; if (norepair) return 0; printf("%s [Y]? ",msg); fflush(stdout); if (fgets(buf,sizeof(buf),stdin)==(char*)0) exit(1); switch (toupper(buf[0])) { case '\n': case 'Y': return 1; case 'N': return 0; } } } /*}}}*/ /* prfile -- print file name */ /*{{{*/ static char *prfile(struct cpmSuperBlock *sb, int extent) { struct PhysDirectoryEntry *dir; static char name[80]; char *s=name; int i; char c; dir=sb->dir+extent; for (i=0; i<8; ++i) { c=dir->name[i]; if ((c&0x7f)<' ') { *s++='\\'; *s++=('0'+((c>>6)&0x01)); *s++=('0'+((c>>3)&0x03)); *s++=('0'+(c&0x03)); } else *s++=(c&0x7f); } *s++='.'; for (i=0; i<3; ++i) { c=dir->ext[i]; if ((c&0x7f)<' ') { *s++='\\'; *s++=('0'+((c>>6)&0x01)); *s++=('0'+((c>>3)&0x03)); *s++=('0'+(c&0x03)); } else *s++=(c&0x7f); } *s='\0'; return name; } /*}}}*/ /* fsck -- file system check */ /*{{{*/ static int fsck(struct cpmInode *root, const char *image) { /* variables */ /*{{{*/ enum Result ret=OK; int extent,extent2; struct PhysDirectoryEntry *dir,*dir2; struct cpmSuperBlock *sb=root->sb; /*}}}*/ /* Phase 1: check extent fields */ /*{{{*/ printf("Phase 1: check extent fields\n"); for (extent=0; extentmaxdir; ++extent) { char *status; int usedBlocks=0; dir=sb->dir+extent; status=&dir->status; if (*status>=0 && *status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* directory entry */ /*{{{*/ { /* check name and extension */ /*{{{*/ { int i; char *c; for (i=0; i<8; ++i) { c=&(dir->name[i]); if (!ISFILECHAR(i,*c&0x7f) || islower(*c&0x7f)) { printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); if (ask("Remove file")) { *status=(char)0xE5; ret|=MODIFIED; break; } else ret|=BROKEN; } } if (*status==(char)0xe5) continue; for (i=0; i<3; ++i) { c=&(dir->ext[i]); if (!ISFILECHAR(1,*c&0x7f) || islower(*c&0x7f)) { printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); if (ask("Remove file")) { *status=(char)0xE5; ret|=MODIFIED; break; } else ret|=BROKEN; } } if (*status==(char)0xe5) continue; } /*}}}*/ /* check extent number */ /*{{{*/ if ((dir->extnol&0xff)>0x1f) { printf("Error: Bad lower bits of extent number (extent=%d, name=\"%s\", low bits=%d)\n",extent,prfile(sb,extent),dir->extnol&0xff); if (ask("Remove file")) { *status=(char)0xE5; ret|=MODIFIED; } else ret|=BROKEN; } if (*status==(char)0xe5) continue; if ((dir->extnoh&0xff)>0x3f) { printf("Error: Bad higher bits of extent number (extent=%d, name=\"%s\", high bits=%d)\n",extent,prfile(sb,extent),dir->extnoh&0xff); if (ask("Remove file")) { *status=(char)0xE5; ret|=MODIFIED; } else ret|=BROKEN; } if (*status==(char)0xe5) continue; /*}}}*/ /* check last record byte count */ /*{{{*/ if ((dir->lrc&0xff)>128) { printf("Error: Bad last record byte count (extent=%d, name=\"%s\", lrc=%d)\n",extent,prfile(sb,extent),dir->lrc&0xff); if (ask("Clear last record byte count")) { dir->lrc=(char)0; ret|=MODIFIED; } else ret|=BROKEN; } if (*status==(char)0xe5) continue; /*}}}*/ /* check block number range */ /*{{{*/ { int block,min,max,i; min=sb->dirblks; max=sb->size; for (i=0; i<16; ++i) { block=dir->pointers[i]&0xff; if (sb->size>256) block+=(dir->pointers[++i]&0xff)<<8; if (block>0) { ++usedBlocks; if (block=max) { printf("Error: Bad block number (extent=%d, name=\"%s\", block=%d)\n",extent,prfile(sb,extent),block); if (ask("Remove file")) { *status=(char)0xE5; ret|=MODIFIED; break; } else ret|=BROKEN; } } } if (*status==(char)0xe5) continue; } /*}}}*/ /* check number of used blocks ? */ /*{{{*/ /*}}}*/ /* check record count */ /*{{{*/ { int i,min,max,recordsInBlocks,used=0; min=(dir->extnol%sb->extents)*16/sb->extents; max=((dir->extnol%sb->extents)+1)*16/sb->extents; assert(minpointers[i] || (sb->size>256 && dir->pointers[i+1])) ++used; if (sb->size>256) ++i; } recordsInBlocks=(((unsigned char)dir->blkcnt)*128+sb->blksiz-1)/sb->blksiz; if (recordsInBlocks!=used) { printf("Error: Bad record count (extent=%d, name=\"%s\", record count=%d)\n",extent,prfile(sb,extent),dir->blkcnt&0xff); if (ask("Remove file")) { *status=(char)0xE5; ret|=MODIFIED; } else ret|=BROKEN; } if (*status==(char)0xe5) continue; } /*}}}*/ /* check for too large .com files */ /*{{{*/ if (((EXTENT(dir->extnol,dir->extnoh)==3 && dir->blkcnt>=126) || EXTENT(dir->extnol,dir->extnoh)>=4) && (dir->ext[0]&0x7f)=='C' && (dir->ext[1]&0x7f)=='O' && (dir->ext[2]&0x7f)=='M') { printf("Warning: Oversized .COM file (extent=%d, name=\"%s\")\n",extent,prfile(sb,extent)); } /*}}}*/ } /*}}}*/ else if ((sb->type==CPMFS_P2DOS || sb->type==CPMFS_DR3) && *status==33) /* check time stamps ? */ /*{{{*/ { unsigned long created,modified; char s; if ((s=sb->dir[extent2=(extent&~3)].status)>=0 && s<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* time stamps for first of the three extents */ /*{{{*/ { bcdCheck(dir->name[2],24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent2); bcdCheck(dir->name[3],60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent2); bcdCheck(dir->name[6],24,"modification date","hour",extent,extent2); bcdCheck(dir->name[7],60,"modification date","minute",extent,extent2); created=(dir->name[4]+(dir->name[1]<<8))*(0x60*0x60)+dir->name[2]*0x60+dir->name[3]; modified=(dir->name[0]+(dir->name[5]<<8))*(0x60*0x60)+dir->name[6]*0x60+dir->name[7]; if (sb->cnotatime && modifieddir[extent2=(extent&~3)+1].status)>=0 && s<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* time stamps for second */ /*{{{*/ { bcdCheck(dir->lrc,24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent2); bcdCheck(dir->extnoh,60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent2); bcdCheck(dir->pointers[1],24,"modification date","hour",extent,extent2); bcdCheck(dir->pointers[2],60,"modification date","minute",extent,extent2); created=(dir->ext[2]+(dir->extnol<<8))*(0x60*0x60)+dir->lrc*0x60+dir->extnoh; modified=(dir->blkcnt+(dir->pointers[0]<<8))*(0x60*0x60)+dir->pointers[1]*0x60+dir->pointers[2]; if (sb->cnotatime && modifieddir[extent2=(extent&~3)+2].status)>=0 && s<=(sb->type==CPMFS_P2DOS ? 31 : 15)) /* time stamps for third */ /*{{{*/ { bcdCheck(dir->pointers[7],24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent2); bcdCheck(dir->pointers[8],60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent2); bcdCheck(dir->pointers[11],24,"modification date","hour",extent,extent2); bcdCheck(dir->pointers[12],60,"modification date","minute",extent,extent2); created=(dir->pointers[5]+(dir->pointers[6]<<8))*(0x60*0x60)+dir->pointers[7]*0x60+dir->pointers[8]; modified=(dir->pointers[9]+(dir->pointers[10]<<8))*(0x60*0x60)+dir->pointers[11]*0x60+dir->pointers[12]; if (sb->cnotatime && modifiedtype==CPMFS_DR3 && *status==32) /* disc label */ /*{{{*/ { unsigned long created,modified; bcdCheck(dir->pointers[10],24,sb->cnotatime ? "creation date" : "access date","hour",extent,extent); bcdCheck(dir->pointers[11],60,sb->cnotatime ? "creation date" : "access date","minute",extent,extent); bcdCheck(dir->pointers[14],24,"modification date","hour",extent,extent); bcdCheck(dir->pointers[15],60,"modification date","minute",extent,extent); created=(dir->pointers[8]+(dir->pointers[9]<<8))*(0x60*0x60)+dir->pointers[10]*0x60+dir->pointers[11]; modified=(dir->pointers[12]+(dir->pointers[13]<<8))*(0x60*0x60)+dir->pointers[14]*0x60+dir->pointers[15]; if (sb->cnotatime && modifiedextnol&0x40 && dir->extnol&0x10) { printf("Error: Bit 4 and 6 can only be exclusively be set (extent=%d, label byte=0x%02x)\n",extent,(unsigned char)dir->extnol); if (ask("Time stamp on creation")) { dir->extnol&=~0x40; ret|=MODIFIED; } else if (ask("Time stamp on access")) { dir->extnol&=~0x10; ret|=MODIFIED; } else ret|=BROKEN; } if (dir->extnol&0x80 && pwdCheck(extent,dir->pointers,dir->lrc)) { char msg[80]; sprintf(msg,"Set password to %c%c%c%c%c%c%c%c",T0,T1,T2,T3,T4,T5,T6,T7); if (ask(msg)) { dir->pointers[0]=P0; dir->pointers[1]=P1; dir->pointers[2]=P2; dir->pointers[3]=P3; dir->pointers[4]=P4; dir->pointers[5]=P5; dir->pointers[6]=P6; dir->pointers[7]=P7; dir->lrc=PB; ret|=MODIFIED; } else ret|=BROKEN; } } /*}}}*/ else if (sb->type==CPMFS_DR3 && *status>=16 && *status<=31) /* password */ /*{{{*/ { /* check name and extension */ /*{{{*/ { int i; char *c; for (i=0; i<8; ++i) { c=&(dir->name[i]); if (!ISFILECHAR(i,*c&0x7f) || islower(*c&0x7f)) { printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); if (ask("Clear password entry")) { *status=(char)0xE5; ret|=MODIFIED; break; } else ret|=BROKEN; } } if (*status==(char)0xe5) continue; for (i=0; i<3; ++i) { c=&(dir->ext[i]); if (!ISFILECHAR(1,*c&0x7f) || islower(*c&0x7f)) { printf("Error: Bad name (extent=%d, name=\"%s\", position=%d)\n",extent,prfile(sb,extent),i); if (ask("Clear password entry")) { *status=(char)0xE5; ret|=MODIFIED; break; } else ret|=BROKEN; } } if (*status==(char)0xe5) continue; } /*}}}*/ /* check password */ /*{{{*/ if (dir->extnol&(0x80|0x40|0x20) && pwdCheck(extent,dir->pointers,dir->lrc)) { char msg[80]; sprintf(msg,"Set password to %c%c%c%c%c%c%c%c",T0,T1,T2,T3,T4,T5,T6,T7); if (ask(msg)) { dir->pointers[0]=P0; dir->pointers[1]=P1; dir->pointers[2]=P2; dir->pointers[3]=P3; dir->pointers[4]=P4; dir->pointers[5]=P5; dir->pointers[6]=P6; dir->pointers[7]=P7; dir->lrc=PB; ret|=MODIFIED; } else ret|=BROKEN; } /*}}}*/ } /*}}}*/ else if (*status!=(char)0xe5) /* bad status */ /*{{{*/ { printf("Error: Bad status (extent=%d, name=\"%s\", status=0x%02x)\n",extent,prfile(sb,extent),*status&0xff); if (ask("Clear entry")) { *status=(char)0xE5; ret|=MODIFIED; } else ret|=BROKEN; continue; } /*}}}*/ } /*}}}*/ /* Phase 2: check extent connectivity */ /*{{{*/ printf("Phase 2: check extent connectivity\n"); /* check multiple allocated blocks */ /*{{{*/ for (extent=0; extentmaxdir; ++extent) if ((dir=sb->dir+extent)->status>=0 && dir->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) { int i,j,block,block2; for (i=0; i<16; ++i) { block=dir->pointers[i]&0xff; if (sb->size>256) block+=(dir->pointers[++i]&0xff)<<8; for (extent2=0; extent2maxdir; ++extent2) if ((dir2=sb->dir+extent2)->status>=0 && dir2->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) { for (j=0; j<16; ++j) { block2=dir2->pointers[j]&0xff; if (sb->size>256) block2+=(dir2->pointers[++j]&0xff)<<8; if (block!=0 && block2!=0 && block==block2 && !(extent==extent2 && i==j)) { printf("Error: Multiple allocated block (extent=%d,%d, name=\"%s\"",extent,extent2,prfile(sb,extent)); printf(",\"%s\" block=%d)\n",prfile(sb,extent2),block); ret|=BROKEN; } } } } } /*}}}*/ /* check multiple extents */ /*{{{*/ for (extent=0; extentmaxdir; ++extent) if ((dir=sb->dir+extent)->status>=0 && dir->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) { for (extent2=0; extent2maxdir; ++extent2) if ((dir2=sb->dir+extent2)->status>=0 && dir2->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) { if (extent!=extent2 && EXTENT(dir->extnol,dir->extnoh)==EXTENT(dir2->extnol,dir2->extnoh) && dir->status==dir2->status) { int i; for (i=0; i<8 && (dir->name[i]&0x7f)==(dir2->name[i]&0x7f); ++i); if (i==8) { for (i=0; i<3 && (dir->ext[i]&0x7f)==(dir2->ext[i]&0x7f); ++i); if (i==3) { printf("Error: Duplicate extent (extent=%d,%d)\n",extent,extent2); ret|=BROKEN; } } } } } /*}}}*/ /*}}}*/ if (ret==0) /* print statistics */ /*{{{*/ { struct cpmStatFS statfsbuf; int fragmented=0,borders=0; cpmStatFS(root,&statfsbuf); for (extent=0; extentmaxdir; ++extent) if ((dir=sb->dir+extent)->status>=0 && dir->status<=(sb->type==CPMFS_P2DOS ? 31 : 15)) { int i,block,previous=-1; for (i=0; i<16; ++i) { block=dir->pointers[i]&0xff; if (sb->size>256) block+=(dir->pointers[++i]&0xff)<<8; if (previous!=-1) { if (block!=0 && block!=(previous+1)) ++fragmented; ++borders; } previous=block; } } fragmented=(borders ? (1000*fragmented)/borders : 0); printf("%s: %ld/%ld files (%d.%d%% non-contigous), %ld/%ld blocks\n",image,statfsbuf.f_files-statfsbuf.f_ffree,statfsbuf.f_files,fragmented/10,fragmented%10,statfsbuf.f_blocks-statfsbuf.f_bfree,statfsbuf.f_blocks); } /*}}}*/ return ret; } /*}}}*/ const char cmd[]="fsck.cpm"; /* main */ /*{{{*/ int main(int argc, char *argv[]) { const char *err; const char *image; const char *format; const char *devopts=NULL; int uppercase=0; int c,usage=0; struct cpmSuperBlock sb; struct cpmInode root; enum Result ret; if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT; while ((c=getopt(argc,argv,"T:f:nuh?"))!=EOF) switch(c) { case 'f': format=optarg; break; case 'T': devopts=optarg; break; case 'n': norepair=1; break; case 'u': uppercase=1; break; case 'h': case '?': usage=1; break; } if (optind!=(argc-1)) usage=1; else image=argv[optind++]; if (usage) { fprintf(stderr,"Usage: %s [-f format] [-n] image\n",cmd); exit(1); } if ((err=Device_open(&sb.dev, image, (norepair ? O_RDONLY : O_RDWR), devopts))) { if ((err=Device_open(&sb.dev, image,O_RDONLY, devopts))) { fprintf(stderr,"%s: cannot open %s: %s\n",cmd,image,err); exit(1); } else { fprintf(stderr,"%s: cannot open %s for writing, no repair possible\n",cmd,image); } } if (cpmReadSuper(&sb,&root,format,uppercase)==-1) { fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } ret=fsck(&root,image); if (ret&MODIFIED) { if (cpmSync(&sb)==-1) { fprintf(stderr,"%s: write error on %s: %s\n",cmd,image,strerror(errno)); ret|=BROKEN; } fprintf(stderr,"%s: FILE SYSTEM ON %s MODIFIED",cmd,image); if (ret&BROKEN) fprintf(stderr,", PLEASE CHECK AGAIN"); fprintf(stderr,"\n"); } cpmUmount(&sb); if (ret&BROKEN) return 2; else return 0; } /*}}}*/ cpmtools-2.23/config.sub0000740000175000017500000010315414317767263015067 0ustar michaelmichael#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2021 Free Software Foundation, Inc. timestamp='2021-01-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv4 ;; i*86v) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv ;; i*86sol2) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=$(echo "$basic_machine" | sed 's/-.*//') ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') ;; os2-emx) kernel=os2 os=$(echo $basic_os | sed -e 's|os2-emx|emx|') ;; nto-qnx*) kernel=nto os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') ;; *-*) # shellcheck disable=SC2162 IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpmtools-2.23/cpmchmod.10000644000175000017500000000367414330525205014753 0ustar michaelmichael.TH CPMCHMOD 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmchmod \- change file mode on CP/M files .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmchmod .RB [ \-f .IR format ] .RB [ \-u ] .I image .I mode .I file-pattern \&... .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBCpmchmod\fP changes the file mode for files 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 "\fB\-u\fP" Show all CP/M file names in upper case. .IP "\fImode\fP" Octal file mode, as used in \fIchmod\fP(1). .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt and copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR chmod (1), .IR cpm (5) .\"}}} cpmtools-2.23/configure0000755000175000017500000051427114330525524015012 0ustar michaelmichael#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # 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'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="as_nop=: if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi fi if test "x$CONFIG_SHELL" != x then : 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'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $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 # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # 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). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... 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 -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='' PACKAGE_TARNAME='' PACKAGE_VERSION='' PACKAGE_STRING='' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="cpmfs.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= ac_subst_vars='LTLIBOBJS UPDATED FSED_CPM DEFFORMAT DISKDEFS DATADIR DEVICE LDDEPS LDLIBS LIBOBJS CPP INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_diskdefs with_defformat with_libdsk enable_largefile ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-diskdefs Specify diskdefs location --with-defformat Specify default format (ibm-3740) --with-libdsk Specify path to libdsk library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. */ #include #undef $2 /* 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 $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' // Does the compiler advertise C99 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' // Does the compiler advertise C11 conformance? #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" # Auxiliary files required by this configure script. ac_aux_files="install-sh config.guess config.sub" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac VERSION=2.23 UPDATED='November 2, 2022' DEVICE="posix" TERM="curses" if test "$prefix" = NONE then case $host in *-linux-*) ;; *-cygwin-*) CYGWIN=yes ;; *-pc-mingw32) CFLAGS_LIBDSK=-DNOTWINDLL MINGW32=yes ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else $as_nop ac_file='' fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do 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. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else $as_nop # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else $as_nop # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else $as_nop # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else $as_nop { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$GCC" = yes then CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wshadow -Wno-unused-parameter -Wunused -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common" LDFLAGS="${LDFLAGS} ${EXTRA_GLDFLAGS}-g" else CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}" LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}" fi DISKDEFS='${datarootdir}/diskdefs' # Check whether --with-diskdefs was given. if test ${with_diskdefs+y} then : withval=$with_diskdefs; DISKDEFS="$withval" else $as_nop DISKDEFS="$DISKDEFS" fi # Check whether --with-defformat was given. if test ${with_defformat+y} then : withval=$with_defformat; DEFFORMAT="$withval" else $as_nop DEFFORMAT="ibm-3740" fi # Check whether --with-libdsk was given. if test ${with_libdsk+y} then : withval=$with_libdsk; LIBDSK="$withval" else $as_nop LIBDSK="" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for printw in -lcurses" >&5 printf %s "checking for printw in -lcurses... " >&6; } if test ${ac_cv_lib_curses_printw+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char printw (); int main (void) { return printw (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_curses_printw=yes else $as_nop ac_cv_lib_curses_printw=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_printw" >&5 printf "%s\n" "$ac_cv_lib_curses_printw" >&6; } if test "x$ac_cv_lib_curses_printw" = xyes then : FSED_CPM=fsed.cpm LIBS="-lcurses $LIBS" else $as_nop FSED_CPM= fi if test x"$FSED_CPM" = x""; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for printw in -lncurses" >&5 printf %s "checking for printw in -lncurses... " >&6; } if test ${ac_cv_lib_ncurses_printw+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ char printw (); int main (void) { return printw (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_ncurses_printw=yes else $as_nop ac_cv_lib_ncurses_printw=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_printw" >&5 printf "%s\n" "$ac_cv_lib_ncurses_printw" >&6; } if test "x$ac_cv_lib_ncurses_printw" = xyes then : FSED_CPM=fsed.cpm LIBS="-lncurses $LIBS" else $as_nop FSED_CPM= fi if test x"$FSED_CPM" != x""; then printf "%s\n" "#define NEED_NCURSES 1" >>confdefs.h ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in ncurses/ncurses.h do : ac_fn_c_check_header_compile "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default" if test "x$ac_cv_header_ncurses_ncurses_h" = xyes then : printf "%s\n" "#define HAVE_NCURSES_NCURSES_H 1" >>confdefs.h have_ncurses_ncurses_h=yes fi done fi fi if test "$LIBDSK" != ""; then DEVICE="libdsk" CPPFLAGS="$CPPFLAGS -I$LIBDSK/include" CFLAGS="$CFLAGS -I$LIBDSK/include $CFLAGS_LIBDSK" LDFLAGS="$LDFLAGS -L$LIBDSK/lib" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dsk_open in -ldsk" >&5 printf %s "checking for dsk_open in -ldsk... " >&6; } if test ${ac_cv_lib_dsk_dsk_open+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldsk $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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. */ char dsk_open (); int main (void) { return dsk_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_dsk_dsk_open=yes else $as_nop ac_cv_lib_dsk_dsk_open=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dsk_dsk_open" >&5 printf "%s\n" "$ac_cv_lib_dsk_dsk_open" >&6; } if test "x$ac_cv_lib_dsk_dsk_open" = xyes then : printf "%s\n" "#define HAVE_LIBDSK 1" >>confdefs.h LIBS="-ldsk $LIBS" fi for ac_header in libdsk.h do : ac_fn_c_check_header_compile "$LINENO" "libdsk.h" "ac_cv_header_libdsk_h" "$ac_includes_default" if test "x$ac_cv_header_libdsk_h" = xyes then : printf "%s\n" "#define HAVE_LIBDSK_H 1" >>confdefs.h else $as_nop echo "No libdsk.h - aborting"; exit 1 fi done fi ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_fcntl_h" = xyes then : printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default" if test "x$ac_cv_header_sys_stat_h" = xyes then : printf "%s\n" "#define HAVE_SYS_STAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" if test "x$ac_cv_header_limits_h" = xyes then : printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes then : printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/utime.h" "ac_cv_header_sys_utime_h" "$ac_includes_default" if test "x$ac_cv_header_sys_utime_h" = xyes then : printf "%s\n" "#define HAVE_SYS_UTIME_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "utime.h" "ac_cv_header_utime_h" "$ac_includes_default" if test "x$ac_cv_header_utime_h" = xyes then : printf "%s\n" "#define HAVE_UTIME_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 printf %s "checking for an ANSI C-conforming const... " >&6; } if test ${ac_cv_c_const+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* 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; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_const=yes else $as_nop ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then printf "%s\n" "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes then : else $as_nop printf "%s\n" "#define mode_t int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes then : else $as_nop printf "%s\n" "#define off_t long int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default " if test "x$ac_cv_type_pid_t" = xyes then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _WIN64 && !defined __CYGWIN__ LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_pid_type='int' else $as_nop ac_pid_type='__int64' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes then : else $as_nop printf "%s\n" "#define ssize_t int" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 printf %s "checking whether struct tm is in sys/time.h or time.h... " >&6; } if test ${ac_cv_struct_tm+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_struct_tm=time.h else $as_nop ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 printf "%s\n" "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then printf "%s\n" "#define TM_IN_SYS_TIME 1" >>confdefs.h fi # Check whether --enable-largefile was given. if test ${enable_largefile+y} then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 printf %s "checking for special C compiler options needed for large files... " >&6; } if test ${ac_cv_sys_largefile_CC+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : break fi rm -f core conftest.err conftest.$ac_objext conftest.beam CC="$CC -n32" if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if test ${ac_cv_sys_file_offset_bits+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } if test ${ac_cv_sys_large_files+y} then : printf %s "(cached) " >&6 else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 printf "%s\n" "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h ;; esac rm -rf conftest* fi fi if test x"$FSED_CPM" != x""; then FSED_CPM="$FSED_CPM$EXEEXT" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 printf %s "checking for working memcmp... " >&6; } if test ${ac_cv_func_memcmp_working+y} then : printf %s "(cached) " >&6 else $as_nop if test "$cross_compiling" = yes then : ac_cv_func_memcmp_working=no else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_memcmp_working=yes else $as_nop ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes then : printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h else $as_nop # strftime is in -lintl on SCO UNIX. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 printf %s "checking for strftime in -lintl... " >&6; } if test ${ac_cv_lib_intl_strftime+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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. */ char strftime (); int main (void) { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_intl_strftime=yes else $as_nop ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 printf "%s\n" "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = xyes then : printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done ac_fn_c_check_func "$LINENO" "mktime" "ac_cv_func_mktime" if test "x$ac_cv_func_mktime" = xyes then : printf "%s\n" "#define HAVE_MKTIME 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes then : printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h fi eval DATADIR=$datadir ac_config_files="$ac_config_files Makefile cpm.5 cpmchattr.1 cpmchmod.1 cpmcp.1 cpmls.1 cpmrm.1 fsck.cpm.1 fsed.cpm.1 mkfs.cpm.1 diskdefs.5" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else $as_nop as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... 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 -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" 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 shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "cpm.5") CONFIG_FILES="$CONFIG_FILES cpm.5" ;; "cpmchattr.1") CONFIG_FILES="$CONFIG_FILES cpmchattr.1" ;; "cpmchmod.1") CONFIG_FILES="$CONFIG_FILES cpmchmod.1" ;; "cpmcp.1") CONFIG_FILES="$CONFIG_FILES cpmcp.1" ;; "cpmls.1") CONFIG_FILES="$CONFIG_FILES cpmls.1" ;; "cpmrm.1") CONFIG_FILES="$CONFIG_FILES cpmrm.1" ;; "fsck.cpm.1") CONFIG_FILES="$CONFIG_FILES fsck.cpm.1" ;; "fsed.cpm.1") CONFIG_FILES="$CONFIG_FILES fsed.cpm.1" ;; "mkfs.cpm.1") CONFIG_FILES="$CONFIG_FILES mkfs.cpm.1" ;; "diskdefs.5") CONFIG_FILES="$CONFIG_FILES diskdefs.5" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cpmtools-2.23/device_libdsk.c0000640000175000017500000000702114047006226016016 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include "device.h" /*}}}*/ static const char *lookupFormat(DSK_GEOMETRY *geom, const char *name) { dsk_format_t fmt = FMT_180K; const char *fname; while (dg_stdformat(NULL, fmt, &fname, NULL) == DSK_ERR_OK) { if (!strcmp(name, fname)) { dg_stdformat(geom, fmt, &fname, NULL); return NULL; } ++fmt; } return "Unrecognised LibDsk geometry specification"; } /* Device_open -- Open an image file */ /*{{{*/ const char *Device_open(struct Device *this, const char *filename, int mode, const char *deviceOpts) { 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; 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 */ /*{{{*/ 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 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) { this->geom.dg_cylinders = tracks; this->geom.dg_heads = 1; } else { this->geom.dg_cylinders = tracks/2; this->geom.dg_heads = 2; } return NULL; } /*}}}*/ /* Device_close -- Close an image file */ /*{{{*/ const char *Device_close(struct Device *this) { dsk_err_t e; this->opened=0; e = dsk_close(&this->dev); return (e?dsk_strerror(e):(const char*)0); } /*}}}*/ /* Device_readSector -- read a physical sector */ /*{{{*/ const char *Device_readSector(const struct Device *this, int track, int sector, char *buf) { dsk_err_t e; e = dsk_lread(this->dev, &this->geom, buf, (track * this->sectrk) + sector + this->offset/this->secLength); return (e?dsk_strerror(e):(const char*)0); } /*}}}*/ /* Device_writeSector -- write physical sector */ /*{{{*/ const char *Device_writeSector(const struct Device *this, int track, int sector, const char *buf) { dsk_err_t e; e = dsk_lwrite(this->dev, &this->geom, buf, (track * this->sectrk) + sector + this->offset/this->secLength); return (e?dsk_strerror(e):(const char*)0); } /*}}}*/ cpmtools-2.23/diskdefs0000644000175000017500000012041714050213236014606 0ustar michaelmichaeldiskdef ibm-3740 seclen 128 tracks 77 sectrk 26 blocksize 1024 maxdir 64 skew 6 boottrk 2 os 2.2 end diskdef 4mb-hd seclen 128 tracks 1024 sectrk 32 blocksize 2048 maxdir 256 skew 1 boottrk 0 os p2dos end diskdef sdcard seclen 512 tracks 256 sectrk 64 blocksize 8192 maxdir 256 skew 0 boottrk 1 os 2.2 end diskdef pcw seclen 512 tracks 40 sectrk 9 blocksize 1024 maxdir 64 skew 1 boottrk 1 os 3 libdsk:format pcw180 end diskdef pc1.2m seclen 512 tracks 80 # this format uses 15 sectors per track, but 30 per cylinder sectrk 30 blocksize 4096 maxdir 256 skew 1 boottrk 0 os 3 end # CP/M 86 on 1.44MB floppies diskdef cpm86-144feat seclen 512 tracks 160 sectrk 18 blocksize 4096 maxdir 256 skew 1 boottrk 2 os 3 libdsk:format ibm1440 end # CP/M 86 on 720KB floppies diskdef cpm86-720 seclen 512 tracks 160 sectrk 9 blocksize 2048 maxdir 256 skew 1 boottrk 2 os 3 end diskdef cf2dd seclen 512 tracks 160 sectrk 9 blocksize 2048 maxdir 256 skew 1 boottrk 1 os 3 libdsk:format pcw720 end #amstrad: values are read from super block (special name hardcoded) # Royal alphatronic # setfdprm /dev/fd1 dd ssize=256 cyl=40 sect=16 head=2 diskdef alpha seclen 256 tracks 40 sectrk 32 blocksize 2048 maxdir 128 skew 1 boottrk 2 os 2.2 end # Apple II CP/M skew o Apple II DOS 3.3 skew diskdef apple-do seclen 256 tracks 35 sectrk 16 blocksize 1024 maxdir 64 skewtab 0,6,12,3,9,15,14,5,11,2,8,7,13,4,10,1 boottrk 3 os 2.2 end # Apple II CP/M skew o Apple II PRODOS skew diskdef apple-po seclen 256 tracks 35 sectrk 16 blocksize 1024 maxdir 64 skewtab 0,9,3,12,6,15,1,10,4,13,7,8,2,11,5,14 boottrk 3 os 2.2 end # MYZ80 hard drive (only works with libdsk, because it has a 256-byte header) diskdef myz80 seclen 1024 tracks 64 sectrk 128 blocksize 4096 maxdir 1024 skew 1 boottrk 0 os 3 libdsk:format pcw720 end # Despite being Amstrad formats, CPC System and CPC Data don't have an Amstrad # superblock. You'll need to use libdsk to access them because the Linux # and Windows kernel drivers won't touch them. diskdef cpcsys seclen 512 tracks 40 sectrk 9 blocksize 1024 maxdir 64 skew 1 boottrk 2 os 3 libdsk:format cpcsys end diskdef cpcdata seclen 512 tracks 40 sectrk 9 blocksize 1024 maxdir 64 skew 1 boottrk 0 os 3 libdsk:format cpcdata end # after being read in with no sector skew. diskdef nigdos seclen 512 # NigDos double sided disk format, 42 tracks * 2 sides tracks 84 sectrk 10 blocksize 2048 maxdir 128 skew 1 boottrk 0 # this format wastes half of the directory entry logicalextents 1 os 3 end diskdef epsqx10 seclen 512 tracks 40 sectrk 20 blocksize 2048 maxdir 128 skew 0 boottrk 2 os 2.2 end diskdef ibm-8ss seclen 512 tracks 40 sectrk 8 blocksize 1024 maxdir 64 skew 0 boottrk 1 os 2.2 end diskdef ibm-8ds seclen 512 tracks 40 sectrk 8 blocksize 1024 maxdir 64 skew 0 boottrk 1 os 2.2 end diskdef electroglas seclen 512 tracks 80 sectrk 10 blocksize 2048 maxdir 256 skew 0 boottrk 1 os 3 end # IBM CP/M-86 # setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 head=1 diskdef ibmpc-514ss seclen 512 tracks 40 sectrk 8 blocksize 1024 maxdir 64 skew 1 boottrk 1 os 2.2 libdsk:format ibm160 end # IBM CP/M-86 # setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 diskdef ibmpc-514ds seclen 512 tracks 80 sectrk 8 blocksize 2048 maxdir 64 skew 0 boottrk 2 os 2.2 libdsk:format ibm320 end diskdef p112 seclen 512 tracks 160 sectrk 18 blocksize 2048 maxdir 256 skew 1 boottrk 2 os 3 end diskdef p112-old seclen 512 tracks 160 sectrk 18 blocksize 2048 maxdir 128 skew 1 boottrk 1 os 3 end diskdef gide-cfa seclen 512 tracks 1000 sectrk 16 blocksize 4096 maxdir 1024 skew 0 boottrk 2 os 3 end diskdef gide-cfb seclen 512 tracks 1000 sectrk 16 blocksize 4096 maxdir 1024 skew 0 boottrk 0 # Start of second partition offset 1000trk os 3 end # AT&T/Olivetti Word Processor diskdef attwp seclen 256 tracks 80 sectrk 32 blocksize 2048 maxdir 128 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.2 end # setfdprm /dev/fd0 zerobased SS DD ssize=512 cyl=40 sect=10 head=1 # Kaypro II diskdef kpii seclen 512 tracks 40 sectrk 10 blocksize 1024 maxdir 64 dirblks 4 skew 0 boottrk 1 os 2.2 end # setfdprm /dev/fd0 zerobased DS DD ssize=512 cyl=40 sect=10 head=2 # Kayro IV diskdef kpiv seclen 512 tracks 80 sectrk 10 blocksize 2048 maxdir 64 dirblks 2 skew 0 boottrk 1 os 2.2 end # setfdprm /dev/fd0 dd sect=10 diskdef interak seclen 512 tracks 80 sectrk 20 blocksize 4096 maxdir 256 skew 1 boottrk 2 os 2.2 end # Timex FDD3000 3" diskdef fdd3000 seclen 256 tracks 40 sectrk 16 blocksize 1024 maxdir 128 boottrk 4 os 2.2 skew 7 end # Timex FDD3000 3" diskdef fdd3000_2 seclen 256 tracks 40 sectrk 16 blocksize 1024 maxdir 128 boottrk 2 os 2.2 skew 5 end # Robotron 1715 diskdef 1715 seclen 1024 tracks 40 sectrk 5 blocksize 1024 maxdir 64 skew 0 boottrk 3 os 2.2 end # Robotron 1715 with SCP3 diskdef 17153 seclen 1024 tracks 160 sectrk 5 blocksize 2048 maxdir 128 skew 0 boottrk 4 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 tracks 80 sectrk 10 blocksize 2048 maxdir 128 skew 0 boottrk 2 os 3 end # Microbee 40 track 5.25" disks diskdef microbee40 seclen 512 tracks 80 sectrk 10 blocksize 2048 maxdir 128 skewtab 1,4,7,0,3,6,9,2,5,8 boottrk 2 os 2.2 end diskdef dreamdisk40 seclen 512 tracks 80 sectrk 10 blocksize 2048 maxdir 128 skewtab 1,4,7,0,3,6,9,2,5,8 boottrk 2 os 2.2 end diskdef dreamdisk80 seclen 512 tracks 160 sectrk 10 blocksize 2048 maxdir 256 skewtab 1,4,7,0,3,6,9,2,5,8 boottrk 2 os 2.2 end # RC75x series diskdef rc75x seclen 1024 tracks 154 sectrk 8 blocksize 2048 maxdir 512 boottrk 4 os 3 end # ICL Comet: 40 track 5.25" Single Sided # diskdef icl-comet-525ss seclen 512 tracks 40 sectrk 10 blocksize 1024 maxdir 64 skewtab 0,3,6,9,2,5,8,1,4,7 boottrk 2 os 2.2 end diskdef z80pack-hd seclen 128 tracks 255 sectrk 128 blocksize 2048 maxdir 1024 skew 0 boottrk 0 os 2.2 end diskdef z80pack-hdb seclen 128 tracks 256 sectrk 16384 blocksize 16384 maxdir 8192 skew 0 boottrk 0 os 2.2 end # Bondwell 12 and 14 disk images in IMD raw binary format diskdef bw12 seclen 256 tracks 40 sectrk 18 blocksize 2048 maxdir 64 skew 1 boottrk 2 os 2.2 end diskdef bw14 seclen 256 tracks 80 sectrk 18 blocksize 2048 maxdir 64 skew 1 boottrk 2 os 2.2 end ############################ # north star cp/m disks ############################ #North Star floppy 360K diskdef nsfd seclen 512 tracks 70 sectrk 10 blocksize 2048 maxdir 64 skew 5 boottrk 2 os 2.2 end #North Star CP/M Virtual-Disk file on Hard Disk # prepared with allocation factor = 4 # as in "CR CPMB 4000 4" # needs to be copied off hard drive before you can # work on it with cpmtools diskdef nshd4 seclen 512 tracks 512 sectrk 16 blocksize 4096 maxdir 256 skew 0 boottrk 0 os 2.2 end #North Star CP/M Virtual-Disk file on Hard Disk # prepared with allocation factor = 8 # as in "CR CPMB 6000 8" # needs to be copied off hard drive before you can # work on it with cpmtools diskdef nshd8 seclen 512 tracks 1024 sectrk 16 blocksize 8192 maxdir 256 skew 0 boottrk 0 os 2.2 end # Northstar Micro-Disk System MDS-A-D 175 diskdef mdsad175 seclen 512 blocksize 1024 tracks 35 maxdir 64 boottrk 2 sectrk 10 skew 5 os 2.2 end # Northstar Micro-Disk System MDS-A-D 350 diskdef mdsad350 seclen 512 blocksize 2048 tracks 70 maxdir 64 boottrk 2 sectrk 10 skew 5 os 2.2 end # Osborne 1 diskdef osborne1 seclen 1024 tracks 40 sectrk 5 blocksize 1024 maxdir 64 boottrk 3 os 2.2 end # Osborne Nuevo/Vixen/4 diskdef osborne4 seclen 1024 tracks 80 sectrk 5 blocksize 2048 maxdir 128 skew 2 boottrk 2 os 2.2 end # Lobo Max-80 8" CP/M 2 diskdef lobo2 seclen 256 tracks 77 sectrk 30 blocksize 2048 maxdir 64 skew 0 boottrk 2 os 2.2 end #Lobo Max-80 8" CP/M 3 diskdef lobo3 seclen 512 tracks 77 sectrk 17 blocksize 2048 maxdir 64 skew 0 boottrk 2 os 3 end # PRO CP/M RZ50 DZ format (Perhaps only 79 tracks should be used?) diskdef dec_pro seclen 512 tracks 80 sectrk 10 blocksize 2048 maxdir 128 skew 2 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 # ZEN7 Zenith Z-100 - SSDD 48 tpi 5.25" - 512 x 8 diskdef zen7 seclen 512 tracks 40 sectrk 8 blocksize 1024 maxdir 128 skew 1 boottrk 2 os 2.2 end # ZEN8 Zenith Z-100 - DSDD 48 tpi 5.25" - 512 x 8 diskdef zen8 seclen 512 tracks 80 sectrk 8 blocksize 2048 maxdir 256 skew 1 boottrk 2 os 2.2 end # ZEN9 Zenith Z-100 - SSSD 8" - 128 x 26 diskdef zen9 seclen 128 tracks 77 sectrk 26 blocksize 1024 maxdir 64 skew 6 boottrk 2 os 2.2 end # ZENA Zenith Z-100 - SSDD 8" - 256 x 26 diskdef zena seclen 256 tracks 77 sectrk 26 blocksize 2048 maxdir 128 skew 9 boottrk 2 os 2.2 end # Morrow Designs Micro-Decision DOUBLE # 64k CP/M Vers. 2.2 Rev.2.3 SIDED # Copyright '76, '77, '78, '79, '80 # 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 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 # All TRS formats added by Larry Kraemer # BEGIN trsomsssd TRS-80 Model 1, Omikron CP/M - SSSD 48 tpi 5.25" - 128 x 18 # Test OK - image size = 80,640, from TRS-80 Yahoo Group posting diskdef trsomsssd 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 diskdef trsg #= TRS-80 Model 4,4P Montezuma System 170K - SSDD 48 tpi 5.25" seclen 256 #= Sectors xx,256 tracks 40 #= (Cylinders * Sides) = 40*1 = 40 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 18 #= Sectors 18,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsh #= TRS-80 Model 4,4P Montezuma Data 200K - SSDD 48 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 40 #= (Cylinders * Sides) = 40*1 = 40 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsi #= TRS-80 Model 4,4P Montezuma System 350K - DSDD 48 tpi 5.25" seclen 256 #= Sectors xx,256 tracks 80 #= (Cylinders * Sides) = 40*2 = 80 # sides outout #= Order of Cylinders = alt, outout, outback sectrk 18 #= Sectors 18,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 #end diskdef trsj #= TRS-80 Model 4,4P Montezuma Data 400K - DSDD 48 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 80 #= (Cylinders * Sides) = 40*2 = 80 # sides outout #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsk #= TRS-80 Model 4,4P Montezuma System 350K - SSDD 96 tpi 5.25" seclen 256 #= Sectors xx,256 tracks 80 #= (Cylinders * Sides) = 80*1 = 80 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 18 #= Sectors 18,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsl #= TRS-80 Model 4,4P Montezuma Data 400K - SSDD 96 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 80 #= (Cylinders * Sides) = 80*1 = 80 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsm #= TRS-80 Model 4,4P Montezuma System 710K - DSDD 96 tpi 5.25" seclen 256 #= Sectors xx,256 tracks 160 #= (Cylinders * Sides) = 80*2 = 160 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 18 #= Sectors 18,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsn #= TRS-80 Model 4,4P Montezuma Data 800K - DSDD 96 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 160 #= (Cylinders * Sides) = 80*2 = 160 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 0 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trso #= TRS-80 Model 4,4P Montezuma Extend System 190K - SSDD 48 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 40 #= (Cylinders * Sides) = 40*1 = 40 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try x boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsp #= TRS-80 Model 4,4P Montezuma Extend System 390K - DSDD 48 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 80 #= (Cylinders * Sides) = 40*2 = 80 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsq #= TRS-80 Model 4,4P Montezuma Extend System 390K - SSDD 96 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 80 #= (Cylinders * Sides) = 80*1 = 80 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsr #= TRS-80 Model 4,4P Montezuma Extend System 790K - DSDD 96 tpi 5.25" seclen 512 #= Sectors xx,512 tracks 160 #= (Cylinders * Sides) = 80*2 = 160 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 2 #= OFS = 2 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trss #= TRS-80 Model 4,4P Montezuma Super Data 220K - SSDD 48 tpi 5.25" seclen 1024 #= Sectors xx,1024 tracks 40 #= (Cylinders * Sides) = 40*1 = 40 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 6 #= Sectors 6,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trst #= TRS-80 Model 4,4P Montezuma Super Data 440K - DSDD 48 tpi 5.25" seclen 1024 #= Sectors xx,1024 tracks 80 #= (Cylinders * Sides) = 40*2 = 80 # sides outout #= Order of Cylinders = alt, outout, outback sectrk 6 #= Sectors 6,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsu #= TRS-80 Model 4,4P Montezuma Super Data 440K - SSDD 96 tpi 5.25" seclen 1024 #= Sectors xx,1024 tracks 80 #= (Cylinders * Sides) = 80*1 = 80 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 6 #= Sectors 6,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsv #= TRS-80 Model 4,4P Montezuma Super Data 880K - DSDD 96 tpi 5.25" seclen 1024 #= Sectors xx,1024 tracks 160 #= (Cylinders * Sides) = 80*2 = 160 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 6 #= Sectors 6,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try x boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end diskdef trsw #= TRS-80 Model 4,4P Montezuma System 400K - SSDD 96 tpi 3.5" seclen 512 #= Sectors xx,512 tracks 80 #= (Cylinders * Sides) = 80*1 = 80 # sides alt #= Order of Cylinders = alt, outout, outback sectrk 10 #= Sectors 10,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 # datarate DD #= DENSITY SD, DD, HD, or ED # FM NO #= Format YES = FM, or NO = MFM skew 2 #= [0..8] try 2 boottrk 0 #= OFS = 0 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end #BEGIN TRSE TRS-80 II/12/16 Aton CP/M - SSHD 8" - 1024 x 8 diskdef trse seclen 1024 tracks 77 sectrk 8 blocksize 2048 maxdir 128 datarate DD fm NO skew 3 boottrk 0 offset 11520 os 2.2 end # TRSF TRS-80 II/12/16 Aton CP/M - DSHD 8" - 1024 x 8 diskdef trsf seclen 1024 tracks 154 sides alt sectrk 8 blocksize 2048 maxdir 192 skew 3 boottrk 0 offset 11520 os 2.2 end # TRS5 TRS-80, Lifeboat CP/M (1024 bytes/sector) - SSDD 8" # The first track is 26 sectors with 128 bytes, the rest are 1024 x 8 diskdef trs5 seclen 1024 tracks 75 sectrk 8 blocksize 2048 maxdir 128 skew 3 boottrk 0 os 2.2 offset 11520 end # Memotech type 03, ie: 3.5" or 5.25", D/S, D/D, S/T # 40 tracks, 2 sides, 16 sectors/track, 256 bytes/sector # Bytes on the media = 2*40*16*256 = 327680 # 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 # Ampro - DSDD 48 tpi 5.25" - 512 x 10 diskdef ampro400d seclen 512 tracks 80 sectrk 10 blocksize 2048 maxdir 128 skew 0 boottrk 2 os 2.2 libdsk:format ampro400d # DENSITY MFM ,LOW # BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 end # BEGIN ampdsdd80 Ampro - DSDD 96 tpi 5.25" - 512 x 10 # Test OK - image size = 819,200, from Don Maslin's archive diskdef ampdsdd80 seclen 1024 tracks 160 sectrk 5 blocksize 2048 maxdir 128 skew 0 boottrk 2 os 2.2 libdsk:format ampro800 # DENSITY MFM ,LOW # BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 end # ALTAIRZ80 SIMH *dsk 8MB Harddisk (Type AZ80 HDSK) diskdef 8megAltairSIMH seclen 128 tracks 2048 sectrk 32 blocksize 4096 maxdir 1024 skew 0 boottrk 6 os 2.2 end # ALTAIRZ80 SIMH *dsk MITS 88-DISK 137 Byte/Sektor # speedball (copylib) skewtable diskdef simh seclen 128 tracks 254 sectrk 32 blocksize 2048 maxdir 256 skew 17 boottrk 6 os 2.2 end diskdef all1 #= Allen-Bradley Advisor+ - DSDD 3.5" seclen 512 #= Sectors xx,512 tracks 160 #= (Cylinders * Sides) = 80*2 = 160 sides alt #= Order of Cylinders = alt, outout, outback sectrk 8 #= Sectors 8,xxx blocksize 2048 #= (128*(BLM+1)) = 7=1024, 15=2048, 31=4096, 63=8192 maxdir 128 #= (DRM+1) = 128 datarate DD #= DENSITY SD, DD, HD, or ED FM NO #= Format YES = FM, or NO = MFM skew 0 #= [0..8] try x boottrk 1 #= OFS = 1 # #= 2, 2.2, or 3 (NO comment on next line) os 2.2 end # COM8 Compupro (Viasyn) 8/16 - SSDD 8" - 1024 x 8 # IMD RAW format diskdef com8 seclen 1024 tracks 77 sectrk 8 blocksize 2048 maxdir 128 skew 3 offset 11520 boottrk 0 os 2.2 end # Spectravideo SVI-728 (MSX) with SVI-707 floppy drive diskdef svi707 seclen 256 tracks 40 sectrk 17 blocksize 2048 maxdir 64 skew 0 boottrk 3 os 2.2 end # Intel MDS/22 8" Double Density diskdef mds-dd seclen 128 tracks 77 sectrk 52 blocksize 2048 maxdir 128 skew 0 boottrk 2 os 2.2 end # Intel MDS/22 8" Single Density. Untested. diskdef mds-sd seclen 128 tracks 77 sectrk 26 blocksize 1024 maxdir 64 skew 0 boottrk 2 os 2.2 end # CF card in PCMCIA slot on NC200 with cpmish diskdef nc200cf seclen 512 tracks 256 sectrk 256 blocksize 16384 maxdir 512 boottrk 0 os 2.2 end # Floppy image on NC200 with cpmish diskdef nc200cpm seclen 512 tracks 80 sectrk 18 blocksize 2048 maxdir 128 boottrk 2 os 2.2 end # ZCN format drive partitions in nc100em's nc100.card # use this for a bootable A: drive # (assumes ZCN system is 12k, which it has been for years) diskdef zcna_boot seclen 1024 tracks 256 sectrk 1 blocksize 1024 maxdir 64 skew 0 boottrk 13 os 2.2 end # use this for a non-bootable A: drive diskdef zcna_nonboot seclen 1024 tracks 256 sectrk 1 blocksize 1024 maxdir 64 skew 0 boottrk 1 os 2.2 end # ZCN b/c/d all assumed to be non-bootable diskdef zcnb seclen 1024 tracks 256 sectrk 1 blocksize 1024 maxdir 64 skew 0 boottrk 1 os 2.2 offset 256KB end diskdef zcnc seclen 1024 tracks 256 sectrk 1 blocksize 1024 maxdir 64 skew 0 boottrk 1 os 2.2 offset 512KB end diskdef zcnd seclen 1024 tracks 256 sectrk 1 blocksize 1024 maxdir 64 skew 0 boottrk 1 os 2.2 offset 768KB end # Hewlett-Packard HP9000-200 - 70-track SS drive that emulates a # 35 track DSDD 48 tpi 5.25" diskdef HP25 seclen 256 tracks 66 sectrk 16 blocksize 1024 maxdir 128 skew 0 boottrk 3 os 2.2 end diskdef yaze512 # BSH 4 BLM 15 EXM 1 DSM 255 DRM 1023 AL0 0FFH AL1 0FFH OFS 0 seclen 128 tracks 4096 sectrk 8 blocksize 2048 maxdir 1024 skew 1 offset 128 boottrk 0 os 3 end cpmtools-2.23/cpmrm.1.in0000640000175000017500000000351514047006226014674 0ustar michaelmichael.TH CPMRM 1 "@UPDATED@" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmrm \- remove files on CP/M disks .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmrm .RB [ \-f .IR format ] .RB [ \-u ] .I image .I file-pattern \&... .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBcpmrm\fP removes files from CP/M disks. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-T\fP \fIlibdsk-type\fP" libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images (requires building cpmtools with support for libdsk). .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ @DATADIR@/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR cpm (5) .\"}}} cpmtools-2.23/COPYING0000640000175000017500000010437414047006226014127 0ustar michaelmichael GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . cpmtools-2.23/cpmchattr.1.in0000640000175000017500000000521614047006226015543 0ustar michaelmichael.TH CPMCHATTR 1 "@UPDATED@" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmchattr \- change file attributes on CP/M files .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmchattr .RB [ \-f .IR format ] .RB [ \-u ] .I image .I attrib .I file-pattern \&... .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBCpmchattr\fP changes the file attributes for files on CP/M disks. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-T\fP \fIlibdsk-type\fP" libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images (requires building cpmtools with support for libdsk). .IP "\fB\-u\fP" Show all CP/M file names in upper case. .IP "\fIattrib\fP" Set the file attributes as given. .\"}}} .SH "FILE ATTRIBUTES" \"{{{ The file attribute string can contain the characters 1,2,3,4,r,s,a,n and m. The meanings of these are: .TP .B 1-4 The CP/M "user attributes" F1-F4. CP/M does not assign any meaning to these attributes, though MP/M does. .TP .B r The file is read-only. This is the same as using .I cpmchmod(1) to revoke write permissions. .TP .B s The file is a system file. This attribute can also be set by .I cpmchmod(1). .TP .B a The file has been backed up. .TP .B n Reset all attributes to zero. So the string "n1r" resets all attributes and then sets F1 and Read-Only. .TP .B m Attributes after an m are unset rather than set. The string "12m34" sets atttributes F1 and F2, and unsets F3 and F4. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ @DATADIR@/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt and copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR cpmchmod (1), .IR cpm (5) .\"}}} cpmtools-2.23/mkfs.cpm.1.in0000640000175000017500000000425514047006226015276 0ustar michaelmichael.TH MKFS.CPM 1 "@UPDATED@" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ mkfs.cpm \- make a CP/M file system .\"}}} .SH SYNOPSIS \"{{{ .ad l .B mkfs.cpm .RB [ \-f .IR format ] .RB [ \-b .IR boot ] .RB [ \-L .IR label ] .RB [ \-t ] .RB [ \-u ] .I image .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBmkfs.cpm\fP makes a CP/M file system on an image file or device. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-b\fP \fIbootblock\fP" Write the contents of the file \fIbootblock\fP to the system tracks instead of filling them with 0xe5. This option can be used up to four times. The file contents (typically boot block, CCP, BDOS and BIOS) are written to sequential sectors, padding with 0xe5 if needed. .IP "\fB\-L\fP \fIlabel\fP" Label the file system. This is only supported by CP/M Plus. .IP "\fB\-t\fP" Create time stamps. .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ @DATADIR@/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR fsck.cpm (1), .IR cpmls (1), .IR mkfs (1), .IR cpm (5) .\"}}} cpmtools-2.23/diskdefs.50000644000175000017500000000322214330525206014747 0ustar michaelmichael.\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en \(en .TH DISKDEFS 5 "October 10, 2022" "CP/M tools" "File formats" .SH NAME \"{{{roff}}}\"{{{ diskdefs \- CP/M disk and file system format definitions .\"}}} .SH DESCRIPTION \"{{{ The diskdefs file contains CP/M format descriptions, because CP/M in general does not store those in the file system and there are no standards of any kind. .PP A diskdefs file consists of one or more entries of the format: .PP .nf .RS \fBdiskdef\fP \fIname\fP \fBseclen\fP \fIsize\fP \fBtracks\fP \fIcount\fP \fBsectrk\fP \fIcount\fP \fBblocksize\fP \fIsize\fP \fBmaxdir\fP \fIcount\fP [\fBdirblks\fP \fIcount\fP] \fBboottrk\fP \fInumber\fP [\fBbootsec\fP \fInumber\fP] [\fBskew\fP \fInumber\fP] [\fBskewtab\fP \fIsector\fP[\fB,\fP\fIsector\fP]...] [\fBos\fP \fB2.2\fP|\fB3\fP|\fBisx\fP|\fBp2dos\fP|\fBzsys\fP] [\fBoffset\fP \fIsize\fP] [\fBlogicalextents\fP \fIcount\fP] [\fBlibdsk:format\fP \fIname\fP] \fBend\fP .RE .fi .PP \fBskew\fP and \fBskewtab\fP must only be used exclusively. .PP Comments are marked with a leading hash or semicolon and extend to the end of the line. .PP It is possible to reserve space after the directory beyond \fBmaxdir\fP using an inflated DPB ALV0. If the format makes use of that, \fBdirblks\fP must be set. .PP \fBbootsec\fP contains the total number of sectors used by the boot area. This is for CP/M systems that map multiple logical tracks onto a physical track. While raw disk images can be configured for doing the same, accessing libdsk images needs to be done by physical tracks. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpm (5) .\"}}} cpmtools-2.23/cpmfs.h0000640000175000017500000001030714330525147014350 0ustar michaelmichael#ifndef CPMFS_H #define CPMFS_H #ifdef __cplusplus extern "C" { #endif #include "device.h" /* CP/M file attributes */ #define CPM_ATTR_F1 1 #define CPM_ATTR_F2 2 #define CPM_ATTR_F3 4 #define CPM_ATTR_F4 8 /* F5-F8 are banned in CP/M 2 & 3, F7 is used by ZSDOS */ #define CPM_ATTR_RO 256 /* Read-only */ #define CPM_ATTR_SYS 512 /* System */ #define CPM_ATTR_ARCV 1024 /* Archive */ #define CPM_ATTR_PWDEL 2048 /* Password required to delete */ #define CPM_ATTR_PWWRITE 4096 /* Password required to write */ #define CPM_ATTR_PWREAD 8192 /* Password required to read */ typedef int cpm_attr_t; struct cpmInode { ino_t ino; mode_t mode; off_t size; cpm_attr_t attr; time_t atime; time_t mtime; time_t ctime; struct cpmSuperBlock *sb; }; struct cpmFile { mode_t mode; off_t pos; struct cpmInode *ino; }; struct cpmDirent { ino_t ino; off_t off; size_t reclen; char name[2+8+1+3+1]; /* 00foobarxy.zzy\0 */ }; struct cpmStat { ino_t ino; mode_t mode; off_t size; time_t atime; time_t mtime; time_t ctime; }; /* Note: CPMFS_HI_USER should be split for systems with user numbers * up to 31 and CP/M 3, which uses them, but for password entries and * not for files. */ #define CPMFS_HI_USER (0x1<<0) /* has user numbers up to 31 */ #define CPMFS_CPM3_DATES (0x1<<1) /* has CP/M+ style time stamps */ #define CPMFS_CPM3_OTHER (0x1<<2) /* has passwords and disc label */ #define CPMFS_DS_DATES (0x1<<3) /* has datestamper timestamps */ #define CPMFS_EXACT_SIZE (0x1<<4) /* has reverse exact file size */ #define CPMFS_DR22 (CPMFS_HI_USER) #define CPMFS_P2DOS (CPMFS_CPM3_DATES|CPMFS_HI_USER) #define CPMFS_DR3 (CPMFS_CPM3_DATES|CPMFS_CPM3_OTHER|CPMFS_HI_USER) #define CPMFS_ISX (CPMFS_EXACT_SIZE) #define CPMFS_ZSYS (CPMFS_HI_USER) struct dsEntry { char year; char month; char day; char hour; char minute; }; struct dsDate { struct dsEntry create; struct dsEntry access; struct dsEntry modify; char checksum; }; struct cpmSuperBlock { struct Device dev; int uppercase; int secLength; int tracks; int sectrk; int blksiz; int maxdir; int dirblks; int skew; int bootsec; int boottrk; off_t offset; int type; int size; int extents; /* logical extents per physical extent */ int *skewtab; char libdskGeometry[256]; struct PhysDirectoryEntry *dir; int alvSize; int *alv; int cnotatime; char *label; size_t labelLength; char *passwd; size_t passwdLength; struct cpmInode *root; int dirtyDirectory; struct dsDate *ds; int dirtyDs; }; struct cpmStatFS { long f_bsize; long f_blocks; long f_bfree; long f_bused; long f_bavail; long f_files; long f_ffree; long f_namelen; }; extern char const cmd[]; extern char const *boo; int match(char const *a, char const *pattern); void cpmglob(int opti, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv); void cpmglobfree(char **dirent, int entries); int cpmReadSuper(struct cpmSuperBlock *drive, struct cpmInode *root, const char *format, int uppercase); int cpmNamei(const struct cpmInode *dir, const char *filename, struct cpmInode *i); void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf); int cpmUnlink(const struct cpmInode *dir, const char *fname); int cpmRename(const struct cpmInode *dir, const char *old, const char *newname); int cpmOpendir(struct cpmInode *dir, struct cpmFile *dirp); int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent); void cpmStat(const struct cpmInode *ino, struct cpmStat *buf); int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib); int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib); int cpmChmod(struct cpmInode *ino, mode_t mode); int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode); ssize_t cpmRead(struct cpmFile *file, char *buf, size_t count); ssize_t cpmWrite(struct cpmFile *file, const char *buf, size_t count); int cpmClose(struct cpmFile *file); int cpmCreat(struct cpmInode *dir, const char *fname, struct cpmInode *ino, mode_t mode); void cpmUtime(struct cpmInode *ino, struct utimbuf *times); int cpmSync(struct cpmSuperBlock *sb); int cpmUmount(struct cpmSuperBlock *sb); int cpmCheckDs(struct cpmSuperBlock *sb); #ifdef __cplusplus } #endif #endif cpmtools-2.23/mkfs.cpm.10000644000175000017500000000427214330525205014672 0ustar michaelmichael.TH MKFS.CPM 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ mkfs.cpm \- make a CP/M file system .\"}}} .SH SYNOPSIS \"{{{ .ad l .B mkfs.cpm .RB [ \-f .IR format ] .RB [ \-b .IR boot ] .RB [ \-L .IR label ] .RB [ \-t ] .RB [ \-u ] .I image .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBmkfs.cpm\fP makes a CP/M file system on an image file or device. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-b\fP \fIbootblock\fP" Write the contents of the file \fIbootblock\fP to the system tracks instead of filling them with 0xe5. This option can be used up to four times. The file contents (typically boot block, CCP, BDOS and BIOS) are written to sequential sectors, padding with 0xe5 if needed. .IP "\fB\-L\fP \fIlabel\fP" Label the file system. This is only supported by CP/M Plus. .IP "\fB\-t\fP" Create time stamps. .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR fsck.cpm (1), .IR cpmls (1), .IR mkfs (1), .IR cpm (5) .\"}}} cpmtools-2.23/term_curses.c0000640000175000017500000000225714047006226015570 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #ifdef NEED_NCURSES #ifdef HAVE_NCURSES_NCURSES_H #include #else #include #endif #else #include #endif #include #include #include #include #include "term.h" /*}}}*/ void term_init(void) /*{{{*/ { initscr(); noecho(); raw(); nonl(); idlok(stdscr,TRUE); idcok(stdscr,TRUE); keypad(stdscr,TRUE); clear(); } /*}}}*/ void term_exit(void) /*{{{*/ { move(LINES-1,0); refresh(); echo(); noraw(); endwin(); } /*}}}*/ void term_clear(void) /*{{{*/ { clear(); } /*}}}*/ void term_xy(int x, int y) /*{{{*/ { move(y,x); } /*}}}*/ void term_printf(char const *fmt, ...) /*{{{*/ { va_list ap; va_start(ap, fmt); vw_printw(stdscr, fmt, ap); va_end(ap); } /*}}}*/ void term_putch(char ch) /*{{{*/ { addch(ch); } /*}}}*/ int term_getch(void) /*{{{*/ { return getch(); } /*}}}*/ void term_reverse(int on) /*{{{*/ { if (on) attron(A_REVERSE); else attroff(A_REVERSE); } /*}}}*/ int term_lines(void) /*{{{*/ { return LINES; } /*}}}*/ int term_cols(void) /*{{{*/ { return COLS; } /*}}}*/ cpmtools-2.23/getopt_.h0000644000175000017500000001760714047006226014714 0ustar michaelmichael/* Declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif /* Standalone applications should #define __GETOPT_PREFIX to an identifier that prefixes the external functions and variables defined in this header. When this happens, include the headers that might declare getopt so that they will not cause confusion if included after this file. Then systematically rename identifiers so that they do not collide with the system functions and variables. Renaming avoids problems with some compilers and linkers. */ #if defined __GETOPT_PREFIX && !defined __need_getopt # include # include # include # undef __need_getopt # undef getopt # undef getopt_long # undef getopt_long_only # undef optarg # undef opterr # undef optind # undef optopt # define __GETOPT_CONCAT(x, y) x ## y # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) # define getopt __GETOPT_ID (getopt) # define getopt_long __GETOPT_ID (getopt_long) # define getopt_long_only __GETOPT_ID (getopt_long_only) # define optarg __GETOPT_ID (optarg) # define opterr __GETOPT_ID (opterr) # define optind __GETOPT_ID (optind) # define optopt __GETOPT_ID (optopt) #endif /* Standalone applications get correct prototypes for getopt_long and getopt_long_only; they declare "char **argv". libc uses prototypes with "char *const *argv" that are incorrect because getopt_long and getopt_long_only can permute argv; this is required for backward compatibility (e.g., for LSB 2.0.1). This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', but it caused redefinition warnings if both unistd.h and getopt.h were included, since unistd.h includes getopt.h having previously defined __need_getopt. The only place where __getopt_argv_const is used is in definitions of getopt_long and getopt_long_only below, but these are visible only if __need_getopt is not defined, so it is quite safe to rewrite the conditional as follows: */ #if !defined __need_getopt # if defined __GETOPT_PREFIX # define __getopt_argv_const /* empty */ # else # define __getopt_argv_const const # endif #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifndef __THROW # ifndef __GNUC_PREREQ # define __GNUC_PREREQ(maj, min) (0) # endif # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # else # define __THROW # endif #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `-', then non-option arguments are treated as arguments to the option '\1'. This behavior is specific to the GNU `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in the environment, then do not permute arguments. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; #ifndef __need_getopt extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; #endif #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ cpmtools-2.23/config.guess0000755000175000017500000014044614317767263015437 0ustar michaelmichael#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2021 Free Software Foundation, Inc. timestamp='2021-01-25' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif EOF eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # 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 # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)) case "$UNAME_MACHINE_ARCH" in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; *:OS108:*:*) echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Twizzler:*:*) echo "$UNAME_MACHINE"-unknown-twizzler exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') ;; *5.*) UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *: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:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "$( (/bin/universe) 2>/dev/null)" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case $(/usr/bin/uname -p) in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:*:*) case "$(/usr/bin/arch -k)" in Series*|S4*) UNAME_RELEASE=$(uname -v) ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "$(/bin/arch)" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && SYSTEM_NAME=$("$dummy" "$dummyarg") && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=$(/usr/bin/uname -p) if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=$(/usr/bin/oslevel) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 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}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=$(uname -p) set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=$(/usr/bin/uname -p) case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-pc-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; *:GNU:*:*) # the GNU system echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-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 2>/dev/null) in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI="$LIBC"x32 fi fi echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. 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, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case $(/bin/uname -X | grep "^Machine") in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=$(sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi 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. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=$( (uname -p) 2>/dev/null) echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; 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 echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; 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 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; arm64:Darwin:*:*) echo aarch64-apple-darwin"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=$(uname -p) case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=$(uname -p) if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) 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) case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; *:AROS:*:*) echo "$UNAME_MACHINE"-unknown-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; *:Unleashed:*:*) echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" exit ;; esac # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null); if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown) uname -r = $( (uname -r) 2>/dev/null || echo unknown) uname -s = $( (uname -s) 2>/dev/null || echo unknown) uname -v = $( (uname -v) 2>/dev/null || echo unknown) /usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) /bin/uname -X = $( (/bin/uname -X) 2>/dev/null) hostinfo = $( (hostinfo) 2>/dev/null) /bin/universe = $( (/bin/universe) 2>/dev/null) /usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) /bin/arch = $( (/bin/arch) 2>/dev/null) /usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) /usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cpmtools-2.23/mkfs.cpm.c0000640000175000017500000001343214047006226014750 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include #include "getopt_.h" #include "cpmfs.h" /*}}}*/ /* #defines */ /*{{{*/ #ifndef O_BINARY #define O_BINARY 0 #endif /*}}}*/ /* mkfs -- make file system */ /*{{{*/ static int mkfs(struct cpmSuperBlock *drive, const char *name, const char *format, const char *label, char *bootTracks, int timeStamps, int uppercase) { /* variables */ /*{{{*/ unsigned int i; char buf[128]; char firstbuf[128]; int fd; unsigned int bytes; unsigned int trkbytes; /*}}}*/ /* open image file */ /*{{{*/ if ((fd = open(name, O_BINARY|O_CREAT|O_WRONLY, 0666)) < 0) { boo=strerror(errno); return -1; } /*}}}*/ /* write system tracks */ /*{{{*/ /* this initialises only whole tracks, so it skew is not an issue */ trkbytes=drive->secLength*drive->sectrk; for (i=0; iboottrk; i+=drive->secLength) if (write(fd, bootTracks+i, drive->secLength)!=(ssize_t)drive->secLength) { boo=strerror(errno); close(fd); return -1; } /*}}}*/ /* write directory */ /*{{{*/ memset(buf,0xe5,128); bytes=drive->maxdir*32; if (bytes%trkbytes) bytes=((bytes+trkbytes)/trkbytes)*trkbytes; if (timeStamps && (drive->type==CPMFS_P2DOS || drive->type==CPMFS_DR3)) buf[3*32]=0x21; memcpy(firstbuf,buf,128); if (drive->type==CPMFS_DR3) { time_t now; struct tm *t; int min,hour,days; firstbuf[0]=0x20; for (i=0; i<11 && *label; ++i,++label) firstbuf[1+i]=toupper(*label&0x7f); while (i<11) firstbuf[1+i++]=' '; firstbuf[12]=timeStamps ? 0x11 : 0x01; /* label set and first time stamp is creation date */ memset(&firstbuf[13],0,1+2+8); if (timeStamps) { 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; } } 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,uppercase); 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; } /*}}}*/ const char cmd[]="mkfs.cpm"; int main(int argc, char *argv[]) /*{{{*/ { char *image; const char *format; int uppercase=0; int c,usage=0; 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:tuh?"))!=EOF) switch(c) { case 'b': { if (boot[0]==(const char*)0) boot[0]=optarg; else if (boot[1]==(const char*)0) boot[1]=optarg; else if (boot[2]==(const char*)0) boot[2]=optarg; else if (boot[3]==(const char*)0) boot[3]=optarg; else usage=1; break; } case 'f': format=optarg; break; case 'L': label=optarg; break; case 't': timeStamps=1; break; case 'u': uppercase=1; break; case 'h': case '?': usage=1; break; } if (optind!=(argc-1)) usage=1; else image=argv[optind++]; if (usage) { fprintf(stderr,"Usage: %s [-f format] [-b boot] [-L label] [-t] [-u] image\n",cmd); exit(1); } drive.dev.opened=0; cpmReadSuper(&drive,&root,format,uppercase); bootTrackSize=drive.boottrk*drive.secLength*drive.sectrk; if ((bootTracks=malloc(bootTrackSize))==(void*)0) { fprintf(stderr,"%s: can not allocate boot track buffer: %s\n",cmd,strerror(errno)); exit(1); } memset(bootTracks,0xe5,bootTrackSize); used=0; for (c=0; c<4 && boot[c]; ++c) { int fd; size_t size; if ((fd=open(boot[c],O_BINARY|O_RDONLY))==-1) { fprintf(stderr,"%s: can not open %s: %s\n",cmd,boot[c],strerror(errno)); exit(1); } size=read(fd,bootTracks+used,bootTrackSize-used); #if 0 fprintf(stderr,"%d %04x %s\n",c,used+0x800,boot[c]); #endif if (size%drive.secLength) size=(size|(drive.secLength-1))+1; used+=size; close(fd); } if (mkfs(&drive,image,format,label,bootTracks,timeStamps,uppercase)==-1) { fprintf(stderr,"%s: can not make new file system: %s\n",cmd,boo); exit(1); } else exit(0); } /*}}}*/ cpmtools-2.23/README0000644000175000017500000000376514047006226013762 0ustar michaelmichaelThis package allows to access CP/M file systems similar to the well-known mtools package, which accesses MSDOS file systems. I use it for file exchange with a Z80-PC simulator, but it works on floppy devices as well. Currently it contains: o cpmls - list sorted directory with output similar to ls, DIR, P2DOS DIR and CP/M3 DIR[FULL] o cpmcp - copy files from and to CP/M file systems o cpmrm - erase files from CP/M file systems o cpmchmod - change file permissions o cpmchattr - change file attributes o mkfs.cpm - make a CP/M file system o fsck.cpm - check and repair a CP/M file system (only simple errors can be repaired so far). Some images of broken file systems are provided for testing. o fsed.cpm - view CP/M file system o manual pages for everything including the CP/M file system format All CP/M file system features are supported. Password protection is ignored, because passwords are easy to decrypt, but a pseudo file [passwd] contains them, if you are curious what your old password has been. The disk label is read as special file [label]. User numbers are specified as user:file. Cpmtools should compile and work out of the box on each POSIX compliant system. It can be additionally compiled for Win32 systems. The source is available as a GNU zipped tape archive from: http://www.moria.de/~michael/cpmtools/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cpmtools-2.23/getopt.c0000640000175000017500000007667714047006226014560 0ustar michaelmichael/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBC # include "config.h" #endif #include "getopt_.h" #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef __VMS # include #endif #ifdef _LIBC # include #else #if 0 # include # define _(msgid) gettext (msgid) #else # define _(msgid) (msgid) #endif #endif #if defined _LIBC && defined USE_IN_LIBIO # include #endif #ifndef attribute_hidden # define attribute_hidden #endif /* Unlike standard Unix `getopt', functions like `getopt_long' let the user intersperse the options with the other arguments. As `getopt_long' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Using `getopt' or setting the environment variable POSIXLY_CORRECT disables permutation. Then the application's behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt_int.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Keep a global copy of all internal members of getopt_data. */ static struct _getopt_data getopt_data; #if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV extern char *getenv (); #endif #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (d->__nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (char **argv, struct _getopt_data *d) { int bottom = d->__first_nonopt; int middle = d->__last_nonopt; int top = d->optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, d->__nonoption_flags_max_len), '\0', top + 1 - d->__nonoption_flags_max_len); d->__nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ d->__first_nonopt += (d->optind - d->__last_nonopt); d->__last_nonopt = d->optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (int argc, char **argv, const char *optstring, int posixly_correct, struct _getopt_data *d) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ d->__first_nonopt = d->__last_nonopt = d->optind; d->__nextchar = NULL; d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { d->__ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { d->__ordering = REQUIRE_ORDER; ++optstring; } else if (d->__posixly_correct) d->__ordering = REQUIRE_ORDER; else d->__ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (!d->__posixly_correct && argc == __libc_argc && argv == __libc_argv) { if (d->__nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') d->__nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = d->__nonoption_flags_max_len = strlen (orig_str); if (d->__nonoption_flags_max_len < argc) d->__nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (d->__nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) d->__nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', d->__nonoption_flags_max_len - len); } } d->__nonoption_flags_len = d->__nonoption_flags_max_len; } else d->__nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT environment variable were set. */ int _getopt_internal_r (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct, struct _getopt_data *d) { int print_errors = d->opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; d->optarg = NULL; if (d->optind == 0 || !d->__initialized) { if (d->optind == 0) d->optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring, posixly_correct, d); d->__initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ || (d->optind < d->__nonoption_flags_len \ && __getopt_nonoption_flags[d->optind] == '1')) #else # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') #endif if (d->__nextchar == NULL || *d->__nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (d->__last_nonopt > d->optind) d->__last_nonopt = d->optind; if (d->__first_nonopt > d->optind) d->__first_nonopt = d->optind; if (d->__ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__last_nonopt != d->optind) d->__first_nonopt = d->optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (d->optind < argc && NONOPTION_P) d->optind++; d->__last_nonopt = d->optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (d->optind != argc && !strcmp (argv[d->optind], "--")) { d->optind++; if (d->__first_nonopt != d->__last_nonopt && d->__last_nonopt != d->optind) exchange ((char **) argv, d); else if (d->__first_nonopt == d->__last_nonopt) d->__first_nonopt = d->optind; d->__last_nonopt = argc; d->optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (d->optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (d->__first_nonopt != d->__last_nonopt) d->optind = d->__first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (d->__ordering == REQUIRE_ORDER) return -1; d->optarg = argv[d->optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ d->__nextchar = (argv[d->optind] + 1 + (longopts != NULL && argv[d->optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[d->optind][1] == '-' || (long_only && (argv[d->optind][2] || !strchr (optstring, argv[d->optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { if ((unsigned int) (nameend - d->__nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; d->optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; d->optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } d->__nextchar += strlen (d->__nextchar); d->optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[d->optind][1] == '-' || strchr (optstring, *d->__nextchar) == NULL) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (argv[d->optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), argv[0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], d->__nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[d->optind][0], d->__nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->__nextchar = (char *) ""; d->optind++; d->optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *d->__nextchar++; char *temp = strchr (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*d->__nextchar == '\0') ++d->optind; if (temp == NULL || c == ':') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; int n; #endif if (d->__posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: illegal option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: invalid option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #endif } d->optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `d->optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[d->optind]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[d->optind]); #endif } d->__nextchar += strlen (d->__nextchar); d->optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) d->optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } d->__nextchar += strlen (d->__nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (d->optind < argc) d->optarg = argv[d->optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]); #endif } d->__nextchar += strlen (d->__nextchar); return optstring[0] == ':' ? ':' : '?'; } } d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } d->__nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; d->optind++; } else d->optarg = NULL; d->__nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*d->__nextchar != '\0') { d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ d->optind++; } else if (d->optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; if (__asprintf (&buf, _("\ %s: option requires an argument -- %c\n"), argv[0], c) >= 0) { _IO_flockfile (stderr); int old_flags2 = ((_IO_FILE *) stderr)->_flags2; ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; __fxprintf (NULL, "%s", buf); ((_IO_FILE *) stderr)->_flags2 = old_flags2; _IO_funlockfile (stderr); free (buf); } #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } d->optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ d->optarg = argv[d->optind++]; d->__nextchar = NULL; } } return c; } } int _getopt_internal (int argc, char **argv, const char *optstring, const struct option *longopts, int *longind, int long_only, int posixly_correct) { int result; getopt_data.optind = optind; getopt_data.opterr = opterr; result = _getopt_internal_r (argc, argv, optstring, longopts, longind, long_only, posixly_correct, &getopt_data); optind = getopt_data.optind; optarg = getopt_data.optarg; optopt = getopt_data.optopt; return result; } /* glibc gets a LSB-compliant getopt. Standalone applications get a POSIX-compliant getopt. */ #if _LIBC enum { POSIXLY_CORRECT = 0 }; #else enum { POSIXLY_CORRECT = 1 }; #endif int getopt (int argc, char *const *argv, const char *optstring) { return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, POSIXLY_CORRECT); } #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ cpmtools-2.23/cpmdir.h0000640000175000017500000000106214047006226014511 0ustar michaelmichael#ifndef CPMDIR_H #define CPMDIR_H struct PhysDirectoryEntry { char status; char name[8]; char ext[3]; char extnol; char lrc; char extnoh; char blkcnt; char pointers[16]; }; #define ISFILECHAR(notFirst,c) (((notFirst) || (c)!=' ') && (c)>=' ' && !((c)&~0x7f) && (c)!='<' && (c)!='>' && (c)!='.' && (c)!=',' && (c)!=';' && (c)!=':' && (c)!='=' && (c)!='?' && (c)!='*' && (c)!= '[' && (c)!=']') #define EXTENT(low,high) (((low)&0x1f)|(((high)&0x3f)<<5)) #define EXTENTL(extent) ((extent)&0x1f) #define EXTENTH(extent) (((extent>>5))&0x3f) #endif cpmtools-2.23/install-sh0000740000175000017500000003577614317767263015126 0ustar michaelmichael#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # 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 # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord 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 if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: cpmtools-2.23/fsed.cpm.c0000640000175000017500000005411514047257376014752 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include #include #include "cpmfs.h" #include "getopt_.h" #include "term.h" /*}}}*/ extern char **environ; static char *mapbuf; static struct tm *cpmtime(char lday, char hday, char hour, char min) /*{{{*/ { static struct tm tm; unsigned long days=(lday&0xff)|((hday&0xff)<<8); int d; 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); tm.tm_hour=((hour>>4)&0xf)*10+(hour&0xf); tm.tm_mon=0; tm.tm_year=1978; tm.tm_isdst=-1; if (days) --days; while (days>=(d=(((tm.tm_year%400)==0 || ((tm.tm_year%4)==0 && (tm.tm_year%100))) ? 366 : 365))) { days-=d; ++tm.tm_year; } md[1]=((tm.tm_year%400)==0 || ((tm.tm_year%4)==0 && (tm.tm_year%100))) ? 29 : 28; while (days>=md[tm.tm_mon]) { days-=md[tm.tm_mon]; ++tm.tm_mon; } tm.tm_mday=days+1; tm.tm_year-=1900; return &tm; } /*}}}*/ static void info(struct cpmSuperBlock *sb, const char *format, const char *image) /*{{{*/ { const char *msg; term_clear(); msg="File system characteristics"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg); term_xy(0,2); term_printf(" Image: %s",image); term_xy(0,3); term_printf(" Format: %s",format); term_xy(0,4); term_printf(" File system: "); switch (sb->type) { case CPMFS_DR22: term_printf("CP/M 2.2"); break; case CPMFS_P2DOS: term_printf("P2DOS 2.3"); break; case CPMFS_DR3: term_printf("CP/M Plus"); break; } term_xy(0,6); term_printf(" Sector length: %d",sb->secLength); term_xy(0,7); term_printf(" Number of tracks: %d",sb->tracks); term_xy(0,8); term_printf(" Sectors per track: %d",sb->sectrk); term_xy(0,10);term_printf(" Block size: %d",sb->blksiz); term_xy(0,11);term_printf("Number of directory entries: %d",sb->maxdir); term_xy(0,12);term_printf(" Number of directory blocks: %d",sb->dirblks); term_xy(0,13);term_printf(" Logical sector skew: %d",sb->skew); term_xy(0,14);term_printf(" Number of system tracks: %d",sb->boottrk); term_xy(0,15);term_printf(" Logical extents per extent: %d",sb->extents); term_xy(0,16);term_printf(" Allocatable data blocks: %d",sb->size-(sb->maxdir*32+sb->blksiz-1)/sb->blksiz); msg="Any key to continue"; term_xy((term_cols()-strlen(msg))/2,23); term_printf(msg); term_getch(); } /*}}}*/ static void map(struct cpmSuperBlock *sb) /*{{{*/ { const char *msg; char bmap[18*80]; int secmap,sys,directory; int pos; term_clear(); msg="Data map"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg); secmap=(sb->tracks*sb->sectrk+80*18-1)/(80*18); memset(bmap,' ',sizeof(bmap)); sys=sb->boottrk*sb->sectrk; memset(bmap,'S',sys/secmap); directory=(sb->maxdir*32+sb->secLength-1)/sb->secLength; memset(bmap+sys/secmap,'D',directory/secmap); memset(bmap+(sys+directory)/secmap,'.',sb->sectrk*sb->tracks/secmap); for (pos=0; pos<(sb->maxdir*32+sb->secLength-1)/sb->secLength; ++pos) { int entry; Device_readSector(&sb->dev,sb->boottrk+pos/(sb->sectrk*sb->secLength),pos/sb->secLength,mapbuf); for (entry=0; entrysecLength/32 && (pos*sb->secLength/32)+entrymaxdir; ++entry) { int i; if (mapbuf[entry*32]>=0 && mapbuf[entry*32]<=(sb->type==CPMFS_P2DOS ? 31 : 15)) { for (i=0; i<16; ++i) { int sector; sector=mapbuf[entry*32+16+i]&0xff; if (sb->size>256) sector|=(((mapbuf[entry*32+16+ ++i]&0xff)<<8)); if (sector>0 && sector<=sb->size) { /* not entirely correct without the last extent record count */ sector=sector*(sb->blksiz/sb->secLength)+sb->sectrk*sb->boottrk; memset(bmap+sector/secmap,'#',sb->blksiz/(sb->secLength*secmap)); } } } } } for (pos=0; pos<(int)sizeof(bmap); ++pos) { term_xy(pos/18,2+pos%18); term_putch(bmap[pos]); } term_xy(0,21); term_printf("S=System area D=Directory area #=File data .=Free"); msg="Any key to continue"; term_xy((term_cols()-strlen(msg))/2,23); term_printf(msg); term_getch(); } /*}}}*/ static void data(struct cpmSuperBlock *sb, const char *buf, unsigned long int pos) /*{{{*/ { int offset=(pos%sb->secLength)&~0x7f; unsigned int i; for (i=0; i<128; ++i) { term_xy((i&0x0f)*3+!!(i&0x8),4+(i>>4)); term_printf("%02x",buf[i+offset]&0xff); if (pos%sb->secLength==i+offset) term_reverse(1); term_xy(50+(i&0x0f),4+(i>>4)); term_printf("%c",isprint((unsigned char)buf[i+offset]) ? buf[i+offset] : '.'); term_reverse(0); } term_xy(((pos&0x7f)&0x0f)*3+!!((pos&0x7f)&0x8)+1,4+((pos&0x7f)>>4)); } /*}}}*/ const char cmd[]="fsed.cpm"; int main(int argc, char *argv[]) /*{{{*/ { /* variables */ /*{{{*/ const char *devopts=(const char*)0; int uppercase=0; char *image; const char *err; struct cpmSuperBlock drive; struct cpmInode root; const char *format; int c,usage=0; off_t pos; int ch; int reload; char *buf; /*}}}*/ /* parse options */ /*{{{*/ if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT; while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c) { case 'f': format=optarg; break; case 'T': devopts=optarg; break; case 'u': uppercase=1; break; case 'h': case '?': usage=1; break; } if (optind!=(argc-1)) usage=1; else image=argv[optind++]; if (usage) { fprintf(stderr,"Usage: fsed.cpm [-f format] image\n"); exit(1); } /*}}}*/ /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev,image,O_RDONLY,devopts))) { fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); exit(1); } if (cpmReadSuper(&drive,&root,format,uppercase)==-1) { fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } /*}}}*/ /* alloc sector buffers */ /*{{{*/ if ((buf=malloc(drive.secLength))==(char*)0 || (mapbuf=malloc(drive.secLength))==(char*)0) { fprintf(stderr,"fsed.cpm: can not allocate sector buffer (%s).\n",strerror(errno)); exit(1); } /*}}}*/ term_init(); pos=0; reload=1; do { /* display position and load data */ /*{{{*/ term_clear(); term_xy(0,2); term_printf("Byte %8lu (0x%08lx) ",pos,pos); if (pos<(drive.boottrk*drive.sectrk*drive.secLength)) { term_printf("Physical sector %3lu ",((pos/drive.secLength)%drive.sectrk)+1); } else { term_printf("Sector %3lu ",((pos/drive.secLength)%drive.sectrk)+1); term_printf("(physical %3d) ",drive.skewtab[(pos/drive.secLength)%drive.sectrk]+1); } term_printf("Offset %5lu ",pos%drive.secLength); term_printf("Track %5lu",pos/(drive.secLength*drive.sectrk)); term_xy(0,term_lines()-3); term_printf("N)ext track P)revious track"); term_xy(0,term_lines()-2); term_printf("n)ext record p)revious record f)orward byte b)ackward byte"); term_xy(0,term_lines()-1); term_printf("i)nfo q)uit"); if (reload) { if (pos<(drive.boottrk*drive.sectrk*drive.secLength)) { err=Device_readSector(&drive.dev,pos/(drive.secLength*drive.sectrk),(pos/drive.secLength)%drive.sectrk,buf); } else { err=Device_readSector(&drive.dev,pos/(drive.secLength*drive.sectrk),drive.skewtab[(pos/drive.secLength)%drive.sectrk],buf); } if (err) { term_xy(0,4); term_printf("Data can not be read: %s",err); } else reload=0; } /*}}}*/ if /* position before end of system area */ /*{{{*/ (pos<(drive.boottrk*drive.sectrk*drive.secLength)) { const char *msg; msg="System area"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg); term_xy(36,term_lines()-3); term_printf("F)orward 16 byte B)ackward 16 byte"); if (!reload) data(&drive,buf,pos); switch (ch=term_getch()) { case 'F': /* next 16 byte */ /*{{{*/ { if (pos+16<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+16)/drive.secLength) reload=1; pos+=16; } break; } /*}}}*/ case 'B': /* previous 16 byte */ /*{{{*/ { if (pos>=16) { if (pos/drive.secLength!=(pos-16)/drive.secLength) reload=1; pos-=16; } break; } /*}}}*/ } } /*}}}*/ else if /* position before end of directory area */ /*{{{*/ (pos<(drive.boottrk*drive.sectrk*drive.secLength+drive.maxdir*32)) { const char *msg; unsigned long entrystart=(pos&~0x1f)%drive.secLength; int entry=(pos-(drive.boottrk*drive.sectrk*drive.secLength))>>5; int offset=pos&0x1f; msg="Directory area"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg); term_xy(36,term_lines()-3); term_printf("F)orward entry B)ackward entry"); term_xy(0,13); term_printf("Entry %3d: ",entry); if /* free or used directory entry */ /*{{{*/ ((buf[entrystart]>=0 && buf[entrystart]<=(drive.type==CPMFS_P2DOS ? 31 : 15)) || buf[entrystart]==(char)0xe5) { int i; if (buf[entrystart]==(char)0xe5) { if (offset==0) term_reverse(1); term_printf("Free"); term_reverse(0); } else term_printf("Directory entry"); term_xy(0,15); if (buf[entrystart]!=(char)0xe5) { term_printf("User: "); if (offset==0) term_reverse(1); term_printf("%2d",buf[entrystart]); term_reverse(0); term_printf(" "); } term_printf("Name: "); for (i=0; i<8; ++i) { if (offset==1+i) term_reverse(1); term_printf("%c",buf[entrystart+1+i]&0x7f); term_reverse(0); } term_printf(" Extension: "); for (i=0; i<3; ++i) { if (offset==9+i) term_reverse(1); term_printf("%c",buf[entrystart+9+i]&0x7f); term_reverse(0); } term_xy(0,16); term_printf("Extent: %3d",((buf[entrystart+12]&0xff)+((buf[entrystart+14]&0xff)<<5))/drive.extents); term_printf(" (low: "); if (offset==12) term_reverse(1); term_printf("%2d",buf[entrystart+12]&0xff); term_reverse(0); term_printf(", high: "); if (offset==14) term_reverse(1); term_printf("%2d",buf[entrystart+14]&0xff); term_reverse(0); term_printf(")"); term_xy(0,17); term_printf("Last extent record count: "); if (offset==15) term_reverse(1); term_printf("%3d",buf[entrystart+15]&0xff); term_reverse(0); term_xy(0,18); term_printf("Last record byte count: "); if (offset==13) term_reverse(1); term_printf("%3d",buf[entrystart+13]&0xff); term_reverse(0); term_xy(0,19); term_printf("Data blocks:"); for (i=0; i<16; ++i) { unsigned int block=buf[entrystart+16+i]&0xff; if (drive.size>256) { term_printf(" "); if (offset==16+i || offset==16+i+1) term_reverse(1); term_printf("%5d",block|(((buf[entrystart+16+ ++i]&0xff)<<8))); term_reverse(0); } else { term_printf(" "); if (offset==16+i) term_reverse(1); term_printf("%3d",block); term_reverse(0); } } } /*}}}*/ else if /* disc label */ /*{{{*/ (buf[entrystart]==0x20 && drive.type==CPMFS_DR3) { int i; const struct tm *tm; char s[30]; if (offset==0) term_reverse(1); term_printf("Disc label"); term_reverse(0); term_xy(0,15); term_printf("Label: "); for (i=0; i<11; ++i) { if (i+1==offset) term_reverse(1); term_printf("%c",buf[entrystart+1+i]&0x7f); term_reverse(0); } term_xy(0,16); term_printf("Bit 0,7: "); if (offset==12) term_reverse(1); term_printf("Label %s",buf[entrystart+12]&1 ? "set" : "not set"); term_printf(", password protection %s",buf[entrystart+12]&0x80 ? "set" : "not set"); term_reverse(0); term_xy(0,17); term_printf("Bit 4,5,6: "); if (offset==12) term_reverse(1); term_printf("Time stamp "); if (buf[entrystart+12]&0x10) term_printf("on create, "); else term_printf("not on create, "); if (buf[entrystart+12]&0x20) term_printf("on modification, "); else term_printf("not on modifiction, "); if (buf[entrystart+12]&0x40) term_printf("on access"); else term_printf("not on access"); term_reverse(0); term_xy(0,18); term_printf("Password: "); for (i=0; i<8; ++i) { char printable; if (offset==16+(7-i)) term_reverse(1); printable=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; term_printf("%c",isprint(printable) ? printable : ' '); term_reverse(0); } term_printf(" XOR value: "); if (offset==13) term_reverse(1); term_printf("0x%02x",buf[entrystart+13]&0xff); term_reverse(0); term_xy(0,19); term_printf("Created: "); tm=cpmtime(buf[entrystart+24],buf[entrystart+25],buf[entrystart+26],buf[entrystart+27]); if (offset==24 || offset==25) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==26) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==27) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); term_printf(" Updated: "); tm=cpmtime(buf[entrystart+28],buf[entrystart+29],buf[entrystart+30],buf[entrystart+31]); if (offset==28 || offset==29) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==30) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==31) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); } /*}}}*/ else if /* time stamp */ /*{{{*/ (buf[entrystart]==0x21 && (drive.type==CPMFS_P2DOS || drive.type==CPMFS_DR3)) { const struct tm *tm; char s[30]; if (offset==0) term_reverse(1); term_printf("Time stamps"); term_reverse(0); term_xy(0,15); term_printf("3rd last extent: Created/Accessed "); tm=cpmtime(buf[entrystart+1],buf[entrystart+2],buf[entrystart+3],buf[entrystart+4]); if (offset==1 || offset==2) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==3) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==4) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); term_printf(" Modified "); tm=cpmtime(buf[entrystart+5],buf[entrystart+6],buf[entrystart+7],buf[entrystart+8]); if (offset==5 || offset==6) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==7) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==8) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); term_xy(0,16); term_printf("2nd last extent: Created/Accessed "); tm=cpmtime(buf[entrystart+11],buf[entrystart+12],buf[entrystart+13],buf[entrystart+14]); if (offset==11 || offset==12) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==13) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==14) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); term_printf(" Modified "); tm=cpmtime(buf[entrystart+15],buf[entrystart+16],buf[entrystart+17],buf[entrystart+18]); if (offset==15 || offset==16) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==17) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==18) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); term_xy(0,17); term_printf(" Last extent: Created/Accessed "); tm=cpmtime(buf[entrystart+21],buf[entrystart+22],buf[entrystart+23],buf[entrystart+24]); if (offset==21 || offset==22) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==23) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==24) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); term_printf(" Modified "); tm=cpmtime(buf[entrystart+25],buf[entrystart+26],buf[entrystart+27],buf[entrystart+28]); if (offset==25 || offset==26) term_reverse(1); strftime(s,sizeof(s),"%x",tm); term_printf("%s",s); term_reverse(0); term_printf(" "); if (offset==27) term_reverse(1); term_printf("%2d",tm->tm_hour); term_reverse(0); term_printf(":"); if (offset==28) term_reverse(1); term_printf("%02d",tm->tm_min); term_reverse(0); } /*}}}*/ else if /* password */ /*{{{*/ (buf[entrystart]>=16 && buf[entrystart]<=31 && drive.type==CPMFS_DR3) { int i; if (offset==0) term_reverse(1); term_printf("Password"); term_reverse(0); term_xy(0,15); term_printf("Name: "); for (i=0; i<8; ++i) { if (offset==1+i) term_reverse(1); term_printf("%c",buf[entrystart+1+i]&0x7f); term_reverse(0); } term_printf(" Extension: "); for (i=0; i<3; ++i) { if (offset==9+i) term_reverse(1); term_printf("%c",buf[entrystart+9+i]&0x7f); term_reverse(0); } term_xy(0,16); term_printf("Password required for: "); if (offset==12) term_reverse(1); if (buf[entrystart+12]&0x80) term_printf("Reading "); if (buf[entrystart+12]&0x40) term_printf("Writing "); if (buf[entrystart+12]&0x20) term_printf("Deleting "); term_reverse(0); term_xy(0,17); term_printf("Password: "); for (i=0; i<8; ++i) { char printable; if (offset==16+(7-i)) term_reverse(1); printable=(buf[entrystart+16+(7-i)]^buf[entrystart+13])&0x7f; term_printf("%c",isprint(printable) ? printable : ' '); term_reverse(0); } term_printf(" XOR value: "); if (offset==13) term_reverse(1); term_printf("0x%02x",buf[entrystart+13]&0xff); term_reverse(0); } /*}}}*/ else /* bad status */ /*{{{*/ { term_printf("Bad status "); if (offset==0) term_reverse(1); term_printf("0x%02x",buf[entrystart]); term_reverse(0); } /*}}}*/ if (!reload) data(&drive,buf,pos); switch (ch=term_getch()) { case 'F': /* next entry */ /*{{{*/ { if (pos+32<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+32)/drive.secLength) reload=1; pos+=32; } break; } /*}}}*/ case 'B': /* previous entry */ /*{{{*/ { if (pos>=32) { if (pos/drive.secLength!=(pos-32)/drive.secLength) reload=1; pos-=32; } break; } /*}}}*/ } } /*}}}*/ else /* data area */ /*{{{*/ { const char *msg; msg="Data area"; term_xy((term_cols()-strlen(msg))/2,0); term_printf(msg); if (!reload) data(&drive,buf,pos); ch=term_getch(); } /*}}}*/ /* process common commands */ /*{{{*/ switch (ch) { case 'n': /* next record */ /*{{{*/ { if (pos+128<(drive.sectrk*drive.tracks*(off_t)drive.secLength)) { if (pos/drive.secLength!=(pos+128)/drive.secLength) reload=1; pos+=128; } break; } /*}}}*/ case 'p': /* previous record */ /*{{{*/ { if (pos>=128) { if (pos/drive.secLength!=(pos-128)/drive.secLength) reload=1; pos-=128; } break; } /*}}}*/ case 'N': /* next track */ /*{{{*/ { if ((pos+drive.sectrk*drive.secLength)<(drive.sectrk*drive.tracks*drive.secLength)) { pos+=drive.sectrk*drive.secLength; reload=1; } break; } /*}}}*/ case 'P': /* previous track */ /*{{{*/ { if (pos>=drive.sectrk*drive.secLength) { pos-=drive.sectrk*drive.secLength; reload=1; } break; } /*}}}*/ case 'b': /* byte back */ /*{{{*/ { if (pos) { if (pos/drive.secLength!=(pos-1)/drive.secLength) reload=1; --pos; } break; } /*}}}*/ case 'f': /* byte forward */ /*{{{*/ { if (pos+1 . , ; : = ? * [ ]\fP. The file name must not be empty, the extension may be empty. Both are padded with blanks. The highest bit of each character of the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp F0: requires set wheel byte (Backgrounder II) .br F1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br F2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br F7: wheel protect (ZSDOS) .br E0: read-only .br E1: system file .br E2: archived .sp .RE Public files (visible under each user number) are not supported by CP/M 2.2, but there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .\"}}} .LP .\"{{{ Xl, Xh = extent number \fBXl\fP and \fBXh\fP store the extent number. A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially with an extent number. If a physical extent stores more than 16k, it is considered to contain multiple logical extents, each pointing to 16k data, and the extent number of the last used logical extent is stored. Note: Some formats decided to always store only one logical extent in a physical extent, thus wasting extent space. CP/M 2.2 allows 512 extents per file, CP/M 3 and higher allow up to 2048. Bit 5\*(en7 of Xl are 0, bit 0\*(en4 store the lower bits of the extent number. Bit 6 and 7 of Xh are 0, bit 0\*(en5 store the higher bits of the extent number. .\"}}} .LP .\"{{{ Rc, Bc = record count, byte count \fBRc\fP and \fBBc\fP determine the length of the data used by this extent. The physical extent is divided into logical extents, each of them being 16k in size (a physical extent must hold at least one logical extent, e.g. a blocksize of 1024 byte with two-byte block pointers is not allowed). Rc stores the number of 128 byte records of the last used logical extent. Bc stores the number of bytes in the last used record. The value 0 means 128 for backward compatibility with CP/M 2.2, which did not support Bc. ISX records the number of unused instead of used bytes in Bc. This only applies to files with allocated blocks. For an empty file, no block is allocated and Bc 0 has no meaning. .\"}}} .LP .\"{{{ Al = allocated blocks \fBAl\fP stores block pointers. If the disk capacity minus boot tracks but including the directory area is less than or equal to 256 blocks, Al is interpreted as 16 byte-values, otherwise as 8 double-byte-values. Since the directory area is not subtracted, the directory area starts with block 0 and files can never allocate block 0, which is why this value can be given a new meaning: A block pointer of 0 marks a hole in the file. If a hole covers the range of a full extent, the extent will not be allocated. In particular, the first extent of a file does not neccessarily have extent number 0. A file may not share blocks with other files, as its blocks would be freed if the other files is erased without a following disk system reset. CP/M returns EOF when it reaches a hole, whereas UNIX returns zero-value bytes, which makes holes invisible. .\"}}} .\"}}} .SS "Native time stamps" \"{{{ P2DOS and CP/M Plus support time stamps, which are stored in each fourth directory entry. This entry contains the time stamps for the extents using the previous three directory entries. Note that you really have time stamps for each extent, no matter if it is the first extent of a file or not. The structure of time stamp entries is: .RS .sp 1 byte status 0x21 .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of two dates: Creation and modification date (the latter being recorded when the file is closed). CP/M Plus further allows optionally to record the access instead of creation date as first time stamp. .RS .sp 2 bytes (little-endian) days starting with 1 at 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE All time stamps are stored in local time. .\"}}} .SS "DateStamper time stamps" \"{{{ The DateStamper software added functions to the BDOS to manage time stamps by allocating a read only file with the name "!!!TIME&.DAT" in the very first directory entry, covering the very first data blocks. It contains one entry per directory entry with the following structure of 16 bytes: .RS .sp 5 bytes create datefield .br 5 bytes access datefield .br 5 bytes modify datefield .br 1 byte magic number/checksum .sp .RE 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 1 byte BCD coded year (no century, so it is sane assuming any year < 70 means 21st century) .br 1 byte BCD coded month .br 1 byte BCD coded day .br 1 byte BCD coded hour or, if the high bit is set, the high byte of a counter for systems without real time clock .br 1 byte BCD coded minute, or the low byte of the counter .sp .DE .\"}}} .SS "Disc labels" \"{{{ CP/M Plus support disc labels, which are stored in an arbitrary directory entry. The structure of disc labels is: .RS .sp 1 byte status 0x20 .br \fBF0\*(enE2\fP are the disc label .br 1 byte mode: bit 7 activates password protection, bit 6 causes time stamps on access, but 5 causes time stamps on modifications, bit 4 causes time stamps on creation and bit 0 is set when a label exists. Bit 4 and 6 are exclusively set. .br 1 byte password decode byte: To decode the password, xor this byte with the password bytes in reverse order. To encode a password, add its characters to get the decode byte. .br 2 reserved bytes .br 8 password bytes .br 4 bytes label creation time stamp .br 4 bytes label modification time stamp .sp .RE .\"}}} .SS "Passwords" \"{{{ CP/M Plus supports passwords, which are stored in an arbitrary directory entry. The structure of these entries is: .RS .sp 1 byte status (user number plus 16) .br \fBF0\*(enE2\fP are the file name and its extension. .br 1 byte password mode: bit 7 means password required for reading, bit 6 for writing and bit 5 for deleting. .br 1 byte password decode byte: To decode the password, xor this byte with the password bytes in reverse order. To encode a password, add its characters to get the decode byte. .br 2 reserved bytes .br 8 password bytes .sp .RE .\"}}} .\"}}} .SH "SEE ALSO" \"{{{ .IR mkfs.cpm (1), .IR fsck.cpm (1), .IR fsed.cpm (1), .IR cpmls (1) .\"}}} cpmtools-2.23/fsed.cpm.10000644000175000017500000000406314330525205014651 0ustar michaelmichael.TH FSED.CPM 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME ..\"{{{roff}}}\"{{{ fsed.cpm \- edit a CP/M file system .\"}}} .SH SYNOPSIS .\"{{{ .ad l .B fsed.cpm .RB [ \-f .IR format ] .RB [ \-u ] .I image .ad b .\"}}} .SH DESCRIPTION .\"{{{ \fBfsed.cpm\fP edits a CP/M file system on an image file or device. It knows about the system, directory and data area, using sector skew on the last two. Directory entries are decoded. The interactive usage is self-explanatory. .\"}}} .SH OPTIONS .\"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-T\fP \fIlibdsk-type\fP" libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images (requires building cpmtools with support for libdsk). .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" .\"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS .\"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES .\"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" .\"{{{ .IR fsck.cpm (1), .IR mkfs.cpm (1), .IR cpmls (1), .IR cpm (5) .\"}}} cpmtools-2.23/configure.in0000600000175000017500000000536214330525175015402 0ustar michaelmichaelAC_INIT(cpmfs.c) AC_CONFIG_HEADERS([config.h]) AC_CANONICAL_HOST VERSION=2.23 UPDATED='November 2, 2022' DEVICE="posix" TERM="curses" if test "$prefix" = NONE then case $host in *-linux-*) ;; *-cygwin-*) CYGWIN=yes ;; *-pc-mingw32) CFLAGS_LIBDSK=-DNOTWINDLL MINGW32=yes ;; esac fi AC_PROG_CC AC_PROG_INSTALL AC_PROG_CPP if test "$GCC" = yes then CFLAGS="${CFLAGS} ${EXTRA_GCFLAGS}-pipe -Wall -Wextra -Wshadow -Wno-unused-parameter -Wunused -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common" LDFLAGS="${LDFLAGS} ${EXTRA_GLDFLAGS}-g" else CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}" LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}" fi DISKDEFS='${datarootdir}/diskdefs' AC_ARG_WITH(diskdefs,[ --with-diskdefs Specify diskdefs location], [DISKDEFS="$withval"], [DISKDEFS="$DISKDEFS"]) AC_ARG_WITH(defformat,[ --with-defformat Specify default format (ibm-3740)], [DEFFORMAT="$withval"], [DEFFORMAT="ibm-3740"]) AC_ARG_WITH(libdsk, [ --with-libdsk Specify path to libdsk library], [LIBDSK="$withval"], [LIBDSK=""]) dnl Check for curses. If not found, don't build fsed.cpm dnl Try both curses and ncurses AC_CHECK_LIB(curses, printw, FSED_CPM=fsed.cpm LIBS="-lcurses $LIBS", FSED_CPM=) if test x"$FSED_CPM" = x""; then AC_CHECK_LIB(ncurses, printw, FSED_CPM=fsed.cpm LIBS="-lncurses $LIBS", FSED_CPM=) 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. if test "$LIBDSK" != ""; then DEVICE="libdsk" CPPFLAGS="$CPPFLAGS -I$LIBDSK/include" CFLAGS="$CFLAGS -I$LIBDSK/include $CFLAGS_LIBDSK" LDFLAGS="$LDFLAGS -L$LIBDSK/lib" AC_CHECK_LIB(dsk, dsk_open) AC_CHECK_HEADERS(libdsk.h, ,[echo "No libdsk.h - aborting"; exit 1]) fi dnl Checks for header files. AC_CHECK_HEADERS(fcntl.h sys/types.h sys/stat.h limits.h unistd.h sys/utime.h utime.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_STRUCT_TM AC_EXEEXT AC_OBJEXT AC_SYS_LARGEFILE dnl add EXE extension to fsed.cpm if test x"$FSED_CPM" != x""; then FSED_CPM="$FSED_CPM$EXEEXT" fi dnl Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_STRFTIME AC_CHECK_FUNCS(mktime strerror) AC_SUBST(LDLIBS) AC_SUBST(LDDEPS) AC_SUBST(DEVICE) eval DATADIR=$datadir AC_SUBST(DATADIR) AC_SUBST(DISKDEFS) AC_SUBST(DEFFORMAT) AC_SUBST(FSED_CPM) AC_SUBST(UPDATED) AC_CONFIG_FILES(Makefile cpm.5 cpmchattr.1 cpmchmod.1 cpmcp.1 cpmls.1 cpmrm.1 fsck.cpm.1 fsed.cpm.1 mkfs.cpm.1 diskdefs.5) AC_OUTPUT cpmtools-2.23/cpmrm.10000644000175000017500000000353214330525205014270 0ustar michaelmichael.TH CPMRM 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmrm \- remove files on CP/M disks .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmrm .RB [ \-f .IR format ] .RB [ \-u ] .I image .I file-pattern \&... .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBcpmrm\fP removes files from CP/M disks. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-T\fP \fIlibdsk-type\fP" libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images (requires building cpmtools with support for libdsk). .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR cpm (5) .\"}}} cpmtools-2.23/cpmcp.10000644000175000017500000000617214330525205014257 0ustar michaelmichael.TH CPMCP 1 "October 10, 2022" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmcp \- copy files from and to CP/M disks .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIuser\fP\fB:\fP\fIfile\fP \fIfile\fP .br .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIuser\fP\fB:\fP\fIfile\fP ... \fIdirectory\fP .br .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIfile\fP \fIuser\fP\fB:\fP\fIfile\fP .br .B cpmcp .RB [ \-f .IR format ] .RB [ \-p ] .RB [ \-t ] .I image .RB [ \-u ] \fIfile\fP ... \fIuser\fP\fB:\fP .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBcpmcp\fP copies one or more files to or from a CP/M disk. When copying multiple files, the last argument must be a drive or directory. The drive letter does not matter because the device is specified by the image, it is only used to specify which direction you want to copy. The user number is specified after the drive letter, if omitted user 0 is used. .PP You can use \fB*\fP and \fB?\fP in CP/M file names, which have the same meaning in .IR sh (1) file name patterns. .PP On CP/M, the slash is a legal file name character. When copying such files to the host, it is translated to a comma. Filenames with a comma have that translated back to a slash on CP/M. That is no restriction, because a comma is not a legal CP/M filename character. .\"}}} .SH OPTIONS \"{{{ .IP "\fB\-f\fP \fIformat\fP" 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\-p\fP Preserve time stamps when copying files from CP/M to UNIX (not implemented for copying the other way so far). .IP \fB\-t\fP Convert text files between CP/M and UNIX conventions. .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ ${prefix}/share/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR cpm (5) .\"}}} cpmtools-2.23/cpmcp.c0000640000175000017500000002122014165642652014340 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include #include #include #include #include "getopt_.h" #include "cpmfs.h" /*}}}*/ const char cmd[]="cpmcp"; static int text=0; static int preserve=0; /** * Return the user number. * @param s CP/M filename in 0[0]:aaaaaaaa.bbb format. * @returns The user number or -1 for no match. */ static int userNumber(const char *s) /*{{{*/ { if (isdigit(*s) && *(s+1)==':') return (*s-'0'); if (isdigit(*s) && isdigit(*(s+1)) && *(s+2)==':') return (10*(*s-'0')+(*(s+1)-'0')); return -1; } /*}}}*/ /** * Copy one file from CP/M to UNIX. * @param root The inode for the root directory. * @param src The CP/M filename in 00aaaaaaaabbb format. * @param dest The UNIX filename. * @returns 0 for success, 1 for error. */ static int cpmToUnix(const struct cpmInode *root, const char *src, const char *dest) /*{{{*/ { struct cpmInode ino; int exitcode=0; if (cpmNamei(root,src,&ino)==-1) { fprintf(stderr,"%s: can not open `%s': %s\n",cmd,src,boo); exitcode=1; } else { struct cpmFile file; FILE *ufp; cpmOpen(&ino,&file,O_RDONLY); if ((ufp=fopen(dest,text ? "w" : "wb"))==(FILE*)0) { fprintf(stderr,"%s: can not create %s: %s\n",cmd,dest,strerror(errno)); exitcode=1; } else { int crpending=0; int ohno=0; ssize_t res; char buf[4096]; while ((res=cpmRead(&file,buf,sizeof(buf)))>0) { int j; for (j=0; j=argc) usage(); image=argv[optind++]; if (userNumber(argv[optind])>=0) /* cpm -> unix? */ /*{{{*/ { int i; struct stat statbuf; for (i=optind; i<(argc-1); ++i) if (userNumber(argv[i])==-1) usage(); todir=((argc-optind)>2); if (stat(argv[argc-1],&statbuf)==-1) { if (todir) usage(); } else if (S_ISDIR(statbuf.st_mode)) todir=1; else if (todir) usage(); readcpm=1; } /*}}}*/ else if (userNumber(argv[argc-1])>=0) /* unix -> cpm */ /*{{{*/ { int i; todir=0; for (i=optind; i<(argc-1); ++i) if (userNumber(argv[i])>=0) usage(); if ((argc-optind)>2 && *(strchr(argv[argc-1],':')+1)!='\0') usage(); if (*(strchr(argv[argc-1],':')+1)=='\0') todir=1; readcpm=0; } /*}}}*/ else usage(); /*}}}*/ /* open image file */ /*{{{*/ if ((err=Device_open(&super.dev,image,readcpm ? O_RDONLY : O_RDWR, devopts))) { fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); exit(1); } if (cpmReadSuper(&super,&root,format,uppercase)==-1) { fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } /*}}}*/ if (readcpm) /* copy from CP/M to UNIX */ /*{{{*/ { int i; char *last=argv[argc-1]; cpmglob(optind,argc-1,argv,&root,&gargc,&gargv); /* trying to copy multiple files to a file? */ if (gargc>1 && !todir) usage(); for (i=0; i. The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmcp (1), .IR cpm (5) .\"}}} cpmtools-2.23/cpmchmod.1.in0000640000175000017500000000365714047006226015357 0ustar michaelmichael.TH CPMCHMOD 1 "@UPDATED@" "CP/M tools" "User commands" .SH NAME \"{{{roff}}}\"{{{ cpmchmod \- change file mode on CP/M files .\"}}} .SH SYNOPSIS \"{{{ .ad l .B cpmchmod .RB [ \-f .IR format ] .RB [ \-u ] .I image .I mode .I file-pattern \&... .ad b .\"}}} .SH DESCRIPTION \"{{{ \fBCpmchmod\fP changes the file mode for files 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 "\fB\-u\fP" Show all CP/M file names in upper case. .IP "\fImode\fP" Octal file mode, as used in \fIchmod\fP(1). .\"}}} .SH "RETURN VALUE" \"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS \"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES \"{{{ @DATADIR@/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt and copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" \"{{{ .IR cpmls (1), .IR chmod (1), .IR cpm (5) .\"}}} cpmtools-2.23/NEWS0000640000175000017500000000077714330525462013600 0ustar michaelmichaelChanges since 2.22: o Use 16 bit block pointers for file systems > 256 blocks, not >= 256 o Translate CP/M file name character '/' to ',' for the host and back o dirblks in Kaypro format fixed o Misc fixes for directory listing o Added bootsec diskdefs option o Check Device_close return value o Check for too small block number when reading file data o Replaced obsolete macros in configure.in o Cygwin/Windows support did not build any more and likely not for quite some time, so it was removed. cpmtools-2.23/device_posix.c0000640000175000017500000000464114047006226015715 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include "device.h" /*}}}*/ /* Device_open -- Open an image file */ /*{{{*/ const char *Device_open(struct Device *this, const char *filename, int mode, const char *deviceOpts) { if (deviceOpts != NULL) { return "POSIX driver accepts no options (build compiled without libdsk)"; } this->fd=open(filename,mode); this->opened=(this->fd==-1?0:1); return ((this->fd==-1)?strerror(errno):(const char*)0); } /*}}}*/ /* Device_setGeometry -- Set disk geometry */ /*{{{*/ 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 */ /*{{{*/ const char *Device_close(struct Device *this) { this->opened=0; return ((close(this->fd)==-1)?strerror(errno):(const char*)0); } /*}}}*/ /* Device_readSector -- read a physical sector */ /*{{{*/ const char *Device_readSector(const struct Device *this, int track, int sector, char *buf) { int res; assert(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); } if ((res=read(this->fd, buf, this->secLength)) != this->secLength) { if (res==-1) { return strerror(errno); } else { printf("len %d\n",this->secLength-res); memset(buf+res,0,this->secLength-res); /* hit end of disk image */ } } return (const char*)0; } /*}}}*/ /* Device_writeSector -- write physical sector */ /*{{{*/ const char *Device_writeSector(const struct Device *this, int track, int sector, const char *buf) { assert(sector>=0); assert(sectorsectrk); assert(track>=0); assert(tracktracks); if (lseek(this->fd,(off_t)(((sector+track*this->sectrk)*this->secLength)+this->offset),SEEK_SET)==-1) { return strerror(errno); } if (write(this->fd, buf, this->secLength) == this->secLength) return (const char*)0; return strerror(errno); } /*}}}*/ cpmtools-2.23/fsed.cpm.1.in0000640000175000017500000000404614047006226015255 0ustar michaelmichael.TH FSED.CPM 1 "@UPDATED@" "CP/M tools" "User commands" .SH NAME ..\"{{{roff}}}\"{{{ fsed.cpm \- edit a CP/M file system .\"}}} .SH SYNOPSIS .\"{{{ .ad l .B fsed.cpm .RB [ \-f .IR format ] .RB [ \-u ] .I image .ad b .\"}}} .SH DESCRIPTION .\"{{{ \fBfsed.cpm\fP edits a CP/M file system on an image file or device. It knows about the system, directory and data area, using sector skew on the last two. Directory entries are decoded. The interactive usage is self-explanatory. .\"}}} .SH OPTIONS .\"{{{ .IP "\fB\-f\fP \fIformat\fP" Use the given CP/M disk \fIformat\fP instead of the default format. .IP "\fB\-T\fP \fIlibdsk-type\fP" libdsk driver type, e.g. \fBtele\fP for Teledisk images or \fBraw\fP for raw images (requires building cpmtools with support for libdsk). .IP "\fB\-u\fP" Show all CP/M file names in upper case. .\"}}} .SH "RETURN VALUE" .\"{{{ Upon successful completion, exit code 0 is returned. .\"}}} .SH ERRORS .\"{{{ Any errors are indicated by exit code 1. .\"}}} .SH ENVIRONMENT \"{{{ CPMTOOLSFMT Default format .\"}}} .SH FILES .\"{{{ @DATADIR@/diskdefs CP/M disk format definitions .\"}}} .SH AUTHORS \"{{{ This program is copyright 1997\(en2021 Michael Haardt . The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" .\"{{{ .IR fsck.cpm (1), .IR mkfs.cpm (1), .IR cpmls (1), .IR cpm (5) .\"}}} cpmtools-2.23/cpmls.c0000644000175000017500000003210314047427134014355 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include #include "getopt_.h" #include "cpmfs.h" /*}}}*/ /* variables */ /*{{{*/ static const char * const month[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; /*}}}*/ /* namecmp -- compare two entries */ /*{{{*/ static int namecmp(const void *a, const void *b) { if (**((const char * const *)a)=='[') return -1; return strcmp(*((const char * const *)a),*((const char * const *)b)); } /*}}}*/ /* onlyuser0 -- do all entries belong to user 0? */ /*{{{*/ static int onlyuser0(char ** const dirent, int entries) { int i; for (i=0; i2) { int i,j,k,l,announce,user; qsort(dirent,entries,sizeof(char*),namecmp); cpmStatFS(ino,&buf); printf(" Name Bytes Recs Attr update create\n"); printf("------------ ------ ------ ---- ----------------- -----------------\n"); announce=0; for (l=user=0; user<32; ++user) { for (i=0; itm_mday,month[tmp->tm_mon],tmp->tm_year+1900,tmp->tm_hour,tmp->tm_min); } else if (statbuf.ctime) printf(" "); if (statbuf.ctime) { tmp=localtime(&statbuf.ctime); printf(" %02d-%s-%04d %02d:%02d",tmp->tm_mday,month[tmp->tm_mon],tmp->tm_year+1900,tmp->tm_hour,tmp->tm_min); } putchar('\n'); ++l; } } if (announce==2) announce=1; } printf("%5.1d Files occupying %6.1ldK",l,(buf.f_bused*buf.f_bsize)/1024); printf(", %7.1ldK Free.\n",(buf.f_bfree*buf.f_bsize)/1024); } else printf("No files found\n"); } /*}}}*/ /* old3dir -- old CP/M Plus style long output */ /*{{{*/ static void old3dir(char **dirent, int entries, struct cpmInode *ino) { struct cpmStatFS buf; struct cpmStat statbuf; struct cpmInode file; if (entries>2) { int i,j,k,l,announce,user, attrib; int totalBytes=0,totalRecs=0; qsort(dirent,entries,sizeof(char*),namecmp); cpmStatFS(ino,&buf); announce=1; for (l=0,user=0; user<32; ++user) { for (i=0; isb->cnotatime ? "Create" : "Access"); printf("------------ ------ ------ ------------ ------ -------------- --------------\n\n"); } announce=2; for (j=2; dirent[i][j] && dirent[i][j]!='.'; ++j) putchar(toupper(dirent[i][j])); k=j; while (k<10) { putchar(' '); ++k; } putchar(' '); if (dirent[i][j]=='.') ++j; for (k=0; dirent[i][j]; ++j,++k) putchar(toupper(dirent[i][j])); for (; k<3; ++k) putchar(' '); totalBytes+=statbuf.size; totalRecs+=(statbuf.size+127)/128; printf(" %5.1ldk",(long) (statbuf.size+buf.f_bsize-1) / buf.f_bsize*(buf.f_bsize/1024)); printf(" %6.1ld ",(long)((statbuf.size+127)/128)); putchar((attrib & CPM_ATTR_F1) ? '1' : ' '); putchar((attrib & CPM_ATTR_F2) ? '2' : ' '); putchar((attrib & CPM_ATTR_F3) ? '3' : ' '); putchar((attrib & CPM_ATTR_F4) ? '4' : ' '); putchar((statbuf.mode&(S_IWUSR|S_IWGRP|S_IWOTH)) ? ' ' : 'R'); putchar((attrib & CPM_ATTR_SYS) ? 'S' : ' '); putchar((attrib & CPM_ATTR_ARCV) ? 'A' : ' '); printf(" "); if (attrib & CPM_ATTR_PWREAD) printf("Read "); else if (attrib & CPM_ATTR_PWWRITE) printf("Write "); else if (attrib & CPM_ATTR_PWDEL) printf("Delete "); else printf("None "); if (statbuf.mtime) { tmp=localtime(&statbuf.mtime); printf("%02d/%02d/%02d %02d:%02d ",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min); } else printf(" "); if (ino->sb->cnotatime && statbuf.ctime) { tmp=localtime(&statbuf.ctime); printf("%02d/%02d/%02d %02d:%02d",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min); } else if (!ino->sb->cnotatime && statbuf.atime) { tmp=localtime(&statbuf.atime); printf("%02d/%02d/%02d %02d:%02d",tmp->tm_mon+1,tmp->tm_mday,tmp->tm_year%100,tmp->tm_hour,tmp->tm_min); } putchar('\n'); ++l; } } if (announce==2) announce=1; } printf("\nTotal Bytes = %6.1dk ",(totalBytes+1023)/1024); printf("Total Records = %7.1d ",totalRecs); printf("Files Found = %4.1d\n",l); printf("Total 1k Blocks = %6.1ld ",(buf.f_bused*buf.f_bsize)/1024); printf("Used/Max Dir Entries For Drive A: %4.1ld/%4.1ld\n",buf.f_files-buf.f_ffree,buf.f_files); } else printf("No files found\n"); } /*}}}*/ /* ls -- UNIX style output */ /*{{{*/ static void ls(char **dirent, int entries, struct cpmInode *ino, int l, int c, int iflag) { int i,user,announce,any; time_t now; struct cpmStat statbuf; struct cpmInode file; time(&now); qsort(dirent,entries,sizeof(char*),namecmp); announce=0; any=0; for (user=0; user<32; ++user) { announce=0; for (i=0; itm_mon],tmp->tm_mday); if ((c ? statbuf.ctime : statbuf.mtime)<(now-182*24*3600)) printf("%04d ",tmp->tm_year+1900); else printf("%02d:%02d ",tmp->tm_hour,tmp->tm_min); } printf("%s\n",dirent[i]+2); } } } } /*}}}*/ /* lsattr -- output something like e2fs lsattr */ /*{{{*/ static void lsattr(char **dirent, int entries, struct cpmInode *ino) { int i,user,announce,any; struct cpmStat statbuf; struct cpmInode file; cpm_attr_t attrib; qsort(dirent,entries,sizeof(char*),namecmp); announce=0; any=0; for (user=0; user<32; ++user) { announce=0; for (i=0; i. The Windows port is copyright 2000, 2001, 2011 John Elliott . .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\"}}} .SH "SEE ALSO" .\"{{{ .IR fsck (8), .IR mkfs.cpm (1), .IR cpm (5) .\"}}} cpmtools-2.23/badfs/0000740000175000017500000000000014047006226014140 5ustar michaelmichaelcpmtools-2.23/badfs/multipleblocks0000640000175000017500000003200014046710673017120 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM 5 CPM 6 ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .brååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifiåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "January 16åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directoååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is dery. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 by date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and create ti . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains more blockon byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks . format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes have the me stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last dirs than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent number). hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS,ectory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but thememory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmlfor this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 li ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Background for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Eachre is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not supports (1) ttle-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< >er II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extensicpmtools-2.23/badfs/lcr0000640000175000017500000004020014046710673014650 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM 5 )ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååd there are lots of formats. Accessing a block is performed by accessing its sectors, which are stored with the given software ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååt .\"}}} .\"{{{ description .SH DESCRIPTION .\"{{{ specific sizes Each CP/M disk format is described by the following specific sååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååskew. .\"}}} .LP .\"{{{ areas on the device A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .brååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .bråååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supporåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\"{{{roff}}}.\"{{{ title .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååts block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk anåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå\(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .\"}}} .\"{{{ name .SH NAME cpm \- CP/M disk and file system forma no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directovileged commands may be executed. .\"}}} .LP .\"{{{ Xl, Xh = extent number .SS "Xl, Xh" A file may use more than one directory ete (Backgrounder II) .br F1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br F2: date stamp (ZSDOS), bayte-values. A block pointer of 0 marks a hole in the file. If a hole covers the range of a full extent, the extent will not be .br 33: time stamp (P2DOS) .br 0xE5: unused .sp .RE .\"}}} .LP .\"{{{ F0-E2 = file name and extension .SS F0\*(enE2 F0\*(enE2 used by this extent. The physical extent is divided into logical extents, each of them being 16k in size. Rc stores the numberry. .\"}}} .LP The directory is a sequence of directory entries (also called extents), which contain 32 bytes of the following sntry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numberedckground-only commands (Backgrounder II) .br F7: wheel protect (ZSDOS) .br E0: read-only .br E1: system file .br E2: archived .sallocated. In particular, the first extent of a file does not neccessarily have extent number 0. A file may not share blocks wiare the file name and its extension. They may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. of 128 byte records of the last used logical extent. Bc stores the number of bytes in the last used record. The value 0 means tructure: .RS .sp St F0 F1 F2 F3 F4 F5 F6 F7 E0 E1 E2 XL BC XH RC .br Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al .sp .RE .\ sequentially with an extent number. CP/M 2.2 allows 512 extents per file, CP/M 3 and higher allow up to 2048. .LP Bit 5\*(en7 op .RE Public files (visible under each user number) are not supported by CP/M 2.2, but there is a patch and some free CP/M cloneth other files, as its blocks would be freed if the other files is erased without a following disk system reset. .\"}}} .LP P2DOThe file name must not be empty, the extension may be empty. Both are padded with blanks. The highest bit of each character of128 for backward compatibility with CP/M 2.2, which did not support Bc. .\"}}} .LP .\"{{{ Al = allocated blocks .SS Al Al st"{{{ St = status .SS St St is the status; possible values are: .RS .sp 0\*(en15: used for file, status is the user number .bf Xl are 0, bit 0\*(en4 store the lower bits of the extent number. Bit 6 and 7 of Xh are 0, bit 0\*(en5 store the higher bits os support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-priS' time stamps are stored in each fourth directory entry, which contains the update and create time stamps for the files in the the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp F0: requires set wheel byores block pointers. If the disk capacity is less than 256 blocks, Al is interpreted as 16 byte-values, otherwise as 8 double-br2 16\*(en31: used for file, status is the user number (P2DOS) or used for password extent (CP/M 3 or higher) .br 32: disc labelf the extent number. .\"}}} .LP .\"{{{ Rc, Bc = record count, byte count .SS "Rc, Bc" Rc and Bc determine the length of the dataprevious three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE .\"}}} .\"{{{ see also .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\"}}} cpmtools-2.23/badfs/name0000640000175000017500000003200014046710673015007 0ustar michaelmichaelåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå PM 5 !ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååccessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååt is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to savåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååe disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååblock is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "Januaryååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååspace for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååately, this format specification is not stored on the disk and there are lots of formats. Accessing a block is performed by aåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk formaM builds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extents), wRE A time stamp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps arIR cpmls (1) sion may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension hich have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> time 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE Thee stored in each fourth directory entry, which contains the update and create time stamps for the files in the previous three file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents arbyte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tstamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number highest bit of each character of the file name and extension is used as attribute. The attributes have the following meaning:directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8e allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) tfor this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forg bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some freehe memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extenround-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .brcpmtools-2.23/badfs/Makefile0000640000175000017500000000005514046710673015611 0ustar michaelmichael# # Dummy makefile # all: clean: distclean: cpmtools-2.23/badfs/doubleext0000640000175000017500000003200014046710673016062 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM 5 #CPM 5 # ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .brååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifiåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "January 16åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directoååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is dery. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 bys. .LP A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more ext .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZS days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The wheel byte is (by default) the number .br2 16\*(en31: extent is used for directory entry, status is the user number (P2DOS) or password extent (CP/M 3) .br 32:tored in each fourth directory entry, which contains the update and create time stamps for the files in the previous three directe status (0xe5 \(-> free, other values \(-> used) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded ents are allocated and each of them is numbered sequentially (extent number). Sparse files are within the specification. A bloDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .brmemory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpml disc label .br 33: time stamp (P2DOS) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \tory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stwith blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count for this extent (a record containsck pointer of 0 marks a hole in the file. If a hole covers the range of a full extent, the extent will not be allocated. In pa Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supportes (1) fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. The highest bit of each character of the file name and extension is usamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp cons 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 blocks, 8 little-endian two-byte values erticular, the first extent of a file does not neccessarily have extent number 0. .LP A file may not share blocks with other filed by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones support them without any patcheed as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II)ists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian)lse) .sp .RE The status can have the following values: .RS .sp 0\*(en15: extent is used for directory entry, status is the user s, as its blocks would be freed if the other files is erased without a following disk system reset. .LP P2DOS' time stamps are scpmtools-2.23/badfs/hugecom0000640000175000017500000022540014046710673015526 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååFOO COM€ FOO COM€ !FOO COM€"#$%&'()*+,-./01FOO COM€23456789:;<=>?@Aååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .brååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size FOO COMBCåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifiåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "January 16åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directoååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is dery. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 by date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and create tiary 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains more blockon byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks . format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes have the me stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last dir is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent number). hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS,ectory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smalle One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but thememory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmlfor this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 li ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Background for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Eachst allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format sre is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not supports (1) .\" 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 "Januttle-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< >er II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extensipecification is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, ut there is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not s, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: grounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Eirectory. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .s Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directoupport time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and cre\fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains morextension byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guep 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blin BCD format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes havry .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootablate time stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-la blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent numssed that by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by defaultanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record e the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (e formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that thst directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes timeber). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, b) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .Icount for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 KP2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backere is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the d stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file.R cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5ecord count for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less thanhat there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core froms time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of armat specification is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its secn15, but there is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character the directory. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte mtors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br D not support time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update aformat is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contain.RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded winute in BCD format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributirectory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bnd create time stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for th Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the s more blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (exteith blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte res have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public ootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note tird-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytesmallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this font number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(efile (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. s the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, t (extent number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en \(en .THbyte record count for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity les (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system fileNote that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in corhis format specification is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing i 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2. CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/Ms than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII cha .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probabe from the directory. .LP The directory is a sequence of directory entries (also called extents), which have the following structs sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional)2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the up disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectoracter but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it cly guessed that by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by dture: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, pa .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there aredate and create time stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp rs .br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block iontains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentiallyefault) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (dded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A b (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfsme, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused ublic file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only core are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tr8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creatiolock is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunat.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en \(.br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacimmands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: systeacks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap n of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 ely, this format specification is not stored on the disk and there are lots of formats. Accessing a block is performed by accesen .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Eacty less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCm file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you in core from the directory. .LP The directory is a sequence of directory entries (also called extents), which have the followingbyte minute in BCD format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The atsing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (opth CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number ofII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, iprobably guessed that by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file natributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: pional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, thef it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequen (you probably guessed that by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel bThe attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byts (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk spacstamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unuseber of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .tially (extent number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numberyte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .Ie 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-oe, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for sysd .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the cRE A block is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfos from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .dsnly commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1:tem tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this breation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format rtunately, this format specification is not stored on the disk and there are lots of formats. Accessing a block is performed byP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTI system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, butitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extents), which have the fol.br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file name and extension is used as attribute. accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System trackthe update and create time stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time ON Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Numlowing structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file name and extension is used as attribtains the update and create time stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytesCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .try, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered 2, but (you probably guessed that by now) there is a patch and some free CP/M clones support them without any patches. .LP The wile name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes uute. The attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File na time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytesbr Number of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system trackssequentially (extent number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user heel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALnused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk me byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), backgr unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes.numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches.SO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .ifcapacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bound-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension b the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD f Unfortunately, this format specification is not stored on the disk and there are lots of formats. Accessing a block is perfor .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which con t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory enyte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.med by accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp Systemtches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, while 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directsion byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supported by Che following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 b BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file name and extension is used as tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disch contains the update and create time stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8ory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones support them without any patches. .LPytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 battribute. The attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br Fk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space f bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2bered sequentially (extent number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "ytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values ifile name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), or system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update user numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without paSEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of any printabbackground-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extenthis bitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extents), which have tand of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .ues if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of any puilds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extents), which pdate and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hperformed by accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp out patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entrSH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of trrintable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .our in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file name and extension is usSystem tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to say, which contains the update and create time stamps for the files in the previous three directory entries: .RS .sp 1 byte statusacks .br Number of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .ed as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II)ve disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the s .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entrytracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 is numbered sequentially (extent number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only subr 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte val .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSpace for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M b .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last ubytes. Unfortunately, this format specification is not stored on the disk and there are lots of formats. Accessing a block is pports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 withDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br the space for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, 16384 bytes. Unfortunately, this format specification is not stored on the disk and there are lots of formats. Accessing a blonly supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones support 0\*(en3.ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system fote values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consist of Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supporteCP/M builds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extents), ck is performed by accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .R1 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fourth directorrmat .SH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br Number any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more thad by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones support them without any patchewhich have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestaS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In ordery entry, which contains the update and create time stamps for the files in the previous three directory entries: .RS .sp 1 byte of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved sn one directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each ofs. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed.mps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number for this to save disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludesstatus .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directoryystem tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 o .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 by entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the rved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 819cuted. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not know \(en this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block pointers mp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-oncludes the space for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 2 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and there are lots of formats. Accessing.if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file sys(16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension may consly .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not sutime, CP/M builds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extebyte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file name and extension a block is performed by accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three aretem format .SH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br ist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use mopported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones support them without any nts), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> t is used as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgroundas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. InNumber of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number of resere than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and epatches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be exeimestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number forer II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date sta order to save disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always exach of them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at most 16 K. .LP CP/Mt any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may grounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: daf. In order to save disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP alwectory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 409 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones support 0be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do not knowte stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: rays excludes the space for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the f the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 6, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and there are lots of formats. Acc\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fourth di \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and fiead-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are first time, CP/M builds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also calle.br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file name and extessing a block is performed by accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains thrrectory entry, which contains the update and create time stamps for the files in the previous three directory entries: .RS .sp 1le system format .SH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytenot supported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones support them withoud extents), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 ension is used as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backee areas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itsel byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last dirs .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number o\(-> timestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent numbnd extension is used as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requires set wheel byte .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-lan bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Nu and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at most 16 K. .Lwithout any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commander for this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block poi (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File name bytest directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dmber of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 204P CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clones sups may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs which do nonters (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extension ma 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extension bytates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-018, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and there are lots of formatsport 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in each fout know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk y consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may e 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file name a. Accessing a block is performed by accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contairth directory entry, which contains the update and create time stamps for the files in the previous three directory entries: .RSand file system format .SH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size iuse more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated) are not supported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones support them ns three areas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/Mch fourth directory entry, which contains the update and create time stamps for the files in the previous three directory entriee may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allnumber) are not supported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones support 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extenname and extension is used as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requires set whee itself. In order to save disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\s: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for secocated and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at most 16 them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged ct number for this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes blol byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br File namfP always excludes the space for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive foond-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/M clonommands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs whichck pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extense byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Extensir the first time, CP/M builds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days sincees support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are stored in ea do not know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/Mion may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A filon byte 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user called extents), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of the file disk and file system format .SH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Sector extension may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP (also called extents), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, us since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character of thecontains three areas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader an in each fourth directory entry, which contains the update and create time stamps for the files in the previous three directory size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical sector skew A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents aed and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte file name and extension is used as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requires sed CP/M itself. In order to save disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capentries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp f.br Number of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes of 102re allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at m extent number for this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytt wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br Fiacity\fP always excludes the space for system tracks. Note that there is no bitmap or list for free blocks. When accessing a dror second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists 4, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and there are lots of fost 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some free CP/es block pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and le name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) .br Eive for the first time, CP/M builds this bitmap in core from the directory. .LP The directory is a sequence of directory entriesof the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) daysormats. Accessing a block is performed by accessing its sectors, which are stored with the given logical skew. .LP A CP/M disk M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are storedxtension byte 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under eachg a drive for the first time, CP/M builds this bitmap in core from the directory. .LP The directory is a sequence of directory es of formats. Accessing a block is performed by accessing its sectors, which are stored with the given logical skew. .LP A CP/Mee CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps are - CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RS .sp Se and extension may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blank user number) are not supported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M clones sntries (also called extents), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user numb disk contains three areas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loastored in each fourth directory entry, which contains the update and create time stamps for the files in the previous three direector size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical sectors. .LP A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extupport them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-priviler, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br der and CP/M itself. In order to save disk space, there are non-bootable formats which omit those system tracks. The term \fIdictory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time s skew .br Number of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block sizes ents are allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thus usineged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are nroffs1 byte extent number for this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br sk capacity\fP always excludes the space for system tracks. Note that there is no bitmap or list for free blocks. When accessintamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp conof 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and there are lotg at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some fr which do not know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File namsists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endiansizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and there anroffs which do not know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SH NAME) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE Fi .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible undecessing a drive for the first time, CP/M builds this bitmap in core from the directory. .LP The directory is a sequence of direc) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each character re lots of formats. Accessing a block is performed by accessing its sectors, which are stored with the given logical skew. .LP cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is described by the following specific sizes: .RSle name and extension may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded withr each user number) are not supported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free CP/M cltory entries (also called extents), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> useof the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp File name byte 0: requiA CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the bo .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical blanks. .LP A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, moones support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-r number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blankres set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) ot loader and CP/M itself. In order to save disk space, there are non-bootable formats which omit those system tracks. The termsector skew .br Number of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports block re extents are allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thuprivileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly there are s .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes.br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (ZSDOS) \fIdisk capacity\fP always excludes the space for system tracks. Note that there is no bitmap or list for free blocks. When acs using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and sy non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedly therr II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel protect (e term \fIdisk capacity\fP always excludes the space for system tracks. Note that there is no bitmap or list for free blocks. Wmp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and tome free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stampe are nroffs which do not know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .SZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visiblhen accessing a drive for the first time, CP/M builds this bitmap in core from the directory. .LP The directory is a sequence ofendian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of each charhere are lots of formats. Accessing a block is performed by accessing its sectors, which are stored with the given logical skews are stored in each fourth directory entry, which contains the update and create time stamps for the files in the previous threH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is described by the following specific sizee under each user number) are not supported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some free C directory entries (also called extents), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(acter of the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp File name byte 0:. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks store e directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes s: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .br LoP/M clones support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, onl-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgroundethe boot loader and CP/M itself. In order to save disk space, there are non-bootable formats which omit those system tracks. Thtime stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stagical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supports blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128yte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command (Backgbytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A ti.br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M sups, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31o, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\" Believe it or not, reportedl bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp rounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheel prome stamp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (lports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its timey there are nroffs which do not know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File forma.RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are paddetect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (ittle-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit of eac and there are lots of formats. Accessing a block is performed by accessing its sectors, which are stored with the given logica stamps are stored in each fourth directory entry, which contains the update and create time stamps for the files in the previouts" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is described by the following specifid with blanks. .LP A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this cavisible under each user number) are not supported by CP/M 2.2, but (you probably guessed that by now) there is a patch and some h character of the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp File name bl skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .br Data .sp .RE The system tracks s three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 c sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries se, more extents are allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 recordfree CP/M clones support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zerstore the boot loader and CP/M itself. In order to save disk space, there are non-bootable formats which omit those system tracrevious three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused his case, more extents are allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it d with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count for this extent (a record containame byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forground-only command ks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there is no bitmap or list for free bloc.br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .Rrecords, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending thisis zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) ns 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else(Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br File name byte 7: wheks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directory. .LP The directory is a sequeE A time stamp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 by to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. It) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both areel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public fnce of directory entries (also called extents), which have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(etes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE The highest bit s time stamps are stored in each fourth directory entry, which contains the update and create time stamps for the files in the p padded with blanks. .LP A file may use more than one directory entry, if it contains more blocks than an extent can hold. In tiles (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed that by now) there is a patch andn31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, paddeof each character of the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp File cpmtools-2.23/badfs/extno0000640000175000017500000004020014046710673015225 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM 5 @)ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååd there are lots of formats. Accessing a block is performed by accessing its sectors, which are stored with the given software ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååt .\"}}} .\"{{{ description .SH DESCRIPTION .\"{{{ specific sizes Each CP/M disk format is described by the following specific sååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååskew. .\"}}} .LP .\"{{{ areas on the device A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .brååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .bråååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allocatable storage unit. CP/M supporåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\"{{{roff}}}.\"{{{ title .\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååts block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk anåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå\(en .TH CPM 5 "January 16, 1997" "CP/M tools" "File formats" .\"}}} .\"{{{ name .SH NAME cpm \- CP/M disk and file system forma no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directovileged commands may be executed. .\"}}} .LP .\"{{{ Xl, Xh = extent number .SS "Xl, Xh" A file may use more than one directory ete (Backgrounder II) .br F1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br F2: date stamp (ZSDOS), bayte-values. A block pointer of 0 marks a hole in the file. If a hole covers the range of a full extent, the extent will not be .br 33: time stamp (P2DOS) .br 0xE5: unused .sp .RE .\"}}} .LP .\"{{{ F0-E2 = file name and extension .SS F0\*(enE2 F0\*(enE2 used by this extent. The physical extent is divided into logical extents, each of them being 16k in size. Rc stores the numberry. .\"}}} .LP The directory is a sequence of directory entries (also called extents), which contain 32 bytes of the following sntry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numberedckground-only commands (Backgrounder II) .br F7: wheel protect (ZSDOS) .br E0: read-only .br E1: system file .br E2: archived .sallocated. In particular, the first extent of a file does not neccessarily have extent number 0. A file may not share blocks wiare the file name and its extension. They may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. of 128 byte records of the last used logical extent. Bc stores the number of bytes in the last used record. The value 0 means tructure: .RS .sp St F0 F1 F2 F3 F4 F5 F6 F7 E0 E1 E2 XL BC XH RC .br Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al .sp .RE .\ sequentially with an extent number. CP/M 2.2 allows 512 extents per file, CP/M 3 and higher allow up to 2048. .LP Bit 5\*(en7 op .RE Public files (visible under each user number) are not supported by CP/M 2.2, but there is a patch and some free CP/M cloneth other files, as its blocks would be freed if the other files is erased without a following disk system reset. .\"}}} .LP P2DOThe file name must not be empty, the extension may be empty. Both are padded with blanks. The highest bit of each character of128 for backward compatibility with CP/M 2.2, which did not support Bc. .\"}}} .LP .\"{{{ Al = allocated blocks .SS Al Al st"{{{ St = status .SS St St is the status; possible values are: .RS .sp 0\*(en15: used for file, status is the user number .bf Xl are 0, bit 0\*(en4 store the lower bits of the extent number. Bit 6 and 7 of Xh are 0, bit 0\*(en5 store the higher bits os support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-priS' time stamps are stored in each fourth directory entry, which contains the update and create time stamps for the files in the the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp F0: requires set wheel byores block pointers. If the disk capacity is less than 256 blocks, Al is interpreted as 16 byte-values, otherwise as 8 double-br2 16\*(en31: used for file, status is the user number (P2DOS) or used for password extent (CP/M 3 or higher) .br 32: disc labelf the extent number. .\"}}} .LP .\"{{{ Rc, Bc = record count, byte count .SS "Rc, Bc" Rc and Bc determine the length of the dataprevious three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE .\"}}} .\"{{{ see also .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmls (1) .\"}}} cpmtools-2.23/badfs/recordcount0000640000175000017500000003200014046710673016416 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM 5 ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .brååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifiåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "January 16åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directoååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is dery. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 by date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and create ti . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains more blockon byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks . format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes have the me stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last dirs than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent number). hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS,ectory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but thememory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmlfor this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 li ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Background for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Eachre is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not supports (1) ttle-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< >er II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extensicpmtools-2.23/badfs/label0000640000175000017500000002340014046710673015152 0ustar michaelmichaelåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå LABEL QÅ"Å"åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!åååååååååååååååååååååååååååååååcpmtools-2.23/badfs/extension0000640000175000017500000003200014046710673016103 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM  !ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååccessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååt is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to savåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååe disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååblock is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "Januaryååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååspace for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååately, this format specification is not stored on the disk and there are lots of formats. Accessing a block is performed by aåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk formaM builds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extents), wRE A time stamp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps arIR cpmls (1) sion may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension hich have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> time 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE Thee stored in each fourth directory entry, which contains the update and create time stamps for the files in the previous three file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents arbyte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tstamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number highest bit of each character of the file name and extension is used as attribute. The attributes have the following meaning:directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8e allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) tfor this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forg bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some freehe memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extenround-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .brcpmtools-2.23/badfs/blocknumber0000640000175000017500000003200014046710673016372 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM 5 ÿååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .brååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifiåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "January 16åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directoååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is dery. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 by date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and create ti . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains more blockon byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks . format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes have the me stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last dirs than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent number). hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS,ectory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but thememory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmlfor this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 li ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Background for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Eachre is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not supports (1) ttle-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< >er II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extensicpmtools-2.23/badfs/status0000640000175000017500000003200014046710673015412 0ustar michaelmichaelåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå€CPM 5 !ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååccessing its sectors, which are stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååt is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to savåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååe disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååblock is the smallest allocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå.\" 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 "Januaryååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååspace for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååately, this format specification is not stored on the disk and there are lots of formats. Accessing a block is performed by aåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå 16, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk formaM builds this bitmap in core from the directory. .LP The directory is a sequence of directory entries (also called extents), wRE A time stamp consists of the two dates of the last update and of the creation of a file. Each date is stored as: .RS .sp CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support time stamps, but P2DOS does. Its time stamps arIR cpmls (1) sion may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension hich have the following structure: .RS .sp 1 byte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> time 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE Thee stored in each fourth directory entry, which contains the update and create time stamps for the files in the previous three file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents arbyte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tstamps) .br 8 bytes file name, padded with blanks .br 3 bytes file extension, padded with blanks .br 1 byte extent number highest bit of each character of the file name and extension is used as attribute. The attributes have the following meaning:directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8e allocated and each of them is numbered sequentially (extent number). One extent may store up to 128 records, thus using at hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) tfor this file .br 2 bytes unused .br 1 byte record count for this extent (a record contains 128 bytes) .br 16 bytes block .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS, ZSDOS), forg bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but there is a patch for extending this to 31 and some freehe memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .pointers (16 byte values if disk capacity less than 256 K, 8 little-endian two-byte values else) .sp .RE File name and extenround-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounder II) .brcpmtools-2.23/badfs/timestamps0000640000175000017500000005520014046710673016264 0ustar michaelmichaelååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååCPM 50 CPM 51  CPM 52 !: $: $åå: e: %åå:€%: %ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!åååååååååååååååååååååååååååååååare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .bråååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!åååååååååååååååååååååååååååååååscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååå Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååå.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!åååååååååååååååååååååååååååååååats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!åååååååååååååååååååååååååååååååocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifiåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååå.\" 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 "January 16åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååå no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directoåååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!åååååååååååååååååååååååååååååååcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which åååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååååå!ååååååååååååååååååååååååååååååå, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is dery. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 by date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and create ti.\" 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 "January 16 . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains more blockon byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks . format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes have the me stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last dir, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is des than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent number). hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS,ectory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stampscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but thememory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmlfor this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 li ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Background for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Each.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest allre is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not supports (1) ttle-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< >er II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extensiocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifi One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but thefor this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 li ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Background no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directo for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Eachcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which re is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not supportttle-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< >er II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extensiry. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 by date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCDare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .br time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and create ti . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains more blockon byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks . format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes have the Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formme stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last dirs than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent number). hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS,ats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isectory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stampmemory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpmlte status (0xe5 \(-> free, 0\*(en31 \(-> user number, used and 0x21 \(-> timestamps) .br 8 bytes file name, padded with blanks . Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formme stamps for the files in the previous three directory entries: .RS .sp 1 byte status .br 8 bytes time stamp for third-last dir.br Number of directory entries .br Logical sector skew .br Number of reserved system tracks .sp .RE A block is the smallest alls than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially (extent number). s (1) br 3 bytes file extension, padded with blanks .br 1 byte extent number for this file .br 2 bytes unused .br 1 byte record count ats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there isectory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stampocatable storage unit. CP/M supports block sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specifi One extent may store up to 128 records, thus using at most 16 K. .LP CP/M 2.2 only supports user numbers from 0\*(en15, but the.\" 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 "January 16for this extent (a record contains 128 bytes) .br 16 bytes block pointers (16 byte values if disk capacity less than 256 K, 8 li no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directo for last directory entry .sp .RE A time stamp consists of the two dates of the last update and of the creation of a file. Eachcation is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which re is a patch for extending this to 31 and some free CP/M clones support 0\*(en31 without patches. .LP CP/M 2.2 does not support, 1997" "CP/M tools" "File formats" .SH NAME cpm \- CP/M disk and file system format .SH DESCRIPTION Each CP/M disk format is dettle-endian two-byte values else) .sp .RE File name and extension may consist of any printable 7 bit ASCII character but: \fB< >ry. .LP The directory is a sequence of directory entries (also called extents), which have the following structure: .RS .sp 1 by date is stored as: .RS .sp 2 bytes (little-endian) days since 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCDare stored with the given logical skew. .LP A CP/M disk contains three areas: .RS .sp System tracks (optional) .br Directory .br time stamps, but P2DOS does. Its time stamps are stored in each fourth directory entry, which contains the update and create tiscribed by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size . , ; : = ? * [ ]\fP. Both are padded with blanks. .LP A file may use more than one directory entry, if it contains more block format .sp .RE The highest bit of each character of the file name and extension is used as attribute. The attributes have the hat by now) there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the following meaning: .RS .sp File name byte 0: requires set wheel byte (Backgrounder II) .br File name byte 1: public file (P2DOS,memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .SH "SEE ALSO" .IR mkfs.cpm (1), .IR cpml ZSDOS), forground-only command (Backgrounder II) .br File name byte 2: date stamp (ZSDOS), background-only commands (Backgrounds (1) er II) .br File name byte 7: wheel protect (ZSDOS) .br Extension byte 0: read-only .br Extension byte 1: system file .sp Extension byte 2: archived .RE Public files (visible under each user number) are not supported by CP/M 2.2, but (you probably guessed tcpmtools-2.23/cpm.50000644000175000017500000002507414330525205013742 0ustar michaelmichael.\" Believe it or not, reportedly there are nroffs which do not know \(en .if n .ds en - .if t .ds en \(en .TH CPM 5 "October 10, 2022" "CP/M tools" "File formats" .SH NAME \"{{{roff}}}\"{{{ cpm \- CP/M disk and file system format .\"}}} .SH DESCRIPTION \"{{{ .SS "Characteristic sizes" \"{{{ Each CP/M disk format is described by the following specific sizes: .RS .sp Sector size in bytes .br Number of tracks .br Number of sectors .br Block size .br Number of directory entries .br Logical sector skew .br Number of reserved system tracks (optional) .br 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 sizes of 1024, 2048, 4096, 8192 and 16384 bytes. Unfortunately, this format specification is not stored on the disk and there are lots of formats. Accessing a block is performed by accessing its sectors, which are stored with the given software skew. \fBcpmtools\fP always counts sectors starting with 0, as it deals with logical sectors. CP/M uses physical sectors in the skew table, which often start with 1. .\"}}} .SS "Device areas" \"{{{ A CP/M disk contains four areas: .RS .sp Volume offset (optional and not covered by operating system, but disk driver specific) .br System tracks (optional) .br Directory .br Data .sp .RE The system tracks store the boot loader and CP/M itself. In order to save disk space, there are non-bootable formats which omit those system tracks. The term \fIdisk capacity\fP always excludes the space for system tracks. Note that there is no bitmap or list for free blocks. When accessing a drive for the first time, CP/M builds this bitmap in core from the directory. .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 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. The \fBoffset\fP must appear subsequent to track, sector and sector length values for the sector and track units to work. .LP Note that it is possible to reserve space between the directory and the beginning of data. Although typically data follows the directory, some systems used this to store extra data instead of using more system tracks (see the fields \fBALV0\fP and \fBALV1\fP in the DPB). .LP There are disk formats that map multiple logical tracks onto a physical track, which allows a little bit more capacity in case the system image size does not match the physical track capacity well. .\"}}} .SS "Directory entries" \"{{{ The directory is a sequence of directory entries (also called extents), which contain 32 bytes of the following structure: .RS .sp .ta 3n 6n 9n 12n 15n 18n 21n 24n 27n 30n 33n 36n 39n 42n 45n St F0 F1 F2 F3 F4 F5 F6 F7 E0 E1 E2 Xl Bc Xh Rc .br Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al .sp .RE .\"{{{ St = status \fBSt\fP is the status; possible values are: .RS .sp 0\*(en15: used for file, status is the user number. CP/M 2.2 only documents 0\*(en15 and CCP and PIP only offer those, but the BDOS allows to use 0\*(en31. .br 16\*(en31: used for file, status is the user number (P2DOS, CP/M 2.2) or used for password extent (CP/M 3 or higher) .br 32: disc label .br 33: time stamp (P2DOS) .br 0xE5: unused .sp .RE .\"}}} .LP .\"{{{ F0-E2 = file name and extension \fBF0\*(enE2\fP are the file name and its extension. They may consist of any printable 7 bit ASCII character but: \fB< > . , ; : = ? * [ ]\fP. The file name must not be empty, the extension may be empty. Both are padded with blanks. The highest bit of each character of the file name and extension is used as attribute. The attributes have the following meaning: .RS .sp F0: requires set wheel byte (Backgrounder II) .br F1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II) .br F2: date stamp (ZSDOS), background-only commands (Backgrounder II) .br F7: wheel protect (ZSDOS) .br E0: read-only .br E1: system file .br E2: archived .sp .RE Public files (visible under each user number) are not supported by CP/M 2.2, but there is a patch and some free CP/M clones support them without any patches. .LP The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed. .\"}}} .LP .\"{{{ Xl, Xh = extent number \fBXl\fP and \fBXh\fP store the extent number. A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially with an extent number. If a physical extent stores more than 16k, it is considered to contain multiple logical extents, each pointing to 16k data, and the extent number of the last used logical extent is stored. Note: Some formats decided to always store only one logical extent in a physical extent, thus wasting extent space. CP/M 2.2 allows 512 extents per file, CP/M 3 and higher allow up to 2048. Bit 5\*(en7 of Xl are 0, bit 0\*(en4 store the lower bits of the extent number. Bit 6 and 7 of Xh are 0, bit 0\*(en5 store the higher bits of the extent number. .\"}}} .LP .\"{{{ Rc, Bc = record count, byte count \fBRc\fP and \fBBc\fP determine the length of the data used by this extent. The physical extent is divided into logical extents, each of them being 16k in size (a physical extent must hold at least one logical extent, e.g. a blocksize of 1024 byte with two-byte block pointers is not allowed). Rc stores the number of 128 byte records of the last used logical extent. Bc stores the number of bytes in the last used record. The value 0 means 128 for backward compatibility with CP/M 2.2, which did not support Bc. ISX records the number of unused instead of used bytes in Bc. This only applies to files with allocated blocks. For an empty file, no block is allocated and Bc 0 has no meaning. .\"}}} .LP .\"{{{ Al = allocated blocks \fBAl\fP stores block pointers. If the disk capacity minus boot tracks but including the directory area is less than or equal to 256 blocks, Al is interpreted as 16 byte-values, otherwise as 8 double-byte-values. Since the directory area is not subtracted, the directory area starts with block 0 and files can never allocate block 0, which is why this value can be given a new meaning: A block pointer of 0 marks a hole in the file. If a hole covers the range of a full extent, the extent will not be allocated. In particular, the first extent of a file does not neccessarily have extent number 0. A file may not share blocks with other files, as its blocks would be freed if the other files is erased without a following disk system reset. CP/M returns EOF when it reaches a hole, whereas UNIX returns zero-value bytes, which makes holes invisible. .\"}}} .\"}}} .SS "Native time stamps" \"{{{ P2DOS and CP/M Plus support time stamps, which are stored in each fourth directory entry. This entry contains the time stamps for the extents using the previous three directory entries. Note that you really have time stamps for each extent, no matter if it is the first extent of a file or not. The structure of time stamp entries is: .RS .sp 1 byte status 0x21 .br 8 bytes time stamp for third-last directory entry .br 2 bytes unused .br 8 bytes time stamp for second-last directory entry .br 2 bytes unused .br 8 bytes time stamp for last directory entry .sp .RE A time stamp consists of two dates: Creation and modification date (the latter being recorded when the file is closed). CP/M Plus further allows optionally to record the access instead of creation date as first time stamp. .RS .sp 2 bytes (little-endian) days starting with 1 at 01-01-1978 .br 1 byte hour in BCD format .br 1 byte minute in BCD format .sp .RE All time stamps are stored in local time. .\"}}} .SS "DateStamper time stamps" \"{{{ The DateStamper software added functions to the BDOS to manage time stamps by allocating a read only file with the name "!!!TIME&.DAT" in the very first directory entry, covering the very first data blocks. It contains one entry per directory entry with the following structure of 16 bytes: .RS .sp 5 bytes create datefield .br 5 bytes access datefield .br 5 bytes modify datefield .br 1 byte magic number/checksum .sp .RE 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 1 byte BCD coded year (no century, so it is sane assuming any year < 70 means 21st century) .br 1 byte BCD coded month .br 1 byte BCD coded day .br 1 byte BCD coded hour or, if the high bit is set, the high byte of a counter for systems without real time clock .br 1 byte BCD coded minute, or the low byte of the counter .sp .DE .\"}}} .SS "Disc labels" \"{{{ CP/M Plus support disc labels, which are stored in an arbitrary directory entry. The structure of disc labels is: .RS .sp 1 byte status 0x20 .br \fBF0\*(enE2\fP are the disc label .br 1 byte mode: bit 7 activates password protection, bit 6 causes time stamps on access, but 5 causes time stamps on modifications, bit 4 causes time stamps on creation and bit 0 is set when a label exists. Bit 4 and 6 are exclusively set. .br 1 byte password decode byte: To decode the password, xor this byte with the password bytes in reverse order. To encode a password, add its characters to get the decode byte. .br 2 reserved bytes .br 8 password bytes .br 4 bytes label creation time stamp .br 4 bytes label modification time stamp .sp .RE .\"}}} .SS "Passwords" \"{{{ CP/M Plus supports passwords, which are stored in an arbitrary directory entry. The structure of these entries is: .RS .sp 1 byte status (user number plus 16) .br \fBF0\*(enE2\fP are the file name and its extension. .br 1 byte password mode: bit 7 means password required for reading, bit 6 for writing and bit 5 for deleting. .br 1 byte password decode byte: To decode the password, xor this byte with the password bytes in reverse order. To encode a password, add its characters to get the decode byte. .br 2 reserved bytes .br 8 password bytes .sp .RE .\"}}} .\"}}} .SH "SEE ALSO" \"{{{ .IR mkfs.cpm (1), .IR fsck.cpm (1), .IR fsed.cpm (1), .IR cpmls (1) .\"}}} cpmtools-2.23/Makefile.in0000640000175000017500000001170014227777335015147 0ustar michaelmichaelsrcdir= @srcdir@ VPATH= @srcdir@ libdir= @libdir@ BINDIR= @bindir@ MANDIR= @mandir@ includedir= @includedir@ exec_prefix= @exec_prefix@ prefix= @prefix@ datarootdir= @datarootdir@ INSTALL= @INSTALL@ INSTALL_DATA= @INSTALL_DATA@ CC= @CC@ CFLAGS= @CFLAGS@ LDFLAGS= @LDFLAGS@ DEFFORMAT= @DEFFORMAT@ DISKDEFS= @DISKDEFS@ DEVICE= @DEVICE@ FSED_CPM= @FSED_CPM@ EXEEXT = @EXEEXT@ OBJEXT = .@OBJEXT@ LIBS= @LIBS@ @LDLIBS@ LDDEPS= @LDDEPS@ CPPFLAGS= @CPPFLAGS@ -DDISKDEFS=\"$(DISKDEFS)\" -DFORMAT=\"$(DEFFORMAT)\" # # I'm only a novice and I haven't worked out how to autoconf this one # #MAKEDEPEND= mkdep -d MAKEDEPEND= gcc -MM #MAKEDEPEND= makedepend -f- DEVICEOBJ= device_$(DEVICE)$(OBJEXT) ALL= cpmls$(EXEEXT) cpmrm$(EXEEXT) cpmcp$(EXEEXT) \ cpmchmod$(EXEEXT) cpmchattr$(EXEEXT) mkfs.cpm$(EXEEXT) \ fsck.cpm$(EXEEXT) $(FSED_CPM) all: $(ALL) LibDsk/libdsk.a: cd LibDsk && make cpmls$(EXEEXT): cpmls$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ cpmls$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) cpmrm$(EXEEXT): cpmrm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ cpmrm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) cpmcp$(EXEEXT): cpmcp$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ cpmcp$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) cpmchmod$(EXEEXT): cpmchmod$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ cpmchmod$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) cpmchattr$(EXEEXT): cpmchattr$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ cpmchattr$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) mkfs.cpm$(EXEEXT): mkfs.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ mkfs.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) fsck.cpm$(EXEEXT): fsck.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ fsck.cpm$(OBJEXT) cpmfs$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) fsed.cpm$(EXEEXT): fsed.cpm$(OBJEXT) cpmfs$(OBJEXT) term_curses$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LDDEPS) $(CC) $(LDFLAGS) -o $@ fsed.cpm$(OBJEXT) cpmfs$(OBJEXT) term_curses$(OBJEXT) getopt$(OBJEXT) getopt1$(OBJEXT) $(DEVICEOBJ) $(LIBS) fsck.test: fsck.cpm -./fsck.cpm -f ibm-3740 -n badfs/status -./fsck.cpm -f ibm-3740 -n badfs/extno -./fsck.cpm -f ibm-3740 -n badfs/lcr -./fsck.cpm -f ibm-3740 -n badfs/name -./fsck.cpm -f ibm-3740 -n badfs/extension -./fsck.cpm -f ibm-3740 -n badfs/blocknumber -./fsck.cpm -f ibm-3740 -n badfs/recordcount -./fsck.cpm -f ibm-3740 -n badfs/hugecom -./fsck.cpm -f ibm-3740 -n badfs/timestamps -./fsck.cpm -f ibm-3740 -n badfs/multipleblocks -./fsck.cpm -f ibm-3740 -n badfs/doubleext -./fsck.cpm -f pcw -n badfs/label install: all [ -d $(DESTDIR)$(MANDIR)/man1 ] || $(INSTALL) -m 755 -d $(DESTDIR)$(MANDIR)/man1 [ -d $(DESTDIR)$(MANDIR)/man5 ] || $(INSTALL) -m 755 -d $(DESTDIR)$(MANDIR)/man5 [ -d $(DESTDIR)$(BINDIR) ] || $(INSTALL) -m 755 -d $(DESTDIR)$(BINDIR) $(INSTALL) -s -m 755 cpmls $(DESTDIR)$(BINDIR)/cpmls $(INSTALL) -s -m 755 cpmcp $(DESTDIR)$(BINDIR)/cpmcp $(INSTALL) -s -m 755 cpmrm $(DESTDIR)$(BINDIR)/cpmrm $(INSTALL) -s -m 755 cpmchmod $(DESTDIR)$(BINDIR)/cpmchmod $(INSTALL) -s -m 755 cpmchattr $(DESTDIR)$(BINDIR)/cpmchattr $(INSTALL) -s -m 755 mkfs.cpm $(DESTDIR)$(BINDIR)/mkfs.cpm $(INSTALL) -s -m 755 fsck.cpm $(DESTDIR)$(BINDIR)/fsck.cpm [ "$(FSED_CPM)" = '' ] || $(INSTALL) -s -m 755 fsed.cpm $(DESTDIR)$(BINDIR)/fsed.cpm $(INSTALL_DATA) diskdefs $(DESTDIR)@datarootdir@/diskdefs $(INSTALL_DATA) cpmls.1 $(DESTDIR)$(MANDIR)/man1/cpmls.1 $(INSTALL_DATA) cpmcp.1 $(DESTDIR)$(MANDIR)/man1/cpmcp.1 $(INSTALL_DATA) cpmrm.1 $(DESTDIR)$(MANDIR)/man1/cpmrm.1 $(INSTALL_DATA) cpmchmod.1 $(DESTDIR)$(MANDIR)/man1/cpmchmod.1 $(INSTALL_DATA) cpmchattr.1 $(DESTDIR)$(MANDIR)/man1/cpmchattr.1 $(INSTALL_DATA) mkfs.cpm.1 $(DESTDIR)$(MANDIR)/man1/mkfs.cpm.1 $(INSTALL_DATA) fsck.cpm.1 $(DESTDIR)$(MANDIR)/man1/fsck.cpm.1 $(INSTALL_DATA) fsed.cpm.1 $(DESTDIR)$(MANDIR)/man1/fsed.cpm.1 $(INSTALL_DATA) cpm.5 $(DESTDIR)$(MANDIR)/man5/cpm.5 $(INSTALL_DATA) diskdefs.5 $(DESTDIR)$(MANDIR)/man5/diskdefs.5 clean: rm -f *$(OBJEXT) distclean: clean rm -rf $(ALL) autom4te.cache config.log config.cache config.h config.status Makefile *.out tar: distclean (b=`pwd`; b=`basename $$b`; cd ..; tar zcvf $$b.tar.gz $$b) depend: $(MAKEDEPEND) $(CPPFLAGS) *.c >.depend include .depend cpmtools-2.23/cpmchmod.c0000640000175000017500000000354614047006226015031 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include "getopt_.h" #include "cpmfs.h" /*}}}*/ const char cmd[]="cpmchmod"; int main(int argc, char *argv[]) /*{{{*/ { /* variables */ /*{{{*/ const char *err; const char *image; const char *format; const char *devopts=NULL; int uppercase=0; int c,i,usage=0,exitcode=0; struct cpmSuperBlock drive; struct cpmInode root; int gargc; char **gargv; unsigned int mode; /*}}}*/ /* parse options */ /*{{{*/ if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT; while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c) { case 'T': devopts=optarg; break; case 'f': format=optarg; break; case 'u': uppercase=1; break; case 'h': case '?': usage=1; break; } if (optind>=(argc-2)) usage=1; else { image=argv[optind++]; if (!sscanf(argv[optind++], "%o", &mode)) usage=1; } if (usage) { fprintf(stderr,"Usage: %s [-f format] [-u] image mode pattern ...\n",cmd); exit(1); } /*}}}*/ /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev, image, O_RDWR, devopts))) { fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); exit(1); } if (cpmReadSuper(&drive,&root,format,uppercase)==-1) { fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } /*}}}*/ cpmglob(optind,argc,argv,&root,&gargc,&gargv); for (i=0; i Set the standard format the cpmtools will use. Default is ibm-3740 --with-libdsk=path Use LibDsk to access raw files, .DSK files, MYZ80 files and Unix/Windows floppy drives. This library is available at: https://www.seasip.info/Unix/LibDsk/ --with-dmalloc Use the dmalloc library --disable-floppy Disable the direct floppy access in LibDsk, so that it only contains drivers for raw files, .DSK files and MYZ80 files. All the cpmtools that use LibDsk have an extra option: -T . This sets the drive type used by LibDsk; available values include: "floppy" - The computer's floppy drive (only supported on Linux and Win32) "raw" - Raw file (or the floppy drive on other Unix systems) "dsk" - .DSK file "myz80" - MYZ80 hard drive file See the libdsk documentation for a full list. It will normally only be necessary to include "-T" when you are accessing a MYZ80 file, because LibDsk can detect the other file types automatically. "-T" options are not accepted if LibDsk is not being used. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. cpmtools-2.23/getopt1.c0000640000175000017500000000762414047006226014623 0ustar michaelmichael/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef _LIBC # include #else # include "config.h" # include "getopt_.h" #endif #include "getopt_int.h" #include /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 0, 0); } int _getopt_long_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 0, 0, d); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 1, 0); } int _getopt_long_only_r (int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d) { return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, 0, d); } #ifdef TEST #include int main (int argc, char **argv) { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ cpmtools-2.23/getopt_int.h0000644000175000017500000001127414047006226015421 0ustar michaelmichael/* Internal declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_INT_H #define _GETOPT_INT_H 1 extern int _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument vectors at the same time. */ /* Data type for reentrant functions. */ struct _getopt_data { /* These have exactly the same meaning as the corresponding global variables, except that they are used for the reentrant versions of getopt. */ int optind; int opterr; int optopt; char *optarg; /* Internal members. */ /* True if the internal members have been initialized. */ int __initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ char *__nextchar; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters, or by calling getopt. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } __ordering; /* If the POSIXLY_CORRECT environment variable is set or getopt was called. */ int __posixly_correct; /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ int __first_nonopt; int __last_nonopt; #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; # endif }; /* The initializer is necessary to set OPTIND and OPTERR to their default values and to clear the initialization flag. */ #define _GETOPT_DATA_INITIALIZER { 1, 1 } extern int _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct, struct _getopt_data *__data); extern int _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); extern int _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); #endif /* getopt_int.h */ cpmtools-2.23/cpmfs.c0000640000175000017500000016113414300135612014337 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include #include #include #include #include "cpmdir.h" #include "cpmfs.h" /*}}}*/ /* #defines */ /*{{{*/ #undef CPMFS_DEBUG /* Number of _used_ bits per int */ #define INTBITS ((int)(sizeof(int)*8)) /* Convert BCD datestamp digits to binary */ #define BCD2BIN(x) ((((x)>>4)&0xf)*10 + ((x)&0xf)) #define BIN2BCD(x) (((((x)/10)&0xf)<<4) + (((x)%10)&0xf)) /* There are four reserved directory entries: ., .., [passwd] and [label]. The first two of them refer to the same inode. */ #define RESERVED_ENTRIES 4 /* CP/M does not support any kind of inodes, so they are simulated. Inode 0-(maxdir-1) correlate to the lowest extent number (not the first extent of the file in the directory) of a file. Inode maxdir is the root directory, inode maxdir+1 is the optional passwd file and inode maxdir+2 the optional disk label. */ #define RESERVED_INODES 3 #define PASSWD_RECLEN 24 /*}}}*/ char const *boo; static mode_t s_ifdir=1; static mode_t s_ifreg=1; /* memcpy7 -- Copy string, leaving 8th bit alone */ /*{{{*/ static void memcpy7(char *dest, char const *src, int count) { while (count--) { *dest = ((*dest) & 0x80) | ((*src) & 0x7F); ++dest; ++src; } } /*}}}*/ /* file name conversions */ /* splitFilename -- split file name into name and extension */ /*{{{*/ static int splitFilename(char const *fullname, int type, char *name, char *ext, int *user) { int i,j; assert(fullname!=(char const *)0); assert(name!=(char*)0); assert(ext!=(char*)0); assert(user!=(int*)0); memset(name,' ',8); memset(ext,' ',3); if (!isdigit(fullname[0]) || !isdigit(fullname[1])) { boo="illegal CP/M filename"; return -1; } *user=10*(fullname[0]-'0')+(fullname[1]-'0'); fullname+=2; if ((fullname[0]=='\0') || *user>=((type&CPMFS_HI_USER) ? 32 : 16)) { boo="illegal CP/M filename"; return -1; } for (i=0; i<8 && fullname[i] && fullname[i]!='.'; ++i) if (!ISFILECHAR(i,fullname[i])) { boo="illegal CP/M filename"; return -1; } else name[i]=toupper(fullname[i]); if (fullname[i]=='.') { ++i; for (j=0; j<3 && fullname[i]; ++i,++j) if (!ISFILECHAR(1,fullname[i])) { boo="illegal CP/M filename"; return -1; } else ext[j]=toupper(fullname[i]); if (i==1 && j==0) { boo="illegal CP/M filename"; return -1; } } return 0; } /*}}}*/ /* isMatching -- do two file names match? */ /*{{{*/ static int isMatching(int user1, char const *name1, char const *ext1, int user2, char const *name2, char const *ext2) { int i; assert(name1!=(char const *)0); assert(ext1!=(char const *)0); assert(name2!=(char const *)0); assert(ext2!=(char const *)0); if (user1!=user2) return 0; for (i=0; i<8; ++i) if ((name1[i]&0x7f)!=(name2[i]&0x7f)) return 0; for (i=0; i<3; ++i) if ((ext1[i]&0x7f)!=(ext2[i]&0x7f)) return 0; return 1; } /*}}}*/ /* time conversions */ /* cpm2unix_time -- convert CP/M time to UTC */ /*{{{*/ static time_t cpm2unix_time(int days, int hour, int min) { /* CP/M stores timestamps in local time. We don't know which */ /* timezone was used and if DST was in effect. Assuming it was */ /* the current offset from UTC is most sensible, but not perfect. */ int year,days_per_year; static int days_per_month[]={31,0,31,30,31,30,31,31,30,31,30,31}; char **old_environ; static char gmt0[]="TZ=GMT0"; static char *gmt_env[]={ gmt0, (char*)0 }; struct tm tms; time_t lt,t; time(<); t=lt; tms=*localtime(<); old_environ=environ; environ=gmt_env; tms.tm_isdst=0; lt=mktime(&tms); lt-=t; tms.tm_sec=0; tms.tm_min=((min>>4)&0xf)*10+(min&0xf); tms.tm_hour=((hour>>4)&0xf)*10+(hour&0xf); tms.tm_mday=1; tms.tm_mon=0; tms.tm_year=78; tms.tm_isdst=-1; for (;;) { year=tms.tm_year+1900; days_per_year=((year%4)==0 && ((year%100) || (year%400)==0)) ? 366 : 365; if (days>days_per_year) { days-=days_per_year; ++tms.tm_year; } else break; } for (;;) { days_per_month[1]=(days_per_year==366) ? 29 : 28; if (days>days_per_month[tms.tm_mon]) { days-=days_per_month[tms.tm_mon]; ++tms.tm_mon; } else break; } t=mktime(&tms)+(days-1)*24*3600; environ=old_environ; t-=lt; return t; } /*}}}*/ /* unix2cpm_time -- convert UTC to CP/M time */ /*{{{*/ static void unix2cpm_time(time_t now, int *days, int *hour, int *min) { struct tm *tms; int i; tms=localtime(&now); *min=((tms->tm_min/10)<<4)|(tms->tm_min%10); *hour=((tms->tm_hour/10)<<4)|(tms->tm_hour%10); for (i=1978,*days=0; i<1900+tms->tm_year; ++i) { *days+=365; if (i%4==0 && (i%100!=0 || i%400==0)) ++*days; } *days += tms->tm_yday+1; } /*}}}*/ /* ds2unix_time -- convert DS to Unix time */ /*{{{*/ static time_t ds2unix_time(const struct dsEntry *entry) { struct tm tms; int yr; if (entry->minute==0 && entry->hour==0 && entry->day==0 && entry->month==0 && entry->year==0) return 0; tms.tm_isdst = -1; tms.tm_sec = 0; tms.tm_min = BCD2BIN( entry->minute ); tms.tm_hour = BCD2BIN( entry->hour ); tms.tm_mday = BCD2BIN( entry->day ); tms.tm_mon = BCD2BIN( entry->month ) - 1; yr = BCD2BIN(entry->year); if (yr<70) yr+=100; tms.tm_year = yr; return mktime(&tms); } /*}}}*/ /* unix2ds_time -- convert Unix to DS time */ /*{{{*/ static void unix2ds_time(time_t now, struct dsEntry *entry) { struct tm *tms; int yr; if ( now==0 ) { entry->minute=entry->hour=entry->day=entry->month=entry->year = 0; } else { tms=localtime(&now); entry->minute = BIN2BCD( tms->tm_min ); entry->hour = BIN2BCD( tms->tm_hour ); entry->day = BIN2BCD( tms->tm_mday ); entry->month = BIN2BCD( tms->tm_mon + 1 ); yr = tms->tm_year; if ( yr>100 ) yr -= 100; entry->year = BIN2BCD( yr ); } } /*}}}*/ /* allocation vector bitmap functions */ /* alvInit -- init allocation vector */ /*{{{*/ static void alvInit(const struct cpmSuperBlock *d) { int i,j,offset,block; assert(d!=(const struct cpmSuperBlock*)0); /* clean bitmap */ /*{{{*/ memset(d->alv,0,d->alvSize*sizeof(int)); /*}}}*/ /* mark directory blocks as used */ /*{{{*/ /* A directory may cover more blocks than an int may hold bits, * so a loop is needed. */ for (block=0; blockdirblks; ++block) { offset = block/INTBITS; d->alv[offset] |= (1<<(block%INTBITS)); #ifdef CPMFS_DEBUG fprintf(stderr,"alvInit: allocate directory block %d\n",block); #endif } /*}}}*/ for (i=0; imaxdir; ++i) /* mark file blocks as used */ /*{{{*/ { if (d->dir[i].status>=0 && d->dir[i].status<=(d->type&CPMFS_HI_USER ? 31 : 15)) { #ifdef CPMFS_DEBUG fprintf(stderr,"alvInit: allocate extent %d\n",i); #endif for (j=0; j<16; ++j) { block=(unsigned char)d->dir[i].pointers[j]; if (d->size>256) block+=(((unsigned char)d->dir[i].pointers[++j])<<8); if (block && blocksize) { #ifdef CPMFS_DEBUG fprintf(stderr,"alvInit: allocate block %d\n",block); #endif offset=block/INTBITS; d->alv[offset]|=(1<alvSize; ++i) { for (j=0,bits=drive->alv[i]; j=drive->size) { boo="device full"; return -1; } #ifdef CPMFS_DEBUG fprintf(stderr,"allocBlock: allocate data block %d\n",block); #endif drive->alv[i] |= (1<>= 1; } } boo="device full"; return -1; } /*}}}*/ /* bootOffset -- find the logical sector number of the CP/M directory */ /*{{{*/ static int bootOffset(const struct cpmSuperBlock *d) { assert(d); if (d->bootsec >= 0) return d->bootsec; return d->boottrk * d->sectrk; } /*}}}*/ /* logical block I/O */ /* readBlock -- read a (partial) block */ /*{{{*/ static int readBlock(const struct cpmSuperBlock *d, int blockno, char *buffer, int start, int end) { int sect, track, counter; assert(d); assert(blockno>=0); assert(buffer); #ifdef CPMFS_DEBUG fprintf(stderr,"readBlock: read block %d %d-%d\n",blockno,start,end); #endif if (blockno>=d->size) { boo="Attempting to access block beyond end of disk"; return -1; } if (end<0) end=d->blksiz/d->secLength-1; sect =(blockno*(d->blksiz/d->secLength)+ bootOffset(d))%d->sectrk; track=(blockno*(d->blksiz/d->secLength)+ bootOffset(d))/d->sectrk; for (counter=0; counter<=end; ++counter) { char const *err; assert(d->skewtab[sect]>=0); assert(d->skewtab[sect]sectrk); if (counter>=start) { #ifdef CPMFS_DEBUG fprintf(stderr,"readBlock: read sector %d/%d\n",d->skewtab[sect],track); #endif if ((err=Device_readSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter)))) { boo=err; return -1; } } ++sect; if (sect>=d->sectrk) { sect = 0; ++track; } } return 0; } /*}}}*/ /* writeBlock -- write a (partial) block */ /*{{{*/ static int writeBlock(const struct cpmSuperBlock *d, int blockno, char const *buffer, int start, int end) { int sect, track, counter; assert(blockno>=0); assert(blocknosize); assert(buffer!=(char const *)0); #ifdef CPMFS_DEBUG fprintf(stderr,"writeBlock: write block %d %d-%d\n",blockno,start,end); #endif if (end < 0) end=d->blksiz/d->secLength-1; sect = (blockno*(d->blksiz/d->secLength) + bootOffset(d)) % d->sectrk; track = (blockno*(d->blksiz/d->secLength) + bootOffset(d)) / d->sectrk; for (counter = 0; counter<=end; ++counter) { char const *err; if (counter>=start && (err=Device_writeSector(&d->dev,track,d->skewtab[sect],buffer+(d->secLength*counter)))) { boo=err; return -1; } ++sect; if (sect>=d->sectrk) { sect=0; ++track; } } return 0; } /*}}}*/ /* directory management */ /* findFileExtent -- find first/next extent for a file */ /*{{{*/ static int findFileExtent(const struct cpmSuperBlock *sb, int user, char const *name, char const *ext, int start, int extno) { boo="file already exists"; for (; startmaxdir; ++start) { if ( ((unsigned char)sb->dir[start].status)<=(sb->type&CPMFS_HI_USER ? 31 : 15) && (extno==-1 || (EXTENT(sb->dir[start].extnol,sb->dir[start].extnoh)/sb->extents)==(extno/sb->extents)) && isMatching(user,name,ext,sb->dir[start].status,sb->dir[start].name,sb->dir[start].ext) ) return start; } boo="file not found"; return -1; } /*}}}*/ /* findFreeExtent -- find first free extent */ /*{{{*/ static int findFreeExtent(const struct cpmSuperBlock *drive) { int i; for (i=0; imaxdir; ++i) if (drive->dir[i].status==(char)0xe5) return (i); boo="directory full"; return -1; } /*}}}*/ /* updateTimeStamps -- convert time stamps to CP/M format */ /*{{{*/ static void updateTimeStamps(const struct cpmInode *ino, int extent) { struct PhysDirectoryEntry *date; int ca_min,ca_hour,ca_days,u_min,u_hour,u_days; if (!S_ISREG(ino->mode)) return; #ifdef CPMFS_DEBUG fprintf(stderr,"CPMFS: updating time stamps for inode %d (%d)\n",extent,extent&3); #endif unix2cpm_time(ino->sb->cnotatime ? ino->ctime : ino->atime,&ca_days,&ca_hour,&ca_min); unix2cpm_time(ino->mtime,&u_days,&u_hour,&u_min); if ((ino->sb->type&CPMFS_CPM3_DATES) && (date=ino->sb->dir+(extent|3))->status==0x21) { ino->sb->dirtyDirectory=1; switch (extent&3) { case 0: /* first entry */ /*{{{*/ { date->name[0]=ca_days&0xff; date->name[1]=ca_days>>8; date->name[2]=ca_hour; date->name[3]=ca_min; date->name[4]=u_days&0xff; date->name[5]=u_days>>8; date->name[6]=u_hour; date->name[7]=u_min; break; } /*}}}*/ case 1: /* second entry */ /*{{{*/ { date->ext[2]=ca_days&0xff; date->extnol=ca_days>>8; date->lrc=ca_hour; date->extnoh=ca_min; date->blkcnt=u_days&0xff; date->pointers[0]=u_days>>8; date->pointers[1]=u_hour; date->pointers[2]=u_min; break; } /*}}}*/ case 2: /* third entry */ /*{{{*/ { date->pointers[5]=ca_days&0xff; date->pointers[6]=ca_days>>8; date->pointers[7]=ca_hour; date->pointers[8]=ca_min; date->pointers[9]=u_days&0xff; date->pointers[10]=u_days>>8; date->pointers[11]=u_hour; date->pointers[12]=u_min; break; } /*}}}*/ } } } /*}}}*/ /* updateDsStamps -- set time in datestamper file */ /*{{{*/ static void updateDsStamps(const struct cpmInode *ino, int extent) { struct dsDate *stamp; if (!S_ISREG(ino->mode)) return; if ( !(ino->sb->type&CPMFS_DS_DATES) ) return; #ifdef CPMFS_DEBUG fprintf(stderr,"CPMFS: updating ds stamps for inode %d (%d)\n",extent,extent&3); #endif /* Get datestamp struct */ stamp = ino->sb->ds+extent; unix2ds_time( ino->mtime, &stamp->modify ); unix2ds_time( ino->ctime, &stamp->create ); unix2ds_time( ino->atime, &stamp->access ); ino->sb->dirtyDs = 1; } /*}}}*/ /* readTimeStamps -- read CP/M time stamp */ /*{{{*/ static int readTimeStamps(struct cpmInode *i, int lowestExt) { /* variables */ /*{{{*/ struct PhysDirectoryEntry *date; int u_days=0,u_hour=0,u_min=0; int ca_days=0,ca_hour=0,ca_min=0; int protectMode=0; /*}}}*/ if ( (i->sb->type&CPMFS_CPM3_DATES) && (date=i->sb->dir+(lowestExt|3))->status==0x21 ) { switch (lowestExt&3) { case 0: /* first entry of the four */ /*{{{*/ { ca_days=((unsigned char)date->name[0])+(((unsigned char)date->name[1])<<8); ca_hour=(unsigned char)date->name[2]; ca_min=(unsigned char)date->name[3]; u_days=((unsigned char)date->name[4])+(((unsigned char)date->name[5])<<8); u_hour=(unsigned char)date->name[6]; u_min=(unsigned char)date->name[7]; protectMode=(unsigned char)date->ext[0]; break; } /*}}}*/ case 1: /* second entry */ /*{{{*/ { ca_days=((unsigned char)date->ext[2])+(((unsigned char)date->extnol)<<8); ca_hour=(unsigned char)date->lrc; ca_min=(unsigned char)date->extnoh; u_days=((unsigned char)date->blkcnt)+(((unsigned char)date->pointers[0])<<8); u_hour=(unsigned char)date->pointers[1]; u_min=(unsigned char)date->pointers[2]; protectMode=(unsigned char)date->pointers[3]; break; } /*}}}*/ case 2: /* third one */ /*{{{*/ { ca_days=((unsigned char)date->pointers[5])+(((unsigned char)date->pointers[6])<<8); ca_hour=(unsigned char)date->pointers[7]; ca_min=(unsigned char)date->pointers[8]; u_days=((unsigned char)date->pointers[9])+(((unsigned char)date->pointers[10])<<8); u_hour=(unsigned char)date->pointers[11]; u_min=(unsigned char)date->pointers[12]; protectMode=(unsigned char)date->pointers[13]; break; } /*}}}*/ } if (i->sb->cnotatime) { i->ctime=cpm2unix_time(ca_days,ca_hour,ca_min); i->atime=0; } else { i->ctime=0; i->atime=cpm2unix_time(ca_days,ca_hour,ca_min); } i->mtime=cpm2unix_time(u_days,u_hour,u_min); } else { i->atime=i->mtime=i->ctime=0; protectMode=0; } return protectMode; } /*}}}*/ /* readDsStamps -- read datestamper time stamp */ /*{{{*/ static void readDsStamps(struct cpmInode *i, int lowestExt) { struct dsDate *stamp; if ( !(i->sb->type&CPMFS_DS_DATES) ) return; /* Get datestamp */ stamp = i->sb->ds+lowestExt; i->mtime = ds2unix_time(&stamp->modify); i->ctime = ds2unix_time(&stamp->create); i->atime = ds2unix_time(&stamp->access); } /*}}}*/ /* match -- match filename against a pattern */ /*{{{*/ static int recmatch(char const *a, char const *pattern) { int first=1; assert(a); assert(pattern); while (*pattern) { switch (*pattern) { case '*': { if (*a=='.' && first) return 1; ++pattern; while (*a) if (recmatch(a,pattern)) return 1; else ++a; break; } case '?': { if (*a) { ++a; ++pattern; } else return 0; break; } default: if (tolower(*a)==tolower(*pattern)) { ++a; ++pattern; } else return 0; } first=0; } return (*pattern=='\0' && *a=='\0'); } int match(char const *a, char const *pattern) { int user; char pat[257]; 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; } else user=-1; if (user==-1) sprintf(pat,"??%s",pattern); else sprintf(pat,"%02d%s",user,pattern); return recmatch(a,pat); } /*}}}*/ /* cpmglob -- expand CP/M style wildcards */ /*{{{*/ void cpmglob(int optin, int argc, char * const argv[], struct cpmInode *root, int *gargc, char ***gargv) { struct cpmFile dir; int entries,dirsize=0; struct cpmDirent *dirent=(struct cpmDirent*)0; int gargcap=0,i,j; *gargv=(char**)0; *gargc=0; cpmOpendir(root,&dir); entries=0; dirsize=8; dirent=malloc(sizeof(struct cpmDirent)*dirsize); while (cpmReaddir(&dir,&dirent[entries])) { ++entries; if (entries==dirsize) dirent=realloc(dirent,sizeof(struct cpmDirent)*(dirsize*=2)); } for (i=optin; i=0); for (d=0; dlibdskGeometry[0] = '\0'; d->type=0; if ((fp=fopen("diskdefs","r"))==(FILE*)0 && (fp=fopen(DISKDEFS,"r"))==(FILE*)0) { fprintf(stderr,"%s: Neither `diskdefs' nor `" DISKDEFS "' could be opened.\n",cmd); exit(1); } ln=1; while (fgets(line,sizeof(line),fp)!=(char*)0) { 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; if (insideDef) { if (argc==1 && strcmp(argv[0],"end")==0) { insideDef=0; d->size=(d->sectrk*d->tracks-bootOffset(d)) * d->secLength / d->blksiz; if (d->extents==0) d->extents=((d->size>256 ? 8 : 16)*d->blksiz)/16384; if (d->extents==0) d->extents=1; if (found) break; } else if (argc==2) { if (strcmp(argv[0],"seclen")==0) d->secLength=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"tracks")==0) d->tracks=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"sectrk")==0) d->sectrk=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"blocksize")==0) { d->blksiz=strtol(argv[1],(char**)0,0); if (d->blksiz <= 0) { fprintf(stderr,"%s: invalid blocksize `%s' in line %d\n",cmd,argv[1],ln); exit(1); } } else if (strcmp(argv[0],"maxdir")==0) d->maxdir=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"dirblks")==0) d->dirblks=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"skew")==0) d->skew=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"skewtab")==0) { int pass,sectors; for (pass=0; pass<2; ++pass) { sectors=0; for (s=argv[1]; *s; ) { int phys; char *end; phys=strtol(s,&end,10); if (pass==1) d->skewtab[sectors]=phys; if (end==s) { fprintf(stderr,"%s: invalid skewtab `%s' at `%s' in line %d\n",cmd,argv[1],s,ln); exit(1); } s=end; ++sectors; if (*s==',') ++s; } if (pass==0) d->skewtab=malloc(sizeof(int)*sectors); } } else if (strcmp(argv[0],"boottrk")==0) d->boottrk=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"bootsec")==0) d->bootsec=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"offset")==0) { off_t val; unsigned int multiplier; char *endptr; errno=0; multiplier=1; val = strtol(argv[1],&endptr,10); if ((errno==ERANGE && val==LONG_MAX)||(errno!=0 && val<=0)) { fprintf(stderr,"%s: invalid offset value `%s' (%s) in line %d\n",cmd,argv[1],strerror(errno),ln); exit(1); } if (endptr==argv[1]) { fprintf(stderr,"%s: offset value `%s' is not a number in line %d\n",cmd,argv[1],ln); exit(1); } if (*endptr!='\0') { /* 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 in line %d\n",cmd,ln); 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 in line %d\n",cmd,ln); exit(1); } multiplier=d->secLength; break; default: fprintf(stderr,"%s: unknown unit specifier `%c' in line %d\n",cmd,*endptr,ln); exit(1); } } if (val*multiplier>INT_MAX) { fprintf(stderr,"%s: effective offset is out of range in line %d\n",cmd,ln); exit(1); } d->offset=val*multiplier; } else if (strcmp(argv[0],"logicalextents")==0) d->extents=strtol(argv[1],(char**)0,0); else if (strcmp(argv[0],"os")==0) { if (strcmp(argv[1],"2.2" )==0) d->type|=CPMFS_DR22; else if (strcmp(argv[1],"3" )==0) d->type|=CPMFS_DR3; else if (strcmp(argv[1],"isx" )==0) d->type|=CPMFS_ISX; else if (strcmp(argv[1],"p2dos")==0) d->type|=CPMFS_P2DOS; else if (strcmp(argv[1],"zsys" )==0) d->type|=CPMFS_ZSYS; else { fprintf(stderr, "%s: invalid OS type `%s' in line %d\n",cmd,argv[1],ln); 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]!='#' && argv[0][0]!=';') { fprintf(stderr,"%s: invalid keyword `%s' in line %d\n",cmd,argv[0],ln); exit(1); } } else if (argc==2 && strcmp(argv[0],"diskdef")==0) { insideDef=1; d->skew=1; d->extents=0; d->type=CPMFS_DR22; d->skewtab=(int*)0; d->offset=0; d->blksiz=d->boottrk=d->bootsec=d->secLength=d->sectrk=d->tracks=d->maxdir=-1; d->dirblks=0; d->libdskGeometry[0] = 0; if (strcmp(argv[1],format)==0) found=1; } ++ln; } fclose(fp); if (!found) { fprintf(stderr,"%s: unknown format %s\n",cmd,format); exit(1); } if (d->boottrk<0 && d->bootsec<0) { fprintf(stderr, "%s: boottrk / bootsec parameter invalid or missing from diskdef\n",cmd); exit(1); } if (d->secLength<0) { fprintf(stderr, "%s: secLength parameter invalid or missing from diskdef\n",cmd); exit(1); } if (d->sectrk<0) { fprintf(stderr, "%s: sectrk parameter invalid or missing from diskdef\n",cmd); exit(1); } if (d->tracks<0) { fprintf(stderr, "%s: tracks parameter invalid or missing from diskdef\n",cmd); exit(1); } if (d->blksiz<0) { fprintf(stderr, "%s: blocksize parameter invalid or missing from diskdef\n",cmd); exit(1); } if (d->maxdir<0) { fprintf(stderr, "%s: maxdir parameter invalid or missing from diskdef\n",cmd); exit(1); } return 0; } /*}}}*/ /* amsReadSuper -- read super block from amstrad disk */ /*{{{*/ static int amsReadSuper(struct cpmSuperBlock *d, char const *format) { unsigned char boot_sector[512], *boot_spec; char const *err; 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); exit(1); } boot_spec=(boot_sector[0] == 0 || boot_sector[0] == 3)?boot_sector:(unsigned char*)0; /* Check for JCE's extension to allow Amstrad and MSDOS superblocks * in the same sector (for the PCW16) */ if ( (boot_sector[0] == 0xE9 || boot_sector[0] == 0xEB) && !memcmp(boot_sector + 0x2B, "CP/M", 4) && !memcmp(boot_sector + 0x33, "DSK", 3) && !memcmp(boot_sector + 0x7C, "CP/M", 4) ) boot_spec = boot_sector + 128; if (boot_spec==(unsigned char*)0) { fprintf(stderr,"%s: Amstrad superblock not present\n",cmd); exit(1); } /* boot_spec[0] = format number: 0 for SS SD, 3 for DS DD [1] = single/double sided and density flags [2] = cylinders per side [3] = sectors per cylinder [4] = Physical sector shift, 2 => 512 [5] = Reserved track count [6] = Block shift [7] = No. of directory blocks */ d->type = 0; d->type |= CPMFS_DR3; /* Amstrads are CP/M 3 systems */ d->secLength = 128 << boot_spec[4]; d->tracks = boot_spec[2]; if (boot_spec[1] & 3) d->tracks *= 2; d->sectrk = boot_spec[3]; d->blksiz = 128 << boot_spec[6]; d->maxdir = (d->blksiz / 32) * boot_spec[7]; d->dirblks = 0; d->skew = 1; /* Amstrads skew at the controller level */ d->skewtab = (int*)0; d->boottrk = boot_spec[5]; d->offset = 0; d->size = (d->secLength*d->sectrk*(d->tracks-d->boottrk))/d->blksiz; d->extents = ((d->size>256 ? 8 : 16)*d->blksiz)/16384; d->libdskGeometry[0] = 0; /* LibDsk can recognise an Amstrad superblock * and autodect */ return 0; } /*}}}*/ /* cpmCheckDs -- read all datestamper timestamps */ /*{{{*/ int cpmCheckDs(struct cpmSuperBlock *sb) { int dsoffset, dsblks, dsrecs, off, i; unsigned char *buf; if (!isMatching(0,"!!!TIME&","DAT",sb->dir->status,sb->dir->name,sb->dir->ext)) return -1; /* Offset to ds file in alloc blocks */ dsoffset=(sb->maxdir*32+(sb->blksiz-1))/sb->blksiz; dsrecs=(sb->maxdir+7)/8; dsblks=(dsrecs*128+(sb->blksiz-1))/sb->blksiz; /* Allocate buffer */ sb->ds=malloc(dsblks*sb->blksiz); /* Read ds file in its entirety */ off=0; for (i=dsoffset; ids)+off,0,-1)==-1) return -1; off+=sb->blksiz; } /* Verify checksums */ buf = (unsigned char *)sb->ds; for (i=0; ids); sb->ds = (struct dsDate *)0; return -1; } buf += 128; } return 0; } /*}}}*/ /* cpmReadSuper -- get DPB and init in-core data for drive */ /*{{{*/ int cpmReadSuper(struct cpmSuperBlock *d, struct cpmInode *root, char const *format, int uppercase) { while (s_ifdir && !S_ISDIR(s_ifdir)) s_ifdir<<=1; assert(s_ifdir); while (s_ifreg && !S_ISREG(s_ifreg)) s_ifreg<<=1; assert(s_ifreg); if (strcmp(format,"amstrad")==0) amsReadSuper(d,format); else diskdefReadSuper(d,format); d->uppercase=uppercase; assert(d->boottrk>=0); assert(d->secLength>0); assert(d->sectrk>0); assert(d->tracks>0); assert(d->blksiz>0); assert(d->maxdir>0); assert(d->dirblks>=0); if (d->dirblks==0) { /* optional field, compute based on directory size */ d->dirblks=(d->maxdir*32+(d->blksiz-1))/d->blksiz; } boo = Device_setGeometry(&d->dev,d->secLength,d->sectrk,d->tracks,d->offset,d->libdskGeometry); if (boo) return -1; if (d->skewtab==(int*)0) /* generate skew table */ /*{{{*/ { int i,j,k; if (( d->skewtab = malloc(d->sectrk*sizeof(int))) == (int*)0) { 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; } d->skewtab[i]=j; } } /*}}}*/ /* initialise allocation vector bitmap */ /*{{{*/ { d->alvSize= ((((d->sectrk * d->tracks)-bootOffset(d)) * d->secLength)/d->blksiz+INTBITS-1)/INTBITS; if ((d->alv=malloc(d->alvSize*sizeof(int)))==(int*)0) { boo=strerror(errno); return -1; } } /*}}}*/ /* allocate directory buffer */ /*{{{*/ assert(sizeof(struct PhysDirectoryEntry)==32); if ((d->dir=malloc(((d->maxdir*32+d->blksiz-1)/d->blksiz)*d->blksiz))==(struct PhysDirectoryEntry*)0) { boo=strerror(errno); return -1; } /*}}}*/ if (d->dev.opened==0) /* create empty directory in core */ /*{{{*/ { memset(d->dir,0xe5,d->maxdir*32); } /*}}}*/ else /* read directory in core */ /*{{{*/ { int i,blocks,entry; blocks=(d->maxdir*32+d->blksiz-1)/d->blksiz; entry=0; for (i=0; idir+entry),0,-1)==-1) return -1; entry+=(d->blksiz/32); } } /*}}}*/ alvInit(d); if (d->type&CPMFS_CPM3_OTHER) /* read additional superblock information */ /*{{{*/ { int i; /* passwords */ /*{{{*/ { int passwords=0; for (i=0; imaxdir; ++i) if (d->dir[i].status>=16 && d->dir[i].status<=31) ++passwords; #ifdef CPMFS_DEBUG fprintf(stderr,"getformat: found %d passwords\n",passwords); #endif if ((d->passwdLength=passwords*PASSWD_RECLEN)) { if ((d->passwd=malloc(d->passwdLength))==(char*)0) { boo="out of memory"; return -1; } for (i=0,passwords=0; imaxdir; ++i) if (d->dir[i].status>=16 && d->dir[i].status<=31) { int j,pb; char *p=d->passwd+(passwords++*PASSWD_RECLEN); p[0]='0'+(d->dir[i].status-16)/10; p[1]='0'+(d->dir[i].status-16)%10; for (j=0; j<8; ++j) p[2+j]=d->dir[i].name[j]&0x7f; p[10]=(d->dir[i].ext[0]&0x7f)==' ' ? ' ' : '.'; for (j=0; j<3; ++j) p[11+j]=d->dir[i].ext[j]&0x7f; p[14]=' '; pb=(unsigned char)d->dir[i].lrc; for (j=0; j<8; ++j) p[15+j]=((unsigned char)d->dir[i].pointers[7-j])^pb; #ifdef CPMFS_DEBUG p[23]='\0'; fprintf(stderr,"getformat: %s\n",p); #endif p[23]='\n'; } } } /*}}}*/ /* disc label */ /*{{{*/ for (i=0; imaxdir; ++i) if (d->dir[i].status==(char)0x20) { int j; d->cnotatime=d->dir[i].extnol&0x10; if (d->dir[i].extnol&0x1) { d->labelLength=12; if ((d->label=malloc(d->labelLength))==(char*)0) { boo="out of memory"; return -1; } for (j=0; j<8; ++j) d->label[j]=d->dir[i].name[j]&0x7f; for (j=0; j<3; ++j) d->label[8+j]=d->dir[i].ext[j]&0x7f; d->label[11]='\n'; } else { d->labelLength=0; } break; } if (i==d->maxdir) { d->cnotatime=1; d->labelLength=0; } /*}}}*/ } /*}}}*/ else { d->passwdLength=0; d->cnotatime=1; d->labelLength=0; } d->root=root; d->dirtyDirectory = 0; root->ino=d->maxdir; root->sb=d; root->mode=(s_ifdir|0777); root->size=0; root->atime=root->mtime=root->ctime=0; d->dirtyDs=0; if (cpmCheckDs(d)==0) d->type|=CPMFS_DS_DATES; else d->ds=(struct dsDate*)0; return 0; } /*}}}*/ /* syncDs -- write all datestamper timestamps */ /*{{{*/ static int syncDs(const struct cpmSuperBlock *sb) { if (sb->dirtyDs) { int dsoffset, dsblks, dsrecs, off, i; unsigned char *buf; dsrecs=(sb->maxdir+7)/8; /* Re-calculate checksums */ buf = (unsigned char *)sb->ds; for ( i=0; imaxdir*32+(sb->blksiz-1))/sb->blksiz; dsblks=(dsrecs*128+(sb->blksiz-1))/sb->blksiz; off=0; for (i=dsoffset; ids))+off,0,-1)==-1) return -1; off+=sb->blksiz; } } return 0; } /*}}}*/ /* cpmSync -- write directory back */ /*{{{*/ int cpmSync(struct cpmSuperBlock *sb) { if (sb->dirtyDirectory) { int i,blocks,entry; blocks=(sb->maxdir*32+sb->blksiz-1)/sb->blksiz; entry=0; for (i=0; idir+entry),0,-1)==-1) return -1; entry+=(sb->blksiz/32); } sb->dirtyDirectory=0; } if (sb->type&CPMFS_DS_DATES) syncDs(sb); return 0; } /*}}}*/ /* cpmUmount -- free super block */ /*{{{*/ int cpmUmount(struct cpmSuperBlock *sb) { int err_sync; char const *err_close; err_sync=cpmSync(sb); err_close=Device_close(&sb->dev); if (sb->type&CPMFS_DS_DATES) free(sb->ds); free(sb->alv); free(sb->skewtab); free(sb->dir); if (sb->passwdLength) free(sb->passwd); if (err_sync==-1) return err_sync; if (err_close) { boo=err_close; return -1; } return 0; } /*}}}*/ /* cpmNamei -- map name to inode */ /*{{{*/ int cpmNamei(const struct cpmInode *dir, char const *filename, struct cpmInode *i) { /* variables */ /*{{{*/ int user; char name[8],extension[3]; int highestExtno,highestExt=-1,lowestExtno,lowestExt=-1; int protectMode=0; /*}}}*/ #ifdef CPMFS_DEBUG fprintf(stderr,"cpmNamei: map %s\n", filename); #endif if (!S_ISDIR(dir->mode)) { boo="No such file"; return -1; } if (strcmp(filename,".")==0 || strcmp(filename,"..")==0) /* root directory */ /*{{{*/ { *i=*dir; return 0; } /*}}}*/ else if (strcmp(filename,"[passwd]")==0 && dir->sb->passwdLength) /* access passwords */ /*{{{*/ { i->attr=0; i->ino=dir->sb->maxdir+1; i->mode=s_ifreg|0444; i->sb=dir->sb; i->atime=i->mtime=i->ctime=0; i->size=i->sb->passwdLength; return 0; } /*}}}*/ else if (strcmp(filename,"[label]")==0 && dir->sb->labelLength) /* access label */ /*{{{*/ { i->attr=0; i->ino=dir->sb->maxdir+2; i->mode=s_ifreg|0444; i->sb=dir->sb; i->atime=i->mtime=i->ctime=0; i->size=i->sb->labelLength; return 0; } /*}}}*/ if (splitFilename(filename,dir->sb->type,name,extension,&user)==-1) return -1; /* find highest and lowest extent */ /*{{{*/ { int extent; i->size=0; extent=-1; highestExtno=-1; lowestExtno=2049; while ((extent=findFileExtent(dir->sb,user,name,extension,extent+1,-1))!=-1) { int extno=EXTENT(dir->sb->dir[extent].extnol,dir->sb->dir[extent].extnoh); if (extno>highestExtno) { highestExtno=extno; highestExt=extent; } if (extnosize=highestExtno*16384; if (dir->sb->size<=256) for (block=15; block>=0; --block) { if (dir->sb->dir[highestExt].pointers[block]) break; } else for (block=7; block>=0; --block) { if (dir->sb->dir[highestExt].pointers[2*block] || dir->sb->dir[highestExt].pointers[2*block+1]) break; } if (dir->sb->dir[highestExt].blkcnt) { i->size+=((dir->sb->dir[highestExt].blkcnt&0xff)-1)*128; if (dir->sb->type & CPMFS_ISX) { i->size += (128 - dir->sb->dir[highestExt].lrc); } else { i->size+=dir->sb->dir[highestExt].lrc ? (dir->sb->dir[highestExt].lrc&0xff) : 128; } } #ifdef CPMFS_DEBUG fprintf(stderr,"cpmNamei: size=%ld\n",(long)i->size); #endif } /*}}}*/ i->ino=lowestExt; i->mode=s_ifreg; i->sb=dir->sb; /* read timestamps */ /*{{{*/ protectMode = readTimeStamps(i,lowestExt); /*}}}*/ /* Determine the inode attributes */ i->attr = 0; if (dir->sb->dir[lowestExt].name[0]&0x80) i->attr |= CPM_ATTR_F1; if (dir->sb->dir[lowestExt].name[1]&0x80) i->attr |= CPM_ATTR_F2; if (dir->sb->dir[lowestExt].name[2]&0x80) i->attr |= CPM_ATTR_F3; if (dir->sb->dir[lowestExt].name[3]&0x80) i->attr |= CPM_ATTR_F4; if (dir->sb->dir[lowestExt].ext [0]&0x80) i->attr |= CPM_ATTR_RO; if (dir->sb->dir[lowestExt].ext [1]&0x80) i->attr |= CPM_ATTR_SYS; if (dir->sb->dir[lowestExt].ext [2]&0x80) i->attr |= CPM_ATTR_ARCV; if (protectMode&0x20) i->attr |= CPM_ATTR_PWDEL; if (protectMode&0x40) i->attr |= CPM_ATTR_PWWRITE; if (protectMode&0x80) i->attr |= CPM_ATTR_PWREAD; if (dir->sb->dir[lowestExt].ext[1]&0x80) i->mode|=01000; i->mode|=0444; if (!(dir->sb->dir[lowestExt].ext[0]&0x80)) i->mode|=0222; if (extension[0]=='C' && extension[1]=='O' && extension[2]=='M') i->mode|=0111; readDsStamps(i,lowestExt); return 0; } /*}}}*/ /* cpmStatFS -- statfs */ /*{{{*/ void cpmStatFS(const struct cpmInode *ino, struct cpmStatFS *buf) { int i; struct cpmSuperBlock *d; d=ino->sb; buf->f_bsize=d->blksiz; buf->f_blocks=d->size; buf->f_bfree=0; buf->f_bused=-(d->dirblks); for (i=0; ialvSize; ++i) { int temp,j; temp = *(d->alv+i); for (j=0; jsize) { if (1&temp) { #ifdef CPMFS_DEBUG fprintf(stderr,"cpmStatFS: block %d allocated\n",(i*INTBITS+j)); #endif ++buf->f_bused; } else ++buf->f_bfree; } temp >>= 1; } } buf->f_bavail=buf->f_bfree; buf->f_files=d->maxdir; buf->f_ffree=0; for (i=0; imaxdir; ++i) { if (d->dir[i].status==(char)0xe5) ++buf->f_ffree; } buf->f_namelen=11; } /*}}}*/ /* cpmUnlink -- unlink */ /*{{{*/ int cpmUnlink(const struct cpmInode *dir, char const *fname) { int user; char name[8],extension[3]; int extent; struct cpmSuperBlock *drive; if (!S_ISDIR(dir->mode)) { boo="No such file"; return -1; } drive=dir->sb; if (splitFilename(fname,dir->sb->type,name,extension,&user)==-1) return -1; if ((extent=findFileExtent(drive,user,name,extension,0,-1))==-1) return -1; drive->dirtyDirectory=1; drive->dir[extent].status=(char)0xe5; do { drive->dir[extent].status=(char)0xe5; } while ((extent=findFileExtent(drive,user,name,extension,extent+1,-1))>=0); alvInit(drive); return 0; } /*}}}*/ /* cpmRename -- rename */ /*{{{*/ int cpmRename(const struct cpmInode *dir, char const *old, char const *new) { struct cpmSuperBlock *drive; int extent; int olduser; char oldname[8], oldext[3]; int newuser; char newname[8], newext[3]; if (!S_ISDIR(dir->mode)) { boo="No such file"; return -1; } drive=dir->sb; if (splitFilename(old,dir->sb->type, oldname, oldext,&olduser)==-1) return -1; if (splitFilename(new,dir->sb->type, newname, newext,&newuser)==-1) return -1; if ((extent=findFileExtent(drive,olduser,oldname,oldext,0,-1))==-1) return -1; if (findFileExtent(drive,newuser,newname, newext,0,-1)!=-1) { boo="file already exists"; return -1; } do { drive->dirtyDirectory=1; drive->dir[extent].status=newuser; memcpy7(drive->dir[extent].name, newname, 8); memcpy7(drive->dir[extent].ext, newext, 3); } while ((extent=findFileExtent(drive,olduser,oldname,oldext,extent+1,-1))!=-1); return 0; } /*}}}*/ /* cpmOpendir -- opendir */ /*{{{*/ int cpmOpendir(struct cpmInode *dir, struct cpmFile *dirp) { if (!S_ISDIR(dir->mode)) { boo="No such file"; return -1; } dirp->ino=dir; dirp->pos=0; dirp->mode=O_RDONLY; return 0; } /*}}}*/ /* cpmReaddir -- readdir */ /*{{{*/ int cpmReaddir(struct cpmFile *dir, struct cpmDirent *ent) { /* variables */ /*{{{*/ struct PhysDirectoryEntry *cur=(struct PhysDirectoryEntry*)0; char buf[2+8+1+3+1]; /* 00foobarxy.zzy\0 */ char *bufp; int hasext; /*}}}*/ if (!(S_ISDIR(dir->ino->mode))) /* error: not a directory */ /*{{{*/ { boo="not a directory"; return -1; } /*}}}*/ while (1) { int i; if (dir->pos==0) /* first entry is . */ /*{{{*/ { ent->ino=dir->ino->sb->maxdir; ent->reclen=1; strcpy(ent->name,"."); ent->off=dir->pos; ++dir->pos; return 1; } /*}}}*/ else if (dir->pos==1) /* next entry is .. */ /*{{{*/ { ent->ino=dir->ino->sb->maxdir; ent->reclen=2; strcpy(ent->name,".."); ent->off=dir->pos; ++dir->pos; return 1; } /*}}}*/ else if (dir->pos==2) { if (dir->ino->sb->passwdLength) /* next entry is [passwd] */ /*{{{*/ { ent->ino=dir->ino->sb->maxdir+1; ent->reclen=8; strcpy(ent->name,"[passwd]"); ent->off=dir->pos; ++dir->pos; return 1; } /*}}}*/ } else if (dir->pos==3) { if (dir->ino->sb->labelLength) /* next entry is [label] */ /*{{{*/ { ent->ino=dir->ino->sb->maxdir+2; ent->reclen=7; strcpy(ent->name,"[label]"); ent->off=dir->pos; ++dir->pos; return 1; } /*}}}*/ } else if (dir->pos>=RESERVED_ENTRIES && dir->pos<(int)dir->ino->sb->maxdir+RESERVED_ENTRIES) { int first=dir->pos-RESERVED_ENTRIES; if ((cur=dir->ino->sb->dir+(dir->pos-RESERVED_ENTRIES))->status>=0 && cur->status<=(dir->ino->sb->type&CPMFS_HI_USER ? 31 : 15)) { /* determine first extent for the current file */ /*{{{*/ for (i=0; iino->sb->maxdir; ++i) if (i!=(dir->pos-RESERVED_ENTRIES)) { if (isMatching(cur->status,cur->name,cur->ext,dir->ino->sb->dir[i].status,dir->ino->sb->dir[i].name,dir->ino->sb->dir[i].ext) && EXTENT(cur->extnol,cur->extnoh)>EXTENT(dir->ino->sb->dir[i].extnol,dir->ino->sb->dir[i].extnoh)) first=i; } /*}}}*/ if (first==(dir->pos-RESERVED_ENTRIES)) { ent->ino=dir->pos-RESERVED_INODES; /* convert file name to UNIX style */ /*{{{*/ buf[0]='0'+cur->status/10; buf[1]='0'+cur->status%10; for (bufp=buf+2,i=0; i<8 && (cur->name[i]&0x7f)!=' '; ++i) { *bufp++=dir->ino->sb->uppercase ? cur->name[i]&0x7f : tolower(cur->name[i]&0x7f); } for (hasext=0,i=0; i<3 && (cur->ext[i]&0x7f)!=' '; ++i) { if (!hasext) { *bufp++='.'; hasext=1; } *bufp++=dir->ino->sb->uppercase ? cur->ext[i]&0x7f : tolower(cur->ext[i]&0x7f); } *bufp='\0'; /*}}}*/ assert(bufp<=buf+sizeof(buf)); ent->reclen=bufp-buf; strcpy(ent->name,buf); ent->off=dir->pos; ++dir->pos; return 1; } } } else return 0; ++dir->pos; } } /*}}}*/ /* cpmStat -- stat */ /*{{{*/ void cpmStat(const struct cpmInode *ino, struct cpmStat *buf) { buf->ino=ino->ino; buf->mode=ino->mode; buf->size=ino->size; buf->atime=ino->atime; buf->mtime=ino->mtime; buf->ctime=ino->ctime; } /*}}}*/ /* cpmOpen -- open */ /*{{{*/ int cpmOpen(struct cpmInode *ino, struct cpmFile *file, mode_t mode) { if (S_ISREG(ino->mode)) { if ((mode&O_WRONLY) && (ino->mode&0222)==0) { boo="permission denied"; return -1; } file->pos=0; file->ino=ino; file->mode=mode; return 0; } else { boo="not a regular file"; return -1; } } /*}}}*/ /* cpmRead -- read */ /*{{{*/ ssize_t cpmRead(struct cpmFile *file, char *buf, size_t count) { int findext=1,findblock=1,extent=-1,block=-1,extentno=-1,got=0,nextblockpos=-1,nextextpos=-1; struct cpmSuperBlock const *sb=file->ino->sb; int blocksize=sb->blksiz; int extcap; extcap=(sb->size<=256 ? 16 : 8)*blocksize; if (extcap>16384) extcap=16384*sb->extents; if (file->ino->ino==(ino_t)sb->maxdir+1) /* [passwd] */ /*{{{*/ { if ((file->pos+(off_t)count)>file->ino->size) count=file->ino->size-file->pos; if (count) memcpy(buf,sb->passwd+file->pos,count); file->pos+=count; #ifdef CPMFS_DEBUG fprintf(stderr,"cpmRead passwd: read %d bytes, now at position %ld\n",count,(long)file->pos); #endif return count; } /*}}}*/ else if (file->ino->ino==(ino_t)sb->maxdir+2) /* [label] */ /*{{{*/ { if ((file->pos+(off_t)count)>file->ino->size) count=file->ino->size-file->pos; if (count) memcpy(buf,sb->label+file->pos,count); file->pos+=count; #ifdef CPMFS_DEBUG fprintf(stderr,"cpmRead label: read %d bytes, now at position %ld\n",count,(long)file->pos); #endif return count; } /*}}}*/ else while (count>0 && file->posino->size) { char buffer[16384]; if (findext) { extentno=file->pos/16384; extent=findFileExtent(sb,sb->dir[file->ino->ino].status,sb->dir[file->ino->ino].name,sb->dir[file->ino->ino].ext,0,extentno); nextextpos=(file->pos/extcap)*extcap+extcap; findext=0; findblock=1; } if (findblock) { if (extent!=-1) { int ptr; ptr=(file->pos%extcap)/blocksize; if (sb->size>256) ptr*=2; block=(unsigned char)sb->dir[extent].pointers[ptr]; if (sb->size>256) block+=((unsigned char)sb->dir[extent].pointers[ptr+1])<<8; if (block==0) { memset(buffer,0,blocksize); } else { int start,end; start=(file->pos%blocksize) /sb->secLength; end=((file->pos%blocksize+(off_t)count)>blocksize ? blocksize-1 : (int)(file->pos%blocksize+count-1)) /sb->secLength; if (blockdirblks) { boo="Attempting to access block before beginning of data"; if (got==0) got=-1; break; } if (readBlock(sb,block,buffer,start,end)==-1) { if (got==0) got=-1; break; } } } nextblockpos=(file->pos/blocksize)*blocksize+blocksize; findblock=0; } if (file->pospos%blocksize]; ++file->pos; ++got; --count; } else if (file->pos==nextextpos) findext=1; else findblock=1; } #ifdef CPMFS_DEBUG fprintf(stderr,"cpmRead: read %d bytes, now at position %ld\n",got,(long)file->pos); #endif return got; } /*}}}*/ /* cpmWrite -- write */ /*{{{*/ ssize_t cpmWrite(struct cpmFile *file, char const *buf, size_t count) { int findext=1,findblock=-1,extent=-1,extentno=-1,got=0,nextblockpos=-1,nextextpos=-1; int blocksize=file->ino->sb->blksiz; int extcap; int block=-1,start=-1,end=-1,ptr=-1,last=-1; char buffer[16384]; extcap=(file->ino->sb->size<=256 ? 16 : 8)*blocksize; if (extcap>16384) extcap=16384*file->ino->sb->extents; while (count>0) { if (findext) /*{{{*/ { extentno=file->pos/16384; extent=findFileExtent(file->ino->sb,file->ino->sb->dir[file->ino->ino].status,file->ino->sb->dir[file->ino->ino].name,file->ino->sb->dir[file->ino->ino].ext,0,extentno); nextextpos=(file->pos/extcap)*extcap+extcap; if (extent==-1) { if ((extent=findFreeExtent(file->ino->sb))==-1) return (got==0 ? -1 : got); file->ino->sb->dir[extent]=file->ino->sb->dir[file->ino->ino]; memset(file->ino->sb->dir[extent].pointers,0,16); file->ino->sb->dir[extent].extnol=EXTENTL(extentno); file->ino->sb->dir[extent].extnoh=EXTENTH(extentno); file->ino->sb->dir[extent].blkcnt=0; file->ino->sb->dir[extent].lrc=0; time(&file->ino->ctime); updateTimeStamps(file->ino,extent); updateDsStamps(file->ino,extent); } findext=0; findblock=1; } /*}}}*/ if (findblock) /*{{{*/ { ptr=(file->pos%extcap)/blocksize; if (file->ino->sb->size>256) ptr*=2; block=(unsigned char)file->ino->sb->dir[extent].pointers[ptr]; if (file->ino->sb->size>256) block+=((unsigned char)file->ino->sb->dir[extent].pointers[ptr+1])<<8; if (block==0) /* allocate new block, set start/end to cover it */ /*{{{*/ { if ((block=allocBlock(file->ino->sb))==-1) return (got==0 ? -1 : got); file->ino->sb->dir[extent].pointers[ptr]=block&0xff; if (file->ino->sb->size>256) file->ino->sb->dir[extent].pointers[ptr+1]=(block>>8)&0xff; start=0; /* By setting end to the end of the block and not the end * of the currently written data, the whole block gets * wiped from the disk, which is slow, but convenient in * case of sparse files. */ end=(blocksize-1)/file->ino->sb->secLength; memset(buffer,0,blocksize); time(&file->ino->ctime); updateTimeStamps(file->ino,extent); updateDsStamps(file->ino,extent); } /*}}}*/ else /* read existing block and set start/end to cover modified parts */ /*{{{*/ { start=(file->pos%blocksize)/file->ino->sb->secLength; end=((int)(file->pos%blocksize+count)>=blocksize ? blocksize-1 : (int)(file->pos%blocksize+count-1))/file->ino->sb->secLength; if (file->pos%file->ino->sb->secLength) { if (readBlock(file->ino->sb,block,buffer,start,start)==-1) { if (got==0) got=-1; break; } } if (end!=start && (int)(file->pos%blocksize+count)pos+count)%file->ino->sb->secLength) { if (readBlock(file->ino->sb,block,buffer,end,end)==-1) { if (got==0) got=-1; break; } } } /*}}}*/ nextblockpos=(file->pos/blocksize)*blocksize+blocksize; findblock=0; } /*}}}*/ /* fill block and write it */ /*{{{*/ file->ino->sb->dirtyDirectory=1; while (file->pos!=nextblockpos && count) { buffer[file->pos%blocksize]=*buf++; ++file->pos; if (file->ino->sizepos) file->ino->size=file->pos; ++got; --count; } /* In case the data only fills part of a sector, the rest is * still initialized: A new block was cleared and the boundaries * of an existing block were read. */ (void)writeBlock(file->ino->sb,block,buffer,start,end); time(&file->ino->mtime); if (file->ino->sb->size<=256) for (last=15; last>=0; --last) { if (file->ino->sb->dir[extent].pointers[last]) { break; } } else for (last=14; last>0; last-=2) { if (file->ino->sb->dir[extent].pointers[last] || file->ino->sb->dir[extent].pointers[last+1]) { last/=2; break; } } if (last>0) extentno+=(last*blocksize)/extcap; file->ino->sb->dir[extent].extnol=EXTENTL(extentno); file->ino->sb->dir[extent].extnoh=EXTENTH(extentno); file->ino->sb->dir[extent].blkcnt=((file->pos-1)%16384)/128+1; if (file->ino->sb->type & CPMFS_EXACT_SIZE) { file->ino->sb->dir[extent].lrc = (128 - (file->pos%128)) & 0x7F; } else { file->ino->sb->dir[extent].lrc=file->pos%128; } updateTimeStamps(file->ino,extent); updateDsStamps(file->ino,extent); /*}}}*/ if (file->pos==nextextpos) findext=1; else if (file->pos==nextblockpos) findblock=1; } return got; } /*}}}*/ /* cpmClose -- close */ /*{{{*/ int cpmClose(struct cpmFile *file) { return 0; } /*}}}*/ /* cpmCreat -- creat */ /*{{{*/ int cpmCreat(struct cpmInode *dir, char const *fname, struct cpmInode *ino, mode_t mode) { int user; char name[8],extension[3]; int extent; struct cpmSuperBlock *drive; struct PhysDirectoryEntry *ent; if (!S_ISDIR(dir->mode)) { boo="No such file or directory"; return -1; } if (splitFilename(fname,dir->sb->type,name,extension,&user)==-1) return -1; #ifdef CPMFS_DEBUG fprintf(stderr,"cpmCreat: %s -> %d:%-.8s.%-.3s\n",fname,user,name,extension); #endif if (findFileExtent(dir->sb,user,name,extension,0,-1)!=-1) return -1; drive=dir->sb; if ((extent=findFreeExtent(dir->sb))==-1) return -1; ent=dir->sb->dir+extent; drive->dirtyDirectory=1; memset(ent,0,32); ent->status=user; memcpy(ent->name,name,8); memcpy(ent->ext,extension,3); ino->ino=extent; ino->mode=s_ifreg|mode; ino->size=0; time(&ino->atime); time(&ino->mtime); time(&ino->ctime); ino->sb=dir->sb; updateTimeStamps(ino,extent); updateDsStamps(ino,extent); return 0; } /*}}}*/ /* cpmAttrGet -- get CP/M attributes */ /*{{{*/ int cpmAttrGet(struct cpmInode *ino, cpm_attr_t *attrib) { *attrib = ino->attr; return 0; } /*}}}*/ /* cpmAttrSet -- set CP/M attributes */ /*{{{*/ int cpmAttrSet(struct cpmInode *ino, cpm_attr_t attrib) { struct cpmSuperBlock *drive; int extent; int user; char name[8], extension[3]; memset(name, 0, sizeof(name)); memset(extension, 0, sizeof(extension)); drive = ino->sb; extent = ino->ino; drive->dirtyDirectory=1; /* Strip off existing attribute bits */ memcpy7(name, drive->dir[extent].name, 8); memcpy7(extension, drive->dir[extent].ext, 3); user = drive->dir[extent].status; /* And set new ones */ if (attrib & CPM_ATTR_F1) name[0] |= 0x80; if (attrib & CPM_ATTR_F2) name[1] |= 0x80; if (attrib & CPM_ATTR_F3) name[2] |= 0x80; if (attrib & CPM_ATTR_F4) name[3] |= 0x80; if (attrib & CPM_ATTR_RO) extension[0] |= 0x80; if (attrib & CPM_ATTR_SYS) extension[1] |= 0x80; if (attrib & CPM_ATTR_ARCV) extension[2] |= 0x80; do { memcpy(drive->dir[extent].name, name, 8); memcpy(drive->dir[extent].ext, extension, 3); } while ((extent=findFileExtent(drive, user,name,extension,extent+1,-1))!=-1); /* Update the stored (inode) copies of the file attributes and mode */ ino->attr=attrib; if (attrib&CPM_ATTR_RO) ino->mode&=~(S_IWUSR|S_IWGRP|S_IWOTH); else ino->mode|=(S_IWUSR|S_IWGRP|S_IWOTH); return 0; } /*}}}*/ /* cpmChmod -- set CP/M r/o & sys */ /*{{{*/ int cpmChmod(struct cpmInode *ino, mode_t mode) { /* Convert the chmod() into a chattr() call that affects RO */ int newatt = ino->attr & ~CPM_ATTR_RO; if (!(mode & (S_IWUSR|S_IWGRP|S_IWOTH))) newatt |= CPM_ATTR_RO; return cpmAttrSet(ino, newatt); } /*}}}*/ /* cpmUtime -- set timestamps */ /*{{{*/ void cpmUtime(struct cpmInode *ino, struct utimbuf *times) { ino->atime = times->actime; ino->mtime = times->modtime; time(&ino->ctime); updateTimeStamps(ino,ino->ino); updateDsStamps(ino,ino->ino); } /*}}}*/ cpmtools-2.23/term.h0000644000175000017500000000065714047006226014217 0ustar michaelmichael#ifndef TERM_H #define TERM_H #ifdef __cplusplus extern "C" { #endif extern void term_init(void); extern void term_exit(void); extern void term_clear(void); extern void term_xy(int x, int y); extern void term_printf(char const *fmt, ...); extern void term_putch(char ch); extern int term_getch(void); extern void term_reverse(int on); extern int term_lines(void); extern int term_cols(void); #ifdef __cplusplus } #endif #endif cpmtools-2.23/cpmchattr.c0000640000175000017500000000532314047006226015217 0ustar michaelmichael/* #includes */ /*{{{C}}}*//*{{{*/ #include "config.h" #include #include #include #include #include "getopt_.h" #include "cpmfs.h" /*}}}*/ const char cmd[]="cpmchattr"; int main(int argc, char *argv[]) /*{{{*/ { /* variables */ /*{{{*/ const char *err; const char *image; const char *format; const char *devopts=NULL; int uppercase=0; int c,i,usage=0,exitcode=0; struct cpmSuperBlock drive; struct cpmInode root; int gargc; char **gargv; const char *attrs; /*}}}*/ /* parse options */ /*{{{*/ if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT; while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c) { case 'T': devopts=optarg; break; case 'f': format=optarg; break; case 'u': uppercase=1; break; case 'h': case '?': usage=1; break; } if (optind>=(argc-2)) usage=1; else { image=argv[optind++]; attrs = argv[optind++]; } if (usage) { fprintf(stderr,"Usage: %s [-f format] [-T dsktype] [-u] image [NMrsa1234] pattern ...\n",cmd); exit(1); } /*}}}*/ /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev, image, O_RDWR, devopts))) { fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); exit(1); } if (cpmReadSuper(&drive,&root,format,uppercase)==-1) { fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } /*}}}*/ cpmglob(optind,argc,argv,&root,&gargc,&gargv); for (i=0; i #include #include #include #include #include "getopt_.h" #include "cpmfs.h" /*}}}*/ const char cmd[]="cpmrm"; int main(int argc, char *argv[]) /*{{{*/ { /* variables */ /*{{{*/ const char *err; const char *image; const char *format; const char *devopts=NULL; int uppercase=0; int c,i,usage=0,exitcode=0; struct cpmSuperBlock drive; struct cpmInode root; int gargc; char **gargv; /*}}}*/ /* parse options */ /*{{{*/ if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT; while ((c=getopt(argc,argv,"T:f:uh?"))!=EOF) switch(c) { case 'T': devopts=optarg; break; case 'f': format=optarg; break; case 'u': uppercase=1; break; case 'h': case '?': usage=1; break; } if (optind>=(argc-1)) usage=1; else image=argv[optind++]; if (usage) { fprintf(stderr,"Usage: %s [-f format] [-T dsktype] [-u] image pattern ...\n",cmd); exit(1); } /*}}}*/ /* open image */ /*{{{*/ if ((err=Device_open(&drive.dev, image, O_RDWR, devopts))) { fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err); exit(1); } if (cpmReadSuper(&drive,&root,format,uppercase)==-1) { fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo); exit(1); } /*}}}*/ cpmglob(optind,argc,argv,&root,&gargc,&gargv); for (i=0; i