summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FDISK/D_MENUS.C
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/CMD/FDISK/D_MENUS.C')
-rw-r--r--v4.0/src/CMD/FDISK/D_MENUS.C941
1 files changed, 941 insertions, 0 deletions
diff --git a/v4.0/src/CMD/FDISK/D_MENUS.C b/v4.0/src/CMD/FDISK/D_MENUS.C
new file mode 100644
index 0000000..3ebfff9
--- /dev/null
+++ b/v4.0/src/CMD/FDISK/D_MENUS.C
@@ -0,0 +1,941 @@
1
2#include "dos.h" /* AN000 */
3#include "fdisk.h" /* AN000 */
4#include "extern.h" /* AN000 */
5#include "subtype.h" /* AN000 */
6#include "fdiskmsg.h" /* AN000 */
7#include "string.h" /* AN000 */
8#include "ctype.h" /* AN000 */
9#include "stdio.h" /* AN000 */
10
11/* */
12/******************* START OF SPECIFICATIONS *******************/
13/* */
14/* SUBROUTINE NAME: DELETE_PARTITION */
15/* */
16/* DESCRIPTIVE NAME: Delete partition selection menu */
17/* */
18/* FUNCTION: User is prompted as to what type of DOS partition */
19/* he wishes to delete. */
20/* */
21/* NOTES: The delete volume option is only displayed if some */
22/* disk volumes exist */
23/* */
24/* The following screen is managed */
25/* */
26/* ³0000000000111111111122222222223333333333³ */
27/* ³0123456789012345678901234567890123456789³ */
28/* ÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ */
29/* 00³ ³ */
30/* 01³ ³ */
31/* 02³ ³ */
32/* 03³ ³ */
33/* 04³Delete DOS Partition ³ */
34/* 05³ ³ */
35/* 06³Current Fixed Disk Drive: # ³ */
36/* 07³ ³ */
37/* 08³Enter the type of DOS partition you ³ */
38/* 09³wish to delete..............? ³ */
39/* 10³ ³ */
40/* 11³ 1. Normal DOS partition ³ */
41/* 12³ 2. EXTENDED DOS Partition ³ */
42/* 13³ 3. Disk volume in the EXTENDED ³ */
43/* 14³ DOS Partition ³ */
44/* 15³ ³ */
45/* 16³ ³ */
46/* 17³ ³ */
47/* 18³Enter choice: [#] ³ */
48/* 19³ ³ */
49/* 20³ ³ */
50/* 21³ ³ */
51/* 22³ ³ */
52/* 23³Press ESC to return to FDISK Options ³ */
53/* ÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ */
54/* */
55/* ENTRY POINTS: Delete_Partition */
56/* LINKAGE: delete_partition() */
57/* NEAR CALL */
58/* */
59/* INPUT: None */
60/* */
61/* EXIT-NORMAL: ERROR=FALSE */
62/* */
63/* EXIT-ERROR: ERROR=TRUE */
64/* GOTO internal_program_error if case statement */
65/* failure when branching to requested function */
66/* */
67/* EFFECTS: No data directly modified by this routine, but */
68/* child routines will modify data. */
69/* */
70/* INTERNAL REFERENCES: */
71/* ROUTINES: */
72/* clear_screen */
73/* wait_for_ESC */
74/* get_num_input */
75/* internal_program_error */
76/* dos_delete */
77/* ext_delete */
78/* vol_delete */
79/* */
80/* EXTERNAL REFERENCES: */
81/* ROUTINES: */
82/* */
83/******************** END OF SPECIFICATIONS ********************/
84
85/* */
86void delete_partition()
87
88BEGIN
89
90 unsigned i;
91 char input;
92 char temp;
93 char max_input;
94
95
96 input = c(NUL); /* AC000 */
97 /* clear_screen */
98 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
99
100 /* Display header */
101 display(menu_25);
102
103 /* Setup and print current disk */
104 insert[0] = cur_disk+1+'0';
105 display(menu_5);
106
107 /* print ESC prompt */
108 display(menu_11);
109
110 /* check to see if there is an avail partition */
111 temp = c(0); /* AC000 */
112 for (i = u(0); i < u(4);i++) /* AC000 */
113 BEGIN
114
115 /* See if any non - zero system id bytes */
116 temp = temp | part_table[cur_disk][i].sys_id ;
117 END
118 /* Any entry that isn't zero means */
119 if (temp != c(0)) /* AC000 */
120 BEGIN
121 /* ############# ADD CODE HERE FOR THIS FUNCTION ############## */
122 /* Do something about defaults and highlighting */
123 /* */
124 /* ############################################################ */
125
126 /* Display enter prompts */
127 /* display dos delete menu without input prompt */
128 display(menu_3);
129 display(menu_25);
130 display(menu_26);
131 display(menu_7);
132
133 display(menu_27); /* AC000 */
134 max_input = c(3); /* AC000 */
135
136 input = get_num_input(c(NUL),max_input,input_row,input_col); /* AC000 */
137 /* Go branch to the requested function */
138 switch(input)
139 BEGIN
140 case '1':
141 if (find_partition_type(uc(DOS12)) || /* AN016 AC016 */
142 find_partition_type(uc(DOS16)) || /* AN016 AC016 */
143 find_partition_type(uc(DOSNEW))) /* AN016 AC016 */
144 dos_delete();
145 else /* AN000 */
146 BEGIN /* AN000 */
147 /* No Pri partition to delete */
148 clear_screen(u(17),u(0),u(17),u(79)); /* AN000 */
149 display(error_6); /* AN000 */
150 wait_for_ESC(); /* AN000 */
151 END /* AN000 */
152 break;
153
154 case '2':
155 if (find_partition_type(uc(EXTENDED))) /* AN000 */
156 ext_delete();
157 else /* AN000 */
158 BEGIN /* AN000 */
159 /* No Ext partition to delete */
160 clear_screen(u(17),u(0),u(17),u(79)); /* AN000 */
161 display(error_7); /* AN000 */
162 wait_for_ESC(); /* AN000 */
163 END /* AN000 */
164 break;
165
166 case '3':
167 if ((find_partition_type(uc(EXTENDED))) && (find_logical_drive())) /* AC000 */
168 volume_delete();
169 else
170 BEGIN
171 clear_screen(u(17),u(0),u(17),u(79)); /* AN000 */
172 display(error_36); /* AN000 */
173 wait_for_ESC(); /* AN000 */
174 END /* AN000 */
175 break;
176
177 case ESC: break;
178
179 default : internal_program_error();
180 break;
181 END
182 END
183 else
184 BEGIN
185 display(error_14);
186 wait_for_ESC();
187 END
188 /* clear the screen before going back to main menu */
189 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
190 return;
191END
192
193
194/* */
195/******************* START OF SPECIFICATIONS *******************/
196/* */
197/* SUBROUTINE NAME: DOS_DELETE */
198/* */
199/* DESCRIPTIVE NAME: Delete DOS partition */
200/* */
201/* FUNCTION: Delete the DOS partition. Prompt user with dire */
202/* warning first. Default entry on prompt is (N) */
203/* */
204/* NOTES: Screen can be exited via the ESC command before */
205/* partition is deleted and nothing will change */
206/* */
207/* The following screen is managed */
208/* */
209/* ³0000000000111111111122222222223333333333³ */
210/* ³0123456789012345678901234567890123456789³ */
211/* ÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ */
212/* 00³ ³ */
213/* 01³ ³ */
214/* 02³ ³ */
215/* 03³ ³ */
216/* 04³Delete DOS Partition ³ */
217/* 05³ ³ */
218/* 06³Current Fixed Disk Drive: # ³ */
219/* 07³ ³ */
220/* 08³Partition Status Type Start End Size³ */
221/* 09³ # # ####### #### #### ####³ */
222/* 10³ ³ */
223/* 11³ ³ */
224/* 12³ ³ */
225/* 13³ ³ */
226/* 14³Total disk space is #### cylinders. ³ */
227/* 15³ ³ */
228/* 16³ ³ */
229/* 17³ ³ */
230/* 18³Warning! Data in the DOS partition ³ */
231/* 19³will be lost. Do you wish to ³ */
232/* 20³continue..........................? [N] ³ */
233/* 21³ ³ */
234/* 22³ ³ */
235/* 23³Press ESC to return to FDISK Options ³ */
236/* ÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ */
237/* */
238/* ENTRY POINTS: DOS_Delete */
239/* LINKAGE: dos_delete */
240/* NEAR CALL */
241/* */
242/* INPUT: None */
243/* */
244/* EXIT-NORMAL: ERROR=FALSE */
245/* */
246/* EXIT-ERROR: ERROR=TRUE */
247/* GOTO internal_program_error if invalid input */
248/* returned to this level */
249/* */
250/* EFFECTS: No data directly modified by this routine, but */
251/* child routines will modify data. */
252/* */
253/* INTERNAL REFERENCES: */
254/* ROUTINES */
255/* table_display */
256/* clear_screen */
257/* wait_for_ESC */
258/* get_yn_input */
259/* display */
260/* Write_Boot_Record */
261/* find_part_free_space */
262/* */
263/* EXTERNAL REFERENCES: */
264/* ROUTINES: */
265/* */
266/******************** END OF SPECIFICATIONS ********************/
267
268/* */
269void dos_delete()
270
271BEGIN
272
273 char input;
274 unsigned i;
275
276
277 input = c(NUL); /* AC000 */
278 /* clear screen */
279 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
280
281 /* Display header */
282 display(menu_28);
283
284 /* Setup and print current disk */
285 insert[0] = cur_disk+1+'0';
286 display(menu_5);
287
288 /* print ESC prompt */
289 display(menu_11);
290
291 /* Display partition data and double check if partition exists*/
292 if (table_display())
293 BEGIN
294
295 sprintf(insert,"%4.0d",total_mbytes[cur_disk]);
296 display(menu_15);
297
298 /* See if drive 1 and extended partition exists */
299
300 if (!(find_partition_type(uc(EXTENDED)) && (cur_disk == c(0)))) /* AC000 */
301 BEGIN
302
303 /* Nope, we can keep going */
304 /* Display Y/N prompt */
305 display(menu_29);
306
307 /* Get yes/no prompt */
308 input = get_yn_input(c(No),input_row,input_col); /* AC000 AC011 */
309 switch(input)
310 BEGIN
311 case 1: /* AC000 */
312 BEGIN
313 for (i=u(0); i < u(4); i++) /* AC000 */
314 BEGIN
315
316 if ( (part_table[cur_disk][i].sys_id==uc(DOS12)) ||
317 (part_table[cur_disk][i].sys_id==uc(DOS16)) ||
318 (part_table[cur_disk][i].sys_id==uc(DOSNEW)) ) /* AC000 */
319
320 BEGIN
321 /* Set Partition entry to zero */
322 part_table[cur_disk][i].boot_ind = uc(0); /* AC000 */
323 part_table[cur_disk][i].start_head = uc(0); /* AC000 */
324 part_table[cur_disk][i].start_sector = uc(0); /* AC000 */
325 part_table[cur_disk][i].start_cyl = u(0); /* AC000 */
326 part_table[cur_disk][i].sys_id = uc(0); /* AC000 */
327 part_table[cur_disk][i].end_head = uc(0); /* AC000 */
328 part_table[cur_disk][i].end_sector = uc(0); /* AC000 */
329 part_table[cur_disk][i].end_cyl = u(0); /* AC000 */
330 part_table[cur_disk][i].rel_sec = ul(0); /* AC000 */
331 part_table[cur_disk][i].num_sec = ul(0); /* AC000 */
332 part_table[cur_disk][i].changed = (FLAG)TRUE; /* AC000 */
333 part_table[cur_disk][i].mbytes_used = f(0); /* AN000 */
334 part_table[cur_disk][i].percent_used = u(0); /* AN000 */
335
336 strcpy(part_table[cur_disk][i].system,c(NUL)); /* AN000 */
337 strcpy(part_table[cur_disk][i].vol_label,c(NUL)); /* AN000 */
338
339 /* Redisplay the partition info */
340 table_display();
341
342 /* clear the prompt off */
343 clear_screen(u(16),u(0),u(23),u(79)); /* AC000 */
344
345 /* Set the reboot flag */
346 reboot_flag = (FLAG)TRUE; /* AC000 */
347
348 /* Say that you deleted it */
349 display(status_1);
350
351 wait_for_ESC();
352 break;
353 END
354 END
355 END
356 break;
357
358 case 0: break; /* AC000 */
359
360 case ESC: break;
361
362 default:
363 BEGIN
364 internal_program_error();
365 break;
366 END
367 END
368 END
369 else
370 BEGIN
371 /* Tell user he can't do it while extended exists on drive 1 */
372 display(error_32);
373 wait_for_ESC();
374 END
375 END
376
377 else
378 BEGIN
379 internal_program_error();
380 END
381 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
382 return;
383END
384
385
386/* */
387/******************* START OF SPECIFICATIONS *******************/
388/* */
389/* SUBROUTINE NAME: EXT_DELETE */
390/* */
391/* DESCRIPTIVE NAME: Delete EXTENDED DOS partition */
392/* */
393/* FUNCTION: Delete the EXTENDED DOS partition. Prompt with */
394/* warning first. Default entry on prompt is (N) */
395/* */
396/* NOTES: Screen can be exited via the ESC command before */
397/* partition is deleted and nothing will change */
398/* */
399/* The following screen is managed */
400/* */
401/* ³0000000000111111111122222222223333333333³ */
402/* ³0123456789012345678901234567890123456789³ */
403/* ÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ */
404/* 00³ ³ */
405/* 01³ ³ */
406/* 02³ ³ */
407/* 03³ ³ */
408/* 04³Delete EXTENDED DOS Partition ³ */
409/* 05³ ³ */
410/* 06³Current Fixed Disk Drive: # ³ */
411/* 07³ ³ */
412/* 08³Partition Status Type Start End Size³ */
413/* 09³ # # ####### #### #### ####³ */
414/* 10³ ³ */
415/* 11³ ³ */
416/* 12³ ³ */
417/* 13³ ³ */
418/* 14³Total disk space is #### cylinders. ³ */
419/* 15³ ³ */
420/* 16³ ³ */
421/* 17³ ³ */
422/* 18³Warning! Data in the EXTENDED DOS ³ */
423/* 19³partition will be lost. Do you wish ³ */
424/* 20³to continue.......................? [N] ³ */
425/* 21³ ³ */
426/* 22³ ³ */
427/* 23³Press ESC to return to FDISK Options ³ */
428/* ÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ */
429/* */
430/* ENTRY POINTS: Ext_Delete */
431/* LINKAGE: ext_delete () */
432/* NEAR CALL */
433/* */
434/* INPUT: None */
435/* */
436/* EXIT-NORMAL: ERROR=FALSE */
437/* */
438/* EXIT-ERROR: ERROR=TRUE */
439/* GOTO internal_program_error if invalid input */
440/* returned to this routine */
441/* */
442/* EFFECTS: No data directly modified by this routine, but */
443/* child routines will modify data. */
444/* */
445/* INTERNAL REFERENCES: */
446/* ROUTINES: */
447/* table_display */
448/* clear_screen */
449/* wait_for_ESC */
450/* get_yn_input */
451/* display */
452/* Write_Boot_Record */
453/* Internal_Program_Error */
454/* Find_Free_Space */
455/* */
456/* EXTERNAL REFERENCES: */
457/* ROUTINES: */
458/* */
459/******************** END OF SPECIFICATIONS ********************/
460
461/* */
462void ext_delete()
463
464
465BEGIN
466
467 char input;
468 unsigned i;
469 unsigned j; /* AN000 */
470
471
472 input = c(NUL); /* AC000 */
473 /* Clear the screen */
474 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
475
476 /* Display header */
477 display(menu_30);
478
479 /* Setup and print current disk */
480 insert[0] = cur_disk+1+'0';
481 display(menu_5);
482
483 /* print ESC prompt */
484 display(menu_11);
485
486 /* Display partition data and double check if partition exists*/
487 table_display(); /* AC000 */
488 sprintf(insert,"%4.0d",total_mbytes[cur_disk]);
489 display(menu_15);
490
491 BEGIN
492 /* See if there are still volumes */
493 if (!find_logical_drive())
494 BEGIN
495 /* Display Y/N prompt */
496 display(menu_31);
497
498 /* Get yes/no prompt */
499 input = get_yn_input(c(No),input_row,input_col); /* AC000 AC011 */
500 switch(input)
501 BEGIN
502 case 1: /* AC000 */
503 BEGIN
504 for (i=u(0); i < u(4); i++) /* AC000 */
505 /* Note: This will delete all occurances of EXTENDED DOS partitions found */
506 BEGIN
507 if (part_table[cur_disk][i].sys_id == uc(EXTENDED)) /* AC000 */
508 BEGIN
509 /* Set Partition entry to zero */
510 part_table[cur_disk][i].boot_ind = uc(0); /* AC000 */
511 part_table[cur_disk][i].start_head = uc(0); /* AC000 */
512 part_table[cur_disk][i].start_sector = uc(0); /* AC000 */
513 part_table[cur_disk][i].start_cyl = u(0); /* AC000 */
514 part_table[cur_disk][i].sys_id = uc(0); /* AC000 */
515 part_table[cur_disk][i].end_head = uc(0); /* AC000 */
516 part_table[cur_disk][i].end_sector = uc(0); /* AC000 */
517 part_table[cur_disk][i].end_cyl = u(0); /* AC000 */
518 part_table[cur_disk][i].rel_sec = ul(0); /* AC000 */
519 part_table[cur_disk][i].num_sec = ul(0); /* AC000 */
520 part_table[cur_disk][i].changed = (FLAG)TRUE; /* AC000 */
521 part_table[cur_disk][i].mbytes_used = f(0); /* AN000 */
522 part_table[cur_disk][i].percent_used = u(0); /* AN000 */
523
524 strcpy(part_table[cur_disk][i].system,c(NUL)); /* AN000 */
525 strcpy(part_table[cur_disk][i].vol_label,c(NUL)); /* AN000 */
526
527 /* Redisplay the partition info */
528 table_display();
529
530 /* clear the prompt off */
531 clear_screen(u(17),u(0),u(23),u(79)); /* AC000 */
532
533 /* Say that you deleted it */
534 display(status_2);
535
536 /* Set the reboot flag */
537 reboot_flag = (FLAG)TRUE; /* AC000 */
538 END
539 END
540 wait_for_ESC();
541 break;
542 END
543
544 case 0: break; /* AC000 */
545
546 case ESC: break;
547
548 default: internal_program_error();
549 break;
550 END
551 END
552 else
553 BEGIN
554 /* Logical drives still exist, can't delete partition */
555 display(error_21);
556 wait_for_ESC();
557 END
558 END
559 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
560 return;
561END
562
563
564/* */
565/******************* START OF SPECIFICATIONS *******************/
566/* */
567/* SUBROUTINE NAME: VOL_DELETE */
568/* */
569/* DESCRIPTIVE NAME: Delete DOS disk Volume */
570/* */
571/* FUNCTION: Prompts user to delete a DOS disk volume */
572/* */
573/* NOTES: Screen can be exited via the ESC command before */
574/* partition is deleted and nothing will change */
575/* */
576/* The following screen is managed */
577/* */
578/* ³0000000000111111111122222222223333333333³ */
579/* ³0123456789012345678901234567890123456789³ */
580/* ÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ */
581/* 00³Delete DOS Disk Volume ³ */
582/* 01³ ³ */
583/* 02³Vol Start End Size ³ */
584/* 03³ # #### #### #### ³ */
585/* 04³ ³ */
586/* 05³ ³ */
587/* 06³ ³ */
588/* 07³ ³ */
589/* 08³ ³ */
590/* 09³ ³ */
591/* 10³ ³ */
592/* 11³ ³ */
593/* 12³ ³ */
594/* 13³ ³ */
595/* 14³ ³ */
596/* 15³ ³ */
597/* 16³Total partition size is #### cylinders. ³ */
598/* 17³ ³ */
599/* 18³Warning! Data in the DOS disk volume ³ */
600/* 19³will be lost. What volume do you wish ³ */
601/* 20³to delete.........................? [#] ³ */
602/* 21³ ³ */
603/* 22³Are you sure......................? [N] ³ */
604/* 23³Press ESC to return to FDISK Options ³ */
605/* ÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ */
606/* */
607/* ENTRY POINTS: Vol_Delete */
608/* LINKAGE: vol_delete () */
609/* NEAR CALL */
610/* */
611/* INPUT: None */
612/* */
613/* EXIT-NORMAL: ERROR=FALSE */
614/* */
615/* EXIT-ERROR: ERROR=TRUE */
616/* GOTO internal_program_error if invalid input */
617/* returned to this routine */
618/* */
619/* EFFECTS: No data directly modified by this routine, but */
620/* child routines will modify data. */
621/* */
622/* INTERNAL REFERENCES: */
623/* ROUTINES: */
624/* clear_screen */
625/* display */
626/* volume_display */
627/* get_num_input */
628/* wait_for_ESC */
629/* get_yn_input */
630/* Write_Boot_Record */
631/* Find_Free_Space */
632/* Internal_Program_Error */
633/* */
634/* EXTERNAL REFERENCES: */
635/* ROUTINES: */
636/* */
637/******************** END OF SPECIFICATIONS ********************/
638
639/* */
640void volume_delete()
641
642BEGIN
643
644 char input;
645 char drive_input;
646 char high_drive;
647 char low_drive;
648 char error_low_drive;
649 char error_high_drive;
650 char drives_reassigned;
651 int list_index;
652 int i;
653 int j; /* AN011 */
654 int point;
655 FLAG delete_drive;
656 unsigned char drive_list[23][2];
657 int column;
658 int row;
659 FLAG drives_exist;
660 FLAG vol_matches;
661 char temp;
662 unsigned char drive_temp;
663 char far *s;
664 unsigned char string_input[12]; /* AN000 */
665
666 input = c(NUL);
667 string_input[0] = uc(NUL); /* AN000 */
668
669 /* Clear screen */
670 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
671
672 /* Display header */
673 display(menu_32);
674
675 /* print ESC prompt */
676 display(menu_11);
677
678 /* Display logical drives and get the highest drive letter assigned*/
679 high_drive = volume_display();
680
681 /* Get the first avail drive letter to be deleted */
682 low_drive = (high_drive - get_num_logical_dos_drives()+1);
683 temp = low_drive;
684
685 /* Initialize array of drive letters that exist at this point */
686 for (i=(int)0; i < (int)23; i++) /* AC000 */
687 BEGIN
688 /* See if we've exceeded the drive letter range */
689 if (temp <= high_drive)
690 BEGIN
691 /* Put in drive letter */
692 drive_list[i][0] = ((unsigned char)(temp));
693 /* Initialize the offsets into the array to something harmless */
694 drive_list[i][1] = uc(INVALID); /* AC000 */
695 END
696 else
697 BEGIN
698 /* No drive there, put in NUL */
699 drive_list[i][0] = uc(NUL); /* AC000 */
700 drive_list[i][1] = uc(INVALID); /* AC000 */
701 END
702
703 /* Check for next drive */
704 temp++;
705 END
706
707 /* Set up partition size message */
708 sprintf(insert,"%4.0d",get_partition_size( uc(EXTENDED) ) );
709 display(menu_21);
710
711 /* Assume no drives deleted */
712 drives_reassigned = (FLAG)FALSE; /* AC000 */
713
714 /* Loop until ESC or all deleted */
715 while (input != c(ESC)) /* AC000 */
716 BEGIN
717
718 /* Are there any drives left?*/
719 drives_exist = (FLAG)FALSE; /* AC000 */
720 error_low_drive = ((char)(NUL));
721 error_high_drive = ((char)(NUL));
722
723 for (i=(int)0;i < (int)23; i++) /* AC000 */
724 BEGIN
725 drive_temp = drive_list[i][0];
726 if ((drive_temp != uc(NUL)) && (drive_list[i][1] != uc(DELETED))) /* AC011 */
727 BEGIN
728 drives_exist = (FLAG)TRUE; /* AC000 */
729
730 /* Find last existing drive letter */
731 error_high_drive = ((char)(drive_temp));
732
733 /* See if we've found the first drive yet */
734 if (error_low_drive == ((char)(NUL)))
735 error_low_drive = ((char)(drive_temp));
736 END
737 END
738
739 /* If there are drives, go let user try to delete them */
740 if (drives_exist)
741 BEGIN
742
743 /* Get input until given a correct drive */
744 valid_input = (FLAG)FALSE; /* AC000 */
745 while ( (!valid_input) && (input != c(ESC)) )
746 BEGIN
747
748 /* Prompt for input */
749 display(menu_33);
750
751 /* Get input between first and highest drive letters */
752 clear_screen( u(21), u(0), u(21), u(79) );
753 input = get_alpha_input(low_drive,high_drive,input_row,input_col,error_low_drive,error_high_drive);
754 drive_input = input;
755
756 /* See if it has been deleted already or ESC pressed */
757 drives_exist = FALSE;
758 for (i=(int)0;i < (int)23; i++) /* AC000 */
759 BEGIN
760 if (drive_list[i][0] == ((unsigned char)(drive_input)) &&
761 (drive_list[i][1] != ((unsigned char) DELETED))) /* AC013 */
762 BEGIN
763 drives_exist = TRUE;
764 list_index = i;
765 END
766 if (ext_table[cur_disk][i].drive_letter == c(drive_input) )
767 point = i;
768 END
769 END
770
771 /* Input volume string to confirm delete */
772 vol_matches = FALSE;
773 if (input != c(ESC))
774 BEGIN
775 if (drives_exist)
776 BEGIN
777 /* delete privious volume mismatch message */
778 string_input[0] = uc(NUL); /* AN000 */
779 clear_screen( u(22), u(0), u(23), u(79) );
780 /* Get input volume label */
781 display(menu_41); /* AN000 */
782 get_string_input(input_row,input_col,string_input); /* AN000 */
783 if (string_input[0] == uc(ESC)) input = c(ESC);
784
785 /* See if the volume id matches the selected drive */ /* AN000 */
786 if (strcmp(ext_table[cur_disk][point].vol_label,string_input) == (int)ZERO)
787 vol_matches = TRUE; /* AN000 */
788 else if (input != c(ESC)) display(error_34);
789 END
790 else
791 BEGIN
792 /* Tell user the drive has already been deleted */
793 insert[0] = dos_upper(drive_input); /* AC000 */
794 insert[1] = c(DRIVE_INDICATOR); /* AC000 */
795 clear_screen( u(21), u(0), u(22), u(79) ); /* AN000 */
796 display(error_29);
797 END
798
799 END
800
801 /* If it is a valid drive indicate that the input was ok */
802 if ( (input != c(ESC)) && (drives_exist) && (vol_matches) ) /* AC000 */
803 BEGIN
804 valid_input = TRUE;
805
806 /* At this point we have a valid drive letter to delete */
807
808 /* Get the offset into the array for the drive to be deleted */
809 delete_drive = find_ext_drive(drive_input - low_drive);
810
811 /* Got a drive letter - prompt are you sure */
812 display(menu_34);
813
814 /* Get Y/N input, default is NO */
815 input = get_yn_input(c(No),input_row,input_col); /* AC000 AC011 */
816
817 /* Clear everything out on screen in prompt area */
818 clear_screen(u(23),u(0),u(23),u(79)); /* AC000 */
819
820 /* Go handle the delete */
821 switch(input)
822 BEGIN
823 case 1: /* AC000 */
824 BEGIN
825 /* Go ahead and mark it deleted in list array */
826
827 /* Throw up a flag to indicate we need to delete this one for real later */
828 /* This is because if we change the ext_table array now, we lose the ability */
829 /* to match up drive letters with locations, or at least it become more */
830 /* complicated than I felt like figuring out, so mark it now and do it later */
831 drive_list[list_index][1] = (unsigned char)DELETED; /* AC011 */
832
833 drives_reassigned = TRUE;
834
835 /* Put prompt up on screen */
836 for (i=(int)0; i < (int)23; i++) /* AC000 */
837 BEGIN
838 /* See if drive deleted */
839 if (drive_list[i][1] == uc(DELETED)) /* AC011 */
840 BEGIN
841 /* Wipe out the drive info and print deleted message */
842 /* See what column it is in */
843 if (i < (int)12) /* AC000 */
844 BEGIN
845 column = (int)4; /* AC000 */
846 row = (int)(4 + i - (int)0);
847 clear_screen( (unsigned)row, (unsigned)column,
848 (unsigned)row, (unsigned)39 );
849 END
850 else
851 BEGIN
852 column = (int)45; /* AC000 */
853 row = (int)(4 + i - (int)12);
854 clear_screen( (unsigned)row, (unsigned)column,
855 (unsigned)row, (unsigned)79 );
856 END
857
858 /* Put the start row,col of message in the message string */
859 s=status_3;
860 s++;
861 *s++ = ((char)(row/10))+'0';
862 *s++ = ((char)(row%10))+'0';
863 *s++ = ((char)(column/10))+'0';
864 *s = ((char)(column%10))+'0';
865 display(status_3);
866 END
867 END
868 /* Set the reboot flag */
869 reboot_flag = TRUE;
870 clear_screen( u(21), u(0), u(23), u(79) ); /* AN000 */
871 break;
872 END
873
874 case ESC:
875 case 0:
876 clear_screen( u(21), u(0), u(23), u(79) ); /* AN000 */
877 break; /* AC000 */
878
879 default:
880 internal_program_error();
881 break;
882 END
883 END
884
885 END
886 else /* drives do not exist! */
887 BEGIN
888 /* No more logical drives to delete */
889 clear_screen(u(16),u(0),u(21),u(79)); /* AC000 */
890 display(error_22);
891 input = wait_for_ESC();
892 END
893 END /* while input != esc */
894
895 if (drives_reassigned)
896 BEGIN
897 /* If anything got deleted, lets go do it for real */
898 for (i=(int)0; i < (int)23;i++) /* AC000 */
899 BEGIN
900 if (drive_list[i][1] == uc(DELETED)) /* AC011 */
901 BEGIN /* AN011 */
902 for (j=(int)0; j < (int)23;j++) /* AN011 */
903 BEGIN /* AN011 */
904 if (drive_list[i][0] == ext_table[cur_disk][j].drive_letter) /* AN011 */
905 BEGIN
906 /* Zero sys id and show it changed */
907 ext_table[cur_disk][j].boot_ind = uc(0); /* AC000 */
908 ext_table[cur_disk][j].start_head = uc(0); /* AC000 */
909 ext_table[cur_disk][j].start_sector = uc(0); /* AC000 */
910 ext_table[cur_disk][j].start_cyl = u(0); /* AC000 */
911 ext_table[cur_disk][j].sys_id = uc(0); /* AC000 */
912 ext_table[cur_disk][j].end_head = uc(0); /* AC000 */
913 ext_table[cur_disk][j].end_sector = uc(0); /* AC000 */
914 ext_table[cur_disk][j].end_cyl = u(0); /* AC000 */
915 ext_table[cur_disk][j].rel_sec = ul(0); /* AC000 */
916 ext_table[cur_disk][j].num_sec = ul(0); /* AC000 */
917 ext_table[cur_disk][j].mbytes_used = f(0); /* AN000 */
918 ext_table[cur_disk][j].percent_used = u(0); /* AN000 */
919 ext_table[cur_disk][j].changed = TRUE; /* AN000 */
920 ext_table[cur_disk][j].drive_letter = NUL; /* AN000 */
921 strcpy(ext_table[cur_disk][j].system,c(NUL)); /* AN000 */
922 strcpy(ext_table[cur_disk][j].vol_label,c(NUL)); /* AN000 */
923 END /* AN011 */
924 END /* AN011 */
925 END
926 END
927
928 /* Show new drive letters */
929 volume_display();
930
931 /* Say that drive letters changed */
932 clear_screen(u(16),u(0),u(23),u(79)); /* AC000 */
933 display(status_10);
934 wait_for_ESC();
935 END
936 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
937
938 return;
939
940END
941