<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>1996</year><year>2016</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>tty - A Command-Line Interface</title>
    <prepared>ETX/B/SFP C. Granbom</prepared>
    <responsible></responsible>
    <docno></docno>
    <approved>EPK/TE (K. Boortz)</approved>
    <checked></checked>
    <date>1996-11-01</date>
    <rev>A</rev>
    <file>tty.xml</file>
  </header>
  <p><c><![CDATA[tty]]></c> is a simple command-line interface program where
    keystrokes are collected and interpreted. Completed lines are sent to the
    shell for interpretation. A simple history mechanism saves previous lines,
    which can be edited before sending them to the shell. <c><![CDATA[tty]]></c>
    is started when Erlang is started with the following command:</p>

  <pre>
erl</pre>

  <p><c><![CDATA[tty]]></c> operates in one of two modes:</p>

  <list type="bulleted">
    <item>
      <p>Normal mode, in which text lines can be edited and sent to the
      shell.</p>
    </item>
    <item>
      <p>Shell break mode, which allows the user to kill the current shell,
        start multiple shells, and so on.</p>
    </item>
  </list>

  <section>
    <title>Normal Mode</title>
    <p>In normal mode keystrokes from the user are collected and interpreted by
      <c><![CDATA[tty]]></c>. Most of the <em>Emacs</em> line-editing commands
      are supported. The following is a complete list of the supported
      line-editing commands.</p>

    <p>Typographic conventions:</p>

    <list type="bulleted">
      <item><c>C-a</c> means pressing the <em>Ctrl</em> key and the letter
        <c>a</c> simultaneously.</item>
      <item><c>M-f</c> means pressing the <em>Esc</em> key and the letter
        <c>f</c> in sequence.</item>
      <item><c>Home</c> and <c>End</c> represent the keys with the same
        name on the keyboard.</item>
      <item><c>Left</c> and <c>Right</c> represent the corresponding arrow
        keys.</item>
    </list>

    <table>
      <row>
        <cell align="left" valign="middle"><em>Key Sequence</em></cell>
        <cell align="left" valign="middle"><em>Function</em></cell>
      </row>
      <row>
        <cell align="left" valign="middle">Home</cell>
        <cell align="left" valign="middle">Beginning of line</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-a</cell>
        <cell align="left" valign="middle">Beginning of line</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-b</cell>
        <cell align="left" valign="middle">Backward character</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-Left</cell>
        <cell align="left" valign="middle">Backward word</cell>
      </row>
      <row>
        <cell align="left" valign="middle">M-b</cell>
        <cell align="left" valign="middle">Backward word</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-d</cell>
        <cell align="left" valign="middle">Delete character</cell>
      </row>
      <row>
        <cell align="left" valign="middle">M-d</cell>
        <cell align="left" valign="middle">Delete word</cell>
      </row>
      <row>
        <cell align="left" valign="middle">End</cell>
        <cell align="left" valign="middle">End of line</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-e</cell>
        <cell align="left" valign="middle">End of line</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-f</cell>
        <cell align="left" valign="middle">Forward character</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-Right</cell>
        <cell align="left" valign="middle">Forward word</cell>
      </row>
      <row>
        <cell align="left" valign="middle">M-f</cell>
        <cell align="left" valign="middle">Forward word</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-g</cell>
        <cell align="left" valign="middle">Enter shell break mode</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-k</cell>
        <cell align="left" valign="middle">Kill line</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-u</cell>
        <cell align="left" valign="middle">Backward kill line</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-l</cell>
        <cell align="left" valign="middle">Redraw line</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-n</cell>
        <cell align="left" valign="middle">Fetch next line from the history
          buffer</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-p</cell>
        <cell align="left" valign="middle">Fetch previous line from the history
          buffer</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-t</cell>
        <cell align="left" valign="middle">Transpose characters</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-w</cell>
        <cell align="left" valign="middle">Backward kill word</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-y</cell>
        <cell align="left" valign="middle">Insert previously killed text</cell>
      </row>
      <row>
        <cell align="left" valign="middle">C-]</cell>
        <cell align="left" valign="middle">Insert matching closing bracket</cell>
      </row>
      <tcaption>tty Text Editing</tcaption>
    </table>
  </section>

  <section>
    <title>Shell Break Mode</title>
    <p>In this mode the following can be done:</p>

    <list type="bulleted">
      <item>Kill or suspend the current shell</item>
      <item>Connect to a suspended shell</item>
      <item>Start a new shell</item>
    </list>
  </section>
</chapter>

