static char *sccsid
= "@(#)mt.c 4.1 (Berkeley) 81/05/11";
char line
[80], *getenv();
register struct commands
*comp
;
fprintf(stderr
, "usage: mt [ -t tape ] command [ count ]\n");
if ((strcmp(argv
[1], "-t") == 0) && argc
> 2) {
if ((tape
= getenv("TAPE")) == NULL
)
if ((mtfd
= open(tape
, 2)) < 0) {
if ((mtfd
= open(tape
, 0)) < 0) {
for (comp
= com
; comp
->c_name
!= NULL
; comp
++)
if (strncmp(cp
, comp
->c_name
, strlen(cp
)) == 0)
if (comp
->c_name
== NULL
) {
fprintf(stderr
, "mt: don't grok \"%s\"\n", cp
);
mt_com
.mt_count
= (argc
> 2 ? atoi(argv
[2]) : 1);
mt_com
.mt_op
= comp
->c_code
;
if (ioctl(mtfd
, MTIOCTOP
, &mt_com
) < 0) {
fprintf(stderr
, "%s %d ", comp
->c_name
, mt_com
.mt_count
);