Patch 1&2 to Mtools v1.6

egray at fthood.UUCP egray at fthood.UUCP
Thu Jul 6 11:27:00 AEST 1989


Howdy netlanders!

Here is patch #1 and #2 to the Mtools version 1.6 distribution package.

Have fun...

Emmet P. Gray				US Army, HQ III Corps & Fort Hood
...!uunet!uiucuxc!fthood!egray		Attn: AFZF-DE-ENV
fthood!egray at uxc.cso.uiuc.edu		Directorate of Engineering & Housing
					Environmental Management Office
					Fort Hood, TX 76544-5057

-----------------------------------------------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	patch.01
#	patch.02
# This archive created: Wed Jul  5 20:25:48 1989
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'patch.01'" '(1932 characters)'
if test -f 'patch.01'
then
	echo shar: "will not over-write existing file 'patch.01'"
else
sed 's/^X//' << \SHAR_EOF > 'patch.01'
XSubject: Patch #1 to Mtools v1.6
X
XThis is patch #1 to the Mtools v1.6 distribution package.  This patch
Xwill update the fixname() routine so that it is in agreement with
Xsimilar changes made to other software package with the same routine
X(arc, pcomm, xmodem).  The fixname() routine is responsible for changing
Xa Unix file name to fix the MSDOS file name restrictions.
X
XEmmet P. Gray				US Army, HQ III Corps & Fort Hood
X...!uunet!uiucuxc!fthood!egray		Attn: AFZF-DE-ENV
Xfthood!egray at uxc.cso.uiuc.edu		Directorate of Engineering & Housing
X					Environmental Management Office
X					Fort Hood, TX 76544-5057
X
X----------------------------------------------------------------------------
XPrereq: v1.6
X*** old/Readme	Wed Jul  5 16:41:42 1989
X--- Readme	Wed Jul  5 17:44:36 1989
X***************
X*** 1,3
X! 			      MTOOLS v1.6
X  
X  This is a collection of MSDOS tools to allow you to read and write to
X
X--- 1,4 -----
X! 				MTOOLS
X! 			version 1.6.1 - 11 Jun 89
X  
X  This is a collection of MSDOS tools to allow you to read and write to
X*** old/fixname.c	Sun Jun 11 10:54:13 1989
X--- fixname.c	Sun Jun 11 10:54:22 1989
X***************
X*** 31,36
X  	ext = "";
X  	dot = 0;
X! 	for (s = name; *s; ++s) {
X! 		if (*s == '.' && !dot) {
X  			dot = 1;
X  			*s = '\0';
X
X--- 31,36 -----
X  	ext = "";
X  	dot = 0;
X! 	for (i=strlen(buf)-1; i>=0; i--) {
X! 		if (buf[i] == '.' && !dot) {
X  			dot = 1;
X  			buf[i] = '\0';
X***************
X*** 34,39
X  		if (*s == '.' && !dot) {
X  			dot = 1;
X! 			*s = '\0';
X! 			ext = s + 1;
X  		}
X  		if (islower(*s))
X
X--- 34,39 -----
X  		if (buf[i] == '.' && !dot) {
X  			dot = 1;
X! 			buf[i] = '\0';
X! 			ext = &buf[i+1];
X  		}
X  		if (islower(buf[i]))
X***************
X*** 37,42
X  			ext = s + 1;
X  		}
X! 		if (islower(*s))
X! 			*s = toupper(*s);
X  	}
X  	if (*name == '\0') {
X
X--- 37,42 -----
X  			ext = &buf[i+1];
X  		}
X! 		if (islower(buf[i]))
X! 			buf[i] = toupper(buf[i]);
X  	}
X  	if (*name == '\0') {
X#end of patch
SHAR_EOF
if test 1932 -ne "`wc -c < 'patch.01'`"
then
	echo shar: "error transmitting 'patch.01'" '(should have been 1932 characters)'
fi
fi
echo shar: "extracting 'patch.02'" '(19231 characters)'
if test -f 'patch.02'
then
	echo shar: "will not over-write existing file 'patch.02'"
else
sed 's/^X//' << \SHAR_EOF > 'patch.02'
XSubject: Patch #2 to Mtools v1.6
X
XThis is patch #2 to the Mtools v1.6 distribution package.  This is a
Xcollection of changes to fix a few deficiencies in the handling of EOF
Xmarkers in text files, and to add the ability to preserve file
Xmodification dates with a new "-m" option to mcopy/mread/mwrite (see the
Xpatched man pages...)
X
XMany thanks to Joe Strzemp joe at uicbert.eecs.uic.edu for pointing out
Xthese ideas...
X
XEmmet P. Gray				US Army, HQ III Corps & Fort Hood
X...!uunet!uiucuxc!fthood!egray		Attn: AFZF-DE-ENV
Xfthood!egray at uxc.cso.uiuc.edu		Directorate of Engineering & Housing
X					Environmental Management Office
X					Fort Hood, TX 76544-5057
X
X-----------------------------------------------------------------------------
XPrereq: 1.6.1
X*** old/Readme	Wed Jul  5 17:51:41 1989
X--- Readme	Wed Jul  5 17:50:15 1989
X***************
X*** 1,4
X  				MTOOLS
X! 			version 1.6.1 - 11 Jun 89
X  
X  This is a collection of MSDOS tools to allow you to read and write to
X
X--- 1,4 -----
X  				MTOOLS
X! 			version 1.6.2 - 5 Jul 89
X  
X  This is a collection of MSDOS tools to allow you to read and write to
X***************
X*** 75,81
X  mwrite.  This is because, the text mode is only useful if the files are
X  gonna be used under Unix.
X- 
X- Mwrite adds an EOF marker to every file (not just text files).  Mread
X- ignores all EOF markers.
X  
X  The implementation of the Mcopy command is somewhat clumbsy since the
X
X--- 75,78 -----
X  mwrite.  This is because, the text mode is only useful if the files are
X  gonna be used under Unix.
X  
X  The implementation of the Mcopy command is somewhat clumbsy since the
X*** old/Makefile	Wed Jul  5 11:32:33 1989
X--- Makefile	Wed Jul  5 11:35:52 1989
X***************
X*** 12,16
X  MDIR	= mdir.o getfat.o init.o search.o match.o convdate.o unixname.o \
X  	subdir.o isdir.o
X! MREAD	= mread.o getfat.o init.o search.o match.o unixname.o subdir.o
X  MWRITE	= mwrite.o getfat.o init.o search.o fixname.o unixname.o putfat.o \
X  	subdir.o mkentry.o isdir.o
X
X--- 12,17 -----
X  MDIR	= mdir.o getfat.o init.o search.o match.o convdate.o unixname.o \
X  	subdir.o isdir.o
X! MREAD	= mread.o getfat.o init.o search.o match.o unixname.o subdir.o \
X! 	convdate.o
X  MWRITE	= mwrite.o getfat.o init.o search.o fixname.o unixname.o putfat.o \
X  	subdir.o mkentry.o isdir.o
X*** old/Mcopy.1	Wed Jul  5 10:05:39 1989
X--- Mcopy.1	Wed Jul  5 10:06:52 1989
X***************
X*** 5,9
X  .B mcopy
X  [
X! .B -tnv
X  ] unixfile a:msdosfile
X  .PP
X
X--- 5,9 -----
X  .B mcopy
X  [
X! .B -tnvm
X  ] unixfile a:msdosfile
X  .PP
X***************
X*** 10,14
X  .B mcopy
X  [
X! .B -tnv
X  ] unixfile [ unixfiles... ] a:msdosdirectory
X  .PP
X
X--- 10,14 -----
X  .B mcopy
X  [
X! .B -tnvm
X  ] unixfile [ unixfiles... ] a:msdosdirectory
X  .PP
X***************
X*** 15,19
X  .B mcopy
X  [
X! .B -tn
X  ] a:msdosfile unixfile
X  .PP
X
X--- 15,19 -----
X  .B mcopy
X  [
X! .B -tnm
X  ] a:msdosfile unixfile
X  .PP
X***************
X*** 20,24
X  .B mcopy
X  [
X! .B -tn
X  ] a:msdosfile [ a:msdosfiles... ] unixdirectory
X  .SH DESCRIPTION
X
X--- 20,24 -----
X  .B mcopy
X  [
X! .B -tnm
X  ] a:msdosfile [ a:msdosfiles... ] unixdirectory
X  .SH DESCRIPTION
X***************
X*** 51,54
X  .B v
X  verbose mode.
X  .PP
X  If the target file already exists, and the
X
X--- 51,57 -----
X  .B v
X  verbose mode.
X+ .TP
X+ .B m
X+ Preserve the file modification time.
X  .PP
X  If the target file already exists, and the
X*** old/Mread.1	Wed Jul  5 10:05:39 1989
X--- Mread.1	Wed Jul  5 10:07:34 1989
X***************
X*** 5,9
X  .B mread
X  [
X! .B -tn
X  ] msdosfile unixfile
X  .PP
X
X--- 5,9 -----
X  .B mread
X  [
X! .B -tnm
X  ] msdosfile unixfile
X  .PP
X***************
X*** 10,14
X  .B mread
X  [
X! .B -tn
X  ] msdosfile [ msdosfiles... ] unixdirectory
X  .SH DESCRIPTION
X
X--- 10,14 -----
X  .B mread
X  [
X! .B -tnm
X  ] msdosfile [ msdosfiles... ] unixdirectory
X  .SH DESCRIPTION
X***************
X*** 33,36
X  .I Mread
X  will not warn the user when overwriting an existing file.
X  .PP
X  If the target file already exists, and the
X
X--- 33,39 -----
X  .I Mread
X  will not warn the user when overwriting an existing file.
X+ .TP
X+ .B m
X+ Preserve the file modification times.
X  .PP
X  If the target file already exists, and the
X*** old/Mwrite.1	Wed Jul  5 10:05:40 1989
X--- Mwrite.1	Wed Jul  5 10:08:03 1989
X***************
X*** 5,9
X  .B mwrite
X  [
X! .B -tnv
X  ] unixfile msdosfile
X  .PP
X
X--- 5,9 -----
X  .B mwrite
X  [
X! .B -tnvm
X  ] unixfile msdosfile
X  .PP
X***************
X*** 10,14
X  .B mwrite
X  [
X! .B -tnv
X  ] unixfile [ unixfiles... ] msdosdirectory
X  .SH DESCRIPTION
X
X--- 10,14 -----
X  .B mwrite
X  [
X! .B -tnvm
X  ] unixfile [ unixfiles... ] msdosdirectory
X  .SH DESCRIPTION
X***************
X*** 37,40
X  Verbose mode.  Display the new file name if the Unix file name requires
X  conversion.
X  .PP
X  If the target file already exists, and the
X
X--- 37,43 -----
X  Verbose mode.  Display the new file name if the Unix file name requires
X  conversion.
X+ .TP
X+ .B m
X+ Preserve the file modification times.
X  .PP
X  If the target file already exists, and the
X*** old/convdate.c	Wed Jul  5 10:05:40 1989
X--- convdate.c	Wed Jul  5 12:27:29 1989
X***************
X*** 1,4
X  /*
X!  * convdate(), convtime()
X   */
X  
X
X--- 1,4 -----
X  /*
X!  * convdate(), convtime(), convstamp()
X   */
X  #include <stdio.h>
X***************
X*** 2,6
X   * convdate(), convtime()
X   */
X! 
X  /*
X   * convert MSDOS directory datestamp to ASCII.
X
X--- 2,6 -----
X   * convdate(), convtime(), convstamp()
X   */
X! #include <stdio.h>
X  /*
X   * convert MSDOS directory datestamp to ASCII.
X***************
X*** 13,17
X  /*
X   *	    hi byte     |    low byte
X!  *	|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
X   *      | | | | | | | | | | | | | | | | |
X   *      \   7 bits    /\4 bits/\ 5 bits /
X
X--- 13,17 -----
X  /*
X   *	    hi byte     |    low byte
X!  *	|7|6|5|4|3|2|1|0|7|6|5|4|3|2|1|0|
X   *      | | | | | | | | | | | | | | | | |
X   *      \   7 bits    /\4 bits/\ 5 bits /
X***************
X*** 39,43
X  /*
X   *	    hi byte     |    low byte
X!  *	|0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
X   *      | | | | | | | | | | | | | | | | |
X   *      \  5 bits /\  6 bits  /\ 5 bits /
X
X--- 39,43 -----
X  /*
X   *	    hi byte     |    low byte
X!  *	|7|6|5|4|3|2|1|0|7|6|5|4|3|2|1|0|
X   *      | | | | | | | | | | | | | | | | |
X   *      \  5 bits /\  6 bits  /\ 5 bits /
X***************
X*** 58,60
X  	sprintf(ans, "%2d:%02d%c", hour, min_hi+min_low, am_pm);
X  	return(ans);
X  }
X
X--- 58,96 -----
X  	sprintf(ans, "%2d:%02d%c", hour, min_hi+min_low, am_pm);
X  	return(ans);
X+ }
X+ 
X+ /*
X+  * Convert a MSDOS time & date stamp to the Unix time() format
X+  */
X+ 
X+ long
X+ convstamp(time_field, date_field)
X+ unsigned char *time_field, *date_field;
X+ {
X+ 	extern long timezone;
X+ 	int year, mon, mday, hour, min, sec, old_leaps;
X+ 	long answer, sec_year, sec_mon, sec_mday, sec_hour, sec_min, sec_leap;
X+ 	static int month[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304,
X+ 	334};
X+ 					/* disect the parts */
X+ 	year = (date_field[1] >> 1) + 1980;
X+ 	mon = (((date_field[1] & 0x1) << 3) + (date_field[0] >> 5));
X+ 	mday = date_field[0] & 0x1f;
X+ 	hour = time_field[1] >> 3;
X+ 	min = (((time_field[1] & 0x7) << 3) + (time_field[0] >> 5));
X+ 	sec = (time_field[0] & 0x1f) * 2;
X+ 					/* how many previous leap years */
X+ 	old_leaps = (year -1972) / 4;
X+ 	sec_leap = old_leaps * 24 * 60 * 60;
X+ 					/* back off 1 day if before 29 Feb */
X+ 	if (!(year % 4) && mon < 3)
X+ 		sec_leap -= 24 * 60 * 60;
X+ 	sec_year = (year - 1970) * 365 * 24 * 60 * 60;
X+ 	sec_mon = month[mon -1] * 24 * 60 * 60;
X+ 	sec_mday = mday * 24 * 60 * 60;
X+ 	sec_hour = hour * 60 * 60;
X+ 	sec_min = min * 60;
X+ 	
X+ 	answer = sec_leap + sec_year + sec_mon + sec_mday + sec_hour + sec_min + sec + timezone;
X+ 	return(answer);
X  }
X*** old/mcopy.c	Wed Jul  5 10:05:40 1989
X--- mcopy.c	Wed Jul  5 10:11:48 1989
X***************
X*** 28,32
X  	unix_args = 0;
X  	oops = 0;
X! 	while ((i = getopt(argc, argv, "tnv")) != EOF) {
X  		switch(i) {
X  			case 't':
X
X--- 28,32 -----
X  	unix_args = 0;
X  	oops = 0;
X! 	while ((i = getopt(argc, argv, "tnvm")) != EOF) {
X  		switch(i) {
X  			case 't':
X***************
X*** 33,36
X  			case 'n':
X  			case 'v':
X  				break;
X  			default:
X
X--- 33,37 -----
X  			case 'n':
X  			case 'v':
X+ 			case 'm':
X  				break;
X  			default:
X***************
X*** 41,48
X  
X  	if (oops || (argc - optind) < 2) {
X! 		fprintf(stderr, "Usage: mcopy [-tnv] a:msdosfile unixfile\n");
X! 		fprintf(stderr, "       mcopy [-tnv] a:msdosfile [a:msdosfiles...] unixdirectory\n");
X! 		fprintf(stderr, "       mcopy [-tn] unixfile a:msdosfile\n");
X! 		fprintf(stderr, "       mcopy [-tn] unixfile [unixfiles...] a:msdosdirectory\n");
X  		exit(1);
X  	}
X
X--- 42,49 -----
X  
X  	if (oops || (argc - optind) < 2) {
X! 		fprintf(stderr, "Usage: mcopy [-tnvm] a:msdosfile unixfile\n");
X! 		fprintf(stderr, "       mcopy [-tnvm] a:msdosfile [a:msdosfiles...] unixdirectory\n");
X! 		fprintf(stderr, "       mcopy [-tnm] unixfile a:msdosfile\n");
X! 		fprintf(stderr, "       mcopy [-tnm] unixfile [unixfiles...] a:msdosdirectory\n");
X  		exit(1);
X  	}
X*** old/mkentry.c	Wed Jul  5 10:05:41 1989
X--- mkentry.c	Wed Jul  5 12:48:15 1989
X***************
X*** 17,21
X  
X  struct directory *
X! mk_entry(filename, attr, fat, size)
X  char *filename;
X  unsigned char attr;
X
X--- 17,21 -----
X  
X  struct directory *
X! mk_entry(filename, attr, fat, size, date)
X  char *filename;
X  unsigned char attr;
X***************
X*** 21,25
X  unsigned char attr;
X  int fat;
X! long size;
X  {
X  	long clock, time();
X
X--- 21,25 -----
X  unsigned char attr;
X  int fat;
X! long size, date;
X  {
X  	int i;
X***************
X*** 23,27
X  long size;
X  {
X- 	long clock, time();
X  	int i;
X  	char *strncpy();
X
X--- 23,26 -----
X  long size, date;
X  {
X  	int i;
X  	char *strncpy();
X***************
X*** 31,36
X  	unsigned char year, month_hi, month_low, day;
X  
X! 	time(&clock);
X! 	now = localtime(&clock);
X  	strncpy((char *) ndir.name, filename, 8);
X  	strncpy((char *) ndir.ext, filename+8, 3);
X
X--- 30,34 -----
X  	unsigned char year, month_hi, month_low, day;
X  
X! 	now = localtime(&date);
X  	strncpy((char *) ndir.name, filename, 8);
X  	strncpy((char *) ndir.ext, filename+8, 3);
X***************
X*** 41,45
X  	min_hi = now->tm_min >> 3;
X  	min_low = now->tm_min << 5;
X! 	sec = 0;
X  	ndir.time[1] = hour + min_hi;
X  	ndir.time[0] = min_low + sec;
X
X--- 39,43 -----
X  	min_hi = now->tm_min >> 3;
X  	min_low = now->tm_min << 5;
X! 	sec = now->tm_sec / 2;
X  	ndir.time[1] = hour + min_hi;
X  	ndir.time[0] = min_low + sec;
X*** old/mmd.c	Wed Jul  5 10:05:41 1989
X--- mmd.c	Wed Jul  5 10:22:34 1989
X***************
X*** 32,35
X  	void exit(), putcluster(), writefat(), writedir(), free();
X  	struct directory *dir, *search(), *mk_entry();
X  
X  	if (init(2)) {
X
X--- 32,36 -----
X  	void exit(), putcluster(), writefat(), writedir(), free();
X  	struct directory *dir, *search(), *mk_entry();
X+ 	long time(), now;
X  
X  	if (init(2)) {
X***************
X*** 119,123
X  	}
X  					/* make directory entry */
X! 	dir = mk_entry(fixed, 0x10, fat, 0L);
X  	writedir(slot, dir);
X  					/* write the cluster */
X
X--- 120,125 -----
X  	}
X  					/* make directory entry */
X! 	time(&now);
X! 	dir = mk_entry(fixed, 0x10, fat, 0L, now);
X  	writedir(slot, dir);
X  					/* write the cluster */
X***************
X*** 142,145
X  	struct directory *mk_entry();
X  	void exit(), perror(), move();
X  
X  	start = (dot - 2)*clus_size + dir_start + dir_len;
X
X--- 144,148 -----
X  	struct directory *mk_entry();
X  	void exit(), perror(), move();
X+ 	long time(), now;
X  
X  	start = (dot - 2)*clus_size + dir_start + dir_len;
X***************
X*** 148,153
X  	buflen = clus_size * MSECSIZ;
X  					/* make the '.' and '..' entries */	
X! 	dirs[0] = *mk_entry(".          ", 0x10, dot, 0L);
X! 	dirs[1] = *mk_entry("..         ", 0x10, dot_dot, 0L);
X  
X  	if (write(fd, (char *) &dirs[0], buflen) != buflen) {
X
X--- 151,157 -----
X  	buflen = clus_size * MSECSIZ;
X  					/* make the '.' and '..' entries */	
X! 	time(&now);
X! 	dirs[0] = *mk_entry(".          ", 0x10, dot, 0L, now);
X! 	dirs[1] = *mk_entry("..         ", 0x10, dot_dot, 0L, now);
X  
X  	if (write(fd, (char *) &dirs[0], buflen) != buflen) {
X*** old/mread.c	Wed Jul  5 10:05:41 1989
X--- mread.c	Wed Jul  5 13:26:49 1989
X***************
X*** 39,43
X  	extern int optind;
X  	extern char *optarg;
X! 	int fat, i, ismatch, entry, single, c, oops;
X  	char *filename, *newfile, text[4], tname[9], *getname(), *unixname();
X  	char *strncpy(), *pathname, *getpath(), *target, tmp[MAX_PATH];
X
X--- 39,44 -----
X  	extern int optind;
X  	extern char *optarg;
X! 	int fat, i, ismatch, entry, single, c, oops, mod_time;
X! 	long mod_date, convstamp();
X  	char *filename, *newfile, text[4], tname[9], *getname(), *unixname();
X  	char *strncpy(), *pathname, *getpath(), *target, tmp[MAX_PATH];
X***************
X*** 53,57
X  					/* get command line options */
X  	oops = 0;
X! 	while ((c = getopt(argc, argv, "tn")) != EOF) {
X  		switch(c) {
X  			case 't':
X
X--- 54,59 -----
X  					/* get command line options */
X  	oops = 0;
X! 	mod_time = 0;
X! 	while ((c = getopt(argc, argv, "tnm")) != EOF) {
X  		switch(c) {
X  			case 't':
X***************
X*** 61,64
X  				nowarn = 1;
X  				break;
X  			default:
X  				oops = 1;
X
X--- 63,69 -----
X  				nowarn = 1;
X  				break;
X+ 			case 'm':
X+ 				mod_time = 1;
X+ 				break;
X  			default:
X  				oops = 1;
X***************
X*** 116,119
X  			fat = dir->start[1]*0x100 + dir->start[0];
X  			size = dir->size[2]*0x10000L + dir->size[1]*0x100 + dir->size[0];
X  					/* if single file */
X  			if (single) {
X
X--- 121,129 -----
X  			fat = dir->start[1]*0x100 + dir->start[0];
X  			size = dir->size[2]*0x10000L + dir->size[1]*0x100 + dir->size[0];
X+ 			if (mod_time)
X+ 				mod_date = convstamp(dir->time, dir->date);
X+ 			else
X+ 				mod_date = 0L;
X+ 
X  					/* if single file */
X  			if (single) {
X***************
X*** 119,123
X  			if (single) {
X  				if (!strcmp(newfile, filename)) {
X! 					readit(fat, target);
X  					ismatch = 1;
X  					break;
X
X--- 129,133 -----
X  			if (single) {
X  				if (!strcmp(newfile, filename)) {
X! 					readit(fat, target, mod_date);
X  					ismatch = 1;
X  					break;
X***************
X*** 131,135
X  					strcat(tmp, "/");
X  					strcat(tmp, newfile);
X! 					readit(fat, tmp);
X  					ismatch = 1;
X  				}
X
X--- 141,145 -----
X  					strcat(tmp, "/");
X  					strcat(tmp, newfile);
X! 					readit(fat, tmp, mod_date);
X  					ismatch = 1;
X  				}
X***************
X*** 152,156
X  
X  int
X! readit(fat, target)
X  int fat;
X  char *target;
X
X--- 162,166 -----
X  
X  int
X! readit(fat, target, mod_date)
X  int fat;
X  char *target;
X***************
X*** 155,158
X  int fat;
X  char *target;
X  {
X  	char ans[10];
X
X--- 165,169 -----
X  int fat;
X  char *target;
X+ long mod_date;
X  {
X  	char ans[10];
X***************
X*** 160,163
X  	FILE *fp;
X  	struct stat stbuf;
X  
X  #ifdef LOWERCASE
X
X--- 171,178 -----
X  	FILE *fp;
X  	struct stat stbuf;
X+ 	struct utimbuf {
X+ 		time_t actime;
X+ 		time_t modtime;
X+ 	} utbuf;
X  
X  #ifdef LOWERCASE
X***************
X*** 210,213
X  	}
X  	fclose(fp);
X  	return;
X  }
X
X--- 225,234 -----
X  	}
X  	fclose(fp);
X+ 					/* preserve mod times ? */
X+ 	if (mod_date != 0L) {
X+ 		utbuf.actime = mod_date;
X+ 		utbuf.modtime = mod_date;
X+ 		utime(target, &utbuf);
X+ 	}
X  	return;
X  }
X***************
X*** 241,244
X  			break;
X  		if (textmode && buf[i] == '\r')
X  			continue;
X  		fputc((char) buf[i], fp);
X
X--- 262,267 -----
X  			break;
X  		if (textmode && buf[i] == '\r')
X+ 			continue;
X+ 		if (textmode && current == size && buf[i] == 0x1a)
X  			continue;
X  		fputc((char) buf[i], fp);
X*** old/mtype.c	Wed Jul  5 10:05:41 1989
X--- mtype.c	Wed Jul  5 13:23:47 1989
X***************
X*** 162,166
X  		if (current > size) 
X  			break;
X! 		if (textmode & buf[i] == '\r')
X  			continue;
X  		if (stripmode)
X
X--- 162,168 -----
X  		if (current > size) 
X  			break;
X! 		if (textmode && buf[i] == '\r')
X! 			continue;
X! 		if (textmode && current == size && buf[i] == 0x1a)
X  			continue;
X  		if (stripmode)
X*** old/mwrite.c	Wed Jul  5 10:05:42 1989
X--- mwrite.c	Wed Jul  5 13:29:27 1989
X***************
X*** 38,42
X  	extern char *optarg;
X  	int i, entry, ismatch, nogo, slot, start, dot, single;
X! 	int root, c, oops, verbose, first;
X  	char *filename, *newfile, tname[9], text[4], *fixname(), *getname();
X  	char *unixname(), ans[10], *strncpy(), *pathname, *getpath(), *fixed;
X
X--- 38,42 -----
X  	extern char *optarg;
X  	int i, entry, ismatch, nogo, slot, start, dot, single;
X! 	int root, c, oops, verbose, first, mod_time;
X  	char *filename, *newfile, tname[9], text[4], *fixname(), *getname();
X  	char *unixname(), ans[10], *strncpy(), *pathname, *getpath(), *fixed;
X***************
X*** 52,56
X  	oops = 0;
X  	verbose = 0;
X! 	while ((c = getopt(argc, argv, "tnv")) != EOF) {
X  		switch(c) {
X  			case 't':
X
X--- 52,57 -----
X  	oops = 0;
X  	verbose = 0;
X! 	mod_time = 0;
X! 	while ((c = getopt(argc, argv, "tnvm")) != EOF) {
X  		switch(c) {
X  			case 't':
X***************
X*** 63,66
X  				verbose = 1;
X  				break;
X  			default:
X  				oops = 1;
X
X--- 64,70 -----
X  				verbose = 1;
X  				break;
X+ 			case 'm':
X+ 				mod_time = 1;
X+ 				break;
X  			default:
X  				oops = 1;
X***************
X*** 213,217
X  			printf("Copying %s\n", target);
X  					/* write the file */
X! 		if (dir = writeit(fixed, argv[i], verbose))
X  			writedir(slot, dir);
X  
X
X--- 217,221 -----
X  			printf("Copying %s\n", target);
X  					/* write the file */
X! 		if (dir = writeit(fixed, argv[i], verbose, mod_time))
X  			writedir(slot, dir);
X  
X***************
X*** 238,242
X  
X  struct directory *
X! writeit(fixed, path, verbose)
X  char *fixed, *path;
X  int verbose;
X
X--- 242,246 -----
X  
X  struct directory *
X! writeit(fixed, path, verbose, mod_time)
X  char *fixed, *path;
X  int verbose, mod_time;
X***************
X*** 240,244
X  writeit(fixed, path, verbose)
X  char *fixed, *path;
X! int verbose;
X  {
X  	FILE *fp;
X
X--- 244,248 -----
X  writeit(fixed, path, verbose, mod_time)
X  char *fixed, *path;
X! int verbose, mod_time;
X  {
X  	FILE *fp;
X***************
X*** 244,248
X  	FILE *fp;
X  	int fat, firstfat, oldfat;
X! 	long size;
X  	struct directory *dir, *mk_entry();
X  	struct stat stbuf;
X
X--- 248,252 -----
X  	FILE *fp;
X  	int fat, firstfat, oldfat;
X! 	long size, time(), now;
X  	struct directory *dir, *mk_entry();
X  	struct stat stbuf;
X***************
X*** 264,267
X  	}
X  	filesize = stbuf.st_size;
X  	if (!(fp = fopen(path, "r"))) {
X  		fprintf(stderr, "mwrite: Can't open \"%s\" for read\n", path);
X
X--- 268,277 -----
X  	}
X  	filesize = stbuf.st_size;
X+ 					/* preserve mod time? */
X+ 	if (mod_time)
X+ 		now = stbuf.st_mtime;
X+ 	else
X+ 		time(&now);
X+ 
X  	if (!(fp = fopen(path, "r"))) {
X  		fprintf(stderr, "mwrite: Can't open \"%s\" for read\n", path);
X***************
X*** 293,297
X  	}
X  	fclose(fp);
X! 	dir = mk_entry(fixed, 0x20, firstfat, size);
X  	return(dir);
X  }
X
X--- 303,307 -----
X  	}
X  	fclose(fp);
X! 	dir = mk_entry(fixed, 0x20, firstfat, size, now);
X  	return(dir);
X  }
X***************
X*** 324,328
X  			if ((c = fgetc(fp)) == EOF) {
X  					/* put a file EOF marker */
X! 				tbuf[current] = 0x1a;
X  				break;
X  			}
X
X--- 334,340 -----
X  			if ((c = fgetc(fp)) == EOF) {
X  					/* put a file EOF marker */
X! 				tbuf[current++] = 0x1a;
X! 					/* make the file appear larger */
X! 				filesize++;
X  				break;
X  			}
X***************
X*** 345,351
X  			exit(1);
X  		}
X- 					/* all files get an EOF marker */
X- 		if (current != buflen) 
X- 			tbuf[current+1] = 0x1a;
X  	}
X  	
X
X--- 357,360 -----
X  			exit(1);
X  		}
X  	}
X  	
X#end of patch
SHAR_EOF
if test 19231 -ne "`wc -c < 'patch.02'`"
then
	echo shar: "error transmitting 'patch.02'" '(should have been 19231 characters)'
fi
fi
exit 0
#	End of shell archive



More information about the Unix-pc.sources mailing list