1X3270IF(1) General Commands Manual X3270IF(1)
2
3
4
6 x3270if - command interface to x3270, c3270 and s3270
7
9 x3270if [option]... [ action ]
10 x3270if [option]... -i
11 x3270if [option]... -I emulator-name [-H help-action]
12
14 x3270if provides an interface between scripts and the 3270 emulators
15 x3270, c3270 and s3270.
16
17 x3270if operates in one of three modes. In action mode, it passes a
18 single action and parameters to the emulator for execution. The result
19 of the action is written to standard output, along with the (optional)
20 status of the emulator. (The action is optional as well, so that
21 x3270if can just reports the emulator status.) In iterative mode, it
22 forms a continuous conduit between a script and the emulator. In
23 interactive prompt mode, it displays a prompt, and conveys each command
24 it receives to the emulator.
25
26 The action takes the form:
27
28 action-name(param[,param]...)
29
30 The parentheses are manatory, and usually must be quoted when x3270if
31 is called from a shell script.
32
33 If any param contains a space or comma, it must be surrounded by double
34 quotes.
35
37 -s field
38 Causes x3270if to write to stdout the value of one of the emula‐
39 tor status fields. Field is an integer in the range 0 through
40 11. The value 0 is a no-op and is used only to return exit sta‐
41 tus indicating the state of the emulator. The indices 1-11 and
42 meanings of each field are documented on the x3270-script(1)
43 manual page. If an action is specified as well, the status
44 field is written after the output of the action, separated by a
45 newline. The -s option is mutually exclusive with the -S, -i
46 and -I options.
47
48 -S Causes x3270if to write to stdout the value of all of the emula‐
49 tor status fields. If an action is specified as well, the sta‐
50 tus fields are written after the output of the action, separated
51 by a newline. The -S option is mutually exclusive with the -s,
52 -i and -I options.
53
54 -i Puts x3270if in iterative mode. Data from x3270if's standard
55 input is copied to the emulator's script input; data from the
56 emulator's script output is copied to x3270if's standard output.
57 The -i option is mutually exclusive with the -s, -S and -I
58 options. x3270if runs until it detects end-of-file on its stan‐
59 dard input or on the output from the emulator. (This mode
60 exists primarily to give expect(1) a process to run, on systems
61 which do not support bidirectional pipes.)
62
63 -p process-id
64 Causes x3270if to use a Unix-domain socket to connect to the
65 emulator, rather than pipe file descriptors given in environment
66 variables. The emulator must have been started with the -socket
67 option.
68
69 -I emulator-name
70 Puts x3270if in interactive prompt mode. emulator-name is used
71 as the prompt.
72
73 -H help-action
74 In conjunction with -I, specifies the name of an action that can
75 be used to get interactive help. This action name is displayed
76 in a start-up banner.
77
78 -t port
79 Causes x3270if to use a TCP socket to connect to the emulator,
80 rather than pipe file descriptors given in environment vari‐
81 ables. The emulator must have been started with the -scriptport
82 option.
83
84 -v Turns on verbose debug messages, showing on stderr the literal
85 data that is passed between the emulator and x3270if.
86
88 In action mode, if the requested action succeeds, x3270if exits with
89 status 0. If the action fails, x3270if exits with status 1. In itera‐
90 tive mode, x3270if exits with status 0 when it encounters end-of-file.
91 In interactive prompt mode, x3270if exits with status 0 when it encoun‐
92 ters end-of-file, or if a command is given which ends with a '/' char‐
93 acter. If there is an operational error within x3270if itself, such as
94 a command-line syntax error, missing environment variable, or an unex‐
95 pectedly closed pipe, x3270if exits with a status greater than 2.
96
98 When a script is run as a child process of one of the emulators via the
99 Script action, the emulator passes information about how to control it
100 in environment variables.
101
102 On Unix, the emulator process creates a pair of pipes for communication
103 with the child script process. The values of the file descriptors for
104 these pipes are encoded as text in two environment variables:
105
106 X3270OUTPUT
107 Output from the emulator, input to the child process.
108
109 X3270INPUT
110 Input to the emulator, output from the child process.
111
112 When an emulator is started with the -scriptport option, the emulator
113 will pass the scriptport port number encoded as text in the X3270PORT
114 environment variable. x3270if will use that value as if it had been
115 passed to it via the -t option. X3270PORT takes precedence over
116 X3270OUTPUT and X3270INPUT.
117
119 x3270(1), c3270(1), s3270(1), x3270-script(1)
120
122 Copyright 1999-2009, 2020 Paul Mattes.
123 All rights reserved.
124
125 Redistribution and use in source and binary forms, with or without mod‐
126 ification, are permitted provided that the following conditions are
127 met:
128
129
130 * Redistributions of source code must retain the above copyright
131 notice, this list of conditions and the following disclaimer.
132
133 * Redistributions in binary form must reproduce the above copy‐
134 right notice, this list of conditions and the following dis‐
135 claimer in the documentation and/or other materials provided
136 with the distribution.
137
138 * Neither the names of Paul Mattes nor the names of his contribu‐
139 tors may be used to endorse or promote products derived from
140 this software without specific prior written permission.
141
142
143 THIS SOFTWARE IS PROVIDED BY PAUL MATTES `AS IS' AND ANY EXPRESS OR
144 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAR‐
145 RANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
146 DISCLAIMED. IN NO EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT,
147 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
148 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SER‐
149 VICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
150 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIA‐
151 BILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
152 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
153 SUCH DAMAGE.
154
155
156
157 26 September 2020 X3270IF(1)