opx25 - execute HALGOL programs
/usr/lbin/uucp/X25/opx25 [-f scriptname] [-c char] [-ofile-descriptor]
[-ifile-descriptor] [-nstring] [-d] [-v]
HALGOL is a simple language for communicating with devices such as
modems and X.25 PADs. It has simple statements similar to send xxx
and expect yyy that are described below.
opx25 recognizes the following options:
-f script Causes opx25 to read script as the input program.
If -f is not specified, opx25 reads the standard
input as a script.
-c char Causes opx25 to use char as the first character in
the input stream instead of actually reading it
from the input descriptor. This is useful
sometimes when the program that calls opx25 is
forced to read a character but then cannot
-o number Causes opx25 to use number for the output file
descriptor (i.e., the device to use for send).
The default is 1.
-i number Causes opx25 to use 'number' for the input file
descriptor (ie, the device to use for 'expect').
The default is 0.
-n string Causes opx25 to save this string for use when \#
is encountered in a send command.
-d Causes opx25 to turn on debugging mode.
-v Causes opx25 to turn on verbose mode.
An opx25 script file contains lines of the following types:
(empty) Empty lines are ignored.
/ Lines beginning with a slash (/) are ignored
ID ID denotes a label, and is limited to
alphanumerics or _.
Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000
send string string must be surrounded by double quotes. The
text is sent to the device specified by the -o
option. Non-printable characters are represented
as in C; i.e., as \DDD, where DDD is the octal
ascii character code. \# in a send string is the
string that followed the -n option.
break Send a break "character" to the device.
expect number string
Here number is how many seconds to wait before
giving up. 0 means wait forever, but this is not
advised. Whenever string appears in the input
within the time allotted, the command succeeds.
Thus, it is not necessary to specify the entire
string. For example, if you know that the PAD
will send several lines followed by an @ prompt,
you could just use @ as the string.
run program args
The program (sleep, date, etc.) is run with the
args specified. Do not use quotes here. Also,
the program is invoked directly (using execp), so
wild cards, redirection, etc. are not possible.
error ID If the most recent expect or run encountered an
error, go to the label ID.
exec program args
Similar to run, but does not fork.
echo string Similar to send, but goes to standard error
instead of to the device.
set debug Sets the program in debug mode. It echoes each
line to /tmp/opx25.log, as well as giving the
result of each expect and run. This can be useful
for writing new scripts. The command set nodebug
disables this feature.
set log Sends subsequent incoming characters to
/var/uucp/.Log/LOGX25. This can be used in the
*.in file as a security measure, because part of
the incoming data stream contains the number of
the caller. There is a similar feature in getx25;
it writes the time and the login name into the
same logfile. The command set nolog disables this
set numlog Similar to set log, but better in some cases
because it sends only digits to the log file, and
Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000
not other characters. The command set nonumlog
disables this feature.
timeout number Sets a global timeout value. Each expect uses
time in the timeout reservoir; when this time is
gone, the program gives up (exit 1). If this
command is not used, there is no global timeout.
Also, the global timeout can be reset any time,
and a value of 0 turns it off.
exit number Exits with this value. 0 is success; anything
else is failure.
To perform a rudimentary test of configuration files, run opx25 by
hand, using the -f option followed by the name of the script file.
opx25 then sends to standard output and expects from standard input;
thus you can type the input, observe the output, and use the echo
command to see messages. See the file /usr/lbin/uucp/X25/ventel.out
for a good example of HALGOL programming.
opx25 was developed by HP.
Hewlett-Packard Company - 3 - HP-UX Release 11i: November 2000