am I in background?

Michael O'Shea mo at wgivax.UUCP
Wed Nov 6 00:55:06 AEST 1985


On a 4.2 system, is there any reliable way in which a c-program can determine
from within itself if it is running in background and/or has its input and/or
output redirected (from/into a file or through a pipe)?

I am aware of the method on Version 7 systems consisting of checking if the
SIGINT signal is turned off initially, indicating a process started in back-
ground.  This does not work under 4.2.

I am trying to implement an automatic audit trail mechanism which allows users
to enter optional comments at the beginning of major system utilities (sort,
awk, sed, etc.)  The problem is that many of our users frequently use pipes,
file redirection, and background processing, thus making the task of knowing
when to query for a comment more complex.

Thank you in advance.

Mike O'Shea  (decvax!mcnc!unccvax!wgivax!mo)



More information about the Comp.unix.wizards mailing list