summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FDISK/TDISPLAY.C
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/CMD/FDISK/TDISPLAY.C
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/CMD/FDISK/TDISPLAY.C')
-rw-r--r--v4.0/src/CMD/FDISK/TDISPLAY.C134
1 files changed, 134 insertions, 0 deletions
diff --git a/v4.0/src/CMD/FDISK/TDISPLAY.C b/v4.0/src/CMD/FDISK/TDISPLAY.C
new file mode 100644
index 0000000..7cc5e97
--- /dev/null
+++ b/v4.0/src/CMD/FDISK/TDISPLAY.C
@@ -0,0 +1,134 @@
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 "stdio.h"
8#include "string.h"
9#include "memory.h"
10
11/* */
12char table_display()
13
14BEGIN
15
16
17unsigned i;
18unsigned x;
19unsigned io;
20char *ThisPartitionType;
21char ThisPartitionLetter[3];
22FLAG partition_found;
23char partition_num;
24
25 /* initialize all the inserts to blanks */
26 memset(insert,c(' '),4*21);
27 io = u(0);
28
29 /* Sort the partitions */
30 sort_part_table(c(4)); /* AC000 */
31
32 /* loop thru the partitions, only print stuff if it is there */
33 partition_found = FALSE;
34 partition_num = c(0); /* AC000 */
35
36 for (i=u(0); i < u(4); i++) /* AC000 */
37 BEGIN
38
39 if (part_table[cur_disk][sort[i]].sys_id != uc(0)) /* AC000 */
40 BEGIN
41
42 partition_found = TRUE;
43
44 strcpy(ThisPartitionLetter," ");
45 switch(part_table[cur_disk][sort[i]].sys_id)
46 BEGIN
47 case DOSNEW: /* AN000 */
48 case DOS16:
49 case DOS12:
50 ThisPartitionType = DOS_part;
51 part_table[cur_disk][sort[i]].drive_letter = table_drive_letter(); /* AN000 */
52 sprintf(ThisPartitionLetter,"%c%c",
53 part_table[cur_disk][sort[i]].drive_letter,
54 ( part_table[cur_disk][sort[i]].drive_letter == c(' ') ) ? ' ' : ':');
55 break;
56 case EXTENDED:
57 ThisPartitionType = EXTENDED_part;
58 break;
59 case BAD_BLOCK:
60 ThisPartitionType = BAD_BLOCK_part;
61 break;
62 case XENIX1:
63 ThisPartitionType = XENIX_part;
64 break;
65 case XENIX2:
66 ThisPartitionType = XENIX_part;
67 break;
68 case PCIX:
69 ThisPartitionType = PCIX_part;
70 break;
71 default:
72 ThisPartitionType = NON_DOS_part;
73 break;
74 END
75
76 io += sprintf(&insert[io],"%-2.2s%c%c%-7.7s%4.0d%3.0d%%",
77 ThisPartitionLetter,
78 partition_num+'1',
79 (part_table[cur_disk][sort[i]].boot_ind == uc(0x80)) ? 'A' : ' ',
80 ThisPartitionType,
81 part_table[cur_disk][sort[i]].mbytes_used,
82 part_table[cur_disk][sort[i]].percent_used);
83
84 partition_num++;
85
86 END
87
88 END
89
90 /* Do a clearscreen to erase previous data */
91 clear_screen(u(8),u(0),u(12),u(79)); /* AC000 */
92
93 if (partition_found) display(menu_14);
94 else display(status_8);
95
96 /* Return true if partitions exist, false otherwise */
97 if (partition_found) return(TRUE);
98
99 return(FALSE);
100
101END
102
103/* */
104char table_drive_letter()
105
106BEGIN
107char drive_letter;
108
109 /* Put in drive letter in display */
110 if (cur_disk == c(0)) /* AC000 */
111 BEGIN
112 /* There is a primary partition on 80h, so drive C: */
113 drive_letter = c('C'); /* AC000 */
114 END
115 else
116 BEGIN
117 /* We are on drive 81h, so assume D: */
118 drive_letter = c('D'); /* AC000 */
119
120 /* See if primary exists on 80h drive */
121 /* First, set cur_drive to 0 */
122 cur_disk = c(0); /* AC000 */
123
124 /* Check for primary on drive 80h */
125 if (!(find_partition_type(uc(DOS12)) || find_partition_type(uc(DOS16)) || find_partition_type(uc(DOSNEW)))) /* AC000 */
126 BEGIN
127 drive_letter = c('C'); /* AC000 */
128 END
129 /* restore cur_disk to normal */
130 cur_disk = c(1); /* AC000 */
131 END
132 return(drive_letter);
133END
134 \ No newline at end of file