IS.DEFAULT - determine if I/O unit is default.

Alternate Entry Name: IS_DEF

Usage:

B:
   ret = is.default( unit );
C:
   int is_default(FILE *unit);

Description:

IS.DEFAULT returns a non-zero value if the given "unit" is attached to its default device, and otherwise returns zero. The terminal is the default device for units 0 and 1 (the standard input and output units). Thus IS.DEFAULT provides a mechanism for determining if one of the standard units has been redirected on the command line.

Note that a command line of the form

command >

contains an output redirection even though the standard output is simply redirected to the terminal. Therefore "is.default(1)" will be zero (indicating redirection) even though output still goes to the terminal. With a command line of the form

command

"is.default(1)" will be non-zero.

Units on which there is currently no open file are considered to be attached to a default null device, and IS.DEFAULT will return a non-zero value.

Copyright © 1996, Thinkage Ltd.