xref: /csrg-svn/sys/tahoe/stand/vdformat/list.c (revision 32662)
129532Ssam #ifndef lint
2*32662Skarels static char sccsid[] = "@(#)list.c	1.2 (Berkeley/CCI) 11/23/87";
329532Ssam #endif
429532Ssam 
529532Ssam #include	"vdfmt.h"
629532Ssam 
729532Ssam 
829532Ssam /*
929532Ssam **	Lists all the operations specified so far.
1029532Ssam */
1129532Ssam 
list()1229532Ssam list()
1329532Ssam {
1429532Ssam 	register int	ctlr, drive;
1529532Ssam 	boolean		can_do = false;
1629532Ssam 
1729532Ssam 	/* Determine if there are any operations to do */
1829532Ssam 	for(ctlr=0; ctlr<MAXCTLR; ctlr++)
1929532Ssam 		for(drive=0; drive<MAXDRIVE; drive++) {
2029532Ssam 			if(ops_to_do[ctlr][drive].op)
2129532Ssam 				can_do = true;
2229532Ssam 		}
2329532Ssam 	if(can_do == false) {
2429532Ssam 		indent();
2529532Ssam 		print("There are no operations to list!\n\n");
2629532Ssam 		exdent(1);
2729532Ssam 		return;
2829532Ssam 	}
2929532Ssam 	indent();
3029532Ssam 	print("The following operations will occur when Start is issued:\n");
3129532Ssam 	indent();
3229532Ssam 	for(ctlr=0; ctlr<MAXCTLR; ctlr++)
3329532Ssam 		for(drive=0; drive<MAXDRIVE; drive++)
3429532Ssam 			if(ops_to_do[ctlr][drive].op != 0) {
3529532Ssam 				print("");  /* force an indent */
3629532Ssam 				display_operations(ctlr, drive);
3729532Ssam 			}
3829532Ssam 	exdent(2);
3929532Ssam }
4029532Ssam 
4129532Ssam 
4229532Ssam /*
4329532Ssam **
4429532Ssam */
4529532Ssam 
display_operations(ctlr,drive)4629532Ssam display_operations(ctlr, drive)
4729532Ssam register int	ctlr, drive;
4829532Ssam {
4929532Ssam 	print_op_list(ops_to_do[ctlr][drive].op);
5029532Ssam 	printf(": Controller %d, drive %d", ctlr, drive);
51*32662Skarels 	printf(", type %s.\n", d_info[ctlr][drive].label.d_typename);
5229532Ssam }
5329532Ssam 
5429532Ssam 
5529532Ssam /*
5629532Ssam **
5729532Ssam */
5829532Ssam 
print_op_list(ops)5929532Ssam print_op_list(ops)
6029532Ssam int	ops;
6129532Ssam {
6229532Ssam 	register int	cur_op;
6329532Ssam 	char		*prefix = "";
6429532Ssam 
6529532Ssam 	for(cur_op=0; cur_op<NUMOPS; cur_op++) {
6629532Ssam 		if(ops & (1 << cur_op)) {
6729532Ssam 			printf("%s%s", prefix, operations[cur_op].op_name);
6829532Ssam 			prefix = ", ";
6929532Ssam 		}
7029532Ssam 	}
7129532Ssam }
7229532Ssam 
73