OPX25(1M)
NAME
opx25 − execute HALGOL programs
SYNOPSIS
opx25 [−fscriptname] [−cchar] [−ofile-descriptor] [−ifile-descriptor] [−nstring] [−d] [−v]
HP-UX COMPATIBILITY
Level: HP-UX/NON-STANDARD
Origin:
HP
DESCRIPTION
HALGOL is a simple language for communicating with devices such as modems and X.25 PADs. It has simple statements like send xxx and expect yyy which are descibed below.
Options:
−f script
Causes opx25 to read script as the input program. If -f is not specified, then opx25 reads stdin for the 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 sometimes useful when the program that calls opx25 is forced to read a character but then cannot "unread" it.
−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 (i.e., 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 type:
(empty)
Empty lines are ignored.
/ Lines beginning with a slash "/" are ignored (comments)
ID ID denotes a label. ID is limited to alphanumerics or "_".
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 isn’t advised. Whenever STRING appears in the input within the time allotted, the command succeeds. Thus, it isn’t necessary to specify the entire string. For example, if you know that the PAD will send several lines followed by a "@" prompt, you could just use "@" as the string.
run program args
The program (sleep, date, or whatever) is run with the args specified. Don’t use quotes here. Also, the program is invoked directly (with 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
Like run, but doesn’t fork.
echo STRING
Like send, but goes to stderr 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" will turn off this feature.
set log
Sends subsequent incoming characters to /usr/spool/uucp/X25LOG. This can be used in the *.in file as a security measure, since 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" will turn off this feature.
set numlog
Like "set log," but better in some cases, because it sends only digits to the log file. The command "set nonumlog" will turn off 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 isn’t 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.
You can crudely test configuration files by running opx25 by hand, using the argument -f followed by the name of the script file. The program in this case sends to, and expects from, standard output and input, so you can type the input, observe the output, and see messages with the "echo" command. See the file /usr/lib/uucp/X25/ventel.out for a good example of HALGOL programming.
SEE ALSO
getx25(1C), uucp(1C).
Serial Network Communications Guide
Hewlett-Packard — last mod. May 11, 2021