FEP(1L)

NAME
fep — general purpose front end processor

SYNOPSIS
fep [-emacs|-vi] UNIX-command

DESCRIPTION
Fep is a general purpose front end processor applicable to most UNIX commands that features vi(1)- or emacs(1)-like line editing and a command history mechanism like that of csh(1).

Choice of editing style is made by selecting either the emacs mode or the vi mode (named for the editors they emulate), specified either by command line option or by setting a variable interactively or in the start-up file or environment EDITMODE (see editmode variable).

The default key bindings are shown below for both edit modes. These can be customized using the fep-bind command.

Emacs Bindings

Here follow the default key bindings for the emacs mode. Each function name should be self-explanatory. The function names are defined as similarly to Gosling's emacs as possible.

    ^@	mark
    ^A	beginning-of-line
    ^B	backward-character
    ^D	delete-next-character
    ^E	end-of-line
    ^F	forward-character
    ^I	insert-tab
    ^J	new-line
    ^K	kill-to-end-of-line
    ^L	clear-screen
    ^M	new-line
    ^N	next-history
    ^P	previous-history
    ^T	previous-history
    ^Y	yank-from-kill-buffer
    ^^	toggle-transparency
    ^X-^B	show-bindings
    ^X-^H	show-history
    ^X-^C	terminate
    ^X-^D	send-eof
    ^X-^L	repaint
    ^X-^V	view-buffer
    ^X-(	start-script
    ^X-)	end-script
    esc-b	backward-word
    esc-B	backward-word
    esc-d	delete-next-word
    esc-D	delete-next-word
    esc-f	forward-word
    esc-F	forward-word
    esc-h	delete-previous-word
    esc-H	delete-previous-word
    esc-l	list-file-name
    esc-L	list-file-name
    esc-esc	expand-file-name
    esc-?	help
    esc-_	invoke-shell
    esc-<	search-reverse
    esc->	search-forward
    esc-p	insert-previous-history
    esc-n	insert-next-history
    esc-.	insert-current-history
    /* Bindings inherited from the tty driver */
    erase	delete-previous-character
    kill	delete-line
    rprnt	reprint
    werase	delete-previous-word
    lnext	literal-next

Vi bindings

The vi mode has two sub-modes, the command mode and the text insert mode. The commands of vi are emulated as correctly as possible. Here is a list of the default key bindings of the vi mode that differ from normal vi commands. The tty driver control characters are also inherited in this mode.

    n	search-reverse
    N	search-forward
    ^A	expand-file-name
    ^L	list-file-name
    ^N	next-history
    ^P	previous-history
    ^R	reprint
    ^^	toggle-transparency
    ^X-^B	show-bindings
    ^X-^C	terminate
    ^X-^D	send-eof
    ^X-^H	show-history
    ^X-^L	repaint
    ^X-^X	expand-file-name
    ^X-^V	view-buffer
    ^X-l	list-file-name
    ^X-L	list-file-name
    ^X-?	help
    ^X-(	start-script
    ^X-)	end-script

Built-in commands

Fep has some built-in commands that are not passed to the child process but understood and processed by fep itself. These commands can be issued from the terminal or from the start-up file.

    fep-bind function-name key-binding
        Change key bindings. For example, to bind the function list-file-name to the string "^X-^X", type the following:

        MMMMM'u'fep-bind list-file-name "\^X\^X"

    fep-alias
    fep-alias name
    fep-alias name string
        The first form prints all aliases. The second form prints the alias for name. The last form set the alias for name to string.

        You can refer arguments in command line by !^, !$, !*; they stand for first, last, all arguments correspondingly.

        To specify multiple commands in one alias, command should be separated by semicolon (;) character. For example, next description will allow you to execute fep-cd then pass cd command to shell when input ``cd'' command.

        MMMMM'u'fep-alias cd 'fep-cd !$;cd !$'

        Note: Fep built-in functions must be defined before normal commands.

        If you use fep without auto-tty-fix, following alias could be usefull.

         MMMMM'u'if $command == sh
         MMMMMMMMMM'u'fep-alias more "fep-command more"
         MMMMMMMMMM'u'fep-alias vi "fep-command vi"
         MMMMM'u'endif

    fep-unalias list
        Remove alias for each name in list.

    fep-set variable = value
        Set a variable of fep to some value.

    fep-unset variable
        Unset a variable.

    fep-cd [ directory ]
    fep-chdir [ directory ]
        Change directory. It sometimes happens that a child process has changed directory, but fep is still in the old directory. In such a case, neither list-file-name nor expand-file-name will function as expected. This command allows you to change fep's current working directory (default = home directory).

    fep-pwd
        Print fep's current working directory.

    fep-history [ number of line ]
        Show the history of commands under fep.

    fep-echo arguments
        Only print the arguments. Variable names can be used prefixed by the "$" character.

    fep-source file
        Read the specified file and execute it. The contents of the file are not sent to sub-processes.

    fep-save-history [ number of lines to save ] file
        Save the current history buffer in the specified file.

    fep-read-history  [ file ]
        Read in the command history from the specified file. The default file is the value of the history-file variable. This file name is understood as a path relative to the home directory. If you want to specify the name relative to the current directory instead, prefix the path by "./".

    fep-command command
    fep-! command
        Execute command.

    quit-fep
        Kill the sub-process and exit.

    fep-suspend
        Suspend fep itself. In the unlikely possibility that fep falls into a dead-lock in which the sub-processes have stopped but fep is still running, use this command to escape from the situation.

    fep-read-from-file file
    fep-< file
        Read data from specified file and send them to sub-process. The sub-process will read the data from the file as if they are typed at the keyboard.

    fep-read-from-command command
    fep-<! command
        Send output of specified command to sub-process.

    fep-start-script [ script-file ]
    fep-script [ script-file ]
        Start to send input and output to a script file. If script-file is specified, it is used. If not the value of the variable script-file will be used.

    fep-stop-script
        Stop scripting.

    fep-show-bind
        Print current binding information.

    fep-repaint [ line ]
        Repaint last output from command to screen. ``line'' specifies number of lines to repaint (default is screenful maximum). See also ``auto-repaint'' and ``clear-repaint'' variables.

Control structures

    fep-if expression
    fep-elseif expression
    fep-else
    fep-endif
        Only four control structures are supported but that seems enough. Expression allows only the two operators "==" and "!=". Variables can be referenced by prefixing with the "$" character.

Note: The "fep-" prefix of the built-in functions and the above operators can be abbreviated in commands that fep executes from a file.

Comment

Lines starting with the character "#" are ignored by fep. If fep encounters a comment in interaction, it is sent to the sub-process. In reading from a file, comments will merely be ignored.

Variables

Fep uses some variables.

    alarm-on-eof	default: off
        If this variable is set AND the function send-eof is not bound to the eof character AND the variable ignore-eof is not set, an alarm message will be displayed once the first time eof is encountered on an empty line.

    auto-repaint	default: off
        If this variable is set, fep automatically repaints the screen after restarting.

    auto-tty-fix	default: on
        If this variable is set, fep looks at the tty mode of the sub-command, and if the tty mode has changed, fep fixes the tty mode of standard out and sets the transparency flag according to the mode. If this variable is not set, the automatic tty mode check is not done, so you have to change the tty mode and transparency explicitly using the toggle-transparency function.

    buffer	default: 5120
        Specifies command output buffer size. High-watermark used in buffer management mechanism will be set 4/5 of this count.

    clear-repaint	default: off
        If this variable is set, fep clears the screen before repainting.

    command	default: command-name
        Fep set this variable to the command name of the sub-process when it starts up.

    crt	default: terminal size
        If set, more message is shown during printing the key bindings on each number of line specified by this variable.

    delimiters	default: SPACE & TAB
        The contents of this variable are treated as delimiting characters for file name expantion and file name list.

    editmode	default: emacs
        This variable defines the mode for command line editing. Key bindings will be set for the appropriate defaults when this variable is changed. Fep first looks at the environment variable EDITMODE, then looks at any command line arguments, and finally reads in the .feprc start-up file.

    expand-tilde	default: on
        Fep expands "~" to the real home directory name by the expand-file-name function when this variable is set.

    history	default: 100
        Fep maintains a history file of the length specified by this variable.

    history-file	default: .fephistory
        Contains the name of the history file for reading from and writing to. If the file described by this variable exists, fep will read the file into the history buffer on start up and then save the current session's history when it exits.

    ignore-empty-line	default: on
        If this variable is set, empty command lines are not saved in the history file.

    ignore-eof	default: off
        Fep never worries about the eof character if this variable is set.

    ignore-same-line	default: on
        If this variable is set, command lines identical to the previous command line are not saved to the history file.

    ignore-short-line	default: on
        If this variable is set, command lines which is shorter than this value are not saved to the history file.

    noalias	default: off
        If set, command aliasing won't be done.

    prompt	default: see below
        Fep outputs a prompt after executing built-in functions. The default string is set to the NULL string, but there are some default prompt strings for some common commands such as sh, dbx, lpc, mail, sendmail -bt and calc. However, since fep doesn't care about what program is running, the same prompt is still output when you are executing bc from sh.
        You can change the value of prompt and other variables in the start-up file as follows:

         MMMMM'u'if $command == sh
         MMMMMMMMMM'u'set prompt = "$ "
         MMMMM'u'endif

    savehist	default: off
        If savehist is set fep saves the number of history entries specified by value of this variable in the file named in the variable history-file on terminating.

    script-file	default: fepscript
        This variable is used by the fep-start-script command and by the start-script function.

    shell	default: /bin/sh
        Describe the command name to be invoked by invoke-shell.

    showhist	default: terminal size
        This variable specifies the number of history lines to be displayed by the show-history function.

    tty-fix-bell	default: off
        If this variable is set, fep rings the bell when the tty mode is changed.

Start-Up File

Fep executes the file ".feprc" in the home directory of the user if it is found there when starting up. It looks for arguments on the command line first, and only then reads the ".feprc" file, so the file has higher priority.

Functions

    abort	Abort function
    backward-Word	Backward word (non-space)
    backward-character	Backward character
    backward-word	Backward word (alpha-numeric)
    beginning-of-line	Jump to beginning of line
    clear-screen	Clear screen
    delete-line	Delete whole line
    delete-next-Word	Delete next word (non-space)
    delete-next-character	Delete next character
    delete-next-word	Delete next word (alpha-numeric)
    delete-previous-Word	Delete previous word (non-space)
    delete-previous-character	Delete previous character
    delete-previous-word	Delete previous word (alpha-numeric)
    delete-to-kill-buffer	Delete resion to buffer
    end-of-line	Jump to end of line
    end-script	End script
    expand-file-name	Expand file name
    fix-transparency	Check tty and change transparency mode
    forward-Word	Forward word (non-space)
    forward-character	Forward character
    forward-to-end-of-Word	Forward to end of word (non-space)
    forward-to-end-of-word	Forward to end of word (alpha-numeric)
    forward-word	Forward word (alpha-numeric)
    help	Show help
    ignore	Ignore
    insert-and-flush	Insert the character and flush buffer
    insert-tab	Insert tab
    invoke-shell	Invoke shell process
    kill-to-end-of-line	Delete current position to eol
    kill-to-top-of-line	Delete tol to current position
    list-file-name	List file name
    literal-next	Treat next character as literal
    mark	Mark position
    new-line	Insert newline
    next-history	Get next history
    previous-history	Get previous history
    insert-next-history	Insert next history
    insert-previous-history	Insert previous history
    insert-current-history	Insert current history
    repaint	Repaint screen
    reprint	Reprint line
    search-forward	Search forward last !history
    search-reverse	Search backward last !history
    self-insert	Insert the character
    send-eof	Send eof
    show-bindings	Show binding table
    show-history	Show history
    start-script	Start script
    suspend	Suspend fep
    terminate	Terminate fep
    toggle-transparency	Change transparency mode
    vi-c	Vi c? commands
    vi-d	Vi d? commands
    vi-edit	Vi edit commands
    vi-ins-edit	Vi insert mode
    vi-motion	Vi cursor motion commands
    vi-new-line	Vi new line
    vi-num	Vi prefix number
    view-buffer	View buffer
    yank-from-kill-buffer	Yank from kill buffer

Probably only the function name "toggle-transparency" is hard to understand. This function is provided for entering non-line-oriented tools from a line-oriented tool using fep. Assume a situation where you are using sh(1) with fep, and then invoke vi(1). Since fep intercepts all input for editing, vi cannot work correctly. You can escape from this annoying situation using the "toggle-transparency" function which is bound to the Control-^ key by default. Of course, it is also necessary to return to the normal mode after exiting vi.

Note, however, that this tty mode fix can also be done automatically. If the auto-tty-fix variable is set, fep looks at the tty mode of the sub-command and fixes the tty mode of standard input accordingly.

OTHERS

Fep can handle SHIFT-JIS kanji code if compiled with the -DKANJI flag.

SEE ALSO
newcsh(1)

COPYRIGHT
Copyright (c) 1987, 1988 by Software Research Associates, Inc.
Distribution without fee is allowed as long as all copyright notices are included.

AUTHOR
K. Utashiro
Software Research Associates, Inc., Japan.
    UUCP:	kddlab!srava.sra.junet!utashiro
    ARPA:	utashiro%sra.junet@uunet.uu.net
    JUNET:	utashiro@sra.junet

FILES
~/.feprc, ./.feprc	start-up file
~/.fephistory	default history file
./fepscript	default script file

BUGS

While working on the program the author sometimes lost his mind, whereupon so did the program.