diff -rc --new-file orig/mtools-2.0.7/Configure mtools-2.0.7/Configure *** orig/mtools-2.0.7/Configure Thu Sep 10 16:10:09 1992 --- mtools-2.0.7/Configure Sun Sep 26 19:24:01 1993 *************** *** 39,51 **** FCNTL Alternate Berkeley lock method (may not work on devices) The folowing are pre-proccessor variables for the default device setups for various flavors of Unix. Pick one of the these, or create a new entry in the devices.c file. - ISC default devices for ISC's SVR3.2 ! UNIXPC default devices for AT&T Unix PC 7300/3B1 SPARC default devices for SunOS 4.1 on a SPARCstation --- 39,53 ---- FCNTL Alternate Berkeley lock method (may not work on devices) + Puck *none* if you are on Linux -- record locking is still a bit + + The folowing are pre-proccessor variables for the default device setups for various flavors of Unix. Pick one of the these, or create a new entry in the devices.c file. ! ISC default devices for ISC's SVR3.2 SPARC default devices for SunOS 4.1 on a SPARCstation *************** *** 59,65 **** --- 61,75 ---- RT_ACIS default devices for IBM's BSD clone. + UNIXPC default devices for AT&T Unix PC 7300/3B1 + SPARC_ODD for reading odd-ball disks on a Sparc + + However if you define LOADDEVS instead the configuration information + will be read from /etc/mtools (the path can be changed by editing + at devices.c). This should not be done if you would have defined + otherwise UNIXPC or SPARC_ODD, as these two choices also imply + OS dependent device initialization routines. There is a variable in msdos.h called SIG_TYPE which should be configured to the "base" return type of signal(); *************** *** 123,128 **** --- 133,153 ---- safely ignored. 4) Some example devices + + If you define LOADDEVS, then a sample /etc/mtools file may be: + + A /dev/fd0 12 0 0 0 + A /dev/fd0 12 40 2 9 + B /dev/fd1 12 0 0 0 + B /dev/fd1 12 40 2 9 + C /dev/hda1 16 0 0 0 + D /dev/hda6 16 0 0 0 + + which is the default one contained in mtools.etc in this directory, + and that is designed for Linux. + + If you choose to hardcode the devices in, by not defining LOADDEVS, + but one of DELL, ..., the following are typical choices: for Interactive 386ix 2.0.2 with: 1.2m 5.25" as a: (supports 1.2m, 360k, and 320k) diff -rc --new-file orig/mtools-2.0.7/Makefile mtools-2.0.7/Makefile *** orig/mtools-2.0.7/Makefile Thu Sep 10 16:10:46 1992 --- mtools-2.0.7/Makefile Thu Oct 28 08:58:34 1993 *************** *** 14,177 **** #CFLAGS = -O -M2e -DINT16 -DXENIX -DLOCKF #LDFLAGS = -s -M2e -i -f 5000 ! CFLAGS = -O -DSPARC -DBSD LDFLAGS = -s LD = $(CC) LINT = lint SHLIB = SHAR = shar -a ! BINDIR = ${DESTDIR}/usr/local/mtools ! MANEXT = 1 ! MANDIR = ${DESTDIR}/usr/share/local/man/man$(MANEXT) # # for AT&T Unix PC 7300/3b1 style shared libraries. #SHOBJ = /lib/crt0s.o /lib/shlib.ifile #LD = ld ! PROGS = mattrib mcd mcopy mdel mdir mformat mlabel mmd mrd mread mren \ ! mtype mwrite mkmanifest ! MATTRIB = mattrib.o buf_read.o buf_write.o devices.o dir_read.o \ ! dir_write.o expand.o fat_read.o init.o match.o parse.o subdir.o ! MCD = mcd.o buf_read.o devices.o dir_read.o expand.o fat_read.o \ ! init.o is_dir.o match.o parse.o subdir.o ! MCOPY = mcopy.o ! MDEL = mdel.o buf_read.o buf_write.o devices.o dir_read.o dir_write.o \ ! expand.o fat_free.o fat_read.o fat_write.o init.o match.o parse.o \ ! subdir.o ! MDIR = mdir.o buf_read.o devices.o dir_read.o expand.o fat_read.o \ ! init.o is_dir.o match.o parse.o subdir.o ! MFORMAT = mformat.o devices.o dir_write.o expand.o ! MLABEL = mlabel.o buf_read.o buf_write.o devices.o dir_read.o \ ! dir_write.o expand.o fat_read.o init.o ! MMD = mmd.o buf_read.o buf_write.o devices.o dir_make.o dir_read.o \ ! dir_write.o expand.o fat_read.o fat_write.o init.o match.o parse.o \ ! subdir.o ! MRD = mrd.o buf_read.o buf_write.o devices.o dir_read.o dir_write.o \ ! expand.o fat_free.o fat_read.o fat_write.o init.o match.o parse.o \ ! subdir.o ! MREAD = mread.o buf_read.o devices.o dir_read.o expand.o fat_read.o \ ! file_read.o init.o match.o parse.o subdir.o ! MREN = mren.o buf_read.o buf_write.o devices.o dir_read.o dir_write.o \ ! expand.o fat_read.o init.o match.o parse.o subdir.o ! MTYPE = mtype.o buf_read.o devices.o dir_read.o expand.o fat_read.o \ ! file_read.o init.o match.o parse.o subdir.o ! MWRITE = mwrite.o buf_read.o buf_write.o devices.o dir_make.o \ ! dir_read.o dir_write.o expand.o fat_free.o fat_read.o fat_write.o \ ! file_write.o init.o is_dir.o match.o parse.o subdir.o ! MKMANIFEST = mkmanifest.o ! ! all: $(PROGS) ! ! mattrib: $(MATTRIB) ! $(LD) $(LDFLAGS) $(MATTRIB) $(SHOBJ) -o mattrib $(SHLIB) ! ! mcd: $(MCD) ! $(LD) $(LDFLAGS) $(MCD) $(SHOBJ) -o mcd $(SHLIB) ! ! mcopy: $(MCOPY) ! $(LD) $(LDFLAGS) $(MCOPY) $(SHOBJ) -o mcopy $(SHLIB) ! ! mdel: $(MDEL) ! $(LD) $(LDFLAGS) $(MDEL) $(SHOBJ) -o mdel $(SHLIB) ! ! mdir: $(MDIR) ! $(LD) $(LDFLAGS) $(MDIR) $(SHOBJ) -o mdir $(SHLIB) ! ! mformat: $(MFORMAT) ! $(LD) $(LDFLAGS) $(MFORMAT) $(SHOBJ) -o mformat $(SHLIB) ! ! mlabel: $(MLABEL) ! $(LD) $(LDFLAGS) $(MLABEL) $(SHOBJ) -o mlabel $(SHLIB) ! ! mmd: $(MMD) ! $(LD) $(LDFLAGS) $(MMD) $(SHOBJ) -o mmd $(SHLIB) ! ! mrd: $(MRD) ! $(LD) $(LDFLAGS) $(MRD) $(SHOBJ) -o mrd $(SHLIB) ! ! mread: $(MREAD) ! $(LD) $(LDFLAGS) $(MREAD) $(SHOBJ) -o mread $(SHLIB) ! ! mren: $(MREN) ! $(LD) $(LDFLAGS) $(MREN) $(SHOBJ) -o mren $(SHLIB) ! ! mtype: $(MTYPE) ! $(LD) $(LDFLAGS) $(MTYPE) $(SHOBJ) -o mtype $(SHLIB) ! ! mwrite: $(MWRITE) ! $(LD) $(LDFLAGS) $(MWRITE) $(SHOBJ) -o mwrite $(SHLIB) ! ! mkmanifest: $(MKMANIFEST) ! $(LD) $(LDFLAGS) $(MKMANIFEST) $(SHOBJ) -o mkmanifest $(SHLIB) ! ! install: all ! -mkdir $(BINDIR) ! for prog in $(PROGS); do install $$prog $(BINDIR)/$$prog; gln -sf ../mtools/$$prog ${DESTDIR}/usr/local/bin; done ! install -c -m 644 Mattrib.1 $(MANDIR)/mattrib.$(MANEXT) ! install -c -m 644 Mcd.1 $(MANDIR)/mcd.$(MANEXT) ! install -c -m 644 Mcopy.1 $(MANDIR)/mcopy.$(MANEXT) ! install -c -m 644 Mdel.1 $(MANDIR)/mdel.$(MANEXT) ! install -c -m 644 Mdir.1 $(MANDIR)/mdir.$(MANEXT) ! install -c -m 644 Mformat.1 $(MANDIR)/mformat.$(MANEXT) ! install -c -m 644 Mlabel.1 $(MANDIR)/mlabel.$(MANEXT) ! install -c -m 644 Mmd.1 $(MANDIR)/mmd.$(MANEXT) ! install -c -m 644 Mrd.1 $(MANDIR)/mrd.$(MANEXT) ! install -c -m 644 Mread.1 $(MANDIR)/mread.$(MANEXT) ! install -c -m 644 Mren.1 $(MANDIR)/mren.$(MANEXT) ! install -c -m 644 Mtools.1 $(MANDIR)/mtools.$(MANEXT) ! install -c -m 644 Mtype.1 $(MANDIR)/mtype.$(MANEXT) ! install -c -m 644 Mwrite.1 $(MANDIR)/mwrite.$(MANEXT) ! install -c -m 644 Mkmanifest.1 $(MANDIR)/mkmanifest.$(MANEXT) clean: ! rm $(PROGS) *.o core a.out tags TAGS ! lint: ! $(LINT) mattrib.c buf_read.c buf_write.c devices.c dir_read.c \ ! dir_write.c expand.c fat_read.c init.c match.c parse.c subdir.c ! $(LINT) mcd.c buf_read.c devices.c dir_read.c expand.c fat_read.c \ ! init.c is_dir.c match.c parse.c subdir.c ! $(LINT) mcopy.c ! $(LINT) mdel.c buf_read.c buf_write.c devices.c dir_read.c dir_write.c \ ! expand.c fat_free.c fat_read.c fat_write.c init.c match.c parse.c \ ! subdir.c ! $(LINT) mdir.c buf_read.c devices.c dir_read.c expand.c fat_read.c \ ! init.c is_dir.c match.c parse.c subdir.c ! $(LINT) mformat.c devices.c dir_write.c expand.c ! $(LINT) mlabel.c buf_read.c buf_write.c devices.c dir_read.c \ ! dir_write.c expand.c fat_read.c init.c ! $(LINT) mmd.c buf_read.c buf_write.c devices.c dir_make.c dir_read.c \ ! dir_write.c expand.c fat_read.c fat_write.c init.c match.c parse.c \ ! subdir.c ! $(LINT) mrd.c buf_read.c buf_write.c devices.c dir_read.c dir_write.c \ ! expand.c fat_free.c fat_read.c fat_write.c init.c match.c parse.c \ ! subdir.c ! $(LINT) mread.c buf_read.c devices.c dir_read.c expand.c fat_read.c \ ! file_read.c init.c match.c parse.c subdir.c ! $(LINT) mren.c buf_read.c buf_write.c devices.c dir_read.c dir_write.c \ ! expand.c fat_read.c init.c match.c parse.c subdir.c ! $(LINT) mtype.c buf_read.c devices.c dir_read.c expand.c fat_read.c \ ! file_read.c init.c match.c parse.c subdir.c ! $(LINT) mwrite.c buf_read.c buf_write.c devices.c dir_make.c \ ! dir_read.c dir_write.c expand.c fat_free.c fat_read.c fat_write.c \ ! file_write.c init.c is_dir.c match.c parse.c subdir.c ! $(LINT) mkmanifest.c ! ! shar: ! $(SHAR) Configure Makefile Mattrib.1 Mcd.1 Mcopy.1 Mdel.1 Mdir.1 \ ! Mformat.1 Mkmanifest.1 Mlabel.1 Mmd.1 Mrd.1 Mread.1 Mren.1 \ ! Mtools.1 Mtype.1 Mwrite.1 Readme Release.notes buf_read.c \ ! buf_write.c devices.c dir_make.c dir_read.c dir_write.c expand.c \ ! fat_free.c > mtools_sh.1 ! $(SHAR) fat_read.c fat_write.c file_read.c file_write.c init.c \ ! is_dir.c match.c mattrib.c mcd.c mcopy.c mdel.c mdir.c mformat.c \ ! mkmanifest.c mlabel.c mmd.c > mtools_sh.2 ! $(SHAR) mrd.c mread.c mren.c msdos.h mtype.c mwrite.c parse.c \ ! patchlevel.h subdir.c > mtools_sh.3 ! $(SHAR) Mattrib.out Mcd.out Mcopy.out Mdel.out Mdir.out Mformat.out \ ! Mkmanifest.out Mlabel.out Mmd.out Mrd.out Mread.out Mren.out \ ! Mtools.out Mtype.out Mwrite.out > mtools_sh.4 buf_read.o: msdos.h buf_write.o: msdos.h --- 14,95 ---- #CFLAGS = -O -M2e -DINT16 -DXENIX -DLOCKF #LDFLAGS = -s -M2e -i -f 5000 ! #for Linux (locking device files does not work reliably?) ! CFLAGS = -O2 -m486 -DLOADDEVS #-DFLOCK LDFLAGS = -s + LD = $(CC) LINT = lint SHLIB = SHAR = shar -a ! BINDIR = ${DEST}/usr/bin ! ETCDIR = ${DEST}/etc ! MAN1EXT = 1 ! MAN1DIR = ${DEST}/usr/man/man$(MAN1EXT) ! MAN5EXT = 5 ! MAN5DIR = ${DEST}/usr/man/man$(MAN5EXT) # # for AT&T Unix PC 7300/3b1 style shared libraries. #SHOBJ = /lib/crt0s.o /lib/shlib.ifile #LD = ld ! LINKS=mattrib mcd mcopy mdel mdir mformat mlabel mmd mrd mread mren mtype \ ! mwrite ! MTOOLS = mattrib.o mcd.o mcopy.o mdel.o mdir.o mformat.o mlabel.o mmd.o \ ! mrd.o mread.o mren.o mtype.o mwrite.o buf_read.o buf_write.o \ ! devices.o dir_make.o dir_read.o dir_write.o expand.o fat_free.o \ ! fat_read.o fat_write.o file_read.o file_write.o init.o is_dir.o \ ! match.o parse.o subdir.o mtools.o ! ! MKMAN1IFEST = mkmanifest.o ! ! all: mtools $(LINKS) ! ! mtools: $(MTOOLS) ! $(LD) $(LDFLAGS) $(MTOOLS) $(SHOBJ) -o mtools $(SHLIB) ! ! $(LINKS): mtools ! for name in $(LINKS); \ ! do rm -f $$name && ln mtools $$name; done ! mkmanifest: $(MKMAN1IFEST) ! $(LD) $(LDFLAGS) $(MKMAN1IFEST) $(SHOBJ) -o mkmanifest $(SHLIB) clean: ! -rm *.o 2>/dev/null ! ! spotless: clean ! -rm mtools $(LINKS) 2>/dev/null ! ! install: $(BINDIR)/mtools ${ETCDIR}/mtools install-man install-links ! $(BINDIR)/mtools: mtools ! cp mtools $(BINDIR)/mtools ! ! $(ETCDIR)/mtools: mtools.etc ! cp mtools.etc $(ETCDIR)/mtools ! ! install-links: $(BINDIR)/mtools ! cd $(BINDIR) && for name in $(LINKS); \ ! do rm -f $$name && ln mtools $$name; done ! ! install-man: ! install -c -m 644 mattrib.1 $(MAN1DIR)/mattrib.$(MAN1EXT) ! install -c -m 644 mcd.1 $(MAN1DIR)/mcd.$(MAN1EXT) ! install -c -m 644 mcopy.1 $(MAN1DIR)/mcopy.$(MAN1EXT) ! install -c -m 644 mdel.1 $(MAN1DIR)/mdel.$(MAN1EXT) ! install -c -m 644 mdir.1 $(MAN1DIR)/mdir.$(MAN1EXT) ! install -c -m 644 mformat.1 $(MAN1DIR)/mformat.$(MAN1EXT) ! install -c -m 644 mlabel.1 $(MAN1DIR)/mlabel.$(MAN1EXT) ! install -c -m 644 mmd.1 $(MAN1DIR)/mmd.$(MAN1EXT) ! install -c -m 644 mrd.1 $(MAN1DIR)/mrd.$(MAN1EXT) ! install -c -m 644 mread.1 $(MAN1DIR)/mread.$(MAN1EXT) ! install -c -m 644 mren.1 $(MAN1DIR)/mren.$(MAN1EXT) ! install -c -m 644 mtools.1 $(MAN1DIR)/mtools.$(MAN1EXT) ! install -c -m 644 mtools.5 $(MAN5DIR)/mtools.$(MAN5EXT) ! install -c -m 644 mtype.1 $(MAN1DIR)/mtype.$(MAN1EXT) ! install -c -m 644 mwrite.1 $(MAN1DIR)/mwrite.$(MAN1EXT) ! install -c -m 644 mkmanifest.1 $(MAN1DIR)/mkmanifest.$(MAN1EXT) buf_read.o: msdos.h buf_write.o: msdos.h *************** *** 186,203 **** file_write.o: msdos.h init.o: msdos.h is_dir.o: msdos.h ! mattrib.o: msdos.h patchlevel.h ! mcd.o: msdos.h patchlevel.h ! mcopy.o: patchlevel.h ! mdel.o: msdos.h patchlevel.h ! mdir.o: msdos.h patchlevel.h ! mformat.o: msdos.h patchlevel.h ! mlabel.o: msdos.h patchlevel.h ! mmd.o: msdos.h patchlevel.h ! mrd.o: msdos.h patchlevel.h ! mread.o: msdos.h patchlevel.h ! mren.o: msdos.h patchlevel.h ! mtype.o: msdos.h patchlevel.h ! mwrite.o: msdos.h patchlevel.h parse.o: msdos.h subdir.o: msdos.h --- 104,125 ---- file_write.o: msdos.h init.o: msdos.h is_dir.o: msdos.h ! ! mattrib.o: msdos.h mattrib.c ! mcd.o: msdos.h mcd.c ! mcopy.o: msdos.h mcopy.c ! mdel.o: msdos.h mdel.c ! mdir.o: msdos.h mdir.c ! mformat.o: msdos.h mformat.c ! mlabel.o: msdos.h mlabel.c ! mmd.o: msdos.h mmd.c ! mrd.o: msdos.h mrd.c ! mread.o: msdos.h mread.c ! mren.o: msdos.h mren.c ! mtype.o: msdos.h mtype.c ! mwrite.o: msdos.h mwrite.c ! parse.o: msdos.h subdir.o: msdos.h + + mtools.o: msdos.h patchlevel.h mtools.c Only in orig/mtools-2.0.7: Mattrib.1 Only in orig/mtools-2.0.7: Mcd.1 Only in orig/mtools-2.0.7: Mcopy.1 Only in orig/mtools-2.0.7: Mdel.1 Only in orig/mtools-2.0.7: Mdir.1 Only in orig/mtools-2.0.7: Mformat.1 Only in orig/mtools-2.0.7: Mkmanifest.1 Only in orig/mtools-2.0.7: Mlabel.1 Only in orig/mtools-2.0.7: Mmd.1 Only in orig/mtools-2.0.7: Mrd.1 Only in orig/mtools-2.0.7: Mread.1 Only in orig/mtools-2.0.7: Mren.1 Only in orig/mtools-2.0.7: Mtools.1 Only in orig/mtools-2.0.7: Mtype.1 Only in orig/mtools-2.0.7: Mwrite.1 diff -rc --new-file orig/mtools-2.0.7/Release.notes mtools-2.0.7/Release.notes *** orig/mtools-2.0.7/Release.notes Thu Sep 10 16:00:31 1992 --- mtools-2.0.7/Release.notes Sun Sep 26 19:24:06 1993 *************** *** 1,3 **** --- 1,12 ---- + Patch #7+, 19 sep 93 + + This patch merges in the mods against 2.05 under Linux. Two are the main + changes: that all commands are linked as a single executable, which can + be linked as different name, and that the device specs are no longer + hardcompiled but are read dynamically from /etc/mtools (the latter change + is conditional on LOADDEVS being defined). + + ----------------------------------------------------------------------------- Patch #7, 6 Sep 92 This patch will change the method of determining if the FAT encoding diff -rc --new-file orig/mtools-2.0.7/devices.c mtools-2.0.7/devices.c *** orig/mtools-2.0.7/devices.c Thu Sep 10 16:11:17 1992 --- mtools-2.0.7/devices.c Sun Oct 17 21:58:59 1993 *************** *** 3,50 **** */ #include #include "msdos.h" #ifdef DELL struct device devices[] = { ! {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9}, ! {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, ! {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8}, ! {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, ! {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9}, ! {'C', "/dev/rdsk/dos", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} }; #endif /* DELL */ #ifdef ISC struct device devices[] = { ! {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9}, ! {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, ! {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8}, ! {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, ! {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9}, ! {'C', "/dev/rdsk/0p1", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0}, ! {'D', "/usr/vpix/defaults/C:", 8704L, 12, 0, (int (*) ()) 0, 0, 0, 0}, ! {'E', "$HOME/vpix/C:", 8704L, 12, 0, (int (*) ()) 0, 0, 0, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} }; #endif /* ISC */ #ifdef SPARC struct device devices[] = { ! {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, ! {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9}, ! {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} }; #endif /* SPARC */ ! #ifdef RT_ACIS struct device devices[] = { ! {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, ! {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9}, ! {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} }; ! #endif /* RT_ACIS */ #ifdef UNIXPC --- 3,161 ---- */ #include + #include + #include + #include #include "msdos.h" + #ifdef LOADDEVS + + #define CFG_FILE "/etc/mtools" + + #define MAX_LINE PATH_MAX+40 + #define MAX_DEVICES 10 + + #ifdef __STDC__ + # define AUX(x) #x + # define STR(x) AUX(x) + #else + # define STR(x) "x" + #endif + + #define SET(f,t,h,s) \ + { devices[dev].fat_bits = (f); devices[dev].tracks = (t); \ + devices[dev].heads = (h); devices[dev].sectors = (s); } + + struct device devices[MAX_DEVICES+1]; + + void load_devices(void) + { + FILE *cfg; + char buffer[MAX_LINE+1],name[PATH_MAX+1]; + char *here,*start; + int items,dev,fat_bits; + + if ((cfg = fopen(CFG_FILE,"r")) == NULL) { + perror(CFG_FILE); + exit(1); + } + dev = 0; + while (fgets(buffer,MAX_LINE,cfg)) { + if (here = strchr(buffer,'#')) *here = 0; + else if (here = strchr(buffer,'\n')) *here = 0; + for (start = buffer; *start == ' ' || *start == '\t'; start++); + if (!*start) continue; + items = sscanf(start,"%c %" STR(PATH_MAX) "s %d %d %d %d", + &devices[dev].drive,name,&fat_bits,&devices[dev].tracks, + &devices[dev].heads,&devices[dev].sectors); + if (dev >= MAX_DEVICES) { + fprintf(stderr,"Too many devices\n"); + exit(1); + } + if (items == 6) devices[dev].fat_bits = fat_bits; + else { + if (items == 2 || items == 3) { + #ifdef oldLINUX + if (!strncmp("/dev/at",name,7)) { SET(12,80,2,15) } + else if (!strncmp("/dev/PS",name,7)) { SET(12,80,2,18) } + else if (!strncmp("/dev/ps",name,7)) { SET(12,80,2,9) } + else if (!strncmp("/dev/hd",name,7)) { SET(16,0,0,0) } + else + #endif + { + fprintf(stderr,"Unknown device %s, please specify all " + "parameters\n",name); + exit(1); + } + if (items == 3) devices[dev].fat_bits = fat_bits; + } + else { + fprintf(stderr,"Config file syntax: drive device [ fat [ " + "tracks heads sectors ] ]\n",items); + exit(1); + } + } + if (islower(devices[dev].drive)) + devices[dev].drive = toupper(devices[dev].drive); + devices[dev].offset = 0L; + devices[dev].mode = 0; + devices[dev].gioctl = NULL; + if ((devices[dev].name = (char *) malloc(strlen(name)+1)) == NULL) { + fprintf(stderr,"Out of memory\n"); + exit(1); + } + strcpy(devices[dev++].name,name); + } + memset(&devices[dev],0,sizeof(struct device)); + fclose(cfg); + } + + #else /* LOADDEVS */ + + #define INIT_NOOP ((int (*) ()) 0) + #ifdef DELL struct device devices[] = { ! {'B', "/dev/rdsk/f1q15dt", 0L, 12, 0, INIT_NOOP, 80, 2, 15}, ! {'B', "/dev/rdsk/f1d9dt", 0L, 12, 0, INIT_NOOP, 40, 2, 9}, ! {'B', "/dev/rdsk/f1d8dt", 0L, 12, 0, INIT_NOOP, 40, 2, 8}, ! {'A', "/dev/rdsk/f03ht", 0L, 12, 0, INIT_NOOP, 80, 2, 18}, ! {'A', "/dev/rdsk/f03dt", 0L, 12, 0, INIT_NOOP, 80, 2, 9}, ! {'C', "/dev/rdsk/dos", 0L, 16, 0, INIT_NOOP, 0, 0, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} }; #endif /* DELL */ #ifdef ISC struct device devices[] = { ! {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, INIT_NOOP, 40, 2, 9}, ! {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, INIT_NOOP, 80, 2, 15}, ! {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, INIT_NOOP, 40, 2, 8}, ! {'B', "/dev/rdsk/f13ht", 0L, 12, 0, INIT_NOOP, 80, 2, 18}, ! {'B', "/dev/rdsk/f13dt", 0L, 12, 0, INIT_NOOP, 80, 2, 9}, ! {'C', "/dev/rdsk/0p1", 0L, 16, 0, INIT_NOOP, 0, 0, 0}, ! {'D', "/usr/vpix/defaults/C:", 8704L, 12, 0, INIT_NOOP, 0, 0, 0}, ! {'E', "$HOME/vpix/C:", 8704L, 12, 0, INIT_NOOP, 0, 0, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} }; #endif /* ISC */ + #ifdef RT_ACIS + struct device devices[] = { + {'A', "/dev/rfd0", 0L, 12, 0, INIT_NOOP, 80, 2, 15}, + {'A', "/dev/rfd0", 0L, 12, 0, INIT_NOOP, 40, 2, 9}, + {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} + }; + #endif /* RT_ACIS */ + #ifdef SPARC struct device devices[] = { ! {'A', "/dev/rfd0c", 0L, 12, 0, INIT_NOOP, 80, 2, 18}, ! {'A', "/dev/rfd0c", 0L, 12, 0, INIT_NOOP, 80, 2, 9}, ! {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} }; #endif /* SPARC */ ! ! #ifdef SUN386 struct device devices[] = { ! {'A', "/dev/rfdl0c", 0L, 12, 0, INIT_NOOP, 80, 2, 9}, ! {'A', "/dev/rfd0c", 0L, 12, 0, INIT_NOOP, 80, 2, 18}, ! {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} }; ! #endif /* SUN386 */ ! ! #ifdef XENIX ! struct device devices[] = { ! {'A', "/dev/fd096ds15", 0L, 12, 0, INIT_NOOP, 80, 2, 15}, ! {'A', "/dev/fd048ds9", 0L, 12, 0, INIT_NOOP, 40, 2, 9}, ! {'B', "/dev/fd1135ds18", 0L, 12, 0, INIT_NOOP, 80, 2, 18}, ! {'B', "/dev/fd1135ds9", 0L, 12, 0, INIT_NOOP, 80, 2, 9}, ! {'C', "/dev/hd0d", 0L, 16, 0, INIT_NOOP, 0, 0, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} ! }; ! #endif /* XENIX */ ! ! #endif /* LOADDEVS */ #ifdef UNIXPC *************** *** 55,62 **** struct device devices[] = { {'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9}, ! {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, (int (*) ()) 0, 0, 0, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} }; int --- 166,173 ---- struct device devices[] = { {'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9}, ! {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, INIT_NOOP, 0, 0, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} }; int *************** *** 86,108 **** return(0); } #endif /* UNIXPC */ - - #ifdef RT_ACIS - struct device devices[] = { - {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, - {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9}, - {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} - }; - #endif /* RT_ACIS */ - - #ifdef SUN386 - struct device devices[] = { - {'A', "/dev/rfdl0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9}, - {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, - {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} - }; - #endif /* SUN386 */ - #ifdef SPARC_ODD #include --- 197,202 ---- *************** *** 113,119 **** struct device devices[] = { {'A', "/dev/rfd0c", 0L, 12, 0, init_sparc, 80, 2, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} }; /* --- 207,213 ---- struct device devices[] = { {'A', "/dev/rfd0c", 0L, 12, 0, init_sparc, 80, 2, 0}, ! {'\0', (char *) NULL, 0L, 0, 0, INIT_NOOP, 0, 0, 0} }; /* *************** *** 162,175 **** return(0); } #endif /* SPARC_ODD */ - - #ifdef XENIX - struct device devices[] = { - {'A', "/dev/fd096ds15", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15}, - {'A', "/dev/fd048ds9", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9}, - {'B', "/dev/fd1135ds18", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, - {'B', "/dev/fd1135ds9", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9}, - {'C', "/dev/hd0d", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0}, - {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0} - }; - #endif /* XENIX */ --- 256,258 ---- diff -rc --new-file orig/mtools-2.0.7/init.c mtools-2.0.7/init.c *** orig/mtools-2.0.7/init.c Thu Sep 10 15:59:47 1992 --- mtools-2.0.7/init.c Sun Sep 26 19:24:09 1993 *************** *** 26,31 **** --- 26,32 ---- extern unsigned char *fat_buf, *disk_buf, *dir_buf; extern struct device devices[]; static struct bootsector *read_boot(); + static int lock_dev(); int init(drive, mode) *************** *** 214,219 **** --- 215,227 ---- #else /* FULL_CYL */ disk_size = (dev->tracks) ? sectors : 1; #endif /* FULL_CYL */ + + #ifdef DELL201 + /* + * The driver in Dell's SVR4 v2.01 is unreliable with large writes. + */ + disk_size = 1; + #endif /* DELL201 */ disk_buf = (unsigned char *) malloc((unsigned int) disk_size * MSECTOR_SIZE); if (disk_buf == NULL) { *************** *** 225,230 **** --- 233,245 ---- disk_dirty = 0; fat_error = 0; fat_bits = dev->fat_bits; + if (fat_bits < 0) fat_bits = -fat_bits; + else if (fat_bits == 12 && num_clus > FAT12 || fat_bits == 16 && + num_clus <= FAT12 || (fat_bits != 12 && fat_bits != 16)) { + fprintf(stderr,"%d bit FAT on %c: sure ? (Use -%d in \ + the device config file to bypass.)\n",fat_bits,drive,fat_bits); + exit(1); + } fat_read(fat_start); /* set dir_chain[] to root directory */ dir_dirty = 0; diff -rc --new-file orig/mtools-2.0.7/mattrib.1 mtools-2.0.7/mattrib.1 *** orig/mtools-2.0.7/mattrib.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mattrib.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,59 ---- + .TH MATTRIB 1 local + .SH NAME + mattrib \- change MSDOS file attribute flags + .SH SYNOPSIS + .B mattrib + [ + .B -a|+a + ] + [ + .B -h|+h + ] + [ + .B -r|+r + ] + [ + .B -s|+s + ] msdosfile [ msdosfiles... ] + .SH DESCRIPTION + .I Mattrib + will add attribute flags to an MSDOS file (with the '+' operator) or + remove attribute flags (with the '-' operator). + .PP + .I Mattrib + will allow the following command line options: + .TP + .B a + Archive bit. Used by some backup programs to indicate a new file. + .TP + .B r + Read-only bit. Used to indicate a read-only file. Files with this bit + set cannot be erased by DEL. However, + .I + mdel + is more cunning. + .TP + .B s + System bit. Used by MSDOS to indicate a operating system file. + .TP + .B h + Hidden bit. Used to make files hidden from DIR. However, + .I + mdir + is more cunning. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mattrib + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1) + .SH BUGS + Most MSDOS versions of ATTRIB don't allow this many options. diff -rc --new-file orig/mtools-2.0.7/mattrib.c mtools-2.0.7/mattrib.c *** orig/mtools-2.0.7/mattrib.c Thu Sep 10 15:59:47 1992 --- mtools-2.0.7/mattrib.c Sun Oct 17 22:13:01 1993 *************** *** 10,30 **** #include #include "msdos.h" - #include "patchlevel.h" - int fd = -1; /* the file descriptor for the device */ - int dir_start; /* starting sector for directory */ - int dir_len; /* length of directory (in sectors) */ - int dir_entries; /* number of directory entries */ - int clus_size; /* cluster size (in sectors) */ - char *mcwd; /* the Current Working Directory */ - int fat_error; /* FAT error detected? */ - #define ADD 1 #define REMOVE (-1) #define LEAVE 0 ! main(argc, argv) int argc; char *argv[]; { --- 10,21 ---- #include #include "msdos.h" #define ADD 1 #define REMOVE (-1) #define LEAVE 0 ! mattrib(argc, argv) int argc; char *argv[]; { *************** *** 84,90 **** break; } if (argc < 3 || argv[fargn][0] == '\0' || oops) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-a|+a] [-h|+h] [-r|+r] [-s|+s] msdosfile [msdosfiles...]\n", argv[0]); exit(1); } --- 75,81 ---- break; } if (argc < 3 || argv[fargn][0] == '\0' || oops) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-a|+a] [-h|+h] [-r|+r] [-s|+s] msdosfile [msdosfiles...]\n", argv[0]); exit(1); } diff -rc --new-file orig/mtools-2.0.7/mcd.1 mtools-2.0.7/mcd.1 *** orig/mtools-2.0.7/mcd.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mcd.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,33 ---- + .TH MCD 1 local + .SH NAME + mcd \- change MSDOS directory + .SH SYNOPSIS + .B mcd + [ msdosdirectory ] + .SH DESCRIPTION + Without arguments, + .I mcd + will report the current device and working directory. Otherwise, + .I mcd + changes the current device and current working directory relative to an + MSDOS filesystem. + .PP + The environmental variable MCWD may be used to locate the file where the + device and current working directory information is stored. The default + is '$HOME/.mcwd'. Information in this file is ignored if the file is + more than 6 hours old. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + directory name to be enclosed in quotes to protect it from the shell. + .PP + .I Mcd + returns 0 on success or 1 on failure. + .SH SEE ALSO + mdir(1) + .SH BUGS + Unlike MSDOS versions of CD, + .I mcd + can be used to change to another device. + .PP + It may be wise to remove old .mcwd files at logout. diff -rc --new-file orig/mtools-2.0.7/mcd.c mtools-2.0.7/mcd.c *** orig/mtools-2.0.7/mcd.c Thu Sep 10 15:59:15 1992 --- mtools-2.0.7/mcd.c Sun Oct 17 22:13:27 1993 *************** *** 10,26 **** #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ ! ! main(argc, argv) int argc; char *argv[]; { --- 10,17 ---- #include #include "msdos.h" ! mcd(argc, argv) int argc; char *argv[]; { *************** *** 31,37 **** void exit(); if (argc > 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s: msdosdirectory\n", argv[0]); exit(1); } --- 22,28 ---- void exit(); if (argc > 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s: msdosdirectory\n", argv[0]); exit(1); } *************** *** 90,115 **** fprintf(fp, "%c:%s\n", drive, newpath); fclose(fp); exit(0); - } - - /* - * stubs for read-only programs - */ - - void - disk_flush() - { - extern int disk_dirty; - - disk_dirty = 0; - return; - } - - void - dir_flush() - { - extern int dir_dirty; - - dir_dirty = 0; - return; } --- 81,84 ---- diff -rc --new-file orig/mtools-2.0.7/mcopy.1 mtools-2.0.7/mcopy.1 *** orig/mtools-2.0.7/mcopy.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mcopy.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,74 ---- + .TH MCOPY 1 local + .SH NAME + mcopy \- copy MSDOS files to/from Unix + .SH SYNOPSIS + .B mcopy + [ + .B -tnvm + ] sourcefile targetfile + .PP + .B mcopy + [ + .B -tnvm + ] sourcefile [ sourcefiles... ] targetdirectory + .SH DESCRIPTION + .I Mcopy + copies the specified file to the named file, or copies multiple files to + the named directory. The source and target can be either MSDOS or Unix + files. + .PP + The use of a drive letter designation on the MSDOS files, 'a:' for + example, determines the direction of the transfer. A missing drive + designation implies a Unix file whose path starts in the current + directory + .PP + .I Mcopy + will allow the following command line options: + .TP + .B t + Text file transfer. + .I Mcopy + will translate incoming carriage return/line feeds to line feeds. + .TP + .B n + No warning. + .I Mcopy + will not warn the user when overwriting an existing file. + .TP + .B v + Verbose mode. + .TP + .B m + Preserve the file modification time. + .PP + If the target file already exists, and the + .I -n + option is not in effect, + .I mcopy + asks whether or not to overwrite the file. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mcopy + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1), mread(1), mwrite(1) + .SH BUGS + Unlike MSDOS, the destination directory may + .B not + be omitted. + .PP + The '+' operator (append) from MSDOS is not supported. + .PP + No other + .I Mtools + command + .B requires + the use of a drive letter designation on MSDOS files. diff -rc --new-file orig/mtools-2.0.7/mcopy.c mtools-2.0.7/mcopy.c *** orig/mtools-2.0.7/mcopy.c Thu Sep 10 15:59:47 1992 --- mtools-2.0.7/mcopy.c Sun Oct 17 22:18:13 1993 *************** *** 12,18 **** #include #include #include ! #include "patchlevel.h" #define NONE 0 #define MREAD 1 --- 12,18 ---- #include #include #include ! #include "msdos.h" #define NONE 0 #define MREAD 1 *************** *** 23,29 **** #define WEXITSTATUS(x) (((x)>>8)&0xff) #endif /* WEXITSTATUS */ ! main(argc, argv) int argc; char *argv[]; { --- 23,29 ---- #define WEXITSTATUS(x) (((x)>>8)&0xff) #endif /* WEXITSTATUS */ ! mcopy(argc, argv) int argc; char *argv[]; { *************** *** 50,56 **** } if (oops || (argc - optind) < 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-tnvm] sourcefile targetfile\n", argv[0]); fprintf(stderr, " %s [-tnvm] sourcefile [sourcefiles...] targetdirectory\n", argv[0]); exit(1); --- 50,56 ---- } if (oops || (argc - optind) < 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-tnvm] sourcefile targetfile\n", argv[0]); fprintf(stderr, " %s [-tnvm] sourcefile [sourcefiles...] targetdirectory\n", argv[0]); exit(1); *************** *** 82,88 **** * with a null when it passes it to main() */ nargv = (char **) malloc((unsigned int) (argc + 1) * sizeof(*argv)); ! nargv[0] = "mcopy"; for (i = 1; i < argc; i++) nargv[i] = argv[i]; nargv[argc] = NULL; --- 82,88 ---- * with a null when it passes it to main() */ nargv = (char **) malloc((unsigned int) (argc + 1) * sizeof(*argv)); ! nargv[0] = destination == MWRITE ? "mwrite" : "mread"; for (i = 1; i < argc; i++) nargv[i] = argv[i]; nargv[argc] = NULL; diff -rc --new-file orig/mtools-2.0.7/mdel.1 mtools-2.0.7/mdel.1 *** orig/mtools-2.0.7/mdel.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mdel.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,36 ---- + .TH MDEL 1 local + .SH NAME + mdel \- delete an MSDOS file + .SH SYNOPSIS + .B mdel + [ + .B -v + ] msdosfile [ msdosfiles... ] + .SH DESCRIPTION + .I Mdel + deletes a file on an MSDOS filesystem. + .PP + .I Mdel + will allow the following command line option: + .TP + .B v + Verbose mode. Echo the filenames as they are processed. + .PP + .I Mdel + will ask for verification prior to removing a read\-only file. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mdel + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1) + .SH BUGS + Allows multiple arguments, which does not follow the MSDOS convention. diff -rc --new-file orig/mtools-2.0.7/mdel.c mtools-2.0.7/mdel.c *** orig/mtools-2.0.7/mdel.c Thu Sep 10 15:59:47 1992 --- mtools-2.0.7/mdel.c Sun Oct 17 22:14:00 1993 *************** *** 11,29 **** #include #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ ! static int got_signal(); ! ! main(argc, argv) int argc; char *argv[]; { --- 11,20 ---- #include #include #include "msdos.h" ! extern int got_signal(); ! mdel(argc, argv) int argc; char *argv[]; { *************** *** 50,56 **** fargn = 1; } if (argc < 2 || (argv[1][0] == '-' && !verbose)) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-v] msdosfile [msdosfiles...]\n", argv[0]); exit(1); } --- 41,47 ---- fargn = 1; } if (argc < 2 || (argv[1][0] == '-' && !verbose)) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-v] msdosfile [msdosfiles...]\n", argv[0]); exit(1); } *************** *** 103,108 **** --- 94,100 ---- if (dir->attr & 0x01) { while (!nogo) { printf("%s: \"%s\" is read only, erase anyway (y/n) ? ", argv[0], newfile); + fflush(stdout); gets(ans); if (ans[0] == 'y' || ans[0] == 'Y') break; *************** *** 140,163 **** if (missed_one) exit(1); exit(0); - } - - /* - * Do a graceful exit if the program is interrupted. This will reduce - * (but not eliminate) the risk of generating a corrupted disk on - * a user abort. - */ - - static int - got_signal() - { - void exit(), disk_flush(), fat_write(), dir_flush(); - - if (fd < 0) - exit(1); - fat_write(); - dir_flush(); - disk_flush(); - close(fd); - exit(1); } --- 132,135 ---- diff -rc --new-file orig/mtools-2.0.7/mdir.1 mtools-2.0.7/mdir.1 *** orig/mtools-2.0.7/mdir.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mdir.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,43 ---- + .TH MDIR 1 local + .SH NAME + mdir \- display an MSDOS directory + .SH SYNOPSIS + .B mdir + [ + .B -w + ] msdosdirectory + .PP + .B mdir + [ + .B -w + ] msdosfile [ msdosfiles... ] + .SH DESCRIPTION + .I Mdir + displays the contents of an MSDOS directory. + .PP + .I Mdir + will allow the following command line option: + .TP + .B w + Wide output. This option will print the filenames across the page + without displaying the file size or creation date. + .PP + An error occurs if a component of the path is not a directory. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mdir + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1) + .SH BUGS + Allows multiple arguments, which does not follow the MSDOS convention. + .PP + There is no /P (pause) option. diff -rc --new-file orig/mtools-2.0.7/mdir.c mtools-2.0.7/mdir.c *** orig/mtools-2.0.7/mdir.c Thu Sep 10 15:59:17 1992 --- mtools-2.0.7/mdir.c Sun Oct 17 22:14:34 1993 *************** *** 10,29 **** #include #include "msdos.h" - #include "patchlevel.h" - int fd = -1; /* the file descriptor for the device */ - int dir_start; /* starting sector for directory */ - int dir_len; /* length of directory (in sectors) */ - int dir_entries; /* number of directory entries */ - int clus_size; /* cluster size (in sectors) */ - char *mcwd; /* the Current Working Directory */ - int fat_error; /* FAT error detected? */ - static long getfree(); static char *conv_date(), *conv_time(); ! main(argc, argv) int argc; char *argv[]; { --- 10,20 ---- #include #include "msdos.h" static long getfree(); static char *conv_date(), *conv_time(); ! mdir(argc, argv) int argc; char *argv[]; { *************** *** 47,53 **** } if (argv[1][0] == '-' && !wide) { fprintf(stderr, "%s: illegal option -- %c\n", argv[0], argv[1][1]); ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s: [-w] msdosdirectory\n", argv[0]); fprintf(stderr, " %s: [-w] msdosfile [msdosfiles...]\n", argv[0]); exit(1); --- 38,44 ---- } if (argv[1][0] == '-' && !wide) { fprintf(stderr, "%s: illegal option -- %c\n", argv[0], argv[1][1]); ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s: [-w] msdosdirectory\n", argv[0]); fprintf(stderr, " %s: [-w] msdosfile [msdosfiles...]\n", argv[0]); exit(1); *************** *** 279,304 **** min_low = time_low >> 5; sprintf(ans, "%2d:%02d%c", hour, min_hi + min_low, am_pm); return(ans); - } - - /* - * stubs for read-only programs - */ - - void - disk_flush() - { - extern int disk_dirty; - - disk_dirty = 0; - return; - } - - void - dir_flush() - { - extern int dir_dirty; - - dir_dirty = 0; - return; } --- 270,273 ---- diff -rc --new-file orig/mtools-2.0.7/mformat.1 mtools-2.0.7/mformat.1 *** orig/mtools-2.0.7/mformat.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mformat.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,45 ---- + .TH MFORMAT 1 local + .SH NAME + mformat \- add an MSDOS filesystem to a low-level formatted diskette. + .SH SYNOPSIS + .B mformat + [ + .B -t + tracks ] [ + .B -h + heads ] [ + .B -s + sectors ] [ + .B -l + volume label ] drive: + .SH DESCRIPTION + .I Mformat + adds a minimal MSDOS filesystem (boot sector, FAT, and root directory) to + a diskette that has already been formatted by a Unix low-level format. + .PP + The follow options are supported: + .TP + .B t + The number of tracks (not cylinders). + .TP + .B h + The number of heads (sides). + .TP + .B s + The number of sectors per track. + .TP + .B l + An optional volume label. + .PP + To format a diskette at a density other than the default, you must supply + (at least) those command line parameters that are different from the + default. + .PP + .I Mformat + returns 0 on success or 1 on failure. + .SH SEE ALSO + mlabel(1) + .SH BUGS + Requires a low-level format utility from Unix. + .PP + Doesn't detect (or record) bad block information. diff -rc --new-file orig/mtools-2.0.7/mformat.c mtools-2.0.7/mformat.c *** orig/mtools-2.0.7/mformat.c Thu Sep 10 15:59:16 1992 --- mtools-2.0.7/mformat.c Sun Oct 17 22:14:51 1993 *************** *** 11,23 **** #include #include #include "msdos.h" - #include "patchlevel.h" ! int fd, dir_dirty, dir_entries; ! long dir_chain[MAX_DIR_SECS]; ! unsigned char *dir_buf; ! ! main(argc, argv) int argc; char *argv[]; { --- 11,18 ---- #include #include #include "msdos.h" ! mformat(argc, argv) int argc; char *argv[]; { *************** *** 62,68 **** } if (oops || (argc - optind) != 1) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-t tracks] [-h heads] [-s sectors] [-l label] device\n", argv[0]); exit(1); } --- 57,63 ---- } if (oops || (argc - optind) != 1) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-t tracks] [-h heads] [-s sectors] [-l label] device\n", argv[0]); exit(1); } *************** *** 243,248 **** close(fd); exit(0); } - - /* hooks for the missing parts */ - void disk_write() {} --- 238,240 ---- diff -rc --new-file orig/mtools-2.0.7/mkmanifest.1 mtools-2.0.7/mkmanifest.1 *** orig/mtools-2.0.7/mkmanifest.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mkmanifest.1 Thu Sep 10 15:59:09 1992 *************** *** 0 **** --- 1,74 ---- + .TH MKMANIFEST 1 local + .SH NAME + mkmanifest \- create a shell script to restore Unix filenames + .SH SYNOPSIS + .B mkmanifest + [ files ] + .SH DESCRIPTION + .I Mkmanifest + creates a shell script that will aid in the restoration of Unix filenames + that got clobbered by the MSDOS filename restrictions. MSDOS filenames + are restricted to 8 character names, 3 character extensions, upper case + only, no device names, and no illegal characters. + .PP + The mkmanifest program is compatible with the methods used in + .I pcomm, arc, + and + .I mtools + to change perfectly good Unix filenames to fit the MSDOS restrictions. + .SH EXAMPLE + I want to copy the following Unix files to a MSDOS diskette (using the + .I mcopy + command). + .PP + .in +0.5i + .nf + very_long_name + 2.many.dots + illegal: + good.c + prn.dev + Capital + .fi + .in + .PP + .I Mcopy + will convert the names to: + .PP + .in +0.5i + .nf + very_lon + 2xmany.dot + illegalx + good.c + xprn.dev + capital + .fi + .in + .PP + The command: + .PP + mkmanifest very_long_name 2.many.dots illegal: good.c prn.dev Capital > + manifest + .PP + would produce the following: + .PP + .in +0.5i + .nf + mv very_lon very_long_name + mv 2xmany.dot 2.many.dots + mv illegalx illegal: + mv xprn.dev prn.dev + mv capital Capital + .fi + .in + .PP + Notice that "good.c" did not require any conversion, so it did not appear + in the output. + .PP + Suppose I've copied these files from the diskette to another Unix + system, and I now want the files back to their original names. If the + file "manifest" (the output captured above) was sent along with those + files, it could be used to convert the filenames. + .SH SEE ALSO + arc(1), pcomm(1), mtools(1) diff -rc --new-file orig/mtools-2.0.7/mlabel.1 mtools-2.0.7/mlabel.1 *** orig/mtools-2.0.7/mlabel.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mlabel.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,31 ---- + .TH MLABEL 1 local + .SH NAME + mlabel \- make an MSDOS volume label + .SH SYNOPSIS + .B mlabel + [ + .B -v + ] drive: + .SH DESCRIPTION + .I Mlabel + displays the current volume label, if present, and prompts the user + for a new volume label. To delete an existing volume label, press + return at the prompt. + .PP + .I Mlabel + will allow the following command line option: + .TP + .B v + Verbose mode. Display the new volume label if the label supplied is + invalid. + .PP + Reasonable care is taken to create a valid MSDOS volume label. If an + invalid label is specified, + .I mlabel + will change the label (and display the new label if the verbose mode is + set). + .PP + .I Mlabel + returns 0 on success or 1 on failure. + .SH SEE ALSO + mformat(1) diff -rc --new-file orig/mtools-2.0.7/mlabel.c mtools-2.0.7/mlabel.c *** orig/mtools-2.0.7/mlabel.c Thu Sep 10 15:59:16 1992 --- mtools-2.0.7/mlabel.c Sun Oct 17 22:15:17 1993 *************** *** 11,27 **** #include #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ ! ! main(argc, argv) int argc; char *argv[]; { --- 11,18 ---- #include #include #include "msdos.h" ! mlabel(argc, argv) int argc; char *argv[]; { *************** *** 45,51 **** oops++; } if (argc < 2 || argv[fargn][1] != ':' || oops) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-v] drive:\n", argv[0]); exit(1); } --- 36,42 ---- oops++; } if (argc < 2 || argv[fargn][1] != ':' || oops) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-v] drive:\n", argv[0]); exit(1); } *************** *** 98,103 **** --- 89,95 ---- /* ask for new label */ printf("Enter the new volume label (11 characters): "); + fflush(stdout); gets(filename); if (filename[0] != '\0') { sprintf((char *) fixed, "%-11.11s", filename); *************** *** 109,114 **** --- 101,107 ---- exit(0); printf("Delete volume label (y/n): "); + fflush(stdout); gets(ans); if (ans[0] == 'y' || ans[0] == 'Y') { strcpy((char *) fixed, (char *) vol); diff -rc --new-file orig/mtools-2.0.7/mmd.1 mtools-2.0.7/mmd.1 *** orig/mtools-2.0.7/mmd.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mmd.1 Thu Sep 10 15:59:46 1992 *************** *** 0 **** --- 1,42 ---- + .TH MMD 1 local + .SH NAME + mmd \- make an MSDOS subdirectory + .SH SYNOPSIS + .B mmd + [ + .B -v + ] msdosdirectory [ msdosdirectories... ] + .SH DESCRIPTION + .I Mmd + makes a new directory on an MSDOS filesystem. + .PP + .I Mmd + will allow the following command line option: + .TP + .B v + Verbose mode. Display the new directory name if the name supplied is + invalid. + .PP + Reasonable care is taken to create a valid MSDOS directory name. If an + invalid name is specified, + .I mmd + will change the name (and display the new name if the verbose mode is + set). + .PP + An error occurs if the directory already exists. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + directory name to be enclosed in quotes to protect it from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mmd + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1), mrd(1) + .SH BUGS + Allows multiple arguments, which does not follow the MSDOS convention. diff -rc --new-file orig/mtools-2.0.7/mmd.c mtools-2.0.7/mmd.c *** orig/mtools-2.0.7/mmd.c Thu Sep 10 15:59:48 1992 --- mtools-2.0.7/mmd.c Sun Oct 17 22:15:30 1993 *************** *** 11,30 **** #include #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ - static int got_signal(); static void empty_dir(); ! main(argc, argv) int argc; char *argv[]; { --- 11,22 ---- #include #include #include "msdos.h" ! extern int got_signal(); static void empty_dir(); ! mmd(argc, argv) int argc; char *argv[]; { *************** *** 56,62 **** oops++; } if (argc == 1 || oops) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-v] msdosdirectory [msdosdirectories...]\n", argv[0]); exit(1); } --- 48,54 ---- oops++; } if (argc == 1 || oops) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-v] msdosdirectory [msdosdirectories...]\n", argv[0]); exit(1); } *************** *** 201,224 **** /* write the cluster */ disk_write(start, (unsigned char *) buf, buflen); return; - } - - /* - * Do a graceful exit if the program is interrupted. This will reduce - * (but not eliminate) the risk of generating a corrupted disk on - * a user abort. - */ - - static int - got_signal() - { - void exit(), disk_flush(), fat_write(), dir_flush(); - - if (fd < 0) - exit(1); - fat_write(); - dir_flush(); - disk_flush(); - close(fd); - exit(1); } --- 193,196 ---- diff -rc --new-file orig/mtools-2.0.7/mrd.1 mtools-2.0.7/mrd.1 *** orig/mtools-2.0.7/mrd.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mrd.1 Thu Sep 10 15:59:47 1992 *************** *** 0 **** --- 1,27 ---- + .TH MRD 1 local + .SH NAME + mrd \- remove an MSDOS subdirectory + .SH SYNOPSIS + .B mrd + msdosdirectory [ msdosdirectories... ] + .SH DESCRIPTION + .I Mrd + removes a directory from an MSDOS filesystem. + .PP + An error occurs if the directory is not empty. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + directory name to be enclosed in quotes to protect it from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mrd + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1), mmd(1) + .SH BUGS + Allows multiple arguments, which does not follow the MSDOS convention. diff -rc --new-file orig/mtools-2.0.7/mrd.c mtools-2.0.7/mrd.c *** orig/mtools-2.0.7/mrd.c Thu Sep 10 15:59:48 1992 --- mtools-2.0.7/mrd.c Sun Oct 17 22:15:43 1993 *************** *** 11,29 **** #include #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ ! static int got_signal(), is_empty(); ! main(argc, argv) int argc; char *argv[]; { --- 11,22 ---- #include #include #include "msdos.h" ! extern int got_signal(); ! static int is_empty(); ! mrd(argc, argv) int argc; char *argv[]; { *************** *** 39,45 **** signal(SIGQUIT, (SIG_TYPE(*) ()) got_signal); if (argc == 1) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s mdsosdirectory [msdosdirectories...]\n", argv[0]); exit(1); } --- 32,38 ---- signal(SIGQUIT, (SIG_TYPE(*) ()) got_signal); if (argc == 1) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s mdsosdirectory [msdosdirectories...]\n", argv[0]); exit(1); } *************** *** 178,201 **** fat = next; } return(1); - } - - /* - * Do a graceful exit if the program is interrupted. This will reduce - * (but not eliminate) the risk of generating a corrupted disk on - * a user abort. - */ - - static int - got_signal() - { - void exit(), disk_flush(), fat_write(), dir_flush(); - - if (fd < 0) - exit(1); - fat_write(); - dir_flush(); - disk_flush(); - close(fd); - exit(1); } --- 171,174 ---- diff -rc --new-file orig/mtools-2.0.7/mread.1 mtools-2.0.7/mread.1 *** orig/mtools-2.0.7/mread.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mread.1 Thu Sep 10 15:59:47 1992 *************** *** 0 **** --- 1,58 ---- + .TH MREAD 1 local + .SH NAME + mread \- low level read (copy) an MSDOS file to Unix + .SH SYNOPSIS + .B mread + [ + .B -tnm + ] msdosfile unixfile + .PP + .B mread + [ + .B -tnm + ] msdosfile [ msdosfiles... ] unixdirectory + .SH DESCRIPTION + In the first form, + .I mread + copies the specified MSDOS file to the named Unix file. The second form + of the command copies multiple MSDOS files to the named Unix directory. + .PP + .I Mread + will allow the following command line options: + .TP + .B t + Text file transfer. + .I Mread + will translate incoming carriage return/line feeds to line feeds. + .TP + .B n + No warning. + .I Mread + will not warn the user when overwriting an existing file. + .TP + .B m + Preserve the file modification times. + .PP + If the target file already exists, and the + .I -n + option is not in effect, + .I mread + asks whether or not to overwrite the file. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mread + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1), mcopy(1), mtype(1), mwrite(1) + .SH BUGS + Unlike MSDOS, the destination directory may + .B not + be omitted. diff -rc --new-file orig/mtools-2.0.7/mread.c mtools-2.0.7/mread.c *** orig/mtools-2.0.7/mread.c Thu Sep 10 15:59:48 1992 --- mtools-2.0.7/mread.c Sun Oct 17 22:15:59 1993 *************** *** 20,40 **** #include #endif /* BSD */ #include "msdos.h" - #include "patchlevel.h" - int fd = -1; /* the file descriptor for the device */ - int dir_start; /* starting sector for directory */ - int dir_len; /* length of directory (in sectors) */ - int dir_entries; /* number of directory entries */ - int clus_size; /* cluster size (in sectors) */ - char *mcwd; /* the Current Working Directory */ - int fat_error; /* FAT error detected? */ - static void set_mtime(); static FILE *open_file(); static long conv_stamp(); ! main(argc, argv) int argc; char *argv[]; { --- 20,31 ---- #include #endif /* BSD */ #include "msdos.h" static void set_mtime(); static FILE *open_file(); static long conv_stamp(); ! mread(argc, argv) int argc; char *argv[]; { *************** *** 79,85 **** } if (oops || (argc - optind) < 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-tnm] msdosfile unixfile\n", argv[0]); fprintf(stderr, " %s [-tnm] msdosfile [msdosfiles...] unixdirectory\n", argv[0]); exit(1); --- 70,76 ---- } if (oops || (argc - optind) < 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-tnm] msdosfile unixfile\n", argv[0]); fprintf(stderr, " %s [-tnm] msdosfile [msdosfiles...] unixdirectory\n", argv[0]); exit(1); *************** *** 230,235 **** --- 221,227 ---- /* CONSTCOND */ while (1) { printf("File \"%s\" exists, overwrite (y/n) ? ", target); + fflush(stdout); gets(ans); if (ans[0] == 'n' || ans[0] == 'N') return(NULL); *************** *** 341,367 **** utime(target, &utbuf); } #endif /* BSD */ - return; - } - - /* - * stubs for read-only programs - */ - - void - disk_flush() - { - extern int disk_dirty; - - disk_dirty = 0; - return; - } - - void - dir_flush() - { - extern int dir_dirty; - - dir_dirty = 0; return; } --- 333,337 ---- diff -rc --new-file orig/mtools-2.0.7/mren.1 mtools-2.0.7/mren.1 *** orig/mtools-2.0.7/mren.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mren.1 Thu Sep 10 15:59:47 1992 *************** *** 0 **** --- 1,50 ---- + .TH MREN 1 local + .SH NAME + mren \- rename an existing MSDOS file + .SH SYNOPSIS + .B mren + [ + .B -v + ] sourcefile targetfile + .SH DESCRIPTION + .I Mren + renames an existing file on an MSDOS filesystem. + .PP + .I Mren + will allow the following command line option: + .TP + .B v + Verbose mode. Display the new filename if the name supplied is + invalid. + .PP + Reasonable care is taken to create a valid MSDOS filename. If an invalid + MSDOS target name is specified, + .I mren + will change the name (and prompt the user to accept or reject the new name + if the verbose mode is set). + .PP + The path component of the target filename (if supplied) is ignored. In + other words, you may not use + .I mren + to move a file from one subdirectory to another. + .PP + .I Mren + may be used to rename directories. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mread + returns 0 on success or 1 on failure. + .SH SEE ALSO + mcd(1) + .SH BUGS + Unlike the MSDOS version of REN, + .I mren + can be used to rename directories. diff -rc --new-file orig/mtools-2.0.7/mren.c mtools-2.0.7/mren.c *** orig/mtools-2.0.7/mren.c Thu Sep 10 15:59:16 1992 --- mtools-2.0.7/mren.c Sun Oct 17 22:16:12 1993 *************** *** 10,26 **** #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ ! ! main(argc, argv) int argc; char *argv[]; { --- 10,17 ---- #include #include "msdos.h" ! mren(argc, argv) int argc; char *argv[]; { *************** *** 41,47 **** } } if (argc != fargn + 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-v] sourcefile targetfile\n", argv[0]); exit(1); } --- 32,38 ---- } } if (argc != fargn + 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-v] sourcefile targetfile\n", argv[0]); exit(1); } *************** *** 66,71 **** --- 57,63 ---- if (strcmp(temp, new) && verbose) { while (!nogo) { printf("Do you accept \"%s\" as the new filename (y/n) ? ", new); + fflush(stdout); gets(ans); if (ans[0] == 'y' || ans[0] == 'Y') break; diff -rc --new-file orig/mtools-2.0.7/msdos.h mtools-2.0.7/msdos.h *** orig/mtools-2.0.7/msdos.h Thu Sep 10 15:59:13 1992 --- mtools-2.0.7/msdos.h Sun Oct 17 22:17:20 1993 *************** *** 59,61 **** --- 59,74 ---- #define strchr index #define strrchr rindex #endif /* BSD */ + + #define FAT12 4086 /* max. number of clusters described by a 12 bit FAT */ + + extern int fd; /* the file descriptor for the device */ + extern int dir_start; /* starting sector for directory */ + extern int dir_len; /* length of directory (in sectors) */ + extern int dir_entries; /* number of directory entries */ + extern int clus_size; /* cluster size (in sectors) */ + extern char *mcwd; /* the Current Working Directory */ + extern int fat_error; /* FAT error detected? */ + + extern char *mversion; + extern char *mdate; diff -rc --new-file orig/mtools-2.0.7/mtools.1 mtools-2.0.7/mtools.1 *** orig/mtools-2.0.7/mtools.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mtools.1 Sun Sep 26 19:24:05 1993 *************** *** 0 **** --- 1,84 ---- + .TH MTOOLS 1 local + .SH NAME + Mtools \- a collection of tools for manipulating MSDOS files + .SH SYNOPSIS + .nf + \fBmattrib\fR \- change MSDOS file attribute flags + \fBmcd\fR \- change MSDOS directory + \fBmcopy\fR \- copy MSDOS files to/from Unix + \fBmdel\fR \- delete an MSDOS file + \fBmdir\fR \- display an MSDOS directory + \fBmformat\fR \- add an MSDOS filesystem to a low-level formatted diskette + \fBmlabel\fR \- make an MSDOS volume label + \fBmmd\fR \- make an MSDOS subdirectory + \fBmrd\fR \- remove an MSDOS subdirectory + \fBmread\fR \- low level read (copy) an MSDOS file to Unix + \fBmren\fR \- rename an existing MSDOS file + \fBmtype\fR \- display contents of an MSDOS file + \fBmwrite\fR \- low level write (copy) a Unix file to MSDOS + .fi + .SH DESCRIPTION + Mtools is a public domain collection of programs to allow Unix systems + to read, write, and manipulate files on an MSDOS filesystem (typically a + diskette). Each program attempts to emulate the MSDOS equivalent + command as closely as practical. + .PP + MSDOS filenames are optionally composed of a drive letter followed by a + colon, a subdirectory, and a filename. Subdirectory names can use either + the '/' or '\e' separator. The use of the '\e' separator or wildcards + will require the names to be enclosed in quotes to protect them from the + shell. + .PP + The regular expression "pattern matching" routines follow the Unix-style + rules. For example, '*' matches all MSDOS files in lieu of '*.*'. The + archive, hidden, read-only and system attribute bits are ignored during + pattern matching. + .PP + Not all Unix filenames are appropriate in the MSDOS world. The Mtools + commands may have to alter Unix names to fit the MSDOS filename + restrictions. Most commands have a -v (verbose) option that will + display the new names if they have been changed. The following table + shows some examples of filename conversions: + .PP + .in +0.5i + .(b L + .TS + l l l. + Unix name MSDOS name Reason for the change + _ _ _ + thisisatest THISISAT filename too long + emmet.gray EMMET.GRA extension too long + prn.txt XRN.TXT PRN is a device name + \.abc X.ABC null filename + hot+cold HOTXCOLD illegal character + .TE + .)b + .in + .PP + All options use the '-' (minus) flag, not '/' as you'd expect in MSDOS. + .PP + The + .I mcd + command is used to establish the device and the current working + directory (relative to the MSDOS filesystem), otherwise the default is + assumed to be A:/. + .PP + All the Mtools commands return 0 on success, 1 on utter failure, or 2 + on partial failure. + .PP + Unless the host operating requires hardwired device setup, + the description of the devices on which to operate is loaded from + .I /etc/mtools + where each line describes one device. The first word is the device + letter name, the second the type of FAT (12 or 16 bits), the third the + number of cylinder, the fourth is the number of heads, and the fifth + word is the number of sector per track. If zero is specified for any of + the last three a guess will be attempted; if using any one line fails, + the next lines that apply to that device are tried in turn. + .SH SEE ALSO + mattrib(1), mcd(1), mdel(1), mformat(1), mrd(1), mren(1), mtype(1), + mcopy(1), mdir(1), mlabel(1), mmd(1), mread(1), mwrite(1) + .SH BUGS + An unfortunate side effect of not guessing the proper device (when + multiple disk capacities are supported) is an occasional error message + from the device driver. These can be safely ignored. diff -rc --new-file orig/mtools-2.0.7/mtools.5 mtools-2.0.7/mtools.5 *** orig/mtools-2.0.7/mtools.5 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mtools.5 Thu Oct 28 08:55:58 1993 *************** *** 0 **** --- 1,42 ---- + .TH MTOOLS 5 "Oct 20, 1993" "" "Linux Programmer's Manual" + .SH NAME + mtools \- table of DOS devices + .SH DESCRIPTION + .B /etc/mtools + is a text file which contains the description of valid DOS + drive letters for + .IR mtools (1). + .PP + There are six columns in each line, and each line describes + a device. + .PP + The first is the drive letter, the second the pathname of + drive aliased to that letter; the third column is the number of + bits, 12 or 16, in the FAT. The last three columns are the + geometry of the drive, cuylinders, tracks per cylinder, + sectors per track. + .PP + .B Mtools + will attempt to query the drive for its geometry if the files + contains zeroes for those three parameters. + .PP + There can be several lines for the same drice letter; if IO fails + with the parameters specified in the first such line, the other + lines are tried in sequence. + .SH EXAMPLES + .B /etc/mtools may contain the following paths: + .sp + .RS + .nf + A /dev/fd0 12 80 2 18 + A /dev/fd0 12 0 0 0 + A /dev/fd0 12 40 2 9 + B /dev/fd1 12 0 0 0 + B /dev/fd1 12 40 2 9 + C /dev/hda2 16 32 64 300 + .fi + .RE + .SH FILES + /etc/mtools + .SH "SEE ALSO" + .IR mtools (1) diff -rc --new-file orig/mtools-2.0.7/mtools.c mtools-2.0.7/mtools.c *** orig/mtools-2.0.7/mtools.c Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mtools.c Sun Oct 17 22:16:36 1993 *************** *** 0 **** --- 1,71 ---- + #include + #include + #include "msdos.h" + #include "patchlevel.h" + + int fd = -1; /* the file descriptor for the device */ + int dir_start; /* starting sector for directory */ + int dir_len; /* length of directory (in sectors) */ + int dir_entries; /* number of directory entries */ + int clus_size; /* cluster size (in sectors) */ + char *mcwd; /* the Current Working Directory */ + int fat_error; /* FAT error detected? */ + + char *mversion = VERSION; + char *mdate = DATE; + + #define DISPATCH(cmd,fn) if (!strcmp(name,cmd)) { extern fn(); \ + return fn(argc,argv); } + + main(int argc,char **argv) + { + char *name; + + #ifdef LOADDEVS + load_devices(); + #endif + + if (name = strrchr(argv[0],'/')) + name++; + else name = argv[0]; + + DISPATCH("mattrib",mattrib) + DISPATCH("mcd",mcd) + DISPATCH("mcopy",mcopy) + DISPATCH("mdel",mdel) + DISPATCH("mdir",mdir) + DISPATCH("mformat",mformat) + DISPATCH("mlabel",mlabel) + DISPATCH("mmd",mmd) + DISPATCH("mrd",mrd) + DISPATCH("mread",mread) + DISPATCH("mren",mren) + DISPATCH("mtype",mtype) + DISPATCH("mwrite",mwrite) + + fprintf(stderr,"Unknown mtools command '%s'\n",name); + + return 1; + } + + /* + * Do a graceful exit if the program is interrupted. This will reduce + * (but not eliminate) the risk of generating a corrupted disk on + * a user abort. + */ + + extern int fd; + + int + got_signal() + { + void exit(), disk_flush(), fat_write(), dir_flush(); + + if (fd < 0) + exit(1); + fat_write(); + dir_flush(); + disk_flush(); + close(fd); + exit(1); + } diff -rc --new-file orig/mtools-2.0.7/mtools.etc mtools-2.0.7/mtools.etc *** orig/mtools-2.0.7/mtools.etc Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mtools.etc Thu Oct 28 08:46:42 1993 *************** *** 0 **** --- 1,6 ---- + A /dev/fd0 12 80 2 18 + A /dev/fd0 12 0 0 0 + A /dev/fd0 12 40 2 9 + B /dev/fd1 12 0 0 0 + B /dev/fd1 12 40 2 9 + C /etc/dosemu/hdimage 16 80 2 18 diff -rc --new-file orig/mtools-2.0.7/mtype.1 mtools-2.0.7/mtype.1 *** orig/mtools-2.0.7/mtype.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mtype.1 Thu Sep 10 15:59:47 1992 *************** *** 0 **** --- 1,40 ---- + .TH MTYPE 1 local + .SH NAME + mtype \- display contents of an MSDOS file + .SH SYNOPSIS + .B mtype + [ + .B -ts + ] msdosfile [ msdosfiles... ] + .SH DESCRIPTION + .I Mtype + displays the specified MSDOS file on the screen. + .PP + .I Mtype + will allow the following command line options: + .TP + .B t + Text file viewing. + .I Mtype + will translate incoming carriage return/line feeds to line feeds. + .TP + .B s + Strip high bit. + .I Mtype + will strip the high bit from the data. + .PP + MSDOS subdirectory names are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mtype + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1), mread(1) + .SH BUGS + Allows multiple arguments, which does not follow the MSDOS convention. diff -rc --new-file orig/mtools-2.0.7/mtype.c mtools-2.0.7/mtype.c *** orig/mtools-2.0.7/mtype.c Thu Sep 10 15:59:48 1992 --- mtools-2.0.7/mtype.c Sun Oct 17 22:16:48 1993 *************** *** 10,26 **** #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ ! ! main(argc, argv) int argc; char *argv[]; { --- 10,17 ---- #include #include "msdos.h" ! mtype(argc, argv) int argc; char *argv[]; { *************** *** 56,62 **** } if (oops || (argc - optind) < 1) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-st] msdosfile [msdosfiles...]\n", argv[0]); exit(1); } --- 47,53 ---- } if (oops || (argc - optind) < 1) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-st] msdosfile [msdosfiles...]\n", argv[0]); exit(1); } *************** *** 121,146 **** if (missed_one) exit(1); exit(0); - } - - /* - * stubs for read-only programs - */ - - void - disk_flush() - { - extern int disk_dirty; - - disk_dirty = 0; - return; - } - - void - dir_flush() - { - extern int dir_dirty; - - dir_dirty = 0; - return; } --- 112,115 ---- diff -rc --new-file orig/mtools-2.0.7/mwrite.1 mtools-2.0.7/mwrite.1 *** orig/mtools-2.0.7/mwrite.1 Thu Jan 1 01:00:00 1970 --- mtools-2.0.7/mwrite.1 Thu Sep 10 15:59:47 1992 *************** *** 0 **** --- 1,68 ---- + .TH MWRITE 1 local + .SH NAME + mwrite \- low level write (copy) a Unix file to MSDOS + .SH SYNOPSIS + .B mwrite + [ + .B -tnvm + ] unixfile msdosfile + .PP + .B mwrite + [ + .B -tnvm + ] unixfile [ unixfiles... ] msdosdirectory + .SH DESCRIPTION + In the first form, + .I mwrite + copies the specified Unix file to the named MSDOS file. The second form + of the command copies multiple Unix files to the named MSDOS directory. + .PP + .I Mwrite + will allow the following command line options: + .TP + .B t + Text file transfer. + .I Mwrite + will translate incoming line feeds to carriage return/line feeds. + .TP + .B n + No warning. + .I Mwrite + will not warn the user when overwriting an existing file. + .TP + .B v + Verbose mode. Display the new filename if the Unix filename requires + conversion. + .TP + .B m + Preserve the file modification times. + .PP + If the target file already exists, and the + .I -n + option is not in effect, + .I mwrite + asks whether or not to overwrite the file. + .PP + Reasonable care is taken to create a valid MSDOS filename. If an + invalid name is specified, + .I mwrite + will change the name (and display the new name if the verbose mode is + set). + .PP + MSDOS subdirectory names are are supported with either the '/' or '\e' + separator. The use of the '\e' separator or wildcards will require the + names to be enclosed in quotes to protect them from the shell. + .PP + The + .I mcd + command may be used to establish the device and the current working + directory (relative to MSDOS), otherwise the default is A:/. + .PP + .I Mwrite + returns 0 on success, 1 on utter failure, or 2 on partial failure. + .SH SEE ALSO + mcd(1), mcopy(1), mread(1) + .SH BUGS + Unlike MSDOS, the destination directory may + .B not + be omitted. diff -rc --new-file orig/mtools-2.0.7/mwrite.c mtools-2.0.7/mwrite.c *** orig/mtools-2.0.7/mwrite.c Thu Sep 10 15:59:48 1992 --- mtools-2.0.7/mwrite.c Sun Oct 17 22:17:01 1993 *************** *** 13,36 **** #include #include #include "msdos.h" - #include "patchlevel.h" ! int fd = -1; /* the file descriptor for the device */ ! int dir_start; /* starting sector for directory */ ! int dir_len; /* length of directory (in sectors) */ ! int dir_entries; /* number of directory entries */ ! int clus_size; /* cluster size (in sectors) */ ! char *mcwd; /* the Current Working Directory */ ! int fat_error; /* FAT error detected? */ int full = 0; int textmode = 0; int nowarn = 0; - static int got_signal(); static struct directory *writeit(); static long free_space(); ! main(argc, argv) int argc; char *argv[]; { --- 13,28 ---- #include #include #include "msdos.h" ! extern int got_signal(); int full = 0; int textmode = 0; int nowarn = 0; static struct directory *writeit(); static long free_space(); ! mwrite(argc, argv) int argc; char *argv[]; { *************** *** 76,82 **** } if (oops || (argc - optind) < 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", VERSION, DATE); fprintf(stderr, "Usage: %s [-tnvm] unixfile msdosfile\n", argv[0]); fprintf(stderr, " %s [-tnvm] unixfile [unixfiles...] msdosdirectory\n", argv[0]); exit(1); --- 68,74 ---- } if (oops || (argc - optind) < 2) { ! fprintf(stderr, "Mtools version %s, dated %s\n", mversion, mdate); fprintf(stderr, "Usage: %s [-tnvm] unixfile msdosfile\n", argv[0]); fprintf(stderr, " %s [-tnvm] unixfile [unixfiles...] msdosdirectory\n", argv[0]); exit(1); *************** *** 177,182 **** --- 169,175 ---- /* CONSTCOND */ while (1) { printf("File \"%s\" exists, overwrite (y/n) ? ", target); + fflush(stdout); gets(ans); if (ans[0] == 'n' || ans[0] == 'N') { nogo = 1; *************** *** 322,348 **** dir = mk_entry(fixed, 0x20, fat, size, now); return(dir); } - - /* - * Do a graceful exit if the program is interrupted. This will reduce - * (but not eliminate) the risk of generating a corrupted disk on - * a user abort. - */ - - static int - got_signal() - { - void exit(), disk_flush(), fat_write(), dir_flush(); - - if (fd < 0) - exit(1); - fat_write(); - dir_flush(); - disk_flush(); - close(fd); - exit(1); - } - /* * Get the amount of remaining free space --- 315,320 ---- diff -rc --new-file orig/mtools-2.0.7/patchlevel.h mtools-2.0.7/patchlevel.h *** orig/mtools-2.0.7/patchlevel.h Thu Sep 10 16:00:31 1992 --- mtools-2.0.7/patchlevel.h Fri Nov 5 19:41:30 1993 *************** *** 1,2 **** #define VERSION "2.0.7" ! #define DATE "6 Sep 92" --- 1,2 ---- #define VERSION "2.0.7" ! #define DATE "17 Oct 93"