title: where is DIR defined?
body: <p>I have just started reading Advanced Programming in the Unix Environment. The first example is for an ls implementation, the code is below. The only thing I don't understand is where is DIR defined. I looked in apue.h (not there) and in dirent.h (not there). Could anyone please tell me where it is defined?</p>
  
  <pre><code>#include "apue.h"
  #include &lt;dirent.h&gt;
  #include &lt;stdlib.h&gt;
  
  int
  main(int argc, char *argv[])
  {
  DIR             *dp;
  struct dirent   *dirp;
  
  if (argc != 2)
      err_quit("usage: ls directory_name");
  
  if ((dp = opendir(argv[1])) == NULL)
      err_sys("can't open %s", argv[1]);
  while ((dirp = readdir(dp)) != NULL)
      printf("%s\n", dirp-&gt;d_name);
  
  closedir(dp);
  exit(0);
  </code></pre>