home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Tex / Dvi / dvieps.arc / EPS.C < prev    next >
C/C++ Source or Header  |  1988-10-28  |  880b  |  46 lines

  1.  
  2. /* simple-minded dump-to-epson frob */
  3.  
  4. #include <stdio.h>
  5. #include <file.h>
  6. #include <osbind.h>
  7.  
  8. main(argc, argv)
  9. int argc;
  10. char ** argv;
  11. {
  12.   char * name, * p;
  13.   int nbufs, nbytes;
  14.   char buf[1024];
  15.   int inf, outf;
  16.   
  17.   if (argc < 2)
  18.     {
  19.     fprintf(stderr, "Eps what?\n");
  20.     exit(1);
  21.     }
  22.  
  23.   name = (char * )malloc(256);
  24.   strcpy(name, argv[1]);
  25.   if ((inf = open(name, O_RDONLY, 0)) <= 0)
  26.     {
  27.     strcat(name, ".eps");
  28.       if ((inf = open(name, O_RDONLY, 0)) <= 0)
  29.         {
  30.         fprintf(stderr, "Eps: can't open %s or %s.  Giving up.\n",
  31.             argv[1], name);
  32.         exit(2);
  33.         }
  34.     }
  35. /*  outf = open("PRN:", O_WRONLY, 0); */
  36.   for (nbufs = 0 ; ((nbytes = Fread(inf, 1024, &buf)) > 0) ; nbufs++)
  37.     {
  38. /*    Fwrite(outf, nbytes, &buf); */
  39.     for (p = &buf[0] ; nbytes > 0 ; nbytes--)
  40.         Cprnout(*p++);
  41.     fprintf(stdout, " %dK", nbufs);
  42.     }
  43.   close(inf);
  44.   close(outf);
  45. }
  46.