Hey I want to creat a c program that does the task of the UNIX utility 'which'.
The which utility, in the simplest form, takes one program name and tries to locate this program within the PATH environment variable. If it finds the program, the full path to that program is printed on the terminal otherwise a message about not being able to locate the program will be printed.
I can use the functions getenv() and stat()
Can you give me a logic how to do this?