19,24c19
<  *
<  * Changes by Yudhi Widyatama (yudhi@warlord.ee.itb.ac.id)
<  * - tries to continue with next file in case of out-of-memory
<  * - if cannot allocate memory for the whole file, uses a 2MB
<  *   buffer in lieu of the file size (file_len) and do it
<  *   with a do-while loop
---
>  *
53c48
< 			("error: you must specify the mac data file on the command line.\n i.e. \% rescumm \"Sam & Max Demo Data\"\n",
---
> 			("error: you must specify the mac data file on the command line.\n i.e. \% macextract \"Sam & Max Demo Data\"\n",
157,160c152
< 		if (!(buf = malloc(file_len))) {
< 		    buf = malloc(2048*1024) ; // 2MB
< 		    if (!buf)
< 		    {
---
> 		if (!(buf = malloc(file_len))) {
162,184c154,155
< 			fclose(ofp);
< 		    } else {
< 			size_t readed,total_read;
< 			total_read=0; readed=0;
< 			do {
< 			    readed = file_len - total_read;
< 			    if (readed>2048*1024) 
< 				readed = 2048*1024;
< 			    readed=fread(buf,1,readed,ifp);
< 			    if (readed>0) {
< 				fwrite(buf,1,readed,ofp);
< 				total_read+=readed;
< 			    }
< 			} while (readed>0);
< 			fclose(ofp);
< 			free(buf);
< 			fprintf(stdout,"total written = %ld bytes, file len = %ld\n",
< 			    total_read,file_len);
< 			if (total_read!=file_len)
< 			    fprintf(stderr,"bytes written mismatch with file size!\n");
< 		    }
< 		} else
< 		{
---
> 			exit(0);
> 		}
188,189c159
< 		free(buf);
< 		}
---
> 		free(buf);
