Thinking in C and *nix (CSC 295/282 2014S) : Outlines

Outline 04: Decoding Scripts


Held: Thursday, 13 February 2014

Back to Outline 03 - The Bash Shell - A Refresher. On to Outline 05 - Learning Vi.

Summary

We consider how we might write a program that "cleans up" a typescript file created by script.

Related Pages

Overview

Administrivia

Background

Why did Sam give you this assignment?

Reflection

Algorithm

Given that analysis, what should our algorithm look like?

while input characters remain
    ch = next character
    switch ch
      case backspace:
          remove the last character in the buffer
      case 'n':
          print the buffer, reset
      case '\r'
          ignore the character
      case escape
          read two more characters, which will almost be [ and something
          ignore them
      default
          add the character to the buffer
print whatever remains in the buffer

Build Inputs

Write Programs

Copyright (c) 2013-14 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.