idi_tools(1) DG/UX 5.4.2 idi_tools(1)
NAME
idi_tools: idi_confirm, idi_echo, idi_error, idi_log, idi_warning -
tools for use with the interface description interpreter
SYNOPSIS
idi_confirm [ -iny ] string
idi_echo [ string ... ]
idi_error [ string ... ]
idi_log [ string ... ]
idi_warning [ string ... ]
DESCRIPTION
The idi_tools are used by commands to communicate with idi(1), the
interface description interpreter. The idi_tools commands function
in very similar ways, but are described separately below.
idi_confirm
The idi_confirm program presents a string using the appropriate idi
interface mechanism. If idi_confirm 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 idi_confirm:
-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.
idi_echo
The idi_echo 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.
idi_error
The idi_error command displays error output using the appropriate idi
Licensed material--property of copyright holder(s) 1
idi_tools(1) DG/UX 5.4.2 idi_tools(1)
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.
idi_log
The idi_log 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 idi_echo command, not by idi_log.
This command uses idi's builtin :Log command.
idi_warning
The idi_warning 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 idi_warning is
still expected to exit with a zero exit code (unlike commands which
invoke idi_error).
This command uses idi's builtin :Warning command.
Output
Idi_confirm may write the string to standard error (if there is no
parent idi process), and writes either y or n to standard output.
Idi_echo may write the string to standard output (if there is no
parent idi process). Idi_error, idi_log, and idi_warning 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" ]
Licensed material--property of copyright holder(s) 2
idi_tools(1) DG/UX 5.4.2 idi_tools(1)
do
confirmed=` idi_confirm "Is the tape mounted in ${tape}?" `
case ${confirmed} in
y) done=yes ;;
n) stop=` idi_confirm -n "Quit?" `
case ${stop} in
y) idi_error "Operation aborted."; exit 1 ;;
n) continue;;
esac
;;
esac
done
if cpio -ivtBc < ${tape} > ${file}
then
: nothing
else
idi_error "Unable to read ${tape}."
exit 1
fi
if set_file_permissions ${file} root other 0644
then
: nothing
else
idi_warning "Unable to set permissions for ${file}."
fi
idi_echo "
Mode Owner Size Modification Time File Name
---- ----- ---- ----------------- ---------
`cat ${file}`"
idi_log "Read ${tape}."
SEE ALSO
idi(1), idl(4).
Licensed material--property of copyright holder(s) 3