2 #include "dos.h" /* AN000 */
3 #include "fdisk.h" /* AN000 */
4 #include "subtype.h" /* AN000 */
5 #include "extern.h" /* AN000 */
8 char find_free_partition()
13 /* Look at all four partition entries for empty partition */
14 for (i = c(0); i < c(4);i++) /* AC000 */
17 /* if we find an empty one, return which one */
18 if (part_table[cur_disk][i].num_sec == ul(0)) /* AC000 */
24 /* Did not find one, return NOT_FOUND */
25 return(c(NOT_FOUND)); /* AC000 */
29 char find_partition_type(type)
36 /* Look at all four partition entries for system id byte that matches */
37 for (i = c(0); i < c(4);i++) /* AC000 */
40 /* if we find a match, do a TRUE return */
41 if (part_table[cur_disk][i].sys_id == type)
47 /* Did not find one, return FALSE */
54 XFLOAT get_partition_size(type) /* AC000 */
56 unsigned char type; /* AC000 */
61 /* Look at all four partition entries for system id byte that matches */
62 for (i = c(0); i < c(4);i++) /* AC000 */
65 /* if we find a match, get the size */
66 if (part_table[cur_disk][i].sys_id == type)
68 /* Get the size of the partition from the array */
69 return(part_table[cur_disk][i].mbytes_used); /* AC000 */
72 /* Did not find one, something bad wrong happened */
73 internal_program_error();
77 char find_active_partition()
83 /* See if there is an active partition */
84 for (i = uc(0); i < uc(4);i++) /* AC000 */
87 /* if we find an active one, TRUE return */
88 if (part_table[cur_disk][i].boot_ind == uc(ACTIVE)) /* AC000 */
94 /* Did not find one, return FALSE */
100 char find_partition_location(type)
107 /* Look at all four partition entries for system id byte that matches */
108 for (i = c(0); i < c(4);i++) /* AC000 */
111 /* if we find a match, do a TRUE return */
112 if (part_table[cur_disk][i].sys_id == type)
118 /* Did not find one, return */
119 return(c(NOT_FOUND)); /* AC000 */
129 /* Look at all 23 extended entries for empty partition */
130 for (i = c(0); i < c(23);i++) /* AC000 */
133 /* if we find an empty one, return which one */
134 if (ext_table[cur_disk][i].sys_id == uc(0)) /* AC000 */
140 return(c(NOT_FOUND)); /* AC000 */
144 char find_logical_drive()
150 /* See if there is a logical drive defined in Extended Partition */
151 for (i = uc(0); i < uc(23);i++) /* AC000 */
154 /* See if we find a sys id that is not 0 */
155 if (ext_table[cur_disk][i].sys_id != uc(0)) /* AC000 */
165 char get_num_logical_dos_drives()
171 number = c(0); /* AC000 */
172 /* See if there is a logical drive defined in Extended Partition */
173 for (i = c(0); i < c(23);i++) /* AC000 */
176 /* See if we find a sys id that is DOS */
177 if ((ext_table[cur_disk][i].sys_id == uc(DOS12)) || (ext_table[cur_disk][i].sys_id == uc(DOS16)) ||
178 (ext_table[cur_disk][i].sys_id == uc(DOSNEW))) /* AC000 */
187 char find_ext_drive(offset)
196 number_found = c(0); /* AC000 */
198 /* Go look for the nth extended drive */
199 for (i=c(0); i < c(23); i++) /* AC000 */
202 /* See if there is a drive we know about */
203 if ((ext_table[cur_disk][i].sys_id == uc(DOS12)) || (ext_table[cur_disk][i].sys_id == uc(DOS16)) ||
204 (ext_table[cur_disk][i].sys_id == uc(DOSNEW))) /* AC000 */
206 /* Is this the one we were looking for ? */
207 if (number_found == offset)
209 /* Yes it is, return where we found it */
213 /* Show we found one and go look for the next */
217 /* We should never get here */
218 internal_program_error();
219 return(c(INVALID)); /* AC000 */
224 char find_previous_drive(offset)
234 number_found = c(0); /* AC000 */
235 last_found = c(0); /* AC000 */
237 /* Go look for the nth extended drive */
238 for (i=c(0); i < c(23); i++) /* AC000 */
241 /* See if there is a drive */
242 if (ext_table[cur_disk][i].sys_id != uc(0)) /* AC000 */
244 /* Is this the one we were looking for ? */
245 if (number_found == offset)
247 /* Yes it is, return where we found the previous one */
250 /* This is the latest one we found, but not the limit, so save it */
253 /* Show we found one and go look for the next */
257 /* We should never get here */
258 internal_program_error();
259 return(c(INVALID)); /* AC000 */