2 #include "dos.h" /* AN000 */
3 #include "fdisk.h" /* AN000 */
4 #include "subtype.h" /* AN000 */
5 #include "extern.h" /* AN000 */
6 #include "fdiskmsg.h" /* AN000 */
9 /******************* START OF SPECIFICATIONS *******************/
11 /* SUBROUTINE NAME: DO_MAIN_MENU */
13 /* DESCRIPTIVE NAME: Main menu display and input routine */
16 /* Displays the main FDISK menu, accepts and validates */
17 /* input from menu and passes control to requested function */
19 /* NOTES: The following screen is managed by this routine: */
21 /* ³0000000000111111111122222222223333333333³ */
22 /* ³0123456789012345678901234567890123456789³ */
23 /* ÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ */
24 /* 00³IBM Personal Computer ³ */
25 /* 01³Fixed Disk Setup Program Version 3.30 ³ */
26 /* 02³(C)Copyright IBM Corp. 1983,1987 ³ */
28 /* 04³FDISK Options ³ */
30 /* 06³Current Fixed Disk Drive: # ³ */
32 /* 08³Choose one of the following: ³ */
34 /* 10³ 1. Create DOS partition ³ */
35 /* 11³ 2. Change Active Partition ³ */
36 /* 12³ 3. Delete DOS Partition ³ */
37 /* 13³ 4. Display Partition Data ³ */
38 /* 14³ 5. Select Next Fixed Disk Drive ³ */
42 /* 18³Enter choice: [#] ³ */
45 /* 21³WARNING! No partitions marked active ³ */
47 /* 23³Press ESC to return to DOS ³ */
48 /* ÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ */
50 /* ENTRY POINTS: do_main_menu */
51 /* LINKAGE: do_main_menu(); */
56 /* EXIT-NORMAL: ERROR=FALSE */
58 /* EXIT-ERROR: ERROR=TRUE */
59 /* GOTO internal_program_error if case statement */
60 /* failure when branching to requested function */
62 /* EFFECTS: No data directly modified by this routine, but */
63 /* child routines will modify data. */
65 /* INTERNAL REFERENCES: */
70 /* create_partition */
71 /* change_active_partition */
72 /* delete_partition */
73 /* display_partition_information */
74 /* find_active_partition */
76 /* internal_program_error */
78 /* EXTERNAL REFERENCES: */
81 /******************** END OF SPECIFICATIONS ********************/
94 input = c(NUL); /* AC000 */
95 PercentFlag = (FLAG)FALSE; /* AN000 */
96 /* Intialize cur_disk indicator. It is 0 based for array usage */
97 /* See if first disk readable */
98 cur_disk = c(0); /* AC000 */
104 /* See if we have a valid combo of disk */
105 if ((good_disk[0]) || ((good_disk[1]) && (number_of_drives == uc(2)))) /* AC000 */
107 clear_screen(u(0),u(0),u(24),u(79)); /* AC000 */
108 /* Display the copyright */
111 /* See if we couldn't access drive 1 */
114 insert[0] = c('1'); /* AC000 */
118 /* Display the menu every time this routine is returned to until ESC */
119 input = c(NUL); /* AC000 */
120 while (input !=c(ESC)) /* AC000 */
122 /* Put up most of the menu */
127 /* Put correct disk in current disk message */
128 insert[0]=cur_disk+1+'0';
131 /* Display warning prompt if no active partitions */
132 /* check to see if there is an avail partition */
133 temp = u(0); /* AC000 */
134 for (i = u(0); i < u(4);i++) /* AC000 */
137 /* See if any non - zero system id bytes */
138 temp = temp | part_table[cur_disk][i].sys_id ;
140 /* Any entry that isn't zero means */
141 if (temp != u(0)) /* AC000 */
143 /* If there isn't an active partition and this is disk 1, then yell) */
144 if ((!find_active_partition()) && (cur_disk == c(0))) /* AC000 */
148 /* Get the menu input */
150 /* See if more than one fixed disk */
151 if (number_of_drives == uc(2)) /* AC000 */
154 max_input = c(5); /* AC000 */
156 else /* only 4 options */
157 max_input = c(4); /* AC000 */
158 /* Setup default and go get input */
159 input = get_num_input(c(1),max_input,input_row,input_col); /* AC000 */
162 case '1': create_partition();
165 case '2': change_active_partition();
168 case '3': delete_partition();
171 case '4': display_partition_information();
175 if (number_of_drives == uc(1)) /* AC000 */
176 internal_program_error();
179 /* Swap the number */
180 if (cur_disk == c(0)) /* AC000 */
188 /* Disk has error reading */
189 insert[0] = c('2'); /* AC000 */
196 if (cur_disk == c(1)) /* AC000 */
204 /* Disk has error reading */
205 insert[0] = c('1'); /* AC000 */
210 internal_program_error;
216 case ESC: break; /* ESC case */
218 default: internal_program_error();
224 /* Can't read either drive, so quit */
225 no_fatal_error = c(FALSE); /* AC000 */