In C, what is the way to detect a program was called in "background mode" ? I have a program I would like to launch either interactively or in background.
How can I detect I should not be reading from stdin and end in a "Stopped : tty input" state ?
Should I test that stdin is closed ? How can I do that ?
Edit : isatty seems like a good idea, but what happen if stdin is a pipe end, and not a tty ?