I'm doing an assignment for a class where I have to make a simplified bash shell in c and opendir is fucking me over right now, though i'm 99% sure i'm using it correctly.
We are not going to do homework for you kid
>>59651369man 3 opendir
>>59651369
>>59651752
how did I know i'd get this one, yeah I've read the fuckin man pages dude
>>59651740
never asked you to
>>59651369
>opendir is fucking me over right now
How so?
>>59652521
ight, thanks for at least hearing me out. so I'm onto running executables from my shell but we aren't aloud to use execvp since they want us to search the PATH ourselves if the arg passed doesn't have a "/" in it. So I get the PATH usint getenv("PATH") and parse it using ":" as a delim, then put each path into an array. but when I call open dir on the first one which is for example "/home/student/bin" it just returns null and actually corrupts my whole array. I used gdb to witness this firsthand, and idk why it won't work
Sorry dude, can't help ya there, best of luck tho
>>59652560
You fucked up elsewhere, run your program through valgrind.
>>59652560
Why use opendir at all? Just loop through PATH. build your path/file, try to execve it. If it fails check errno, if it's ENOENT try the next one.