xref: /original-bsd/sys/tahoe/stand/vdformat/list.c (revision 50dd0bba)
1 #ifndef lint
2 static char sccsid[] = "@(#)list.c	1.2 (Berkeley/CCI) 11/23/87";
3 #endif
4 
5 #include	"vdfmt.h"
6 
7 
8 /*
9 **	Lists all the operations specified so far.
10 */
11 
12 list()
13 {
14 	register int	ctlr, drive;
15 	boolean		can_do = false;
16 
17 	/* Determine if there are any operations to do */
18 	for(ctlr=0; ctlr<MAXCTLR; ctlr++)
19 		for(drive=0; drive<MAXDRIVE; drive++) {
20 			if(ops_to_do[ctlr][drive].op)
21 				can_do = true;
22 		}
23 	if(can_do == false) {
24 		indent();
25 		print("There are no operations to list!\n\n");
26 		exdent(1);
27 		return;
28 	}
29 	indent();
30 	print("The following operations will occur when Start is issued:\n");
31 	indent();
32 	for(ctlr=0; ctlr<MAXCTLR; ctlr++)
33 		for(drive=0; drive<MAXDRIVE; drive++)
34 			if(ops_to_do[ctlr][drive].op != 0) {
35 				print("");  /* force an indent */
36 				display_operations(ctlr, drive);
37 			}
38 	exdent(2);
39 }
40 
41 
42 /*
43 **
44 */
45 
46 display_operations(ctlr, drive)
47 register int	ctlr, drive;
48 {
49 	print_op_list(ops_to_do[ctlr][drive].op);
50 	printf(": Controller %d, drive %d", ctlr, drive);
51 	printf(", type %s.\n", d_info[ctlr][drive].label.d_typename);
52 }
53 
54 
55 /*
56 **
57 */
58 
59 print_op_list(ops)
60 int	ops;
61 {
62 	register int	cur_op;
63 	char		*prefix = "";
64 
65 	for(cur_op=0; cur_op<NUMOPS; cur_op++) {
66 		if(ops & (1 << cur_op)) {
67 			printf("%s%s", prefix, operations[cur_op].op_name);
68 			prefix = ", ";
69 		}
70 	}
71 }
72 
73