I'm looking for a way to detect whether or not a program has been called from pipe, e.g.
Code:
whatever | my_program
versus simply just being exectuated directly:
Why? In the first case, I want to run the program non-interactively, and in the latter case I want to print out user-friendly messages. I've been thinking along the lines of some check I haven't yet found, like:
Code:
if( stream_buffer_is_not_empty() )
print_interactive_messages();
Any ideas?
Thanks to you!
Jameson