<p>I am programming a UNIX shell and I have to use the <code>execv()</code> system call to create a process.
One of the parameters for <code>execv()</code> is the filepath for the executable.  So if somebody types in <code>/bin/ls</code>, it will run the <code>ls</code> executable.  But what I need is a function such that when <code>ls</code> is typed, it will search for the filepath of <code>ls</code> (like the <code>which</code> command).  Is there a function which allows me to do that?</p>
<p>Unfortunately, this is a school project and I am not allowed to use <code>execvp()</code>. I need to implement some path searching function and then add that filepath to the <code>execv()</code> parameter.</p>

I think execvp() does what you need.
Edit:
So you're actually asking how to do this manually? In that case...
Find your PATH in envp (3rd argument to main())
Split this into individual paths
Check for your program's existance in each of these with stat()
Execute the first one you find to exist
Or if you want a
really
solid implementation, use
this
. It might set off the plagarism detectors though :)