X3270IF(1)X3270IF(1)NAMEx3270if - command interface to x3270, c3270 and s3270
SYNOPSISx3270if [option]... [ action ]
x3270if-i
DESCRIPTIONx3270if provides an interface between scripts and the 3270 emulators
x3270, c3270, and s3270.
x3270if operates in one of two modes. In action mode, it passes a sin‐
gle action and parameters to the emulator for execution. The result of
the action is written to standard output, along with the (optional)
status of the emulator. (The action is optional as well, so that
x3270if can just reports the emulator status.) In iterative mode, it
forms a continuous conduit between a script and the emulator.
The action takes the form:
action-name(param[,param]...)
The parentheses are manatory, and usually must be quoted when x3270if
is called from a shell script.
If any param contains a space or comma, it must be surrounded by double
quotes.
OPTIONS-s field
Causes x3270if to write to stdout the value of one of the emula‐
tor status fields. Field is an integer in the range 0 through
11. The value 0 is a no-op and is used only to return exit sta‐
tus indicating the state of the emulator. The indices 1-11 and
meanings of each field are documented on the x3270-script(1)
manual page. If an action is specified as well, the status
field is written after the output of the action, separated by a
newline. The -s option is mutually exclusive with the -S and -i
options.
-S Causes x3270if to write to stdout the value of all of the emula‐
tor status fields. If an action is specified as well, the sta‐
tus fields are written after the output of the action, separated
by a newline. The -S option is mutually exclusive with the -s
and -i options.
-i Puts x3270if in iterative mode. Data from x3270if's standard
input is copied to the emulator's script input; data from the
emulator's script output is copied to x3270if's standard output.
The -i option is mutually exclusive with the -s and -S options.
x3270if runs until it detects end-of-file on its standard input
or on the output from the emulator. (This mode exists primarily
to give expect(1) a process to run, on systems which do not sup‐
port bidirectional pipes.)
-p process-id
Causes x3270if to use a Unix-domain socket to connect to the
emulator, rather than pipe file descriptors given in environment
variables. The emulator must have been started with the -socket
option.
-t port
Causes x3270if to use a TCP socket to connect to the emulator,
rather than pipe file descriptors given in environment vari‐
ables. The emulator must have been started with the -scriptport
option.
-v Turns on verbose debug messages, showing on stderr the literal
data that is passed between the emulator and x3270if.
EXIT STATUS
In action mode, if the requested action succeeds, x3270if exits with
status 0. If the action fails, x3270if exits with status 1. In itera‐
tive mode, x3270if exits with status 0 when it encounters end-of-file.
If there is an operational error within x3270if itself, such as a com‐
mand-line syntax error, missing environment variable, or an unexpect‐
edly closed pipe, x3270if exits with status 2.
ENVIRONMENT
When a script is run as a child process of one of the emulators via the
Script action, the emulator passes information about how to control it
in environment variables.
On Unix, the emulator process creates a pair of pipes for communication
with the child script process. The values of the file descriptors for
these pipes are encoded as text in two environment variables:
X3270OUTPUT
Output from the emulator, input to the child process.
X3270INPUT
Input to the emulator, output from the child process.
On Windows, or when a Unix emulator is started with the -scriptport
option, the emulator will pass the port number encoded as text in the
X3270PORT environment variable. x3270if will use that value as if it
had been passed to it via the -t option. X3270PORT takes precedence
over X3270OUTPUT and X3270INPUT.
SEE ALSOx3270(1), c3270(1), s3270(1), x3270-script(1)COPYRIGHT
Copyright 1999-2009, Paul Mattes.
All rights reserved.
Redistribution and use in source and binary forms, with or without mod‐
ification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copy‐
right notice, this list of conditions and the following dis‐
claimer in the documentation and/or other materials provided
with the distribution.
* Neither the names of Paul Mattes nor the names of his contribu‐
tors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY PAUL MATTES `AS IS' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR‐
RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SER‐
VICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIA‐
BILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
24 August 2011 X3270IF(1)