xref: /original-bsd/sys/tahoe/stand/vdformat/delete.c (revision 08eb28af)
1 #ifndef lint
2 static char sccsid[] = "@(#)delete.c	1.1 (Berkeley/CCI) 07/05/86";
3 #endif
4 
5 #include	"vdfmt.h"
6 #include	"cmd.h"
7 
8 /*
9 **
10 */
11 static int	line = 0;
12 
13 
14 delete_help()
15 {
16 	indent();
17 	print("The following commands are available:\n");
18 	indent();
19 	print("STATus - Display formatter state.\n");
20 	print("QUIT   - Terminate current operation.\n");
21 	print("");
22 	print("Any line number between 0 and %d may be entered.\n", line-1);
23 	print("");
24 	exdent(2);
25 }
26 
27 
28 delete()
29 {
30 	register int	ctlr, drive;
31 	int		*table[(MAXCTLR * MAXDRIVE) + 50];
32 	int		list[(MAXCTLR * MAXDRIVE) + 50];
33 	int		tokens[(MAXCTLR * MAXDRIVE) + 50];
34 	int		*tok;
35 
36 	indent();
37 	indent();
38 	line = 0;
39 	for(ctlr=0; ctlr<MAXCTLR; ctlr++)
40 		for(drive=0; drive<MAXDRIVE; drive++)
41 			if(ops_to_do[ctlr][drive].op) {
42 				table[line] = &ops_to_do[ctlr][drive].op;
43 				list[line] = line;
44 				print("%d) ", line++);
45 				display_operations(ctlr, drive);
46 			}
47 	list[line] = -1;
48 	exdent(1);
49 	if(line > 1) {
50 		for(;;) {
51 			print("Delete line? ");
52 			get_digit_list(tokens, list, delete_help);
53 			if(kill_processes == true) {
54 				kill_processes = false;
55 				break;
56 			}
57 			indent();
58 			tok = tokens;
59 			for(tok=tokens; *tok != -1; tok++) {
60 				if(*table[*tok] != 0) {
61 					print("Line %d has been deleted.\n",*tok);
62 					*table[*tok] = 0;
63 				}
64 			}
65 			exdent(1);
66 		}
67 	}
68 	else if(line == 1) {
69 		print("Line 0 deleted since it was the only line possible.\n");
70 		*table[0] = 0;
71 	}
72 	else {
73 		print("Nothing to delete.\n");
74 	}
75 	exdent(1);
76 }
77