To simulate the fdisk command for allocating partitioning


Integrative Programming

Assignment- Simulating Linux FDISK in TCL

Objective:

To simulate the FDISK command for allocating partitioning on a disk.

Inputs:

- Input text file consisting of disk allocation information (device, starting location, ending location, block size, id, file system)
- User choice: (‘n'-Create a new partition, ‘d'-Delete a partition, ‘p'- Print the partition table, ‘w'-Write the partition table and exit, ‘q'-Quit without saving changes)

Output:

- Display of disk allocation information in a partition table
- Output text file consisting of disk allocation information (device, starting location, ending location, block size, id, file system)

Specification:

The program maintains disk partition allocation information among multiple logical devices.

Any user input should consist of:

(1) a visible prompt (requiring the use of: "flush stdout" after: puts -nonewline "prompt string"

(2) setting the user input to a new variable (requiring the use of: "set var [gets stdin]")

Each option should be implemented as a separate function, so that its function can be called using either a (i) switch or an (ii) if-elseif-else statement.

The disk partition allocation information will be loaded from an input file and stored in a list. The list will be passed as a parameter from the "main" portion of the script to the appropriate function in the file and updated according to the function. To search for a pattern within a list (for checking if a device label exists/doesn't exist), use: lsearch $list $pattern* which returns -1 if the pattern is not found, or the first instance of the pattern within the list if found.

Initially, the program prompts for an input text file to read from. If the file does not exist, it should be created. The program should then loop until the user chooses to quit (either selects choice as 'w' or ‘q'). If the user enters an illegal status, the program will prompt again for the status input. Upon quitting, the program prompts the user to save the list to an output file with the same name as the original input text file.

Attachment:- asmt3_Al.tcl

Request for Solution File

Ask an Expert for Answer!!
Operating System: To simulate the fdisk command for allocating partitioning
Reference No:- TGS01412434

Expected delivery within 24 Hours