home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 280_01 / concat1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-01-11  |  1.5 KB  |  64 lines

  1. /* [concat1.c of JUGPDS Vol.46] */
  2. /*
  3. *****************************************************************
  4. *                                *
  5. *    Written by  Hakuo Katayose (JUG-CP/M No.179)        *
  6. *            49-114 Kawauchi-Sanjuunin-machi        *
  7. *            Sendai, Miyagi 980                          *
  8. *            Phone: 0222-61-3219                *
  9. *                                *
  10. *       Modifird by Toshiya Oota   (JUG-CPM No.10)              *
  11. *                   Sakae ko-po 205                 *
  12. *            5-19-6 Hosoda                *
  13. *            Katusikaku Tokyo 124            *
  14. *                                *
  15. *        for MS-DOS Lattice C V3.1J & 80186/V20/V30    *
  16. *                                *
  17. *    Compiler Option: -ccu -k0(1) -ms -n -v -w        *
  18. *                                *
  19. *    Edited & tested by Y. Monma (JUG-CP/M Disk Editor)    *
  20. *            &  T. Ota   (JUG-CP/M Sub Disk Editor)    *
  21. *                                *
  22. *****************************************************************
  23. */
  24.  
  25. /* Library functions for Software Tools */
  26.  
  27. #include "stdio.h"
  28. #include "dos.h"
  29. #include "ctype.h"
  30. #include "tools.h"
  31. #include "toolfunc.h"
  32.  
  33. #include "fcntl.h"
  34.  
  35. char tbuf[TBUFSIZ];
  36.  
  37. void main(argc, argv)
  38. int  argc;
  39. char **argv;
  40. {
  41. int fp;
  42. char *p;
  43. int n;
  44.  
  45.     if (argc < 2) {
  46.         error("CON901 Usage: concat1 file1 file2 ... >outfile");
  47.         exit(1);
  48.         }
  49.     p = tbuf;
  50.     while (--argc > 0) {
  51.         if ( (fp = open( *++argv, O_RDONLY | O_RAW ,0)) == ERROR) {
  52.             printf("\nCON902 can't open %s\n", *argv);
  53.             exit(1);
  54.             }
  55.         printf("\nfile:%s\n", *argv);
  56.         while ((n = read(fp, p, 256 )) > 0) {
  57.             while (*p != CPMEOF && n--)
  58.                 putchar(*p++);
  59.             p = tbuf;
  60.         }
  61.         close(fp);
  62.     }
  63. }
  64.