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