For this project we will have a command file. The command file will have a series of commands that instruct our program what to do. The commands will be described below. The commands will deal with messages and we will be using an mbox format and I'll describe it below. The heart of this project will be a struct that you create and then 2 arrays used to store the messages. One of the arrays will store valid or good messages, and the other array will store modified or invalid messages. Both of these arrays will need to "grow" and so we'll be using pointers and dynamic arrays to accomplish this.
For this project the mailbox program will respond to a series of commands:
-load this command will expect a filename to appear after it. The file will be a valid mbox file and the messages will not be checked as they are loaded. (Even though some of them may be modified, load will put them all in the inbox.)
-add this command will simulate a new message coming in. On the next line will be a single message. The message will need to be checked for validity. If it is good, then it is added to the inbox. Otherwise it is added to the modified
-show this command will be followed by which inbox to show, i.e inbox or modified, and then optionally a number. If the command is just show inbox or show modified then the entire request list of messages will be shown. If the command is ended with a number then, if the number is good, that message is shown. IF the message number is invalid, then an error message is shown.
-remove this command will be followed by which inbox you wish to remove a message from and then it will end with a message number. This would look something like this: remove inbox 3 or remove modified 2 If the message number is valid, then the message is removed from the list and an output would indicate it's removal. If the message number is invalid then an error output is displayed.
-save this command will be followed by which inbox to save and a filename where to save the inbox. For example: save inbox mboxsave or save modified mboxsave The format of the saved file is such that it could be used to load. So to test, you could add some messages, save your inbox, then load that same saved file back in.