Assignment Quick Links

  1. Overview
  2. Build It
  3. Break It
    1. Infer details
  4. Fix It
  5. Oracle
  6. Program specifications
    1. logappend
    2. logread
  7. Grading
  8. Scoring
  9. Rules

logread

logread queries the state of the gallery. It prints which employees and guests are in the gallery or its rooms, and allows for various time-based queries of the state of the gallery. The following invocations must be supported:

logread -K <token> -S <log>
logread -K <token> -R (-E <name> | -G <name>) <log>

The following invocations are optional (for extra points). If you do not implement an optional feature, be sure to print unimplemented to standard output when an optional argument is provided.

logread -K <token> -T (-E <name> | -G <name>) <log>
logread -K <token> -I (-E <name> | -G <name>) [(-E <name> | -G <name>) ...] <log>

As per the above invocations, only one of -S, -R, -T, or -I may be specified at once.

In what follows, we refer to employees or visitors who are ‘in the gallery’. Each person is expected to first enter the gallery (using logappend option -A) prior to entering any particular room of the gallery. Once in the gallery, he or she may enter and leave various rooms (using logappend options -A -R and options -L -R, respectively). Finally, the person will leave the gallery (using logappend option -L). During this whole sequence of events, a person is considered to be ‘in the gallery’. See the examples for more information.

When output elements are comma-separated lists, there will be no spaces before or after the commas.

If logread is given an employee or guest name that does not exist in the log, it should print nothing about that employee (which may result in empty output).

If logread cannot validate that an entry in the log was created with an invocation of logappend using a matching token, then logread should return a 255 and print “integrity violation” to stdout.

Return values and error conditions