Closed willccoates closed 10 years ago
No, you should just run execv
on whatever the user types in. So if the user types in: asdfgh
, then you should call execv("asdfgh", ... )
. That way, if the user types in bin/ls
, it will first try to run the program in bin/ls
before trying all the combinations in the PATH
variable.
so i should parse the user input, pass to execv, if fails then work with paths?
exactly
i am still confused about this, i get the concept but implementing it is where i get lost. are we supposed to open our current directory, check each item in directory to see if it matches the input and then run exec on the path if it does match?