<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>1996</year><year>2010</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.

      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights 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>. 
      </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">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">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">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">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-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-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>

