summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FDISK/VDISPLAY.C
blob: 41b62856b26af2fd33234903070b7ba84bdb709f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#include "dos.h"                                                        /* AN000 */
#include "fdisk.h"                                                      /* AN000 */
#include "extern.h"                                                     /* AN000 */
#include "subtype.h"                                                    /* AN000 */
#include "fdiskmsg.h"                                                   /* AN000 */
#include "string.h"
#include "stdio.h"
#include "memory.h"

/*  */
char volume_display()

BEGIN

unsigned    i;
unsigned    x;
char        drive_found;
char        drive_letter;
char        drive_num;
char        temp;
char        first_display;
char        second_display;
char        third_display;
char        fourth_display;
unsigned    insert_offset;

        first_display = FALSE;
        second_display = FALSE;
        third_display = FALSE;
        fourth_display = FALSE;

        /* See what the starting drive letter is */
        drive_letter = c(SEA);                                          /* AC000 */

        /* See if primary on drive 1 */
        temp = cur_disk;
        cur_disk = c(0);                                                /* AC000 */
        if ( (find_partition_type(uc(DOS12))) ||
             (find_partition_type(uc(DOS16))) ||
             (find_partition_type(uc(DOSNEW)))) /* AC000 */
           BEGIN
            /* There is a Primary partition on drive 1, so increment for first logical drive */
                drive_letter++;
           END
         cur_disk = temp;

        /* See if there is a second drive */
        if (number_of_drives == uc(2))                                  /* AC000 */
           BEGIN

            /* Go see if DOS partition on drive 2 */
            temp = cur_disk;
            cur_disk = c(1);                                            /* AC000 */
            if ( (find_partition_type(uc(DOS12))) ||
                 (find_partition_type(uc(DOS16))) ||
                 (find_partition_type(uc(DOSNEW)))) /*AC000*/
                BEGIN

                /* There is a Primary partition on drive 2, so increment for first logical drive */
                drive_letter++;
               END
            /* Are we on drive 2? If so, we got to find all the drives on drive 1 */
            if (temp == c(1))                                           /* AC000 */
               BEGIN
                /* Next, we need to see what is on drive 1 */
                for (i=u(0); i < u(23); i++)                            /* AC000 */
                   BEGIN
                    /* See if there is a logical drive we understand in PC-DOS land */
                    if ( (ext_table[0][i].sys_id == uc(DOS12)) ||
                         (ext_table[0][i].sys_id == uc(DOS16)) ||
                         (ext_table[0][i].sys_id == uc(DOSNEW)) )                    /* AC000  */
                       BEGIN
                        /* Found one, so kick up the first available drive letter */
                        drive_letter++;
                       END
                   END
               END

            /* Reset the cur_drive to where it was */
            cur_disk = temp;
           END




        /* loop thru the partitions, only print stuff if it is there */

        /* Get the drives in order by location on disk */
        sort_ext_table(c(23));                                          /* AC000 */

        /* initialize all the inserts to blanks */
        memset(insert,c(' '),(24*29));

        drive_num = c(0);                                               /* AC000 */
        drive_found = FALSE;
        first_display = TRUE;
        insert_offset = 0;

        for (i=u(0); i < u(23); i++)                                    /* AC000 */
           BEGIN

            /* See if entry exists */
            if ( (ext_table[cur_disk][sort[i]].sys_id == uc(DOS12)) ||
                 (ext_table[cur_disk][sort[i]].sys_id == uc(DOS16)) ||
                 (ext_table[cur_disk][sort[i]].sys_id == uc(DOSNEW)) )  /* AC000  */
               BEGIN

                /* We found one, now get the info */
                drive_found = TRUE;

                /* Get the drive letter - make sure it is Z: or less*/
                /* Put it in the message, and set it up for next time */
                if (drive_letter > c('Z'))
                        ext_table[cur_disk][sort[i]].drive_letter = c(' ');
                   else ext_table[cur_disk][sort[i]].drive_letter = drive_letter;

                insert_offset += sprintf(&insert[insert_offset],"%c%c%-11.11s%4.0d%-8.8s%3.0d%%",
                        ext_table[cur_disk][sort[i]].drive_letter,
                        ( ext_table[cur_disk][sort[i]].drive_letter == c(' ') ) ? ' ' : ':',
                        ext_table[cur_disk][sort[i]].vol_label,
                        ext_table[cur_disk][sort[i]].mbytes_used,
                        ext_table[cur_disk][sort[i]].system,
                        ext_table[cur_disk][sort[i]].percent_used );


                drive_letter++;
                drive_num++;

               END
           END

        /* Display the column of drives */
        if (drive_found)
           BEGIN

            clear_screen(u(2),u(0),u(15),u(79));                    /* AC000 */

            if ( drive_num > 0 )
                BEGIN
                pinsert = &insert[0];
                display(menu_19);
                END

            if ( drive_num > 6 )
                BEGIN
                pinsert = &insert[6*29];
                display(menu_43);
                END

            if ( drive_num > 12 )
                BEGIN
                pinsert = &insert[12*29];
                display(menu_20);
                END

            if ( drive_num > 18 )
                BEGIN
                pinsert = &insert[18*29];
                display(menu_44);
                END
            pinsert = &insert[0];
            END
        else
           BEGIN
            /* Didn't find any */
            if (first_display)
               BEGIN
                /* Wipe out display and put up message */
                clear_screen(u(2),u(0),u(15),u(79));                    /* AC000 */
                display(status_9);
               END
           END
        /* Return the highest drive letter found */
        drive_letter--;
        return(drive_letter);

END