title: Using execv() with PATH env variable
body: <p>I'm writing a shell and I want to use <a href="http://pubs.opengroup.org/onlinepubs/009604499/functions/exec.html" rel="nofollow">execv()</a> and search for the right directory through the <code>$PATH</code> environment variable (Yes, I know I can use <code>execvp()</code> and just pass the name of the file to it). </p>
  
  <p>What I'm thinking about doing is getting a string from <code>getenv("PATH")</code>, breaking it down to separate paths then trying each one. But I was wondering if there is an easier way to do it?</p>
  
  <p>I guess the question is: how does <code>execvp()</code> search for the right path?</p>
  
  <p>Thanks!</p>