am I in background?

MALEK am at vilya.UUCP
Thu Nov 7 06:39:24 AEST 1985


> On a 4.2 system, is there any reliable way in which a c-program can determine
> .......... if it is run directly from a terminal.
> 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.       Mike O'Shea
The best way top solve your problem is to have "aud" (or some other name).
code for "aud":
if test "$#" = 0
then 
echo YOUR SYNTAX MESSAGE
exit 1
fi
<code for auditing goes here. You can check $1 for which command is running>
# now run the command by exec or sh or ksh......
exec $*

This is rather portable and allows the user to turn on logging when desired.
To force logging, you probably need to add lines or to front end each
command separately.
-- 
Avi Malek @ATT Bell Labs Parsippany, NJ



More information about the Comp.unix.wizards mailing list