Skip to main content

How Can a Host Detect if Anzio is Running


System developers and administrators would like to take advantage of some of Anzio's special features, using commands sent from the host. But in order to do so, the host program or script must know that it is talking to Anzio. The following are some of the ways this can be determined:

Environment variables

In the telnet and SSH protocols, it is possible for the client to send a set of environment variable definitions to the host, during the login process.  In Anzio, you can set these up in Communicate:Environment, as a series of pairs of


separated by semicolons.  For instance, if this string contained " ANZIO=1", then at login that environment variable would be defined to the process.

However, the telnet daemon or the SSH daemon has to allow the particular variables to be set.  In the past, these daemons allowed any variables to be set.  Recently, however, for security reasons, daemons have been disallowing almost all environment variable setting. So this method may not work. (There are sets of patches available for most all  SSH daemons, to allow environment variable passing.)

TERM variable

The TERM environment variable DOES get passed through the login process in telnet and SSH, because it is so essential to proper terminal emulation.  The TERM variable tells the host what kind of terminal you are emulating.  In Anzio, you can enter a value in Communicate:TERM name; if that is blank, Anzio will automatically construct a TERM variable dependent on the terminal type selected (in Communicate:Terminal Type).

It is possible to enter a special value in Communicate:TERM name, such as "ANZIO-VT220".  Then the login script (.profile or .bashrc, for instance) could inspect the TERM variable to determine whether Anzio was running.  It might also need to reset the TERM variable to something legitimate.

DISPLAY variable

With some daemons, you can set a DISPLAY variable, and it will be passed during the login process. Your login script might need to unset it, so that certain host programs won't think you're running in an X environment.


Many terminals include an ability to respond with an "answerback" string when they are polled.  In Anzio, you can set an answerback string in "Communicate:Answerback" (use a "|" to represent a ).  Typically, the terminal sends the answerback message in response to a control-E (hex 05) coming from the host.

So, in your login script, you could have:

            printf "\x05"

            read ANS

            export ANS

This method has the advantages that it will work in a compatible manner with most dumb terminals, and it will work over all kinds of communication (serial, modem, telnet, etc.).

Prompting for an Anzio specific response 

It is possible to send Anzio commands from the host, by sending a hex-1C before the command, and a hex-1D afterward.  Some commands in Anzio (those ending in "/S") cause Anzio to send a response of some kind to the host.  So a host script can send an Anzio command that generates a response, then do a "read".

The difficulty here is that, if the user is NOT running Anzio, the "read" command will require a response, so the user then must hit the key.  Also, the command may show on the screen, although it can be cleared in a number of ways, such as backspacing over it.

Prompt with timed read

If you have a mechanism in an application to do a "read" operation of some sort, but with a timeout if nothing is received, you can solve the problem just stated.  Just send the terminal an Anzio-specific command, preceded with hex-1C and followed by hex-1D; then do a timed-out read. If no response is received, and the timeout occurs, it's not Anzio.  For instance, send

            ENV/S ANZ_PROGRAM

Then do a timed-out read.  If Anzio is running, it will respond with "ANZIOLITE" or "ANZIOWIN".  If not, a timeout will occur.

We are not aware of any way to do this on Unix/Linux systems using standard commands.

A complete "Timed Read" solution 

Following is, we hope, a complete solution.  It is centered around a program, written in C, that does a timed-out read, and outputs what it read to stdout.  We have called the program "timedread"; the source program is "timedread.c".  The source is shown at the end of this document.  If you are unable to compile this on your Unix/Linux system, contact us for a compiled version, or check

The second piece is a script called "anzdetect", as follows:

# Sample script to detect if Anzio is running. Sets
# environment variable

# ANZ_PROGRAM. To use this script as is, do

#   . ./anzdetect

# Note: requires 'timedread' program in current
# directory

printf "\034env/s

tput el   #erase to end of line



# printf "\n\rYou are running: ${ANZ_PROGRAM}\n\r"

This script will send Anzio a command "env/s anz_program".  Then it backspaces over that text and erases to end-of-line.  Then it runs the timedread program and stores its output in the environment variable ANZ_PROGRAM, and exports that variable.  So, if Anzio is running, ANZ_PROGRAM will be equal to "ANZIOLITE" or "ANZIOWIN".  If Anzio is NOT running, the timedread program will timeout (in two seconds), and ANZ_PROGRAM will be empty.

Note that you will probably want to include these lines in your login script.  If you just execute this script, it will run in a subprocess, and the ANZ_PROGRAM environment variable will not be returned to the calling process.

Following is the timedread.c                      }




TMOUT Login Script read and other automatic Timed Reads

It is possible to set up a simple read within your login script on UNIX and Linux that will act similar to the solution above involving a "timed read".

By setting a small script up (or entering it in your .profile or .login)  that uses the shell's TMOUT command, you can detect if Anzio is present without the shell hanging waiting for a user result if it is NOT Anzio.

Try this script:

printf "\034env/s anz_program\035\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
tput el; #erase to end of line
read a
tput cuu1; # cursor up one line
tput el;
if [ "$a" = "ANZIOWIN" ]; then
echo "AnzioWin is running"
if [ "$a" = "ANZIOLITE" ]; then
echo "Anzio Lite is running"

On SCO UNIX, AIX and other systems, various other "timed read" programs exist that can be called from a shell script and accomplish this same thing, basically waiting for a specific read before timing out of the script.

Also note that the TMOUT exists only in certain shells, such as bash and ksh. Other shells may have similar verbs (check your specific shell documentation).

Copyright © 2023 Rasmussen Software, Inc. Legal Information & Privacy Policy
Send comments and suggestions to