Foreground/background execution detection

Larry R. Ader lra00 at ccc.amdahl.com
Mon May 13 12:41:29 AEST 1991


In some of the programs and (csh) scripts that I write, I would like to take
different action depending on whether the program or script is exectuing in
the foreground or background.

I was wondering if any of you could provide a (hopefully) simple answer
to the following question:

    Is there anyway a C program can determine if it is being executed in
    the foreground vs. background (via **env or some other mechanism)?

    Is there a similar mechanism for C-shell (csh) scripts?

Any help would be greatly appreciated.

Thanks in advance,

Larry Ader

-------------------------------------------------------------------------
 Larry Ader                      || 
 Amdahl Corporation              ||  ames   \
 1250 E. Arques Ave.  M/S 139    ||  apple   > !amdahl!lra00
 P.O. Box 3470                   ||  att    /
 Sunnyvale, CA   94088-3470      ||  uunet /
 ph. 408/992-2722                ||             or lra00 at amdahl.com
-------------------------------------------------------------------------



More information about the Comp.unix.wizards mailing list