title: Implementing the "more" Unix utility command
body: <p>i am trying to implement the <code>more</code> command.  I want to learn that how can I understand if there is a pipe.  For example, if I type from the shell</p>
  
  <pre><code>cat file1 file2 | more
  </code></pre>
  
  <p>how can I handle that inside the implementation of more?</p>
  
  <p>And is the implementation of <code>more</code> available as open source?</p>
  
  <p>Actually i could not succeed from reading stdin.I've managed doing more file.txt but not cat file | more..</p>
  
  <p>i think i should first read from user and put a buffer than print the buffer. my code contains:</p>
  
  <pre><code>if(argc == 1)
  {
    fgets(line, 255, 0);
     printf("%s", line);
  } 
  </code></pre>
  
  <p>but it gives error.</p>