xref: /original-bsd/sys/luna68k/stand/tape.c (revision 28a62f4d)
1 /*
2  * Copyright (c) 1992 OMRON Corporation.
3  * Copyright (c) 1992, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * OMRON Corporation.
8  *
9  * %sccs.include.redist.c%
10  *
11  *	@(#)tape.c	8.1 (Berkeley) 06/10/93
12  */
13 
14 /*
15  * tape.c -- operation commands for TAPE unit.
16  * by A.Fujita, APR-14-1992
17  */
18 
19 #include <sys/param.h>
20 #include <luna68k/stand/status.h>
21 
22 dev_t  rst0 = 0x0000;
23 dev_t nrst0 = 0x0004;
24 
25 u_char buff[512];
26 
27 int
tape(argc,argv)28 tape(argc, argv)
29 	int   argc;
30 	char *argv[];
31 {
32 	int size, count;
33 	u_long *p = (u_long *) buff;
34 
35 	if (!strcmp(argv[1], "read")) {
36 		count = 0;
37 		while ((size = stread(rst0, buff, 512)) == 512)
38 			count++;
39 		printf("tape: size  = %d\n", size);
40 		printf("tape: count = %d\n", count);
41 	} else if (!strcmp(argv[1], "write")) {
42 		for (count = 0; count < 500; count++) {
43 			if ((size = stwrite(rst0, buff, 512)) != 512)
44 				break;
45 		}
46 		printf("tape: size  = %d\n", size);
47 		printf("tape: count = %d\n", count);
48 	} else if (!strcmp(argv[1], "rewind")) {
49 		st_rewind(rst0);
50 	} else if (!strcmp(argv[1], "weof")) {
51 		st_write_EOF(rst0);
52 	} else if (!strcmp(argv[1], "skip")) {
53 		st_skip(rst0);
54 	} else {
55 		return(ST_ERROR);
56 	}
57 
58 	return(ST_NORMAL);
59 }
60