SE 598, Data Structures and Algorithms

STL List Programming Assignment, due 5:00 p.m. Wednesday, 19 July


Introduction

Unlike the previous dequeue assignment, this assignment can actually used lists to good effect.

Problem Statement

This is a two part problem: add a new command to readmbox and modify readmbox so it can handle a more realistic form of mailboxes.

The delete Command

The delete command deletes messages from the readmbox message list. The delete command format is
delete [ field word ]
where [ a ] means a is optional. The pair field word has the same search pattern interpretation it has for the the order command.

The command

delete field word
deletes from the message list all messages that match the search pattern field word; delete doesn't otherwise change or re-order the message list. For example, suppose the current state of the message list in readmbox is
1 2* 3 4* 5* 6
where each number is a message number and an asterisk (*) represents a message which matches the delete search pattern. Then delete would reduce the message list to
1 3 6

The command

delete
restores all deleted messages to the message list; deleted messages are added to the end of the message list with no particular order among the deleted messages.

Make sure delete and order interact properly. If messages are undeleted and then re-ordered to their original state, the resulting message list should be the same as the original message list.

Folded Header Fields

A message consists of a header followed by contents. A message header consists of one or fields; a message header field is a text-line with the following format
word:text-line
Because it starts with a word, a field cannot start with linear white space. Fields in this form are known as unfolded message header fields.

RFC 822 defines a second type of message header field called a folded message header field. The form of a folded message header field is linear white space followed by a text-line; the first character of the text-line is not a linear white space character, that is, the linear white space preceding the text-line is maximal. The field

****rclayton@monmouth.edu
where each asterisk * represents a white-space character, is an example of a folded field.

A folded field is considered a continuation of the previous field (unfolded or not) as follows: replace the linear white space and preceding newline by a single linear white-space character (of your choice). This has the effect of joining the folded field with the previous field; for example, the combination of folded and unfolded fields

Recipients: bird@parker.com
***pres@young.com
***pops@armstrong.com
where each asterisk * represents a white-space character, is interpreted as the single unfolded field
Recipients: bird@parker.com pres@young.com pops@armstrong.com
Your readmbox program should be able to handle mailboxes containing messages with folded message header fields. To help make sure, a new version of the original mailbox contains folded fields.


This page last modified on 5 July 2000.