title: Whether program is executed from command line or invoked through system call
body: <p>Platform is linux and the <code>c</code> code is compiled in gcc.</p>
  
  <p>Is it possible to know from inside the code of program  whether its executable has been executed directly from <em>command line</em> or invoked through "<code>system</code>" call ?
  e.g <code>test.exe</code> can be directly run on command line as <code>./test.exe</code> or executed through <code>system("/home/mydir/test.exe")</code> How do I know inside the running program as to how it was invoked ?</p>