mt.c revision 92921
1/*
2 * Copyright (c) 1980, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD: head/usr.bin/mt/mt.c 92921 2002-03-22 01:33:25Z imp $
34 */
35
36#ifndef lint
37static const char copyright[] =
38"@(#) Copyright (c) 1980, 1993\n\
39	The Regents of the University of California.  All rights reserved.\n";
40#endif /* not lint */
41
42#ifndef lint
43#if 0
44static char sccsid[] = "@(#)mt.c	8.2 (Berkeley) 5/4/95";
45#endif
46static const char rcsid[] =
47  "$FreeBSD: head/usr.bin/mt/mt.c 92921 2002-03-22 01:33:25Z imp $";
48#endif /* not lint */
49
50/*
51 * mt --
52 *   magnetic tape manipulation program
53 */
54#include <sys/types.h>
55#include <sys/ioctl.h>
56#include <sys/mtio.h>
57
58#include <ctype.h>
59#include <err.h>
60#include <fcntl.h>
61#include <stdio.h>
62#include <stdlib.h>
63#include <string.h>
64#include <unistd.h>
65
66/* the appropriate sections of <sys/mtio.h> are also #ifdef'd for FreeBSD */
67/* c_flags */
68#define NEED_2ARGS	0x01
69#define ZERO_ALLOWED	0x02
70#define IS_DENSITY	0x04
71#define DISABLE_THIS	0x08
72#define IS_COMP		0x10
73
74#ifndef TRUE
75#define TRUE 1
76#endif
77#ifndef FALSE
78#define FALSE 0
79#endif
80
81struct commands {
82	char *c_name;
83	int c_code;
84	int c_ronly;
85	int c_flags;
86} com[] = {
87	{ "bsf",	MTBSF,	1 },
88	{ "bsr",	MTBSR,	1 },
89	/* XXX FreeBSD considered "eof" dangerous, since it's being
90	   confused with "eom" (and is an alias for "weof" anyway) */
91	{ "eof",	MTWEOF, 0, DISABLE_THIS },
92	{ "fsf",	MTFSF,	1 },
93	{ "fsr",	MTFSR,	1 },
94	{ "offline",	MTOFFL,	1 },
95	{ "rewind",	MTREW,	1 },
96	{ "rewoffl",	MTOFFL,	1 },
97	{ "status",	MTNOP,	1 },
98	{ "weof",	MTWEOF,	0, ZERO_ALLOWED },
99	{ "erase",	MTERASE, 0, ZERO_ALLOWED},
100	{ "blocksize",	MTSETBSIZ, 0, NEED_2ARGS|ZERO_ALLOWED },
101	{ "density",	MTSETDNSTY, 0, NEED_2ARGS|ZERO_ALLOWED|IS_DENSITY },
102	{ "eom",	MTEOD, 1 },
103	{ "eod",	MTEOD, 1 },
104	{ "smk",	MTWSS, 0 },
105	{ "wss",	MTWSS, 0 },
106	{ "fss",	MTFSS, 1 },
107	{ "bss",	MTBSS, 1 },
108	{ "comp",	MTCOMP, 0, NEED_2ARGS|ZERO_ALLOWED|IS_COMP },
109	{ "retension",	MTRETENS, 1 },
110	{ "rdhpos",     MTIOCRDHPOS,  0 },
111	{ "rdspos",     MTIOCRDSPOS,  0 },
112	{ "sethpos",    MTIOCHLOCATE, 0, NEED_2ARGS|ZERO_ALLOWED },
113	{ "setspos",    MTIOCSLOCATE, 0, NEED_2ARGS|ZERO_ALLOWED },
114	{ "errstat",	MTIOCERRSTAT, 0 },
115	{ "setmodel",	MTIOCSETEOTMODEL, 0, NEED_2ARGS|ZERO_ALLOWED },
116	{ "seteotmodel",	MTIOCSETEOTMODEL, 0, NEED_2ARGS|ZERO_ALLOWED },
117	{ "getmodel",	MTIOCGETEOTMODEL },
118	{ "geteotmodel",	MTIOCGETEOTMODEL },
119	{ NULL }
120};
121
122void printreg(char *, u_int, char *);
123void status(struct mtget *);
124void usage(void);
125void st_status (struct mtget *);
126int stringtodens (const char *s);
127const char *denstostring (int d);
128int denstobp(int d, int bpi);
129u_int32_t stringtocomp(const char *s);
130const char * comptostring(u_int32_t comp);
131void warn_eof(void);
132
133int
134main(argc, argv)
135	int argc;
136	char *argv[];
137{
138	register struct commands *comp;
139	struct mtget mt_status;
140	struct mtop mt_com;
141	int ch, len, mtfd;
142	char *p, *tape;
143
144	if ((tape = getenv("TAPE")) == NULL)
145		tape = DEFTAPE;
146
147	while ((ch = getopt(argc, argv, "f:t:")) != -1)
148		switch(ch) {
149		case 'f':
150		case 't':
151			tape = optarg;
152			break;
153		case '?':
154		default:
155			usage();
156		}
157	argc -= optind;
158	argv += optind;
159
160	if (argc < 1 || argc > 2)
161		usage();
162
163	len = strlen(p = *argv++);
164	for (comp = com;; comp++) {
165		if (comp->c_name == NULL)
166			errx(1, "%s: unknown command", p);
167		if (strncmp(p, comp->c_name, len) == 0)
168			break;
169	}
170	if((comp->c_flags & NEED_2ARGS) && argc != 2)
171		usage();
172	if(comp->c_flags & DISABLE_THIS) {
173		warn_eof();
174	}
175	if ((mtfd = open(tape, comp->c_ronly ? O_RDONLY : O_RDWR)) < 0)
176		err(1, "%s", tape);
177	if (comp->c_code != MTNOP) {
178		mt_com.mt_op = comp->c_code;
179		if (*argv) {
180			if (!isdigit(**argv) &&
181			    (comp->c_flags & IS_DENSITY)) {
182				const char *dcanon;
183				mt_com.mt_count = stringtodens(*argv);
184				if (mt_com.mt_count == 0)
185					errx(1, "%s: unknown density", *argv);
186				dcanon = denstostring(mt_com.mt_count);
187				if (strcmp(dcanon, *argv) != 0)
188					printf(
189					"Using \"%s\" as an alias for %s\n",
190					       *argv, dcanon);
191				p = "";
192			} else if (!isdigit(**argv) &&
193				   (comp->c_flags & IS_COMP)) {
194
195				mt_com.mt_count = stringtocomp(*argv);
196				if ((u_int32_t)mt_com.mt_count == 0xf0f0f0f0)
197					errx(1, "%s: unknown compression",
198					     *argv);
199				p = "";
200			} else
201				/* allow for hex numbers; useful for density */
202				mt_com.mt_count = strtol(*argv, &p, 0);
203			if ((mt_com.mt_count <=
204			    ((comp->c_flags & ZERO_ALLOWED)? -1: 0)
205			    && ((comp->c_flags & IS_COMP) == 0)
206			    ) || *p)
207				errx(1, "%s: illegal count", *argv);
208		}
209		else
210			mt_com.mt_count = 1;
211		switch (comp->c_code) {
212		case MTIOCERRSTAT:
213		{
214			int i;
215			union mterrstat umn;
216			struct scsi_tape_errors *s = &umn.scsi_errstat;
217
218			if (ioctl(mtfd, comp->c_code, (caddr_t)&umn) < 0)
219				err(2, "%s", tape);
220			(void)printf("Last I/O Residual: %u\n", s->io_resid);
221			(void)printf(" Last I/O Command:");
222			for (i = 0; i < sizeof (s->io_cdb); i++)
223				(void)printf(" %02X", s->io_cdb[i]);
224			(void)printf("\n");
225			(void)printf("   Last I/O Sense:\n\n\t");
226			for (i = 0; i < sizeof (s->io_sense); i++) {
227				(void)printf(" %02X", s->io_sense[i]);
228				if (((i + 1) & 0xf) == 0) {
229					(void)printf("\n\t");
230				}
231			}
232			(void)printf("\n");
233			(void)printf("Last Control Residual: %u\n",
234			    s->ctl_resid);
235			(void)printf(" Last Control Command:");
236			for (i = 0; i < sizeof (s->ctl_cdb); i++)
237				(void)printf(" %02X", s->ctl_cdb[i]);
238			(void)printf("\n");
239			(void)printf("   Last Control Sense:\n\n\t");
240			for (i = 0; i < sizeof (s->ctl_sense); i++) {
241				(void)printf(" %02X", s->ctl_sense[i]);
242				if (((i + 1) & 0xf) == 0) {
243					(void)printf("\n\t");
244				}
245			}
246			(void)printf("\n\n");
247			exit(0);
248			/* NOTREACHED */
249		}
250		case MTIOCRDHPOS:
251		case MTIOCRDSPOS:
252		{
253			u_int32_t block;
254			if (ioctl(mtfd, comp->c_code, (caddr_t)&block) < 0)
255				err(2, "%s", tape);
256			(void)printf("%s: %s block location %u\n", tape,
257			    (comp->c_code == MTIOCRDHPOS)? "hardware" :
258			    "logical", block);
259			exit(0);
260			/* NOTREACHED */
261		}
262		case MTIOCSLOCATE:
263		case MTIOCHLOCATE:
264		{
265			u_int32_t block = (u_int32_t)mt_com.mt_count;
266			if (ioctl(mtfd, comp->c_code, (caddr_t)&block) < 0)
267				err(2, "%s", tape);
268			exit(0);
269			/* NOTREACHED */
270		}
271		case MTIOCGETEOTMODEL:
272		{
273			u_int32_t om;
274			if (ioctl(mtfd, MTIOCGETEOTMODEL, (caddr_t)&om) < 0)
275				err(2, "%s", tape);
276			(void)printf("%s: the model is %u filemar%s at EOT\n",
277			    tape, om, (om > 1)? "ks" : "k");
278			exit(0);
279			/* NOTREACHED */
280		}
281		case MTIOCSETEOTMODEL:
282		{
283			u_int32_t om, nm = (u_int32_t)mt_com.mt_count;
284			if (ioctl(mtfd, MTIOCGETEOTMODEL, (caddr_t)&om) < 0)
285				err(2, "%s", tape);
286			if (ioctl(mtfd, comp->c_code, (caddr_t)&nm) < 0)
287				err(2, "%s", tape);
288			(void)printf("%s: old model was %u filemar%s at EOT\n",
289			    tape, om, (om > 1)? "ks" : "k");
290			(void)printf("%s: new model  is %u filemar%s at EOT\n",
291			    tape, nm, (nm > 1)? "ks" : "k");
292			exit(0);
293			/* NOTREACHED */
294		}
295		default:
296			break;
297		}
298		if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0)
299			err(1, "%s: %s", tape, comp->c_name);
300	} else {
301		if (ioctl(mtfd, MTIOCGET, &mt_status) < 0)
302			err(1, NULL);
303		status(&mt_status);
304	}
305	exit(0);
306	/* NOTREACHED */
307}
308
309#if defined(__i386__)
310#include <machine/wtio.h>
311#endif
312
313struct tape_desc {
314	short	t_type;		/* type of magtape device */
315	char	*t_name;	/* printing name */
316	char	*t_dsbits;	/* "drive status" register */
317	char	*t_erbits;	/* "error" register */
318} tapes[] = {
319	/*
320	 * XXX This is weird.  The st driver reports the tape drive
321	 * as 0x7 (MT_ISAR - Sun/Archive compatible); the wt driver
322	 * either reports MT_ISVIPER1 for an Archive tape, or 0x11
323	 * (MT_ISMFOUR) for other tapes.
324	 * XXX for the wt driver, rely on it behaving like a "standard"
325	 * magtape driver.
326	 */
327	{ MT_ISAR,	"SCSI tape drive", 0,		0 },
328#if defined (__i386__)
329	{ MT_ISVIPER1,	"Archive Viper", WTDS_BITS, WTER_BITS },
330	{ MT_ISMFOUR,	"Wangtek",	 WTDS_BITS, WTER_BITS },
331#endif
332	{ 0 }
333};
334
335/*
336 * Interpret the status buffer returned
337 */
338void
339status(bp)
340	register struct mtget *bp;
341{
342	register struct tape_desc *mt;
343
344	for (mt = tapes;; mt++) {
345		if (mt->t_type == 0) {
346			(void)printf("%d: unknown tape drive type\n",
347			    bp->mt_type);
348			return;
349		}
350		if (mt->t_type == bp->mt_type)
351			break;
352	}
353	if(mt->t_type == MT_ISAR)
354		st_status(bp);
355	else {
356		(void)printf("%s tape drive, residual=%d\n",
357		    mt->t_name, bp->mt_resid);
358		printreg("ds", (unsigned short)bp->mt_dsreg, mt->t_dsbits);
359		printreg("\ner", (unsigned short)bp->mt_erreg, mt->t_erbits);
360		(void)putchar('\n');
361	}
362}
363
364/*
365 * Print a register a la the %b format of the kernel's printf.
366 */
367void
368printreg(s, v, bits)
369	char *s;
370	register u_int v;
371	register char *bits;
372{
373	register int i, any = 0;
374	register char c;
375
376	if (bits && *bits == 8)
377		printf("%s=%o", s, v);
378	else
379		printf("%s=%x", s, v);
380	if (!bits)
381		return;
382	bits++;
383	if (v && bits) {
384		putchar('<');
385		while ((i = *bits++)) {
386			if (v & (1 << (i-1))) {
387				if (any)
388					putchar(',');
389				any = 1;
390				for (; (c = *bits) > 32; bits++)
391					putchar(c);
392			} else
393				for (; *bits > 32; bits++)
394					;
395		}
396		putchar('>');
397	}
398}
399
400void
401usage()
402{
403	(void)fprintf(stderr, "usage: mt [-f device] command [ count ]\n");
404	exit(1);
405}
406
407struct densities {
408	int dens;
409	int bpmm;
410	int bpi;
411	const char *name;
412} dens[] = {
413	/*
414	 * Taken from T10 Project 997D
415	 * SCSI-3 Stream Device Commands (SSC)
416	 * Revision 11, 4-Nov-97
417	 */
418	/*Num.  bpmm    bpi     Reference     */
419	{ 0x1,	32,	800,	"X3.22-1983" },
420	{ 0x2,	63,	1600,	"X3.39-1986" },
421	{ 0x3,	246,	6250,	"X3.54-1986" },
422	{ 0x5,	315,	8000,	"X3.136-1986" },
423	{ 0x6,	126,	3200,	"X3.157-1987" },
424	{ 0x7,	252,	6400,	"X3.116-1986" },
425	{ 0x8,	315,	8000,	"X3.158-1987" },
426	{ 0x9,	491,	37871,	"X3.180" },
427	{ 0xA,	262,	6667,	"X3B5/86-199" },
428	{ 0xB,	63,	1600,	"X3.56-1986" },
429	{ 0xC,	500,	12690,	"HI-TC1" },
430	{ 0xD,	999,	25380,	"HI-TC2" },
431	{ 0xF,	394,	10000,	"QIC-120" },
432	{ 0x10,	394,	10000,	"QIC-150" },
433	{ 0x11,	630,	16000,	"QIC-320" },
434	{ 0x12,	2034,	51667,	"QIC-1350" },
435	{ 0x13,	2400,	61000,	"X3B5/88-185A" },
436	{ 0x14,	1703,	43245,	"X3.202-1991" },
437	{ 0x15,	1789,	45434,	"ECMA TC17" },
438	{ 0x16,	394,	10000,	"X3.193-1990" },
439	{ 0x17,	1673,	42500,	"X3B5/91-174" },
440	{ 0x18,	1673,	42500,	"X3B5/92-50" },
441	{ 0x1C, 1654,	42000,	"QIC-385M" },
442	{ 0x1D,	1512,	38400,	"QIC-410M" },
443	{ 0x1E, 1385,	36000,	"QIC-1000C" },
444	{ 0x1F,	2666,	67733,	"QIC-2100C" },
445	{ 0x20, 2666,	67733,	"QIC-6GB(M)" },
446	{ 0x21,	2666,	67733,	"QIC-20GB(C)" },
447	{ 0x22,	1600,	40640,	"QIC-2GB(C)" },
448	{ 0x23, 2666,	67733,	"QIC-875M" },
449	{ 0x24,	2400,	61000,	"DDS-2" },
450	{ 0x25,	3816,	97000,	"DDS-3" },
451	{ 0x26,	3816,	97000,	"DDS-4" },
452	{ 0x27,	3056,	77611,	"Mammoth" },
453	{ 0x28,	1491,	37871,	"X3.224" },
454	{ 0, 0, 0, NULL }
455};
456
457struct compression_types {
458	u_int32_t	comp_number;
459	const char 	*name;
460} comp_types[] = {
461	{ 0x00, "none" },
462	{ 0x00, "off" },
463	{ 0x10, "IDRC" },
464	{ 0x20, "DCLZ" },
465	{ 0xffffffff, "enable" },
466	{ 0xffffffff, "on" },
467	{ 0xf0f0f0f0, NULL}
468};
469
470const char *
471denstostring(int d)
472{
473	static char buf[20];
474	struct densities *sd;
475
476	/* densities 0 and 0x7f are handled as special cases */
477	if (d == 0)
478		return "default";
479	if (d == 0x7f)
480		return "same";
481	for (sd = dens; sd->dens; sd++)
482		if (sd->dens == d)
483			break;
484	if (sd->dens == 0)
485		sprintf(buf, "0x%02x", d);
486	else
487		sprintf(buf, "0x%02x:%s", d, sd->name);
488	return buf;
489}
490
491/*
492 * Given a specific density number, return either the bits per inch or bits
493 * per millimeter for the given density.
494 */
495int
496denstobp(int d, int bpi)
497{
498	struct densities *sd;
499
500	for (sd = dens; sd->dens; sd++)
501		if (sd->dens == d)
502			break;
503	if (sd->dens == 0)
504		return(0);
505	else {
506		if (bpi)
507			return(sd->bpi);
508		else
509			return(sd->bpmm);
510	}
511}
512
513int
514stringtodens(const char *s)
515{
516	struct densities *sd;
517	size_t l = strlen(s);
518
519	for (sd = dens; sd->dens; sd++)
520		if (strncasecmp(sd->name, s, l) == 0)
521			break;
522	return sd->dens;
523}
524
525
526const char *
527getblksiz(int bs)
528{
529	static char buf[25];
530	if (bs == 0)
531		return "variable";
532	else {
533		sprintf(buf, "%d bytes", bs);
534		return buf;
535	}
536}
537
538const char *
539comptostring(u_int32_t comp)
540{
541	static char buf[20];
542	struct compression_types *ct;
543
544	if (comp == MT_COMP_DISABLED)
545		return "disabled";
546	else if (comp == MT_COMP_UNSUPP)
547		return "unsupported";
548
549	for (ct = comp_types; ct->name; ct++)
550		if (ct->comp_number == comp)
551			break;
552
553	if (ct->comp_number == 0xf0f0f0f0) {
554		sprintf(buf, "0x%x", comp);
555		return(buf);
556	} else
557		return(ct->name);
558}
559
560u_int32_t
561stringtocomp(const char *s)
562{
563	struct compression_types *ct;
564	size_t l = strlen(s);
565
566	for (ct = comp_types; ct->name; ct++)
567		if (strncasecmp(ct->name, s, l) == 0)
568			break;
569
570	return(ct->comp_number);
571}
572
573void
574st_status(struct mtget *bp)
575{
576	printf("Mode      Density              Blocksize      bpi      "
577	       "Compression\n"
578	       "Current:  %-17s    %-12s   %-7d  %s\n"
579	       "---------available modes---------\n"
580	       "0:        %-17s    %-12s   %-7d  %s\n"
581	       "1:        %-17s    %-12s   %-7d  %s\n"
582	       "2:        %-17s    %-12s   %-7d  %s\n"
583	       "3:        %-17s    %-12s   %-7d  %s\n",
584	       denstostring(bp->mt_density), getblksiz(bp->mt_blksiz),
585	       denstobp(bp->mt_density, TRUE), comptostring(bp->mt_comp),
586	       denstostring(bp->mt_density0), getblksiz(bp->mt_blksiz0),
587	       denstobp(bp->mt_density0, TRUE), comptostring(bp->mt_comp0),
588	       denstostring(bp->mt_density1), getblksiz(bp->mt_blksiz1),
589	       denstobp(bp->mt_density1, TRUE), comptostring(bp->mt_comp1),
590	       denstostring(bp->mt_density2), getblksiz(bp->mt_blksiz2),
591	       denstobp(bp->mt_density2, TRUE), comptostring(bp->mt_comp2),
592	       denstostring(bp->mt_density3), getblksiz(bp->mt_blksiz3),
593	       denstobp(bp->mt_density3, TRUE), comptostring(bp->mt_comp3));
594
595	if (bp->mt_dsreg != MTIO_DSREG_NIL) {
596		auto char foo[32];
597		const char sfmt[] = "Current Driver State: %s.\n";
598		printf("---------------------------------\n");
599		switch (bp->mt_dsreg) {
600		case MTIO_DSREG_REST:
601			printf(sfmt, "at rest");
602			break;
603		case MTIO_DSREG_RBSY:
604			printf(sfmt, "Communicating with drive");
605			break;
606		case MTIO_DSREG_WR:
607			printf(sfmt, "Writing");
608			break;
609		case MTIO_DSREG_FMK:
610			printf(sfmt, "Writing Filemarks");
611			break;
612		case MTIO_DSREG_ZER:
613			printf(sfmt, "Erasing");
614			break;
615		case MTIO_DSREG_RD:
616			printf(sfmt, "Reading");
617			break;
618		case MTIO_DSREG_FWD:
619			printf(sfmt, "Spacing Forward");
620			break;
621		case MTIO_DSREG_REV:
622			printf(sfmt, "Spacing Reverse");
623			break;
624		case MTIO_DSREG_POS:
625			printf(sfmt,
626			    "Hardware Positioning (direction unknown)");
627			break;
628		case MTIO_DSREG_REW:
629			printf(sfmt, "Rewinding");
630			break;
631		case MTIO_DSREG_TEN:
632			printf(sfmt, "Retensioning");
633			break;
634		case MTIO_DSREG_UNL:
635			printf(sfmt, "Unloading");
636			break;
637		case MTIO_DSREG_LD:
638			printf(sfmt, "Loading");
639			break;
640		default:
641			(void) sprintf(foo, "Unknown state 0x%x", bp->mt_dsreg);
642			printf(sfmt, foo);
643			break;
644		}
645	}
646	if (bp->mt_resid == 0 && bp->mt_fileno == (daddr_t) -1 &&
647	    bp->mt_blkno == (daddr_t) -1)
648		return;
649	printf("---------------------------------\n");
650	printf("File Number: %ld\tRecord Number: %ld\tResidual Count %d\n",
651	    bp->mt_fileno, bp->mt_blkno, bp->mt_resid);
652}
653
654void
655warn_eof(void)
656{
657	fprintf(stderr,
658		"The \"eof\" command has been disabled.\n"
659		"Use \"weof\" if you really want to write end-of-file marks,\n"
660		"or \"eom\" if you rather want to skip to the end of "
661		"recorded medium.\n");
662	exit(1);
663}
664