/* Delete Non-DOS Partition User Interface */ void Delete_N_DOS_Partition_Interface() { int input=0; Clear_Screen(0); Print_Centered(4,"Delete Non-DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); BlinkPrintAt(4,18,"WARNING!"); printf(" Data in the deleted Non-DOS Partition will be lost."); printAt(4,19,"What Non-DOS Partition do you want to delete..? "); flags.esc=FALSE; input=(int)Input(1,52,19,NUM,1,4,ESCR,-1,0,NULL,NULL); /* 4 needs changed to the max num of partitions */ if(flags.esc==FALSE) { Delete_Primary_Partition(input-1); Clear_Screen(0); Print_Centered(4,"Delete Non-DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); cprintAt(4,21,"Non-DOS Partition deleted"); printAt(4,24," "); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); } }
/* Delete Extended DOS Partition Interface */ void Delete_Extended_DOS_Partition_Interface() { int input=0; Partition_Table *pDrive = &part_table[flags.drive_number-0x80]; Clear_Screen(0); Print_Centered(4,"Delete Extended DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); BlinkPrintAt(4,18,"WARNING!"); printf(" Data in the deleted Extended DOS Partition will be lost."); printAt(4,19,"Do you wish to continue (Y/N).................? "); flags.esc=FALSE; input=(int)Input(1,52,19,YN,0,0,ESCR,0,0,NULL,NULL); if( (flags.esc==FALSE) && (input==TRUE) ) { Delete_Primary_Partition(int(pDrive->ptr_ext_part-pDrive->pri_part)); Clear_Extended_Partition_Table(flags.drive_number-128); Clear_Screen(0); Print_Centered(4,"Delete Extended DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); cprintAt(4,21,"Extended DOS Partition deleted"); printAt(4,24," "); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); } }
/* Delete Primary DOS Partition Interface */ void Delete_Primary_DOS_Partition_Interface() { int input=0; int partition_to_delete; Clear_Screen(0); Print_Centered(4,"Delete Primary DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); BlinkPrintAt(4,19,"WARNING!"); printf(" Data in the deleted Primary DOS Partition will be lost."); printAt(4,20,"What primary partition do you want to delete..? "); flags.esc=FALSE; input=(int)Input(1,52,20,NUM,1,4,ESCR,-1,0,NULL,NULL); /* 4 needs changed to the max num of partitions */ if(flags.esc==FALSE) { partition_to_delete=input-1; printAt(4,22,"Are you sure (Y/N)..............................? "); flags.esc=FALSE; input=(int)Input(1,54,22,YN,0,0,ESCR,0,0,NULL,NULL); if( (input==TRUE) && (flags.esc==FALSE) ) { Delete_Primary_Partition(partition_to_delete); Clear_Screen(0); Print_Centered(4,"Delete Primary DOS Partition",BOLD); /* */ Display_Primary_Partition_Information_SS(); cprintAt(4,21,"Primary DOS Partition deleted"); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); } } }
/* /DELETE command line option */ void Command_Line_Delete() { Partition_Table *pDrive = &part_table[flags.drive_number-0x80]; /* Delete the primary partition */ if(0==strcmp(arg[1].choice,"PRI")) { if (arg[1].value != 0) /* specified what to delete */ { if (arg[1].value < 1 || arg[1].value >4) { printf("primary partition # (%ld) must be 1..4\n",(long)arg[1].value); exit(9);} Delete_Primary_Partition((int)(arg[1].value - 1)); } else { /* no number given, delete 'the' partition */ int index,found,count; for (count = 0, index = 0; index < 4; index++) { if(IsRecognizedFatPartition(pDrive->pri_part[index].num_type)) { count++; found = index; } } if (count == 0) printf("no partition to delete found\n"); /* but continue */ else if (count > 1) { printf("%d primary partitions found, you must specify number to delete\n",count); exit(9); } else { Delete_Primary_Partition(found); } } } /* end PRI */ /* Delete the extended partition */ if(0==strcmp(arg[1].choice,"EXT")) { int index=3; do { if( ( (flags.version==FOUR) || (flags.version==FIVE) || (flags.version==SIX) ) && (pDrive->pri_part[index].num_type==5) ) { Delete_Primary_Partition(index); break; } if( ( (flags.version==W95) || (flags.version==W95B) || (flags.version==W98) ) && ( (pDrive->pri_part[index].num_type==5) || (pDrive->pri_part[index].num_type==15) ) ) { Delete_Primary_Partition(index); break; } index--; }while(index>=0); if(index<0) { printf("\nExtended DOS Partition not found...no partition deleted.\n"); exit(9); } } /* Delete a Logical DOS Drive */ if(0==strcmp(arg[1].choice,"LOG")) { if( (arg[1].value>=1) && (arg[1].value<=23) ) { Delete_Logical_Drive( (int)(arg[1].value-1) ); } else { printf("\nLogical drive number (%d) is out of range...Operation Terminated\n",arg[1].value); exit(9); } } /* Delete the partition by the number of the partition */ if(0==strcmp(arg[1].choice,"NUM")) { if( (arg[1].value>=1) && (arg[1].value<=4) ) { Delete_Primary_Partition( (int)(arg[1].value-1) ); } else if( (arg[1].value>=5) && (arg[1].value<=28) ) { Delete_Logical_Drive( (int)(arg[1].value-5) ); } else { printf("\nPartition number is out of range...Operation Terminated\n"); exit(9); } } Shift_Command_Line_Options(2); }