<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;

  <!ENTITY expect-download-http "http://prdownloads.sourceforge.net/expect/expect&expect-version;.tar.gz">
  <!ENTITY expect-download-ftp  " ">
  <!ENTITY expect-md5sum        "44e1a4f4c877e9ddc5a542dfa7ecc92b">
  <!ENTITY expect-size          "620 KB">
  <!ENTITY expect-buildsize     "4.1 MB">
  <!ENTITY expect-time          "0.2 SBU">
]>

<sect1 id="expect" xreflabel="Expect-&expect-version;">
  <?dbhtml filename="expect.html"?>

  <sect1info>
    <othername>$LastChangedBy: bdubbs $</othername>
    <date>$Date: 2015-02-20 16:15:05 -0500 (Fri, 20 Feb 2015) $</date>
  </sect1info>

  <title>Expect-&expect-version;</title>

  <indexterm zone="expect">
    <primary sortas="a-Expect">Expect</primary>
  </indexterm>

  <sect2 role="package">
    <title>Introduction to Expect</title>

    <para>The <application>Expect</application> package was installed in the
    LFS temporary tools directory for testing other packages.  These
    procedures install it in a prmanent location.  It contains tools for
    automating interactive applications such as <command>telnet</command>,
    <command>ftp</command>, <command>passwd</command>,
    <command>fsck</command>, <command>rlogin</command>,
    <command>tip</command>, etc. <application>Expect</application> is
    also useful for testing these same applications as well as easing all sorts of
    tasks that are prohibitively difficult with anything else.</para>

    &lfs77_checked;

    <bridgehead renderas="sect3">Package Information</bridgehead>
    <itemizedlist spacing="compact">
      <listitem>
        <para>Download (HTTP): <ulink url="&expect-download-http;"/></para>
      </listitem>
      <!-- <listitem>
        <para>Download (FTP): <ulink url="&expect-download-ftp;"/></para>
      </listitem> -->
      <listitem>
        <para>Download MD5 sum: &expect-md5sum;</para>
      </listitem>
      <listitem>
        <para>Download size: &expect-size;</para>
      </listitem>
      <listitem>
        <para>Estimated disk space required: &expect-buildsize;</para>
      </listitem>
      <listitem>
        <para>Estimated build time: &expect-time;</para>
      </listitem>
    </itemizedlist>

    <bridgehead renderas="sect3">Expect Dependencies</bridgehead>

    <bridgehead renderas="sect4">Required</bridgehead>
    <para role="required"><xref linkend="tcl"/></para>

    <bridgehead renderas="sect4">Optional</bridgehead>
    <para role="optional"><xref linkend="tk"/></para>

    <para condition="html" role="usernotes">User Notes:
    <ulink url="&blfs-wiki;/expect"/></para>

  </sect2>

  <sect2 role="installation">
    <title>Installation of Expect</title>

    <para>Install <application>Expect</application> by running the following
    commands:</para>

    <!-- Not sure if we need a static library as it does not build by default
         any longer. Only a .so library is installed when passing
         'enable-shared'. -->
<screen><userinput>./configure --prefix=/usr           \
            --with-tcl=/usr/lib     \
            --enable-shared         \
            --mandir=/usr/share/man \
            --with-tclinclude=/usr/include &amp;&amp;
make</userinput></screen>

    <para>To test the results, issue: <command>make test</command>.</para>

    <para>Now, as the <systemitem class="username">root</systemitem> user:</para>

<screen role="root"><userinput>make install &amp;&amp;
ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib</userinput></screen>

  </sect2>

  <sect2 role="commands">
    <title>Command Explanations</title>

    <para><parameter>-with-tcl=/usr/lib</parameter>: This parameter is used to
    tell the <command>configure</command> script where the
    <command>tclConfig.sh</command> is located.</para>

    <para><parameter>--enable-shared</parameter>: This option enables
    building the shared library.</para>

    <!-- Not really sure if this is required any longer as the library is now
         installed directly in /usr/lib/expect5.45/. -->
    <para><command>ln -sf ...</command>: This command creates a required link
    to the shared library.</para>

  </sect2>

  <sect2 role="configuration">
    <title>Configuring Expect</title>

    <sect3 id="expect-config">
      <title>Config Files</title>

      <para><filename>$exp_library/expect.rc</filename> and
      <filename>~/.expect.rc</filename></para>

      <indexterm zone="expect expect-config">
        <primary sortas="e-AA.expect.rc">~/.expect.rc</primary>
      </indexterm>

      <indexterm zone="expect expect-config">
        <primary sortas="e-A.exp_library-expect.rc">$exp_library/expect.rc</primary>
      </indexterm>

    </sect3>

    <sect3>
      <title>Configuration Information</title>

      <para>Reference the <command>expect</command> man page for information about
      utilizing the <filename>expect.rc</filename> configuration files. Additionally,
      many of the tools contained in the <application>Expect</application> package
      will use their own configuration files. Reference the respective man page, or
      examine the script directly for configuration file information.</para>

    </sect3>

  </sect2>

  <sect2 role="content">
    <title>Contents</title>

    <segmentedlist>
      <segtitle>Installed Programs</segtitle>
      <segtitle>Installed Library</segtitle>
      <segtitle>Installed Directory</segtitle>

      <seglistitem>
        <seg>autoexpect, autopasswd, cryptdir, decryptdir, dislocate, expect, ftp-rfc,
        kibitz, lpunlock, mkpasswd, passmass, rftp, rlogin-cwd, timed-read, timed-run,
        unbuffer, weather, and optionally (if <application>Expect</application> was
        linked against <application>Tk</application>), multixterm,
        tknewsbiff, tkpasswd, xkibitz, and xpstat</seg>
        <seg>libexpect&expect-version;.so</seg>
        <seg>/usr/lib/expect&expect-version;</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="autoexpect">
        <term><command>autoexpect</command></term>
        <listitem>
          <para>generates an <application>Expect</application> script from
          watching a session.</para>
          <indexterm zone="expect autoexpect">
            <primary sortas="b-autoexpect">autoexpect</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="autopasswd">
        <term><command>autopasswd</command></term>
        <listitem>
          <para>is a wrapper to make <command>passwd</command>(1) be
          non-interactive.</para>
          <indexterm zone="expect autopasswd">
            <primary sortas="b-autopasswd">autopasswd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="cryptdir">
        <term><command>cryptdir</command></term>
        <listitem>
          <para>encrypts all files in a directory.</para>
          <indexterm zone="expect cryptdir">
            <primary sortas="b-cryptdir">cryptdir</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="decryptdir">
        <term><command>decryptdir</command></term>
        <listitem>
          <para>decrypts all files in a directory.</para>
          <indexterm zone="expect decryptdir">
            <primary sortas="b-decryptdir">decryptdir</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="dislocate">
        <term><command>dislocate</command></term>
        <listitem>
          <para>allows processes to be disconnected and reconnected to a
          terminal.</para>
          <indexterm zone="expect dislocate">
            <primary sortas="b-dislocate">dislocate</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="expect-prog">
        <term><command>expect</command></term>
        <listitem>
          <para>is a program that <quote>talks</quote> to other interactive
          programs according to a script.</para>
          <indexterm zone="expect expect-prog">
            <primary sortas="b-expect">expect</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="ftp-rfc">
        <term><command>ftp-rfc</command></term>
        <listitem>
          <para>retrieves an RFC (or the index) from UUNET.</para>
          <indexterm zone="expect ftp-rfc">
            <primary sortas="b-ftp-rfc">ftp-rfc</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="kibitz">
        <term><command>kibitz</command></term>
        <listitem>
          <para>allows two (or more) people to interact with one shell
          (or any arbitrary program).</para>
          <indexterm zone="expect kibitz">
            <primary sortas="b-kibitz">kibitz</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="lpunlock">
        <term><command>lpunlock</command></term>
        <listitem>
          <para>unhangs a printer which claims it is <quote>waiting for
          lock</quote>.</para>
          <indexterm zone="expect lpunlock">
            <primary sortas="b-lpunlock">lpunlock</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="mkpasswd">
        <term><command>mkpasswd</command></term>
        <listitem>
          <para>generates passwords and can apply them automatically to
          users.</para>
          <indexterm zone="expect mkpasswd">
            <primary sortas="b-mkpasswd">mkpasswd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="passmass">
        <term><command>passmass</command></term>
        <listitem>
          <para>changes a password on multiple machines.</para>
          <indexterm zone="expect passmass">
            <primary sortas="b-passmass">passmass</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="rftp">
        <term><command>rftp</command></term>
        <listitem>
          <para>is much like <command>ftp</command> except it uses
          <option>~g</option> and <option>~p</option> instead of
          <option>mget</option> and <option>mput</option>.</para>
          <indexterm zone="expect rftp">
            <primary sortas="b-rftp">rftp</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="rlogin-cwd">
        <term><command>rlogin-cwd</command></term>
        <listitem>
          <para>is <command>rlogin</command> except it uses the local current
          directory as the current working directory on the remote machine.</para>
          <indexterm zone="expect rlogin-cwd">
            <primary sortas="b-rlogin-cwd">rlogin-cwd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="timed-read">
        <term><command>timed-read</command></term>
        <listitem>
          <para> reads a complete line from stdin and aborts after a given
          number of seconds.</para>
          <indexterm zone="expect timed-read">
            <primary sortas="b-timed-read">timed-read</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="timed-run">
        <term><command>timed-run</command></term>
        <listitem>
          <para>runs a program for a given amount of time.</para>
          <indexterm zone="expect timed-run">
            <primary sortas="b-timed-run">timed-run</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="unbuffer">
        <term><command>unbuffer</command></term>
        <listitem>
          <para>disables the output buffering that occurs when program output
          is redirected.</para>
          <indexterm zone="expect unbuffer">
            <primary sortas="b-unbuffer">unbuffer</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="weather">
        <term><command>weather</command></term>
        <listitem>
          <para>retrieves a weather report (courtesy University of Michigan)
          for a given city or geographical area.</para>
          <indexterm zone="expect weather">
            <primary sortas="b-weather">weather</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="multixterm">
        <term><command>multixterm</command></term>
        <listitem>
          <para>creates multiple <command>xterm</command>s that can be driven
          together or separately.</para>
          <indexterm zone="expect multixterm">
            <primary sortas="b-multixterm">multixterm</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="tknewsbiff">
        <term><command>tknewsbiff</command></term>
        <listitem>
          <para>pops up a window when there is unread news in your favorite
          newsgroups and removes the window after you've read the news.</para>
          <indexterm zone="expect tknewsbiff">
            <primary sortas="b-tknewsbiff">tknewsbiff</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="tkpasswd">
        <term><command>tkpasswd</command></term>
        <listitem>
          <para>is a script to change passwords using
          <command>expect</command> and <application>Tk</application>.</para>
          <indexterm zone="expect tkpasswd">
            <primary sortas="b-tkpasswd">tkpasswd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="xkibitz">
        <term><command>xkibitz</command></term>
        <listitem>
          <para>allows users in separate <command>xterm</command>s to share
          one shell (or any program that runs in an <command>xterm</command>).</para>
          <indexterm zone="expect xkibitz">
            <primary sortas="b-xkibitz">xkibitz</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="xpstat">
        <term><command>xpstat</command></term>
        <listitem>
          <para>is a script that acts as a front-end for <command>xpilot</command>.</para>
          <indexterm zone="expect xpstat">
            <primary sortas="b-xpstat">xpstat</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libexpect">
        <term><filename class='libraryfile'>libexpect&expect-version;.so</filename></term>
        <listitem>
          <para> contains functions that allow <application>Expect</application> to be
          used as a <application>Tcl</application> extension or to be used directly from
          C or C++ (without <application>Tcl</application>).</para>
          <indexterm zone="expect libexpect">
            <primary sortas="c-libexpect&expect-version;">libexpect&expect-version;.so</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
