home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / standalone / dd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-24  |  347 b   |  24 lines

  1. main()
  2. {
  3.   int i, j, in;
  4.   char buf[512];
  5.  
  6.   do {
  7.     printf("Input device: ");
  8.     gets(buf);
  9.     in = open(buf, 0);
  10.   } while (in <= 0);
  11.   do {
  12.     printf("Output device: ");
  13.     gets(buf);
  14.     j = open(buf, 1, 0777);
  15.   } while (j <= 0);
  16.  
  17.   while (1) {
  18.     if ((i = read(in, buf, 512)) <= 0) {
  19.       exit(1);
  20.     }
  21.     write(j, buf, 512);
  22.   }
  23. }
  24.