%n mtools %v 3.0 %c * %l * %b * %d * %f * %t mtools-3.0.tgz %w Misc %% %setup patch -u -p1 <<'ENDPATCH' diff -ru2N mtools-3.0/Makefile.in mtools-MCC/Makefile.in --- mtools-3.0/Makefile.in Wed May 8 20:50:57 1996 +++ mtools-MCC/Makefile.in Sat Aug 31 13:07:05 1996 @@ -32,14 +32,14 @@ DEFS = @DEFS@ HOST_ID = @HOST_ID@ -CFLAGS = @CFLAGS@ +CFLAGS = -O6 -m386 -Wall -fomit-frame-pointer LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ SHLIB = @SHLIB@ -LN_S = @LN_S@ +LN_S = ln -f INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = install -s -m 555 +INSTALL_DATA = install -m 444 MAKEINFO = makeinfo TEXI2DVI = texi2dvi @@ -94,8 +94,8 @@ -SCRIPTS = mcheck mxtar uz gz xcopy mcomp +SCRIPTS = mcheck xcopy LINKS=mattrib mcd mcopy mdel mdeltree mdir mformat mlabel \ -mmd mmount mmove mrd mread mren mtype mwrite mtest +mmd mmount mmove mrd mread mren mtype mwrite mtest mbadblocks ALLCFLAGS = $(CPPFLAGS) $(DEFS) $(HOST_ID) $(CFLAGS) -I. -I@srcdir@ $(USERCFLAGS) @@ -149,5 +149,5 @@ install: $(bindir)/mtools install-man install-links \ - $(bindir)/mkmanifest install-scripts install-info + $(bindir)/mkmanifest install-scripts uninstall: uninstall-bin uninstall-man uninstall-links \ @@ -171,5 +171,5 @@ @for j in $(LINKS); do \ rm -f $(bindir)/$$j ; \ - $(LN_S) mtools $(bindir)/$$j ; \ + $(LN_S) $(bindir)/mtools $(bindir)/$$j ; \ echo $(bindir)/$$j ; \ done @@ -182,6 +182,4 @@ echo $(bindir)/$$j ; \ done - rm -f $(bindir)/lz - $(LN_S) uz $(bindir)/lz install-man: @@ -189,10 +187,10 @@ @for j in $(MAN1); do \ $(INSTALL_DATA) $(srcdir)/$$j $(MAN1DIR)/$$j ; \ - echo $(MAN1DIR)/$$j ; \ + gzip -9f $(MAN1DIR)/$$j ; \ done @$(top_srcdir)/mkinstalldirs $(MAN5DIR) @for j in $(MAN5); do \ $(INSTALL_DATA) $(srcdir)/$$j $(MAN5DIR)/$$j ; \ - echo $(MAN5DIR)/$$j ; \ + gzip -9f $(MAN5DIR)/$$j ; \ done diff -ru2N mtools-3.0/codepage.c mtools-MCC/codepage.c --- mtools-3.0/codepage.c Wed May 8 18:25:18 1996 +++ mtools-MCC/codepage.c Sat Aug 31 11:25:14 1996 @@ -77,5 +77,6 @@ { int fd, filesize; - unsigned char file[65536]; + unsigned char *file; + struct stat buf; unsigned short ucase=0, records; int i; @@ -93,4 +94,11 @@ } + fstat(fd, &buf); + file = (unsigned char *) malloc(buf.st_size); + if(!file) { + fprintf(stderr, "Out of memory\n"); + cleanup_and_exit(1); + } + /* load country.sys */ filesize=read(fd, (char *) file, 65536); @@ -126,4 +134,5 @@ mstoupper = (char *) toucase[0]; memcpy(mstoupper, file + ucase + 10, 128); + free(file); return; } @@ -131,4 +140,5 @@ } not_found(country_found, country, *codepage); + free(file); } diff -ru2N mtools-3.0/directory.c mtools-MCC/directory.c --- mtools-3.0/directory.c Fri May 3 07:35:01 1996 +++ mtools-MCC/directory.c Sat Aug 31 11:40:05 1996 @@ -21,5 +21,5 @@ return NULL; - if (v && (dir->attr == 0x0f)) { + if (v && (dir->attr == 0x0f) && dir->name[0] != DELMARK) { struct vfat_subentry *vse; unsigned char id, last_flag; diff -ru2N mtools-3.0/init.c mtools-MCC/init.c --- mtools-3.0/init.c Fri May 3 08:32:25 1996 +++ mtools-MCC/init.c Sat Aug 31 11:46:07 1996 @@ -140,4 +140,5 @@ char name[EXPAND_BUF]; int cylinder_size; + int nhs; struct device dev; @@ -168,4 +169,5 @@ cylinder_size = dev.heads * dev.sectors; + This->serialized = 0; if ((media & ~7) == 0xf8){ @@ -178,6 +180,6 @@ This->num_fat = 2; This->sector_size = 512; - This->serialized = 0; This->fat_bits = 12; + nhs = 0; } else { /* @@ -185,6 +187,14 @@ * (which is in clusters) */ - tot_sectors = DWORD(bigsect); - set_ulong(&tot_sectors, WORD(psect)); + if(boot0.dos4 == 0x29) { + This->serialized = 1; + tot_sectors = DWORD(bigsect); + set_ulong(&tot_sectors, WORD(psect)); + This->serial_number = DWORD(serial); + nhs = DWORD(nhs); + } else { + tot_sectors = WORD(psect); + nhs = WORD(nhs); + } This->cluster_size = boot0.clsiz; This->fat_start = WORD(nrsvsect); @@ -192,6 +202,4 @@ This->dir_len = WORD(dirents) * MDIR_SIZE / This->sector_size; This->num_fat = boot0.nfat; - This->serialized = boot0.dos4 == 0x29; - This->serial_number = DWORD(serial); } cylinder_size = dev.sectors * dev.heads; @@ -204,5 +212,5 @@ This->fat_len * This->sector_size / 2 * This->cluster_size; - tot_sectors -= (tot_sectors + DWORD(nhs)) % cylinder_size; + tot_sectors -= (tot_sectors + nhs) % cylinder_size; fprintf(stderr, "Warning: disk size unknown, assuming %d Megabytes\n", diff -ru2N mtools-3.0/match.c mtools-MCC/match.c --- mtools-3.0/match.c Tue Apr 30 23:09:11 1996 +++ mtools-MCC/match.c Sat Aug 31 11:55:26 1996 @@ -20,16 +20,10 @@ -int match(__const char *s, __const char *p, char *out, int Case) +static int _match(__const char *s, __const char *p, char *out, int Case, + int (*compfn) (char a, char b)) { int matched, reverse; char first, last; - int (*compfn)(char a, char b); - - if(Case) - compfn = casecmp; - else - /*compfn = exactcmp;*/ - compfn = casecmp; for (; *p != '\0'; ) { @@ -47,21 +41,12 @@ /* search for next char in pattern */ - matched = 0; - while (*s != '\0') { + while(*s) { + if(_match(s, p, out, Case, compfn)) + return 1; if(out) - *(out++) = *s; - if (compfn(*s,*p)) { - matched = 1; - break; - } + *out++ = *s; s++; } - /* if last char in pattern */ - if (*p == '\0') - continue; - - if (!matched) - return(0); - break; + continue; case '[': /* match range of characters */ first = '\0'; @@ -145,3 +130,11 @@ else return(1); +} + +int match(__const char *s, __const char *p, char *out, int Case) +{ + int (*compfn)(char a, char b); + + compfn = casecmp; + return _match(s, p, out, Case, compfn); } diff -ru2N mtools-3.0/mlabel.c mtools-MCC/mlabel.c --- mtools-3.0/mlabel.c Wed May 8 18:26:35 1996 +++ mtools-MCC/mlabel.c Sat Aug 31 11:56:33 1996 @@ -166,5 +166,5 @@ ch.ignore_entry = 1; result = mwrite_one(RootDir,Fs,argv[0],filename,0, - labelit,NULL,&ch); + labelit,NULL,&ch) ? 0 : 1; } diff -ru2N mtools-3.0/msdos.h mtools-MCC/msdos.h --- mtools-3.0/msdos.h Thu May 9 07:08:23 1996 +++ mtools-MCC/msdos.h Sat Aug 31 11:57:18 1996 @@ -123,5 +123,5 @@ }; - +#define CHAR(x) (boot->x[0]) #define WORD(x) (_WORD(boot->x)) #define DWORD(x) (_DWORD(boot->x)) diff -ru2N mtools-3.0/mtools.h mtools-MCC/mtools.h --- mtools-3.0/mtools.h Wed May 8 18:22:08 1996 +++ mtools-MCC/mtools.h Sat Aug 31 12:03:37 1996 @@ -49,5 +49,5 @@ int retries); -int lock_dev(int fd); +int lock_dev(int fd, int mode); Stream_t *subdir(Stream_t *, char *pathname); diff -ru2N mtools-3.0/mtools.texi mtools-MCC/mtools.texi --- mtools-3.0/mtools.texi Wed May 8 21:07:38 1996 +++ mtools-MCC/mtools.texi Sat Aug 31 12:11:18 1996 @@ -195,5 +195,5 @@ @itemize @bullet @item -Illegal characters are replaces by underscores. The illegal characters +Illegal characters are replaced by underscores. The illegal characters are @code{;+=[]',\"*\\<>/?:|}. @item @@ -313,5 +313,5 @@ to overwrite the file, or to skip it. -@node case sensitivity, XDF disks, name clashes, Common features +@node case sensitivity, high capacity formats, name clashes, Common features @section Case sensitivity of the VFAT filesystem @cindex Case sensitivity @@ -341,4 +341,22 @@ @cindex Linux enhancements (XDF disks) +Mtools supports a number of formats which allow to store more data on +disk as usual. Due to different operating system abilities, these +formats are not supported on all OS'es. Mtools recognizes these formats +transparently where supported. + +In order to format these disks, you need to use an operating system +specific tool. For Linux, suitable floppy tools can be found in the +@code{fdutils} package at the following locations~: +@example +@code{ftp://ftp.imag.fr/pub/Linux/ZLIBC/fdutils/}. +@code{ftp://tsx-11.mit.edu/pub/linux/sources/sbin/fdutils-*} +@code{ftp://sunsite.unc.edu/pub/Linux/system/Misc/fdutils-*} +@end example + +See the manpages included in that package for further detail: Use +@code{superformat} to format all formats except XDF, and use +@code{xdfcopy} to format XDF. + XDF is a high capacity format used by OS/2. It can hold 1840 K per disk. That's lower than the best 2m formats, but its main advantage is @@ -1264,5 +1282,5 @@ @item s The number of sectors per track. If the 2m option is given, number of -512-byte sector equivalents on generic tracks (i.e. not head 0 track). +512-byte sector equivalents on generic tracks (i.e. not head 0 track 0). If the 2m option is not given, number of physical sectors per track (which may be bigger than 512 bytes). diff -ru2N mtools-3.0/patchlevel.h mtools-MCC/patchlevel.h --- mtools-3.0/patchlevel.h Sun May 12 20:01:20 1996 +++ mtools-MCC/patchlevel.h Sat Aug 31 12:49:08 1996 @@ -1,2 +1,2 @@ -#define VERSION "3.0 " +#define VERSION "3.0" #define DATE "12 May 96" diff -ru2N mtools-3.0/plain_io.c mtools-MCC/plain_io.c --- mtools-3.0/plain_io.c Sun May 12 20:24:19 1996 +++ mtools-MCC/plain_io.c Sat Aug 31 12:19:35 1996 @@ -35,18 +35,18 @@ */ -int lock_dev(int fd) +int lock_dev(int fd, int mode) { -#if (defined(HAVE_LOCKF) && defined(F_TLOCK)) - if (lockf(fd, F_TLOCK, 0) < 0) -#else /* LOCKF */ - #if (defined(HAVE_FLOCK) && defined (LOCK_EX) && defined(LOCK_NB)) - if (flock(fd, LOCK_EX|LOCK_NB) < 0) + if (flock(fd, (mode ? LOCK_EX : LOCK_SH)|LOCK_NB) < 0) #else /* FLOCK */ +#if (defined(HAVE_LOCKF) && defined(F_TLOCK)) + if (mode && lockf(fd, F_TLOCK, 0) < 0) +#else /* LOCKF */ + #if (defined(F_SETLK) && defined(F_WRLCK)) struct flock flk; - flk.l_type = F_WRLCK; + flk.l_type = mode ? F_WRLCK : F_RDLCK; flk.l_whence = 0; flk.l_start = 0L; @@ -55,6 +55,6 @@ if (fcntl(fd, F_SETLK, &flk) < 0) #endif /* FCNTL */ -#endif /* FLOCK */ #endif /* LOCKF */ +#endif /* FLOCK */ { if(errno == EINVAL) @@ -147,6 +147,6 @@ if(media == 0xf0 || media >= 0x100){ - dev->heads = WORD(nheads); - dev->sectors = WORD(nsect); + dev->heads = CHAR(nheads); + dev->sectors = CHAR(nsect); tot_sectors = DWORD(bigsect); set_ulong(&tot_sectors, WORD(psect)); @@ -169,6 +169,5 @@ sum += boot->jump[j];/* checksum */ dev->ssize = boot->jump[InfTm]; - if (!sum && - dev->ssize >= 0 && dev->ssize <= 7 ){ + if (!sum && dev->ssize <= 7 ){ dev->use_2m = 0xff; dev->ssize |= 0x80; /* is set */ @@ -269,5 +268,5 @@ /* lock the device on writes */ - if (mode == O_RDWR && lock_dev(This->fd)) { + if (lock_dev(This->fd, mode == O_RDWR)) { close(This->fd); Free(This); diff -ru2N mtools-3.0/scripts/xcopy mtools-MCC/scripts/xcopy --- mtools-3.0/scripts/xcopy Fri May 3 22:02:39 1996 +++ mtools-MCC/scripts/xcopy Sat Aug 31 12:24:53 1996 @@ -119,4 +119,5 @@ echo -n 'What directory do you want to copy (default is "'$WD'")? ' if read answer; then + [ -z "$answer" ] && answer="$WD" if [ ! -d "$answer" ]; then echo '' @@ -172,8 +173,10 @@ cd $FROMDIR -OPTIONS='-pmdu' +OPTIONS='-pdu' if [ -w "$FROMDIR" ]; then ## Reset access times if permissions available OPTIONS=${OPTIONS}a +else + OPTIONS=3D${OPTIONS}m fi diff -ru2N mtools-3.0/xdf_io.c mtools-MCC/xdf_io.c --- mtools-3.0/xdf_io.c Wed May 8 17:48:27 1996 +++ mtools-MCC/xdf_io.c Sat Aug 31 12:25:50 1996 @@ -538,5 +538,5 @@ /* lock the device on writes */ - if (mode == O_RDWR && lock_dev(This->fd)) { + if (lock_dev(This->fd, mode == O_RDWR)) { sprintf(errmsg,"xdf floppy: device \"%s\"busy\n:", dev->name); ENDPATCH ./configure --prefix=/usr --enable-xdf make * make install * rm -f /usr/bin/mtools %%