idi_tools(1) DG/UX R4.11MU05 idi_tools(1)
NAME
iditools: idiconfirm, idiecho, idierror, idilog, idiwarning -
tools for use with the interface description interpreter
SYNOPSIS
idiconfirm [ -i ] [ -y | -n ] string
idiecho [ string ... ]
idierror [ string ... ]
idilog [ string ... ]
idiwarning [ string ... ]
DESCRIPTION
The iditools are used by commands to communicate with idi(1), the
interface description interpreter. For all commands other than
idiconfirm, if no string is provided, the commands read the string
from standard input.
The iditools commands function in very similar ways, but are
described separately below.
idiconfirm
The idiconfirm program presents a string using the appropriate idi
interface mechanism. If idiconfirm is invoked as a child of an idi
process, the interface of the idi program is used. Otherwise, the
string is written to standard error and the user's response is read
from standard input.
If the string is confirmed, y is written to the standard output;
otherwise, n is written to the standard output.
The following options may be passed to idiconfirm:
-i Present the string only if the command is not a child of
some idi process. If the command is a child of some idi
process, write y to the standard output and exit.
This is for use when the calling program is invoked
interactively.
-n Use negative ("no") as the default response.
-y Use affirmative ("yes") as the default response.
If neither -n or -y is given, affirmative ("yes") is used as the
default response.
idiecho
The idiecho command displays report or listing output using the
appropriate idi interface mechanism. For the idi ASCII display
driver, the string is written to standard output. For the idi Motif
display driver, the string is presented in a separate "report"
window. If there is no parent idi process, the string is written to
standard output.
This command uses idi's builtin :Echo command.
idierror
The idierror command displays error output using the appropriate idi
interface mechanism. For the idi ASCII display driver, the string is
written to standard error with an "Error: " prefix. For the idi
Motif display driver, the string is presented in a separate "error"
window. If there is no parent idi process, the string is written to
standard error.
This command should be used for messages describing conditions which
cause the invoking program to exit with a non-zero exit code.
This command uses idi's builtin :Error command.
idilog
The idilog command displays informational output using the
appropriate idi interface mechanism. The string is also appended to
idi's log file. For the idi ASCII display driver, the string is
written to standard error. For the idi Motif display driver, the
string is written to the main window's text area. If there is no
parent idi process, the string is written to standard error.
This command should be used for informative messages such as "The
host 'mynewhost' has been added.". Any listing or report output
should be displayed with the idiecho command, not by idilog.
This command uses idi's builtin :Log command.
idiwarning
The idiwarning command displays warning messages using the
appropriate idi interface mechanism. For the idi ASCII display
driver, the string is written to standard error with a "Warning: "
prefix. For the idi Motif display driver, the string is written to a
separate "warning" window. If there is no parent idi process, the
string is written to standard error.
This command should be used when the invoking program encounters an
unusual or unexpected condition which does not affect the program's
ability to complete its task. A command which invokes idiwarning is
still expected to exit with a zero exit code (unlike commands which
invoke idierror).
This command uses idi's builtin :Warning command.
Output
Idiconfirm may write the string to standard error (if there is no
parent idi process), and writes either y or n to standard output.
Idiecho may write the string to standard output (if there is no
parent idi process). Idierror, idilog, and idiwarning may write
the string to standard error (if there is no parent idi process).
EXAMPLE
The shell code below demonstrates how these tools might be used:
done=no
while [ $done = "no" ]
do
confirmed=` idiconfirm "Is the tape mounted in ${tape}?" `
case ${confirmed} in
y) done=yes ;;
n) stop=` idiconfirm -n "Quit?" `
case ${stop} in
y) idierror "Operation aborted."; exit 1 ;;
n) continue;;
esac
;;
esac
done
if cpio -ivtBc < ${tape} > ${file}
then
: nothing
else
idierror "Unable to read ${tape}."
exit 1
fi
if setfilepermissions ${file} root other 0644
then
: nothing
else
idiwarning "Unable to set permissions for ${file}."
fi
idiecho "
Mode Owner Size Modification Time File Name
---- ----- ---- ----------------- ---------
`cat ${file}`"
idilog "Read ${tape}."
NOTE
These commands cannot handle messages longer than approximately 2100
bytes. For longer strings, the caller must use multiple invocations
of the iditools commands.
SEE ALSO
idi(1), idl(4).
Licensed material--property of copyright holder(s)