SCCS-vsn: usr.sbin/rmt/rmt.c 4.3
-static char sccsid[] = "@(#)rmt.c 4.2 82/04/19";
+static char sccsid[] = "@(#)rmt.c 4.3 82/05/19";
tape = open(device, atoi(mode));
if (tape < 0)
goto ioerror;
tape = open(device, atoi(mode));
if (tape < 0)
goto ioerror;
case 'C':
if (debug) fprintf(debug, "rmtd: C\n");
case 'C':
if (debug) fprintf(debug, "rmtd: C\n");
if (close(tape) < 0)
goto ioerror;
tape = -1;
if (close(tape) < 0)
goto ioerror;
tape = -1;
case 'L':
gets(count); gets(pos);
case 'L':
gets(count); gets(pos);
rval = lseek(tape, (long) atoi(count), atoi(pos));
if (rval < 0)
goto ioerror;
rval = lseek(tape, (long) atoi(count), atoi(pos));
if (rval < 0)
goto ioerror;
rval = write(tape, record, n);
if (rval < 0)
goto ioerror;
rval = write(tape, record, n);
if (rval < 0)
goto ioerror;
rval = read(tape, record, n);
if (rval < 0)
goto ioerror;
rval = read(tape, record, n);
if (rval < 0)
goto ioerror;
- (void) write(1, record, n);
- break;
+ (void) sprintf(resp, "A%d\n", rval);
+ (void) write(1, resp, strlen(resp));
+ (void) write(1, record, rval);
+ goto top;
case 'I':
gets(op); gets(count);
case 'I':
gets(op); gets(count);
goto ioerror;
rval = mtop.mt_count;
}
goto ioerror;
rval = mtop.mt_count;
}
case 'S': /* status */
if (debug) fprintf(debug, "rmtd: S\n");
case 'S': /* status */
if (debug) fprintf(debug, "rmtd: S\n");
goto ioerror;
rval = sizeof (mtget);
(void) write(1, (char *)&mtget, sizeof (mtget));
goto ioerror;
rval = sizeof (mtget);
(void) write(1, (char *)&mtget, sizeof (mtget));
}
default:
if (debug) fprintf(debug, "rmtd: garbage command %c\n", c);
exit(1);
}
}
default:
if (debug) fprintf(debug, "rmtd: garbage command %c\n", c);
exit(1);
}
if (debug) fprintf(debug, "rmtd: A %d\n", rval);
(void) sprintf(resp, "A%d\n", rval);
(void) write(1, resp, strlen(resp));
if (debug) fprintf(debug, "rmtd: A %d\n", rval);
(void) sprintf(resp, "A%d\n", rval);
(void) write(1, resp, strlen(resp));