How can I tell, in Linux in C, whether stdout and stderr are redirected to a file vs. an interactive shell? I tried playing with stat(2) and the st_mode, but I'm not getting the results I expect. Thanks! --Dave P.S. I'm doing this because I want to disable colors if my output is going to a file, but enable colors if it's a shell.