summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FDISK/PROFILE.C
blob: 5bee0a5c2ca19ea5023a65674f1cd383cf9bd888 (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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
#include        <doscall.h>
#include        <profile.h>
#include        <fdiskc.msg>
#include        <subtype.h>
#include        <ctype.h>


void    main()

BEGIN

unsigned i;

        /* Main Menu */
        clear_screen(0,0,24,79);
        display(menu_1);
        display(menu_2);
        display(menu_3);
        display(menu_4);
        insert[0] = 'C';
        display(menu_5);
        display(menu_6);
        display(menu_7);

        wait_for_ESC();


        /* Type of DOS partition for create */
        clear_screen(0,0,24,39);
        display(menu_3);
        insert[0] = 'C';
        display(menu_5);
        display(menu_7);
        display(menu_8);
        display(menu_9);
        display(menu_10);
        display(menu_11);
        wait_for_ESC();

        /* Shortcut screen C:*/
        clear_screen(0,0,24,39);
        display(menu_12);
        insert[0] = 'C';
        display(menu_5);
        display(menu_11);
        display(menu_12);
        display(menu_13);
        wait_for_ESC();

        /* Shortcut screen D:*/
        clear_screen(0,0,24,39);
        display(menu_12);
        insert[0] = 'C';
        display(menu_5);
        display(menu_11);
        display(menu_12);
        display(menu_41);
        wait_for_ESC();


/* Create primary DOS partition screen */
        display(menu_12);
        insert[0] = 'C';
        display(menu_5);
        for (i=0;i < 92;i++)
           BEGIN
            insert[i] = 'x';
           END
        display(menu_14);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_15);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_16);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_39);
        display(menu_11);
        wait_for_ESC();

/* Create Extended Partition */
        clear_screen(0,0,24,39);
        display(menu_17);
        insert[0] = 'C';
        display(menu_5);
        for (i=0;i < 92;i++)
           BEGIN
            insert[i] = 'x';
           END
        display(menu_14);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_15);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_16);
        display(menu_39);
        display(menu_11);
        wait_for_ESC();


/* Create logical drive screen */
        clear_screen(0,0,24,39);
        display(menu_18);
        for (i=0;i < 168;i++)
           BEGIN
            insert[i]= 'x';
           END
        display(menu_19);
        for (i=0;i < 168;i++)
           BEGIN
            insert[i]= 'x';
           END
        display(menu_20);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_21);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_22);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_40);
        display(menu_11);
        wait_for_ESC();


/* Change active partition screen */
        clear_screen(0,0,24,39);
        display(menu_23);
        insert[0] = 'C';
        display(menu_5);
        for (i=0;i < 92;i++)
           BEGIN
            insert[i] = 'x';
           END
        display(menu_14);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_15);
        display(menu_24);
        display(menu_11);
        wait_for_ESC();


/* Delete Partition Screen */
        clear_screen(0,0,24,39);
        display(menu_25);
        insert[0] = 'C';
        display(menu_5);
        display(menu_3);
        display(menu_26);
        display(menu_27);
        display(menu_7);
        display(menu_11);
        wait_for_ESC();

/* Delete Primary Screen */
        clear_screen(0,0,24,39);
        display(menu_28);
        insert[0] = 'C';
        display(menu_5);
        for (i=0;i < 92;i++)
           BEGIN
            insert[i] = 'x';
           END
        display(menu_14);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_15);
        display(menu_29);
        display(menu_11);
        wait_for_ESC();


/* Delete Extended Screen */
        clear_screen(0,0,24,39);
        display(menu_30);
        insert[0] = 'C';
        display(menu_5);
        for (i=0;i<92;i++)
           BEGIN
            insert[i] = 'x';
           END
        display(menu_14);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_15);
        display(menu_31);
        display(menu_11);
        wait_for_ESC();


/* Delete Logical Drives */
        clear_screen(0,0,24,39);
        display(menu_32);
        display(menu_18);
        for (i=0;i<168;i++)
           BEGIN
            insert[i]='x';
           END
        display(menu_19);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_21);
        display(menu_33);
        display(menu_11);
        wait_for_ESC();

/* Display Partition Information */
        clear_screen(0,0,24,39);
        display(menu_35);
        insert[0] = 'C';
        display(menu_5);
        for (i=0;i<92;i++)
           BEGIN
            insert[i] = 'x';
           END
        display(menu_14);
        insert[0] = 'x';
        insert[1] = 'x';
        insert[2] = 'x';
        insert[3] = 'x';
        display(menu_15);
        display(menu_36);
        display(menu_11);
        wait_for_ESC();

/* Display Logical Drive Info */
        clear_screen(0,0,24,39);
        display(menu_37);
        for (i=0;i<168;i++)
           BEGIN
            insert[i]='x';
           END
        display(menu_19);
        for (i=0;i<168;i++)
           BEGIN
            insert[i]='x';
           END
        display(menu_20);
        display(menu_11);
        wait_for_ESC();

/* Reboot Screen */
        clear_screen(0,0,24,39);
        display(menu_38);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_1);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_2);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_3);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        insert[0] = 'x';
        display(status_4);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_5);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_6);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_7);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_8);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_9);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(status_10);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_1);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_2);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_3);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_4);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_5);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_6);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_7);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_8);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_9);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_10);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_12);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_13);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_14);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_15);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_16);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_17);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_19);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_20);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_21);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_22);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        insert[0]='x';
        insert[1]='y';
        insert[2]='-';
        insert[3]='z';
        display(error_23);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_24);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_25);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_26);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_27);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_28);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        insert[0]='X';
        insert[1]=':';
        display(error_29);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        insert[0]='X';
        display(error_30);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        insert[0]='x';
        insert[1]='-';
        insert[2]='y';
        display(error_31);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        display(error_32);
        wait_for_ESC();

        clear_screen(0,0,24,39);
        DOSEXIT(0,0);

END


/******************* START OF SPECIFICATIONS *******************/
/*                                                             */
/* SUBROUTINE NAME: DISPLAY                                    */
/*                                                             */
/* DESCRIPTIVE NAME: Display full screen interface messages    */
/*                                                             */
/* FUNCTION: Displays messages and handles control characters  */
/*                                                             */
/* NOTES:                                                      */
/*  FDISK MESSAGES                                             */
/* Portions of the screen that are handled in the msg are      */
/* indicated on the listing of the screen with the message     */
/* name given.  If the text message is defined in another      */
/* screen, then the name is followed by a "#" character        */
/*                                                             */
/* NOTE TO TRANSLATORS The characters inside the <> and the [] */
/* are control characters and should not be translated.  The   */
/* Control characters are defined as follows:                  */
/*                                                             */
/* <H> - Highlight the following text                          */
/* <R> - Regular text                                          */
/* <B> - Blink the following text                              */
/* <O> - Turn blinking off                                     */
/* <Y> - Print YES character, as set by define                 */
/* <N> - Print NO character, as set by define                  */
/* <W> - Sound the beep                                        */
/* <S> - Save cursor position for later use                    */
/* <I> - Insert character from insert[] string. This string    */
/*       must be set up prior to displaying the message. The   */
/*       first <I> will insert Insert[0], the second           */
/*       insert[1], etc....This will move the cursor one       */
/*       postition. The insert[] string will be initialized    */
/*                                                             */
/* Multiple control characters can be between the <>.          */
/*                                                             */
/* The %####%indicates Row and column for the text and has the */
/* format of [rrcc] where the numbers are decimal and zero     */
/* based (first row/col is 00.  The numbers are in decimal,    */
/* and must be 2 characters, which means rows/cols 0-9 should  */
/* be listed as 00-09.  For example, the 5th row, 3rd column   */
/* on the screen would be listed as %0402%.                    */
/*                                                             */
/* The column number is always the column desired.  The row    */
/* number is an offset from the previous row.  For example, if */
/* the text just printed is on row 6, and the next text should */
/* be printed 2 rows down in column 0, then the control strin  */
/* would be %0201%.  The first row specified in the message is */
/* assumed to be based off of row 0, it would actually specify */
/* the actual row for the start of the msg to be printed.      */
/*                                                             */
/* ENTRY POINTS: display(*message_name);                       */
/*      LINKAGE: Near call                                     */
/*                                                             */
/* INPUT: char *message_name                                   */
/*                                                             */
/* EXIT-NORMAL:                                                */
/*                                                             */
/* EXIT-ERROR:                                                 */
/*                                                             */
/* EFFECTS:                                                    */
/* input_row changed if <S> control character in message       */
/* input_col changed if <S> control character in message       */
/*                                                             */
/* INTERNAL REFERENCES:                                        */
/*   ROUTINES:                                                 */
/*                                                             */
/* EXTERNAL REFERENCES:                                        */
/*   ROUTINES:                                                 */
/*                                                             */
/* viowrtcharstratt();                                         */
/******************** END OF SPECIFICATIONS ********************/
void display(s)

char far *s;

BEGIN
        unsigned      row;
        unsigned      col;
        char          attribute;
        char far      *attribute_ptr = &attribute;
        unsigned      insert_count;


        /* Initialize row and col, and index into array */
        row = 0;
        col = 0;
        insert_count = 0;
        /* check for a request to display a null string */
        if (*s == '\0')
           BEGIN
            /* Message string error */
            insert[0] = '1';
            display(debug_msg);
           END
        else
           BEGIN
            /* There is data there, lets go handle it */

            attribute = 0x00;
            /* Go until end of string */
            while (*s != '\0')
               BEGIN

                /* Check for any imbedded control strings */
                switch (*s)
                   BEGIN
                    /* Check for control characters */
                    case '<':
                              BEGIN
                               s++;
                               while ( (*s != '>') && (*s != '\0') )
                                  BEGIN
                                   switch (*s++)
                                      BEGIN
                                       case 'H': attribute = (attribute & 0x80) | 0x0F;
                                                 break;


                                       case 'R': attribute = (attribute & 0x80) | 0x07;
                                                 break;

                                       case 'B': attribute |= 0x80;
                                                 break;

                                       case 'O': attribute &= 0x7F;
                                                 break;

                                       case 'W': DOSBEEP(900,400);
                                                 break;

                                       case 'I':
                                                 BEGIN
                                                   /* display next element in the array */
                                                  if (attribute == 0x00)
                                                      attribute = 0x07;
                                                  VIOWRTCHARSTRATT(pinsert+insert_count++,1,row,col++,attribute_ptr,0);
                                                  break;
                                                 END


                                       case 'Y':
                                                 BEGIN
                                                  /* display YES character in next location */
                                                  *--s = YES;
                                                  if (attribute == 0x00)
                                                      attribute = 0x07;
                                                  VIOWRTCHARSTRATT(s++,1,row,col++,attribute_ptr,0);
                                                  break;
                                                 END

                                       case 'N':
                                                 BEGIN
                                                  /* display NO character in next location */
                                                  *--s = NO;
                                                  if (attribute == 0x00)
                                                      attribute = 0x07;
                                                  VIOWRTCHARSTRATT(s++,1,row,col++,attribute_ptr,0);
                                                  break;
                                                 END


                                       case 'S':
                                                 BEGIN
                                                  input_row = row;
                                                  input_col = col;
                                                  break;
                                                 END

                                       case 'C':
                                                 BEGIN
                                                  /* Clear from current position to end of line */
                                                  clear_screen(row,col,row,39);
                                                  break;
                                                 END

                                       case '\0':
                                                 BEGIN
                                                  /* Message string error - string ended in the middle of control string*/
                                                  insert[0] = '7';
                                                  display(debug_msg);
                                                  break;
                                                 END

                                       default:
                                                 BEGIN
                                                  /* Message string error - no valid control char found */
                                                  insert[0] = '6';
                                                  display(debug_msg);
                                                  break;
                                                 END
                                      END /* Switch */
                                  END /* While */
                               /* Get the pointer past the '>' */
                               s++;
                               break;
                              END /* control characters */

                    /* Check for row,col */
                    case '%':
                              BEGIN
                               s++;
                               /* determine the row to put the message on */
                               if ( !isdigit(*s) )
                                  BEGIN
                                   /* Message string error */
                                   insert[0] = '2';
                                   display(debug_msg);
                                  END
                               else
                                  BEGIN
                                   row = row+((unsigned)(((*s++ - '0')*10)));
                                   if ( !isdigit(*s) )
                                     BEGIN
                                      /* Message string error */
                                      insert[0] = '2';
                                      display(debug_msg);
                                     END
                                   else
                                      BEGIN
                                       row = row+((unsigned)(*s++ - '0'));
                                       /* determine the col to put the message on */
                                       if ( !isdigit(*s) )
                                          BEGIN
                                           /* Message string error */
                                           insert[0] = '3';
                                           display(debug_msg);
                                          END
                                       else
                                          BEGIN
                                           col = ((unsigned)(*s++ - '0'));
                                           if ( !isdigit(*s) )
                                              BEGIN
                                               /* Message string error */
                                               insert[0] = '3';
                                               display(debug_msg);
                                              END
                                           else
                                              BEGIN
                                               col = ((unsigned)((col* 10) + (*s++ - '0')));
                                               if (*s++ != '%')
                                                  BEGIN
                                                   /* Message string error */
                                                   insert[0] = '4';
                                                   display(debug_msg);
                                                  END /* 2nd sq bracket */
                                              END /* 2nd digit col */
                                          END /* 1st digit col */
                                      END /* 2nd digit row */
                                  END /* 1st digit row */
                               break;
                              END
                    /* Handle anything else */


                    default:
                            BEGIN
                             /* See if attribute set to anything */
                             if (attribute == 0x00)
                                  attribute = 0x07;
                             VIOWRTCHARSTRATT(s++,1,row,col++,attribute_ptr,0);
                             break;
                            END
                   END
               END /* End of string check */
           END /* No characters in string check */
        return;

END

void number_in_msg(number,start)

unsigned    number;
unsigned    start;

BEGIN

unsigned     i;

        /* init the four spots to zero's */
        for (i = 0; i < 4;i++)
            BEGIN
             insert[start+i] = ' ';
            END
        /* Divide the space down and get it into decimal */
        if (number > 999)
           BEGIN
            insert[start] = ((char)(number/1000))+'0';
            insert[start+1] = '0';
            insert[start+2] = '0';
            insert[start+3] = '0';
            number = number%1000;
           END
        if (number > 99)
           BEGIN
            insert[start+1] = ((char)(number/100))+'0';
            insert[start+2] = '0';
            insert[start+3] = '0';
            number = number%100;
           END
        if (number > 9)
           BEGIN
            insert[start+2] = ((char)(number/10))+'0';
            insert[start+3] = '0';
            number = number%10;
           END
        insert[start+3] = ((char)(number +'0'));
        return;
END



void clear_screen(TopRow,LeftCol,BotRow,RightCol)

unsigned     TopRow;
unsigned     LeftCol;
unsigned     BotRow;
unsigned     RightCol;

BEGIN

char    attribute;
char    *attribute_ptr = &attribute;

   attribute = 0x07;
   VIOSCROLLUP(TopRow,LeftCol,BotRow,RightCol,0,attribute_ptr,0);
   return;
END



char wait_for_ESC()

BEGIN
     char  input;

    while (input != ESC)
       BEGIN
        /* position the cursor at the end of the ESC prompt */
        VIOSETCURPOS(24,39,0);

        /* Get input */
        KBDFLUSHBUFFER(0);
      /*KBDCHARIN(input_data,0,0);*/
      /*input = input_data->char_code;*/
          input = ((char)(getch()));
       END
    return(ESC);
END