spt1@ukc.ac.uk (Stephen Thomas) (02/02/91)
Does anyone know if it is possible for a CLI-based program to sense whether its output (or input) is redirected or not? I have written a version of UN*Xs ``ls'' command, and I would like for it to generate slightly different output if it is being redirected (I want it to terminate lines with just LFs, not LF-CRs). The PRM says that redirection behaves "as if" there is a *SPOOL'ed file open for the duration of the command. Redirection is a separate mechanism, however, because OS_Byte 199 thinks the spooling file handle is 0, even if the command *is* redirected. Any ideas, please? Stephen -- | "You've been having a nightmare. | Stephen Thomas -------------------------| | And it's not over yet." | Email: spt1@ukc.ac.uk; Smail: Computing | | -- Roger Waters, "The Pros and | Lab, University of Kent, CT2 7NZ, UK; | | Cons of Hitchhiking" | Tel: +44 (0)227 764000 x 3824 |