<?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. There is a simple history mechanism, which saves previous lines. These can be edited before sending them to the shell.
    <c><![CDATA[tty]]></c> is started when Erlang is started with the command:<br></br></p>
  <p><em>erl</em></p>
  <p><c><![CDATA[tty]]></c> operates in one of two modes:<br></br></p>
  <list type="bulleted">
    <item>
      <p><em>normal mode</em>, in which lines of text can be edited and sent to the shell.</p>
    </item>
    <item>
      <p><em>shell break</em> mode, which allows the user to kill the current shell, start multiple shells etc. Shell break mode is started by typing <em>Control G</em>.</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.<br></br></p>
    <p><em>Note:</em>	The notation <c><![CDATA[C-a]]></c> means pressing the control key and the letter <c><![CDATA[a]]></c> simultaneously. <c><![CDATA[M-f]]></c> means pressing the <c><![CDATA[ESC]]></c> key followed by the letter <c><![CDATA[f]]></c>. <c><![CDATA[Home]]></c> and <c><![CDATA[End]]></c> represent the keys with the same name on the keyboard, whereas <c><![CDATA[Left]]></c> and <c><![CDATA[Right]]></c> represent the corresponding arrow keys.
      </p>
    <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>
      <tcaption>tty text editing</tcaption>
    </table>
  </section>

  <section>
    <title>Shell Break Mode</title>
    <p><em>tty</em> enters <em>shell</em> break mode when you type <em>Control G</em>. In this mode you can:<br></br></p>
    <list type="bulleted">
      <item>
        <p>Kill or suspend the current shell</p>
      </item>
      <item>
        <p>Connect to a suspended shell</p>
      </item>
      <item>
        <p>Start a new shell</p>
      </item>
    </list>
  </section>
</chapter>

