home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 545b.lha / T3E / t3e.c < prev    next >
C/C++ Source or Header  |  1991-09-06  |  2KB  |  61 lines

  1. struct FileHandle *fi,*fo,*Open();
  2.  
  3. LONG l,hl,Read(),Seek();
  4. UBYTE *buf,*AllocMem();
  5.  
  6. UWORD hunkdat[]={
  7. /*    0      1      2      3      4      5      6      7        */
  8.    0x0000,0x03F3,0x0000,0x0000,0x0000,0x0001,0x0000,0x0000,/* 0 */
  9.    0x0000,0x0000,0x0000,0x0010,0x0000,0x03E9,0x0000,0x0010,/* 1 */
  10.    0x43FA,0x002c,0x2C78,0x0004,0x4EAE,0xFDD8,0x2C40,0x4EAE,/* 2 */
  11.    0xFFC4,0x2200,0x41FA,0x0024,0x2618,0x2408,0x4EAE,0xFFD0,/* 3 */
  12.    0x224E,0x2C78,0x0004,0x4EAE,0xFE62,0x7000,0x4E75,0x646F,/* 4 */
  13.    0x732E,0x6C69,0x6272,0x6172,0x7900,                     /* 5 */
  14.                                       0x0000,0x03F2};      /* 5 */
  15.  
  16. main(argc,argv)
  17. char *argv[];
  18. {
  19. int t;
  20.     if (argc!=3) PrintF("Usage: %s <IN> <OUT>\n",argv[0]);
  21.     else {
  22.         if (!(fi=Open(argv[1],MODE_OLDFILE))) {
  23.             PrintF("Couldn't open input-file\n");
  24.             exit(0L);
  25.         }
  26.         Seek(fi,0L,OFFSET_END);
  27.         l=Seek(fi,0L,OFFSET_BEGINNING);
  28.         if (l<1L) {
  29.             PrintF("Input-file empty !?\n");
  30.             Close(fi);
  31.             Close(fo);
  32.             exit(0L);
  33.         }
  34.         if (!(fo=Open(argv[2],MODE_NEWFILE))) {
  35.             PrintF("Couldn't open output-file\n");
  36.             Close(fi);
  37.             exit(0L);
  38.         }
  39.         Write(fo,hunkdat,20L);
  40.         hl=16L+((l+1)>>2);
  41.         Write(fo,&hl,4L);
  42.         Write(fo,&(hunkdat[014]),4L);
  43.         Write(fo,&hl,4L);
  44.         Write(fo,&(hunkdat[020]),58L);
  45.         Write(fo,&l,4L);
  46.         hl=((l+1)&0xFFFFFFFCL)+2L;
  47.         if (!(buf=AllocMem(hl,MEMF_CLEAR))) {
  48.             PrintF("Not enough memory to read file!\n");
  49.             Close(fi);
  50.             Close(fo);
  51.             exit(0L);
  52.         }
  53.         Read(fi,buf,l);
  54.         Write(fo,buf,hl);
  55.         Write(fo,&(hunkdat[055]),4L);
  56.         Close(fi);
  57.         Close(fo);
  58.     }
  59.     exit(0L);
  60. }
  61.