title: execvp() not letting me
body: <p>I'm trying to implement a basic shell in C, but whenever my shell executes a command using execvp(), it skips out of the loop I want it to stay in. I suspect this is because I'm not too familiar with execvp.</p>
  
  <p>Relevant code:</p>
  
  <pre><code>int main()
  {
      int nCmd = 1;                   // Command number
      char *line;                     // Initial command line
      token *list;                    // Linked list of tokens
      CMD *cmd;                       // Parsed command
      int process (CMD *);
  
      for ( ; ; ) {
  
      printf ("(%d)$ ", nCmd);                // Prompt for command
      fflush (stdout);
      if ((line = getLine (stdin)) == NULL)   // Read line
          break;                              //   Break on end of file
  
      list = lex (line);
      // Lex line into tokens
      free (line);
      if (list == NULL) {
          continue;
      } else if (getenv ("DUMP_LIST")) {      // Dump token list only if
          dumpList (list);                    //   environment variable set
          printf ("\n");
      }
  
      cmd = parse (list);                     // Parsed command?
      freeList (list);
      if (cmd == NULL) {
          continue;
      } else if (getenv ("DUMP_TREE")) {      // Dump command tree only if
          dumpTree (cmd, 0);                  //   environment variable set
          printf ("\n");
      }
  
      process (cmd);                          // Execute command
  
      freeCMD (cmd);                          // Free associated storage
      nCmd++;                                 // Adjust prompt
  
      }
  
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>Here are the relevant parts of "process":</p>
  
  <pre><code>int process (CMD *cmdList)
  {
      if ((cmdList-&gt;nLocal)&gt;0)
      {
          for (int i = 0; i&lt;cmdList-&gt;nLocal; i++)
          {
              setenv(cmdList-&gt;locVar[i], cmdList-&gt;locVal[i], 0);
          }
      }
      if (cmdList-&gt;type==SIMPLE)
      {
          execvp(cmdList-&gt;argv[0],cmdList-&gt;argv);
      }
      return 0;
  }
  </code></pre>
  
  <p>What is happening is that I get through the first process in main's for loop fine. However, instead of reading command line in like I want, after the command is executed, the program just ends. How do I get it to stay in the for loop?</p>