home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / z3util / acreate3.lbr / DCREATE.CQ / DCREATE.C
Encoding:
C/C++ Source or Header  |  1993-06-07  |  1.3 KB  |  82 lines

  1. /*
  2.     DCREATE.C: Program to create a Text file from an alias file
  3.     
  4.                                  By:
  5.  
  6.                            James W. McMann
  7.                    San Jose, Calif.
  8.  
  9.  
  10.         Inspired by the program ACREATE by Howard Cripe.
  11.  
  12. */
  13.  
  14. #include <bdscio.h>
  15.  
  16. char ibuf[BUFSIZ], obuf[BUFSIZ], file_name[40], command[256];
  17. int c, i;
  18.  
  19. main(argc, argv)
  20. char **argv;
  21.  
  22. {
  23.     if (argc != 3)
  24.     {
  25.     printf("Usage: A>dcreate <alias_file> <output_file> <cr> \n");
  26.     exit();
  27.     }
  28.  
  29.     if (fopen(argv[1], ibuf) == ERROR)
  30.     {
  31.     printf("Can't open alias file %s\n", argv[1]);
  32.     exit();
  33.     }
  34.     for (i=0; i < 28; i++)
  35.     getc(ibuf);
  36.  
  37.     for (i=0; i < 256; i++)
  38.         command[i] = getc(ibuf);
  39.  
  40.     command[i]=0;
  41.  
  42.     fabort(ibuf);
  43.  
  44.  
  45.     if (fcreat(argv[2], obuf) == ERROR)
  46.     {
  47.          printf("Can't create %s\n", argv[2]);
  48.         exit();
  49.     }
  50.  
  51.  
  52.     for (i=0; i < 256; i++)
  53.     {
  54.      if (command[i] == 59)
  55.         {
  56.         putc(13, obuf);
  57.         command[i]=10;
  58.     }
  59.     if (command[i] == 0)
  60.     {
  61.         i=256;
  62.         command[i]=CPMEOF;
  63.     }
  64.  
  65.            putc(command[i], obuf);
  66.     
  67.     }
  68.  
  69.     fclose(obuf);
  70.     printf("\n** Done **\n\n");
  71.  
  72.  }
  73.  
  74. [i]=CPMEOF;
  75.     }
  76.  
  77.            putc(command[i], obuf);
  78.     
  79.     }
  80.  
  81.     fclose(obuf);
  82.     printf("\n** Done